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