Package vhacd

Class VHACDParameters

All Implemented Interfaces:
Cloneable, Comparable<NativePhysicsObject>

public class VHACDParameters extends NativePhysicsObject implements Cloneable
A set of tuning parameters for convex decomposition, based on classic V-HACD's IVHACD::Parameters.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • VHACDParameters

      public VHACDParameters()
      Instantiate the default tuning parameters.
  • Method Details

    • fromInputStream

      public void fromInputStream(InputStream is) throws IOException
      Read selected parameters from the specified InputStream.
      Parameters:
      is - the stream to read (not null)
      Throws:
      IOException - from DataInputStream
    • getACDMode

      public ACDMode getACDMode()
      Return the decomposition mode (native field: m_mode).
      Returns:
      an enum value (not null)
    • getAlpha

      public double getAlpha()
      Return the bias toward clipping along symmetry planes. (native field: m_alpha).
      Returns:
      alpha (≥0, ≤1)
    • getBeta

      public double getBeta()
      Return the bias toward clipping along revolution axes (native field: m_beta).
      Returns:
      beta (≥0, ≤1)
    • getConvexHullDownSampling

      public int getConvexHullDownSampling()
      Return the precision of the convex-hull generation process (native field: m_convexhullDownsampling).
      Returns:
      precision (≥1, ≤16)
    • getDebugEnabled

      public boolean getDebugEnabled()
      Test whether debug output is enabled.
      Returns:
      true if enabled, otherwise false
    • getMaxConcavity

      public double getMaxConcavity()
      Return the maximum concavity (native field: m_concavity).
      Returns:
      concavity (≥0, ≤1)
    • getMaxVerticesPerHull

      public int getMaxVerticesPerHull()
      Return the maximum number of vertices per convex hull (native field: m_maxNumVerticesPerCH).
      Returns:
      the limit (≥4, ≤1024)
    • getMinVolumePerHull

      public double getMinVolumePerHull()
      Return the minimum volume for added vertices (native field: m_minVolumePerCH).
      Returns:
      the volume (≥0, ≤0.01)
    • getPCA

      public boolean getPCA()
      Test whether to normalize the mesh (native field: m_pca).
      Returns:
      true → normalize, false → don't normalize
    • getPlaneDownSampling

      public int getPlaneDownSampling()
      Return the granularity of the search (native field: m_planeDownsampling).
      Returns:
      granularity (≥1, ≤16)
    • getVoxelResolution

      public int getVoxelResolution()
      Return the maximum number of voxels generated during the voxelization stage (native field: m_resolution).
      Returns:
      number (≥10000, ≤64000000)
    • setACDMode

      public void setACDMode(ACDMode mode)
      Set approximate convex decomposition mode (native field: m_mode).
      Parameters:
      mode - default = VOXEL
    • setAlpha

      public void setAlpha(double alpha)
      Set bias toward clipping along symmetry planes (native field: m_alpha).
      Parameters:
      alpha - default = 0.05, min = 0.0, max = 1.0,
    • setBeta

      public void setBeta(double beta)
      Set bias toward clipping along revolution axes (native field: m_beta).
      Parameters:
      beta - default = 0.05, min = 0.0, max = 1.0
    • setConvexHullDownSampling

      public void setConvexHullDownSampling(int precision)
      Set precision of the convex-hull generation process during the clipping plane selection stage (native field: m_convexhullDownsampling).
      Parameters:
      precision - default = 4, min = 1, max = 16
    • setDebugEnabled

      public void setDebugEnabled(boolean setting)
      Alter whether debug output is enabled.
      Parameters:
      setting - true → enable, false → disable (default=false)
    • setMaxConcavity

      public void setMaxConcavity(double concavity)
      Set maximum concavity (native field: m_concavity).
      Parameters:
      concavity - default = 0.0025, min = 0.0, max = 1.0

      Note: the native default is 0.001.

    • setMaxVerticesPerHull

      public void setMaxVerticesPerHull(int limit)
      Alter the maximum number of vertices per convex hull (native field: m_maxNumVerticesPerCH).
      Parameters:
      limit - default = 32, min = 4, max = 1024

      Note: the native default is 64.

    • setMinVolumePerHull

      public void setMinVolumePerHull(double volume)
      Set the minimum volume to add vertices to convex hulls (native field: m_minVolumePerCH).
      Parameters:
      volume - default = 0.0001, min = 0.0, max = 0.01
    • setPCA

      public void setPCA(boolean v)
      Enable/disable normalizing the mesh before applying the convex decomposition (native field: m_pca).
      Parameters:
      v - default = false
    • setPlaneDownSampling

      public void setPlaneDownSampling(int v)
      Set granularity of the search for the "best" clipping plane (native field: m_planeDownsampling).
      Parameters:
      v - default = 4, min = 1, max = 16
    • setVoxelResolution

      public void setVoxelResolution(int maxVoxels)
      Alter the maximum number of voxels generated during the voxelization stage (native field: m_resolution).
      Parameters:
      maxVoxels - default = 100_000, min = 10_000, max = 64_000_000
    • toMap

      public Map<String,Object> toMap()
      Represent this instance as a Map, in order to make comparisons easier.
      Returns:
      a map of property names to values
    • toOutputStream

      public void toOutputStream(OutputStream os) throws IOException
      Write selected parameters to the specified OutputStream.
      Parameters:
      os - the stream to write (not null)
      Throws:
      IOException - from DataOutputStream
    • clone

      public VHACDParameters clone()
      Create a copy of these parameters.
      Overrides:
      clone in class Object
      Returns:
      a new instance, equivalent to this one
    • equals

      public boolean equals(Object otherObject)
      Test for exact equivalence with another Object.
      Overrides:
      equals in class NativePhysicsObject
      Parameters:
      otherObject - (may be null, unaffected)
      Returns:
      true if the objects are equivalent, otherwise false
    • hashCode

      public int hashCode()
      Generate the hash code for this instance.
      Overrides:
      hashCode in class NativePhysicsObject
      Returns:
      a 32-bit value for use in hashing
    • toString

      public String toString()
      Represent this instance as a String.
      Overrides:
      toString in class NativePhysicsObject
      Returns:
      a descriptive string of text (not null, not empty)