*/
//================================================================================
- TopoDS_Edge nextC1Edge(const TopoDS_Edge& edge,
- SMESH_Mesh & aMesh,
- const bool forward)
+ TopoDS_Edge nextC1Edge(TopoDS_Edge edge,
+ SMESH_Mesh & aMesh,
+ const bool forward)
{
+ if (edge.Orientation() > TopAbs_REVERSED) // INTERNAL
+ edge.Orientation( TopAbs_FORWARD );
TopoDS_Edge eNext;
TopTools_MapOfShape edgeCounter;
edgeCounter.Add( edge );
- TopoDS_Vertex v;
- if (edge.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
- v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
- else {
- TopoDS_Iterator vIt (edge);
- if (forward)
- for (; vIt.More(); vIt.Next())
- v = TopoDS::Vertex(vIt.Value()); // last
- else if (vIt.More())
- v = TopoDS::Vertex(vIt.Value()); // first
- }
+ TopoDS_Vertex v = forward ? TopExp::LastVertex(edge,true) : TopExp::FirstVertex(edge,true);
TopTools_ListIteratorOfListOfShape ancestIt = aMesh.GetAncestors( v );
for ( ; ancestIt.More(); ancestIt.Next() )
{
if ( edgeCounter.Extent() < 3 && !eNext.IsNull() ) {
if ( SMESH_Algo::IsContinuous( edge, eNext )) {
// care of orientation
- TopoDS_Vertex vn;
- if (eNext.Orientation() <= TopAbs_REVERSED) // FORWARD || REVERSED
- vn = forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
- else {
- TopoDS_Iterator vIt (eNext);
- if (forward)
- vn = TopoDS::Vertex(vIt.Value()); // first
- else if (vIt.More())
- for (; vIt.More(); vIt.Next())
- vn = TopoDS::Vertex(vIt.Value()); // last
- }
-
+ if (eNext.Orientation() > TopAbs_REVERSED) // INTERNAL
+ eNext.Orientation( TopAbs_FORWARD );
+ TopoDS_Vertex vn =
+ forward ? TopExp::FirstVertex(eNext,true) : TopExp::LastVertex(eNext,true);
bool reverse = (!v.IsSame(vn));
if ( reverse )
eNext.Reverse();
const bool ignoreMeshed)
{
list< TopoDS_Edge > edges;
- edges.push_back( anEdge );
+ if ( anEdge.Orientation() <= TopAbs_REVERSED )
+ edges.push_back( anEdge );
+ else
+ edges.push_back( TopoDS::Edge( anEdge.Oriented( TopAbs_FORWARD ))); // PAL21718
list <const SMESHDS_Hypothesis *> hypList;
SMESH_Algo* theAlgo = aMesh.GetGen()->GetAlgo( aMesh, anEdge );
if ( theAlgo ) hypList = theAlgo->GetUsedHypothesis(aMesh, anEdge, false);
for ( int forward = 0; forward < 2; ++forward )
{
- TopoDS_Edge eNext = nextC1Edge( anEdge, aMesh, forward );
+ TopoDS_Edge eNext = nextC1Edge( edges.back(), aMesh, forward );
while ( !eNext.IsNull() ) {
if ( ignoreMeshed ) {
// eNext must not have computed mesh