Salome HOME
23562: EDF 17098 - problem with Extrusion 3D
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadToTriaAdaptor.cxx
index 9259d2e1da78a081c93fa908e9e84da2e1154cd5..fd3a5bb10f8376a3dbb7789039c964905b7facd3 100644 (file)
@@ -296,12 +296,13 @@ namespace
       SMESH_ComputeErrorPtr& err = sm->GetComputeError();
       if ( !err || err->IsOK() )
       {
-        err = SMESH_ComputeError::New( COMPERR_BAD_INPUT_MESH, msg, sm->GetAlgo() );
-        err->myBadElements.push_back( face1 );
-        err->myBadElements.push_back( face2 );
+        SMESH_BadInputElements* badElems =
+          new SMESH_BadInputElements( mesh.GetMeshDS(),COMPERR_BAD_INPUT_MESH, msg, sm->GetAlgo() );
+        badElems->add( face1 );
+        badElems->add( face2 );
+        err.reset( badElems );
       }
     }
-    //throw SALOME_Exception( msg.c_str() );
 
     return false; // == "algo fails"
   }
@@ -485,9 +486,6 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
   gp_XYZ vert1 = P2.XYZ();
   gp_XYZ vert2 = P3.XYZ();
 
-  /* calculate distance from vert0 to ray origin */
-  gp_XYZ  tvec = orig - vert0;
-
   gp_XYZ edge1 = vert1 - vert0;
   gp_XYZ edge2 = vert2 - vert0;
 
@@ -497,9 +495,13 @@ static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
   /* if determinant is near zero, ray lies in plane of triangle */
   double det = edge1 * pvec;
 
-  if (det > -EPSILON && det < EPSILON)
+  const double ANGL_EPSILON = 1e-12;
+  if ( det > -ANGL_EPSILON && det < ANGL_EPSILON )
     return false;
 
+  /* calculate distance from vert0 to ray origin */
+  gp_XYZ  tvec = orig - vert0;
+
   /* calculate U parameter and test bounds */
   double u = ( tvec * pvec ) / det;
   //if (u < 0.0 || u > 1.0)
@@ -1034,7 +1036,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh)
   vector<const SMDS_MeshNode*> FNodes(5);
   TColgp_SequenceOfPnt aContour;
 
-  SMDS_FaceIteratorPtr fIt = meshDS->facesIterator(/*idInceasingOrder=*/true);
+  SMDS_FaceIteratorPtr fIt = meshDS->facesIterator();
   while( fIt->more())
   {
     const SMDS_MeshElement* face = fIt->next();