chore(markdown): Updated utils docs for v3
This commit is contained in:
parent
acf1b72c4c
commit
bc3b0cd770
23 changed files with 782 additions and 622 deletions
|
@ -1,7 +1,13 @@
|
|||
---
|
||||
title: linesIntersect()
|
||||
title: utils.linesIntersect()
|
||||
---
|
||||
|
||||
The `utils.linesInersect()` function finds the intersection between two line
|
||||
segments. Returns a [Point](../point) object for the intersection, or `false`
|
||||
if the lines don't intersect.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Point | false utils.linesIntersect(
|
||||
Point A,
|
||||
|
@ -11,34 +17,27 @@ Point | false utils.linesIntersect(
|
|||
)
|
||||
```
|
||||
|
||||
Finds the intersection between two line segments. Returns a [Point](../point) object
|
||||
for the intersection, or `false` if the lines don't intersect.
|
||||
## Example
|
||||
|
||||
<Example part="utils_linesintersect">
|
||||
A Utils.linesIntersect() example
|
||||
<Example caption="A Utils.linesIntersect() 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(15, 30)
|
||||
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.linesIntersect(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(15, 30);
|
||||
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.linesIntersect(points.A, points.B, points.C, points.D)
|
||||
);
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue