Revision 1ad1c158
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/library/mesh/MeshMultigon.java | ||
---|---|---|
305 | 305 |
int outerL = belongsToOuter(vL[0],vL[1]); |
306 | 306 |
int outerR = belongsToOuter(vR[0],vR[1]); |
307 | 307 |
|
308 |
float[] vl = mOuterVectors[outerL]; |
|
309 |
float[] vr = mOuterVectors[outerR]; |
|
308 |
if( outerL>=0 && outerR>=0 ) |
|
309 |
{ |
|
310 |
float[] vl =mOuterVectors[outerL]; |
|
311 |
normL[0] = -vl[0]; |
|
312 |
normL[1] = -vl[1]; |
|
313 |
float[] vr =mOuterVectors[outerR]; |
|
314 |
normR[0] = -vr[0]; |
|
315 |
normR[1] = -vr[1]; |
|
316 |
} |
|
317 |
else |
|
318 |
{ |
|
319 |
int eupp = edges[prev]; |
|
320 |
int eupn = edges[next]; |
|
310 | 321 |
|
311 |
normL[0] = -vl[0]; |
|
312 |
normL[1] = -vl[1]; |
|
313 |
normR[0] = -vr[0]; |
|
314 |
normR[1] = -vr[1]; |
|
322 |
if( eupp<0 ) |
|
323 |
{ |
|
324 |
normL[0]=vL[0]-vT[0]; |
|
325 |
normL[1]=vL[1]-vT[1]; |
|
326 |
} |
|
327 |
else |
|
328 |
{ |
|
329 |
normL[0]= v[2*curr ] - v[2*prev ]; |
|
330 |
normL[1]= v[2*curr+1] - v[2*prev+1]; |
|
331 |
} |
|
332 |
|
|
333 |
if( eupn<0 ) |
|
334 |
{ |
|
335 |
normR[0]=vR[0]-vT[0]; |
|
336 |
normR[1]=vR[1]-vT[1]; |
|
337 |
} |
|
338 |
else |
|
339 |
{ |
|
340 |
int nnxt= next==len-1 ? 0 : next+1; |
|
341 |
normR[0]= v[2*next ] - v[2*nnxt ]; |
|
342 |
normR[1]= v[2*next+1] - v[2*nnxt+1]; |
|
343 |
} |
|
344 |
} |
|
315 | 345 |
|
316 | 346 |
return MeshBandedTriangle.MODE_NORMAL; |
317 | 347 |
} |
... | ... | |
338 | 368 |
else |
339 | 369 |
{ |
340 | 370 |
int outerT = belongsToOuter(vT[0],vT[1]); |
341 |
float[] vt = mOuterVectors[outerT]; |
|
342 |
float dx = vt[0]; |
|
343 |
float dy = vt[1]; |
|
344 |
|
|
345 |
normL[0]=dx; |
|
346 |
normL[1]=dy; |
|
347 |
normR[0]=dx; |
|
348 |
normR[1]=dy; |
|
371 |
|
|
372 |
if( outerT>=0 ) |
|
373 |
{ |
|
374 |
float[] vt =mOuterVectors[outerT]; |
|
375 |
normL[0]= vt[0]; |
|
376 |
normL[1]= vt[1]; |
|
377 |
normR[0]= vt[0]; |
|
378 |
normR[1]= vt[1]; |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
float dx = v[2*next ]-v[2*curr ]; |
|
383 |
float dy = v[2*next+1]-v[2*curr+1]; |
|
384 |
normL[0]= dx; |
|
385 |
normL[1]= dy; |
|
386 |
normR[0]= dx; |
|
387 |
normR[1]= dy; |
|
388 |
} |
|
349 | 389 |
|
350 | 390 |
return MeshBandedTriangle.MODE_INVERTED; |
351 | 391 |
} |
Also available in: Unified diff
Initial support for scrambling a bandaged pyraminx.