The rectangular bounds of this polygon
The origin point of the source polygon.
The configuration of this polygon.
A cached array of SightRay objects used to compute the polygon.
An indicator for whether this polygon is constrained by some boundary shape?
Compute the polygon using the origin and configuration options.
The computed polygon
Customize the provided configuration object for this polygon type.
The provided polygon origin
The provided configuration object
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.
The constraining boundary shape
A new constrained polygon
Visualize the polygon, displaying its computed area, rays, and collision points
Convert a PIXI.Polygon into an array of clipper points [{X,Y}, ...]. Note that clipper points must be rounded to integers. In order to preserve some amount of floating point precision, an optional scaling factor may be provided.
Options which affect how clipper points are generated
} An array of points to be used by clipper
Intersect this PIXI.Polygon with another PIXI.Polygon using the clipper library.
Another PIXI.Polygon
Options which configure how the intersection is computed
The intersected polygon or null if no solution was present
Intersect this PIXI.Polygon with a PIXI.Circle. For now, convert the circle to a Polygon approximation and use intersectPolygon. In the future we may replace this with more specialized logic which uses the line-circle intersection formula.
A PIXI.Circle
The intersected polygon
Intersect this PIXI.Polygon with a PIXI.Rectangle. For now, convert the rectangle to a Polygon and use intersectPolygon. In the future we may replace this with more specialized logic which uses the line-line intersection formula.
A PIXI.Rectangle
The intersected polygon
Perform the implementation-specific computation
Determine the set of collisions which occurs for a Ray.
The Ray to test
The collision mode being tested
The collision test result
Benchmark the performance of polygon computation for this source
The number of test iterations to perform
The origin point to benchmark
The polygon configuration to benchmark
Compute the polygon given a point origin and radius
The origin source point
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.
An origin point
A destination point
The configuration that defines a certain Polygon type
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
Construct a PIXI.Polygon instance from an array of clipper points [{X,Y}, ...].
Options which affect how canvas points are generated
The resulting PIXI.Polygon
An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source.