351 virtual void Reset();
502 virtual void Reset();
508#ifdef REGION_SANITY_CHECK
513class MxRectIntersection {
523 MxRect32& GetRect() {
return m_rect; }
529 void SetRect(
MxRect32& p_rect) { m_rect = p_rect; }
535 MxS32 GetNumRects() {
return m_numRects; }
541 void SetNumRects(
MxS32 p_numRects) { m_numRects = p_numRects; }
547class MxRectIntersectionList :
public MxPtrList<MxRectIntersection> {
552 MxRectIntersectionList() :
MxPtrList<MxRectIntersection>(
TRUE) {}
558class MxRectIntersectionListCursor :
public MxPtrListCursor<MxRectIntersection> {
564 MxRectIntersectionListCursor(MxRectIntersectionList* p_list) :
MxPtrListCursor<MxRectIntersection>(p_list) {}
570class MxRegionSanityCheck {
572 MxRectIntersectionList* m_rectIntersectionList;
578 MxRegionSanityCheck();
583 ~MxRegionSanityCheck();
588 void Reset() { m_rectIntersectionList->Delete(); }
600 MxS32 CalculateArea();
[AI] Base virtual class for all Mindscape engine (Mx) objects.
MxU32 GetNumElements()
[AI]
[AI] Rectangle using 32-bit signed integer coordinates.
T GetTop() const
[AI] Get the top edge.
T GetRight() const
[AI] Get the right edge.
T GetBottom() const
[AI] Get the bottom edge.
[AI] Cursor object suitable for traversing all rectangles covered by an MxRegion.
void PrevSpan(MxRect32 &p_rect)
[AI] Step to the previous span (reverse traversal) intersecting p_rect.
virtual void Reset()
[AI] Resets the cursor(s) to the initial (uninitialized) state.
virtual MxRect32 * Prev()
[AI] Steps backward to and returns the previous rectangle in region sequence.
virtual MxBool Valid()
[AI] Checks if the cursor is currently referencing a valid rectangle (not at end).
void SetRect(MxS32 p_left, MxS32 p_top, MxS32 p_right, MxS32 p_bottom)
[AI] Initializes or updates m_rect with the specified coordinates.
MxRegion * m_region
[AI] The region being traversed. [AI]
MxSegmentListCursor * m_segListCursor
[AI] Cursor for the current segment list. [AI]
virtual MxRect32 * Head()
[AI] Seeks to and returns the first (topmost, leftmost) rectangle covered by the region.
void CreateSegmentListCursor(MxSegmentList *p_segList)
[AI] Allocates a segment list cursor for the given segment list, replacing any previous segment curso...
MxSpanListCursor * m_spanListCursor
[AI] Cursor for moving through the span list. [AI]
MxRect32 * m_rect
[AI] Current rectangle being referenced. [AI]
void NextSpan(MxRect32 &p_rect)
[AI] Step to the next span which overlaps p_rect (for filtered/region-clip traversal).
virtual MxRect32 * GetRect()
[AI] Returns a pointer to the currently referenced rectangle.
~MxRegionCursor() override
[AI] Destructor; releases ownership of current rectangle and cursors.
virtual MxRect32 * Next()
[AI] Advances to and returns the next rectangle in region sequence.
virtual MxRect32 * Tail()
[AI] Seeks to and returns the last (bottommost, rightmost) rectangle covered by the region.
[AI] Represents a 2D region as a set of vertical spans each containing one or more horizontal segment...
virtual void Reset()
[AI] Removes all spans and resets the bounding rectangle to an empty state.
MxRect32 & GetBoundingRect()
[AI] Returns a reference to the current bounding rectangle for the region.
MxSpanList * m_spanList
[AI] List of vertical spans for the region. [AI]
void Compact()
[AI] Compacts the region's internal structure, merging adjacent/overlapping spans and segments when p...
MxRegion()
[AI] Constructs an (initially empty) region.
virtual void AddRect(MxRect32 &p_rect)
[AI] Adds a rectangle to this region, merging or splitting spans and segments as necessary.
~MxRegion() override
[AI] Destructor; destroys all spans and contained segments.
virtual MxBool IsEmpty()
[AI] Returns TRUE if the region contains zero spans (i.e., is empty).
virtual MxBool Intersects(MxRect32 &p_rect)
[AI] Checks if this region intersects with a given rectangle (any overlap between the region's covere...
MxRect32 m_boundingRect
[AI] Cached bounding rectangle for the whole region. [AI]
[AI] Cursor for traversing an MxSegmentList; allows sequential access through the segments.
MxSegmentListCursor(MxSegmentList *p_list)
[AI] Constructs a cursor to navigate the given segment list.
[AI] List container for segments; stores pointers to MxSegment objects and may take ownership dependi...
MxSegmentList()
[AI] Constructs a segment list that takes ownership and deletes segments on destruction/removal.
[AI] Represents a 1D segment defined by a minimum and maximum integer value.
MxBool Combine(MxSegment &p_seg)
[AI] Attempt to merge this segment with the specified segment, if they are adjacent or overlapping.
MxBool IntersectsH(MxRect32 &p_rect)
[AI] Determines if this segment horizontally intersects a given rectangle, interpreted as an interval...
MxS32 m_min
[AI] Lower boundary of the segment (inclusive). [AI]
MxS32 m_max
[AI] Upper boundary of the segment (exclusive). [AI]
MxSegment * Clone()
[AI] Creates a copy of the current segment.
MxS32 GetMin()
[AI] Returns the lower boundary of the segment (inclusive).
MxBool Adjacent(MxSegment &p_seg)
[AI] Checks if this segment is adjacent to another (i.e., ends where the other begins or vice versa).
MxBool operator!=(MxSegment &p_seg)
[AI] Inequality operator: checks if this segment differs from the specified segment by its boundaries...
MxBool operator==(MxSegment &p_seg)
[AI] Equality operator: checks if this segment has identical boundaries to the specified segment.
MxSegment(MxS32 p_min, MxS32 p_max)
[AI] Constructs a new segment with the specified minimum and maximum boundaries.
MxS32 GetMax()
[AI] Returns the upper boundary of the segment (exclusive).
[AI] Cursor for traversing an MxSpanList, to sequentially access all spans in the list.
MxSpanListCursor(MxPtrList< MxSpan > *p_list)
[AI] Cursor for any list of span pointers.
[AI] List container for spans; holds MxSpan pointers and may automatically destroy them.
MxSpanList()
[AI] Constructs a new span list which owns its entries.
[AI] Represents a vertical span—a 1D range plus a set of contained horizontal segments,...
MxS32 m_max
[AI] Upper vertical boundary (usually 'bottom'). [AI]
void Compact()
[AI] Compact this span, potentially merging adjacent or overlapping segments for optimal storage.
MxS32 GetMax()
[AI] Returns the vertical upper boundary of the span.
~MxSpan()
[AI] Destructor; releases the segment list and owned segments inside this span.
MxS32 GetMin()
[AI] Returns the vertical lower boundary of the span.
MxBool IntersectsH(MxRect32 &p_rect)
[AI] Checks if any segment in this span horizontally overlaps with the given rectangle.
MxBool operator==(MxSpan &p_span)
[AI] Tests for equality (vertical bounds and segments) with another span.
void AddSegment(MxS32 p_min, MxS32 p_max)
[AI] Adds a horizontal segment to this span, merging with adjacent segments if required to maintain c...
MxBool Adjacent(MxSpan &p_span)
[AI] Checks if this span is vertically adjacent to another (end-to-end).
void SetMin(MxS32 p_min)
[AI] Sets the vertical lower boundary of the span.
void SetMax(MxS32 p_max)
[AI] Sets the vertical upper boundary of the span.
MxSegmentList * m_segList
[AI] List of horizontal segments covered by this vertical span. [AI]
MxSpan * Clone()
[AI] Deep copies this span, including all its attached segments.
MxBool Combine(MxSpan &p_span)
[AI] Tries to merge this span with another, if possible (must be adjacent and have matching segments)...
MxBool HasSameSegments(MxSpan &p_span)
[AI] Checks for pointwise segment equivalence between two spans.
MxBool IntersectsV(MxRect32 &p_rect)
[AI] Check if this span vertically intersects a rectangle (vertical ranges overlap).
MxBool operator!=(MxSpan &p_span)
[AI] Tests for inequality with another span.
MxS32 m_min
[AI] Lower vertical boundary (usually 'top'). [AI]
#define NULL
[AI] Null pointer value (C/C++ semantics).