1 // Created on: 1995-12-04
2 // Created by: Laurent BOURESCHE
3 // Copyright (c) 1995-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.
18 #include <GeomFill_Boundary.hxx>
19 #include <GeomFill_CoonsAlgPatch.hxx>
23 #include <Law_Function.hxx>
24 #include <Law_Linear.hxx>
25 #include <Standard_Type.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(GeomFill_CoonsAlgPatch,Standard_Transient)
29 //=======================================================================
30 //function : GeomFill_CoonsAlgPatch
32 //=======================================================================
33 GeomFill_CoonsAlgPatch::GeomFill_CoonsAlgPatch
34 (const Handle(GeomFill_Boundary)& B1,
35 const Handle(GeomFill_Boundary)& B2,
36 const Handle(GeomFill_Boundary)& B3,
37 const Handle(GeomFill_Boundary)& B4)
39 bound[0] = B1; bound[1] = B2; bound[2] = B3; bound[3] = B4;
40 Standard_Real deb0, deb1, fin0, fin1;
42 B2->Bounds(deb1,fin1);
43 Handle(Law_Linear) aLaw0 = new Law_Linear();
44 aLaw0->Set (deb1, 1., fin1, 0.);
47 B1->Bounds(deb0,fin0);
48 Handle(Law_Linear) aLaw1 = new Law_Linear();
49 aLaw1->Set (deb0, 0., fin0, 1.);
53 temp = B4->Value(deb1).XYZ().Added(B1->Value(deb0).XYZ());
56 temp = B1->Value(fin0).XYZ().Added(B2->Value(deb1).XYZ());
59 temp = B2->Value(fin1).XYZ().Added(B3->Value(fin0).XYZ());
62 temp = B3->Value(deb0).XYZ().Added(B4->Value(fin1).XYZ());
68 //=======================================================================
71 //=======================================================================
73 void GeomFill_CoonsAlgPatch::SetFunc(const Handle(Law_Function)& f1,
74 const Handle(Law_Function)& f2)
81 //=======================================================================
84 //=======================================================================
86 void GeomFill_CoonsAlgPatch::Func(Handle(Law_Function)& f1,
87 Handle(Law_Function)& f2)const
94 //=======================================================================
97 //=======================================================================
99 //gp_Pnt GeomFill_CoonsAlgPatch::Value(const Standard_Real U,
100 gp_Pnt GeomFill_CoonsAlgPatch::Value(const Standard_Real ,
101 const Standard_Real V) const
103 Standard_Real a0,a1,a2,a3;
110 cor = bound[0]->Value(V).XYZ();
113 cortemp = bound[1]->Value(V).XYZ();
114 cortemp.Multiply(a1);
117 cortemp = bound[2]->Value(V).XYZ();
118 cortemp.Multiply(a2);
121 cortemp = bound[3]->Value(V).XYZ();
122 cortemp.Multiply(a3);
125 cortemp = c[0].XYZ();
126 cortemp.Multiply(-a0*a3);
129 cortemp = c[1].XYZ();
130 cortemp.Multiply(-a0*a1);
133 cortemp = c[2].XYZ();
134 cortemp.Multiply(-a1*a2);
137 cortemp = c[3].XYZ();
138 cortemp.Multiply(-a2*a3);
145 //=======================================================================
148 //=======================================================================
150 gp_Vec GeomFill_CoonsAlgPatch::D1U(const Standard_Real U,
151 const Standard_Real V) const
153 Standard_Real a0,a1,a2,a3,bid;
162 bound[0]->D1(U,pbid,vbid);
166 cortemp = bound[1]->Value(V).XYZ();
167 cortemp.Multiply(a1);
170 bound[2]->D1(U,pbid,vbid);
171 cortemp = vbid.XYZ();
172 cortemp.Multiply(a2);
175 cortemp = bound[3]->Value(V).XYZ();
176 cortemp.Multiply(a3);
179 cortemp = c[0].XYZ();
180 cortemp.Multiply(-a0*a3);
183 cortemp = c[1].XYZ();
184 cortemp.Multiply(-a0*a1);
187 cortemp = c[2].XYZ();
188 cortemp.Multiply(-a1*a2);
191 cortemp = c[3].XYZ();
192 cortemp.Multiply(-a2*a3);
200 //=======================================================================
203 //=======================================================================
205 gp_Vec GeomFill_CoonsAlgPatch::D1V(const Standard_Real U,
206 const Standard_Real V) const
208 Standard_Real a0,a1,a2,a3,bid;
217 cor = bound[0]->Value(U).XYZ();
220 bound[1]->D1(V,pbid,vbid);
221 cortemp = vbid.XYZ();
222 cortemp.Multiply(a1);
225 cortemp = bound[2]->Value(U).XYZ();
226 cortemp.Multiply(a2);
229 bound[3]->D1(V,pbid,vbid);
230 cortemp = vbid.XYZ();
231 cortemp.Multiply(a3);
234 cortemp = c[0].XYZ();
235 cortemp.Multiply(-a0*a3);
238 cortemp = c[1].XYZ();
239 cortemp.Multiply(-a0*a1);
242 cortemp = c[2].XYZ();
243 cortemp.Multiply(-a1*a2);
246 cortemp = c[3].XYZ();
247 cortemp.Multiply(-a2*a3);
255 //=======================================================================
258 //=======================================================================
260 gp_Vec GeomFill_CoonsAlgPatch::DUV(const Standard_Real U,
261 const Standard_Real V) const
263 Standard_Real a0,a1,a2,a3,bid;
273 bound[0]->D1(U,pbid,vbid);
277 bound[1]->D1(V,pbid,vbid);
278 cortemp = vbid.XYZ();
279 cortemp.Multiply(a1);
282 bound[2]->D1(U,pbid,vbid);
283 cortemp = vbid.XYZ();
284 cortemp.Multiply(a2);
287 bound[3]->D1(V,pbid,vbid);
288 cortemp = vbid.XYZ();
289 cortemp.Multiply(a3);
292 cortemp = c[0].XYZ();
293 cortemp.Multiply(-a0*a3);
296 cortemp = c[1].XYZ();
297 cortemp.Multiply(-a0*a1);
300 cortemp = c[2].XYZ();
301 cortemp.Multiply(-a1*a2);
304 cortemp = c[3].XYZ();
305 cortemp.Multiply(-a2*a3);
313 //=======================================================================
316 //=======================================================================
318 const Handle(GeomFill_Boundary)& GeomFill_CoonsAlgPatch::Bound
319 (const Standard_Integer I) const
325 //=======================================================================
328 //=======================================================================
330 const gp_Pnt& GeomFill_CoonsAlgPatch::Corner(const Standard_Integer I) const
335 //=======================================================================
338 //=======================================================================
340 const Handle(Law_Function)& GeomFill_CoonsAlgPatch::Func
341 (const Standard_Integer I)const