1
0
Fork 0

chore(markdown): Updated utils docs for v3

This commit is contained in:
Joost De Cock 2022-10-01 22:20:43 +02:00
parent acf1b72c4c
commit bc3b0cd770
23 changed files with 782 additions and 622 deletions

View file

@ -1,7 +1,13 @@
---
title: beamsIntersect()
title: uils.beamsIntersect()
---
The `utils.beamsIntersect()` function finds the intersection between two endless
lines (beams). Returns a [Point](/reference/api/point) object for the
intersection, or `false` if the lines don't intersect.
## Signature
```js
Point | false utils.beamsIntersect(
Point A,
@ -11,34 +17,27 @@ Point | false utils.beamsIntersect(
)
```
Finds the intersection between two endless lines (beams). Returns a [Point](/reference/api/point) object
for the intersection, or `false` if the lines don't intersect.
## Example
<Example part="utils_beamsintersect">
A Utils.beamIntersect() example
<Example caption="A Utils.beamIntersect() example">
```js
({ Point, points, Path, paths, Snippet, snippets, utils, part }) => {
points.A = new Point(10, 10)
points.B = new Point(50, 40)
points.C = new Point(45, 20)
points.D = new Point(60, 15)
paths.AB = new Path().move(points.A).line(points.B)
paths.CD = new Path().move(points.C).line(points.D)
snippets.x = new Snippet(
"notch",
utils.beamsIntersect(points.A, points.B, points.C, points.D)
)
return part
}
```
</Example>
```js
let {
Point,
points,
Path,
paths,
Snippet,
snippets,
utils
} = part.shorthand();
points.A = new Point(10, 10);
points.B = new Point(50, 40);
points.C = new Point(45, 20);
points.D = new Point(60, 15);
paths.AB = new Path().move(points.A).line(points.B);
paths.CD = new Path().move(points.C).line(points.D);
snippets.x = new Snippet(
"notch",
utils.beamsIntersect(points.A, points.B, points.C, points.D)
);
```