closest-point-on-bezier
v1.0.12
Published
Given a bezier curve and a point, finds which point in the curve is closest to the given point
Downloads
16
Maintainers
Readme
closest-point-on-bezier
Given a bezier curve and a point, finds which point in the curve is closest to the given point
usage:
import closestPoint from "closest-point-on-bezier";
const {relative_position, absolute_point} = closestPoint(
[
{x:20,y:20},
{x:20,y:100},
{x:200,y:100},
{x:200,y:20}
],
{x:offsetX,y:offsetY}
)
result:
{
relative_position : number, // the relative position of the point on the curve (0 - 1)
absolute_point: { // the absolute position of the point(x, y)
x : number,
y : number
},
example of what data this program cauculates