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