Title Feature request: paths_intersect() API
Issue ID 56d4702a744c5ab38e5766545e44f0ecf4d7057b
Author caravan-z6Mks4XdJC2nfPAbWZ4VXZ9GWU9TxkcW7ga7n9XeR55WxyBk
Opened on Sun Jan 25 19:52:57 2026
Status open
Description I would like to request a paths_intersect() API that returns whether the input paths have any intersections. My use case is in my font editor, knowing whether boolean operations are going to actually do something or not. If not, I can skip the actual operation and not add to the undo stack. Something like this: ```rust pub fn paths_intersect( set_a: &kurbo::BezPath, set_b: &kurbo::BezPath, fill_rule: FillRule, ) -> Result<bool, Error> ``` Thanks! (From adrientatar at github issue #34)
caravan Sun Jan 25 19:54:09 2026 be8d33b8181e0300e61c36ec7ac7ef47c9894a2f
Sure, this seems reasonable, with the caveat that it's hard to be exact. But I think we can do this pretty accurately and conservatively (i.e. sometimes falsely declare an intersection, but never falsely declare a non-intersection). We can definitely have a function like you suggest, but I think I'd also have a stateful version because once you detect an intersection you've already done quite a lot of setup work. So it might look like ```rust let mut top = Topology::from_paths_binary(set_a, set_b, 1e-6); if top.paths_intersect() { // This is now cheaper than doing it from scratch because a // bunch of stuff has been already computed. do_something_with(top.contours(fill_rule)); } ```
mlwilkerson Tue Feb 3 20:56:37 2026 ac743f8836e7d94e43f2020aab473cc98de03fa7
I would second this feature request. I'm in the process of migrating from flo_curves to linesweeper and kurbo. For now I've tried to do a best-effort self-intersection detection, but would way prefer to have it in linesweeper.