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

Add tangents_to_point for QuadBez #417

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Keavon
Copy link

@Keavon Keavon commented Feb 15, 2025

Follows up #288 which added tangents_to_point() to CubicBez, by adding it to QuadBez now as well.

Comment on lines +120 to +127
let a = self.p0.to_vec2() - 2.0 * self.p1.to_vec2() + self.p2.to_vec2();
let b = 2.0 * (self.p1.to_vec2() - self.p0.to_vec2());
let c = self.p0.to_vec2() - p.to_vec2();

// coefficients of x(t) \cross x'(t)
let c2 = a.cross(b);
let c1 = -2.0 * c.cross(a);
let c0 = b.cross(c);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like a double check on the math here, both in terms of its correctness (I'm not certain of it) and its formatting (is it more faithful to the canonical Bézier equations to reverse the orders of the terms, swap the order of the cross product and negate it, etc.?). This mostly arose from pattern recognition based fiddling and I wasn't able to quite grasp its relationship with the Bézier equations on Wikipedia. So please confirm this is right.

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

Successfully merging this pull request may close these issues.

1 participant