Improved Documentation for FlipEdge

This commit is contained in:
Paolo Cignoni 2016-12-16 23:54:57 +01:00
parent 32680eac28
commit c0a99c8b3a
1 changed files with 29 additions and 13 deletions

View File

@ -566,10 +566,10 @@ bool CheckFlipEdgeNormal(FaceType &f, const int z, const float angleRad)
assert((NewDiag1 != NewDiag0) && (NewDiag1 != OldDiag0) && (NewDiag1 != OldDiag1)); assert((NewDiag1 != NewDiag0) && (NewDiag1 != OldDiag0) && (NewDiag1 != OldDiag1));
CoordType oldN0 = NormalizedNormal( NewDiag0->cP(),OldDiag0->cP(),OldDiag1->cP()); CoordType oldN0 = Normal( NewDiag0->cP(),OldDiag0->cP(),OldDiag1->cP()).Normalize();
CoordType oldN1 = NormalizedNormal( NewDiag1->cP(),OldDiag1->cP(),OldDiag0->cP()); CoordType oldN1 = Normal( NewDiag1->cP(),OldDiag1->cP(),OldDiag0->cP()).Normalize();
CoordType newN0 = NormalizedNormal( OldDiag0->cP(),NewDiag1->cP(),NewDiag0->cP()); CoordType newN0 = Normal( OldDiag0->cP(),NewDiag1->cP(),NewDiag0->cP()).Normalize();
CoordType newN1 = NormalizedNormal( OldDiag1->cP(),NewDiag0->cP(),NewDiag1->cP()); CoordType newN1 = Normal( OldDiag1->cP(),NewDiag0->cP(),NewDiag1->cP()).Normalize();
if(AngleN(oldN0,newN0) > angleRad) return false; if(AngleN(oldN0,newN0) > angleRad) return false;
if(AngleN(oldN0,newN1) > angleRad) return false; if(AngleN(oldN0,newN1) > angleRad) return false;
if(AngleN(oldN1,newN0) > angleRad) return false; if(AngleN(oldN1,newN0) > angleRad) return false;
@ -629,13 +629,28 @@ bool CheckFlipEdge(FaceType &f, int z)
/*! /*!
* Flip the z-th edge of the face f. * Flip the z-th edge of the face f.
* Check for topological correctness first using <CODE>CheckFlipFace()</CODE>. * Check for topological correctness first using <CODE>CheckFlipEdge()</CODE>.
* \param f pointer to the face * \param f pointer to the face
* \param z the edge index * \param z the edge index
* *
* Note: For <em>edge flip</em> we intend the swap of the diagonal of the rectangle * Note: For <em>edge flip</em> we intend the swap of the diagonal of the quadrilater
* formed by the face \a f and the face adjacent to the specified edge. * formed by the face \a f and the face adjacent to the specified edge.
*
* 0__________ 2 0__________2
* -> 1|\ | | /|1
* | \ g | | g / |
* | \ | |w / |
* | f z\w | | / f z|
* | \ | | / |
* |__________\|1 <- 1|/__________|
* 2 0 2 0
*
* Note that, after an operation FlipEdge(f,z)
* to topologically revert it should be sufficient to do FlipEdge(f,z+1)
* (even if the mesh is actually different: f and g will be swapped)
*
*/ */
template <class FaceType> template <class FaceType>
void FlipEdge(FaceType &f, const int z) void FlipEdge(FaceType &f, const int z)
{ {
@ -644,14 +659,14 @@ void FlipEdge(FaceType &f, const int z)
assert( !IsBorder(f,z) ); assert( !IsBorder(f,z) );
assert( face::IsManifold<FaceType>(f, z)); assert( face::IsManifold<FaceType>(f, z));
FaceType *g = f.FFp(z); FaceType *g = f.FFp(z); // The other face
int w = f.FFi(z); int w = f.FFi(z); // and other side
assert( g->V(w) == f.V1(z) ); assert( g->V0(w) == f.V1(z) );
assert( g->V1(w)== f.V(z) ); assert( g->V1(w) == f.V0(z) );
assert( g->V2(w)!= f.V(z) ); assert( g->V2(w) != f.V0(z) );
assert( g->V2(w)!= f.V1(z) ); assert( g->V2(w) != f.V1(z) );
assert( g->V2(w)!= f.V2(z) ); assert( g->V2(w) != f.V2(z) );
f.V1(z) = g->V2(w); f.V1(z) = g->V2(w);
g->V1(w) = f.V2(z); g->V1(w) = f.V2(z);
@ -685,6 +700,7 @@ void FlipEdge(FaceType &f, const int z)
g->FFp(w)->FFp( g->FFi(w) ) = g; g->FFp(w)->FFp( g->FFi(w) ) = g;
g->FFp(w)->FFi( g->FFi(w) ) = w; g->FFp(w)->FFi( g->FFi(w) ) = w;
} }
} }
template <class FaceType> template <class FaceType>