From 813e18e7bf907d24938452bf742eb33c256cc11f Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 16 May 2011 14:20:24 +0000 Subject: [PATCH] 0021263: EDF 1868: Several use cases fail (regressions) + * \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 | 22 ++++++++++++++++++++++ src/SMESH/SMESH_MesherHelper.hxx | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index e6d7d84fe..e6e832b76 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -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, diff --git a/src/SMESH/SMESH_MesherHelper.hxx b/src/SMESH/SMESH_MesherHelper.hxx index 087c515f0..79b7d0cab 100644 --- a/src/SMESH/SMESH_MesherHelper.hxx +++ b/src/SMESH/SMESH_MesherHelper.hxx @@ -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 ---------- -- 2.39.2