A data structure used to represent potential edges used by the ClockwiseSweepPolygon. Edges are not polygon-specific, meaning they can be reused across many polygon instances.

Constructors

Properties

a: Point

The first endpoint of the edge.

b: Point

The second endpoint of the edge.

bounds: Rectangle

The rectangular bounds of the edge. Used by the quadtree.

direction: WallDirection

The direction of effect for the edge.

id: string

A string used to uniquely identify this edge.

intersections: { edge: Edge; intersection: LineIntersection }[] = []

Record other edges which this one intersects with.

How this edge restricts light.

How this edge restricts movement.

nw: Point

The endpoint of the edge which is oriented towards the top-left.

se: Point

The endpoint of the edge which is oriented towards the bottom-right.

How this edge restricts sight.

How this edge restricts sound.

Specialized threshold data for this edge.

vertexA: PolygonVertex

A PolygonVertex instance. Used as part of ClockwiseSweepPolygon computation.

vertexB: PolygonVertex

A PolygonVertex instance. Used as part of ClockwiseSweepPolygon computation.

Methods

  • Test whether to apply a proximity threshold to this edge. If the proximity threshold is met, this edge excluded from perception calculations.

    Parameters

    • sourceType: string

      Sense type for the source

    • sourceOrigin: Point

      The origin or position of the source on the canvas

    • OptionalexternalRadius: number = 0

      The external radius of the source

    Returns boolean

    True if the edge has a threshold greater than 0 for the source type, and the source type is within that distance.

  • Create a copy of the Edge which can be safely mutated.

    Returns Edge

  • Is this edge limited for a particular type?

    Parameters

    • type: "light" | "sight" | "sound" | "move"

    Returns boolean

  • Determine the orientation of this Edge with respect to a reference point.

    Parameters

    • point: Point

      Some reference point, relative to which orientation is determined

    Returns number

    An orientation in CONST.WALL_DIRECTIONS which indicates whether the Point is left, right, or collinear (both) with the Edge

  • Record the intersections between two edges.

    Parameters

    • other: Edge

      Another edge to test and record

    Returns void

  • Remove intersections of this edge with all other edges.

    Returns void

  • Identify intersections between a provided iterable of edges.

    Parameters

    • edges: Iterable<Edge, any, any>

      An iterable of edges

    Returns void