1
0
Fork 0
freesewing/sites/dev/docs/reference/api/utils/curveedge
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: utils.curveEdge()
---

The `utils.curveEdge()` function finds the edge of a cubic Bézier curve,
given the curve, the edge to find ("top", "bottom", "left", or "right"),
and the number of steps to divide the curve into while walking it.

## Signature

```js
Point utils.curveEdge(
  Bezier curve,
  string edge,
  int steps = 500)
```

## Example

<Example caption="A Utils.curveEdge() example">
```js
({ Point, points, Path, paths, Snippet, snippets, utils, Bezier, part }) => {

  points.A = new Point(20, 10)
  points.Acp = new Point(310, 40)
  points.Bcp = new Point(-210, 40)
  points.B = new Point(100, 70)

  paths.pathA = new Path()
    .move(points.A)
    .curve(points.Acp, points.Bcp, points.B)

  const curveA = new Bezier(
    { x: points.A.x, y: points.A.y },
    { x: points.Acp.x, y: points.Acp.y },
    { x: points.Bcp.x, y: points.Bcp.y },
    { x: points.B.x, y: points.B.y }
  )

  points.edge = utils.curveEdge(curveA, "left")
  snippets.edge = new Snippet("notch", points.edge)

  return part
}
```
</Example>