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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // Modified: Wed Mar 5 09:45:42 1997
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)
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>
33 #include <gp_Trsf.hxx>
36 #include <Plate_Plate.hxx>
37 #include <Standard_NoSuchObject.hxx>
38 #include <Standard_RangeError.hxx>
39 #include <Standard_Type.hxx>
41 IMPLEMENT_STANDARD_RTTIEXT(GeomPlate_Surface,Geom_Surface)
43 //=======================================================================
44 //function : GeomPlate_Surface
46 //=======================================================================
47 GeomPlate_Surface::GeomPlate_Surface(const Handle(Geom_Surface)& Surfinit,const Plate_Plate& Surfinter)
48 : mySurfinter(Surfinter),
57 //=======================================================================
60 //=======================================================================
62 void GeomPlate_Surface::UReverse()
64 //throw Standard_Failure("UReverse");
68 //=======================================================================
69 //function : UReversedParameter
71 //=======================================================================
73 Standard_Real GeomPlate_Surface::UReversedParameter(const Standard_Real U) const
74 { //throw Standard_Failure("UReversedParameter");
79 //=======================================================================
82 //=======================================================================
84 void GeomPlate_Surface::VReverse()
85 { //throw Standard_Failure("VReverse");
89 //=======================================================================
90 //function : VReversedParameter
92 //=======================================================================
94 Standard_Real GeomPlate_Surface::VReversedParameter(const Standard_Real V) const
95 { //throw Standard_Failure("VReversedParameter");
100 //=======================================================================
101 //function : TransformParameters
103 //=======================================================================
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");
111 //=======================================================================
112 //function : ParametricTransformation
114 //=======================================================================
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");
123 //=======================================================================
126 //=======================================================================
128 void GeomPlate_Surface::Bounds(Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const
130 if (mySurfinit->DynamicType() == STANDARD_TYPE(GeomPlate_Surface))
131 mySurfinit->Bounds(U1,U2,V1,V2);
133 {U1=myUmin;U2=myUmax;V1=myVmin;V2=myVmax;}
137 //=======================================================================
138 //function : IsUClosed
140 //=======================================================================
142 Standard_Boolean GeomPlate_Surface::IsUClosed() const
143 { //throw Standard_Failure("IsUClosed(");
149 //=======================================================================
150 //function : IsVClosed
152 //=======================================================================
154 Standard_Boolean GeomPlate_Surface::IsVClosed() const
155 { //throw Standard_Failure("IsVClosed(");
161 //=======================================================================
162 //function : IsUPeriodic
164 //=======================================================================
166 Standard_Boolean GeomPlate_Surface::IsUPeriodic() const
168 return Standard_False;
172 //=======================================================================
175 //=======================================================================
177 Standard_Real GeomPlate_Surface::UPeriod() const
179 return Standard_False;
183 //=======================================================================
184 //function : IsVPeriodic
186 //=======================================================================
188 Standard_Boolean GeomPlate_Surface::IsVPeriodic() const
190 return Standard_False;
194 //=======================================================================
197 //=======================================================================
199 Standard_Real GeomPlate_Surface::VPeriod() const
201 return Standard_False;
205 //=======================================================================
208 //=======================================================================
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)();
217 //=======================================================================
220 //=======================================================================
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)();
229 //=======================================================================
230 //function : Continuity
232 //=======================================================================
234 GeomAbs_Shape GeomPlate_Surface::Continuity() const
235 { //throw Standard_Failure("Continuity()");
236 return GeomAbs_Shape();
241 //=======================================================================
244 //=======================================================================
246 //Standard_Boolean GeomPlate_Surface::IsCNu(const Standard_Integer N) const
247 Standard_Boolean GeomPlate_Surface::IsCNu(const Standard_Integer ) const
249 throw Standard_Failure("IsCNu");
253 //=======================================================================
256 //=======================================================================
258 //Standard_Boolean GeomPlate_Surface::IsCNv(const Standard_Integer N) const
259 Standard_Boolean GeomPlate_Surface::IsCNv(const Standard_Integer ) const
261 throw Standard_Failure("IsCNv");
265 //=======================================================================
268 //=======================================================================
270 void GeomPlate_Surface::D0(const Standard_Real U, const Standard_Real V, gp_Pnt& P) const
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++)
279 P.SetCoord(i,P3.Coord(i)+P2.Coord(i));
284 //=======================================================================
287 //=======================================================================
289 void GeomPlate_Surface::D1(const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const
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++)
300 D1U.SetCoord(i,V1U.Coord(i)+V2U.Coord(i));
301 D1V.SetCoord(i,V1V.Coord(i)+V2V.Coord(i));
306 //=======================================================================
309 //=======================================================================
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
316 gp_Vec V1U,V1V,V1UV,vv,v;
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++)
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));
331 //=======================================================================
334 //=======================================================================
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");
342 //=======================================================================
345 //=======================================================================
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
350 throw Standard_Failure("DN");
354 //=======================================================================
357 //=======================================================================
359 Handle(Geom_Geometry) GeomPlate_Surface::Copy() const
361 Handle(GeomPlate_Surface) GPS
362 = new GeomPlate_Surface(mySurfinit,mySurfinter);
367 //=======================================================================
368 //function : Transform
370 //=======================================================================
372 //void GeomPlate_Surface::Transform(const gp_Trsf& T)
373 void GeomPlate_Surface::Transform(const gp_Trsf& )
374 { //throw Standard_Failure("Transform");
377 //=======================================================================
378 //function : CallSurfinit
380 //=======================================================================
382 Handle(Geom_Surface) GeomPlate_Surface::CallSurfinit() const
389 //=======================================================================
390 //function : SetBounds
392 //=======================================================================
394 void GeomPlate_Surface::SetBounds(const Standard_Real Umin, const Standard_Real Umax, const Standard_Real Vmin, const Standard_Real Vmax)
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;
402 //=======================================================================
403 //function : RealBounds
405 //=======================================================================
407 void GeomPlate_Surface::RealBounds(Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const
409 mySurfinter.UVBox(U1,U2,V1,V2);
413 //=======================================================================
414 //function : Constraints
416 //=======================================================================
418 void GeomPlate_Surface::Constraints(TColgp_SequenceOfXY& Seq) const
420 mySurfinter.UVConstraints(Seq);