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_XY.h>
25 #define MY_XY implPtr<gp_XY>()
27 GeomAPI_XY::GeomAPI_XY(const double theX, const double theY)
28 : GeomAPI_Interface(new gp_XY(theX, theY))
32 double GeomAPI_XY::x() const
37 double GeomAPI_XY::y() const
42 void GeomAPI_XY::setX(const double theX)
44 return MY_XY->SetX(theX);
47 void GeomAPI_XY::setY(const double theY)
49 return MY_XY->SetY(theY);
52 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const std::shared_ptr<GeomAPI_XY>& theArg)
54 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
55 MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
59 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::decreased(
60 const std::shared_ptr<GeomAPI_XY>& theArg)
62 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
63 MY_XY->X() - theArg->x(), MY_XY->Y() - theArg->y()));
67 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
69 std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
73 double GeomAPI_XY::dot(const std::shared_ptr<GeomAPI_XY>& theArg) const
75 return MY_XY->Dot(theArg->impl<gp_XY>());
78 double GeomAPI_XY::cross(const std::shared_ptr<GeomAPI_XY>& theArg) const
80 return MY_XY->Crossed(theArg->impl<gp_XY>());
83 double GeomAPI_XY::distance(const std::shared_ptr<GeomAPI_XY>& theOther) const
85 gp_XY aResult(theOther->x() - x(), theOther->y() - y());
86 return aResult.Modulus();