1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include<GeomAPI_XYZ.h>
25 #define MY_XYZ implPtr<gp_XYZ>()
27 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
28 : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
32 double GeomAPI_XYZ::x() const
37 double GeomAPI_XYZ::y() const
42 double GeomAPI_XYZ::z() const
47 void GeomAPI_XYZ::setX(const double theX)
49 return MY_XYZ->SetX(theX);
52 void GeomAPI_XYZ::setY(const double theY)
54 return MY_XYZ->SetY(theY);
57 void GeomAPI_XYZ::setZ(const double theZ)
59 return MY_XYZ->SetZ(theZ);
62 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
63 const std::shared_ptr<GeomAPI_XYZ>& theArg)
65 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
66 MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
70 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
71 const std::shared_ptr<GeomAPI_XYZ>& theArg)
73 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
74 MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
78 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
80 std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
81 MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
85 double GeomAPI_XYZ::dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const
87 return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
90 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
91 const std::shared_ptr<GeomAPI_XYZ>& theArg) const
93 gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
94 return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
97 double GeomAPI_XYZ::distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const
99 gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
100 return aResult.Modulus();
103 double GeomAPI_XYZ::squareModulus() const
105 return MY_XYZ->SquareModulus();