2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-11-06 18:20:45 +01:00
|
|
|
title: Point.sitsOn()
|
2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-08-25 16:09:31 +02:00
|
|
|
|
2021-11-06 18:20:45 +01:00
|
|
|
Returns `true` if this point has the _exact_ same coordinates as the point you pass to it.
|
|
|
|
|
|
|
|
<Note>
|
|
|
|
|
|
|
|
###### Too exact?
|
|
|
|
|
|
|
|
This method is _very_ precise, so points with an X-coordinate of `10` and `10.0001`
|
|
|
|
are considered to be different.
|
|
|
|
|
|
|
|
To check if two points have the same coordinates rounded to the nearest
|
|
|
|
millimeter, use [`Point.sitsRoughlyOn()`](/reference/api/point/sitsroughlyon/) instead.
|
|
|
|
|
|
|
|
</Note>
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
bool point.sitsOn(Point check)
|
|
|
|
```
|
|
|
|
|
2021-11-06 18:20:45 +01:00
|
|
|
<Example
|
2021-10-17 18:26:00 +02:00
|
|
|
part="point_sitson"
|
|
|
|
caption="An example of the Point.sitsOn() method"
|
2021-08-25 16:09:31 +02:00
|
|
|
/>
|
|
|
|
|
|
|
|
```js
|
|
|
|
let { Point, points, Snippet, snippets } = part.shorthand();
|
|
|
|
|
|
|
|
let s;
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
points[`a${i}`] = new Point(i * 10, 40);
|
|
|
|
points[`b${i}`] = new Point(i * 10, i * 8);
|
|
|
|
if (points[`a${i}`].sitsOn(points[`b${i}`])) s = "notch";
|
|
|
|
else s = "bnotch";
|
|
|
|
snippets[`b${i}`] = new Snippet(s, points[`b${i}`]);
|
|
|
|
snippets[`a${i}`] = new Snippet(s, points[`a${i}`]);
|
|
|
|
}
|
|
|
|
```
|