point(index, [point_or_x], [y])
Class: Polygon.
Description:
Sets or gets a point of the Polygon {x:number, y:number} at a specified index.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
number |
Index of the existing point to update. |
|
|
Point | number |
New point object or X coordinate of the new point. |
|
|
number |
Y coordinate of the new point. |
Returns:
When getting a point, returns a point object or throws and Error. When setting the point, returns this Polygon or throws an Error.
Examples:
Updating a point at index 3:
polygon.point(3, 50, 80); // x = 50, y = 80
// or...
polygon.point(3, {x:50, y:80});
Getting a point at index 3:
let p = polygon.point(3);
