1.0.12 • Published 1 year ago

closest-point-on-bezier v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

image

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago