Constructor
new QuadtreeExpansionPolygon()
Extends
Members
config :object
- Inherited From:
The limiting radius of the polygon, if applicable
Type:
- object
origin :Point
- Inherited From:
The origin point of the source polygon.
Type:
rays :Array.<SightRay>
- Overrides:
A cached array of SightRay objects used to compute the polygon.
Type:
Methods
(static) create()
_castRays(x, y, distance, density, endpoints, limitAngle, aMin, aMax) → {Array.<Ray>}
A helper method responsible for casting rays at wall endpoints. Rays are restricted by limiting angles.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The origin x-coordinate |
y |
number | The origin y-coordinate |
distance |
number | The ray distance |
density |
number | The desired radial density |
endpoints |
Array.<PointArray> | An array of endpoints to target |
limitAngle |
boolean | Whether the rays should be cast subject to a limited angle of emission |
aMin |
number | The minimum bounding angle |
aMax |
number | The maximum bounding angle |
Returns:
An array of Ray objects
(protected) _getBounds(points) → {Rectangle}
- Inherited From:
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
_getClosestCollision(collisions) → {RayIntersection|null}
Identify the closest collision point from an array of collisions
Parameters:
Name | Type | Description |
---|---|---|
collisions |
Array.<RayIntersection> | An array of intersection points |
Returns:
The closest blocking intersection or null if no collision occurred
- Type
- RayIntersection | null
_testWall(ray, wall) → {RayIntersection|null}
Test a single Ray against a single Wall
Parameters:
Name | Type | Description |
---|---|---|
ray |
Ray | The Ray being tested |
wall |
Wall | The Wall against which to test |
Returns:
A RayIntersection if a collision occurred, or null
- Type
- RayIntersection | null
compute()
- Overrides:
Compute the polygon using the origin and configuration options.
initialize(origin, config) → {object}
- Inherited From:
Customize the provided configuration object for this polygon type.
Parameters:
Name | Type | Description |
---|---|---|
origin |
Point | The provided polygon origin |
config |
object | The provided configuration object |
Returns:
The initialized object
- Type
- object
visualize()
- Inherited From:
Visualize the polygon, displaying its computed area, rays, and collision points