Implement a simple 2d Line.
Kind: global class
Line
\*
Boolean
Boolean
Number
Boolean
Create the Line.
Param | Type | Description |
---|---|---|
from | Vector2 |
Line start position. |
to | Vector2 |
Line end position. |
Line
Return a clone of this line.
Kind: instance method of Line
Returns: Line
- Cloned line.
\*
Convert to dictionary.
Kind: instance method of Line
Returns: \*
- Dictionary with {from, to}.
Param | Type | Description |
---|---|---|
minimized | Boolean |
If true, will not include keys that their values are 0. You can use fromDict on minimized dicts. |
Boolean
Check if this circle contains a Vector2.
Kind: instance method of Line
Returns: Boolean
- if point is contained within the circle.
Param | Type | Description |
---|---|---|
p | Vector2 |
Point to check. |
threshold | Number |
Distance between point and line to consider as intersecting. Default is 0.5, meaning it will treat point and line as round integers (sort-of). |
Boolean
Check if this line collides with another line.
Kind: instance method of Line
Returns: Boolean
- True if lines collide, false otherwise.
Param | Type | Description |
---|---|---|
other | Line |
Other line to test collision with. |
Number
Get the shortest distance between this line segment and a vector.
Kind: instance method of Line
Returns: Number
- Shortest distance between line and vector.
Param | Type | Description |
---|---|---|
v | Vector2 |
Vector to get distance to. |
Boolean
Check if equal to another circle.
Kind: instance method of Line
Returns: Boolean
- True if circles are equal, false otherwise.
Param | Type | Description |
---|---|---|
other | Circle |
Other circle to compare to. |
Line
Create Line from a dictionary.
Kind: static method of Line
Returns: Line
- Newly created line.
Param | Type | Description |
---|---|---|
data | \* |
Dictionary with {from, to}. |
Line
Lerp between two lines.
Kind: static method of Line
Returns: Line
- result lines.
Param | Type | Description |
---|---|---|
l1 | Line |
First lines. |
l2 | Line |
Second lines. |
a | Number |
Lerp factor (0.0 - 1.0). |