1 // File: GeomFill_Curved.cxx
2 // Created: Tue Sep 28 17:58:37 1993
3 // Author: Bruno DUMORTIER
6 #include <GeomFill_Curved.ixx>
10 #include <TColStd_Array1OfReal.hxx>
11 #include <TColgp_HArray2OfPnt.hxx>
12 #include <TColStd_HArray2OfReal.hxx>
14 #include <Standard_NotImplemented.hxx>
16 //=======================================================================
17 //function : GeomFill_Curved
19 //=======================================================================
21 GeomFill_Curved::GeomFill_Curved()
26 //=======================================================================
27 //function : GeomFill_Curved
29 //=======================================================================
31 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
32 const TColgp_Array1OfPnt& P2,
33 const TColgp_Array1OfPnt& P3,
34 const TColgp_Array1OfPnt& P4)
40 //=======================================================================
41 //function : GeomFill_Curved
43 //=======================================================================
45 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
46 const TColgp_Array1OfPnt& P2,
47 const TColgp_Array1OfPnt& P3,
48 const TColgp_Array1OfPnt& P4,
49 const TColStd_Array1OfReal& W1,
50 const TColStd_Array1OfReal& W2,
51 const TColStd_Array1OfReal& W3,
52 const TColStd_Array1OfReal& W4)
54 Init(P1, P2, P3, P4, W1, W2, W3, W4);
58 //=======================================================================
59 //function : GeomFill_Curved
61 //=======================================================================
63 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
64 const TColgp_Array1OfPnt& P2,
65 const TColgp_Array1OfPnt& P3)
71 //=======================================================================
72 //function : GeomFill_Curved
74 //=======================================================================
76 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
77 const TColgp_Array1OfPnt& P2,
78 const TColgp_Array1OfPnt& P3,
79 const TColStd_Array1OfReal& W1,
80 const TColStd_Array1OfReal& W2,
81 const TColStd_Array1OfReal& W3)
83 Init(P1, P2, P3, W1, W2, W3);
87 //=======================================================================
88 //function : GeomFill_Curved
90 //=======================================================================
92 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
93 const TColgp_Array1OfPnt& P2)
99 //=======================================================================
100 //function : GeomFill_Curved
102 //=======================================================================
104 GeomFill_Curved::GeomFill_Curved(const TColgp_Array1OfPnt& P1,
105 const TColgp_Array1OfPnt& P2,
106 const TColStd_Array1OfReal& W1,
107 const TColStd_Array1OfReal& W2)
109 Init(P1, P2, W1, W2);
113 //=======================================================================
116 //=======================================================================
118 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& P1,
119 const TColgp_Array1OfPnt& P2,
120 const TColgp_Array1OfPnt& P3,
121 const TColgp_Array1OfPnt& P4)
123 Standard_DomainError_Raise_if
124 ( P1.Length() != P3.Length() || P2.Length() != P4.Length()," ");
126 Standard_Integer NPolU = P1.Length();
127 Standard_Integer NPolV = P2.Length();
129 IsRational = Standard_False;
131 Standard_Real NU = NPolU - 1;
132 Standard_Real NV = NPolV - 1;
133 myPoles = new TColgp_HArray2OfPnt( 1, NPolU, 1, NPolV);
135 // The boundaries are not modified
136 Standard_Integer i,j,k;
137 for ( i=1; i<=NPolU; i++) {
138 myPoles->SetValue( i, 1 , P1(i));
139 myPoles->SetValue( i, NPolV, P3(i));
141 Standard_Real PU,PU1,PV,PV1;
143 for ( j=2; j<=NPolV-1; j++) {
148 myPoles->SetValue( 1 , j, P4(j));
149 myPoles->SetValue( NPolU, j, P2(j));
151 for ( i=2; i<=NPolU-1; i++) {
157 for (k=1; k<=3; k++) {
159 PV1 * P1(i).Coord(k) + PV * P3(i).Coord(k) +
160 PU * P2(j).Coord(k) + PU1 * P4(j).Coord(k) );
162 myPoles->SetValue(i,j,P);
168 //=======================================================================
171 //=======================================================================
173 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& P1,
174 const TColgp_Array1OfPnt& P2,
175 const TColgp_Array1OfPnt& P3,
176 const TColgp_Array1OfPnt& P4,
177 const TColStd_Array1OfReal& W1,
178 const TColStd_Array1OfReal& W2,
179 const TColStd_Array1OfReal& W3,
180 const TColStd_Array1OfReal& W4)
182 Standard_DomainError_Raise_if
183 ( W1.Length() != W3.Length() || W2.Length() != W4.Length()," ");
184 Standard_DomainError_Raise_if
185 ( W1.Length() != P1.Length() ||
186 W2.Length() != P2.Length() ||
187 W3.Length() != P3.Length() ||
188 W4.Length() != P4.Length() , " ");
191 IsRational = Standard_True;
193 Standard_Integer NPolU = W1.Length();
194 Standard_Integer NPolV = W2.Length();
196 Standard_Real NU = NPolU - 1;
197 Standard_Real NV = NPolV - 1;
198 myWeights = new TColStd_HArray2OfReal( 1, NPolU, 1, NPolV);
200 // The boundaries are not modified
201 Standard_Integer i,j;
202 for ( i=1; i<=NPolU; i++) {
203 myWeights->SetValue( i, 1 , W1(i));
204 myWeights->SetValue( i, NPolV, W3(i));
206 Standard_Real PU,PU1,PV,PV1;
208 for ( j=2; j<=NPolV-1; j++) {
213 myWeights->SetValue( 1 , j, W4(j));
214 myWeights->SetValue( NPolU, j, W2(j));
216 for ( i=2; i<=NPolU-1; i++) {
221 Standard_Real W = PV1 * W1(i) + PV * W3(i) +
222 PU * W2(j) + PU1 * W4(j) ;
223 myWeights->SetValue(i,j,W);
229 //=======================================================================
232 //=======================================================================
234 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& , // P1,
235 const TColgp_Array1OfPnt& , // P2,
236 const TColgp_Array1OfPnt& )// P3)
238 Standard_NotImplemented::Raise(" ");
242 //=======================================================================
245 //=======================================================================
247 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& , // P1,
248 const TColgp_Array1OfPnt& , // P2,
249 const TColgp_Array1OfPnt& , // P3,
250 const TColStd_Array1OfReal& , // W1,
251 const TColStd_Array1OfReal& , // W2,
252 const TColStd_Array1OfReal& ) // W3)
254 Standard_NotImplemented::Raise(" ");
258 //=======================================================================
261 //=======================================================================
263 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& P1,
264 const TColgp_Array1OfPnt& P2)
266 Standard_Integer NPolU = P1.Length();
267 Standard_Integer NPolV = P2.Length();
269 IsRational = Standard_False;
271 myPoles = new TColgp_HArray2OfPnt( 1, NPolU, 1, NPolV);
273 Standard_Integer i,j;
275 for ( j=1; j<=NPolV; j++) {
276 gp_Vec Tra(P2(1),P2(j));
277 for ( i=1; i<=NPolU; i++) {
278 myPoles->SetValue( i, j, P1(i).Translated(Tra));
284 //=======================================================================
287 //=======================================================================
289 void GeomFill_Curved::Init(const TColgp_Array1OfPnt& P1,
290 const TColgp_Array1OfPnt& P2,
291 const TColStd_Array1OfReal& W1,
292 const TColStd_Array1OfReal& W2)
295 IsRational = Standard_True;
297 //Initialisation des poids.
298 Standard_Integer NPolU = W1.Length();
299 Standard_Integer NPolV = W2.Length();
301 myWeights = new TColStd_HArray2OfReal( 1, NPolU, 1, NPolV);
302 for (Standard_Integer j=1; j<=NPolV; j++) {
303 Standard_Real Factor = W2(j)/W1(1);
304 for (Standard_Integer i=1; i<=NPolU; i++) {
305 myWeights->SetValue(i,j,W1(i)*Factor);