-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
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 ConvexGeometry based on QuickHull #10987
Conversation
Great stuff as always! However, just like with |
I think this is really great! :) The only thing that bothers me is the creation of the class you call In three.js, the term 'vertex' has special meaning: as vertex of a triangle, or as a point on the surface of a mesh. I would call it |
@WestLangley Ok, i'll try to figure out a different name 👍 .
@mrdoob The problem is that the implementation of |
Okay, i moved to code to |
Sweet! |
Thanks! |
Thanks @Mugen87 ! |
This PR introduces a QuickHull implementation for generating convex hulls. Features:
ConvexGeometry
andConvexBufferGeometry
I've prepared two simple examples (with a 50k vertices model) so you can better compare the execution times (see console):
Old Implementation O(n^2)
New Implementation O(nlogn)
As you can see in the code the QuickHull implementation is not part of
ConvexGeometry
but a standalone entity. So you can do e.g.new THREE.QuickHull().setFromObject( mesh )
to create the bounding volume for a 3D object as withBox3
.ConvexGeometry
uses the result ofTHREE.QuickHull
to compute the geometry data. But you can also use it for other purposes like collision detection.The implementation is mainly based on /~https://github.com/maurizzzio/quickhull3d so credit goes to @Maurizzzio for his great work!