Salome HOME
Issue #1650: Added option to create axis by two planes.
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pln.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Pln.hxx
4 // Created:     23 Apr 2014
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef GeomAPI_Pln_H_
8 #define GeomAPI_Pln_H_
9
10 #include <memory>
11 #include <GeomAPI_Interface.h>
12
13 class GeomAPI_Ax3;
14 class GeomAPI_Pnt;
15 class GeomAPI_Dir;
16 class GeomAPI_Lin;
17
18 /**\class GeomAPI_Pln
19  * \ingroup DataModel
20  * \brief 3D point defined by three coordinates
21  */
22
23 class GeomAPI_Pln : public GeomAPI_Interface
24 {
25  public:
26   /// Creation of plane by the axis placement
27   GEOMAPI_EXPORT 
28   GeomAPI_Pln(const std::shared_ptr<GeomAPI_Ax3>& theAxis);
29
30   /// Creation of plane by the point and normal
31   GEOMAPI_EXPORT 
32   GeomAPI_Pln(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
33               const std::shared_ptr<GeomAPI_Dir>& theNormal);
34
35   /// Creation of plane by coefficients (Ax+By+Cz+D=0)
36   GEOMAPI_EXPORT 
37   GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
38
39   /// Returns a point of this plane
40   GEOMAPI_EXPORT 
41   std::shared_ptr<GeomAPI_Pnt> location() const;
42
43   /// Returns a plane normal
44   GEOMAPI_EXPORT 
45   std::shared_ptr<GeomAPI_Dir> direction() const;
46
47   /// Returns a plane x direction
48   GEOMAPI_EXPORT 
49   std::shared_ptr<GeomAPI_Dir> xDirection() const;
50
51   /// Returns the plane coefficients (Ax+By+Cz+D=0)
52   GEOMAPI_EXPORT 
53   void coefficients(double& theA, double& theB, double& theC, double& theD);
54
55   /// Returns true if planes are coincident.
56   GEOMAPI_EXPORT
57   bool isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane, const double theTolerance = 1.e-7);
58
59   /// Returns true if plane is parallel to theLine.
60   GEOMAPI_EXPORT
61   bool isParallel(const std::shared_ptr<GeomAPI_Lin> theLine);
62
63   /// Returns intersection point or empty if no intersections
64   GEOMAPI_EXPORT
65   std::shared_ptr<GeomAPI_Pnt> intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const;
66
67   /// Returns projection of the given point onto the plane
68   GEOMAPI_EXPORT
69   std::shared_ptr<GeomAPI_Pnt> project(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
70
71   /// \return distance between planes.
72   GEOMAPI_EXPORT
73   double distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
74
75   /// Translates the plane along direction theDir on distance theDist
76   GEOMAPI_EXPORT
77   void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theDist);
78
79   /// \return intersection line of two planes. Empty if they are parallel.
80   GEOMAPI_EXPORT
81   std::shared_ptr<GeomAPI_Lin> intersect(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
82 };
83
84 #endif
85