b311480e |
1 | -- Created on: 1999-04-27 |
2 | -- Created by: Andrey BETENEV |
3 | -- Copyright (c) 1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class CompositeSurface from ShapeExtend inherits Surface from Geom |
18 | |
19 | ---Purpose: Composite surface is represented by a grid of surfaces |
20 | -- (patches) connected geometrically. Patches may have different |
21 | -- parametrisation ranges, but they should be parametrised in |
22 | -- the same manner so that parameter of each patch (u,v) can be converted |
23 | -- to global parameter on the whole surface (U,V) with help of linear |
24 | -- transformation: |
25 | -- |
26 | -- for any i,j-th patch |
27 | -- U = Ui + ( u - uijmin ) * ( Ui+1 - Ui ) / ( uijmax - uijmin ) |
28 | -- V = Vj + ( v - vijmin ) * ( Vj+1 - Vj ) / ( vijmax - vijmin ) |
29 | -- |
30 | -- where |
31 | -- |
32 | -- [uijmin, uijmax] * [ vijmin, vijmax] - parametric range of i,j-th patch, |
33 | -- |
34 | -- Ui (i=1,..,Nu+1), Vi (j=1,..,Nv+1) - values defining global |
35 | -- parametrisation by U and V (correspond to points between patches and |
36 | -- bounds, (Ui,Uj) corresponds to (uijmin,vijmin) on i,j-th patch) and to |
37 | -- (u(i-1)(j-1)max,v(i-1)(j-1)max) on (i-1),(j-1)-th patch. |
38 | -- |
39 | -- Geometrical connectivity is expressed via global parameters: |
40 | -- S[i,j](Ui+1,V) = S[i+1,j](Ui+1,V) for any i, j, V |
41 | -- S[i,j](U,Vj+1) = S[i,j+1](U,Vj+1) for any i, j, U |
42 | -- It is checked with Precision::Confusion() by default. |
43 | -- |
44 | -- NOTE 1: This class is inherited from Geom_Surface in order to |
45 | -- make it more easy to store and deal with it. However, it should |
46 | -- not be passed to standard methods dealing with geometry since |
47 | -- this type is not known to them. |
48 | -- NOTE 2: Not all the inherited methods are implemented, and some are |
49 | -- implemented not in the full form. |
50 | |
51 | uses |
52 | Pnt2d from gp, |
53 | Pnt from gp, |
54 | Vec from gp, |
55 | Trsf from gp, |
56 | Trsf2d from gp, |
57 | Surface from Geom, |
58 | Curve from Geom, |
59 | Array1OfReal from TColStd, |
60 | HArray1OfReal from TColStd, |
61 | HArray2OfSurface from TColGeom, |
62 | Shape from GeomAbs, |
63 | Parametrisation from ShapeExtend |
64 | |
65 | is |
66 | |
67 | Create returns mutable CompositeSurface from ShapeExtend; |
68 | ---Purpose: Empty constructor. |
69 | |
70 | Create (GridSurf: HArray2OfSurface from TColGeom; |
71 | param : Parametrisation from ShapeExtend = ShapeExtend_Natural) |
72 | returns mutable CompositeSurface from ShapeExtend; |
73 | ---Purpose: Initializes by a grid of surfaces (calls Init()). |
74 | |
75 | Create (GridSurf: HArray2OfSurface from TColGeom; |
76 | UJoints, VJoints : Array1OfReal from TColStd) |
77 | returns mutable CompositeSurface from ShapeExtend; |
78 | ---Purpose: Initializes by a grid of surfaces (calls Init()). |
79 | |
80 | Init (me: mutable; GridSurf: HArray2OfSurface from TColGeom; |
81 | param : Parametrisation from ShapeExtend = ShapeExtend_Natural) |
82 | returns Boolean; |
83 | ---Purpose: Initializes by a grid of surfaces. |
84 | -- All the Surfaces of the grid must have geometrical |
85 | -- connectivity as stated above. |
86 | -- If geometrical connectivity is not satisfied, method |
87 | -- returns False. |
88 | -- However, class is initialized even in that case. |
89 | -- |
90 | -- Last parameter defines how global parametrisation |
91 | -- (joint values) will be computed: |
92 | -- ShapeExtend_Natural: U1 = u11min, Ui+1 = Ui + (ui1max-ui1min), etc. |
93 | -- ShapeExtend_Uniform: Ui = i-1, Vj = j-1 |
94 | -- ShapeExtend_Unitary: Ui = (i-1)/Nu, Vi = (j-1)/Nv |
95 | |
96 | Init (me: mutable; GridSurf: HArray2OfSurface from TColGeom; |
97 | UJoints, VJoints : Array1OfReal from TColStd) |
98 | returns Boolean; |
99 | ---Purpose: Initializes by a grid of surfaces with given global |
100 | -- parametrisation defined by UJoints and VJoints arrays, |
101 | -- each having langth equal to number of patches in corresponding |
102 | -- direction + 1. Global joint values should be sorted in |
103 | -- increasing order. |
104 | -- All the Surfaces of the grid must have geometrical |
105 | -- connectivity as stated above. |
106 | -- If geometrical connectivity is not satisfied, method |
107 | -- returns False. |
108 | -- However, class is initialized even in that case. |
109 | |
110 | NbUPatches (me) returns Integer; |
111 | ---Purpose: Returns number of patches in U direction. |
112 | |
113 | NbVPatches (me) returns Integer; |
114 | ---Purpose: Returns number of patches in V direction. |
115 | |
116 | Patch (me; i, j: Integer) returns Surface from Geom; |
117 | ---C++: return const & |
118 | ---Purpose: Returns one surface patch |
119 | |
120 | Patches (me) returns HArray2OfSurface from TColGeom; |
121 | ---C++: return const & |
122 | ---Purpose: Returns grid of surfaces |
123 | |
124 | UJointValues (me) returns HArray1OfReal from TColStd; |
125 | ---Purpose: Returns the array of U values corresponding to joint |
126 | -- points between patches as well as to start and end points, |
127 | -- which define global parametrisation of the surface |
128 | |
129 | VJointValues (me) returns HArray1OfReal from TColStd; |
130 | ---Purpose: Returns the array of V values corresponding to joint |
131 | -- points between patches as well as to start and end points, |
132 | -- which define global parametrisation of the surface |
133 | |
134 | UJointValue (me; i: Integer) returns Real; |
135 | ---Purpose: Returns i-th joint value in U direction |
136 | -- (1-st is global Umin, (NbUPatches()+1)-th is global Umax |
137 | -- on the composite surface) |
138 | |
139 | VJointValue (me; j: Integer) returns Real; |
140 | ---Purpose: Returns j-th joint value in V direction |
141 | -- (1-st is global Vmin, (NbVPatches()+1)-th is global Vmax |
142 | -- on the composite surface) |
143 | |
144 | SetUJointValues (me: mutable; UJoints: Array1OfReal from TColStd) |
145 | returns Boolean; |
146 | ---Purpose: Sets the array of U values corresponding to joint |
147 | -- points, which define global parametrisation of the surface. |
148 | -- Number of values in array should be equal to NbUPatches()+1. |
149 | -- All the values should be sorted in increasing order. |
150 | -- If this is not satisfied, does nothing and returns False. |
151 | |
152 | SetVJointValues (me: mutable; VJoints: Array1OfReal from TColStd) |
153 | returns Boolean; |
154 | ---Purpose: Sets the array of V values corresponding to joint |
155 | -- points, which define global parametrisation of the surface |
156 | -- Number of values in array should be equal to NbVPatches()+1. |
157 | -- All the values should be sorted in increasing order. |
158 | -- If this is not satisfied, does nothing and returns False. |
159 | |
160 | SetUFirstValue (me: mutable; UFirst: Real); |
161 | ---Purpose: Changes starting value for global U parametrisation (all |
162 | -- other joint values are shifted accordingly) |
163 | |
164 | SetVFirstValue (me: mutable; VFirst: Real); |
165 | ---Purpose: Changes starting value for global V parametrisation (all |
166 | -- other joint values are shifted accordingly) |
167 | |
168 | LocateUParameter(me; U: Real) returns Integer; |
169 | ---Purpose: Returns number of col that contains given (global) parameter |
170 | |
171 | LocateVParameter(me; V: Real) returns Integer; |
172 | ---Purpose: Returns number of row that contains given (global) parameter |
173 | |
174 | LocateUVPoint(me; pnt: Pnt2d from gp; |
175 | i : out Integer; |
176 | j : out Integer); |
177 | ---Purpose: Returns number of row and col of surface that contains |
178 | -- given point |
179 | |
180 | Patch(me; U, V: Real) returns Surface from Geom; |
181 | ---C++: return const & |
182 | ---Purpose: Returns one surface patch that contains given (global) parameters |
183 | |
184 | Patch(me; pnt: Pnt2d from gp) returns Surface from Geom; |
185 | ---C++: return const & |
186 | ---Purpose: Returns one surface patch that contains given point |
187 | |
188 | |
189 | ---Advanced: Work with local parameters on patches |
190 | |
191 | ULocalToGlobal (me; i, j: Integer; u: Real) returns Real; |
192 | ---Purpose: Converts local parameter u on patch i,j to global parameter U |
193 | |
194 | VLocalToGlobal (me; i, j: Integer; v: Real) returns Real; |
195 | ---Purpose: Converts local parameter v on patch i,j to global parameter V |
196 | |
197 | LocalToGlobal (me; i, j: Integer; uv: Pnt2d from gp) returns Pnt2d from gp; |
198 | ---Purpose: Converts local parameters uv on patch i,j to global parameters UV |
199 | |
200 | UGlobalToLocal (me; i, j: Integer; U: Real) returns Real; |
201 | ---Purpose: Converts global parameter U to local parameter u on patch i,j |
202 | |
203 | VGlobalToLocal (me; i, j: Integer; V: Real) returns Real; |
204 | ---Purpose: Converts global parameter V to local parameter v on patch i,j |
205 | |
206 | GlobalToLocal (me; i, j: Integer; UV: Pnt2d from gp) returns Pnt2d from gp; |
207 | ---Purpose: Converts global parameters UV to local parameters uv on patch i,j |
208 | |
209 | GlobalToLocalTransformation (me; i, j : Integer; |
210 | uFact: out Real; Trsf: out Trsf2d from gp ) |
211 | returns Boolean; |
212 | ---Purpose: Computes transformation operator and uFactor descrinbing affine |
213 | -- transformation required to convert global parameters on composite |
214 | -- surface to local parameters on patch (i,j): |
215 | -- uv = ( uFactor, 1. ) X Trsf * UV; |
216 | -- NOTE: Thus Trsf contains shift and scale by V, scale by U is stored in uFact. |
217 | -- Returns True if transformation is not an identity |
218 | |
219 | |
220 | ---Inherited: methods of Geom_Geometry and Geom_Surface |
221 | |
222 | Transform (me : mutable; T : Trsf) is redefined; |
223 | ---Purpose: Applies transformation to all the patches |
224 | |
225 | Copy (me) returns mutable like me is redefined; |
226 | ---Purpose: Returns a copy of the surface |
227 | |
228 | UReverse (me : mutable) is redefined; |
229 | ---Purpose: NOT IMPLEMENTED (does nothing) |
230 | |
231 | UReversedParameter (me; U : Real) returns Real is redefined; |
232 | ---Purpose: Returns U |
233 | |
234 | VReverse (me : mutable) is redefined; |
235 | ---Purpose: NOT IMPLEMENTED (does nothing) |
236 | |
237 | VReversedParameter (me; V : Real) returns Real is redefined; |
238 | ---Purpose: Returns V |
239 | |
240 | Bounds(me; U1, U2, V1, V2 : out Real) is redefined; |
241 | ---Purpose: Returns the parametric bounds of grid |
242 | |
243 | IsUClosed (me) returns Boolean is redefined; |
244 | ---Purpose: Returns True if grid is closed in U direction |
245 | -- (i.e. connected with Precision::Confusion) |
246 | |
247 | IsVClosed (me) returns Boolean is redefined; |
248 | ---Purpose: Returns True if grid is closed in V direction |
249 | -- (i.e. connected with Precision::Confusion) |
250 | |
251 | IsUPeriodic (me) returns Boolean is redefined; |
252 | ---Purpose: Returns False |
253 | |
254 | IsVPeriodic (me) returns Boolean is redefined; |
255 | ---Purpose: Returns False |
256 | |
257 | UIso (me; U : Real) returns mutable Curve is redefined; |
258 | ---Purpose: NOT IMPLEMENTED (returns Null curve) |
259 | |
260 | VIso (me; V : Real) returns mutable Curve is redefined; |
261 | ---Purpose: NOT IMPLEMENTED (returns Null curve) |
262 | |
263 | |
264 | Continuity (me) returns Shape from GeomAbs is redefined; |
265 | ---Purpose: returns C0 |
266 | |
267 | IsCNu (me; N : Integer) returns Boolean is redefined; |
268 | ---Purpose: returns True if N <=0 |
269 | |
270 | IsCNv (me; N : Integer) returns Boolean is redefined; |
271 | ---Purpose: returns True if N <=0 |
272 | |
273 | D0 (me; U, V : Real; P : out Pnt) is redefined; |
274 | ---Purpose: Computes the point of parameter U,V on the grid. |
275 | |
276 | D1 (me; U, V : Real; P : out Pnt; D1U, D1V : out Vec) is redefined; |
277 | ---Purpose: Computes the point P and the first derivatives in the |
278 | -- directions U and V at this point. |
279 | |
280 | D2 (me; U, V : Real; P : out Pnt; D1U, D1V, D2U, D2V, D2UV : out Vec) is redefined; |
281 | ---Purpose: Computes the point P, the first and the second derivatives in |
282 | -- the directions U and V at this point. |
283 | |
284 | D3 (me; U, V : Real; P : out Pnt; |
285 | D1U, D1V, D2U, D2V, D2UV, D3U, D3V, D3UUV, D3UVV: out Vec) is redefined; |
286 | ---Purpose: Computes the point P, the first,the second and the third |
287 | -- derivatives in the directions U and V at this point. |
288 | |
289 | DN (me; U, V : Real; Nu, Nv : Integer) returns Vec is redefined; |
290 | ---Purpose: Computes the derivative of order Nu in the direction U and Nv |
291 | -- in the direction V at the point P(U, V). |
292 | |
293 | Value(me; pnt: Pnt2d from gp) returns Pnt from gp; |
294 | ---Purpose: Computes the point of parameter pnt on the grid. |
295 | |
296 | |
297 | ---Private: internal methods |
298 | |
299 | ComputeJointValues (me: mutable; param : Parametrisation from ShapeExtend = ShapeExtend_Natural); |
300 | ---Purpose: Computes Joint values according to parameter |
301 | |
302 | CheckConnectivity (me: mutable; prec: Real) returns Boolean; |
303 | ---Purpose: Checks geometrical connectivity of the patches, including |
304 | -- closedness (sets fields muUClosed and myVClosed) |
305 | |
306 | fields |
307 | |
308 | myPatches : HArray2OfSurface from TColGeom; |
309 | myUJointValues: HArray1OfReal from TColStd; |
310 | myVJointValues: HArray1OfReal from TColStd; |
311 | myUClosed : Boolean; -- closedness (periodicity) measured with Precision::Confusion() |
312 | myVClosed : Boolean; |
313 | |
314 | end; |
315 | |