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> |
30 | class Standard_OutOfRange; |
31 | class Standard_NoSuchObject; |
32 | class Standard_DomainError; |
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_Ax1; |
44 | class gp_Dir; |
45 | class 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. |
64 | class Adaptor3d_Surface |
65 | { |
66 | public: |
67 | |
68 | DEFINE_STANDARD_ALLOC |
69 | |
70 | |
71 | Standard_EXPORT virtual Standard_Real FirstUParameter() const; |
72 | |
73 | Standard_EXPORT virtual Standard_Real LastUParameter() const; |
74 | |
75 | Standard_EXPORT virtual Standard_Real FirstVParameter() const; |
76 | |
77 | Standard_EXPORT virtual Standard_Real LastVParameter() const; |
78 | |
79 | Standard_EXPORT virtual GeomAbs_Shape UContinuity() const; |
80 | |
81 | Standard_EXPORT virtual GeomAbs_Shape VContinuity() const; |
82 | |
83 | //! Returns the number of U intervals for continuity |
84 | //! <S>. May be one if UContinuity(me) >= <S> |
85 | Standard_EXPORT virtual Standard_Integer NbUIntervals (const GeomAbs_Shape S) const; |
86 | |
87 | //! Returns the number of V intervals for continuity |
88 | //! <S>. May be one if VContinuity(me) >= <S> |
89 | Standard_EXPORT virtual Standard_Integer NbVIntervals (const GeomAbs_Shape S) const; |
90 | |
91 | //! Returns the intervals with the requested continuity |
92 | //! in the U direction. |
93 | Standard_EXPORT virtual void UIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; |
94 | |
95 | //! Returns the intervals with the requested continuity |
96 | //! in the V direction. |
97 | Standard_EXPORT virtual void VIntervals (TColStd_Array1OfReal& T, const GeomAbs_Shape S) const; |
98 | |
99 | //! Returns a surface trimmed in the U direction |
100 | //! equivalent of <me> between |
101 | //! parameters <First> and <Last>. <Tol> is used to |
102 | //! test for 3d points confusion. |
103 | //! If <First> >= <Last> |
104 | Standard_EXPORT virtual Handle(Adaptor3d_HSurface) UTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; |
105 | |
106 | //! Returns a surface trimmed in the V direction between |
107 | //! parameters <First> and <Last>. <Tol> is used to |
108 | //! test for 3d points confusion. |
109 | //! If <First> >= <Last> |
110 | Standard_EXPORT virtual Handle(Adaptor3d_HSurface) VTrim (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol) const; |
111 | |
112 | Standard_EXPORT virtual Standard_Boolean IsUClosed() const; |
113 | |
114 | Standard_EXPORT virtual Standard_Boolean IsVClosed() const; |
115 | |
116 | Standard_EXPORT virtual Standard_Boolean IsUPeriodic() const; |
117 | |
118 | Standard_EXPORT virtual Standard_Real UPeriod() const; |
119 | |
120 | Standard_EXPORT virtual Standard_Boolean IsVPeriodic() const; |
121 | |
122 | Standard_EXPORT virtual Standard_Real VPeriod() const; |
123 | |
124 | //! Computes the point of parameters U,V on the surface. |
125 | Standard_EXPORT virtual gp_Pnt Value (const Standard_Real U, const Standard_Real V) const; |
126 | |
127 | //! Computes the point of parameters U,V on the surface. |
128 | Standard_EXPORT virtual void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const; |
129 | |
130 | //! Computes the point and the first derivatives on |
131 | //! the surface. |
132 | //! Raised if the continuity of the current |
133 | //! intervals is not C1. |
134 | Standard_EXPORT virtual void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const; |
135 | |
136 | //! Computes the point, the first and second |
137 | //! derivatives on the surface. |
138 | //! Raised if the continuity of the current |
139 | //! intervals is not C2. |
140 | 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; |
141 | |
142 | //! Computes the point, the first, second and third |
143 | //! derivatives on the surface. |
144 | //! Raised if the continuity of the current |
145 | //! intervals is not C3. |
146 | 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; |
147 | |
148 | //! Computes the derivative of order Nu in the direction U and Nv |
149 | //! in the direction V at the point P(U, V). |
150 | //! Raised if the current U interval is not not CNu |
151 | //! and the current V interval is not CNv. |
152 | //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
153 | Standard_EXPORT virtual gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const; |
154 | |
155 | //! Returns the parametric U resolution corresponding |
156 | //! to the real space resolution <R3d>. |
157 | Standard_EXPORT virtual Standard_Real UResolution (const Standard_Real R3d) const; |
158 | |
159 | //! Returns the parametric V resolution corresponding |
160 | //! to the real space resolution <R3d>. |
161 | Standard_EXPORT virtual Standard_Real VResolution (const Standard_Real R3d) const; |
162 | |
163 | //! Returns the type of the surface : Plane, Cylinder, |
164 | //! Cone, Sphere, Torus, BezierSurface, |
165 | //! BSplineSurface, SurfaceOfRevolution, |
166 | //! SurfaceOfExtrusion, OtherSurface |
167 | Standard_EXPORT virtual GeomAbs_SurfaceType GetType() const; |
168 | |
169 | Standard_EXPORT virtual gp_Pln Plane() const; |
170 | |
171 | Standard_EXPORT virtual gp_Cylinder Cylinder() const; |
172 | |
173 | Standard_EXPORT virtual gp_Cone Cone() const; |
174 | |
175 | Standard_EXPORT virtual gp_Sphere Sphere() const; |
176 | |
177 | Standard_EXPORT virtual gp_Torus Torus() const; |
178 | |
179 | Standard_EXPORT virtual Standard_Integer UDegree() const; |
180 | |
181 | Standard_EXPORT virtual Standard_Integer NbUPoles() const; |
182 | |
183 | Standard_EXPORT virtual Standard_Integer VDegree() const; |
184 | |
185 | Standard_EXPORT virtual Standard_Integer NbVPoles() const; |
186 | |
187 | Standard_EXPORT virtual Standard_Integer NbUKnots() const; |
188 | |
189 | Standard_EXPORT virtual Standard_Integer NbVKnots() const; |
190 | |
191 | Standard_EXPORT virtual Standard_Boolean IsURational() const; |
192 | |
193 | Standard_EXPORT virtual Standard_Boolean IsVRational() const; |
194 | |
195 | Standard_EXPORT virtual Handle(Geom_BezierSurface) Bezier() const; |
196 | |
197 | Standard_EXPORT virtual Handle(Geom_BSplineSurface) BSpline() const; |
198 | |
199 | Standard_EXPORT virtual gp_Ax1 AxeOfRevolution() const; |
200 | |
201 | Standard_EXPORT virtual gp_Dir Direction() const; |
202 | |
203 | Standard_EXPORT virtual Handle(Adaptor3d_HCurve) BasisCurve() const; |
204 | |
205 | Standard_EXPORT virtual Handle(Adaptor3d_HSurface) BasisSurface() const; |
206 | |
207 | Standard_EXPORT virtual Standard_Real OffsetValue() const; |
208 | Standard_EXPORT virtual ~Adaptor3d_Surface(); |
209 | |
210 | |
211 | |
212 | |
213 | protected: |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | private: |
220 | |
221 | |
222 | |
223 | |
224 | |
225 | }; |
226 | |
227 | |
228 | |
229 | |
230 | |
231 | |
232 | |
233 | #endif // _Adaptor3d_Surface_HeaderFile |