From d17c1bedcc8aab3064c41037d8788efc64efbcae Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 1 Mar 2013 16:45:29 +0000 Subject: [PATCH] fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A1 +// bool isDegenTria( const SMDS_MeshNode * nn[3] ) +// { + // It was an attemp to fix a problem of a zero area face whose all nodes + // are on one staight EDGE. But omitting this face makes a hole in the mesh :( + // if ( !isDegen && allNodesAreOld ) + // isDegen = isDegenTria( nn ); --- src/StdMeshers/StdMeshers_MEFISTO_2D.cxx | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index 150197a51..113078085 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -770,6 +770,23 @@ void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh, ASSERT(scaley); } +// namespace +// { +// bool isDegenTria( const SMDS_MeshNode * nn[3] ) +// { +// SMESH_TNodeXYZ p1( nn[0] ); +// SMESH_TNodeXYZ p2( nn[1] ); +// SMESH_TNodeXYZ p3( nn[2] ); +// gp_XYZ vec1 = p2 - p1; +// gp_XYZ vec2 = p3 - p1; +// gp_XYZ cross = vec1 ^ vec2; +// const double eps = 1e-100; +// return ( fabs( cross.X() ) < eps && +// fabs( cross.Y() ) < eps && +// fabs( cross.Z() ) < eps ); +// } +// } + //============================================================================= /*! * @@ -785,6 +802,8 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, TopoDS_Face F = TopoDS::Face( _helper->GetSubShape() ); Handle(Geom_Surface) S = BRep_Tool::Surface( F ); + //const size_t nbInputNodes = mefistoToDS.size(); + Z n = mefistoToDS.size(); // nb input points mefistoToDS.resize( nbst ); for ( ; n < nbst; n++) @@ -811,6 +830,9 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, const SMDS_MeshNode * nn[3]; for (n = 1; n <= nbt; n++) { + // const bool allNodesAreOld = ( nust[m + 0] <= nbInputNodes && + // nust[m + 1] <= nbInputNodes && + // nust[m + 2] <= nbInputNodes ); nn[ 0 ] = mefistoToDS[ nust[m++] - 1 ]; nn[ 1 ] = mefistoToDS[ nust[m++] - 1 ]; nn[ 2 ] = mefistoToDS[ nust[m++] - 1 ]; @@ -819,6 +841,12 @@ void StdMeshers_MEFISTO_2D::StoreResult(Z nbst, R2 * uvst, Z nbt, Z * nust, // avoid creating degenetrated faces bool isDegen = ( _helper->HasDegeneratedEdges() && ( nn[0] == nn[1] || nn[1] == nn[2] || nn[2] == nn[0] )); + + // It was an attemp to fix a problem of a zero area face whose all nodes + // are on one staight EDGE. But omitting this face makes a hole in the mesh :( + // if ( !isDegen && allNodesAreOld ) + // isDegen = isDegenTria( nn ); + if ( !isDegen ) _helper->AddFace( nn[0], nn[i1], nn[i2] ); } -- 2.39.2