Skip to main content

utils.curveIntersectsY()

The utils.curveIntersectsY() function finds the point(s) where a curve intersects a given Y-value.

warning

This function can sometimes fail to find intersections in some curves due to a limitation in an underlying Bézier library. Please see Bug #3367 for more information.

Signature

array | Point | false utils.curveIntersectsY(
Point start,
Point cp1,
Point cp2,
Point end,
float y)

This returns false if no intersections are found, a Point object if a single intersection is found, and an array of Point objects if multiple intersections are found.

Example

A Utils.curveIntersectY() example

Notes

This is a low-level (and faster) variant of Path.intersectsY(). Instead of a path, you describe a single curve by passing the four points that describes it.