java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.vhacd.Decomposer
All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>

public class Decomposer extends JoltPhysicsObject
Decompose 3-D meshes into collections of convex hulls using Khaled Mamou's Volumetric-Hierarchical Approximate Convex Decomposition (V-HACD) algorithm.
  • Constructor Details

    • Decomposer

      public Decomposer()
      Instantiate a default instance.
  • Method Details

    • addProgressListener

      public Decomposer addProgressListener(ProgressListener listener)
      Register the specified progress listener.
      Parameters:
      listener - the listener to register (not null, alias created)
      Returns:
      the modified properties, for chaining
    • decompose

      public Collection<ConvexHull> decompose(float[] locations, int[] indices, Parameters params)
      Generate convex hulls to approximate the specified mesh.
      Parameters:
      locations - the locations of all mesh vertices (not null, length a multiple of 3, unaffected)
      indices - the vertex indices of all mesh triangles (not null, length a multiple of 3, unaffected)
      params - the tuning parameters to use (not null, unaffected)
      Returns:
      a new unmodifiable collection of hulls, or an empty collection if the algorithm failed
    • decompose

      public Collection<ConvexHull> decompose(FloatBuffer locations, IntBuffer indices, Parameters params)
      Generate convex hulls to approximate the specified mesh.
      Parameters:
      locations - the locations of all mesh vertices (not null, direct, capacity a multiple of 3, unaffected)
      indices - the vertex indices of all mesh triangles (not null, direct, capacity a multiple of 3, unaffected)
      params - the tuning parameters to use (not null, unaffected)
      Returns:
      a new unmodifiable collection of hulls, or an empty collection if the algorithm failed
    • removeProgressListener

      public void removeProgressListener(ProgressListener listener)
      De-register the specified progress listener.
      Parameters:
      listener - the listener to de-register (not null, unaffected)