Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / GeomAPI / GeomAPI_Dir.cpp
1 // File:        GeomAPI_Dir.cpp
2 // Created:     23 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include <GeomAPI_Dir.h>
6 #include <GeomAPI_XYZ.h>
7
8 #include <gp_Dir.hxx>
9
10 #define MY_DIR static_cast<gp_Dir*>(myImpl)
11
12 GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, const double theZ)
13     : GeomAPI_Interface(new gp_Dir(theX, theY, theZ))
14 {
15 }
16
17 GeomAPI_Dir::GeomAPI_Dir(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
18     : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
19 {
20 }
21
22 double GeomAPI_Dir::x() const
23 {
24   return MY_DIR->X();
25 }
26
27 double GeomAPI_Dir::y() const
28 {
29   return MY_DIR->Y();
30 }
31
32 double GeomAPI_Dir::z() const
33 {
34   return MY_DIR->Z();
35 }
36
37 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
38 {
39   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
40 }
41
42 double GeomAPI_Dir::dot(const boost::shared_ptr<GeomAPI_Dir>& theArg) const
43 {
44   return MY_DIR->Dot(theArg->impl<gp_Dir>());
45 }
46
47 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
48     const boost::shared_ptr<GeomAPI_Dir>& theArg) const
49 {
50   gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl<gp_Dir>().XYZ());
51   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
52 }
53