Skip to main content

utils.curveIntersectsX()

The utils.curveIntersectsX() function finds the point(s) where a curve intersects a given X-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.curveIntersectsX(
Point start,
Point cp1,
Point cp2,
Point end,
float x)

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.curveIntersectX() example

Notes

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