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