Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Position returned for some lengths on SVG Bezier Curves #1879

Open
FrontSide opened this issue Jan 20, 2025 · 0 comments
Open

Incorrect Position returned for some lengths on SVG Bezier Curves #1879

FrontSide opened this issue Jan 20, 2025 · 0 comments

Comments

@FrontSide
Copy link

It looks like, when using the Path.getPositionAtLength function the incorrect position is returned for some lengths. This seems to be happening around curvatures.

Example: Take this SVG Path

m 1633.8176,1077.4212 c 0,0 18.4277,-511.56464 -14.7423,-535.31585 -32.2488,-23.0917 -318.7995,-9.13506 -318.7995,-9.13506 H 830.3691 c 0,0 -182.43438,-54.81052 -189.80546,-129.7182 -3.97298,-40.37463 -16.58496,-164.43147 -16.58496,-164.43147 0,0 -60.81148,-89.5238 -180.59162,-95.00485 C 323.6069,138.33472 -4.4064367,134.68069 -4.4064367,134.68069")

And now following positions

 let p0 = p.getPointAtLength(87.9549) //black
 let p1 = p.getPointAtLength(91.9549) //red - incorrect 
 let p2 = p.getPointAtLength(94.8549) //green
 let p3 = p.getPointAtLength(97.7549) //blue

When drawing circles at these points (using the annotated colours) I get the following picture

Image

As you can see, the Red dot is above the green dot whereas the order should be in the same order as the Length along the path, i.e.:
black, red, green, blue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant