Skip to content

Thiago099/closest-point-on-bezier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published