1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef GeomAPI_Pln_H_
21 #define GeomAPI_Pln_H_
24 #include <GeomAPI_Interface.h>
33 * \brief 3D point defined by three coordinates
36 class GeomAPI_Pln : public GeomAPI_Interface
39 /// Creation of plane by the axis placement
41 GeomAPI_Pln(const std::shared_ptr<GeomAPI_Ax3>& theAxis);
43 /// Creation of plane by the point and normal
45 GeomAPI_Pln(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
46 const std::shared_ptr<GeomAPI_Dir>& theNormal);
48 /// Creation of plane by coefficients (Ax+By+Cz+D=0)
50 GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
52 /// Returns a point of this plane
54 std::shared_ptr<GeomAPI_Pnt> location() const;
56 /// Returns a plane normal
58 std::shared_ptr<GeomAPI_Dir> direction() const;
60 /// Returns a plane x direction
62 std::shared_ptr<GeomAPI_Dir> xDirection() const;
64 /// Returns the plane coefficients (Ax+By+Cz+D=0)
66 void coefficients(double& theA, double& theB, double& theC, double& theD);
68 /// Returns true if planes are coincident.
70 bool isCoincident(const std::shared_ptr<GeomAPI_Pln> thePlane, const double theTolerance = 1.e-7);
72 /// Returns intersection point or empty if no intersections
74 std::shared_ptr<GeomAPI_Pnt> intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const;
76 /// Returns projection of the given point onto the plane
78 std::shared_ptr<GeomAPI_Pnt> project(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
80 /// \return distance between planes.
82 double distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
84 /// \return distance from a point to this plane.
86 double distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const;
88 /// Translates the plane along direction theDir on distance theDist
90 void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theDist);
92 /// \return intersection line of two planes. Empty if they are parallel.
94 std::shared_ptr<GeomAPI_Lin> intersect(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
97 //! Pointer on the object
98 typedef std::shared_ptr<GeomAPI_Pln> GeomPlanePtr;