A specialized point data structure used to represent vertices in the context of the ClockwiseSweepPolygon. This class is not designed or intended for use outside of that context.

Constructors

  • Construct a PolygonVertex by providing {x, y} coordinates and vertex options.

    Parameters

    • x: number

      The x-coordinate of the vertex

    • y: number

      The y-coordinate of the vertex

    • Optionaloptions: PolygonVertexOptions = {}

      Options which modify vertex context or behavior

    Returns PolygonVertex

Properties

_angle: undefined | number

The angle of the ray from the origin to this vertex.

_d2: undefined | number

The squared distance from a polygon origin to this vertex.

_distance: undefined | number

The distance from a polygon origin to this vertex.

_index: undefined | number

The integer index of this vertex in an ordered sweep.

_intersectionCoordinates: undefined | LineIntersection

The line intersection coordinates of the two edges that create this vertex.

_visited: boolean = false

Record whether this PolygonVertex has been visited in the sweep

ccwEdges: EdgeSet = ...

The subset of edges which continue counter-clockwise from this vertex.

collinearVertices: Set<PolygonVertex> = ...

The set of vertices collinear to this vertex

cwEdges: EdgeSet = ...

The subset of edges which continue clockwise from this vertex.

edges: EdgeSet = ...

The set of edges which connect to this vertex. This set is initially empty and populated later after vertices are de-duplicated.

isBlockingCCW: boolean

Does this vertex have non-limited edges or 2+ limited edges counterclockwise?

isBlockingCW: boolean

Does this vertex have non-limited edges or 2+ limited edges clockwise?

isEndpoint: boolean

Is this vertex an endpoint of one or more edges?

isInternal: boolean = false

Does this vertex result from an internal collision?

isLimitingCCW: boolean

Does this vertex have a single counterclockwise limiting edge?

isLimitingCW: boolean

Does this vertex have a single clockwise limiting edge?

restriction: number = 0

The maximum restriction imposed by this vertex.

Accessors

  • get isLimited(): boolean

    Is this vertex limited in type?

    Returns boolean

Methods

  • Associate an edge with this vertex.

    Parameters

    • edge: Edge

      The edge being attached

    • orientation: number

      The orientation of the edge with respect to the origin

    • type: string

      The restriction type of polygon being created

    Returns void

  • Is this vertex the same point as some other vertex?

    Parameters

    Returns boolean

    Are they the same point?

  • Determine the sort key to use for this vertex, arranging points from north-west to south-east.

    Parameters

    • x: number

      The x-coordinate

    • y: number

      The y-coordinate

    Returns number

    The key used to identify the vertex