Added
Link Here
|
1 |
--- nurbs/hnurbsS_sp.cpp.orig Mon May 13 14:07:46 2002 |
2 |
+++ nurbs/hnurbsS_sp.cpp Fri Dec 1 01:01:28 2006 |
3 |
@@ -43,7 +43,7 @@ |
4 |
*/ |
5 |
template <class T, int N> |
6 |
void HNurbsSurfaceSP<T,N>::updateMaxU() { |
7 |
- if(degU>3){ |
8 |
+ if(this->degU>3){ |
9 |
#ifdef USE_EXCEPTION |
10 |
throw NurbsError(); |
11 |
#else |
12 |
@@ -53,12 +53,12 @@ |
13 |
#endif |
14 |
} |
15 |
else{ |
16 |
- maxU.resize(P.rows()) ; |
17 |
- maxAtU_.resize(P.rows()) ; |
18 |
- for(int i=0;i<P.rows();++i){ |
19 |
- if(!maxInfluence(i,U,degU,maxAtU_[i])) |
20 |
+ maxU.resize(this->P.rows()) ; |
21 |
+ maxAtU_.resize(this->P.rows()) ; |
22 |
+ for(int i=0;i<this->P.rows();++i){ |
23 |
+ if(!maxInfluence(i,this->U,this->degU,maxAtU_[i])) |
24 |
cerr << "Problem in maxInfluence U!\n" ; |
25 |
- maxU[i] = nurbsBasisFun(maxAtU_[i],i,degU,U) ; |
26 |
+ maxU[i] = nurbsBasisFun(maxAtU_[i],i,this->degU,this->U) ; |
27 |
} |
28 |
|
29 |
} |
30 |
@@ -78,7 +78,7 @@ |
31 |
*/ |
32 |
template <class T, int N> |
33 |
void HNurbsSurfaceSP<T,N>::updateMaxV() { |
34 |
- if(degV>3){ |
35 |
+ if(this->degV>3){ |
36 |
#ifdef USE_EXCEPTION |
37 |
throw NurbsError(); |
38 |
#else |
39 |
@@ -88,12 +88,12 @@ |
40 |
#endif |
41 |
} |
42 |
else{ |
43 |
- maxV.resize(P.cols()) ; |
44 |
- maxAtV_.resize(P.cols()) ; |
45 |
- for(int i=0;i<P.cols();++i){ |
46 |
- if(!maxInfluence(i,V,degV,maxAtV_[i])) |
47 |
+ maxV.resize(this->P.cols()) ; |
48 |
+ maxAtV_.resize(this->P.cols()) ; |
49 |
+ for(int i=0;i<this->P.cols();++i){ |
50 |
+ if(!maxInfluence(i,this->V,this->degV,maxAtV_[i])) |
51 |
cerr << "Problem in maxInfluence V!\n" ; |
52 |
- maxV[i] = nurbsBasisFun(maxAtV_[i],i,degV,V) ; |
53 |
+ maxV[i] = nurbsBasisFun(maxAtV_[i],i,this->degV,this->V) ; |
54 |
} |
55 |
|
56 |
} |
57 |
@@ -113,18 +113,18 @@ |
58 |
*/ |
59 |
template <class T, int N> |
60 |
void HNurbsSurfaceSP<T,N>::modSurfCPby(int i, int j, const HPoint_nD<T,N>& a) { |
61 |
- offset(i,j) += a / (maxU[i]*maxV[j]) ; |
62 |
- if(baseLevel_){ |
63 |
+ this->offset(i,j) += a / (maxU[i]*maxV[j]) ; |
64 |
+ if(this->baseLevel_){ |
65 |
Point_nD<T,N> vecOffset ; |
66 |
- vecOffset = offset(i,j).x()*ivec(i,j) + |
67 |
- offset(i,j).y()*jvec(i,j) + |
68 |
- offset(i,j).z()*kvec(i,j) ; |
69 |
- P(i,j).x() = baseSurf.ctrlPnts()(i,j).x()+vecOffset.x() ; |
70 |
- P(i,j).y() = baseSurf.ctrlPnts()(i,j).y()+vecOffset.y() ; |
71 |
- P(i,j).z() = baseSurf.ctrlPnts()(i,j).z()+vecOffset.z() ; |
72 |
+ vecOffset = this->offset(i,j).x()*this->ivec(i,j) + |
73 |
+ this->offset(i,j).y()*this->jvec(i,j) + |
74 |
+ this->offset(i,j).z()*this->kvec(i,j) ; |
75 |
+ this->P(i,j).x() = this->baseSurf.ctrlPnts()(i,j).x()+vecOffset.x() ; |
76 |
+ this->P(i,j).y() = this->baseSurf.ctrlPnts()(i,j).y()+vecOffset.y() ; |
77 |
+ this->P(i,j).z() = this->baseSurf.ctrlPnts()(i,j).z()+vecOffset.z() ; |
78 |
} |
79 |
else |
80 |
- P(i,j) = offset(i,j) ; |
81 |
+ this->P(i,j) = this->offset(i,j) ; |
82 |
} |
83 |
|
84 |
/*! |
85 |
@@ -151,24 +151,24 @@ |
86 |
void HNurbsSurfaceSP<T,N>::modOnlySurfCPby(int i, int j, const HPoint_nD<T,N>& a){ |
87 |
int k ; |
88 |
|
89 |
- P = offset ; |
90 |
+ this->P = this->offset ; |
91 |
|
92 |
// by definition the offset has w = 0 , but this isn't valid for |
93 |
// the control points, increasing the w by 1, will generate a valid surface |
94 |
- if(baseLevel_) |
95 |
- for(k=0;k<P.rows();++k) |
96 |
- for(int l=0;l<P.cols();++l) |
97 |
- P(k,l).w() += T(1) ; |
98 |
+ if(this->baseLevel_) |
99 |
+ for(k=0;k<this->P.rows();++k) |
100 |
+ for(int l=0;l<this->P.cols();++l) |
101 |
+ this->P(k,l).w() += T(1) ; |
102 |
|
103 |
int sizeU, sizeV ; |
104 |
|
105 |
- sizeU = 2*degU+3 ; |
106 |
- if(i-degU-1<0) sizeU += i-degU-1 ; |
107 |
- if(i+degU+1>=P.rows()) sizeU -= i+degU+1-P.rows() ; |
108 |
- |
109 |
- sizeV = 2*degV+3 ; |
110 |
- if(j-degV-1<0) sizeV += j-degV-1 ; |
111 |
- if(j+degV+1>=P.cols()) sizeV -= j+degV+1-P.cols() ; |
112 |
+ sizeU = 2*this->degU+3 ; |
113 |
+ if(i-this->degU-1<0) sizeU += i-this->degU-1 ; |
114 |
+ if(i+this->degU+1>=this->P.rows()) sizeU -= i+this->degU+1-this->P.rows() ; |
115 |
+ |
116 |
+ sizeV = 2*this->degV+3 ; |
117 |
+ if(j-this->degV-1<0) sizeV += j-this->degV-1 ; |
118 |
+ if(j+this->degV+1>=this->P.cols()) sizeV -= j+this->degV+1-this->P.cols() ; |
119 |
|
120 |
Vector<T> u(sizeU) ; |
121 |
Vector<T> v(sizeV) ; |
122 |
@@ -179,16 +179,16 @@ |
123 |
int n=0; |
124 |
int nu = 0 ; |
125 |
int nv = 0 ; |
126 |
- for(k=i-degU-1;k<=i+degU+1;++k){ |
127 |
+ for(k=i-this->degU-1;k<=i+this->degU+1;++k){ |
128 |
if(k<0) |
129 |
continue ; |
130 |
- if(k>=P.rows()) |
131 |
+ if(k>=this->P.rows()) |
132 |
break ; |
133 |
nv = 0 ; |
134 |
- for(int l=j-degV-1;l<=j+degV+1;++l){ |
135 |
+ for(int l=j-this->degV-1;l<=j+this->degV+1;++l){ |
136 |
if(l<0) |
137 |
continue ; |
138 |
- if(l>=P.cols()) |
139 |
+ if(l>=this->P.cols()) |
140 |
break ; |
141 |
if( k == i && j==l){ |
142 |
pts[n].x() = a.x() ; |
143 |
@@ -216,12 +216,12 @@ |
144 |
pv.resize(n) ; |
145 |
|
146 |
if(NurbsSurface<T,N>::movePoint(u,v,pts,pu,pv)){ |
147 |
- offset = P ; |
148 |
+ this->offset = this->P ; |
149 |
// an offset shouldn't have a weight value. |
150 |
- if(baseLevel_) |
151 |
- for(k=0;k<P.rows();++k) |
152 |
- for(int l=0;l<P.cols();++l) |
153 |
- offset(k,l).w() -= T(1) ; |
154 |
+ if(this->baseLevel_) |
155 |
+ for(k=0;k<this->P.rows();++k) |
156 |
+ for(int l=0;l<this->P.cols();++l) |
157 |
+ this->offset(k,l).w() -= T(1) ; |
158 |
} |
159 |
updateSurface(); |
160 |
} |
161 |
@@ -262,7 +262,7 @@ |
162 |
HNurbsSurfaceSP<T,N>* HNurbsSurfaceSP<T,N>::addLevel(int n, int s) { |
163 |
HNurbsSurfaceSP<T,N> *newLevel ; |
164 |
|
165 |
- if(nextLevel_) |
166 |
+ if(this->nextLevel_) |
167 |
return 0 ; |
168 |
|
169 |
Vector<T> newU,newV ; |
170 |
@@ -289,7 +289,7 @@ |
171 |
HNurbsSurfaceSP<T,N>* HNurbsSurfaceSP<T,N>::addLevel() { |
172 |
HNurbsSurfaceSP<T,N> *newLevel ; |
173 |
|
174 |
- if(nextLevel_) |
175 |
+ if(this->nextLevel_) |
176 |
return 0 ; |
177 |
|
178 |
newLevel = new HNurbsSurfaceSP<T,N>(this) ; |
179 |
@@ -311,23 +311,23 @@ |
180 |
levelP = nS.nextLevel() ; |
181 |
|
182 |
NurbsSurface<T,N>::operator=(nS) ; |
183 |
- rU = nS.rU ; |
184 |
- rV = nS.rV ; |
185 |
- offset = nS.offset ; |
186 |
+ this->rU = nS.rU ; |
187 |
+ this->rV = nS.rV ; |
188 |
+ this->offset = nS.offset ; |
189 |
|
190 |
updateMaxUV() ; |
191 |
|
192 |
- firstLevel_ = this ; |
193 |
+ this->firstLevel_ = this ; |
194 |
|
195 |
if(levelP){ |
196 |
HNurbsSurfaceSP<T,N> *newLevel ; |
197 |
newLevel = new HNurbsSurfaceSP<T,N>(this) ; |
198 |
newLevel->copy(*levelP) ; |
199 |
- nextLevel_ = newLevel ; |
200 |
- lastLevel_ = nextLevel_->lastLevel() ; |
201 |
+ this->nextLevel_ = newLevel ; |
202 |
+ this->lastLevel_ = this->nextLevel_->lastLevel() ; |
203 |
} |
204 |
else{ |
205 |
- lastLevel_ = this ; |
206 |
+ this->lastLevel_ = this ; |
207 |
} |
208 |
|
209 |
} |
210 |
@@ -349,55 +349,55 @@ |
211 |
template <class T, int N> |
212 |
void HNurbsSurfaceSP<T,N>::updateSurface(int i0, int j0){ |
213 |
if(i0>=0 && j0>=0){ |
214 |
- if(offset(i0,j0).x()==0.0 && offset(i0,j0).y()==0.0 && offset(i0,j0).z()==0.0) |
215 |
+ if(this->offset(i0,j0).x()==0.0 && this->offset(i0,j0).y()==0.0 && this->offset(i0,j0).z()==0.0) |
216 |
return ; |
217 |
} |
218 |
- if(baseLevel_){ |
219 |
- if(initBase()){ |
220 |
- P = baseSurf.ctrlPnts() ; |
221 |
- U = baseSurf.knotU() ; |
222 |
- V = baseSurf.knotV() ; |
223 |
- degU = baseSurf.degreeU() ; |
224 |
- degV = baseSurf.degreeV() ; |
225 |
+ if(this->baseLevel_){ |
226 |
+ if(this->initBase()){ |
227 |
+ this->P = this->baseSurf.ctrlPnts() ; |
228 |
+ this->U = this->baseSurf.knotU() ; |
229 |
+ this->V = this->baseSurf.knotV() ; |
230 |
+ this->degU = this->baseSurf.degreeU() ; |
231 |
+ this->degV = this->baseSurf.degreeV() ; |
232 |
updateMaxUV() ; |
233 |
} |
234 |
if(i0>=0 && j0>=0){ |
235 |
Point_nD<T,N> vecOffset ; |
236 |
- vecOffset = offset(i0,j0).x()*ivec(i0,j0) + |
237 |
- offset(i0,j0).y()*jvec(i0,j0) + |
238 |
- offset(i0,j0).z()*kvec(i0,j0) ; |
239 |
- P(i0,j0).x() = baseSurf.ctrlPnts()(i0,j0).x()+vecOffset.x() ; |
240 |
- P(i0,j0).y() = baseSurf.ctrlPnts()(i0,j0).y()+vecOffset.y() ; |
241 |
- P(i0,j0).z() = baseSurf.ctrlPnts()(i0,j0).z()+vecOffset.z() ; |
242 |
+ vecOffset = this->offset(i0,j0).x()*this->ivec(i0,j0) + |
243 |
+ this->offset(i0,j0).y()*this->jvec(i0,j0) + |
244 |
+ this->offset(i0,j0).z()*this->kvec(i0,j0) ; |
245 |
+ this->P(i0,j0).x() = this->baseSurf.ctrlPnts()(i0,j0).x()+vecOffset.x() ; |
246 |
+ this->P(i0,j0).y() = this->baseSurf.ctrlPnts()(i0,j0).y()+vecOffset.y() ; |
247 |
+ this->P(i0,j0).z() = this->baseSurf.ctrlPnts()(i0,j0).z()+vecOffset.z() ; |
248 |
} |
249 |
else{ |
250 |
- for(int i=0;i<P.rows();++i) |
251 |
- for(int j=0;j<P.cols();++j){ |
252 |
- if(offset(i,j).x() != 0 || |
253 |
- offset(i,j).y() != 0 || offset(i,j).z() || 0){ |
254 |
+ for(int i=0;i<this->P.rows();++i) |
255 |
+ for(int j=0;j<this->P.cols();++j){ |
256 |
+ if(this->offset(i,j).x() != 0 || |
257 |
+ this->offset(i,j).y() != 0 || this->offset(i,j).z() || 0){ |
258 |
Point_nD<T,N> vecOffset ; |
259 |
- vecOffset = offset(i,j).x()*ivec(i,j) + |
260 |
- offset(i,j).y()*jvec(i,j) + |
261 |
- offset(i,j).z()*kvec(i,j) ; |
262 |
- P(i,j).x() = baseSurf.ctrlPnts()(i,j).x()+vecOffset.x() ; |
263 |
- P(i,j).y() = baseSurf.ctrlPnts()(i,j).y()+vecOffset.y() ; |
264 |
- P(i,j).z() = baseSurf.ctrlPnts()(i,j).z()+vecOffset.z() ; |
265 |
+ vecOffset = this->offset(i,j).x()*this->ivec(i,j) + |
266 |
+ this->offset(i,j).y()*this->jvec(i,j) + |
267 |
+ this->offset(i,j).z()*this->kvec(i,j) ; |
268 |
+ this->P(i,j).x() = this->baseSurf.ctrlPnts()(i,j).x()+vecOffset.x() ; |
269 |
+ this->P(i,j).y() = this->baseSurf.ctrlPnts()(i,j).y()+vecOffset.y() ; |
270 |
+ this->P(i,j).z() = this->baseSurf.ctrlPnts()(i,j).z()+vecOffset.z() ; |
271 |
} |
272 |
} |
273 |
} |
274 |
} |
275 |
else{ |
276 |
if(i0>=0 && j0>=0) |
277 |
- P(i0,j0) = offset(i0,j0) ; |
278 |
+ this->P(i0,j0) = this->offset(i0,j0) ; |
279 |
else{ |
280 |
- for(int i=0;i<P.rows();++i) |
281 |
- for(int j=0;j<P.cols();++j){ |
282 |
- P(i,j) = offset(i,j) ; |
283 |
+ for(int i=0;i<this->P.rows();++i) |
284 |
+ for(int j=0;j<this->P.cols();++j){ |
285 |
+ this->P(i,j) = this->offset(i,j) ; |
286 |
} |
287 |
} |
288 |
} |
289 |
|
290 |
- ++updateN ; |
291 |
+ ++(this->updateN) ; |
292 |
} |
293 |
|
294 |
/*! |
295 |
@@ -413,7 +413,7 @@ |
296 |
if(!okMax()) |
297 |
updateMaxUV() ; |
298 |
if(upLevel>=0){ |
299 |
- if(level()<=upLevel){ |
300 |
+ if(this->level()<=upLevel){ |
301 |
this->updateSurface() ; |
302 |
} |
303 |
} |
304 |
@@ -421,9 +421,9 @@ |
305 |
this->updateSurface() ; |
306 |
} |
307 |
|
308 |
- if(upLevel>level() || upLevel<0){ |
309 |
- if(nextLevel_) |
310 |
- ((HNurbsSurfaceSP<T,N>*)nextLevel_)->updateLevels(upLevel) ; |
311 |
+ if(upLevel>this->level() || upLevel<0){ |
312 |
+ if(this->nextLevel_) |
313 |
+ ((HNurbsSurfaceSP<T,N>*)this->nextLevel_)->updateLevels(upLevel) ; |
314 |
} |
315 |
} |
316 |
|
317 |
@@ -458,10 +458,10 @@ |
318 |
if(!fin.read((char*)&du,sizeof(int))) { delete []type ; return 0 ;} |
319 |
if(!fin.read((char*)&dv,sizeof(int))) { delete []type ; return 0 ;} |
320 |
|
321 |
- resize(nu,nv,du,dv) ; |
322 |
+ this->resize(nu,nv,du,dv) ; |
323 |
|
324 |
- if(!fin.read((char*)U.memory(),sizeof(T)*U.n())) { delete []type ; return 0 ;} |
325 |
- if(!fin.read((char*)V.memory(),sizeof(T)*V.n())) { delete []type ; return 0 ;} |
326 |
+ if(!fin.read((char*)this->U.memory(),sizeof(T)*this->U.n())) { delete []type ; return 0 ;} |
327 |
+ if(!fin.read((char*)this->V.memory(),sizeof(T)*this->V.n())) { delete []type ; return 0 ;} |
328 |
|
329 |
if(!r1){ |
330 |
p = new T[3*nu*nv] ; |
331 |
@@ -469,10 +469,10 @@ |
332 |
p2 = p ; |
333 |
for(int i=0;i<nu;i++) |
334 |
for(int j=0;j<nv;j++){ |
335 |
- P(i,j).x() = *(p++) ; |
336 |
- P(i,j).y() = *(p++) ; |
337 |
- P(i,j).z() = *(p++) ; |
338 |
- P(i,j).w() = 1.0 ; |
339 |
+ this->P(i,j).x() = *(p++) ; |
340 |
+ this->P(i,j).y() = *(p++) ; |
341 |
+ this->P(i,j).z() = *(p++) ; |
342 |
+ this->P(i,j).w() = 1.0 ; |
343 |
} |
344 |
delete []p2 ; |
345 |
} |
346 |
@@ -482,26 +482,26 @@ |
347 |
p2 = p ; |
348 |
for(int i=0;i<nu;i++) |
349 |
for(int j=0;j<nv;j++){ |
350 |
- P(i,j).x() = *(p++) ; |
351 |
- P(i,j).y() = *(p++) ; |
352 |
- P(i,j).z() = *(p++) ; |
353 |
- P(i,j).w() = *(p++) ; |
354 |
+ this->P(i,j).x() = *(p++) ; |
355 |
+ this->P(i,j).y() = *(p++) ; |
356 |
+ this->P(i,j).z() = *(p++) ; |
357 |
+ this->P(i,j).w() = *(p++) ; |
358 |
} |
359 |
delete []p2 ; |
360 |
} |
361 |
- offset = P ; |
362 |
+ this->offset = this->P ; |
363 |
this->updateSurface() ; |
364 |
} |
365 |
else { // reading the offset information |
366 |
int ru,rv ; |
367 |
if(!fin.read((char*)&ru,sizeof(int))) { delete []type ; return 0 ;} |
368 |
if(!fin.read((char*)&rv,sizeof(int))) { delete []type ; return 0 ;} |
369 |
- rU.resize(ru) ; |
370 |
- rV.resize(rv) ; |
371 |
- if(rU.n()>0) |
372 |
- if(!fin.read((char*)rU.memory(),sizeof(T)*rU.n())) { delete []type ; return 0 ;} |
373 |
- if(rV.n()>0) |
374 |
- if(!fin.read((char*)rV.memory(),sizeof(T)*rV.n())) { delete []type ; return 0 ;} |
375 |
+ this->rU.resize(ru) ; |
376 |
+ this->rV.resize(rv) ; |
377 |
+ if(this->rU.n()>0) |
378 |
+ if(!fin.read((char*)this->rU.memory(),sizeof(T)*this->rU.n())) { delete []type ; return 0 ;} |
379 |
+ if(this->rV.n()>0) |
380 |
+ if(!fin.read((char*)this->rV.memory(),sizeof(T)*this->rV.n())) { delete []type ; return 0 ;} |
381 |
|
382 |
if(!fin.read((char*)&nu,sizeof(int))) { delete []type ; return 0 ;} |
383 |
if(!fin.read((char*)&nv,sizeof(int))) { delete []type ; return 0 ;} |
384 |
@@ -509,16 +509,16 @@ |
385 |
p = new T[4*nu*nv] ; |
386 |
if(!fin.read((char*)p,sizeof(T)*4*nu*nv)) { delete []type ; return 0 ;} |
387 |
p2 = p ; |
388 |
- offset.resize(nu,nv) ; |
389 |
+ this->offset.resize(nu,nv) ; |
390 |
for(int i=0;i<nu;i++) |
391 |
for(int j=0;j<nv;j++){ |
392 |
- offset(i,j).x() = *(p++) ; |
393 |
- offset(i,j).y() = *(p++) ; |
394 |
- offset(i,j).z() = *(p++) ; |
395 |
- offset(i,j).w() = *(p++) ; |
396 |
+ this->offset(i,j).x() = *(p++) ; |
397 |
+ this->offset(i,j).y() = *(p++) ; |
398 |
+ this->offset(i,j).z() = *(p++) ; |
399 |
+ this->offset(i,j).w() = *(p++) ; |
400 |
} |
401 |
delete []p2 ; |
402 |
- --baseUpdateN ; |
403 |
+ --(this->baseUpdateN) ; |
404 |
this->updateSurface() ; |
405 |
} |
406 |
|