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
Point utils.curveEdge(
Bezier curve,
string edge,
int steps = 500)
Example
- Preview
- Code
- X-Ray
({ 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
}