Live data from Hacker News

Bezier-rs – algorithms for Bézier segments and shapes

graphite.rs

11–20 of 57 posts

Re: Bezier-rs – algorithms for Bézier segments and shapes

#11

Almost even more interesting is the Bezier Boolean-Operations lib they use (it’s a rewrite of Pathbool.js ( https://github.com/r-flash/PathBool.js ) in Rust) 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)

Link to the code for the mentioned Rust path-bool crate:

https://github.com/GraphiteEditor/Graphite/tree/master/libra...

Re: Bezier-rs – algorithms for Bézier segments and shapes

#12

Almost even more interesting is the Bezier Boolean-Operations lib they use (it’s a rewrite of Pathbool.js ( https://github.com/r-flash/PathBool.js ) in Rust) 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)

Link to the code for the mentioned Rust path-bool crate: https://github.com/GraphiteEditor/Graphite/tree/master/libra...

Interesting, I’m writing some code to find the interception of two clipping paths at the moment. I can’t use this because I have a no dependency rule but will take a look.

Re: Bezier-rs – algorithms for Bézier segments and shapes

#13
post #8

Earlier quoted context omitted.

Wasm in the browser?

wasm = WebAssembly = a simple stack-based VM with one flat heap for memory.

Sure... but people are running Wasm on the server side too so fair question.

Re: Bezier-rs – algorithms for Bézier segments and shapes

#14
post #2

I'm hoping to code Bezier animation in OCaml/F# in four dimensional space time, with a moving vantage point. Offload rendering each time slice frame to worker threads. 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…

If you're not restricted to Bezier for graphics (it's a very common choice as the path primitive for vector graphics), there are other classes of curves that you may find are a better fit. In particular, I think animations typically feel better if they move at constant speed - which is nontrivial with Bezier curves because they do not have an exact closed-form arc length parameterization. Something like pythagorean hodographs could be a better fit for your application.

I am not a mathematician though, so if you have other insight I'd be glad to hear it.

Re: Bezier-rs – algorithms for Bézier segments and shapes

#15
Bezier curves in painting software never gave me the results I wanted. And I mean never. I sincerely wonder who succeeds at using them?

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.

Re: Bezier-rs – algorithms for Bézier segments and shapes

#16

Bezier curves in painting software never gave me the results I wanted. And I mean never. I sincerely wonder who succeeds at using them? 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 perf…

A Bézier curve is not an interpolating spline. It is a parametric curve defined by a set of control points, which the curve typically does not pass through (except the first and last points). Bézier curves exhibit local control (changing a control point influences only a portion of the curve, especially in piecewise Bézier constructions). Interpolating splines may seem more user-friendly at first, since the curve passes exactly through all the given points. However, this can lead to unintuitive behavior: modifying a single point can cause global changes in the curve, including in areas far from the edited point. In some cases, these changes can be drastic, making precise control difficult or impossible. I may be biased by my 20+ years of graphic design work, but I prefer the precision and control given by Bézier curves.

Re: Bezier-rs – algorithms for Bézier segments and shapes

#17

Bezier curves in painting software never gave me the results I wanted. And I mean never. I sincerely wonder who succeeds at using them? 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 perf…

[deleted]

Re: Bezier-rs – algorithms for Bézier segments and shapes

#18
This looks really nice!

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/

[1] https://doc.servo.org/kurbo/stroke/index.html

[2] https://fontforge.org/docs/techref/stroke.html

Re: Bezier-rs – algorithms for Bézier segments and shapes

#19

Earlier quoted context omitted.

wasm = WebAssembly = a simple stack-based VM with one flat heap for memory.

Sure... but people are running Wasm on the server side too so fair question.

Barely, this is Rust, so if you're on a server you can just... use that already ?
Post reply on HN