SolveSpace Logo SOLVESPACE -- parametric 2d/3d CAD
Examples
Tutorials
Features
Download
Reference
Technology
Library
Forum
Contact
USER FORUM

(you are viewing a thread; or go back to list of threads)

Tangent/perpendicular to bezier? (by whitequark)
Being able to constrain lines to be tangential or perpendicular to beziers would simplify some of my sketches quite a bit, and for some it's the only way I see to get a 0DOF solution. Are there fundamental reasons that's not possible?
Sun Jul 5 2015, 17:17:57
(no subject) (by Jonathan Westhues)
That's easy at the endpoints; it's just tangent or perpendicular to the line from the endpoint to the control point. Tangent is already handled nicely. Perpendicular is easy with a construction line, and could be special-cased like tangent if desired.

In the middle of the curve, that's harder for the same reason point-on-Bezier-curve is harder, basically because there's no easy way to go from the solver's representation of the curve (by its control points) to an implicit form. There's some discussion at:

http://solvespace.com/forum.pl?action=viewthread&parent=29

Approaches mentioned there include (a) closed-form implicitization, like by Groebner bases or something; (b) numerical methods within the greater Newton solver; and (c) representation of the point by its parameter along the curve instead of (u, v) in the plane.

Those seem like (a) an academic science project, (b) the quickest way to get something working, but possibly slow and unstable, and (c) the most elegant solution, and one that makes good use of the symbolic algebra system underlying SolveSpace's constraint solver, but more work.
Sun Jul 5 2015, 18:28:12, download attachment bezier-tangent.slvs
(no subject) (by whitequark)
So in essence, you would have a different kind of point, one that is placed on a Bezier (as opposed to a regular one constrained to a Bezier) and defined by a single coordinate along it, and you could constrain other entities against it as usual? That sounds nice. I think you could even make it invisible and add a point-point constraint against it, so that the point visible in the UI would not disappear when you delete the Bezier.

As I understand, once you can do that, getting the tangent vector at the point is just taking a derivative of (x,y) at that point.
Sun Jul 5 2015, 21:20:47
(no subject) (by Jonathan Westhues)
Pretty much, yeah. You'd just write the symbolic derivative as a function of t. If the spline is made from multiple segments, then Expr would need to be extended to handle piecewise functions, and to compute intermediate control points from the interpolating points and C2 continuity criterion. Numerical behavior seems likely to be good, though.
Fri Jul 10 2015, 13:15:41
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):
© 2008-2022 SolveSpace contributors. Most recent update June 2 2022.