Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt2d.cpp
index 70bc646930fab9e98b4bfaf9028ee58030d9dcf3..2bd8e3937982f62d42bc0f6c734cc4712ab2cd3d 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 // File:        GeomAPI_Pnt2d.cpp
 // Created:     29 May 2014
 // Author:      Artem ZHIDKOV
@@ -10,6 +12,8 @@
 
 #include<gp_Pnt2d.hxx>
 
+#include <Precision.hxx>
+
 #define MY_PNT2D static_cast<gp_Pnt2d*>(myImpl)
 
 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY)
@@ -17,7 +21,7 @@ GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY)
 {
 }
 
-GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
+GeomAPI_Pnt2d::GeomAPI_Pnt2d(const std::shared_ptr<GeomAPI_XY>& theCoords)
     : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
 {
 }
@@ -42,22 +46,27 @@ void GeomAPI_Pnt2d::setY(const double theY)
   return MY_PNT2D->SetY(theY);
 }
 
-boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
-                                                   const boost::shared_ptr<GeomAPI_Dir>& theDirX,
-                                                   const boost::shared_ptr<GeomAPI_Dir>& theDirY)
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+                                                   const std::shared_ptr<GeomAPI_Dir>& theDirX,
+                                                   const std::shared_ptr<GeomAPI_Dir>& theDirY)
 {
-  boost::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
+  std::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
       ->added(theDirY->xyz()->multiplied(y()));
 
-  return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
+  return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
 }
 
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
+const std::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
 {
-  return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
+  return std::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
 }
 
-double GeomAPI_Pnt2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
+double GeomAPI_Pnt2d::distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const
 {
   return MY_PNT2D->Distance(theOther->impl<gp_Pnt2d>());
 }
+
+bool GeomAPI_Pnt2d::isEqual(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const
+{
+  return distance(theOther) < Precision::Confusion();
+}