-
-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New node: Merge by Distance #2307
base: master
Are you sure you want to change the base?
Conversation
7cd11f3
to
26c5460
Compare
Footprint -> VectorDataTable, | ||
)] | ||
source: impl Node<F, Output = VectorDataTable>, | ||
#[default(10.)] distance: Length, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a different default would be better.
5131957
to
2f32d59
Compare
2f32d59
to
23a5e56
Compare
For the 0.05 MB I think we can accept the dependency. There's a chance we use it in the future for other graph data structures, too. |
It's probably overkill for just this 1 problem, but I can see it being useful in a number of situations. It might even be the most efficient way to store path info. |
!build |
|
I'll get back on this. |
Just a reminder since it's the weekend and you might have some time to fix this up for the merge. |
|
||
// Now group connected segments - all will be collapsed to a single point. | ||
// Note: there are a few algos for this - perhaps test empirically to find fastest | ||
let collapse: Vec<FxHashSet<PointId>> = petgraph::algo::tarjan_scc(&short_edges).into_iter().map(|connected| connected.into_iter().collect()).collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tarjan will almost certainly be faster than Kosaraju because it only requires a single graph traversal
Hi, just one more friendly reminder, it'd be awesome to get this landed. Thanks for your work so far on it! |
Here's a patch that adds a new node to collapse segments with chord shorter than a distance (parameter to the node). It's not finished but this version works - I tried it out by drawing freehand then watching the segments collapse as the distance increases.
Things still to do:
petgraph
for the clustering algo but unless you want to take the dep, I assume I'll need to figure it out myself and replace it with hand-written code.)I do think you should consider using a graph library though, because the relationship between points, segments and faces is inherantly graph-like, and one might as well take advantage of all the experties that's been developed for graphs.
EDIT I measured binary size before/after this PR:
master
size is 15.93M