• Calculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier, so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values of the curve and the point - it will most likely be pixels.


    • point: PointXY

      a point in the form {x:567, y:3342}

    • curve: Curve

      a Bezier curve: an Array of PointXY objects. Note that this is currently hardcoded to assume cubix beziers, but would be better off supporting any degree.

    Returns DistanceFromCurve

    a JS object literal containing location and distance. Location is analogous to the location argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve. Distance is the distance in pixels from the point to the curve.