0027491: GeomAdaptor_Curve Is Not Thread-Safe (Anymore?)
[occt.git] / src / Adaptor3d / Adaptor3d_Surface.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-03-31
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 _Adaptor3d_Surface_HeaderFile
18#define _Adaptor3d_Surface_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <GeomAbs_Shape.hxx>
26#include <Standard_Integer.hxx>
27#include <TColStd_Array1OfReal.hxx>
28#include <Standard_Boolean.hxx>
29#include <GeomAbs_SurfaceType.hxx>
30class Standard_OutOfRange;
31class Standard_NoSuchObject;
32class Standard_DomainError;
33class Adaptor3d_HSurface;
34class gp_Pnt;
35class gp_Vec;
36class gp_Pln;
37class gp_Cylinder;
38class gp_Cone;
39class gp_Sphere;
40class gp_Torus;
41class Geom_BezierSurface;
42class Geom_BSplineSurface;
43class gp_Ax1;
44class gp_Dir;
45class Adaptor3d_HCurve;
46
47
48//! Root class for surfaces on which geometric algorithms work.
49//! An adapted surface is an interface between the
50//! services provided by a surface and those required of
51//! the surface by algorithms which use it.
52//! A derived concrete class is provided:
53//! GeomAdaptor_Surface for a surface from the Geom package.
54//! The Surface class describes the standard behaviour
55//! of a surface for generic algorithms.
56//!
57//! The Surface can be decomposed in intervals of any
58//! continuity in U and V using the method
59//! NbIntervals. A current interval can be set. Most
60//! of the methods apply to the current interval.
61//! Warning: All the methods are virtual and implemented with a
62//! raise to allow to redefined only the methods realy
63//! used.
34e4e9f2
BB
64//!
65//! Polynomial coefficients of BSpline surfaces used for their evaluation are
66//! cached for better performance. Therefore these evaluations are not
67//! thread-safe and parallel evaluations need to be prevented.
42cf5bc1 68class Adaptor3d_Surface
69{
70public:
71
72 DEFINE_STANDARD_ALLOC
73
74
75 Standard_EXPORT virtual Standard_Real FirstUParameter() const;
76
77 Standard_EXPORT virtual Standard_Real LastUParameter() const;
78
79 Standard_EXPORT virtual Standard_Real FirstVParameter() const;
80
81 Standard_EXPORT virtual Standard_Real LastVParameter() const;
82
83 Standard_EXPORT virtual GeomAbs_Shape UContinuity() const;
84
85 Standard_EXPORT virtual GeomAbs_Shape VContinuity() const;
86
87 //! Returns the number of U intervals for continuity
88 //! <S>. May be one if UContinuity(me) >= <S>
89 Standard_EXPORT virtual Standard_Integer NbUIntervals (const GeomAbs_Shape S) const;
90
91 //! Returns the number of V intervals for continuity
92 //! <S>. May be one if VContinuity(me) >= <S>
93 Standard_EXPORT virtual Standard_Integer NbVIntervals (const GeomAbs_Shape S) const;
94
95 //! Returns the intervals with the requested continuity
96 //! in the U direction.
97 Standard_EXPORT virtual void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
98
99 //! Returns the intervals with the requested continuity
100 //! in the V direction.
101 Standard_EXPORT virtual void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const;
102
103 //! Returns a surface trimmed in the U direction
104 //! equivalent of <me> between
105 //! parameters <First> and <Last>. <Tol> is used to
106 //! test for 3d points confusion.
107 //! If <First> >= <Last>
108 Standard_EXPORT virtual Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
109
110 //! Returns a surface trimmed in the V direction between
111 //! parameters <First> and <Last>. <Tol> is used to
112 //! test for 3d points confusion.
113 //! If <First> >= <Last>
114 Standard_EXPORT virtual Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const;
115
116 Standard_EXPORT virtual Standard_Boolean IsUClosed() const;
117
118 Standard_EXPORT virtual Standard_Boolean IsVClosed() const;
119
120 Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const;
121
122 Standard_EXPORT virtual Standard_Real UPeriod() const;
123
124 Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const;
125
126 Standard_EXPORT virtual Standard_Real VPeriod() const;
127
128 //! Computes the point of parameters U,V on the surface.
129 Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const;
130
131 //! Computes the point of parameters U,V on the surface.
132 Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const;
133
134 //! Computes the point and the first derivatives on
135 //! the surface.
136 //! Raised if the continuity of the current
137 //! intervals is not C1.
138 Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const;
139
140 //! Computes the point, the first and second
141 //! derivatives on the surface.
142 //! Raised if the continuity of the current
143 //! intervals is not C2.
144 Standard_EXPORT virtual 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;
145
146 //! Computes the point, the first, second and third
147 //! derivatives on the surface.
148 //! Raised if the continuity of the current
149 //! intervals is not C3.
150 Standard_EXPORT virtual 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;
151
152 //! Computes the derivative of order Nu in the direction U and Nv
153 //! in the direction V at the point P(U, V).
154 //! Raised if the current U interval is not not CNu
155 //! and the current V interval is not CNv.
156 //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
157 Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const;
158
159 //! Returns the parametric U resolution corresponding
160 //! to the real space resolution <R3d>.
161 Standard_EXPORT virtual Standard_Real UResolution (const Standard_Real R3d) const;
162
163 //! Returns the parametric V resolution corresponding
164 //! to the real space resolution <R3d>.
165 Standard_EXPORT virtual Standard_Real VResolution (const Standard_Real R3d) const;
166
167 //! Returns the type of the surface : Plane, Cylinder,
168 //! Cone, Sphere, Torus, BezierSurface,
169 //! BSplineSurface, SurfaceOfRevolution,
170 //! SurfaceOfExtrusion, OtherSurface
171 Standard_EXPORT virtual GeomAbs_SurfaceType GetType() const;
172
173 Standard_EXPORT virtual gp_Pln Plane() const;
174
175 Standard_EXPORT virtual gp_Cylinder Cylinder() const;
176
177 Standard_EXPORT virtual gp_Cone Cone() const;
178
179 Standard_EXPORT virtual gp_Sphere Sphere() const;
180
181 Standard_EXPORT virtual gp_Torus Torus() const;
182
183 Standard_EXPORT virtual Standard_Integer UDegree() const;
184
185 Standard_EXPORT virtual Standard_Integer NbUPoles() const;
186
187 Standard_EXPORT virtual Standard_Integer VDegree() const;
188
189 Standard_EXPORT virtual Standard_Integer NbVPoles() const;
190
191 Standard_EXPORT virtual Standard_Integer NbUKnots() const;
192
193 Standard_EXPORT virtual Standard_Integer NbVKnots() const;
194
195 Standard_EXPORT virtual Standard_Boolean IsURational() const;
196
197 Standard_EXPORT virtual Standard_Boolean IsVRational() const;
198
199 Standard_EXPORT virtual Handle(Geom_BezierSurface) Bezier() const;
200
201 Standard_EXPORT virtual Handle(Geom_BSplineSurface) BSpline() const;
202
203 Standard_EXPORT virtual gp_Ax1 AxeOfRevolution() const;
204
205 Standard_EXPORT virtual gp_Dir Direction() const;
206
207 Standard_EXPORT virtual Handle(Adaptor3d_HCurve) BasisCurve() const;
208
209 Standard_EXPORT virtual Handle(Adaptor3d_HSurface) BasisSurface() const;
210
211 Standard_EXPORT virtual Standard_Real OffsetValue() const;
212 Standard_EXPORT virtual ~Adaptor3d_Surface();
213
214
215
216
217protected:
218
219
220
221
222
223private:
224
225
226
227
228
229};
230
231
232
233
234
235
236
237#endif // _Adaptor3d_Surface_HeaderFile