Remix.run Logo
Fraterkes 3 days ago

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)

bruckie 2 days ago | parent | next [-]

Kurbo (https://github.com/linebender/kurbo) is another Rust Bézier curve library. It apparently doesn't have boolean operations yet, although https://github.com/linebender/kurbo/issues/277 documents potential work in that direction.

meindnoch 3 days ago | parent | prev | next [-]

"The boolean operations are implemented using a graph-based approach. After the parsing the input, self-intersecting cubic beziers curves are simplified. Then the intersection points between all edges are calculated. These are then turned into a graph representation where every intersection becomes a new vertex. We then apply edge contractions to remove vertices with a degree of 2 to compute the graph minor. At this stage, identical edges are deduplicated. Because we are ultimately interested in the faces of the graph to decide if they should be included in the final output, we then compute the dual graph in which the faces become vertices and vertices become the new faces. That dual structure is then used to determine which faces (dual vertices) should be included in the final output."

This would be such a pain in the ass to implement with good precision and performance.

QuantumNomad_ 3 days ago | parent | prev | next [-]

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

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

tonyedgecombe 3 days ago | parent [-]

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.

Fraterkes 3 days ago | parent [-]

In case you end up coming up with your own solution: this is one of the best collections of info for what is currently out there Ive seen: https://github.com/linebender/kurbo/issues/277

stuaxo 3 days ago | parent | prev [-]

Oh, that's definitely interesting - would be good for creative coding.

I could do with python bindings for this.