2021-10-17 18:26:00 +02:00
|
|
|
---
|
2021-11-06 18:20:45 +01:00
|
|
|
title: Point.sitsRoughlyOn()
|
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 roughly (rounded to the nearest millimeter) the same coordinates as the one you pass to it.
|
|
|
|
|
2021-11-06 19:03:54 +01:00
|
|
|
## Point.sitsRoughlyOn() signature
|
|
|
|
|
2021-08-25 16:09:31 +02:00
|
|
|
```js
|
|
|
|
bool point.sitsRoughlyOn(Point check)
|
|
|
|
```
|
|
|
|
|
|
|
|
<Note>
|
|
|
|
|
|
|
|
###### How rough?
|
|
|
|
|
2021-11-06 18:20:45 +01:00
|
|
|
The difference between this method and [`Point.sitsOn()`](/reference/api/point/sitson/) is
|
2021-08-25 16:09:31 +02:00
|
|
|
that this one rounds things down to the nearest integer (thus mm) before checking.
|
|
|
|
|
|
|
|
</Note>
|
|
|
|
|
2021-11-06 19:03:54 +01:00
|
|
|
## Point.sitsRoughlyOn() example
|
|
|
|
|
2022-01-19 11:31:39 +01:00
|
|
|
<Example part="point_sitsroughlyon">
|
|
|
|
An example of the Point.sitsRoughlyOn() method
|
|
|
|
</Example>
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
let { Point, points, Snippet, snippets } = part.shorthand();
|
|
|
|
|
|
|
|
box(part);
|
|
|
|
|
|
|
|
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}`].sitsRoughlyOn(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}`]);
|
|
|
|
}
|
|
|
|
```
|