Salome HOME
0021263: EDF 1868: Several use cases fail (regressions)
authoreap <eap@opencascade.com>
Mon, 16 May 2011 14:20:24 +0000 (14:20 +0000)
committereap <eap@opencascade.com>
Mon, 16 May 2011 14:20:24 +0000 (14:20 +0000)
+ * \brief Wrapper over TopExp::FirstVertex() and TopExp::LastVertex() fixing them
+ *  in the case of INTERNAL edge
+ */
+//================================================================================
+
+TopoDS_Vertex SMESH_MesherHelper::IthVertex( const bool  is2nd,
+                                             TopoDS_Edge anEdge,
+                                             const bool  CumOri )

src/SMESH/SMESH_MesherHelper.cxx
src/SMESH/SMESH_MesherHelper.hxx

index e6d7d84fe073ea5e206b0e6fef9ae01f5c84569d..e6e832b768c038f6773d15cf04770bf01b27fe0e 100644 (file)
@@ -1756,6 +1756,28 @@ bool SMESH_MesherHelper::IsClosedEdge( const TopoDS_Edge& anEdge )
   return TopExp::FirstVertex( anEdge ).IsSame( TopExp::LastVertex( anEdge ));
 }
 
+//================================================================================
+/*!
+ * \brief Wrapper over TopExp::FirstVertex() and TopExp::LastVertex() fixing them
+ *  in the case of INTERNAL edge
+ */
+//================================================================================
+
+TopoDS_Vertex SMESH_MesherHelper::IthVertex( const bool  is2nd,
+                                             TopoDS_Edge anEdge,
+                                             const bool  CumOri )
+{
+  if ( anEdge.Orientation() >= TopAbs_INTERNAL )
+    anEdge.Orientation( TopAbs_FORWARD );
+
+  const TopAbs_Orientation tgtOri = is2nd ? TopAbs_REVERSED : TopAbs_FORWARD;
+  TopoDS_Iterator vIt( anEdge, CumOri );
+  while ( vIt.More() && vIt.Value().Orientation() != tgtOri )
+    vIt.Next();
+
+  return ( vIt.More() ? TopoDS::Vertex(vIt.Value()) : TopoDS_Vertex() );
+}
+
 //=======================================================================
 //function : IsQuadraticMesh
 //purpose  : Check mesh without geometry for: if all elements on this shape are quadratic,
index 087c515f02bd75a4796a09559d2e553718fc50ca..79b7d0caba809be83e30d42cd01e82d4c67ed738 100644 (file)
@@ -147,6 +147,8 @@ public:
 
   static bool IsClosedEdge( const TopoDS_Edge& anEdge );
 
+  static TopoDS_Vertex IthVertex( const bool is2nd, TopoDS_Edge anEdge, const bool CumOri=true );
+
 
 public:
   // ---------- PUBLIC INSTANCE METHODS ----------