- TopTools_ListIteratorOfListOfShape ancestIt =
- myHelper->GetMesh()->GetAncestors( V1 );
- for ( ; ancestIt.More(); ancestIt.Next() )
- {
- const TopoDS_Shape & ancestor = ancestIt.Value();
- if ( ancestor.ShapeType() == TopAbs_EDGE )
- for ( TopExp_Explorer e( ancestor, TopAbs_VERTEX ); e.More(); e.Next() )
- if ( V2.IsSame( e.Current() ))
- return TopoDS::Edge( ancestor );
- }
+ TopoDS_Shape ancestor = myHelper->GetCommonAncestor( V1, V2, *myHelper->GetMesh(), TopAbs_EDGE);
+ if ( !ancestor.IsNull() )
+ return TopoDS::Edge( ancestor );