Salome HOME
Copyright update 2022
[modules/shaper.git] / src / GeomAPI / GeomAPI_XYZ.cpp
index f413005fd0aebc80ab6744fef5787a82920b4a85..241c8fb5c1e70e3977e818323b0e449cd7a384d2 100644 (file)
@@ -1,16 +1,32 @@
-// File:        GeomAPI_XYZ.cpp
-// Created:     23 Apr 2014
-// Author:      Mikhail PONIKAROV
+// Copyright (C) 2014-2022  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
 
 #include<GeomAPI_XYZ.h>
 
 #include<gp_XYZ.hxx>
 
-#define MY_XYZ static_cast<gp_XYZ*>(myImpl)
+#define MY_XYZ implPtr<gp_XYZ>()
 
 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
-  : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
-{}
+    : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
+{
+}
 
 double GeomAPI_XYZ::x() const
 {
@@ -42,43 +58,48 @@ void GeomAPI_XYZ::setZ(const double theZ)
   return MY_XYZ->SetZ(theZ);
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
-  const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
+    const std::shared_ptr<GeomAPI_XYZ>& theArg)
 {
-  boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
-    MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
+  std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
+  MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
   return aResult;
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
-  const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
+    const std::shared_ptr<GeomAPI_XYZ>& theArg)
 {
-  boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
-    MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
+  std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
+  MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
   return aResult;
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
 {
-  boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
-    MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
+  std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
+  MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
   return aResult;
 }
 
-double GeomAPI_XYZ::dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+double GeomAPI_XYZ::dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const
 {
   return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
 }
 
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
+    const std::shared_ptr<GeomAPI_XYZ>& theArg) const
 {
   gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
-  return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
+  return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
 }
 
-double GeomAPI_XYZ::distance(const boost::shared_ptr<GeomAPI_XYZ>& theOther) const
+double GeomAPI_XYZ::distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const
 {
   gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
   return aResult.Modulus();
 }
 
+double GeomAPI_XYZ::squareModulus() const
+{
+  return MY_XYZ->SquareModulus();
+}