Constructor
new Path(pointsopt)
Instantiates a new object of the class.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
points |
Array.<rune.geom.Point> |
<optional> |
A list of points to represent the path. |
- Source:
- See:
Members
alpha :number
Path transparency (used in debug rendering).
Type:
- number
- Default Value:
- 1
- Source:
color :string
Color to represent the path when it is debug-rendered.
Type:
- string
- Default Value:
- #FFFFFF
- Source:
(readonly) first :rune.geom.Point
Reference to the first point in the path.
Type:
- Source:
(readonly) last :rune.geom.Point
Reference to the last point in the path.
Type:
- Source:
(readonly) length :number
The number of points that make up the path.
Type:
- number
- Source:
thickness :number
The thickness of the path when it is debug-rendered.
Type:
- number
- Default Value:
- 1
- Source:
Methods
add(x, y) → {undefined}
Extends the path by one point (x and y coordinates).
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x-coordinate of the point. |
y |
number | The y-coordinate of the point. |
- Source:
Returns:
- Type
- undefined
addAt(x, y, index) → {undefined}
Adds a point to the path at a specified index.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The x-coordinate of the point. |
y |
number | The y-coordinate of the point. |
index |
number | Index where the point is to be stored. |
- Source:
Returns:
- Type
- undefined
addPoint(point, asReferenceopt) → {undefined}
Extends the path by one point.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
point |
rune.geom.Point | Point to add. | ||
asReference |
boolean |
<optional> |
false | Whether the point should be added as a reference or a new object. |
- Source:
Returns:
- Type
- undefined
addPointAt(point, index, asReferenceopt) → {undefined}
Adds a point to the path at a specified index.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
point |
rune.geom.Point | Point to add. | ||
index |
number | Index where the point is to be stored. | ||
asReference |
boolean |
<optional> |
false | Whether the point should be added as a reference or a new object. |
- Source:
Returns:
- Type
- undefined
compress() → {undefined}
Compress a path by removing unnecessary nodes (points). A compressed path
represents the same path as an uncompressed path, but with fewer nodes.
- Source:
Returns:
- Type
- undefined
getAt(index) → {rune.geom.Point}
Returns a point based on the specified index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Index of the point to be retuned. |
- Source:
Returns:
- Type
- rune.geom.Point
remove(point) → {rune.geom.Point}
Removes a point by reference.
Parameters:
Name | Type | Description |
---|---|---|
point |
rune.geom.Point | Reference to the point to be removed. |
- Source:
Returns:
Reference to the removed point.
- Type
- rune.geom.Point
removeAt(index) → {rune.geom.Point}
Removes a point from the path. The removal is based on an index.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Index of the point to remove. |
- Source:
Returns:
Reference to the removed point.
- Type
- rune.geom.Point