added SplitNonFlatQuads method
This commit is contained in:
parent
5380a6f7f6
commit
36d9030955
|
@ -45,6 +45,8 @@ void MakeDominant(MeshType &m, int level)
|
||||||
void MakeBitTriOnly(MeshType &m)
|
void MakeBitTriOnly(MeshType &m)
|
||||||
- inverse process: returns to tri-only mesh
|
- inverse process: returns to tri-only mesh
|
||||||
|
|
||||||
|
int SplitNonFlatQuads(MeshType &m, ScalarType toleranceDeg=0){
|
||||||
|
- as above, but splits only non flat quads
|
||||||
|
|
||||||
(more info in comments before each method)
|
(more info in comments before each method)
|
||||||
|
|
||||||
|
@ -71,7 +73,6 @@ typedef typename MeshType::VertexIterator VertexIterator;
|
||||||
|
|
||||||
typedef BitQuad<MeshType> BQ; // static class to make basic quad operations
|
typedef BitQuad<MeshType> BQ; // static class to make basic quad operations
|
||||||
|
|
||||||
|
|
||||||
// helper function:
|
// helper function:
|
||||||
// given a triangle, merge it with its best neightboord to form a quad
|
// given a triangle, merge it with its best neightboord to form a quad
|
||||||
template <bool override>
|
template <bool override>
|
||||||
|
@ -275,6 +276,27 @@ static bool MakeTriEvenByDelete(MeshType& m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Splits any quad that makes an angle steeper than given degrees
|
||||||
|
*/
|
||||||
|
static int SplitNonFlatQuads(MeshType &m, ScalarType deg=0){
|
||||||
|
int res=0;
|
||||||
|
float th = math::Cos(math::ToRad(deg));
|
||||||
|
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||||
|
if (fi->IsAnyF()) {
|
||||||
|
int faux = BQ::FauxIndex(&*fi);
|
||||||
|
FaceType *fb = fi->FFp(faux);
|
||||||
|
if (fb->N()*fi->N()<th) {
|
||||||
|
fi->ClearF(faux);
|
||||||
|
fb->ClearF(fi->FFi(faux));
|
||||||
|
res++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Given a mesh, makes it bit trianglular (makes all edges NOT faux)
|
Given a mesh, makes it bit trianglular (makes all edges NOT faux)
|
||||||
*/
|
*/
|
||||||
|
@ -769,9 +791,6 @@ static bool MakePureByFlip(MeshType &m, int maxdist=10000)
|
||||||
*/
|
*/
|
||||||
static void MakeDominant(MeshType &m, int level){
|
static void MakeDominant(MeshType &m, int level){
|
||||||
|
|
||||||
assert(MeshType::HasPerFaceQuality());
|
|
||||||
assert(MeshType::HasPerFaceFlags());
|
|
||||||
|
|
||||||
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) {
|
for (FaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) {
|
||||||
fi->ClearAllF();
|
fi->ClearAllF();
|
||||||
fi->Q() = 0;
|
fi->Q() = 0;
|
||||||
|
|
Loading…
Reference in New Issue