1
0
Fork 0

feat: Flat import of markdown repo

This is a flat (without history) import of (some of) the content
from our markdown module.

We've imported this without history because the repo contains our
blog posts and showcases posts content prior to porting them to strapi.

Since this contains many images, it would balloon the size of this repo
to import the full history.

Instead, please refer to the history of the (archived) markdown repo
at: https://github.com/freesewing/markdown
This commit is contained in:
Joost De Cock 2021-08-25 16:09:31 +02:00
parent 1671a896b5
commit b34a2ee2ed
6132 changed files with 244167 additions and 0 deletions

View file

@ -0,0 +1,72 @@
---
title: curveIntersectsY()
---
```js
array | Point | false utils.curveIntersectsY(
Point start,
Point cp1,
Point cp2,
Point end,
float y)
```
Finds the point(s) where a curve intersects a given Y-value.
This is a low-level variant
of [`Path.intersectsY()`](/en/docs/developer/api/path/#pathintersectsy).
Instead of a path, you describe a single curve by passing the four
points that describes it.
This returns `false` if no intersections are found,
a [Point](/en/docs/developer/api/point/) object if
a single intersection is found, and an array
of [Point](/en/docs/developer/api/point/) objects if
multiple intersections are found.
<Example part="utils_curveintersectsy" caption="A Utils.curveIntersectY() example" />
```js
let {
Point,
points,
Path,
paths,
utils,
snippets,
Snippet
} = part.shorthand();
points.start = new Point(10, 45);
points.cp1 = new Point(50, 10);
points.cp2 = new Point(0, 80);
points.end = new Point(110, 70);
paths.curve = new Path()
.move(points.start)
.curve(points.cp1, points.cp2, points.end);
for (let y of [40, 50]) {
points["from" + y] = new Point(10, y);
points["to" + y] = new Point(110, y);
paths["line" + y] = new Path()
.move(points["from" + y])
.line(points["to" + y])
.attr("class", "lining dashed");
}
snippets.i50 = new Snippet(
"notch",
utils.curveIntersectsY(points.start, points.cp1, points.cp2, points.end, 50)
);
for (let p of utils.curveIntersectsY(
points.start,
points.cp1,
points.cp2,
points.end,
40
))
snippets[p.x] = new Snippet("notch", p);
```