get birth faces indices in ImportFromPolyMesh function
This commit is contained in:
parent
0f320aa671
commit
a282947a72
|
@ -75,10 +75,16 @@ namespace tri {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Import a trianglemesh from a polygon mesh
|
* @brief Import a trianglemesh from a polygon mesh
|
||||||
**/
|
* @param tm: output triangle mesh
|
||||||
static void ImportFromPolyMesh(TriMeshType & tm, PolyMeshType & pm)
|
* @param pm: input polygonal mesh
|
||||||
|
* @param birthFaces: a mapping that tells, for each face of the triangle mesh,
|
||||||
|
* which one is its birth face in the polygonal mesh.
|
||||||
|
*/
|
||||||
|
static void ImportFromPolyMesh(TriMeshType& tm, PolyMeshType& pm, std::vector<unsigned int>& birthFaces)
|
||||||
{
|
{
|
||||||
|
birthFaces.clear();
|
||||||
|
birthFaces.reserve(pm.FN()); //at least the same face number of the polymesh
|
||||||
tri::RequirePolygonalMesh(pm);
|
tri::RequirePolygonalMesh(pm);
|
||||||
std::vector<typename PolyMeshType::CoordType> points;
|
std::vector<typename PolyMeshType::CoordType> points;
|
||||||
|
|
||||||
|
@ -99,8 +105,13 @@ namespace tri {
|
||||||
}
|
}
|
||||||
std::vector<int> faces;
|
std::vector<int> faces;
|
||||||
TessellatePlanarPolygon3(points,faces);
|
TessellatePlanarPolygon3(points,faces);
|
||||||
|
|
||||||
|
//all the faces we add in tm have as a birth face fi
|
||||||
|
birthFaces.insert(birthFaces.end(), faces.size()/3, tri::Index(pm, *fi));
|
||||||
|
|
||||||
for(size_t i = 0; i<faces.size();i+=3){
|
for(size_t i = 0; i<faces.size();i+=3){
|
||||||
TriFaceIterator tfi = Allocator<TriMeshType>::AddFace(tm,
|
TriFaceIterator tfi = Allocator<TriMeshType>::AddFace(
|
||||||
|
tm,
|
||||||
tri::Index(pm,(*fi).V( faces[i+0] )),
|
tri::Index(pm,(*fi).V( faces[i+0] )),
|
||||||
tri::Index(pm,(*fi).V( faces[i+1] )),
|
tri::Index(pm,(*fi).V( faces[i+1] )),
|
||||||
tri::Index(pm,(*fi).V( faces[i+2] )) );
|
tri::Index(pm,(*fi).V( faces[i+2] )) );
|
||||||
|
@ -115,6 +126,12 @@ namespace tri {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ImportFromPolyMesh(TriMeshType & tm, PolyMeshType & pm)
|
||||||
|
{
|
||||||
|
std::vector<unsigned int> dummyVector;
|
||||||
|
ImportFromPolyMesh(tm, pm, dummyVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Import a polygon mesh from a triangle mesh
|
\brief Import a polygon mesh from a triangle mesh
|
||||||
|
|
Loading…
Reference in New Issue