Salome HOME
Issue #1860: fix end lines with spaces
[modules/shaper.git] / src / GeomAPI / GeomAPI_Dir.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Dir.cpp
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include <GeomAPI_Dir.h>
8 #include <GeomAPI_XYZ.h>
9
10 #include <gp_Dir.hxx>
11
12 #define MY_DIR implPtr<gp_Dir>()
13
14 GeomAPI_Dir::GeomAPI_Dir(const double theX, const double theY, const double theZ)
15     : GeomAPI_Interface(new gp_Dir(theX, theY, theZ))
16 {
17 }
18
19 GeomAPI_Dir::GeomAPI_Dir(const std::shared_ptr<GeomAPI_XYZ>& theCoords)
20     : GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
21 {
22 }
23
24 double GeomAPI_Dir::x() const
25 {
26   return MY_DIR->X();
27 }
28
29 double GeomAPI_Dir::y() const
30 {
31   return MY_DIR->Y();
32 }
33
34 double GeomAPI_Dir::z() const
35 {
36   return MY_DIR->Z();
37 }
38
39 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
40 {
41   return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
42 }
43
44 void GeomAPI_Dir::reverse()
45 {
46   MY_DIR->Reverse();
47 }
48
49 double GeomAPI_Dir::dot(const std::shared_ptr<GeomAPI_Dir>& theArg) const
50 {
51   return MY_DIR->Dot(theArg->impl<gp_Dir>());
52 }
53
54 const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
55     const std::shared_ptr<GeomAPI_Dir>& theArg) const
56 {
57   gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl<gp_Dir>().XYZ());
58   return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
59 }
60
61 double GeomAPI_Dir::angle(const std::shared_ptr<GeomAPI_Dir>& theArg) const
62 {
63   return MY_DIR->Angle(theArg->impl<gp_Dir>());
64 }
65
66 bool GeomAPI_Dir::isParallel(const std::shared_ptr<GeomAPI_Dir> theDir,
67                              const double theTolerance) const
68 {
69   return MY_DIR->IsParallel(theDir->impl<gp_Dir>(), theTolerance) == Standard_True;
70 }