0027491: GeomAdaptor_Curve Is Not Thread-Safe (Anymore?)
[occt.git] / src / GeomAdaptor / GeomAdaptor_SurfaceOfRevolution.hxx
1 // Created on: 1993-04-21
2 // Created by: Bruno DUMORTIER
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 _GeomAdaptor_SurfaceOfRevolution_HeaderFile
18 #define _GeomAdaptor_SurfaceOfRevolution_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <gp_Ax1.hxx>
25 #include <gp_Ax3.hxx>
26 #include <GeomAdaptor_Surface.hxx>
27
28 class Adaptor3d_HCurve;
29 class Standard_OutOfRange;
30 class Standard_NoSuchObject;
31 class Standard_DomainError;
32 class gp_Ax1;
33 class Adaptor3d_HSurface;
34 class gp_Pnt;
35 class gp_Vec;
36 class gp_Pln;
37 class gp_Cylinder;
38 class gp_Cone;
39 class gp_Sphere;
40 class gp_Torus;
41 class Geom_BezierSurface;
42 class Geom_BSplineSurface;
43 class gp_Ax3;
44 class gp_Dir;
45
46
47 //! This class defines a complete surface of revolution.
48 //! The surface is obtained by rotating a curve a complete revolution
49 //! about an axis. The curve and the axis must be in the same plane.
50 //! If the curve and the axis are not in the same plane it is always
51 //! possible to be in the previous case after a cylindrical projection
52 //! of the curve in a referenced plane.
53 //! For a complete surface of revolution the parametric range is
54 //! 0 <= U <= 2*PI.       --
55 //! The parametric range for V is defined with the revolved curve.
56 //! The origin of the U parametrization is given by the position
57 //! of the revolved curve (reference). The direction of the revolution
58 //! axis defines the positive sense of rotation (trigonometric sense)
59 //! corresponding to the increasing of the parametric value U.
60 //! The derivatives are always defined for the u direction.
61 //! For the v direction the definition of the derivatives depends on
62 //! the degree of continuity of the referenced curve.
63 class GeomAdaptor_SurfaceOfRevolution  : public GeomAdaptor_Surface
64 {
65 public:
66
67   DEFINE_STANDARD_ALLOC
68
69   
70   Standard_EXPORT GeomAdaptor_SurfaceOfRevolution();
71   
72   //! The Curve is loaded.
73   Standard_EXPORT GeomAdaptor_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C);
74   
75   //! The Curve and the Direction are loaded.
76   Standard_EXPORT GeomAdaptor_SurfaceOfRevolution(const Handle(Adaptor3d_HCurve)& C, const gp_Ax1& V);
77   
78   //! Changes the Curve
79   Standard_EXPORT void Load (const Handle(Adaptor3d_HCurve)& C);
80   
81   //! Changes the Direction
82   Standard_EXPORT void Load (const gp_Ax1& V);
83   
84   Standard_EXPORT gp_Ax1 AxeOfRevolution() const Standard_OVERRIDE;
85   
86   Standard_EXPORT Standard_Real FirstUParameter() const Standard_OVERRIDE;
87   
88   Standard_EXPORT Standard_Real LastUParameter() const Standard_OVERRIDE;
89   
90   Standard_EXPORT Standard_Real FirstVParameter() const Standard_OVERRIDE;
91   
92   Standard_EXPORT Standard_Real LastVParameter() const Standard_OVERRIDE;
93   
94   Standard_EXPORT GeomAbs_Shape UContinuity() const Standard_OVERRIDE;
95   
96   //! Return CN.
97   Standard_EXPORT GeomAbs_Shape VContinuity() const Standard_OVERRIDE;
98   
99   //! Returns the number of U intervals for  continuity
100   //! <S>. May be one if UContinuity(me) >= <S>
101   Standard_EXPORT Standard_Integer NbUIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
102   
103   //! Returns the number of V intervals for  continuity
104   //! <S>. May be one if VContinuity(me) >= <S>
105   Standard_EXPORT Standard_Integer NbVIntervals (const GeomAbs_Shape S) const Standard_OVERRIDE;
106   
107   //! Returns the  intervals with the requested continuity
108   //! in the U direction.
109   Standard_EXPORT void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
110   
111   //! Returns the  intervals with the requested continuity
112   //! in the V direction.
113   Standard_EXPORT void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const Standard_OVERRIDE;
114   
115   //! Returns    a  surface trimmed in the U direction
116   //! equivalent   of  <me>  between
117   //! parameters <First>  and <Last>. <Tol>  is used  to
118   //! test for 3d points confusion.
119   //! If <First> >= <Last>
120   Standard_EXPORT Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
121   
122   //! Returns    a  surface trimmed in the V direction  between
123   //! parameters <First>  and <Last>. <Tol>  is used  to
124   //! test for 3d points confusion.
125   //! If <First> >= <Last>
126   Standard_EXPORT Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const Standard_OVERRIDE;
127   
128   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
129   
130   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
131   
132   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
133   
134   Standard_EXPORT Standard_Real UPeriod() const Standard_OVERRIDE;
135   
136   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
137   
138   Standard_EXPORT Standard_Real VPeriod() const Standard_OVERRIDE;
139
140   //! Returns the parametric U  resolution corresponding
141   //! to the real space resolution <R3d>.
142   Standard_EXPORT Standard_Real UResolution (const Standard_Real R3d) const Standard_OVERRIDE;
143   
144   //! Returns the parametric V  resolution corresponding
145   //! to the real space resolution <R3d>.
146   Standard_EXPORT Standard_Real VResolution (const Standard_Real R3d) const Standard_OVERRIDE;
147   
148   //! Returns the type of the surface : Plane, Cylinder,
149   //! Cone,      Sphere,        Torus,    BezierSurface,
150   //! BSplineSurface,               SurfaceOfRevolution,
151   //! SurfaceOfExtrusion, OtherSurface
152   Standard_EXPORT GeomAbs_SurfaceType GetType() const Standard_OVERRIDE;
153   
154   Standard_EXPORT gp_Pln Plane() const Standard_OVERRIDE;
155   
156   Standard_EXPORT gp_Cylinder Cylinder() const Standard_OVERRIDE;
157   
158   //! Apex of the Cone = Cone.Position().Location()
159   //! ==> ReferenceRadius = 0.
160   Standard_EXPORT gp_Cone Cone() const Standard_OVERRIDE;
161   
162   Standard_EXPORT gp_Sphere Sphere() const Standard_OVERRIDE;
163   
164   Standard_EXPORT gp_Torus Torus() const Standard_OVERRIDE;
165
166   Standard_EXPORT Standard_Integer VDegree() const Standard_OVERRIDE;
167   
168   Standard_EXPORT Standard_Integer NbVPoles() const Standard_OVERRIDE;
169
170   Standard_EXPORT Standard_Integer NbVKnots() const Standard_OVERRIDE;
171   
172   Standard_EXPORT Standard_Boolean IsURational() const Standard_OVERRIDE;
173   
174   Standard_EXPORT Standard_Boolean IsVRational() const Standard_OVERRIDE;
175   
176   Standard_EXPORT Handle(Geom_BezierSurface) Bezier() const Standard_OVERRIDE;
177   
178   Standard_EXPORT Handle(Geom_BSplineSurface) BSpline() const Standard_OVERRIDE;
179   
180   Standard_EXPORT const gp_Ax3& Axis() const;
181   
182   Standard_EXPORT Handle(Adaptor3d_HCurve) BasisCurve() const Standard_OVERRIDE;
183
184
185
186
187 protected:
188
189
190
191
192
193 private:
194   Handle(Adaptor3d_HCurve) myBasisCurve; ///< revolved curve
195   gp_Ax1                   myAxis;       ///< axis of revolution
196   Standard_Boolean         myHaveAxis;   ///< whether axis of revolution is initialized
197   gp_Ax3                   myAxeRev;     ///< auxiliary trihedron according to the curve position
198 };
199
200
201
202
203
204
205
206 #endif // _GeomAdaptor_SurfaceOfRevolution_HeaderFile