Added FaceFauxSignedCrease that Marks feature edges according to two signed dihedral angles.

This commit is contained in:
Paolo Cignoni 2013-06-24 06:56:15 +00:00
parent efe6379b4b
commit 5049407069
1 changed files with 37 additions and 4 deletions

View File

@ -358,11 +358,44 @@ public:
} }
} }
} }
//
/// \brief Marks feature edges according to two signed dihedral angles.
/// Actually it marks as fauxedges all the non feature edges,
/// e.g. the edge such that the signed dihedral angle between the normal of two faces sharing it, is between the two given thresholds.
/// In this way all the near planar edges are marked as Faux Edges (e.g. edges to be ignored)
/// Note that it uses the signed dihedral angle convention (negative for concave edges and positive for convex ones);
static void FaceFauxSignedCrease(MeshType &m, float AngleRadNeg, float AngleRadPos )
{
RequirePerFaceFlags(m);
RequireFFAdjacency(m);
//initially Nothing is faux (e.g all crease)
FaceClearF(m);
// Then mark faux only if the signed angle is the range.
for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD())
{
for(int z=0;z<(*fi).VN();++z)
{
if(!face::IsBorder(*fi,z) )
{
ScalarType angle = DihedralAngleRad(*fi,z);
if(angle>AngleRadNeg && angle<AngleRadPos)
(*fi).SetF(z);
}
}
}
}
/// \brief Marks feature edges according to a given angle
/// Actually it marks as fauxedges all the non feature edges,
/// e.g. the edge such that the angle between the normal of two faces sharing it is less than the given threshold.
/// In this way all the near planar edges are marked as Faux Edges (e.g. edges to be ignored)
static void FaceFauxCrease(MeshType &m,float AngleRad) static void FaceFauxCrease(MeshType &m,float AngleRad)
{ {
RequirePerFaceFlags(m); RequirePerFaceFlags(m);
RequireFFAdjacency(m); RequireFFAdjacency(m);
RequirePerFaceNormal(m);
typename MeshType::FaceIterator f; typename MeshType::FaceIterator f;