Salome HOME
Merge branch 'master' of newgeom:newgeom
[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 GeomAPI_Dir2d::GeomAPI_Dir2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
17   : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
18 {}
19
20 double GeomAPI_Dir2d::x() const
21 {
22   return MY_DIR->X();
23 }
24
25 double GeomAPI_Dir2d::y() const
26 {
27   return MY_DIR->Y();
28 }
29
30 const boost::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy() 
31 {
32   return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
33 }
34
35 double GeomAPI_Dir2d::dot(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const
36 {
37   return MY_DIR->Dot(theArg->impl<gp_Dir2d>());
38 }
39
40 double GeomAPI_Dir2d::cross(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const
41 {
42   return MY_DIR->XY().Crossed(theArg->impl<gp_Dir2d>().XY());
43 }
44