Using a ConvexGeometry for a dynamic cluster "ring" #111
neil-morrison44
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
This is really nice; thank you for sharing! Actually this was on my list for later on but wasn't sure on the best approach for it. If you are up for it, i'd love to work on a PR with you! |
Beta Was this translation helpful? Give feedback.
0 replies
-
I was meaning to look into this more but completely forgot. Which is lucky since this has just been released & it seems perfect for doing the outlines (and lightweight): https://twitter.com/0xca0a/status/1698429063776325745 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Screen.Recording.2023-07-19.at.18.46.28.mov
Hi again,
I was having a look at the 3D clustering and thought it was let down a little by the ring still being 2d & not strictly following the bounds of the nodes within.
I wasn't able to get anything close to good enough to raise a PR, but it's probably worth thinking about.
It'd be a big change, but I think there'd be an approach in having the React component tree lay itself out dynamically so the nodes etc are supplied to their containing
Cluster
as children. TheCluster
would render a group, (with the label & "ring" element also children) - meaning you can use ConvexHull.setFromObject on a ref of the root and it'd follow the shapes of the contained nodes exactly. With a little bump to the scale it'd probably end up looking nice and smooth. Then there'd be some post-processing step to only draw the outline of the cluster "ring".I've included the code for the above example below, there could be something in there if it was improved, used
ConvexGeometry
as a registered ReactThreeFiber component & subdivided itself somehow to smooth out the weird angles - but it's only seeing the centre points of the nodes so it'll never be as nice as thechildren
&setFromObject
approach.Code here (symbols/Cluster.tsx)
Beta Was this translation helpful? Give feedback.
All reactions