1 // Created on: 1993-03-10
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Geom_Plane_HeaderFile
18 #define _Geom_Plane_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Geom_ElementarySurface.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
27 class Standard_ConstructionError;
28 class Standard_RangeError;
41 DEFINE_STANDARD_HANDLE(Geom_Plane, Geom_ElementarySurface)
43 //! Describes a plane in 3D space.
44 //! A plane is positioned in space by a coordinate system
45 //! (a gp_Ax3 object) such that the plane is defined by
46 //! the origin, "X Direction" and "Y Direction" of this
47 //! coordinate system.
48 //! This coordinate system is the "local coordinate
49 //! system" of the plane. The following apply:
50 //! - Its "X Direction" and "Y Direction" are respectively
51 //! the u and v parametric directions of the plane.
52 //! - Its origin is the origin of the u and v parameters
53 //! (also called the "origin" of the plane).
54 //! - Its "main Direction" is a vector normal to the plane.
55 //! This normal vector gives the orientation of the
56 //! plane only if the local coordinate system is "direct".
57 //! (The orientation of the plane is always defined by
58 //! the "X Direction" and the "Y Direction" of its local
59 //! coordinate system.)
60 //! The parametric equation of the plane is:
61 //! P(u, v) = O + u*XDir + v*YDir
62 //! where O, XDir and YDir are respectively the
63 //! origin, the "X Direction" and the "Y Direction" of the
64 //! local coordinate system of the plane.
65 //! The parametric range of the two parameters u and v
66 //! is ] -infinity, +infinity [.
67 class Geom_Plane : public Geom_ElementarySurface
74 //! Creates a plane located in 3D space with an axis placement
75 //! three axis. The "ZDirection" of "A3" is the direction normal
76 //! to the plane. The "Location" point of "A3" is the origin of
77 //! the plane. The "XDirection" and "YDirection" of "A3" define
78 //! the directions of the U isoparametric and V isoparametric
80 Standard_EXPORT Geom_Plane(const gp_Ax3& A3);
83 //! Creates a plane from a non transient plane from package gp.
84 Standard_EXPORT Geom_Plane(const gp_Pln& Pl);
87 //! P is the "Location" point or origin of the plane.
88 //! V is the direction normal to the plane.
89 Standard_EXPORT Geom_Plane(const gp_Pnt& P, const gp_Dir& V);
92 //! Creates a plane from its cartesian equation :
93 //! Ax + By + Cz + D = 0.0
95 //! Raised if Sqrt (A*A + B*B + C*C) <= Resolution from gp
96 Standard_EXPORT Geom_Plane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D);
99 //! Set <me> so that <me> has the same geometric properties as Pl.
100 Standard_EXPORT void SetPln (const gp_Pln& Pl);
102 //! Converts this plane into a gp_Pln plane.
103 Standard_EXPORT gp_Pln Pln() const;
106 //! Changes the orientation of this plane in the u (or v)
107 //! parametric direction. The bounds of the plane are not
108 //! changed but the given parametric direction is
109 //! reversed. Hence the orientation of the surface is reversed.
110 Standard_EXPORT virtual void UReverse() Standard_OVERRIDE;
112 //! Computes the u parameter on the modified
113 //! plane, produced when reversing the u
114 //! parametric of this plane, for any point of u parameter U on this plane.
115 //! In the case of a plane, these methods return - -U.
116 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
119 //! Changes the orientation of this plane in the u (or v)
120 //! parametric direction. The bounds of the plane are not
121 //! changed but the given parametric direction is
122 //! reversed. Hence the orientation of the surface is reversed.
123 Standard_EXPORT virtual void VReverse() Standard_OVERRIDE;
125 //! Computes the v parameter on the modified
126 //! plane, produced when reversing the v
127 //! parametric of this plane, for any point of v parameter V on this plane.
128 //! In the case of a plane, these methods return -V.
129 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
131 //! Computes the parameters on the transformed surface for
132 //! the transform of the point of parameters U,V on <me>.
133 //! me->Transformed(T)->Value(U',V')
134 //! is the same point as
135 //! me->Value(U,V).Transformed(T)
136 //! Where U',V' are the new values of U,V after calling
137 //! me->TranformParameters(U,V,T)
138 //! This methods multiplies U and V by T.ScaleFactor()
139 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
141 //! Returns a 2d transformation used to find the new
142 //! parameters of a point on the transformed surface.
143 //! me->Transformed(T)->Value(U',V')
144 //! is the same point as
145 //! me->Value(U,V).Transformed(T)
146 //! Where U',V' are obtained by transforming U,V with
147 //! th 2d transformation returned by
148 //! me->ParametricTransformation(T)
149 //! This methods returns a scale centered on the
150 //! origin with T.ScaleFactor
151 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
153 //! Returns the parametric bounds U1, U2, V1 and V2 of this plane.
154 //! Because a plane is an infinite surface, the following is always true:
155 //! - U1 = V1 = Standard_Real::RealFirst()
156 //! - U2 = V2 = Standard_Real::RealLast().
157 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
160 //! Computes the normalized coefficients of the plane's
161 //! cartesian equation : Ax + By + Cz + D = 0.0
162 Standard_EXPORT void Coefficients (Standard_Real& A, Standard_Real& B, Standard_Real& C, Standard_Real& D) const;
165 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
168 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
171 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
174 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
177 //! Computes the U isoparametric curve.
178 //! This is a Line parallel to the YAxis of the plane.
179 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
182 //! Computes the V isoparametric curve.
183 //! This is a Line parallel to the XAxis of the plane.
184 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
187 //! Computes the point P (U, V) on <me>.
188 //! P = O + U * XDir + V * YDir.
189 //! where O is the "Location" point of the plane, XDir the
190 //! "XDirection" and YDir the "YDirection" of the plane's local
191 //! coordinate system.
192 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
195 //! Computes the current point and the first derivatives in the
196 //! directions U and V.
197 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
200 //! Computes the current point, the first and the second
201 //! derivatives in the directions U and V.
202 Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const Standard_OVERRIDE;
205 //! Computes the current point, the first,the second and the
206 //! third derivatives in the directions U and V.
207 Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const Standard_OVERRIDE;
210 //! Computes the derivative of order Nu in the direction u
211 //! and Nv in the direction v.
212 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
213 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
215 //! Applies the transformation T to this plane.
216 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
218 //! Creates a new object which is a copy of this plane.
219 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
221 //! Dumps the content of me into the stream
222 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
227 DEFINE_STANDARD_RTTIEXT(Geom_Plane,Geom_ElementarySurface)
247 #endif // _Geom_Plane_HeaderFile