Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-02 09:12:06

0001 // Created on: 1992-09-28
0002 // Created by: Remi GILET
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GC_MakePlane_HeaderFile
0018 #define _GC_MakePlane_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <GC_Root.hxx>
0025 #include <Geom_Plane.hxx>
0026 
0027 class gp_Pln;
0028 class gp_Pnt;
0029 class gp_Dir;
0030 class gp_Ax1;
0031 
0032 //! Implements construction algorithms for planes in 3D space.
0033 //! Supported constructions include:
0034 //! - a plane parallel to another plane and passing through a point;
0035 //! - a plane passing through three points;
0036 //! - a plane defined by a point and normal direction.
0037 //! A MakePlane object provides a framework for:
0038 //! -   defining the construction of the plane,
0039 //! -   implementing the construction algorithm, and
0040 //! -   consulting the results. In particular, the Value
0041 //! function returns the constructed plane.
0042 class GC_MakePlane : public GC_Root
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Creates a plane from a non-persistent plane from package gp.
0048   //! @param[in] thePl source plane
0049   Standard_EXPORT GC_MakePlane(const gp_Pln& thePl);
0050 
0051   //! Creates a plane from point and normal direction.
0052   //! @param[in] theP location point of the plane
0053   //! @param[in] theV normal direction
0054   Standard_EXPORT GC_MakePlane(const gp_Pnt& theP, const gp_Dir& theV);
0055 
0056   //! Creates a plane from its cartesian equation:
0057   //! `A * x + B * y + C * z + D = 0.0`.
0058   //! @param[in] theA equation coefficient A
0059   //! @param[in] theB equation coefficient B
0060   //! @param[in] theC equation coefficient C
0061   //! @param[in] theD equation coefficient D
0062   //! @note Status is `gce_BadEquation` if `sqrt(theA*theA + theB*theB + theC*theC)`
0063   //!       is below gp resolution.
0064   Standard_EXPORT GC_MakePlane(const double theA,
0065                                const double theB,
0066                                const double theC,
0067                                const double theD);
0068 
0069   //! Creates a plane parallel to the input plane and passing through the input point.
0070   //! @param[in] thePln source plane
0071   //! @param[in] thePoint point on resulting plane
0072   Standard_EXPORT GC_MakePlane(const gp_Pln& thePln, const gp_Pnt& thePoint);
0073 
0074   //! Creates a plane parallel to the input plane at signed distance.
0075   //! @param[in] thePln source plane
0076   //! @param[in] theDist signed distance
0077   //! @note Positive distance follows the normal of the input plane.
0078   Standard_EXPORT GC_MakePlane(const gp_Pln& thePln, const double theDist);
0079 
0080   //! Creates a plane passing through three points.
0081   //! @param[in] theP1 first point
0082   //! @param[in] theP2 second point
0083   //! @param[in] theP3 third point
0084   //! @note Construction fails when points are confused/collinear.
0085   Standard_EXPORT GC_MakePlane(const gp_Pnt& theP1, const gp_Pnt& theP2, const gp_Pnt& theP3);
0086 
0087   //! Creates a plane through axis location and normal to axis direction.
0088   //! @param[in] theAxis axis defining location and normal
0089   Standard_EXPORT GC_MakePlane(const gp_Ax1& theAxis);
0090 
0091   //! Returns the constructed plane.
0092   //! Exceptions StdFail_NotDone if no plane is constructed.
0093   //! @return resulting plane
0094   Standard_EXPORT const occ::handle<Geom_Plane>& Value() const;
0095 
0096   //! Conversion operator returning the constructed object.
0097   //! @return resulting object
0098   operator const occ::handle<Geom_Plane>&() const { return Value(); }
0099 
0100 private:
0101   occ::handle<Geom_Plane> ThePlane;
0102 };
0103 
0104 #endif // _GC_MakePlane_HeaderFile