Package vhacd4

Class Vhacd4Parameters

All Implemented Interfaces:
Cloneable, Comparable<NativePhysicsObject>

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

    Fields
    Modifier and Type
    Field
    Description
    static final Logger
    message logger for this class

    Fields inherited from class com.jme3.bullet.NativePhysicsObject

    loggerN
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiate the default tuning parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Create a copy of these parameters.
    boolean
    equals(Object otherObject)
    Test for exact equivalence with another Object.
    void
    Read all parameters from the specified InputStream.
    boolean
    Test whether debug output is enabled.
    Return the algorithm that fills voxels to create a solid object (native field: m_fillMode).
    int
    Return the maximum number of convex hulls (native field: m_maxConvexHulls).
    int
    Return the maximum recursion depth (native field: m_maxRecursionDepth).
    int
    Return the maximum number of vertices per convex hull (native field: m_maxNumVerticesPerCH).
    int
    Return the minimum edge length (native field: m_minEdgeLength).
    double
    Return the tolerance for the percent difference between the voxel volume and the volume of the hull (native field: m_minimumVolumePercentErrorAllowed).
    int
    Return the maximum number of voxels generated during the voxelization stage (native field: m_resolution).
    int
    Generate the hash code for this instance.
    boolean
    Test whether V-HACD should run on a new thread (native field: m_asyncACD).
    boolean
    Test whether V-HACD should try to find the optimal location for splitting hulls (native field: m_findBestPlane).
    boolean
    Test whether V-HACD should shrinkwrap voxel positions to the source mesh (native field: m_shrinkWrap).
    void
    Advance the fill mode to the next value.
    void
    setAsync(boolean setting)
    Alter whether V-HACD should run on a new thread (native field: m_asyncACD).
    void
    setDebugEnabled(boolean setting)
    Alter whether debug output is enabled.
    void
    Specify the algorithm that fills voxels to create a solid object (native field: m_fillMode).
    void
    setFindBestPlane(boolean setting)
    Alter whether V-HACD should try to find the optimal location for splitting hulls (native field: m_findBestPlane).
    void
    setMaxHulls(int limit)
    Alter the maximum number of convex hulls (native field: m_maxConvexHulls).
    void
    setMaxRecursion(int depth)
    Alter the maximum recursion depth (native field: m_maxRecursionDepth).
    void
    Alter the maximum number of vertices per convex hull (native field: m_maxNumVerticesPerCH).
    void
    setMinEdgeLength(int length)
    Alter the minimum edge length (native field: m_minEdgeLength).
    void
    setShrinkWrap(boolean setting)
    Alter whether to shrinkwrap voxel positions to the source mesh (native field: m_shrinkWrap).
    void
    setVolumePercentError(double percentage)
    Alter the tolerance for the percent difference between the voxel volume and the volume of the hull (native field: m_minimumVolumePercentErrorAllowed).
    void
    setVoxelResolution(int maxVoxels)
    Alter the maximum number of voxels generated during the voxelization stage (native field: m_resolution).
    Represent this instance as a Map, in order to make comparisons easier.
    void
    Write all parameters to the specified OutputStream.
    Represent this instance as a String.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • logger

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

    • Vhacd4Parameters

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

    • fromInputStream

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

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

      public FillMode getFillMode()
      Return the algorithm that fills voxels to create a solid object (native field: m_fillMode).
      Returns:
      an enum value (not null)
    • getMaxHulls

      public int getMaxHulls()
      Return the maximum number of convex hulls (native field: m_maxConvexHulls).
      Returns:
      the limit (≥1, ≤1024)
    • getMaxRecursion

      public int getMaxRecursion()
      Return the maximum recursion depth (native field: m_maxRecursionDepth).
      Returns:
      the limit (≥2, ≤64)
    • getMaxVerticesPerHull

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

      public int getMinEdgeLength()
      Return the minimum edge length (native field: m_minEdgeLength).
      Returns:
      the limit (≥1, ≤32)
    • getVolumePercentError

      public double getVolumePercentError()
      Return the tolerance for the percent difference between the voxel volume and the volume of the hull (native field: m_minimumVolumePercentErrorAllowed).
      Returns:
      the percentage (>0, <100)
    • getVoxelResolution

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

      public boolean isAsync()
      Test whether V-HACD should run on a new thread (native field: m_asyncACD).
      Returns:
      true → create new thread, false → use the existing thread
    • isFindBestPlane

      public boolean isFindBestPlane()
      Test whether V-HACD should try to find the optimal location for splitting hulls (native field: m_findBestPlane).
      Returns:
      true → find optimal location, false → split in the middle
    • isShrinkWrap

      public boolean isShrinkWrap()
      Test whether V-HACD should shrinkwrap voxel positions to the source mesh (native field: m_shrinkWrap).
      Returns:
      true → shrinkwrap enabled, false → shrinkwrap disabled
    • nextFillMode

      public void nextFillMode()
      Advance the fill mode to the next value.
    • setAsync

      public void setAsync(boolean setting)
      Alter whether V-HACD should run on a new thread (native field: m_asyncACD).
      Parameters:
      setting - true → create new thread, false → use the existing thread (default=true)
    • setDebugEnabled

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

      public void setFillMode(FillMode mode)
      Specify the algorithm that fills voxels to create a solid object (native field: m_fillMode).
      Parameters:
      mode - the desired algorithm (not null, default=FloodFill)
    • setFindBestPlane

      public void setFindBestPlane(boolean setting)
      Alter whether V-HACD should try to find the optimal location for splitting hulls (native field: m_findBestPlane).
      Parameters:
      setting - find optimal location, false → split in the middle (default=false)
    • setMaxHulls

      public void setMaxHulls(int limit)
      Alter the maximum number of convex hulls (native field: m_maxConvexHulls).
      Parameters:
      limit - default = 64, min = 1, max = 1024)
    • setMaxRecursion

      public void setMaxRecursion(int depth)
      Alter the maximum recursion depth (native field: m_maxRecursionDepth).

      Note: the native default is 10.

      Parameters:
      depth - default = 14, min = 2, max = 64
    • setMaxVerticesPerHull

      public void setMaxVerticesPerHull(int limit)
      Alter the maximum number of vertices per convex hull (native field: m_maxNumVerticesPerCH).

      Note: the native default is 64.

      Parameters:
      limit - default = 32, min = 4, max = 2_048)
    • setMinEdgeLength

      public void setMinEdgeLength(int length)
      Alter the minimum edge length (native field: m_minEdgeLength).
      Parameters:
      length - default = 2, min = 1, max = 32)
    • setShrinkWrap

      public void setShrinkWrap(boolean setting)
      Alter whether to shrinkwrap voxel positions to the source mesh (native field: m_shrinkWrap).
      Parameters:
      setting - true → enable shrinkwrap, false → disable shrinkwrap (default=true)
    • setVolumePercentError

      public void setVolumePercentError(double percentage)
      Alter the tolerance for the percent difference between the voxel volume and the volume of the hull (native field: m_minimumVolumePercentErrorAllowed).
      Parameters:
      percentage - default = 1, min = 0, max = 100
    • setVoxelResolution

      public void setVoxelResolution(int maxVoxels)
      Alter the maximum number of voxels generated during the voxelization stage (native field: m_resolution).

      Note: the native default is 400_000.

      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 all parameters to the specified OutputStream.
      Parameters:
      os - the stream to write (not null)
      Throws:
      IOException - from DataOutputStream
    • clone

      public Vhacd4Parameters 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)