The rectangular bounds of this polygon
The origin point of the source polygon.
The configuration of this polygon.
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
A new constrained polygon
Visualize the polygon, displaying its computed area and applied boundary shapes.
The rendered debugging shape
Determine if the shape is a complete circle. The config object must have an angle and a radius properties.
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 an array of ClipperPoints.
Array of clipper points generated by PIXI.Polygon.toClipperPoints()
Options which configure how the intersection is computed
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
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
Get the super-set of walls which could potentially apply to this polygon. Define a custom collision test used by the Quadtree to obtain candidate Walls.
Compute the aggregate bounding box which is the intersection of all boundary shapes. Round and pad the resulting rectangle by 1 pixel to ensure it always contains the origin.
Constrain polygon points by applying boundary shapes.
Determine the set of collisions which occurs for a Ray.
The Ray to test
The collision mode being tested
The collision test result
Configure a limited angle and rotation into a triangular polygon boundary shape.
Configure a provided limited radius as a circular polygon boundary shape.
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
Augment a PointSourcePolygon by adding additional coverage for shapes permitted by threshold walls.
The computed polygon
The augmented polygon
Construct a PIXI.Polygon instance from an array of clipper points [{X,Y}, ...].
An array of points returned by clipper
Options which affect how canvas points are generated
The resulting PIXI.Polygon
For 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
Calculate 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 wall 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
Union 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.