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_ConicalSurface_HeaderFile
18 #define _Geom_ConicalSurface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Real.hxx>
24 #include <Geom_ElementarySurface.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Integer.hxx>
27 class Standard_ConstructionError;
28 class Standard_RangeError;
39 class Geom_ConicalSurface;
40 DEFINE_STANDARD_HANDLE(Geom_ConicalSurface, Geom_ElementarySurface)
43 //! A cone is defined by the half-angle (can be negative) at its apex, and
44 //! is positioned in space by a coordinate system (a
45 //! gp_Ax3 object) and a reference radius as follows:
46 //! - The "main Axis" of the coordinate system is the
47 //! axis of revolution of the cone.
48 //! - The plane defined by the origin, the "X Direction"
49 //! and the "Y Direction" of the coordinate system is
50 //! the reference plane of the cone. The intersection
51 //! of the cone with this reference plane is a circle of
52 //! radius equal to the reference radius.
53 //! - The apex of the cone is on the negative side of
54 //! the "main Axis" of the coordinate system if the
55 //! half-angle is positive, and on the positive side if
56 //! the half-angle is negative.
57 //! This coordinate system is the "local coordinate
58 //! system" of the cone. The following apply:
59 //! - Rotation around its "main Axis", in the
60 //! trigonometric sense given by the "X Direction"
61 //! and the "Y Direction", defines the u parametric direction.
62 //! - Its "X Axis" gives the origin for the u parameter.
63 //! - Its "main Direction" is the v parametric direction of the cone.
64 //! - Its origin is the origin of the v parameter.
65 //! The parametric range of the two parameters is:
66 //! - [ 0, 2.*Pi ] for u, and - ] -infinity, +infinity [ for v
67 //! The parametric equation of the cone is: P(u, v) =
68 //! O + (R + v*sin(Ang)) * (cos(u)*XDir + sin(u)*YDir) + v*cos(Ang)*ZDir where:
69 //! - O, XDir, YDir and ZDir are respectively
70 //! the origin, the "X Direction", the "Y Direction" and
71 //! the "Z Direction" of the cone's local coordinate system,
72 //! - Ang is the half-angle at the apex of the cone, and
73 //! - R is the reference radius.
74 class Geom_ConicalSurface : public Geom_ElementarySurface
81 //! A3 defines the local coordinate system of the conical surface.
82 //! Ang is the conical surface semi-angle. Its absolute value is in range
84 //! Radius is the radius of the circle Viso in the placement plane
85 //! of the conical surface defined with "XAxis" and "YAxis".
86 //! The "ZDirection" of A3 defines the direction of the surface's
88 //! If the location point of A3 is the apex of the surface
90 //! At the creation the parametrization of the surface is defined
91 //! such that the normal Vector (N = D1U ^ D1V) is oriented towards
92 //! the "outside region" of the surface.
94 //! Raised if Radius < 0.0 or Abs(Ang) < Resolution from gp or
95 //! Abs(Ang) >= PI/2 - Resolution
96 Standard_EXPORT Geom_ConicalSurface(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
99 //! Creates a ConicalSurface from a non transient Cone from
101 Standard_EXPORT Geom_ConicalSurface(const gp_Cone& C);
104 //! Set <me> so that <me> has the same geometric properties as C.
105 Standard_EXPORT void SetCone (const gp_Cone& C);
108 //! Changes the radius of the conical surface in the placement
109 //! plane (Z = 0, V = 0). The local coordinate system is not
111 //! Raised if R < 0.0
112 Standard_EXPORT void SetRadius (const Standard_Real R);
115 //! Changes the semi angle of the conical surface.
116 //! Semi-angle can be negative. Its absolute value
117 //! Abs(Ang) is in range ]0,PI/2[.
118 //! Raises ConstructionError if Abs(Ang) < Resolution from gp or
119 //! Abs(Ang) >= PI/2 - Resolution
120 Standard_EXPORT void SetSemiAngle(const Standard_Real Ang);
123 //! returns a non transient cone with the same geometric properties
125 Standard_EXPORT gp_Cone Cone() const;
128 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
130 //! Computes the u (or v) parameter on the modified
131 //! surface, when reversing its u (or v) parametric
132 //! direction, for any point of u parameter U (or of v
133 //! parameter V) on this cone.
134 //! In the case of a cone, these functions return respectively:
136 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
138 //! Changes the orientation of this cone in the v
139 //! parametric direction. The bounds of the surface are
140 //! not changed but the v parametric direction is reversed.
141 //! As a consequence, for a cone:
142 //! - the "main Direction" of the local coordinate system
144 //! - the half-angle at the apex is inverted.
145 Standard_EXPORT virtual void VReverse() Standard_OVERRIDE;
147 //! Computes the parameters on the transformed surface for
148 //! the transform of the point of parameters U,V on <me>.
150 //! me->Transformed(T)->Value(U',V')
152 //! is the same point as
154 //! me->Value(U,V).Transformed(T)
156 //! Where U',V' are the new values of U,V after calling
158 //! me->TranformParameters(U,V,T)
160 //! This methods multiplies V by T.ScaleFactor()
161 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
163 //! Returns a 2d transformation used to find the new
164 //! parameters of a point on the transformed surface.
166 //! me->Transformed(T)->Value(U',V')
168 //! is the same point as
170 //! me->Value(U,V).Transformed(T)
172 //! Where U',V' are obtained by transforming U,V with
173 //! th 2d transformation returned by
175 //! me->ParametricTransformation(T)
177 //! This methods returns a scale centered on the
178 //! U axis with T.ScaleFactor
179 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
181 //! Computes the apex of this cone. It is on the negative
182 //! side of the axis of revolution of this cone if the
183 //! half-angle at the apex is positive, and on the positive
184 //! side of the "main Axis" if the half-angle is negative.
185 Standard_EXPORT gp_Pnt Apex() const;
188 //! The conical surface is infinite in the V direction so
189 //! V1 = Realfirst from Standard and V2 = RealLast.
190 //! U1 = 0 and U2 = 2*PI.
191 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
194 //! Returns the coefficients of the implicit equation of the
195 //! quadric in the absolute cartesian coordinate system :
196 //! These coefficients are normalized.
197 //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) +
198 //! 2.(C1.X + C2.Y + C3.Z) + D = 0.0
199 Standard_EXPORT void Coefficients (Standard_Real& A1, Standard_Real& A2, Standard_Real& A3, Standard_Real& B1, Standard_Real& B2, Standard_Real& B3, Standard_Real& C1, Standard_Real& C2, Standard_Real& C3, Standard_Real& D) const;
201 //! Returns the reference radius of this cone.
202 //! The reference radius is the radius of the circle formed
203 //! by the intersection of this cone and its reference
204 //! plane (i.e. the plane defined by the origin, "X
205 //! Direction" and "Y Direction" of the local coordinate
206 //! system of this cone).
207 //! If the apex of this cone is on the origin of the local
208 //! coordinate system of this cone, the returned value is 0.
209 Standard_EXPORT Standard_Real RefRadius() const;
212 //! Returns the semi-angle at the apex of this cone.
213 //! Attention! Semi-angle can be negative.
214 Standard_EXPORT Standard_Real SemiAngle() const;
217 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
220 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
223 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
226 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
228 //! Builds the U isoparametric line of this cone. The
229 //! origin of this line is on the reference plane of this
230 //! cone (i.e. the plane defined by the origin, "X Direction"
231 //! and "Y Direction" of the local coordinate system of this cone).
232 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
234 //! Builds the V isoparametric circle of this cone. It is the
235 //! circle on this cone, located in the plane of Z
236 //! coordinate V*cos(Semi-Angle) in the local coordinate system of this
237 //! cone. The "Axis" of this circle is the axis of revolution
238 //! of this cone. Its starting point is defined by the "X
239 //! Direction" of this cone.
241 //! If the V isoparametric circle is close to the apex of
242 //! this cone, the radius of the circle becomes very small.
243 //! It is possible to have a circle with radius equal to 0.0.
244 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
247 //! Computes the point P (U, V) on the surface.
249 //! (RefRadius + V * sin (Semi-Angle)) * (cos (U) * XDir + sin (U) * YDir) +
250 //! V * cos (Semi-Angle) * ZDir
251 //! where Loc is the origin of the placement plane (XAxis, YAxis)
252 //! XDir is the direction of the XAxis and YDir the direction of
254 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
257 //! Computes the current point and the first derivatives in the
258 //! directions U and V.
259 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
262 //! Computes the current point, the first and the second derivatives
263 //! in the directions U and V.
264 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;
267 //! Computes the current point, the first,the second and the third
268 //! derivatives in the directions U and V.
269 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;
271 //! Computes the derivative of order Nu in the u
272 //! parametric direction, and Nv in the v parametric
273 //! direction at the point of parameters (U, V) of this cone.
275 //! Standard_RangeError if:
276 //! - Nu + Nv is less than 1,
277 //! - Nu or Nv is negative.
278 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
280 //! Applies the transformation T to this cone.
281 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
283 //! Creates a new object which is a copy of this cone.
284 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
286 //! Dumps the content of me into the stream
287 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
292 DEFINE_STANDARD_RTTIEXT(Geom_ConicalSurface,Geom_ElementarySurface)
302 Standard_Real radius;
303 Standard_Real semiAngle;
314 #endif // _Geom_ConicalSurface_HeaderFile