0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / Geom / Geom_ConicalSurface.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-03-10
2// Created by: JCV
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Geom_ConicalSurface_HeaderFile
18#define _Geom_ConicalSurface_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
42cf5bc1 23#include <Geom_ElementarySurface.hxx>
42cf5bc1 24#include <Standard_Integer.hxx>
42cf5bc1 25class gp_Ax3;
26class gp_Cone;
27class gp_Trsf;
28class gp_GTrsf2d;
29class gp_Pnt;
30class Geom_Curve;
31class gp_Vec;
32class Geom_Geometry;
33
34
35class Geom_ConicalSurface;
36DEFINE_STANDARD_HANDLE(Geom_ConicalSurface, Geom_ElementarySurface)
37
38//! Describes a cone.
3306fdd9 39//! A cone is defined by the half-angle (can be negative) at its apex, and
42cf5bc1 40//! is positioned in space by a coordinate system (a
41//! gp_Ax3 object) and a reference radius as follows:
42//! - The "main Axis" of the coordinate system is the
43//! axis of revolution of the cone.
44//! - The plane defined by the origin, the "X Direction"
45//! and the "Y Direction" of the coordinate system is
46//! the reference plane of the cone. The intersection
47//! of the cone with this reference plane is a circle of
48//! radius equal to the reference radius.
49//! - The apex of the cone is on the negative side of
50//! the "main Axis" of the coordinate system if the
51//! half-angle is positive, and on the positive side if
52//! the half-angle is negative.
53//! This coordinate system is the "local coordinate
54//! system" of the cone. The following apply:
55//! - Rotation around its "main Axis", in the
56//! trigonometric sense given by the "X Direction"
57//! and the "Y Direction", defines the u parametric direction.
58//! - Its "X Axis" gives the origin for the u parameter.
59//! - Its "main Direction" is the v parametric direction of the cone.
60//! - Its origin is the origin of the v parameter.
61//! The parametric range of the two parameters is:
316ea293 62//! @code
63//! - [ 0, 2.*Pi ] for u, and
64//! - ] -infinity, +infinity [ for v
65//! @endcode
66//! The parametric equation of the cone is:
67//! @code
68//! P(u, v) = O + (R + v*sin(Ang)) * (cos(u)*XDir + sin(u)*YDir) + v*cos(Ang)*ZDir
69//! @endcode
70//! where:
42cf5bc1 71//! - O, XDir, YDir and ZDir are respectively
72//! the origin, the "X Direction", the "Y Direction" and
73//! the "Z Direction" of the cone's local coordinate system,
74//! - Ang is the half-angle at the apex of the cone, and
75//! - R is the reference radius.
76class Geom_ConicalSurface : public Geom_ElementarySurface
77{
78
79public:
80
81
82
83 //! A3 defines the local coordinate system of the conical surface.
3306fdd9 84 //! Ang is the conical surface semi-angle. Its absolute value is in range
85 //! ]0, PI/2[.
42cf5bc1 86 //! Radius is the radius of the circle Viso in the placement plane
87 //! of the conical surface defined with "XAxis" and "YAxis".
88 //! The "ZDirection" of A3 defines the direction of the surface's
89 //! axis of symmetry.
90 //! If the location point of A3 is the apex of the surface
91 //! Radius = 0 .
92 //! At the creation the parametrization of the surface is defined
93 //! such that the normal Vector (N = D1U ^ D1V) is oriented towards
94 //! the "outside region" of the surface.
95 //!
3306fdd9 96 //! Raised if Radius < 0.0 or Abs(Ang) < Resolution from gp or
97 //! Abs(Ang) >= PI/2 - Resolution
42cf5bc1 98 Standard_EXPORT Geom_ConicalSurface(const gp_Ax3& A3, const Standard_Real Ang, const Standard_Real Radius);
99
100
316ea293 101 //! Creates a ConicalSurface from a non transient gp_Cone.
42cf5bc1 102 Standard_EXPORT Geom_ConicalSurface(const gp_Cone& C);
42cf5bc1 103
104 //! Set <me> so that <me> has the same geometric properties as C.
105 Standard_EXPORT void SetCone (const gp_Cone& C);
42cf5bc1 106
316ea293 107 //! Changes the radius of the conical surface in the placement plane (Z = 0, V = 0).
108 //! The local coordinate system is not modified.
42cf5bc1 109 //! Raised if R < 0.0
110 Standard_EXPORT void SetRadius (const Standard_Real R);
42cf5bc1 111
112 //! Changes the semi angle of the conical surface.
3306fdd9 113 //! Semi-angle can be negative. Its absolute value
114 //! Abs(Ang) is in range ]0,PI/2[.
115 //! Raises ConstructionError if Abs(Ang) < Resolution from gp or
116 //! Abs(Ang) >= PI/2 - Resolution
117 Standard_EXPORT void SetSemiAngle(const Standard_Real Ang);
42cf5bc1 118
316ea293 119 //! Returns a non transient cone with the same geometric properties as <me>.
42cf5bc1 120 Standard_EXPORT gp_Cone Cone() const;
316ea293 121
122 //! Eeturn 2.PI - U.
79104795 123 Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
316ea293 124
125 //! Computes the u (or v) parameter on the modified surface,
126 //! when reversing its u (or v) parametric direction,
127 //! for any point of u parameter U (or of v parameter V) on this cone.
42cf5bc1 128 //! In the case of a cone, these functions return respectively:
129 //! - 2.*Pi - U, -V.
79104795 130 Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
42cf5bc1 131
316ea293 132 //! Changes the orientation of this cone in the v parametric direction.
133 //! The bounds of the surface are not changed but the v parametric direction is reversed.
42cf5bc1 134 //! As a consequence, for a cone:
135 //! - the "main Direction" of the local coordinate system
136 //! is reversed, and
137 //! - the half-angle at the apex is inverted.
138 Standard_EXPORT virtual void VReverse() Standard_OVERRIDE;
316ea293 139
140 //! Computes the parameters on the transformed surface for
42cf5bc1 141 //! the transform of the point of parameters U,V on <me>.
316ea293 142 //! @code
143 //! me->Transformed(T)->Value(U',V')
144 //! @endcode
42cf5bc1 145 //! is the same point as
316ea293 146 //! @code
147 //! me->Value(U,V).Transformed(T)
148 //! @endcode
42cf5bc1 149 //! Where U',V' are the new values of U,V after calling
316ea293 150 //! @code
151 //! me->TransformParameters(U,V,T)
152 //! @endcode
153 //! This method multiplies V by T.ScaleFactor()
42cf5bc1 154 Standard_EXPORT virtual void TransformParameters (Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const Standard_OVERRIDE;
316ea293 155
156 //! Returns a 2d transformation used to find the new
42cf5bc1 157 //! parameters of a point on the transformed surface.
316ea293 158 //! @code
159 //! me->Transformed(T)->Value(U',V')
160 //! @endcode
42cf5bc1 161 //! is the same point as
316ea293 162 //! @code
163 //! me->Value(U,V).Transformed(T)
164 //! @endcode
165 //! Where U',V' are obtained by transforming U,V with the 2d transformation returned by
166 //! @code
167 //! me->ParametricTransformation(T)
168 //! @endcode
169 //! This method returns a scale centered on the U axis with T.ScaleFactor
42cf5bc1 170 Standard_EXPORT virtual gp_GTrsf2d ParametricTransformation (const gp_Trsf& T) const Standard_OVERRIDE;
316ea293 171
42cf5bc1 172 //! Computes the apex of this cone. It is on the negative
173 //! side of the axis of revolution of this cone if the
174 //! half-angle at the apex is positive, and on the positive
175 //! side of the "main Axis" if the half-angle is negative.
176 Standard_EXPORT gp_Pnt Apex() const;
42cf5bc1 177
178 //! The conical surface is infinite in the V direction so
179 //! V1 = Realfirst from Standard and V2 = RealLast.
180 //! U1 = 0 and U2 = 2*PI.
79104795 181 Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
42cf5bc1 182
183 //! Returns the coefficients of the implicit equation of the
184 //! quadric in the absolute cartesian coordinate system :
185 //! These coefficients are normalized.
316ea293 186 //! @code
187 //! A1.X**2 + A2.Y**2 + A3.Z**2 + 2.(B1.X.Y + B2.X.Z + B3.Y.Z) + 2.(C1.X + C2.Y + C3.Z) + D = 0.0
188 //! @endcode
42cf5bc1 189 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;
316ea293 190
42cf5bc1 191 //! Returns the reference radius of this cone.
192 //! The reference radius is the radius of the circle formed
193 //! by the intersection of this cone and its reference
194 //! plane (i.e. the plane defined by the origin, "X
195 //! Direction" and "Y Direction" of the local coordinate
196 //! system of this cone).
197 //! If the apex of this cone is on the origin of the local
198 //! coordinate system of this cone, the returned value is 0.
199 Standard_EXPORT Standard_Real RefRadius() const;
42cf5bc1 200
3306fdd9 201 //! Returns the semi-angle at the apex of this cone.
202 //! Attention! Semi-angle can be negative.
42cf5bc1 203 Standard_EXPORT Standard_Real SemiAngle() const;
316ea293 204
42cf5bc1 205 //! returns True.
79104795 206 Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
316ea293 207
42cf5bc1 208 //! returns False.
79104795 209 Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
316ea293 210
42cf5bc1 211 //! Returns True.
79104795 212 Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
316ea293 213
42cf5bc1 214 //! Returns False.
79104795 215 Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
316ea293 216
217 //! Builds the U isoparametric line of this cone.
218 //! The origin of this line is on the reference plane of this cone
219 //! (i.e. the plane defined by the origin, "X Direction"
42cf5bc1 220 //! and "Y Direction" of the local coordinate system of this cone).
79104795 221 Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
316ea293 222
223 //! Builds the V isoparametric circle of this cone.
224 //! It is the circle on this cone, located in the plane of Z
225 //! coordinate V*cos(Semi-Angle) in the local coordinate system of this cone.
226 //! The "Axis" of this circle is the axis of revolution of this cone.
227 //! Its starting point is defined by the "X Direction" of this cone.
42cf5bc1 228 //! Warning
229 //! If the V isoparametric circle is close to the apex of
230 //! this cone, the radius of the circle becomes very small.
231 //! It is possible to have a circle with radius equal to 0.0.
79104795 232 Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
42cf5bc1 233
316ea293 234 //! Computes the point P (U, V) on the surface.
235 //! @code
236 //! P (U, V) = Loc +
237 //! (RefRadius + V * sin (Semi-Angle)) * (cos (U) * XDir + sin (U) * YDir) +
238 //! V * cos (Semi-Angle) * ZDir
239 //! @endcode
42cf5bc1 240 //! where Loc is the origin of the placement plane (XAxis, YAxis)
316ea293 241 //! XDir is the direction of the XAxis and YDir the direction of the YAxis.
79104795 242 Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
42cf5bc1 243
316ea293 244 //! Computes the current point and the first derivatives in the directions U and V.
79104795 245 Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
42cf5bc1 246
316ea293 247 //! Computes the current point, the first and the second derivatives in the directions U and V.
79104795 248 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;
42cf5bc1 249
250 //! Computes the current point, the first,the second and the third
251 //! derivatives in the directions U and V.
79104795 252 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;
316ea293 253
42cf5bc1 254 //! Computes the derivative of order Nu in the u
255 //! parametric direction, and Nv in the v parametric
256 //! direction at the point of parameters (U, V) of this cone.
257 //! Exceptions
258 //! Standard_RangeError if:
259 //! - Nu + Nv is less than 1,
260 //! - Nu or Nv is negative.
79104795 261 Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
316ea293 262
42cf5bc1 263 //! Applies the transformation T to this cone.
79104795 264 Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
316ea293 265
42cf5bc1 266 //! Creates a new object which is a copy of this cone.
79104795 267 Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
bc73b006 268 //! Dumps the content of me into the stream
269 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
270
92efcf78 271 DEFINE_STANDARD_RTTIEXT(Geom_ConicalSurface,Geom_ElementarySurface)
42cf5bc1 272
42cf5bc1 273private:
274
42cf5bc1 275 Standard_Real radius;
276 Standard_Real semiAngle;
277
42cf5bc1 278};
279
42cf5bc1 280#endif // _Geom_ConicalSurface_HeaderFile