Salome HOME
another z layer for hilight presentation
[modules/hydro.git] / src / HYDROCurveCreator / CurveCreator_Utils.cxx
1 // Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "CurveCreator_Utils.h"
21 #include "CurveCreator.hxx"
22 #include "CurveCreator_UtilsICurve.hxx"
23
24 #include <GEOMUtils.hxx>
25
26 #include <gp_Pln.hxx>
27
28 #include <TopoDS.hxx>
29 #include <TopoDS_Vertex.hxx>
30 #include <TopoDS_Wire.hxx>
31 #include <TopoDS_Edge.hxx>
32 #include <TopoDS_Compound.hxx>
33
34 #include <AIS_ListOfInteractive.hxx>
35 #include <AIS_ListIteratorOfListOfInteractive.hxx>
36 #include <AIS_Shape.hxx>
37 #include <AIS_Line.hxx>
38 #include <AIS_Trihedron.hxx>
39 #include <AIS_LocalContext.hxx>
40
41 #include <Geom_Point.hxx>
42 #include <Geom_BSplineCurve.hxx>
43 #include <Geom_Line.hxx>
44
45 #include <TopExp.hxx>
46 #include <TopExp_Explorer.hxx>
47 #include <GeomAPI_ProjectPointOnCurve.hxx>
48 #include <SelectMgr_EntityOwner.hxx>
49 #include <SelectMgr_Selection.hxx>
50 #include <Select3D_SensitivePoint.hxx>
51
52 #include <BRep_Tool.hxx>
53 #include <BRep_Builder.hxx>
54 #include <BRepBuilderAPI_MakeVertex.hxx>
55 #include <BRepBuilderAPI_MakeEdge.hxx>
56 #include <BRepBuilderAPI_MakeWire.hxx>
57
58 #include <TColgp_HArray1OfPnt.hxx>
59 #include <TColStd_HArray1OfBoolean.hxx>
60 #include <TColgp_Array1OfVec.hxx>
61 #include <GeomAPI_Interpolate.hxx>
62
63 #include <ProjLib.hxx>
64 #include <ElSLib.hxx>
65
66 #include <math.h>
67
68 #include "CurveCreator_ICurve.hxx"
69
70 const double LOCAL_SELECTION_TOLERANCE = 0.0001;
71 const int    SCENE_PIXEL_PROJECTION_TOLERANCE = 10;
72 const int    SCENE_PIXEL_POINT_TOLERANCE = 5;
73
74 //=======================================================================
75 // function : ConvertClickToPoint()
76 // purpose  : Returns the point clicked in 3D view
77 //=======================================================================
78 void CurveCreator_Utils::ConvertPointToClick( const gp_Pnt& thePoint,
79                                               Handle(V3d_View) theView,
80                                               int& x, int& y )
81 {
82   theView->Convert(thePoint.X(), thePoint.Y(), thePoint.Z(), x, y );
83 }
84
85
86 //=======================================================================
87 // function : ConvertClickToPoint()
88 // purpose  : Returns the point clicked in 3D view
89 //=======================================================================
90 gp_Pnt CurveCreator_Utils::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
91 {
92   // the 3D point, that is a projection of the pixels to the XYZ view plane
93   //return GEOMUtils::ConvertClickToPoint( x, y, aView );
94
95   // we need the projection to the XOY plane
96   // 1. find a point in the plane of the eye and the normal to the plane
97   Standard_Real X, Y, Z;
98   Quantity_Parameter Vx, Vy, Vz;
99   aView->ConvertWithProj( x, y, X, Y, Z, Vx, Vy, Vz );
100
101   // 2. build a ray from the point by the normal to the XOY plane and intersect it
102   // The ray equation is the following : p(x,y,z) = p0(x,y,z) + t*V(x,y,z)
103   // X,Y,Z - defines p0(x,y,z), Vx,Vy,Vz - defines V(x,y,z)
104   // p(x,y,z) - is a searched point, t - should to be calculated by the condition of XOY plane
105   // The system of equations is the following:
106   // p(x) = p0(x)+t*V(x)
107   // p(y) = p0(y)+t*V(y)
108   // p(z) = p0(z)+t*V(z)
109   // p(z) = 0
110
111   Standard_Real aXp, aYp, aZp;
112   //It is not possible to use Precision::Confusion(), because it is e-0.8, but V is sometimes e-6
113   Standard_Real aPrec = LOCAL_SELECTION_TOLERANCE;
114   if ( fabs( Vz ) > aPrec ) {
115     Standard_Real aT = -Z/Vz;
116     aXp = X + aT*Vx;
117     aYp = Y + aT*Vy;
118     aZp = Z + aT*Vz;
119   }
120   else { // Vz = 0 - the eyed plane is orthogonal to Z plane - XOZ, or YOZ
121     aXp = aYp = aZp = 0;
122     if ( fabs( Vy ) < aPrec ) // Vy = 0 - the YOZ plane
123       aYp = Y;
124     else if ( fabs( Vx ) < aPrec ) // Vx = 0 - the XOZ plane
125       aXp = X;
126   }
127   /*std::cout << "ConvertClickToPoint: " << std::endl
128             << "XYZ1 = (" << X << ", " << Y << ", " << Z << "); " << std::endl
129             << "Vxyz = (" << Vx << ", " << Vy << ", " << Vz << "); " << std::endl
130             << "Resp = (" << aXp << ", " << aYp << ", " << aZp << "); " << std::endl;*/
131
132   gp_Pnt ResultPoint( aXp, aYp, aZp );
133   return ResultPoint;
134 }
135
136 void CurveCreator_Utils::constructShape( const CurveCreator_ICurve* theCurve,
137                                          TopoDS_Shape& theShape )
138 {
139   BRep_Builder aBuilder;
140   TopoDS_Compound aComp;
141   aBuilder.MakeCompound( aComp );
142   for( int iSection = 0 ; iSection < theCurve->getNbSections() ; iSection++ )
143   {
144     int theISection = iSection;
145
146     CurveCreator::SectionType aSectType = theCurve->getSectionType( theISection );
147     int aPointSize = theCurve->getNbPoints( theISection );
148     if ( aPointSize == 0 )
149       continue;
150
151     bool aSectIsClosed = theCurve->isClosed( theISection );
152     bool isPolyline = aSectType == CurveCreator::Polyline;
153
154     int iPoint = 0;
155     gp_Pnt aPrevPoint, aPoint;
156     // filters the curve points to skip equal points
157     std::vector<gp_Pnt> aPoints;
158     CurveCreator_UtilsICurve::getPoint( theCurve, theISection, iPoint, aPoint );
159     aPoints.push_back( aPoint );
160     aPrevPoint = aPoint;
161     iPoint++;
162     for( ; iPoint < aPointSize; iPoint++ ) {
163       CurveCreator_UtilsICurve::getPoint( theCurve, theISection, iPoint, aPoint );
164       if ( !isEqualPoints( aPrevPoint, aPoint ) )
165         aPoints.push_back( aPoint );
166       aPrevPoint = aPoint;
167     }
168     int aNbPoints = aPoints.size();
169
170     if ( aNbPoints == 1 ) {
171       aPoint = aPoints.front();
172       TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
173       aBuilder.Add( aComp, aVertex );
174     }
175     else if ( aNbPoints > 1 ) {
176       Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aNbPoints);
177       TColgp_Array1OfVec aTangents(1, aNbPoints);
178       Handle(TColStd_HArray1OfBoolean) aTangentFlags = new TColStd_HArray1OfBoolean(1, aNbPoints);
179       gp_Vec aNullVec(0, 0, 0);
180
181       TopoDS_Edge aPointEdge;
182       TopoDS_Vertex aVertex;
183
184       std::vector<gp_Pnt>::const_iterator aPointIt = aPoints.begin(), aPointLast = aPoints.end();
185       aPoint = *aPointIt;
186
187       int aHIndex = 1;
188       aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
189       aBuilder.Add( aComp, aVertex );
190       if ( !isPolyline ) {
191         aHCurvePoints->SetValue( aHIndex, aPoint );
192         aTangents.SetValue( aHIndex, aNullVec );
193         aTangentFlags->SetValue( aHIndex, Standard_False );
194         aHIndex++;
195       }
196
197       aPrevPoint = aPoint;
198       aPointIt++;
199       for( ; aPointIt != aPointLast; aPointIt++ ) {
200         aPoint = *aPointIt;
201         aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
202         aBuilder.Add( aComp, aVertex );
203         if ( isPolyline ) {
204           TopoDS_Edge aPointEdge = BRepBuilderAPI_MakeEdge( aPrevPoint, aPoint ).Edge();
205           aBuilder.Add( aComp, aPointEdge );
206         }
207         else {
208           aHCurvePoints->SetValue( aHIndex, aPoint );
209           aTangents.SetValue( aHIndex, aNullVec );
210           aTangentFlags->SetValue( aHIndex, Standard_False );
211           aHIndex++;
212         }
213         aPrevPoint = aPoint;
214       }
215       if( aSectIsClosed && ( aNbPoints > 2 ) ) {
216         aPoint = aPoints.front();
217         aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
218         aBuilder.Add( aComp, aVertex );
219         if ( isPolyline ) {
220           aPointEdge = BRepBuilderAPI_MakeEdge( aPrevPoint, aPoint ).Edge();
221           aBuilder.Add( aComp, aPointEdge );
222         }
223       }
224       if( !isPolyline ) {
225         // compute BSpline
226         Handle(Geom_BSplineCurve) aBSplineCurve;
227         GeomAPI_Interpolate aGBC(aHCurvePoints, aSectIsClosed, gp::Resolution());
228         // correct the spline degree to be as 3 for non-periodic spline if number of points
229         // less than 3. It is need to have a knot in each spline point. This knots are used
230         // to found a neighbour points when a new point is inserted between two existing.
231         if (!aSectIsClosed ) {
232           if (aHCurvePoints->Length() == 3)
233             aGBC.Load(aTangents, aTangentFlags);
234         }
235
236         aGBC.Perform();
237         if ( aGBC.IsDone() )
238           aBSplineCurve = aGBC.Curve();
239         TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSplineCurve ).Edge();
240         TopoDS_Wire aWire = BRepBuilderAPI_MakeWire( anEdge ).Wire();
241         aBuilder.Add( aComp, aWire );
242       }
243     }
244   }
245   theShape = aComp;
246 }
247
248 class CompareSectionToPoint
249 {
250 public:
251   CompareSectionToPoint( const int theISection = -1, const int theIPoint = -1 )
252     : mySectionId( theISection ), myPointId( theIPoint ) {};
253   ~CompareSectionToPoint() {}
254
255   bool operator < ( const CompareSectionToPoint& theOther ) const
256   {
257     bool isLess = mySectionId < theOther.mySectionId;
258     if ( !isLess && mySectionId == theOther.mySectionId )
259       isLess = myPointId < theOther.myPointId;
260     return isLess;
261   }
262
263 private:
264   int mySectionId;
265   int myPointId;
266 };
267
268
269 void CurveCreator_Utils::getSelectedPoints( Handle(AIS_InteractiveContext) theContext,
270                                             const CurveCreator_ICurve* theCurve,
271                                             CurveCreator_ICurve::SectionToPointList& thePoints )
272 {
273   thePoints.clear();
274
275   std::list<float> aSelectedPoints;
276   gp_Pnt aPnt;
277   std::map<CompareSectionToPoint, int> aPointsMap;
278
279   CurveCreator_ICurve::SectionToPointList aPoints;
280   for ( theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected() ) {
281     TopoDS_Vertex aVertex;
282     TopoDS_Shape aShape = theContext->SelectedShape();
283     if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
284       aVertex = TopoDS::Vertex( theContext->SelectedShape() );
285
286     if ( aVertex.IsNull() )
287       continue;
288     aPnt = BRep_Tool::Pnt( aVertex );
289
290     CurveCreator_UtilsICurve::findSectionsToPoints( theCurve, aPnt.X(), aPnt.Y(), aPoints );
291     CurveCreator_ICurve::SectionToPointList::const_iterator anIt = aPoints.begin(),
292                                                             aLast = aPoints.end();
293     CompareSectionToPoint aPoint;
294     for ( ; anIt != aLast; anIt++ ) {
295       aPoint = CompareSectionToPoint( (*anIt).first, (*anIt).second );
296       if ( aPointsMap.find( aPoint ) != aPointsMap.end() )
297         continue;
298       aPointsMap[aPoint] = 0;
299
300       thePoints.push_back( *anIt );
301     }
302   }
303 }
304
305 void CurveCreator_Utils::setSelectedPoints( Handle(AIS_InteractiveContext) theContext,
306                                             const CurveCreator_ICurve* theCurve,
307                                             const CurveCreator_ICurve::SectionToPointList& thePoints )
308 {
309   if ( !theCurve )
310     return;
311
312   Handle(AIS_InteractiveObject) anAIS = theCurve->getAISObject();
313   if ( anAIS.IsNull() )
314     return;
315   Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( anAIS );
316   if ( anAISShape.IsNull() )
317     return;
318
319   //ASL: we convert list of point indices to list of points coordinates
320   int aSize = thePoints.size();
321   std::vector<gp_Pnt> aPntsToSelect( aSize );
322
323   CurveCreator_ICurve::SectionToPointList::const_iterator
324                      aPIt = thePoints.begin(), aPLast = thePoints.end();
325   CurveCreator_ICurve::SectionToPoint aSToPoint;
326   for( int i=0; aPIt != aPLast; aPIt++, i++ )
327   {
328     gp_Pnt aPntToSelect;
329     CurveCreator_UtilsICurve::getPoint( theCurve, aPIt->first, aPIt->second, aPntToSelect );
330     aPntsToSelect[i] = aPntToSelect;
331   }
332
333   theContext->ClearSelected( Standard_False );
334   //ASL: we switch off automatic highlight to improve performance of selection
335   theContext->SetAutomaticHilight( Standard_False );
336
337   Handle_SelectMgr_Selection aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
338   for( aSelection->Init(); aSelection->More(); aSelection->Next() )
339   {
340     Handle_SelectBasics_SensitiveEntity aSenEntity = aSelection->Sensitive();
341     Handle_Select3D_SensitivePoint aSenPnt = Handle_Select3D_SensitivePoint::DownCast( aSenEntity );
342
343     gp_Pnt anOwnerPnt = aSenPnt->Point();
344     Handle_SelectMgr_EntityOwner anOwner = Handle_SelectMgr_EntityOwner::DownCast( aSenPnt->OwnerId() );
345
346
347     CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
348                                                                    aLast = thePoints.end();
349     bool isFound = false;
350     for( int i=0; i<aSize; i++ )
351     {
352       bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE &&
353                          fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
354       if( isIntersect )
355       {
356         theContext->AddOrRemoveSelected( anOwner, Standard_False );
357         break;
358       }
359     }
360   }
361
362   //ASL: we switch on again automatic highlight (otherwise selection will not be shown)
363   //     and call HilightPicked to draw selected owners
364   theContext->SetAutomaticHilight( Standard_True );
365   theContext->LocalContext()->HilightPicked( Standard_True );
366 }
367
368 //=======================================================================
369 // function : setLocalPointContext
370 // purpose  : Open/close the viewer local context
371 //=======================================================================
372 void CurveCreator_Utils::setLocalPointContext( const CurveCreator_ICurve* theCurve,
373                                                Handle(AIS_InteractiveContext) theContext,
374                                                const bool theOpen )
375 {
376   if ( !theContext )
377     return;
378
379   if ( theOpen ) {
380     // Open local context if there is no one
381     if ( !theContext->HasOpenedContext() ) {
382       theContext->ClearCurrents( false );
383       theContext->OpenLocalContext( false/*use displayed objects*/, true/*allow shape decomposition*/ );
384     }
385     // load the curve AIS object to the local context with the point selection
386     Handle(AIS_InteractiveObject) anAIS = theCurve->getAISObject();
387     if ( !anAIS.IsNull() )
388     {
389       if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
390       {
391         theContext->Load( anAIS, -1/*selection mode*/, true/*allow decomposition*/ );
392         theContext->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)TopAbs_VERTEX ) );
393       }
394     }
395   }
396   else {
397     if ( theContext->HasOpenedContext() )
398       theContext->CloseAllContexts();
399   }
400 }
401
402 bool CurveCreator_Utils::pointOnObject( Handle(V3d_View) theView,
403                                         Handle(AIS_InteractiveObject) theObject,
404                                         const int theX, const int theY,
405                                         gp_Pnt& thePoint,
406                                         gp_Pnt& thePoint1, gp_Pnt& thePoint2 )
407 {
408   bool isFullFound = false;
409
410   if ( theObject.IsNull() || theView.IsNull() )
411     return isFullFound;
412   Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast( theObject );
413   if ( aShape.IsNull() )
414     return isFullFound;
415   const TopoDS_Compound& aCompound = TopoDS::Compound( aShape->Shape() );
416   if ( aCompound.IsNull() )
417     return isFullFound;
418
419   gp_Pnt aCurPoint, aCurPoint1, aCurPoint2;
420   gp_Pnt aFoundPoint, aFoundPnt1, aFoundPnt2;
421   Standard_Real aParameter;
422   bool isFound = false;
423   int aDelta, aMinDelta = 2*SCENE_PIXEL_PROJECTION_TOLERANCE*SCENE_PIXEL_PROJECTION_TOLERANCE;
424   TopExp_Explorer anExp( aCompound, TopAbs_EDGE );
425   for ( ; anExp.More(); anExp.Next())
426   {
427     const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
428     if ( anEdge.IsNull() )
429       continue;
430     Standard_Real aFirst, aLast;
431     Handle(Geom_Curve) aCurve = BRep_Tool::Curve( anEdge, aFirst, aLast );
432     if ( aCurve->IsKind( STANDARD_TYPE(Geom_BSplineCurve) ) ) {
433       Handle(Geom_BSplineCurve) aBSplineCurve =
434                           Handle(Geom_BSplineCurve)::DownCast( aCurve );
435       if ( !aBSplineCurve.IsNull() ) {
436         isFound = hasProjectPointOnCurve( theView, theX, theY, aBSplineCurve,
437                                           aParameter, aDelta );
438         if ( isFound ) {
439           aCurPoint = aBSplineCurve->Value( aParameter );
440           Standard_Integer anI1, anI2;
441           aBSplineCurve->LocateU( aParameter, LOCAL_SELECTION_TOLERANCE, anI1, anI2 );
442           aCurPoint1 = aBSplineCurve->Value( aBSplineCurve->Knot( anI1 ) );
443           aCurPoint2 = aBSplineCurve->Value( aBSplineCurve->Knot( anI2 ) );
444         }
445       }
446     }
447     else { // a curve built on a polyline edge
448       Handle(Geom_Line) aGLine = Handle(Geom_Line)::DownCast( aCurve );
449       if ( aGLine.IsNull() )
450         continue;
451       isFound = hasProjectPointOnCurve( theView, theX, theY, aGLine, aParameter,
452                                         aDelta );
453       if ( isFound ) {
454         aCurPoint = aGLine->Value( aParameter );
455         TopoDS_Vertex V1, V2;
456         TopExp::Vertices( anEdge, V1, V2, Standard_True );
457         if ( V1.IsNull() || V2.IsNull() )
458           continue;
459         aCurPoint1 = BRep_Tool::Pnt(V1);
460         aCurPoint2 = BRep_Tool::Pnt(V2);
461
462         // check that the projected point is on the bounded curve
463         gp_Vec aVec1( aCurPoint1, aCurPoint );
464         gp_Vec aVec2( aCurPoint2, aCurPoint );
465         isFound = fabs( aVec1.Angle( aVec2 ) - M_PI ) < LOCAL_SELECTION_TOLERANCE;
466       }
467     }
468     if ( isFound && aMinDelta >= aDelta ) {
469       aMinDelta = aDelta;
470
471       isFullFound = true;
472       aFoundPnt1 = aCurPoint1;
473       aFoundPnt2 = aCurPoint2;
474       aFoundPoint = aCurPoint;
475     }
476   }
477   if ( isFullFound ) {
478     int aX, anY, aX1, anY1, aX2, anY2;
479     int aDelta;
480     CurveCreator_Utils::ConvertPointToClick( aFoundPoint, theView, aX, anY );
481     CurveCreator_Utils::ConvertPointToClick( aFoundPnt1, theView, aX1, anY1 );
482     CurveCreator_Utils::ConvertPointToClick( aFoundPnt2, theView, aX2, anY2 );
483
484     isFullFound = !isEqualPixels( aX, anY, aX1, anY1, SCENE_PIXEL_POINT_TOLERANCE, aDelta ) &&
485                   !isEqualPixels( aX, anY, aX2, anY2, SCENE_PIXEL_POINT_TOLERANCE, aDelta );
486     if ( isFullFound ) {
487       thePoint = aFoundPoint;
488       thePoint1 = aFoundPnt1;
489       thePoint2 = aFoundPnt2;
490     }
491   }
492   return isFullFound;
493 }
494
495 bool CurveCreator_Utils::hasProjectPointOnCurve( Handle(V3d_View) theView,
496                                                  const int theX, const int theY,
497                                                  const Handle(Geom_Curve)& theCurve,
498                                                  Standard_Real& theParameter,
499                                                  int& theDelta )
500 {
501   bool isFound = false;
502   if ( theView.IsNull() )
503     return isFound;
504
505   gp_Pnt aPoint = CurveCreator_Utils::ConvertClickToPoint( theX, theY, theView );
506
507   GeomAPI_ProjectPointOnCurve aProj( aPoint, theCurve );
508   Standard_Integer aNbPoint = aProj.NbPoints();
509   if (aNbPoint > 0) {
510     for (Standard_Integer j = 1; j <= aNbPoint && !isFound; j++) {
511       gp_Pnt aNewPoint = aProj.Point( j );
512       theParameter = aProj.Parameter( j );
513
514       int aX, anY;
515       CurveCreator_Utils::ConvertPointToClick( aNewPoint, theView, aX, anY );
516
517       isFound = isEqualPixels( aX, anY, theX, theY, SCENE_PIXEL_PROJECTION_TOLERANCE, theDelta );
518     }
519   }
520   return isFound;
521 }
522
523 bool CurveCreator_Utils::isEqualPixels( const int theX, const int theY, const int theOtherX,
524                                         const int theOtherY, const double theTolerance, int& theDelta )
525 {
526   int aXDelta = abs( theX - theOtherX );
527   int anYDelta = abs( theY - theOtherY );
528
529   theDelta = aXDelta*aXDelta + anYDelta*anYDelta;
530
531   return aXDelta < theTolerance && anYDelta < theTolerance;
532 }
533
534 bool CurveCreator_Utils::isEqualPoints( const gp_Pnt& thePoint, const gp_Pnt& theOtherPoint )
535 {
536   return theOtherPoint.IsEqual( thePoint, LOCAL_SELECTION_TOLERANCE );
537 }