Salome HOME
Boost has been removed from code
[modules/shaper.git] / src / GeomAPI / GeomAPI_Dir2d.cpp
1 // File:        GeomAPI_Dir2d.cpp
2 // Created:     23 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include <GeomAPI_Dir2d.h>
6 #include <GeomAPI_XY.h>
7
8 #include <gp_Dir2d.hxx>
9
10 #define MY_DIR static_cast<gp_Dir2d*>(myImpl)
11
12 GeomAPI_Dir2d::GeomAPI_Dir2d(const double theX, const double theY)
13     : GeomAPI_Interface(new gp_Dir2d(theX, theY))
14 {
15 }
16
17 GeomAPI_Dir2d::GeomAPI_Dir2d(const std::shared_ptr<GeomAPI_XY>& theCoords)
18     : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
19 {
20 }
21
22 double GeomAPI_Dir2d::x() const
23 {
24   return MY_DIR->X();
25 }
26
27 double GeomAPI_Dir2d::y() const
28 {
29   return MY_DIR->Y();
30 }
31
32 const std::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy()
33 {
34   return std::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
35 }
36
37 double GeomAPI_Dir2d::dot(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
38 {
39   return MY_DIR->Dot(theArg->impl<gp_Dir2d>());
40 }
41
42 double GeomAPI_Dir2d::cross(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
43 {
44   return MY_DIR->XY().Crossed(theArg->impl<gp_Dir2d>().XY());
45 }
46