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

  • Construct an Edge by providing the following information.

    Parameters

    • a: any

      The first endpoint of the edge

    • b: any

      The second endpoint of the edge

    • Optional options: {
          id: string;
          object: PlaceableObject;
          type: EdgeTypes;
          light: WALL_SENSE_TYPES;
          move: WALL_SENSE_TYPES;
          sight: WALL_SENSE_TYPES;
          sound: WALL_SENSE_TYPES;
          direction: WALL_DIRECTIONS;
          threshold: WallThresholdData;
      } = {}

      Additional options which describe the edge

      • id: string

        A string used to uniquely identify this edge

      • object: PlaceableObject

        A PlaceableObject that is responsible for this edge, if any

      • type: EdgeTypes

        The type of edge

      • light: WALL_SENSE_TYPES

        How this edge restricts light

      • move: WALL_SENSE_TYPES

        How this edge restricts movement

      • sight: WALL_SENSE_TYPES

        How this edge restricts sight

      • sound: WALL_SENSE_TYPES

        How this edge restricts sound

      • direction: WALL_DIRECTIONS

        A direction of effect for the edge

      • threshold: WallThresholdData

        Configuration of threshold data for this edge

    Returns Edge

Properties

a: Point

The first endpoint of the edge.

b: Point

The second endpoint of the edge.

id: string

A string used to uniquely identify this edge.

direction: WALL_DIRECTIONS

The direction of effect for the edge.

light: WALL_SENSE_TYPES

How this edge restricts light.

move: WALL_SENSE_TYPES

How this edge restricts movement.

sight: WALL_SENSE_TYPES

How this edge restricts sight.

sound: WALL_SENSE_TYPES

How this edge restricts sound.

threshold: WallThresholdData

Specialized threshold data for this edge.

nw: any

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

se: any

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

bounds: Rectangle

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

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

Record other edges which this one intersects with.

Type declaration

  • edge: Edge
  • intersection: LineIntersection
vertexA: PolygonVertex

A PolygonVertex instance. Used as part of ClockwiseSweepPolygon computation.

vertexB: PolygonVertex

A PolygonVertex instance. Used as part of ClockwiseSweepPolygon computation.

Methods

  • Is this edge limited for a particular type?

    Parameters

    • type: any

    Returns boolean

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

    Returns Edge

  • Get an intersection point between this Edge and another.

    Parameters

    Returns any

  • 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: any

      The origin or position of the source on the canvas

    • Optional externalRadius: 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.

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

    Parameters

    • point: any

      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>

      An iterable of edges

    Returns void