
Implement a simple 2d Line.
Kind: global class
Line\*BooleanBooleanNumberBooleanCreate the Line.
| Param | Type | Description |
|---|---|---|
| from | Vector2 |
Line start position. |
| to | Vector2 |
Line end position. |
LineReturn 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. |
BooleanCheck 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). |
BooleanCheck 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. |
NumberGet 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. |
BooleanCheck 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. |
LineCreate Line from a dictionary.
Kind: static method of Line
Returns: Line - Newly created line.
| Param | Type | Description |
|---|---|---|
| data | \* |
Dictionary with {from, to}. |
LineLerp 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). |