b311480e |
1 | // Created on: 1996-11-21 |
2 | // Created by: Joelle CHAUVET |
3 | // Copyright (c) 1996-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. |
b311480e |
16 | |
7fd59977 |
17 | // Modified: Wed Mar 5 09:45:42 1997 |
18 | // by: Joelle CHAUVET |
19 | // G1134 : new methods RealBounds and Constraints |
20 | // Modified: Mon Jun 16 15:22:41 1997 |
21 | // by: Jerome LEMONIER |
22 | // Correction de la methode D2 (faute de frappe dans le code) |
23 | // Correction de la methode D1 (D0 inutile) |
b311480e |
24 | |
42cf5bc1 |
25 | #include <Geom_Curve.hxx> |
26 | #include <Geom_Geometry.hxx> |
27 | #include <Geom_Surface.hxx> |
28 | #include <Geom_UndefinedDerivative.hxx> |
29 | #include <Geom_UndefinedValue.hxx> |
30 | #include <GeomPlate_Surface.hxx> |
31 | #include <gp_GTrsf2d.hxx> |
32 | #include <gp_Pnt.hxx> |
33 | #include <gp_Trsf.hxx> |
34 | #include <gp_Vec.hxx> |
7fd59977 |
35 | #include <gp_XY.hxx> |
42cf5bc1 |
36 | #include <Plate_Plate.hxx> |
37 | #include <Standard_NoSuchObject.hxx> |
38 | #include <Standard_RangeError.hxx> |
39 | #include <Standard_Type.hxx> |
7fd59977 |
40 | |
92efcf78 |
41 | IMPLEMENT_STANDARD_RTTIEXT(GeomPlate_Surface,Geom_Surface) |
42 | |
7fd59977 |
43 | //======================================================================= |
44 | //function : GeomPlate_Surface |
45 | //purpose : |
46 | //======================================================================= |
7fd59977 |
47 | GeomPlate_Surface::GeomPlate_Surface(const Handle(Geom_Surface)& Surfinit,const Plate_Plate& Surfinter) : mySurfinter(Surfinter),mySurfinit(Surfinit) |
48 | { |
49 | } |
50 | |
51 | //======================================================================= |
52 | //function : UReverse |
53 | //purpose : |
54 | //======================================================================= |
55 | |
56 | void GeomPlate_Surface::UReverse() |
57 | { |
9775fa61 |
58 | //throw Standard_Failure("UReverse"); |
7fd59977 |
59 | } |
60 | |
61 | |
62 | //======================================================================= |
63 | //function : UReversedParameter |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | Standard_Real GeomPlate_Surface::UReversedParameter(const Standard_Real U) const |
9775fa61 |
68 | { //throw Standard_Failure("UReversedParameter"); |
7fd59977 |
69 | return (-U); |
70 | } |
71 | |
72 | |
73 | //======================================================================= |
74 | //function : VReverse |
75 | //purpose : |
76 | //======================================================================= |
77 | |
78 | void GeomPlate_Surface::VReverse() |
9775fa61 |
79 | { //throw Standard_Failure("VReverse"); |
7fd59977 |
80 | } |
81 | |
82 | |
83 | //======================================================================= |
84 | //function : VReversedParameter |
85 | //purpose : |
86 | //======================================================================= |
87 | |
88 | Standard_Real GeomPlate_Surface::VReversedParameter(const Standard_Real V) const |
9775fa61 |
89 | { //throw Standard_Failure("VReversedParameter"); |
7fd59977 |
90 | return (-V); |
91 | } |
92 | |
93 | |
94 | //======================================================================= |
95 | //function : TransformParameters |
96 | //purpose : |
97 | //======================================================================= |
98 | |
99 | //void GeomPlate_Surface::TransformParameters(Standard_Real& U, Standard_Real& V, const gp_Trsf& T) const |
100 | void GeomPlate_Surface::TransformParameters(Standard_Real& , Standard_Real& , const gp_Trsf& ) const |
9775fa61 |
101 | {//throw Standard_Failure("TransformParameters"); |
7fd59977 |
102 | } |
103 | |
104 | |
105 | //======================================================================= |
106 | //function : ParametricTransformation |
107 | //purpose : |
108 | //======================================================================= |
109 | |
110 | //gp_GTrsf2d GeomPlate_Surface::ParametricTransformation(const gp_Trsf& T) const |
111 | gp_GTrsf2d GeomPlate_Surface::ParametricTransformation(const gp_Trsf& ) const |
9775fa61 |
112 | {//throw Standard_Failure("ParametricTransformation"); |
7fd59977 |
113 | return gp_GTrsf2d(); |
114 | } |
115 | |
116 | |
117 | //======================================================================= |
118 | //function : Bounds |
119 | //purpose : |
120 | //======================================================================= |
121 | |
122 | void GeomPlate_Surface::Bounds(Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const |
123 | { |
124 | if (mySurfinit->DynamicType() == STANDARD_TYPE(GeomPlate_Surface)) |
125 | mySurfinit->Bounds(U1,U2,V1,V2); |
126 | else |
127 | {U1=myUmin;U2=myUmax;V1=myVmin;V2=myVmax;} |
128 | } |
129 | |
130 | |
131 | //======================================================================= |
132 | //function : IsUClosed |
133 | //purpose : |
134 | //======================================================================= |
135 | |
136 | Standard_Boolean GeomPlate_Surface::IsUClosed() const |
9775fa61 |
137 | { //throw Standard_Failure("IsUClosed("); |
7fd59977 |
138 | //return 1; |
139 | return 0; |
140 | } |
141 | |
142 | |
143 | //======================================================================= |
144 | //function : IsVClosed |
145 | //purpose : |
146 | //======================================================================= |
147 | |
148 | Standard_Boolean GeomPlate_Surface::IsVClosed() const |
9775fa61 |
149 | { //throw Standard_Failure("IsVClosed("); |
7fd59977 |
150 | //return 1; |
151 | return 0; |
152 | } |
153 | |
154 | |
155 | //======================================================================= |
156 | //function : IsUPeriodic |
157 | //purpose : |
158 | //======================================================================= |
159 | |
160 | Standard_Boolean GeomPlate_Surface::IsUPeriodic() const |
161 | { |
162 | return Standard_False; |
163 | } |
164 | |
165 | |
166 | //======================================================================= |
167 | //function : UPeriod |
168 | //purpose : |
169 | //======================================================================= |
170 | |
171 | Standard_Real GeomPlate_Surface::UPeriod() const |
172 | { |
173 | return Standard_False; |
174 | } |
175 | |
176 | |
177 | //======================================================================= |
178 | //function : IsVPeriodic |
179 | //purpose : |
180 | //======================================================================= |
181 | |
182 | Standard_Boolean GeomPlate_Surface::IsVPeriodic() const |
183 | { |
184 | return Standard_False; |
185 | } |
186 | |
187 | |
188 | //======================================================================= |
189 | //function : VPeriod |
190 | //purpose : |
191 | //======================================================================= |
192 | |
193 | Standard_Real GeomPlate_Surface::VPeriod() const |
194 | { |
195 | return Standard_False; |
196 | } |
197 | |
198 | |
199 | //======================================================================= |
200 | //function : UIso |
201 | //purpose : |
202 | //======================================================================= |
203 | |
204 | //Handle(Geom_Curve) GeomPlate_Surface::UIso(const Standard_Real U) const |
205 | Handle(Geom_Curve) GeomPlate_Surface::UIso(const Standard_Real ) const |
9775fa61 |
206 | { //throw Standard_Failure("UIso"); |
7fd59977 |
207 | return Handle(Geom_Curve)(); |
208 | } |
209 | |
210 | |
211 | //======================================================================= |
212 | //function : VIso |
213 | //purpose : |
214 | //======================================================================= |
215 | |
216 | //Handle(Geom_Curve) GeomPlate_Surface::VIso(const Standard_Real V) const |
217 | Handle(Geom_Curve) GeomPlate_Surface::VIso(const Standard_Real ) const |
9775fa61 |
218 | { //throw Standard_Failure("VIso"); |
7fd59977 |
219 | return Handle(Geom_Curve)(); |
220 | } |
221 | |
222 | |
223 | //======================================================================= |
224 | //function : Continuity |
225 | //purpose : |
226 | //======================================================================= |
227 | |
228 | GeomAbs_Shape GeomPlate_Surface::Continuity() const |
9775fa61 |
229 | { //throw Standard_Failure("Continuity()"); |
7fd59977 |
230 | return GeomAbs_Shape(); |
231 | |
232 | } |
233 | |
234 | |
235 | //======================================================================= |
236 | //function : IsCNu |
237 | //purpose : |
238 | //======================================================================= |
239 | |
240 | //Standard_Boolean GeomPlate_Surface::IsCNu(const Standard_Integer N) const |
241 | Standard_Boolean GeomPlate_Surface::IsCNu(const Standard_Integer ) const |
9775fa61 |
242 | { |
243 | throw Standard_Failure("IsCNu"); |
7fd59977 |
244 | } |
245 | |
246 | |
247 | //======================================================================= |
248 | //function : IsCNv |
249 | //purpose : |
250 | //======================================================================= |
251 | |
252 | //Standard_Boolean GeomPlate_Surface::IsCNv(const Standard_Integer N) const |
253 | Standard_Boolean GeomPlate_Surface::IsCNv(const Standard_Integer ) const |
9775fa61 |
254 | { |
255 | throw Standard_Failure("IsCNv"); |
7fd59977 |
256 | } |
257 | |
258 | |
259 | //======================================================================= |
260 | //function : D0 |
261 | //purpose : |
262 | //======================================================================= |
263 | |
264 | void GeomPlate_Surface::D0(const Standard_Real U, const Standard_Real V, gp_Pnt& P) const |
265 | { |
266 | gp_XY P1(U,V); |
267 | gp_Pnt P2; |
268 | mySurfinit->D0(U,V,P2); |
269 | gp_XYZ P3;//=mySurfinter.Evaluate(P1); |
270 | P3=mySurfinter.Evaluate(P1); |
271 | for (Standard_Integer i=1; i<=3; i++) |
272 | { |
273 | P.SetCoord(i,P3.Coord(i)+P2.Coord(i)); |
274 | } |
275 | } |
276 | |
277 | |
278 | //======================================================================= |
279 | //function : D1 |
280 | //purpose : |
281 | //======================================================================= |
282 | |
283 | void GeomPlate_Surface::D1(const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const |
284 | { |
285 | gp_XY P1(U,V); |
286 | gp_Pnt P2; |
287 | D0(U,V,P); |
288 | gp_Vec V1U,V1V; |
289 | mySurfinit->D1(U,V,P2,V1U,V1V); |
290 | gp_XYZ V2U=mySurfinter.EvaluateDerivative(P1,1,0); |
291 | gp_XYZ V2V=mySurfinter.EvaluateDerivative(P1,0,1); |
292 | for (Standard_Integer i=1; i<=3; i++) |
293 | { |
294 | D1U.SetCoord(i,V1U.Coord(i)+V2U.Coord(i)); |
295 | D1V.SetCoord(i,V1V.Coord(i)+V2V.Coord(i)); |
296 | } |
297 | } |
298 | |
299 | |
300 | //======================================================================= |
301 | //function : D2 |
302 | //purpose : |
303 | //======================================================================= |
304 | |
305 | void GeomPlate_Surface::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 |
306 | { |
307 | gp_XY P1(U,V); |
308 | gp_Pnt P2; |
309 | |
310 | gp_Vec V1U,V1V,V1UV,vv,v; |
311 | D1(U,V,P,D1U,D1V); |
312 | mySurfinit->D2(U,V,P2,vv,v,V1U,V1V,V1UV); |
313 | gp_XYZ V2U=mySurfinter.EvaluateDerivative(P1,2,0); |
314 | gp_XYZ V2V=mySurfinter.EvaluateDerivative(P1,0,2); |
315 | gp_XYZ V2UV=mySurfinter.EvaluateDerivative(P1,1,1); |
316 | for (Standard_Integer i=1; i<=3; i++) |
317 | { |
318 | D2U.SetCoord(i,V1U.Coord(i)+V2U.Coord(i)); |
319 | D2V.SetCoord(i,V1V.Coord(i)+V2V.Coord(i)); |
320 | D2UV.SetCoord(i,V1UV.Coord(i)+V2UV.Coord(i)); |
321 | } |
322 | } |
323 | |
324 | |
325 | //======================================================================= |
326 | //function : D3 |
327 | //purpose : |
328 | //======================================================================= |
329 | |
330 | //void GeomPlate_Surface::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 |
331 | void GeomPlate_Surface::D3(const Standard_Real , const Standard_Real , gp_Pnt& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& , gp_Vec& ) const |
9775fa61 |
332 | { throw Standard_Failure("D3"); |
7fd59977 |
333 | } |
334 | |
335 | |
336 | //======================================================================= |
337 | //function : DN |
338 | //purpose : |
339 | //======================================================================= |
340 | |
341 | //gp_Vec GeomPlate_Surface::DN(const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const |
342 | gp_Vec GeomPlate_Surface::DN(const Standard_Real , const Standard_Real , const Standard_Integer , const Standard_Integer ) const |
9775fa61 |
343 | { |
344 | throw Standard_Failure("DN"); |
7fd59977 |
345 | } |
346 | |
347 | |
348 | //======================================================================= |
349 | //function : Copy |
350 | //purpose : |
351 | //======================================================================= |
352 | |
353 | Handle(Geom_Geometry) GeomPlate_Surface::Copy() const |
354 | { |
355 | Handle(GeomPlate_Surface) GPS |
356 | = new GeomPlate_Surface(mySurfinit,mySurfinter); |
357 | return GPS; |
358 | } |
359 | |
360 | |
361 | //======================================================================= |
362 | //function : Transform |
363 | //purpose : |
364 | //======================================================================= |
365 | |
366 | //void GeomPlate_Surface::Transform(const gp_Trsf& T) |
367 | void GeomPlate_Surface::Transform(const gp_Trsf& ) |
9775fa61 |
368 | { //throw Standard_Failure("Transform"); |
7fd59977 |
369 | } |
370 | |
371 | //======================================================================= |
372 | //function : CallSurfinit |
373 | //purpose : |
374 | //======================================================================= |
375 | |
376 | Handle(Geom_Surface) GeomPlate_Surface::CallSurfinit() const |
377 | |
378 | { |
379 | return mySurfinit; |
380 | } |
381 | |
382 | |
383 | //======================================================================= |
384 | //function : SetBounds |
385 | //purpose : |
386 | //======================================================================= |
387 | |
388 | void GeomPlate_Surface::SetBounds(const Standard_Real Umin, const Standard_Real Umax, const Standard_Real Vmin, const Standard_Real Vmax) |
389 | { |
9775fa61 |
390 | if ((Umin>Umax) || (Vmin>Vmax)) throw Standard_Failure("Bounds haven't the good sense"); |
391 | if ((Umin==Umax) || (Vmin==Vmax)) throw Standard_Failure("Bounds are equal"); |
2a8523ac |
392 | myUmin=Umin;myUmax=Umax;myVmin=Vmin;myVmax=Vmax; |
7fd59977 |
393 | } |
394 | |
395 | |
396 | //======================================================================= |
397 | //function : RealBounds |
398 | //purpose : |
399 | //======================================================================= |
400 | |
401 | void GeomPlate_Surface::RealBounds(Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const |
402 | { |
403 | mySurfinter.UVBox(U1,U2,V1,V2); |
404 | } |
405 | |
406 | |
407 | //======================================================================= |
408 | //function : Constraints |
409 | //purpose : |
410 | //======================================================================= |
411 | |
412 | void GeomPlate_Surface::Constraints(TColgp_SequenceOfXY& Seq) const |
413 | { |
414 | mySurfinter.UVConstraints(Seq); |
415 | } |