chrono::ChConvexDecompositionHACDv2 Class Reference

Description

Class for wrapping the HACD convex decomposition code revisited by John Ratcliff.

#include <ChConvexDecomposition.h>

Inheritance diagram for chrono::ChConvexDecompositionHACDv2:
Collaboration diagram for chrono::ChConvexDecompositionHACDv2:

Public Member Functions

 ChConvexDecompositionHACDv2 ()
 Basic constructor.
 
virtual ~ChConvexDecompositionHACDv2 ()
 Destructor.
 
virtual void Reset () override
 Reset the input mesh data.
 
virtual bool AddTriangle (const ChVector3d &v1, const ChVector3d &v2, const ChVector3d &v3) override
 Add a triangle, by passing three points for vertices. More...
 
virtual bool AddTriangleMesh (const ChTriangleMesh &tm) override
 Add a triangle mesh soup, by passing an entire ChTriangleMesh object. More...
 
void SetParameters (unsigned int max_hull_count=256, unsigned int max_merge_hull_count=256, unsigned int max_hull_vertices=64, float concavity=0.2f, float small_cluster_threshold=0.0f, float fuse_tolerance=1e-9f, bool verbose=true)
 Set the parameters for this convex decomposition algorithm. More...
 
virtual unsigned int ComputeConvexDecomposition () override
 Perform the convex decomposition. More...
 
virtual unsigned int GetHullCount () override
 Get the number of computed hulls after the convex decomposition.
 
virtual bool GetConvexHullResult (unsigned int hull_index, ChTriangleMesh &convextrimesh) override
 Get the n-th computed convex hull, by filling a ChTriangleMesh object that is passed as a parameter. More...
 
virtual bool GetConvexHullResult (unsigned int hull_index, std::vector< ChVector3d > &convexhull) override
 Get the n-th computed convex hull, by filling a vector with related vertices. More...
 
virtual void WriteConvexHullsAsWavefrontObj (std::ostream &stream) override
 Write the convex decomposition to a Wavefront '.obj' file, where each hull is a separate group.
 
- Public Member Functions inherited from chrono::ChConvexDecomposition
 ChConvexDecomposition ()
 Basic constructor.
 
virtual ~ChConvexDecomposition ()
 Destructor.
 
virtual bool AddTriangle (const ChTriangle &t1)
 Add a triangle, by passing a ChTriangle object (that will be copied, not referenced). More...
 
virtual bool WriteConvexHullsAsChullsFile (std::ostream &stream)
 Write the convex decomposition to a '.chulls' file, where each hull is a sequence of non-repeated vertices.
 

Member Function Documentation

◆ AddTriangle()

bool chrono::ChConvexDecompositionHACDv2::AddTriangle ( const ChVector3d v1,
const ChVector3d v2,
const ChVector3d v3 
)
overridevirtual

Add a triangle, by passing three points for vertices.

Note: the vertices must have proper winding (oriented triangle, normal pointing outside).

Implements chrono::ChConvexDecomposition.

◆ AddTriangleMesh()

bool chrono::ChConvexDecompositionHACDv2::AddTriangleMesh ( const ChTriangleMesh tm)
overridevirtual

Add a triangle mesh soup, by passing an entire ChTriangleMesh object.

Note 1: the triangle mesh does not need connectivity information (a basic 'triangle soup' is enough). Note 2: all vertices must have proper winding (oriented triangles, normals pointing outside). Note 3: the triangles must define closed volumes (holes, gaps in edges, etc. may trouble the decomposition).

Reimplemented from chrono::ChConvexDecomposition.

◆ ComputeConvexDecomposition()

unsigned int chrono::ChConvexDecompositionHACDv2::ComputeConvexDecomposition ( )
overridevirtual

Perform the convex decomposition.

This operation is time consuming, and it may take a while to complete. Quality of the results can depend a lot on the parameters. Also, meshes with triangles that are not well oriented (normals always pointing outside) or with gaps/holes, may give wrong results.

Implements chrono::ChConvexDecomposition.

◆ GetConvexHullResult() [1/2]

bool chrono::ChConvexDecompositionHACDv2::GetConvexHullResult ( unsigned int  hull_index,
ChTriangleMesh convextrimesh 
)
overridevirtual

Get the n-th computed convex hull, by filling a ChTriangleMesh object that is passed as a parameter.

Note 1: passed ChTriangleMesh is cleared before populating it. Note 2: passed ChTriangleMesh is filled with disconnected triangles.

Implements chrono::ChConvexDecomposition.

◆ GetConvexHullResult() [2/2]

bool chrono::ChConvexDecompositionHACDv2::GetConvexHullResult ( unsigned int  hull_index,
std::vector< ChVector3d > &  convexhull 
)
overridevirtual

Get the n-th computed convex hull, by filling a vector with related vertices.

Note: passed vector of points is cleared before populating it.

Implements chrono::ChConvexDecomposition.

◆ SetParameters()

void chrono::ChConvexDecompositionHACDv2::SetParameters ( unsigned int  max_hull_count = 256,
unsigned int  max_merge_hull_count = 256,
unsigned int  max_hull_vertices = 64,
float  concavity = 0.2f,
float  small_cluster_threshold = 0.0f,
float  fuse_tolerance = 1e-9f,
bool  verbose = true 
)

Set the parameters for this convex decomposition algorithm.

Use this function before calling ComputeConvexDecomposition(). Repeated vertices within fuse_tolerance threshold will be fused.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/collision/ChConvexDecomposition.h
  • /builds/uwsbel/chrono/src/chrono/collision/ChConvexDecomposition.cpp