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)

Point on bezier possible? (by Ed C)
Hi!

Absolutely love solvespace and use it heavily. However, recently I have come across the need to be able to contstrain points to bezier splines... this seems not to be possible.

Is it possible? Surely there is no reason this shouldn't be technically possible to do...

Thank you!
Sat Oct 9 2021, 04:05:09
(no subject) (by Eric Buijs)
Yes, that possible. First draw the desired points or lines and fully constrain them. Then draw the bezier with an equal amount of points (the maximum is ten). Now constrain the handles on the outermost points of the bezier. Lastly constrain all the points of the bezier on the constrained points. You'll end up with a fully constrained sketch. I've added a simple example.
Sat Oct 9 2021, 05:51:34, download attachment bezier_example.slvs
(no subject) (by Paul)
I think Eric is describing constraining point OF a spline and OP was asking about constraining point TO a spline. If that's the case, then no there is not way to constrain point-on-bezier.

I can imagine such a constraint for a single curve with 4 points, but it would be harder to implement for longer curves which are actually piece-wise splines - the point would have to seamlessly transition between sections.
Sat Oct 9 2021, 16:37:54
(no subject) (by Jonathan Westhues)
Even for a single piece it's nontrivial, since (unlike for a line or circle) there's no easy way to go from the control points to an implicit equation for the curve. Algorithms for implicitization do exist, but the math gets pretty complicated. I briefly studied this both for point-on-Bezier constraints and for the surface operations, but didn't find it promising enough to continue.
Sat Oct 9 2021, 17:53:26
(no subject) (by Paul)
@jwesthues We could add a free parameter (t) and write expressions for evaluation of the bezier at t. This is mostly implementing PointAt() and Bernstein symbolically.
Sun Oct 10 2021, 13:07:29
(no subject) (by Jonathan Westhues)
Yeah, probably the most promising direction. A long time ago I considered introducing a new point type in terms of t along a curve, but that seemed too complicated. In retrospect the easier path (and I guess what you're proposing here) is to make the constraint add one parameter t, and write two equations constraining u(t) and v(t) equal to the other point.

Of course you'd have to handle the piecewise part too. I don't think that would be bad for the solver, since the curves are all nicely continuous, just more implementation effort.
Sun Oct 10 2021, 13:43:51
(no subject) (by Geert Hospers)
I have experimented to represent airfloils by a few parabola. (Or 4 point beziers using solvespace.)
-At point maximum thickness the tangent is zero.
-At trailing edge the tangent is defined.

-At nose the tangent is infinite
-Define some point and corresponding tangent between nose and maximum thickness.
(-Alternative: combine the nose part of uppper and lower surface in 1 parabola.)


I tend to think (warning: I am qualified as mathematícal moderately intelligent...) that a multipoint Bezier consists of series of parabola. Please correct me if I'm wrong.
But if it is true, then the 'multiparabola route' looks promising to me.
Sun Oct 10 2021, 15:21:13
(no subject) (by Jonathan Westhues)
Beziers can be of any order, but a spline in SolveSpace is piecewise cubic. Parabolas are quadratic. Any quadratic is also a cubic, with zero for the t^3 term. So a SolveSpace spline can represent a parabola exactly, but it has one additional degree of freedom beyond that.
Sun Oct 10 2021, 21:34:47
(no subject) (by Geert Hospers)
Doen't this indicate that every qubic kan be split in 2 qudratics?

https://ttnghia.github.io/pdf/QuadraticApproximation.pdf

I think it is also possible then to assemble all quadratics (parabola) into 1 higher order bezier, and the other way around.
For me (mechanical eng) it is quite comfortable to define things with parabola. Actually the (minimal 4 point) Solvespace Bezier I do consider as too complex. I suggest the simplest: 3 point.
Mon Oct 11 2021, 08:32:58
(no subject) (by Geert Hospers)
BTW, I am still not sure if the quadratics are an approximation or exact representation of the higher order Bezier.
In the citation there they talk about error...
Mon Oct 11 2021, 08:45:33
(no subject) (by Geert Hospers)
But is there also an error if you assemble exact quadratics into a higher order Bezier?
Mon Oct 11 2021, 08:49:31
(no subject) (by Geert Hospers)
If you respect continueaty when connecting the quadratics?
Mon Oct 11 2021, 08:51:06
(no subject) (by Paul)
@Geert Hospers There will always be difference between higher and lower order representations. Except in the rare case where the higher order term happens to be zero.

One thing I'm curious about but never looked at is where solvespace places the control points for the piecewise cubic splines. The user only has control over the 2 at each end. Obviously they are colinear to preserve C1 continuity, but that leaves some freedom for each point.
Mon Oct 11 2021, 11:48:34
(no subject) (by Jonathan Westhues)
As Paul notes, a cubic can exactly represent any quadratic, by setting the t^3 term to zero. A quadratic cannot exactly represent a general cubic.

Multiple piecewise quadratics can approximate a cubic--or any other curve--in the same way that multiple piecewise linear segments can approximate any curve. More segments make the approximation more accurate, but they don't make it exact.

SolveSpace splines are piecewise cubic, and C2 where the pieces join. See Entity::ComputeInterpolatingSpline() for the code that makes that so.
Mon Oct 11 2021, 12:39: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-2021 SolveSpace contributors. Most recent update Apr 18 2021.