Add ability to get the original vertex index from the convex hull (#3018)

This makes it possible to know which input verticies were picked to
to define the hull.

With this information it is much easier to map certain features from the
input mesh/point cloud to the output convex hull.
This commit is contained in:
DarkDefender
2020-09-01 00:05:27 +02:00
committed by GitHub
parent bb1da5b5f5
commit 85a3cb0ed5
2 changed files with 5 additions and 0 deletions

View File

@@ -2673,6 +2673,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
}
vertices.resize(0);
original_vertex_index.resize(0);
edges.resize(0);
faces.resize(0);
@@ -2683,6 +2684,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
{
btConvexHullInternal::Vertex* v = oldVertices[copied];
vertices.push_back(hull.getCoordinates(v));
original_vertex_index.push_back(v->point.index);
btConvexHullInternal::Edge* firstEdge = v->edges;
if (firstEdge)
{

View File

@@ -66,6 +66,9 @@ public:
// Vertices of the output hull
btAlignedObjectArray<btVector3> vertices;
// The original vertex index in the input coords array
btAlignedObjectArray<int> original_vertex_index;
// Edges of the output hull
btAlignedObjectArray<Edge> edges;