THREE.ConvexGeometry
With THREE.ConvexGeometry
, we can create a convex hull around a set of points. A convex hull is the minimal shape that encompasses all these points. The easiest way to understand this is by looking at an example. If you open up the 01-advanced-3d-geometries-convex.html
example, you'll see the convex hull for a random set of points. The following screenshot shows this geometry:
In this example, we generate a random set of points and based on these points we create THREE.ConvexGeometry
. In the example, you can click on redraw, which will generate 20 new points and draw the convex hull. We also add each of these points as a small THREE.SphereGeometry
object to clearly show how a convex hull works. THREE.ConvexGeometry
isn't included in the standard Three.js distribution, so you have to include an additional JavaScript file to use this geometry. At the top of your HTML page, add the following:
<script src="../libs/ConvexGeometry.js"></script...