Salome HOME
Equal points should not be used in the operation preselection.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Pnt.hxx
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomAPI_Pnt_H_
8 #define GeomAPI_Pnt_H_
9
10 #include <GeomAPI_Interface.h>
11 #include <memory>
12
13 class GeomAPI_XYZ;
14 class GeomAPI_Pnt2d;
15 class GeomAPI_Dir;
16 class GeomAPI_Pln;
17
18 /**\class GeomAPI_Pnt
19  * \ingroup DataModel
20  * \brief 3D point defined by three coordinates
21  */
22
23 class GeomAPI_Pnt : public GeomAPI_Interface
24 {
25  public:
26   /// Creation of point by coordinates
27   GEOMAPI_EXPORT 
28   GeomAPI_Pnt(const double theX, const double theY, const double theZ);
29   /// Creation of point by coordinates
30   GEOMAPI_EXPORT 
31   GeomAPI_Pnt(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
32
33   /// returns X coordinate
34   GEOMAPI_EXPORT 
35   double x() const;
36   /// returns Y coordinate
37   GEOMAPI_EXPORT 
38   double y() const;
39   /// returns Z coordinate
40   GEOMAPI_EXPORT 
41   double z() const;
42
43   /// sets X coordinate
44   GEOMAPI_EXPORT 
45   void setX(const double theX);
46   /// sets Y coordinate
47   GEOMAPI_EXPORT 
48   void setY(const double theY);
49   /// sets Z coordinate
50   GEOMAPI_EXPORT 
51   void setZ(const double theZ);
52
53   /// returns coordinates of the point
54   GEOMAPI_EXPORT 
55   const std::shared_ptr<GeomAPI_XYZ> xyz();
56
57   /// Distance between two points
58   GEOMAPI_EXPORT 
59   double distance(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
60
61   /// Returns whether the distance between two points is less then precision confusion
62   GEOMAPI_EXPORT 
63   bool isEqual(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
64
65   /// Projects a point to the plane defined by the origin and 2 axes vectors in this plane
66   GEOMAPI_EXPORT 
67   std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
68                                         const std::shared_ptr<GeomAPI_Dir>& theDirX,
69                                         const std::shared_ptr<GeomAPI_Dir>& theDirY);
70
71   /// Projects a point to the plane defined by the origin and 2 axes vectors in this plane
72   GEOMAPI_EXPORT 
73   std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pln>& thePln) const;
74
75   /// Translates the point along direction theDir on distance theDist
76   GEOMAPI_EXPORT 
77   void translate(const std::shared_ptr<GeomAPI_Dir>& theDir, double theDist);
78 };
79
80 #endif