Header menu logo Euclid

Loop Type

A counter-clockwise, closed series of 2D points. Checked for too short segments and duplicate points but might have colinear points. Checked for self intersection. This class stores for each segment precomputed list of unit-vectors, lengths and bounding Rectangles. This is to have better performance when calculating Loop with Loop intersections or point containment.

Instance members

Instance member Description

this.Area

Full Usage: this.Area

Returns: float

Without sign, since loop is guaranteed to be Counter Clockwise. This Value is precomputed in constructor.

Returns: float

this.BRects

Full Usage: this.BRects

Returns: BRect[]

A List of precomputed bounding rectangles for each segment. Each bounding rectangle is expanded by the SnapThreshold. This list is one item shorter than Points.

Returns: BRect[]

this.Clone

Full Usage: this.Clone

Returns: Loop

Creates a deep copy.

Returns: Loop

this.ClosestPoint

Full Usage: this.ClosestPoint

Parameters:
Returns: Pt

Returns the closest point.

pt : Pt
Returns: Pt

this.ClosestSegment

Full Usage: this.ClosestSegment

Parameters:
Returns: int

Returns closest segment index.

pt : Pt
Returns: int

this.ClosestSegments

Full Usage: this.ClosestSegments

Parameters:
Returns: int * int

Returns closest and second closest segment index. They might both contain the closest point. ( in the corner where they meet)

pt : Pt
Returns: int * int

this.ContainsPoint

Full Usage: this.ContainsPoint

Parameters:
Returns: PointLoopRel

Returns Relation between point and Loop: Inside, On or Outside. Tolerance for being on Loop is SnapThreshold.

pt : Pt
Returns: PointLoopRel

this.ExpandedBoundingRect

Full Usage: this.ExpandedBoundingRect

Returns: BRect

The overall bounding rectangle. Including an expansion by snapThreshold.

Returns: BRect

this.Lengths

Full Usage: this.Lengths

Returns: float[]

A List of the lengths of each segment. This list is one item shorter than Points.

Returns: float[]

this.MinSegmentLength

Full Usage: this.MinSegmentLength

Returns: float

The minimum distance between points in this loop, This is a parameter at creation.

Returns: float

this.Points

Full Usage: this.Points

Returns: ResizeArray<Pt>

This list is one item Longer than vectors, BRects or Lengths. Last point equals the first point.

Returns: ResizeArray<Pt>

this.SegmentCount

Full Usage: this.SegmentCount

Returns: int

One less than Points count.

Returns: int

this.SnapThreshold

Full Usage: this.SnapThreshold

Returns: float

This value is used when calculating intersection or point containment. Points within this distance of the segment will be considered on the segment. This parameter needs to be set at creation since it is used in pre-computations of bounding rectangles.

Returns: float

this.UnitVectors

Full Usage: this.UnitVectors

Returns: UnitVc[]

A List of precomputed UnitVectors for each segment. This list is one item shorter than Points.

Returns: UnitVc[]

this.WindingNumber

Full Usage: this.WindingNumber

Parameters:
    point : Pt - The point to check winding around

Returns: int The winding number, if it is not 0 then point is contained in the Loop

Returns the winding number for this polygon, around a given point

point : Pt

The point to check winding around

Returns: int

The winding number, if it is not 0 then point is contained in the Loop

Static members

Static member Description

Loop.create minSegmentLength snapThreshold points

Full Usage: Loop.create minSegmentLength snapThreshold points

Parameters:
    minSegmentLength : float
    snapThreshold : float
    points : IList<Pt>

Returns: Loop

Creates a Loop from series of points. Checks for too short segments. Closes loop if not closed yet. Makes it Counterclockwise. Also check for self intersection. Does NOT remove colinear points.

minSegmentLength : float
snapThreshold : float
points : IList<Pt>
Returns: Loop

Type something to start searching.