]> SALOME platform Git repositories - modules/shaper.git/blob - src/GeomAPI/GeomAPI_Dir2d.cpp
Salome HOME
Switch Wireframe/Shading with closing of context
[modules/shaper.git] / src / GeomAPI / GeomAPI_Dir2d.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Dir2d.cpp
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include <GeomAPI_Dir2d.h>
8 #include <GeomAPI_XY.h>
9
10 #include <gp_Dir2d.hxx>
11
12 #define MY_DIR static_cast<gp_Dir2d*>(myImpl)
13
14 GeomAPI_Dir2d::GeomAPI_Dir2d(const double theX, const double theY)
15     : GeomAPI_Interface(new gp_Dir2d(theX, theY))
16 {
17 }
18
19 GeomAPI_Dir2d::GeomAPI_Dir2d(const std::shared_ptr<GeomAPI_XY>& theCoords)
20     : GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
21 {
22 }
23
24 double GeomAPI_Dir2d::x() const
25 {
26   return MY_DIR->X();
27 }
28
29 double GeomAPI_Dir2d::y() const
30 {
31   return MY_DIR->Y();
32 }
33
34 const std::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy()
35 {
36   return std::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
37 }
38
39 double GeomAPI_Dir2d::dot(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
40 {
41   return MY_DIR->Dot(theArg->impl<gp_Dir2d>());
42 }
43
44 double GeomAPI_Dir2d::cross(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
45 {
46   return MY_DIR->XY().Crossed(theArg->impl<gp_Dir2d>().XY());
47 }
48