E.g. for moving an object at constant speed along the curve.
[1]: https://docs.rs/bezier-rs/latest/bezier_rs/struct.Bezier.htm...
https://github.com/GraphiteEditor/Graphite/tree/master/libra...
There’s not a ton of robust curve boolean libs out there that aren’t just part of some huge package of tools. This is the only one I know of that isn’t Js.
(Edit: added a link)
https://github.com/GraphiteEditor/Graphite/tree/master/libra...
I could do with python bindings for this.
This would be such a pain in the ass to implement with good precision and performance.
From these graphs I see that I always wanted the simple Quadratic version, and would use 2 of them in sequence to approximate a Cubic version. That would be so much easier. But if the software could allow me to adjust the midpoint, and maintain a smooth transition, that would be perfect. I think.
So I basically wish for a different interface, one that has more thought put into it. Now it's a "give access to the parameters, and be done with it" kind. As if novices don't have the need for a nice smooth curve between known points.
But I agree with the OP, artists might only need new tools that use quadratic bezier curves in a different ways
I work on a commercial CAD application (architecture space) and we have a Polyline Tool (misnomer) that lets users add quadratic Bezier curves and arc segments and they are not clamoring for anything more than that. There is the ability to specify the quadratic segments by point on curve at t=1/2, and various different ways of specifying arc segments. But this is all just UI, under the hood it's arc segments, line segments, and quadratic Bezier and it seems to meet their needs.
There is also a NURBS curve tool but my impression is that the vast majority of our users just stick with the 2D Polyline.
Users can specify them by three points on the perimeter, by tangents at endpoints (up to 180deg of course), with various other conveniences (you can place two tangent arc or bezier vertices in a row and create an implicit g1 interface between the two arc / bezier segments).
Constraint solvers are good at circles and you can offset them analytically so they make a lot of sense for CAD.
I can't really say this rigorously but I also think that Bezier segments and circle segments are good "partners" for approximating smooth curves - each has just enough degrees of freedom for you to require g1 continuity between them, one of them always has constant non-zero curvature, the other cannot have constant non-zero curvature, and the locality aspect matches the intuition of a human operator.
For Beziér curves remember the basics:
- put nodes at extrema and points of inflection (extreme left/right, top/bottom, middle of _S_ curve)
- rule of 30 --- off curve nodes should be ~30% away from the matching on curve node for smoothest appearance unless the shape one is trying to achieve dictates a different placement
If you just do a start/end point it will create a cubic with 2 endpoints and 2 control points. But if you drop a whole series of points (up to 12 I think) it will create a curve that passes though all of them. This is done by internally creating a bunch of cubic splines where the control points are automatically positioned and not shown. You still get 2 control points for the derivatives at the ends, unless you create a closed loop.
I’m currently looking for a nice implementation of stroke expansion (here called outlining) that I can run in the browser, this seems like a good option besides skia (pathkit)[0] and vello/kurbo[1].
Ideally I’d love to be able to expand in a non-uniform way, similar to what Metafont does for bitmap fonts, or what Inkscape allows with its power stroke effect, or even just with a non-uniform ‘nib’ as is possible with FontForge[2].
This doesn’t seem to be something that these bezier libraries generally offer which is understandable, probably a rather niche goal.
[0] https://skia.org/docs/user/modules/pathkit/
https://github.com/solvespace/solvespace/blob/master/src/srf...
https://www.youtube.com/watch?v=jvPPXbo87ds (73 minutes)
https://www.youtube.com/watch?v=aVwxzDHniEw (24 minutes)
They do a pretty good job introducing the mathematics gently I think. But maybe work backwards from whatever you don't understand?
For general polynomials, it matters a great deal in what basis it is represented. The typical monomial basis is usually not the best from a numerical standpoint. I am aware of some modern methods such as this: https://arxiv.org/pdf/1611.02435
For polynomials expressed in e.g. a Bernstein basis, there are often much faster and stable tailored methods working solving for the eigenvalues of a companion matrix of a different form.
[0] https://github.com/GraphiteEditor/Graphite/blob/master/libra...
Curiously, the poly-cool crate appears to use the monomial basis instead of the Bernstein basis that the old version was using.
[0] https://github.com/GraphiteEditor/Graphite/pull/3031
[1] https://crates.io/crates/poly-cool
[2] https://github.com/GraphiteEditor/Graphite/blob/beb1c6ae6489...
Syzygies•5mo ago
I'm surprised Bezier-rs is all about curves. Sure, fonts, but I can't be alone here in seeing curves as a special case.
It's easy as a pure mathematician to write off Bezier theory as "specialized" but it's simply the right way to work with polynomials on a simplex.
ttd•5mo ago
I am not a mathematician though, so if you have other insight I'd be glad to hear it.
ttoinou•5mo ago
ttd•5mo ago
ttoinou•5mo ago