Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / GeomAPI / GeomAPI_XY.cpp
1 // File:        GeomAPI_XY.cpp
2 // Created:     30 May 2014
3 // Author:      Artem ZHIDKOV
4
5 #include<GeomAPI_XY.h>
6
7 #include<gp_XY.hxx>
8
9 #define MY_XY static_cast<gp_XY*>(myImpl)
10
11 GeomAPI_XY::GeomAPI_XY(const double theX, const double theY)
12     : GeomAPI_Interface(new gp_XY(theX, theY))
13 {
14 }
15
16 double GeomAPI_XY::x() const
17 {
18   return MY_XY->X();
19 }
20
21 double GeomAPI_XY::y() const
22 {
23   return MY_XY->Y();
24 }
25
26 void GeomAPI_XY::setX(const double theX)
27 {
28   return MY_XY->SetX(theX);
29 }
30
31 void GeomAPI_XY::setY(const double theY)
32 {
33   return MY_XY->SetY(theY);
34 }
35
36 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const std::shared_ptr<GeomAPI_XY>& theArg)
37 {
38   std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
39   return aResult;
40 }
41
42 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
43 {
44   std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
45   return aResult;
46 }
47
48 double GeomAPI_XY::dot(const std::shared_ptr<GeomAPI_XY>& theArg) const
49 {
50   return MY_XY->Dot(theArg->impl<gp_XY>());
51 }
52
53 double GeomAPI_XY::cross(const std::shared_ptr<GeomAPI_XY>& theArg) const
54 {
55   return MY_XY->Crossed(theArg->impl<gp_XY>());
56 }
57
58 double GeomAPI_XY::distance(const std::shared_ptr<GeomAPI_XY>& theOther) const
59 {
60   gp_XY aResult(theOther->x() - x(), theOther->y() - y());
61   return aResult.Modulus();
62 }
63