]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_XY.cpp
Salome HOME
Update SketchPlugin_Projection feature (issue #1459)
[modules/shaper.git] / src / GeomAPI / GeomAPI_XY.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_XY.cpp
4 // Created:     30 May 2014
5 // Author:      Artem ZHIDKOV
6
7 #include<GeomAPI_XY.h>
8
9 #include<gp_XY.hxx>
10
11 #define MY_XY implPtr<gp_XY>()
12
13 GeomAPI_XY::GeomAPI_XY(const double theX, const double theY)
14     : GeomAPI_Interface(new gp_XY(theX, theY))
15 {
16 }
17
18 double GeomAPI_XY::x() const
19 {
20   return MY_XY->X();
21 }
22
23 double GeomAPI_XY::y() const
24 {
25   return MY_XY->Y();
26 }
27
28 void GeomAPI_XY::setX(const double theX)
29 {
30   return MY_XY->SetX(theX);
31 }
32
33 void GeomAPI_XY::setY(const double theY)
34 {
35   return MY_XY->SetY(theY);
36 }
37
38 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const std::shared_ptr<GeomAPI_XY>& theArg)
39 {
40   std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
41       MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
42   return aResult;
43 }
44
45 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::decreased(
46     const std::shared_ptr<GeomAPI_XY>& theArg)
47 {
48   std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(
49       MY_XY->X() - theArg->x(), MY_XY->Y() - theArg->y()));
50   return aResult;
51 }
52
53 const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
54 {
55   std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
56   return aResult;
57 }
58
59 double GeomAPI_XY::dot(const std::shared_ptr<GeomAPI_XY>& theArg) const
60 {
61   return MY_XY->Dot(theArg->impl<gp_XY>());
62 }
63
64 double GeomAPI_XY::cross(const std::shared_ptr<GeomAPI_XY>& theArg) const
65 {
66   return MY_XY->Crossed(theArg->impl<gp_XY>());
67 }
68
69 double GeomAPI_XY::distance(const std::shared_ptr<GeomAPI_XY>& theOther) const
70 {
71   gp_XY aResult(theOther->x() - x(), theOther->y() - y());
72   return aResult.Modulus();
73 }
74