Class ConvexHull
- Namespace
- Box3D
- Assembly
- Box3D.NET.dll
A convex hull built from a point cloud.
public sealed class ConvexHull : IDisposableInheritance
Implements
Inherited Members
Examples
ReadOnlySpan<Vector3> points = /* your vertices */;
using var hull = ConvexHull.FromPoints(points);
foreach (Vector3 position in spawnPoints)
{
Body body = world.CreateDynamicBody(position);
body.AddHull(hull);
}
// The hull may be disposed here; the shapes hold their own copy.
Remarks
Use this for shapes a Box3D.Box cannot express. Attaching it copies the hull into the world, so it may be disposed as soon as every shape that needs it has been created.
The world deduplicates identical hulls, so attaching the same hull to a thousand bodies stores it once.
Properties
- Bounds
-
Gets the local-space bounding box.
- FaceCount
-
Gets the number of faces in the hull.
- IsDisposed
-
Gets a value indicating whether this hull has been disposed.
- VertexCount
-
Gets the number of vertices in the hull.
- Volume
-
Gets the enclosed volume, usually in cubic metres.
Methods
- Cone(float, float, float, int)
-
Builds a tessellated cone or truncated cone about the y axis.
- Cylinder(float, float, float, int)
-
Builds a tessellated cylinder about the y axis.
- Dispose()
-
Releases the hull.
- FromPoints(ReadOnlySpan<Vector3>, int)
-
Builds the convex hull enclosing a set of points.
- Rock(float)
-
Builds an irregular rock-like hull, useful for scattering debris.