added the option to avoid triangle subdivisions in the polygonal to triangular mesh conversion
This commit is contained in:
parent
ac53416289
commit
abd332b6dc
|
@ -798,13 +798,13 @@ public:
|
||||||
|
|
||||||
|
|
||||||
template <class TriMeshType>
|
template <class TriMeshType>
|
||||||
static void TriangulateToTriMesh(PolyMeshType &poly_m,TriMeshType &triangle_mesh)
|
static void TriangulateToTriMesh(PolyMeshType &poly_m,TriMeshType &triangle_mesh, bool alsoTriangles = true)
|
||||||
{
|
{
|
||||||
triangle_mesh.Clear();
|
triangle_mesh.Clear();
|
||||||
|
|
||||||
PolyMeshType PolySwap;
|
PolyMeshType PolySwap;
|
||||||
vcg::tri::Append<PolyMeshType,PolyMeshType>::Mesh(PolySwap,poly_m);
|
vcg::tri::Append<PolyMeshType,PolyMeshType>::Mesh(PolySwap,poly_m);
|
||||||
Triangulate(PolySwap);
|
Triangulate(PolySwap, alsoTriangles);
|
||||||
|
|
||||||
//then copy onto the triangle mesh
|
//then copy onto the triangle mesh
|
||||||
vcg::tri::Append<TriMeshType,PolyMeshType>::Mesh(triangle_mesh,PolySwap);
|
vcg::tri::Append<TriMeshType,PolyMeshType>::Mesh(triangle_mesh,PolySwap);
|
||||||
|
@ -1355,12 +1355,25 @@ public:
|
||||||
}while (!NeedMerge.empty());
|
}while (!NeedMerge.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Triangulate(PolyMeshType &poly_m)
|
static void Triangulate(PolyMeshType &poly_m, bool alsoTriangles = true)
|
||||||
{
|
{
|
||||||
size_t size0 = poly_m.face.size();
|
size_t size0 = poly_m.face.size();
|
||||||
|
if (alsoTriangles)
|
||||||
|
{
|
||||||
for (size_t i=0; i<size0; i++)
|
for (size_t i=0; i<size0; i++)
|
||||||
Triangulate(poly_m, i);
|
Triangulate(poly_m, i);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i=0; i<size0; i++)
|
||||||
|
{
|
||||||
|
if (poly_m.face[i].VN() > 3)
|
||||||
|
{
|
||||||
|
Triangulate(poly_m, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ void SegmentSegmentDistance(const vcg::Segment3<ScalarType> &s0,
|
||||||
dist=(closest0-closest1).Norm();
|
dist=(closest0-closest1).Norm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @brief Computes the distance between a triangle and a point.
|
/** @brief Computes the distance between a triangle and a point.
|
||||||
*
|
*
|
||||||
* @param t reference to the triangle
|
* @param t reference to the triangle
|
||||||
* @param q point location
|
* @param q point location
|
||||||
|
@ -447,7 +447,7 @@ void TrianglePointDistance(const vcg::Triangle3<ScalarType> &t,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* return the distance between a triangle and a segment
|
* return the distance between a triangle and a segment
|
||||||
* @param[in] t The input triangle
|
* @param[in] t The input triangle
|
||||||
* @param[in] s The input segment
|
* @param[in] s The input segment
|
||||||
|
|
Loading…
Reference in New Issue