1 // Copyright (C) 2014-2020 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_XY.h>
24 #define MY_XY implPtr<gp_XY>()
26 GeomAPI_XY::GeomAPI_XY(const double theX, const double theY)
27 : GeomAPI_Interface(new gp_XY(theX, theY))
31 double GeomAPI_XY::x() const
36 double GeomAPI_XY::y() const
41 void GeomAPI_XY::setX(const double theX)
43 return MY_XY->SetX(theX);
46 void GeomAPI_XY::setY(const double theY)
48 return MY_XY->SetY(theY);
51 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const std::shared_ptr<GeomAPI_XY>& theArg)
53 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
54 MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
58 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::decreased(
59 const std::shared_ptr<GeomAPI_XY>& theArg)
61 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
62 MY_XY->X() - theArg->x(), MY_XY->Y() - theArg->y()));
66 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
68 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
72 double GeomAPI_XY::dot(const std::shared_ptr<GeomAPI_XY>& theArg) const
74 return MY_XY->Dot(theArg->impl<gp_XY>());
77 double GeomAPI_XY::cross(const std::shared_ptr<GeomAPI_XY>& theArg) const
79 return MY_XY->Crossed(theArg->impl<gp_XY>());
82 double GeomAPI_XY::distance(const std::shared_ptr<GeomAPI_XY>& theOther) const
84 gp_XY aResult(theOther->x() - x(), theOther->y() - y());
85 return aResult.Modulus();