Salome HOME
34ea646aa97a25d1ca0e9d3994afdf2ce5ccdf1b
[modules/shaper.git] / src / GeomAPI / GeomAPI_XYZ.h
1 // Copyright (C) 2014-2021  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GeomAPI_XYZ_H_
21 #define GeomAPI_XYZ_H_
22
23 #include <GeomAPI_Interface.h>
24 #include <memory>
25
26 /**\class GeomAPI_XYZ
27  * \ingroup DataModel
28  * \brief 3 coordinates: they may represent vector or point or something else
29  */
30
31 class GeomAPI_XYZ : public GeomAPI_Interface
32 {
33  public:
34   /// Creation by coordinates
35   GEOMAPI_EXPORT
36   GeomAPI_XYZ(const double theX, const double theY, const double theZ);
37
38   /// returns X coordinate
39   GEOMAPI_EXPORT
40   double x() const;
41   /// returns Y coordinate
42   GEOMAPI_EXPORT
43   double y() const;
44   /// returns Z coordinate
45   GEOMAPI_EXPORT
46   double z() const;
47
48   /// sets X coordinate
49   GEOMAPI_EXPORT
50   void setX(const double theX);
51   /// sets Y coordinate
52   GEOMAPI_EXPORT
53   void setY(const double theY);
54   /// sets Z coordinate
55   GEOMAPI_EXPORT
56   void setZ(const double theZ);
57
58   /// result is sum of coordinates of this and the given argument
59   GEOMAPI_EXPORT
60   const std::shared_ptr<GeomAPI_XYZ> added(const std::shared_ptr<GeomAPI_XYZ>& theArg);
61   /// result is difference between coordinates of this and the given argument
62   GEOMAPI_EXPORT
63   const std::shared_ptr<GeomAPI_XYZ> decreased(const std::shared_ptr<GeomAPI_XYZ>& theArg);
64   /// result is coordinates multiplied by the argument
65   GEOMAPI_EXPORT
66   const std::shared_ptr<GeomAPI_XYZ> multiplied(const double theArg);
67
68   /// result is a scalar product of two triplets
69   GEOMAPI_EXPORT
70   double dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
71   /// result is a cross product of two triplets
72   GEOMAPI_EXPORT
73   const std::shared_ptr<GeomAPI_XYZ> cross(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
74
75   /// Distance between two triplets
76   GEOMAPI_EXPORT
77   double distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const;
78
79   /// Square length of triplet from the origin
80   GEOMAPI_EXPORT double squareModulus() const;
81 };
82
83 //! Pointer on object
84 typedef std::shared_ptr<GeomAPI_XYZ> GeomXYZPtr;
85
86 #endif
87