Salome HOME
Issue #19058: Error in sketch projection when changing parameter
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt.cpp
index 976d3949f3733bf96dddfe5502494f05f39f8b44..d2b943df36e7b3089af3a36846a03fccb27fe4b1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include<GeomAPI_Pnt.h>
+#include <GeomAPI_Ax1.h>
 #include<GeomAPI_XYZ.h>
 #include<GeomAPI_Pnt2d.h>
 #include<GeomAPI_Dir.h>
@@ -85,6 +85,21 @@ bool GeomAPI_Pnt::isEqual(const std::shared_ptr<GeomAPI_Pnt>& theOther) const
   return distance(theOther) < Precision::Confusion();
 }
 
+bool GeomAPI_Pnt::isLess(const std::shared_ptr<GeomAPI_Pnt>& theOther,
+                         const double theTolerance) const
+{
+  if (MY_PNT->X() + theTolerance < theOther->x())
+    return true;
+  else if (MY_PNT->X() < theOther->x() + theTolerance) {
+    if (MY_PNT->Y() + theTolerance < theOther->y())
+      return true;
+    else if (MY_PNT->Y() < theOther->y() + theTolerance &&
+             MY_PNT->Z() + theTolerance < theOther->z())
+      return true;
+  }
+  return false;
+}
+
 std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Pnt::to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
   const std::shared_ptr<GeomAPI_Dir>& theDirX, const std::shared_ptr<GeomAPI_Dir>& theDirY)
 {
@@ -114,3 +129,8 @@ std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Pnt::to2D(const std::shared_ptr<GeomAPI_P
   gp_Pnt2d aRes = ProjLib::Project(aPln, *MY_PNT);
   return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aRes.X(), aRes.Y()));
 }
+
+void GeomAPI_Pnt::rotate(const std::shared_ptr<GeomAPI_Ax1>& theAxis, const double theAngle)
+{
+  MY_PNT->Rotate(theAxis->impl<gp_Ax1>(), theAngle / 180.0 * M_PI);
+}