The rectangular bounds of this polygon
The origin point of the source polygon.
The configuration of this polygon.
Private
#rayssince v11
Static
WALL_Customize how wall direction of one-way walls is applied
An indicator for whether this polygon is constrained by some boundary shape?
Create a clone of this polygon. This overrides the default PIXI.Polygon#clone behavior.
A cloned instance
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
Optional
intersectionOptions: object = {}Options passed to the shape intersection method
A new constrained polygon
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.
Optional
options: { Options which affect how clipper points are generated
A scaling factor used to preserve floating point precision
An array of points to be used by clipper
Intersect this PIXI.Polygon with another PIXI.Polygon using the clipper library.
Another PIXI.Polygon
Optional
options: { Options which configure how the intersection is computed
The clipper clip type
A scaling factor passed to Polygon#toClipperPoints to preserve precision
The intersected polygon
Intersect this PIXI.Polygon with an array of ClipperPoints.
Array of clipper points generated by PIXI.Polygon.toClipperPoints()
Optional
options: { Options which configure how the intersection is computed
The clipper clip type
A scaling factor passed to Polygon#toClipperPoints to preserve precision
The resulting ClipperPaths
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
Optional
options: { Options which configure how the intersection is computed
The number of points which defines the density of approximation
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
Optional
options: objectOptions which configure how the intersection is computed
The intersected polygon
Protected
_computeProtected
_constrainProtected
_testProtected
Determine the set of collisions which occurs for a Ray.
The Ray to test
The collision mode being tested
The collision test result
Private
#configurePrivate
#configureStatic
benchmarkBenchmark 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
Static
createCompute the polygon given a point origin and radius
The origin source point
Optional
config: PointSourcePolygonConfig = {}Configuration options which customize the polygon computation
The computed polygon instance
Static
testTest 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
Static
applyAugment a PointSourcePolygon by adding additional coverage for shapes permitted by threshold walls.
The computed polygon
The augmented polygon
Static
fromConstruct a PIXI.Polygon instance from an array of clipper points [{X,Y}, ...].
An array of points returned by clipper
Optional
options: { Options which affect how canvas points are generated
A scaling factor used to preserve floating point precision
The resulting PIXI.Polygon
Static
Private
#getStatic
Private
#createFor each threshold wall that this source passes through construct a shape representing the attenuated source. The attenuated shape is a circle with a radius modified by origin proximity to the threshold wall. Intersect the attenuated shape against the LOS with threshold walls considered. The result is the LOS for the attenuated light source.
The computed polygon with thresholds applied
The identified array of threshold walls
The resulting array of intersected threshold shapes
Static
Private
#calculateCalculate the attenuation of the source as it passes through the threshold wall. The distance of perception through the threshold wall depends on proximity of the source from the wall.
The Edge for which this threshold applies
Origin point on the canvas for this source
Radius to use for this source, before considering attenuation
The external radius of the source
Sense type for the source
The inside and outside portions of the radius
Static
Private
#combineUnion the attenuated shape-LOS intersections with the closed LOS. The portion of the light sources "inside" the threshold walls are not modified from their default radius or shape. Clipper can union everything at once. Use a positive fill to avoid checkerboard; fill any overlap.
The LOS polygon with threshold walls inactive
Attenuation shapes for threshold walls
The combined LOS polygon with threshold shapes
An extension of the default PIXI.Polygon which is used to represent the line of sight for a point source.