Salome HOME
Sources formated according to the codeing standards
[modules/shaper.git] / src / GeomAPI / GeomAPI_XYZ.cpp
1 // File:        GeomAPI_XYZ.cpp
2 // Created:     23 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include<GeomAPI_XYZ.h>
6
7 #include<gp_XYZ.hxx>
8
9 #define MY_XYZ static_cast<gp_XYZ*>(myImpl)
10
11 GeomAPI_XYZ::GeomAPI_XYZ(const double theX, const double theY, const double theZ)
12     : GeomAPI_Interface(new gp_XYZ(theX, theY, theZ))
13 {
14 }
15
16 double GeomAPI_XYZ::x() const
17 {
18   return MY_XYZ->X();
19 }
20
21 double GeomAPI_XYZ::y() const
22 {
23   return MY_XYZ->Y();
24 }
25
26 double GeomAPI_XYZ::z() const
27 {
28   return MY_XYZ->Z();
29 }
30
31 void GeomAPI_XYZ::setX(const double theX)
32 {
33   return MY_XYZ->SetX(theX);
34 }
35
36 void GeomAPI_XYZ::setY(const double theY)
37 {
38   return MY_XYZ->SetY(theY);
39 }
40
41 void GeomAPI_XYZ::setZ(const double theZ)
42 {
43   return MY_XYZ->SetZ(theZ);
44 }
45
46 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
47     const boost::shared_ptr<GeomAPI_XYZ>& theArg)
48 {
49   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
50   MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
51   return aResult;
52 }
53
54 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
55     const boost::shared_ptr<GeomAPI_XYZ>& theArg)
56 {
57   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
58   MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
59   return aResult;
60 }
61
62 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
63 {
64   boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
65   MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
66   return aResult;
67 }
68
69 double GeomAPI_XYZ::dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
70 {
71   return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
72 }
73
74 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
75     const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
76 {
77   gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
78   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
79 }
80
81 double GeomAPI_XYZ::distance(const boost::shared_ptr<GeomAPI_XYZ>& theOther) const
82 {
83   gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
84   return aResult.Modulus();
85 }
86