Package com.github.stephengold.joltjni
Class ConvexHullBuilder
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.ConvexHullBuilder
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Construct a 3-D convex hull for specified points.
-
Constructor Summary
ConstructorsConstructorDescriptionConvexHullBuilder
(Collection<Vec3Arg> points) Instantiate a builder for the specified points. -
Method Summary
Modifier and TypeMethodDescriptionvoid
determineMaxError
(ChbFace[] storeFaceWithMaxError, float[] storeMaxError, int[] storePositionIndex, float[] storeCoplanarDistance) Determine the largest error in the constructed hull.void
getCenterOfMassAndVolume
(Vec3 storeCom, float[] storeVolume) Calculate the center of mass and volume of the resulting hull.ChbFace[]
getFaces()
Enumerate all faces of the hull.initialize
(int maxVertices, float tolerance, String[] storeMessage) Build a convex hull.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
ConvexHullBuilder
Instantiate a builder for the specified points.- Parameters:
points
- a list of locations (not null, unaffected)
-
-
Method Details
-
determineMaxError
public void determineMaxError(ChbFace[] storeFaceWithMaxError, float[] storeMaxError, int[] storePositionIndex, float[] storeCoplanarDistance) Determine the largest error in the constructed hull. The builder is unaffected.- Parameters:
storeFaceWithMaxError
- storage for the face with the largest error (not null, length≥1, modified)storeMaxError
- storage for the magnitude of the largest error (not null, length≥1, modified)storePositionIndex
- storage for the index (not null, length≥1, modified)storeCoplanarDistance
- storage for the coplanar distance (not null, length≥1, modified)
-
getCenterOfMassAndVolume
Calculate the center of mass and volume of the resulting hull. The builder is unaffected.- Parameters:
storeCom
- storage for the center of mass (not null, modified)storeVolume
- storage for the volume (not null, length≥1, modified)
-
getFaces
Enumerate all faces of the hull.- Returns:
- a new array of JVM objects with pre-existing native objects assigned
-
initialize
Build a convex hull.- Parameters:
maxVertices
- the maximum number of vertices in the hull, orMAX_VALUE
for no limittolerance
- how far a point can be outside the hullstoreMessage
- error message if the build fails- Returns:
- the outcome of the build
-