PointSourcePolygon

PointSourcePolygon

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

Constructor

new PointSourcePolygon()

Extends

  • PIXI.Polygon

Members

config :PointSourcePolygonConfig

The configuration of this polygon.

Type:

origin :Point

The origin point of the source polygon.

Type:

rays :Array.<SightRay>

A cached array of SightRay objects used to compute the polygon.

Type:

Methods

(static) benchmark(iterations, …args)

Benchmark the performance of polygon computation for this source

Parameters:
Name Type Attributes Description
iterations number

The number of test iterations to perform

args any <repeatable>

Arguments passed to the compute method

(static) create(origin, configopt) → {PointSourcePolygon}

Compute the polygon given a point origin and radius

Parameters:
Name Type Attributes Default Description
origin Point

The origin source point

config PointSourcePolygonConfig <optional>
{}

Configuration options which customize the polygon computation

Returns:

The computed polygon instance

Type
PointSourcePolygon

(protected) _compute()

Perform the implementation-specific computation

(protected) _getBounds(points) → {Rectangle}

Compute the rectangular bounds for the Polygon.

Parameters:
Name Type Description
points Array.<number>

The initially provided array of coordinates

Returns:

The computed Rectangular bounds

Type
Rectangle

compute() → {PointSourcePolygon}

Compute the polygon using the origin and configuration options.

Returns:

The computed polygon

Type
PointSourcePolygon

initialize(origin, config)

Customize the provided configuration object for this polygon type.

Parameters:
Name Type Description
origin Point

The provided polygon origin

config PointSourcePolygonConfig

The provided configuration object

visualize()

Visualize the polygon, displaying its computed area, rays, and collision points