illuminated.LineObject Class
An opaque line object
Constructor
illuminated.LineObject
-
[options]
Parameters:
-
[options]
Object optionalOptions to be applied to this line object.
-
[a]
illuminated.Vec2 optionalA vector that is the first point of the line.
-
[b]
illuminated.Vec2 optionalA vector that is the last point of the line.
-
Item Index
Methods
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.
syncFromAB
()
private
Initializes the points defining this line based on its options.
Properties
a
Vec2
A vector that is the first point of the line.
Default: new illuminated.Vec2()
b
Vec2
A vector that is the last point of the line.
Default: new illuminated.Vec2()
diffuse
Number
How diffuse this opaque object should be.
Default: 0.8