2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
title: Point
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
A Point object represents a point on a 2D plane with an X and Y axis.
|
|
|
|
|
2022-09-29 15:29:39 +02:00
|
|
|
## Signature
|
|
|
|
|
|
|
|
```js
|
|
|
|
Point new Point(Number x, Number y)
|
|
|
|
```
|
|
|
|
|
|
|
|
The point constructor takes two arguments:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-02-20 14:44:38 +01:00
|
|
|
- `x` : The X-coordinate of the point
|
|
|
|
- `y` : The Y-coordinate of the point
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-12-14 21:24:28 -08:00
|
|
|
## Properties
|
2022-09-29 15:29:39 +02:00
|
|
|
|
|
|
|
Point objects come with the following properties:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-02-20 14:44:38 +01:00
|
|
|
- `x` : The X-coordinate of the point
|
|
|
|
- `y` : The Y-coordinate of the point
|
2022-12-08 22:37:22 -08:00
|
|
|
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the point's attributes
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2024-09-28 13:13:48 +02:00
|
|
|
:::note RELATED
|
2022-12-14 21:24:28 -08:00
|
|
|
See [Using Attributes](/howtos/code/attributes)
|
|
|
|
for information about custom Attributes that can be used with Points.
|
2024-09-28 13:13:48 +02:00
|
|
|
:::
|
2022-12-14 21:24:28 -08:00
|
|
|
|
2022-09-29 15:29:39 +02:00
|
|
|
## Example
|
|
|
|
|
|
|
|
<Example caption="Example of the Point constructor">
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
2022-09-29 15:29:39 +02:00
|
|
|
({ Point, points, part }) => {
|
|
|
|
points.example = new Point(0,0)
|
|
|
|
.addCircle(10)
|
|
|
|
|
|
|
|
return part
|
|
|
|
}
|
2021-08-25 16:09:31 +02:00
|
|
|
```
|
2022-09-29 15:29:39 +02:00
|
|
|
</Example>
|
|
|
|
|
|
|
|
## Methods
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2022-09-29 15:29:39 +02:00
|
|
|
A Point object exposes the following methods:
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2024-01-29 08:43:38 -08:00
|
|
|
<ReadMore />
|