TRectangle

TRectangle related methods

Type definition is found in shared/globals.simba

The rectangle is defined in clockwise order, from Top to Left


TRectangle.ToTPA

function TRectangle.ToTPA(): TPointArray; constref;

TPA from the rectangle.


TRectangle.Bounds

function TRectangle.Bounds(): TBox; constref;

Returns the minimum bounding box covering the rectangle


TRectangle.Radius

function TRectangle.Radius(): Double; constref;

Returns the radius of the shortest side, for the maximum see MaxRadius


TRectangle.MaxRadius

function TRectangle.MaxRadius(): Double; constref;

Returns the radius of the longest side, for minimum see Radius


TRectangle.Mean

function TRectangle.Mean(): TPoint; constref;

Middle of the rectangle

Note

By slacky


TRectangle.FixOrder

function TRectangle.FixOrder(): TRectangle; constref;

As long as the order of the points are clockwise, this will shift the points so that Top, is the topmost,Right is the right-most etc…


TRectangle.Rotate

function TRectangle.Rotate(Angle: Double): TRectangle; constref;

Returns a rotated copy of the rectangle


TRectangle.Contains

function TRectangle.Contains(pt: TPoint): Boolean; constref;

Returns true if the point pt is inside the rectangle.


TRectangle.DirByLen

function TRectangle.DirByLen(Longest: Boolean=True): ESplitDirection; constref;

Returns the direction which is the longest or shortest.

Note

By slacky


TRectangle.Partition

function TRectangle.Partition(m,n:Int32; dir:ESplitDirection=rpTopLeft): TRectArray; constref;

Break the rectangle into smaller rectangles. Goes well along with DirByLen

Note

By slacky


TRectangle.Offset

function TRectangle.Offset(pt: TPoint): TRectangle; constref;

Offset the rectangle.


TRectangle.Filter

function TRectangle.Filter(testSet: TPointArray): TPointArray; constref;

Extract all the points from testSet that fits within this rectangle.


TRectangle.Expand

function TRectangle.Expand(Inc: Int32): TRectangle; constref;

Increase or decrease the dimensions of the rectangle.


TRectangle.NearestEdge

function TRectangle.NearestEdge(P: TPoint): TPoint; constref;

Returns the closest edge point (think Rect.ToTPA.Connect) to the TPoint P.