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

arcTo does not work #28

Open
bogdan-nourescu opened this issue Mar 17, 2023 · 4 comments
Open

arcTo does not work #28

bogdan-nourescu opened this issue Mar 17, 2023 · 4 comments

Comments

@bogdan-nourescu
Copy link

This is the code.
let size=500;
let x1=0;
let x2=size/2;
let x3=size;
let y1=size/32;
let y3=size/3
2;
let y2=size/2;

ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.arcTo(x2, y2, x3, y3, 200);
ctx.lineTo(x3, y3);
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.lineTo(x3, y3);
ctx.stroke();

image

@mvduin
Copy link

mvduin commented Oct 3, 2023

More precisely: for shallow angles (arc spans less than 90 degrees) arcTo incorrectly determines the origin of the arc, and consequently the start/end tangent points.

It appears to work correctly for sharp angles.

@mvduin
Copy link

mvduin commented Oct 3, 2023

Actually, it only works for sharp angles (arcs of 90 degrees or more) in the clockwise direction. Sharp angles in counter-clockwise direction have the correct origin but wrong start/end angles. Shallow angles in counter-clockwise direction have both problems.

@bogdan-nourescu
Copy link
Author

bogdan-nourescu commented Oct 3, 2023

I made a clone of the project and fixed it. You can check my fix here:
my repo clone

@BorisTheBrave
Copy link

@bogdan-nourescu I see you've fixed the shallow arc issue. But if I'm not wrong, you didn't fix the anticlockwise issue. I've got a fix for that to share with anyone who is maintaining their repo, let me know.

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

3 participants