SHAPER  9.12.0
GeomAPI_Pnt.h
1 // Copyright (C) 2014-2023 CEA, EDF
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_Pnt_H_
21 #define GeomAPI_Pnt_H_
22 
23 #include <GeomAPI_Interface.h>
24 #include <memory>
25 
26 class GeomAPI_Ax1;
27 class GeomAPI_XYZ;
28 class GeomAPI_Pnt2d;
29 class GeomAPI_Dir;
30 class GeomAPI_Pln;
31 
38 {
39  public:
41  GEOMAPI_EXPORT
42  GeomAPI_Pnt(const double theX, const double theY, const double theZ);
44  GEOMAPI_EXPORT
45  GeomAPI_Pnt(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
46 
48  GEOMAPI_EXPORT
49  double x() const;
51  GEOMAPI_EXPORT
52  double y() const;
54  GEOMAPI_EXPORT
55  double z() const;
56 
58  GEOMAPI_EXPORT
59  void setX(const double theX);
61  GEOMAPI_EXPORT
62  void setY(const double theY);
64  GEOMAPI_EXPORT
65  void setZ(const double theZ);
66 
68  GEOMAPI_EXPORT
69  const std::shared_ptr<GeomAPI_XYZ> xyz();
70 
72  GEOMAPI_EXPORT
73  double distance(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
74 
76  GEOMAPI_EXPORT
77  bool isEqual(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
78 
83  GEOMAPI_EXPORT
84  bool isLess(const std::shared_ptr<GeomAPI_Pnt>& theOther,
85  const double theTolerance = 1.e-7) const;
86 
88  GEOMAPI_EXPORT
89  std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
90  const std::shared_ptr<GeomAPI_Dir>& theDirX,
91  const std::shared_ptr<GeomAPI_Dir>& theDirY);
92 
94  GEOMAPI_EXPORT
95  std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pln>& thePln) const;
96 
98  GEOMAPI_EXPORT
99  void translate(const std::shared_ptr<GeomAPI_Dir>& theDir, double theDist);
100 
102  GEOMAPI_EXPORT void rotate(const std::shared_ptr<GeomAPI_Ax1>& theAxis, double theAngle);
103 };
104 
106 typedef std::shared_ptr<GeomAPI_Pnt> GeomPointPtr;
107 
108 #endif
The class represents an axis in 3D space.
Definition: GeomAPI_Ax1.h:31
3D direction defined by three normalized coordinates
Definition: GeomAPI_Dir.h:34
General base class for all interfaces in this package.
Definition: GeomAPI_Interface.h:38
3D point defined by three coordinates
Definition: GeomAPI_Pln.h:37
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
GEOMAPI_EXPORT void setY(const double theY)
sets Y coordinate
Definition: GeomAPI_Pnt.cpp:63
GEOMAPI_EXPORT double z() const
returns Z coordinate
Definition: GeomAPI_Pnt.cpp:53
GEOMAPI_EXPORT const std::shared_ptr< GeomAPI_XYZ > xyz()
returns coordinates of the point
Definition: GeomAPI_Pnt.cpp:73
GEOMAPI_EXPORT bool isLess(const std::shared_ptr< GeomAPI_Pnt > &theOther, const double theTolerance=1.e-7) const
Returns true, if the current point is less than theOther.
Definition: GeomAPI_Pnt.cpp:88
GEOMAPI_EXPORT void setZ(const double theZ)
sets Z coordinate
Definition: GeomAPI_Pnt.cpp:68
GEOMAPI_EXPORT void rotate(const std::shared_ptr< GeomAPI_Ax1 > &theAxis, double theAngle)
Rotates the point along axis for the given angle (in degrees)
Definition: GeomAPI_Pnt.cpp:133
GEOMAPI_EXPORT void setX(const double theX)
sets X coordinate
Definition: GeomAPI_Pnt.cpp:58
GEOMAPI_EXPORT std::shared_ptr< GeomAPI_Pnt2d > to2D(const std::shared_ptr< GeomAPI_Pnt > &theOrigin, const std::shared_ptr< GeomAPI_Dir > &theDirX, const std::shared_ptr< GeomAPI_Dir > &theDirY)
Projects a point to the plane defined by the origin and 2 axes vectors in this plane.
Definition: GeomAPI_Pnt.cpp:103
GEOMAPI_EXPORT double y() const
returns Y coordinate
Definition: GeomAPI_Pnt.cpp:48
GEOMAPI_EXPORT bool isEqual(const std::shared_ptr< GeomAPI_Pnt > &theOther) const
Returns whether the distance between two points is less then precision confusion.
Definition: GeomAPI_Pnt.cpp:83
GEOMAPI_EXPORT double x() const
returns X coordinate
Definition: GeomAPI_Pnt.cpp:43
GEOMAPI_EXPORT GeomAPI_Pnt(const double theX, const double theY, const double theZ)
Creation of point by coordinates.
Definition: GeomAPI_Pnt.cpp:33
GEOMAPI_EXPORT void translate(const std::shared_ptr< GeomAPI_Dir > &theDir, double theDist)
Translates the point along direction theDir on distance theDist.
Definition: GeomAPI_Pnt.cpp:115
GEOMAPI_EXPORT double distance(const std::shared_ptr< GeomAPI_Pnt > &theOther) const
Distance between two points.
Definition: GeomAPI_Pnt.cpp:78
3 coordinates: they may represent vector or point or something else
Definition: GeomAPI_XYZ.h:32