illuminated.PolygonObject Class
An opaque polygon object
Constructor
illuminated.PolygonObject
-
[options]
Parameters:
-
[options]
Object optionalOptions to be applied to this disc object.
-
points
ArrayAn array of illuminated.Vec2 points that define the polygon.
-
[diffuse]
Number optionalHow diffuse this polygon object should be.
-
Methods
_forEachVisibleEdges
-
origin
-
bounds
-
f
Invoke a function for each of the visible edges in this polygon.
Parameters:
-
origin
illuminated.Vec2A vector that represents the origin for the casted shadows.
-
bounds
ObjectAn anonymous object with the properties topleft and bottomright. The property values are illuminated.Vec2 objects representing the corners of the boundary of this polygon.
-
f
FunctionThe function to be invoked.
bounds
()
Object
Calculate the boundaries of this polygon object.
Returns:
cast
-
ctx
-
origin
-
bounds
Fill ctx with the shadows projected by this polygon object from the origin point, constrained by the given bounds.
Parameters:
-
ctx
CanvasRenderingContext2DThe canvas context onto which the shadows will be cast.
-
origin
illuminated.Vec2A vector that represents the origin for the casted shadows.
-
bounds
ObjectAn anonymous object with the properties topleft and bottomright. The property values are illuminated.Vec2 objects representing the corners of the boundary.
contains
-
point
Determine if the given point is inside the polygon.
Parameters:
-
point
illuminated.Vec2The point to be checked.
Returns:
path
-
ctx
Draw the path of the polygon onto the ctx.
Parameters:
-
ctx
CanvasRenderingContext2DThe context onto which the path will be drawn.
Properties
diffuse
Number
How diffuse this opaque object should be.
Default: 0.8