Class ConvexHullBuilder

All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class ConvexHullBuilder extends NonCopyable
Construct a 3-D convex hull for specified points.
  • Constructor Details

    • ConvexHullBuilder

      public ConvexHullBuilder(Collection<Vec3Arg> points)
      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

      public void getCenterOfMassAndVolume(Vec3 storeCom, float[] storeVolume)
      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

      public ChbFace[] getFaces()
      Enumerate all faces of the hull.
      Returns:
      a new array of JVM objects with pre-existing native objects assigned
    • initialize

      public EResult initialize(int maxVertices, float tolerance, String[] storeMessage)
      Build a convex hull.
      Parameters:
      maxVertices - the maximum number of vertices in the hull, or MAX_VALUE for no limit
      tolerance - how far a point can be outside the hull
      storeMessage - error message if the build fails
      Returns:
      the outcome of the build