1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : StdMeshers_FaceSide.hxx
24 // Created : Wed Jan 31 18:41:25 2007
25 // Author : Edward AGAPOV (eap)
28 #include "StdMeshers_FaceSide.hxx"
30 #include "SMDS_EdgePosition.hxx"
31 #include "SMDS_MeshNode.hxx"
32 #include "SMESHDS_Mesh.hxx"
33 #include "SMESHDS_SubMesh.hxx"
34 #include "SMESH_Algo.hxx"
35 #include "SMESH_Mesh.hxx"
36 #include "SMESH_MesherHelper.hxx"
37 #include "SMESH_ComputeError.hxx"
38 #include "SMESH_Block.hxx"
40 #include <Adaptor2d_Curve2d.hxx>
41 #include <BRepAdaptor_CompCurve.hxx>
42 #include <BRep_Builder.hxx>
43 #include <BRep_Tool.hxx>
44 #include <GCPnts_AbscissaPoint.hxx>
45 #include <Geom2dAdaptor_Curve.hxx>
47 #include <TopExp_Explorer.hxx>
49 #include <TopoDS_Face.hxx>
50 #include <TopoDS_Vertex.hxx>
51 #include <TopoDS_Wire.hxx>
55 #include "utilities.h"
57 //================================================================================
59 * \brief Constructor of a side of one edge
60 * \param theFace - the face
61 * \param theEdge - the edge
63 //================================================================================
65 StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
66 const TopoDS_Edge& theEdge,
68 const bool theIsForward,
69 const bool theIgnoreMediumNodes)
71 list<TopoDS_Edge> edges(1,theEdge);
72 *this = StdMeshers_FaceSide( theFace, edges, theMesh, theIsForward, theIgnoreMediumNodes );
75 //================================================================================
77 * \brief Constructor of a side of several edges
78 * \param theFace - the face
79 * \param theEdge - the edge
81 //================================================================================
83 StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
84 list<TopoDS_Edge>& theEdges,
86 const bool theIsForward,
87 const bool theIgnoreMediumNodes)
89 int nbEdges = theEdges.size();
90 myEdge.resize( nbEdges );
91 myEdgeID.resize( nbEdges );
92 myC2d.resize( nbEdges );
93 myC3dAdaptor.resize( nbEdges );
94 myFirst.resize( nbEdges );
95 myLast.resize( nbEdges );
96 myNormPar.resize( nbEdges );
97 myEdgeLength.resize( nbEdges );
98 myIsUniform.resize( nbEdges, true );
100 myNbPonits = myNbSegments = 0;
102 myMissingVertexNodes = false;
103 myIgnoreMediumNodes = theIgnoreMediumNodes;
104 myDefaultPnt2d = gp_Pnt2d( 1e+100, 1e+100 );
105 if ( nbEdges == 0 ) return;
107 SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
110 list<TopoDS_Edge>::iterator edge = theEdges.begin();
111 TopoDS_Iterator vExp;
112 for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
114 int i = theIsForward ? index : nbEdges - index - 1;
115 myEdgeLength[i] = SMESH_Algo::EdgeLength( *edge );
116 if ( myEdgeLength[i] < DBL_MIN ) nbDegen++;
117 myLength += myEdgeLength[i];
119 myEdgeID[i] = meshDS->ShapeToIndex( *edge );
120 if ( !theIsForward ) myEdge[i].Reverse();
122 if ( theFace.IsNull() )
123 BRep_Tool::Range( *edge, myFirst[i], myLast[i] );
125 myC2d[i] = BRep_Tool::CurveOnSurface( *edge, theFace, myFirst[i], myLast[i] );
126 if ( myEdge[i].Orientation() == TopAbs_REVERSED )
127 std::swap( myFirst[i], myLast[i] );
129 if ( SMESHDS_SubMesh* sm = meshDS->MeshElements( *edge )) {
130 int nbN = sm->NbNodes();
131 if ( theIgnoreMediumNodes ) {
132 SMDS_ElemIteratorPtr elemIt = sm->GetElements();
133 if ( elemIt->more() && elemIt->next()->IsQuadratic() )
134 nbN -= sm->NbElements();
137 myNbSegments += sm->NbElements();
139 // TopExp::FirstVertex() and TopExp::LastVertex() return NULL from INTERNAL edge
140 vExp.Initialize( *edge );
141 if ( vExp.Value().Orientation() == TopAbs_REVERSED ) vExp.Next();
142 if ( SMESH_Algo::VertexNode( TopoDS::Vertex( vExp.Value()), meshDS ))
143 myNbPonits += 1; // for the first end
145 myMissingVertexNodes = true;
147 // check if edge has non-uniform parametrization (issue 0020705)
148 if ( !myC2d[i].IsNull() && myEdgeLength[i] > DBL_MIN)
150 Geom2dAdaptor_Curve A2dC( myC2d[i] );
151 double p2 = myFirst[i]+(myLast[i]-myFirst[i])/2., p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.;
152 double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 );
153 double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 );
154 //cout<<"len = "<<len<<" d2 = "<<d2<<" fabs(2*d2/len-1.0) = "<<fabs(2*d2/len-1.0)<<endl;
155 myIsUniform[i] = !( fabs(2*d2/myEdgeLength[i]-1.0) > 0.01 || fabs(2*d4/d2-1.0) > 0.01 );
156 if ( !myIsUniform[i] )
160 Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],L,fp,lp);
161 myC3dAdaptor[i].Load( C3d, fp,lp );
165 vExp.Initialize( theEdges.back() );
166 if ( vExp.Value().Orientation() != TopAbs_REVERSED ) vExp.Next();
169 if ( SMESH_Algo::VertexNode( TopoDS::Vertex( vExp.Value()), meshDS ))
170 myNbPonits++; // for the last end
172 myMissingVertexNodes = true;
174 if ( nbEdges > 1 && myLength > DBL_MIN ) {
175 const double degenNormLen = 1.e-5;
176 double totLength = myLength;
178 totLength += myLength * degenNormLen * nbDegen;
179 double prevNormPar = 0;
180 for ( int i = 0; i < nbEdges; ++i ) {
181 if ( myEdgeLength[ i ] < DBL_MIN )
182 myEdgeLength[ i ] = myLength * degenNormLen;
183 myNormPar[ i ] = prevNormPar + myEdgeLength[i]/totLength;
184 prevNormPar = myNormPar[ i ];
187 myNormPar[nbEdges-1] = 1.;
191 //================================================================================
193 * \brief Constructor of a side for vertex using data from other FaceSide
194 * \param theVertex - the vertex
195 * \param theSide - the side
197 //================================================================================
199 StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
200 const gp_Pnt2d thePnt2d,
201 const StdMeshers_FaceSide* theSide)
205 myMesh = theSide->GetMesh();
206 myDefaultPnt2d = thePnt2d;
208 myPoints = theSide->GetUVPtStruct();
209 myNbPonits = myNbSegments = myPoints.size();
210 std::vector<uvPtStruct>::iterator it = myPoints.begin();
211 for(; it!=myPoints.end(); it++) {
212 (*it).u = thePnt2d.X();
213 (*it).v = thePnt2d.Y();
215 (*it).node = theNode;
219 //================================================================================
221 * \brief Return info on nodes on the side
222 * \retval UVPtStruct* - array of data structures
224 //================================================================================
226 const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
227 double constValue) const
229 if ( myPoints.empty() ) {
231 if ( NbEdges() == 0 ) return myPoints;
233 SMESHDS_Mesh* meshDS = myMesh->GetMeshDS();
234 SMESH_MesherHelper helper(*myMesh);
237 // sort nodes of all edges putting them into a map
239 map< double, const SMDS_MeshNode*> u2node;
241 for ( int i = 0; i < myEdge.size(); ++i )
243 // Put 1st vertex node of a current edge
244 TopoDS_Vertex VV[2]; // TopExp::FirstVertex() returns NULL for INTERNAL edge
245 for ( TopoDS_Iterator vIt(myEdge[i]); vIt.More(); vIt.Next() )
246 VV[ VV[0].IsNull() ? 0 : 1 ] = TopoDS::Vertex(vIt.Value());
247 if ( VV[0].Orientation() == TopAbs_REVERSED ) std::swap ( VV[0], VV[1] );
248 const SMDS_MeshNode* node = SMESH_Algo::VertexNode( VV[0], meshDS );
249 double prevNormPar = ( i == 0 ? 0 : myNormPar[ i-1 ]); // normalized param
250 if ( node ) { // internal nodes may be missing
251 u2node.insert( make_pair( prevNormPar, node ));
254 MESSAGE(" NO NODE on VERTEX" );
258 // Put internal nodes
259 SMESHDS_SubMesh* sm = meshDS->MeshElements( myEdge[i] );
261 vector< pair< double, const SMDS_MeshNode*> > u2nodeVec;
262 u2nodeVec.reserve( sm->NbNodes() );
263 SMDS_NodeIteratorPtr nItr = sm->GetNodes();
264 double paramSize = myLast[i] - myFirst[i];
265 double r = myNormPar[i] - prevNormPar;
266 if ( !myIsUniform[i] )
267 while ( nItr->more() )
269 const SMDS_MeshNode* node = nItr->next();
270 if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
272 double u = helper.GetNodeU( myEdge[i], node, 0, ¶mOK );
273 double aLenU = GCPnts_AbscissaPoint::Length
274 ( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), myFirst[i], u );
275 if ( myEdgeLength[i] < aLenU ) // nonregression test "3D_mesh_NETGEN/G6"
280 double normPar = prevNormPar + r*aLenU/myEdgeLength[i];
281 u2nodeVec.push_back( make_pair( normPar, node ));
283 nItr = sm->GetNodes();
284 if ( u2nodeVec.empty() )
285 while ( nItr->more() )
287 const SMDS_MeshNode* node = nItr->next();
288 if ( myIgnoreMediumNodes && SMESH_MeshEditor::IsMedium( node, SMDSAbs_Edge ))
290 double u = helper.GetNodeU( myEdge[i], node, 0, ¶mOK );
292 // paramSize is signed so orientation is taken into account
293 double normPar = prevNormPar + r * ( u - myFirst[i] ) / paramSize;
294 u2nodeVec.push_back( make_pair( normPar, node ));
296 u2node.insert( u2nodeVec.begin(), u2nodeVec.end() );
298 // Put 2nd vertex node for a last edge
299 if ( i+1 == myEdge.size() ) {
300 node = SMESH_Algo::VertexNode( VV[1], meshDS );
302 MESSAGE(" NO NODE on VERTEX" );
305 u2node.insert( make_pair( 1., node ));
308 if ( u2node.size() != myNbPonits ) {
309 MESSAGE("Wrong node parameters on edges, u2node.size():"
310 <<u2node.size()<<" != myNbPonits:"<<myNbPonits);
314 // fill array of UVPtStruct
316 vector<uvPtStruct>* points = const_cast<vector<uvPtStruct>*>( &myPoints );
317 points->resize( myNbPonits );
320 double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
321 map< double, const SMDS_MeshNode*>::iterator u_node = u2node.begin();
322 for (int i = 0 ; u_node != u2node.end(); ++u_node, ++i ) {
323 UVPtStruct & uvPt = (*points)[i];
324 uvPt.node = u_node->second;
325 uvPt.x = uvPt.y = uvPt.normParam = u_node->first;
326 if ( isXConst ) uvPt.x = constValue;
327 else uvPt.y = constValue;
328 const SMDS_EdgePosition* epos =
329 dynamic_cast<const SMDS_EdgePosition*>(uvPt.node->GetPosition());
330 if (( myNormPar[ EdgeIndex ] < uvPt.normParam ) ||
331 ( epos && uvPt.node->getshapeId() != myEdgeID[ EdgeIndex ])) // for myMissingVertexNodes
333 prevNormPar = myNormPar[ EdgeIndex ];
336 if ( EdgeIndex >= myEdge.size() ) {
338 MESSAGE ( "WRONg EdgeIndex " << 1+EdgeIndex
339 << " myNormPar.size()="<<myNormPar.size()
340 << " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
341 << " uvPt.normParam="<<uvPt.normParam );
344 paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
347 uvPt.param = epos->GetUParameter();
350 double r = ( uvPt.normParam - prevNormPar )/ paramSize;
351 // uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
352 uvPt.param = ( r > 0.5 ? myLast[EdgeIndex] : myFirst[EdgeIndex] );
354 if ( !myC2d[ EdgeIndex ].IsNull() ) {
355 gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
360 uvPt.u = uvPt.v = 1e+100;
367 //================================================================================
369 * \brief Falsificate info on nodes
370 * \param nbSeg - nb of segments on the side
371 * \retval UVPtStruct* - array of data structures
373 //================================================================================
375 const vector<UVPtStruct>& StdMeshers_FaceSide::SimulateUVPtStruct(int nbSeg,
377 double constValue) const
379 if ( myFalsePoints.empty() ) {
381 if ( NbEdges() == 0 ) return myFalsePoints;
383 vector<uvPtStruct>* points = const_cast<vector<uvPtStruct>*>( &myFalsePoints );
384 points->resize( nbSeg+1 );
387 double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
388 for (int i = 0 ; i < myFalsePoints.size(); ++i ) {
389 double normPar = double(i) / double(nbSeg);
390 UVPtStruct & uvPt = (*points)[i];
392 uvPt.x = uvPt.y = uvPt.param = uvPt.normParam = normPar;
393 if ( isXConst ) uvPt.x = constValue;
394 else uvPt.y = constValue;
395 if ( myNormPar[ EdgeIndex ] < normPar ) {
396 prevNormPar = myNormPar[ EdgeIndex ];
398 paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
400 double r = ( normPar - prevNormPar )/ paramSize;
401 uvPt.param = myFirst[EdgeIndex] * ( 1 - r ) + myLast[EdgeIndex] * r;
402 if ( !myC2d[ EdgeIndex ].IsNull() ) {
403 gp_Pnt2d p = myC2d[ EdgeIndex ]->Value( uvPt.param );
408 uvPt.u = uvPt.v = 1e+100;
412 return myFalsePoints;
414 // gp_Pnt StdMeshers_FaceSide::Value(double U) const
418 //================================================================================
420 * \brief reverse order of vector elements
421 * \param vec - vector to reverse
423 //================================================================================
425 template <typename T > void reverse(vector<T> & vec)
427 for ( int f=0, r=vec.size()-1; f < r; ++f, --r )
428 std::swap( vec[f], vec[r] );
431 //================================================================================
433 * \brief Change orientation of side geometry
435 //================================================================================
437 void StdMeshers_FaceSide::Reverse()
439 int nbEdges = myEdge.size();
440 for ( int i = nbEdges-1; i >= 0; --i ) {
441 std::swap( myFirst[i], myLast[i] );
443 if ( i > 0 ) // at the first loop 1. is overwritten
444 myNormPar[i] = 1 - myNormPar[i-1];
450 reverse( myC3dAdaptor );
453 reverse( myNormPar );
454 reverse( myEdgeLength );
455 reverse( myIsUniform );
459 myNormPar[nbEdges-1]=1.;
461 myFalsePoints.clear();
465 //================================================================================
467 * \brief Show side features
469 //================================================================================
471 void StdMeshers_FaceSide::dump(const char* msg) const
474 if (msg) MESSAGE ( std::endl << msg );
475 MESSAGE_BEGIN ("NB EDGES: "<< myEdge.size() );
476 MESSAGE_ADD ( "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() );
477 for ( int i=0; i<myEdge.size(); ++i)
479 MESSAGE_ADD ( "\t"<<i+1 );
480 MESSAGE_ADD ( "\tEDGE: " );
481 if (myEdge[i].IsNull()) {
482 MESSAGE_ADD ( "NULL" );
485 TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
486 MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
487 << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() );
489 MESSAGE_ADD ( "\tC2d: ");
491 if (myC2d[i].IsNull()) {
492 MESSAGE_ADD ( "NULL" );
495 MESSAGE_ADD ( myC2d[i].operator->() );
498 MESSAGE_ADD ( "\tF: "<<myFirst[i]<< " L: "<< myLast[i] );
499 MESSAGE_END ( "\tnormPar: "<<myNormPar[i]<<endl );
504 //================================================================================
506 * \brief Creates a Adaptor2d_Curve2d to be used in SMESH_Block
507 * \retval Adaptor2d_Curve2d* -
509 //================================================================================
511 struct Adaptor2dCurve2d : public Adaptor2d_Curve2d
513 const StdMeshers_FaceSide* mySide;
514 Adaptor2dCurve2d(const StdMeshers_FaceSide* faceSide):mySide(faceSide) {}
515 gp_Pnt2d Value(const Standard_Real U) const { return mySide->Value2d( U ); }
516 Standard_Real FirstParameter() const { return 0; }
517 Standard_Real LastParameter() const { return 1; }
520 Adaptor2d_Curve2d* StdMeshers_FaceSide::GetCurve2d() const
522 return new Adaptor2dCurve2d( this );
525 //================================================================================
527 * \brief Creates a fully functional Adaptor_Curve
529 //================================================================================
531 BRepAdaptor_CompCurve* StdMeshers_FaceSide::GetCurve3d() const
533 if ( myEdge.empty() )
537 BRep_Builder aBuilder;
538 aBuilder.MakeWire(aWire);
539 for ( int i=0; i<myEdge.size(); ++i )
540 aBuilder.Add( aWire, myEdge[i] );
542 if ( myEdge.size() == 2 && FirstVertex().IsSame( LastVertex() ))
543 aWire.Closed(true); // issue 0021141
545 return new BRepAdaptor_CompCurve( aWire );
549 //================================================================================
551 * \brief Return 2D point by normalized parameter
552 * \param U - normalized parameter value
553 * \retval gp_Pnt2d - point
555 //================================================================================
557 gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
559 if ( !myC2d[0].IsNull() ) {
560 int i = EdgeIndex( U );
561 double prevU = i ? myNormPar[ i-1 ] : 0;
562 double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
564 double par = myFirst[i] * ( 1 - r ) + myLast[i] * r;
566 // check parametrization of curve
567 if( !myIsUniform[i] )
569 double aLen3dU = r * myEdgeLength[i] * ( myFirst[i]>myLast[i] ? -1. : 1.);
570 GCPnts_AbscissaPoint AbPnt
571 ( const_cast<GeomAdaptor_Curve&>( myC3dAdaptor[i]), aLen3dU, myFirst[i] );
572 if( AbPnt.IsDone() ) {
573 par = AbPnt.Parameter();
576 return myC2d[ i ]->Value(par);
579 return myDefaultPnt2d;
582 //================================================================================
584 * \brief Return wires of a face as StdMeshers_FaceSide's
586 //================================================================================
588 TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
589 SMESH_Mesh & theMesh,
590 const bool theIgnoreMediumNodes,
594 list< TopoDS_Edge > edges, internalEdges;
595 list< int > nbEdgesInWires;
596 int nbWires = SMESH_Block::GetOrderedEdges (theFace, V1, edges, nbEdgesInWires);
598 // split list of all edges into separate wires
599 TSideVector wires( nbWires );
600 list< int >::iterator nbE = nbEdgesInWires.begin();
601 list< TopoDS_Edge >::iterator from = edges.begin(), to = from;
602 for ( int iW = 0; iW < nbWires; ++iW, ++nbE )
604 std::advance( to, *nbE );
605 if ( *nbE == 0 ) // Issue 0020676
609 wires.resize( nbWires );
612 list< TopoDS_Edge > wireEdges( from, to );
613 // assure that there is a node on the first vertex
614 // as StdMeshers_FaceSide::GetUVPtStruct() requires
615 if ( wireEdges.front().Orientation() != TopAbs_INTERNAL ) // Issue 0020676
617 while ( !SMESH_Algo::VertexNode( TopExp::FirstVertex( wireEdges.front(), true),
618 theMesh.GetMeshDS()))
620 wireEdges.splice(wireEdges.end(), wireEdges,
621 wireEdges.begin(), ++wireEdges.begin());
622 if ( from->IsSame( wireEdges.front() )) {
624 ( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"No nodes on vertices"));
625 return TSideVector(0);
629 else if ( *nbE > 1 ) // Issue 0020676 (Face_pb_netgen.brep) - several internal edges in a wire
631 internalEdges.splice( internalEdges.end(), wireEdges, ++wireEdges.begin(), wireEdges.end());
634 StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
635 /*isForward=*/true, theIgnoreMediumNodes);
636 wires[ iW ] = StdMeshers_FaceSidePtr( wire );
639 while ( !internalEdges.empty() )
641 StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, internalEdges.back(), &theMesh,
642 /*isForward=*/true, theIgnoreMediumNodes);
643 wires.push_back( StdMeshers_FaceSidePtr( wire ));
644 internalEdges.pop_back();
649 //================================================================================
651 * \brief Return 1st vertex of the i-the edge
653 //================================================================================
655 TopoDS_Vertex StdMeshers_FaceSide::FirstVertex(int i) const
660 v = myEdge[i].Orientation() <= TopAbs_REVERSED ? // FORWARD || REVERSED
661 TopExp::FirstVertex( myEdge[i], 1 ) :
662 TopoDS::Vertex( TopoDS_Iterator( myEdge[i] ).Value() );
667 //================================================================================
669 * \brief Return last vertex of the i-the edge
671 //================================================================================
673 TopoDS_Vertex StdMeshers_FaceSide::LastVertex(int i) const
678 const TopoDS_Edge& edge = i<0 ? myEdge[ NbEdges() + i ] : myEdge[i];
679 if ( edge.Orientation() <= TopAbs_REVERSED ) // FORWARD || REVERSED
680 v = TopExp::LastVertex( edge, 1 );
682 for ( TopoDS_Iterator vIt( edge ); vIt.More(); vIt.Next() )
683 v = TopoDS::Vertex( vIt.Value() );