Secrets of smooth Béziers
raphlinus.github.io
raphlinus.github.io
Bézier curves seemed to me a bit weird too, but this video made it crystal clear:
http://i.stanford.edu/pub/cstr/reports/cs/tr/85/1047/CS-TR-8...
Spiro curves are necessarily smooth, but beziers aren't. To show what makes beziers smooth, you created a viz that maps spiro curves to their bezier equivalents:
* x,y = spiro curve angles
* color = bezier handle lengths (to best approximate spiro)
The abrupt changes in color in the image reveal the difficulty in creating smooth bezier curves—because it forces abrupt changes in handle lengths for small angle changes.What I think those instead reveal is areas of the parameter space where there is a collapse of a degree of freedom: if your curve is close to a parabola, then you can make many different cubic curves which are close approximations, and it doesn’t much matter which among them you choose.
Raph’s optimizer picks opposite choices for which arm should be the short one when you go across that boundary, but if you smoothed the map out so there were no creases I don’t think you’d get significantly worse results. (I’d be interested to see him try this ;)
I was trying to generate the path the vehicle would follow if you were driving at a constant speed, and start turning the steering wheel at a constant rate. The full curve would then see you holding that angle, then returning the wheel to center.
After brute forcing this curved portion, I was able to solve a linear algebra problem to determine how far to drive during these straight segments to smoothly enter a parking spot with exactly 3 turns: 2 arbitrary turns, and a 3rd that brings the vehicle to the correct angle.
After brute forcing each combo of the first 2 turns, throwing the path through a weighted fitness function that minimised travel, and penalized reverse moves, while at the same time checking for collisions, it would spit out a very simple and elegant parking plan.
This can be fixed by inserting this line after line 308 of euler_explorer.js, in the onpointerdown handler:
e.preventDefault();
By default, if you drag an image, then it moves the image. You should need to call preventDefault to prevent that, so I'm kind of annoyed with Chromium.Rational curves give you another degree of freedom. CAD people like them because they can exactly represent conics.
Neither polynomials nor NURBS are IMO especially intuitive to work with as a design tool. As an approximate output target I think cubic polynomials are okay: a few cubic segments strung together are plenty flexible for typical drawing/modeling purposes.
My original question was that a rational bezier would be easier to use since a rational bezier would make an exact representation of a Euler Curve instead of an approximate representation.
I agree with you that full NURBs are difficult. But if you ignore the "Non Uniform" (NU) part of NURBs and just use the "Rational BSpline" (RB) part of NURBs then they are as easy to use as just beziers. The rational term just means a projection from n+1 space to n space. It is what gives an exact representation of a conic.
If you want to fully model the parametric equation then you would need the "non uniform" part. I don't know why you would want to do this since you can analyze the original curve directly.
You can make a fine approximation if you either (a) increase the degree of the polynomial or (b) increase the number of segments.
There is no particular advantage of NURBS for this vs. polynomials as far as I can tell.
I just came across this article which talks about using rational cubic trigonometric Bézier curves.
The reason to try to approximate Euler spirals by Bézier curves is that Bézier curves are ubiquitous in existing implementations. Trigonometric Bézier curves (https://ac.els-cdn.com/S0893965908001262/1-s2.0-S08939659080...) are not to my knowledge implemented anywhere.