Line
class Line extends Polygon
a line segment Object
Constructor
Summary
Properties inherited from Polygon
Array<Vector2d> |
|
Vector2d |
|
string |
|
Methods inherited from Polygon
Bounds |
|
Array<number> |
|
boolean |
|
Polygon |
|
Polygon |
|
Polygon |
|
Polygon |
|
Polygon |
|
|
|
Polygon |
|
Polygon |
|
Polygon |
|
Polygon |
|
Bounds |
|
Public Methods
contains(x: number | Vector2d, y: number) → {boolean}
Returns true if the Line contains the given point
if (line.contains(10, 10)) {
// do something
}
// or
if (line.contains(myVector2d)) {
// do something
}
Name | Type | Attributes | Description |
---|---|---|---|
x | number | Vector2d |
x coordinate or a vector point to check |
|
y | number |
<optional> |
y coordinate |
Type | Description |
---|---|
boolean |
true if contains |
recalc() → {Line}
Computes the calculated collision edges and normals.
This must be called if the points
array, angle
, or offset
is modified manually.
Type | Description |
---|---|
Line |
this instance for objecf chaining |