An extension of Polygon which is used to represent the line of sight for a point source.

Type Parameters

  • PolygonConfig

Hierarchy (View Summary)

Properties

bounds: Rectangle = ...

The rectangular bounds of this polygon

config: PolygonConfig = {}

The configuration of this polygon.

The origin point of the source polygon.

WALL_DIRECTION_MODES: Readonly<{ BOTH: 2; NORMAL: 0; REVERSED: 1 }> = ...

Customize how wall direction of one-way walls is applied

Accessors

  • get isConstrained(): boolean

    An indicator for whether this polygon is constrained by some boundary shape?

    Returns boolean

Methods

  • Apply a constraining boundary shape to an existing PointSourcePolygon. Return a new instance of the polygon with the constraint applied. The new instance is only a "shallow clone", as it shares references to component properties with the original.

    Parameters

    • constraint: Rectangle | Polygon | Circle

      The constraining boundary shape

    • OptionalintersectionOptions: object = {}

      Options passed to the shape intersection method

    Returns PointSourcePolygon<any>

    A new constrained polygon

  • Create a clone of this polygon. This overrides the default PIXI.Polygon#clone behavior.

    Returns PointSourcePolygon<any>

    A cloned instance

  • Parameters

    • x: any
    • y: any

    Returns boolean

  • Customize the provided configuration object for this polygon type.

    Parameters

    • origin: Point | ElevatedPoint

      The provided polygon origin. The elevation defaults to the elevation of config.source if passed and otherwise 0.

    • config: PolygonConfig

      The provided configuration object

    Returns void

  • Determine if the shape is a complete circle. The config object must have an angle and a radius properties.

    Returns boolean

  • Visualize the polygon, displaying its computed area and applied boundary shapes.

    Returns undefined | Graphics

    The rendered debugging shape

  • Protected

    Perform the implementation-specific computation

    Returns void

  • Protected

    Constrain polygon points by applying boundary shapes.

    Returns void

  • Protected

    Determine the set of collisions which occurs for a Ray.

    Parameters

    • ray: Ray

      The Ray to test

    • mode: "any" | "closest" | "all"

      The collision mode being tested

    • destination: ElevatedPoint

      The destination

    Returns any

    The collision test result

  • Benchmark the performance of polygon computation for this source

    Parameters

    • iterations: number

      The number of test iterations to perform

    • origin: Point | ElevatedPoint

      The origin point to benchmark

    • config: PolygonConfig

      The polygon configuration to benchmark

    Returns Promise<void>

  • Compute the polygon given a point origin and radius

    Parameters

    • origin: Point | ElevatedPoint

      The origin source point. The elevation defaults to the elevation of config.source if passed and otherwise 0.

    • Optionalconfig: any = {}

      Configuration options which customize the polygon computation

    Returns PointSourcePolygon<any>

    The computed polygon instance

  • Test whether a Ray between the origin and destination points would collide with a boundary of this Polygon. A valid wall restriction type is compulsory and must be passed into the config options.

    Parameters

    • origin: Point | ElevatedPoint

      An origin point. The elevation defaults to the elevation of config.source if passed and otherwise 0.

    • destination: Point | ElevatedPoint

      A destination point. The elevation defaults to the elevation of the origin.

    • config: PolygonConfig = {}

      The configuration that defines a certain Polygon type

      • mode

        The collision mode to test: "any", "all", or "closest"

    Returns any

    The collision result depends on the mode of the test: * any: returns a boolean for whether any collision occurred * all: returns a sorted array of PolygonVertex instances * closest: returns a PolygonVertex instance or null