Salome HOME
Copyright update 2022
[modules/shaper.git] / src / GeomAPI / GeomAPI_Ax3.cpp
index d7950b585126717c0e96d409e92ceb1a7d877d5c..969bb12363d03cfd368be6679343dc2ba47eccf3 100644 (file)
@@ -1,9 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAPI_Ax3.cpp
-// Created:     16 February 2015
-// Author:      Vitaly SMETANNIKOV
-
+// 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_Ax3.h"
 #include "GeomAPI_XYZ.h"
@@ -15,7 +27,7 @@
 #include <Precision.hxx>
 
 
-#define MY_AX3 static_cast<gp_Ax3*>(myImpl)
+#define MY_AX3 implPtr<gp_Ax3>()
 
 
 GeomAPI_Ax3::GeomAPI_Ax3()
@@ -25,13 +37,11 @@ GeomAPI_Ax3::GeomAPI_Ax3()
 
 GeomAPI_Ax3::GeomAPI_Ax3(std::shared_ptr<GeomAPI_Pnt> theOrigin,
                          std::shared_ptr<GeomAPI_Dir> theDirX,
-                         std::shared_ptr<GeomAPI_Dir> theDirY,
                          std::shared_ptr<GeomAPI_Dir> theNorm)
-: GeomAPI_Interface(new gp_Ax3(theOrigin->impl<gp_Pnt>(), 
-                               theNorm->impl<gp_Dir>(), 
+: GeomAPI_Interface(new gp_Ax3(theOrigin->impl<gp_Pnt>(),
+                               theNorm->impl<gp_Dir>(),
                                theDirX->impl<gp_Dir>()))
  {
-   MY_AX3->SetYDirection(theDirY->impl<gp_Dir>());
  }
 
 void GeomAPI_Ax3::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
@@ -69,14 +79,14 @@ std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax3::dirY() const
   return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
 }
 
-void GeomAPI_Ax3::setNorm(const std::shared_ptr<GeomAPI_Dir>& theNorm)
+void GeomAPI_Ax3::setNormal(const std::shared_ptr<GeomAPI_Dir>& theNorm)
 {
   gp_Ax1 aAx1 = MY_AX3->Axis();
   aAx1.SetDirection(theNorm->impl<gp_Dir>());
   MY_AX3->SetAxis(aAx1);
 }
 
-std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax3::norm() const
+std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax3::normal() const
 {
   gp_Dir aDir = MY_AX3->Axis().Direction();
   return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(),aDir.Y(),aDir.Z()));
@@ -96,12 +106,12 @@ std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax3::to3D(double theX, double theY) const
 std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Ax3::to2D(double theX, double theY, double theZ) const
 {
   gp_Pnt anOriginPnt = MY_AX3->Axis().Location();
-  gp_Vec aVec(anOriginPnt, gp_Pnt(0, 0, 0));
+  gp_Vec aVec(anOriginPnt, gp_Pnt(theX, theY, theZ));
 
   gp_Dir aXDir = MY_AX3->XDirection();
   gp_Dir aYDir = MY_AX3->YDirection();
 
   double aX = aVec.X() * aXDir.X() + aVec.Y() * aXDir.Y() + aVec.Z() * aXDir.Z();
-  double aY = aVec.X() * aYDir.X() + aVec.Y() * aYDir.Y() + aVec.Z() * aYDir.Y();
+  double aY = aVec.X() * aYDir.X() + aVec.Y() * aYDir.Y() + aVec.Z() * aYDir.Z();
   return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
-}
\ No newline at end of file
+}