-
Notifications
You must be signed in to change notification settings - Fork 233
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 PolygonSort node #2324
New PolygonSort node #2324
Conversation
what about area, other qualities? because we already have list sort with key user defined, for poligons can be added more specific options? |
Sure thing. that can be done (area, normal angle etc). Btw @nortikin , can you show me an example of how you would sort the polygons by distance to point/direction using list sorting node? |
And another live demo :) the magic of toroidal fields Note: the reason why only the first 11 indices of the sorted polygons are shown is to avoid cluttering the demo.. as displaying hundreds of poly indices would make the illustration unreadable. |
Anybody knows who created the area node ? I was wondering why the unit_normal is calculated via determinant instead of simply via crossproduct of the poly first edges + normalization. What’s the catch ? I notice the normals generated via both methods are the same, albeit the cross product should be faster. |
I am totally intrigue by this and all the example demos...! |
Thanks for the flowers, @enzyme69 :) It’s no mystery that the animation/scaling in these demos is doable with other nodes so not much credit can be given to PolygonSort node itself.. the less obvious from the demos however is that the polygons are in fact sorted and the text showing the reduced set of indices are the first 11 polygons in the sorted polygon list. |
Here’s another demo with sorting by “Normal Angle Point”. The red indices are the original (unsorted) polygon indices, the blue indices are the sorted indices. The numbers above the poly normals are the angles between the normals and the vectors connecting the centers to the moving point. (hence the sorting name) |
If there are no objections.. this PR is ready to land. |
f818eba
to
9992a5b
Compare
@DolphinDream who? This is one of the older nodes :) i don't see where it would handle (concave) ngons. I would do a rewrite. I'll port it over to |
@zeffii The polygon sort node already does area calculation so it would really be replicated code to have it in two nodes. I was wondering if it’s worth factorizing the polygon related calculations into a polygon utilities file so that its functions can be used in multiple nodes. And the same could be said about edge related calculations. |
yes, factorize it out if you wish. ( |
This new nodes allows to sort the polygons based on a distance to a given point or distance along a given direction. The Input is the verts/polys needed to be sorted and the reference (either a point P or a direction D). The node outputs the sorted polygons, same (input) vertices, centers of the sorted polygons, distances for the sorted polygons. The node has two modes P & D for distance to point and distance along a direction. Also there is an option to toggle the sorting ascending/descending. And yes, the node also has 3 presets X/Y/Z to preset the sorting direction to be one of the xyz axis.
Example 1 : Sorting by distance to point P
Example 2 : Sorting by distance along distance D