1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
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, or (at your option) any later version.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include<GeomAPI_XYZ.h>
24 #define MY_XYZ implPtr<gp_XYZ>()
26 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
27 : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
31 double GeomAPI_XYZ::x() const
36 double GeomAPI_XYZ::y() const
41 double GeomAPI_XYZ::z() const
46 void GeomAPI_XYZ::setX(const double theX)
48 return MY_XYZ->SetX(theX);
51 void GeomAPI_XYZ::setY(const double theY)
53 return MY_XYZ->SetY(theY);
56 void GeomAPI_XYZ::setZ(const double theZ)
58 return MY_XYZ->SetZ(theZ);
61 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
62 const std::shared_ptr<GeomAPI_XYZ>& theArg)
64 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
65 MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
69 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
70 const std::shared_ptr<GeomAPI_XYZ>& theArg)
72 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
73 MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
77 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
79 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
80 MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
84 double GeomAPI_XYZ::dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const
86 return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
89 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
90 const std::shared_ptr<GeomAPI_XYZ>& theArg) const
92 gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
93 return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
96 double GeomAPI_XYZ::distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const
98 gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
99 return aResult.Modulus();
102 double GeomAPI_XYZ::squareModulus() const
104 return MY_XYZ->SquareModulus();