Revision a76d9cb4
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/Movement.java | ||
---|---|---|
190 | 190 |
if( denom != 0.0f ) |
191 | 191 |
{ |
192 | 192 |
float axisCam = a0*mCamera[0] + a1*mCamera[1] + a2*mCamera[2]; |
193 |
float distance = mDistanceCenterFace3D; |
|
194 |
float alpha = (distance-axisCam)/denom; |
|
193 |
float alpha = (mDistanceCenterFace3D-axisCam)/denom; |
|
195 | 194 |
|
196 | 195 |
output[0] = mCamera[0] + d0*alpha; |
197 | 196 |
output[1] = mCamera[1] + d1*alpha; |
... | ... | |
336 | 335 |
// the 3D 'cuts' to translate it from 3D (i.e. with respect to the rotAxis) to 2D in-face (i.e. with |
337 | 336 |
// respect to the 2D rotAxis cast into a particular face) |
338 | 337 |
|
339 |
void computeLinear(float distance3D, Static3D[] rotAxis, Static3D[] faceAxis) |
|
338 |
private void computeLinear(float distance3D, Static3D[] rotAxis, Static3D[] faceAxis)
|
|
340 | 339 |
{ |
341 | 340 |
int numFaces = faceAxis.length; |
342 | 341 |
int numRot = rotAxis.length; |
... | ... | |
356 | 355 |
mB[i][j] = sign*distance3D*coeff; |
357 | 356 |
} |
358 | 357 |
else mB[i][j] = 0.0f; |
359 |
|
|
360 |
android.util.Log.e("D", "face="+i+" rot="+j+" a="+mA[i][j]+" B="+mB[i][j]); |
|
361 | 358 |
} |
362 | 359 |
} |
363 | 360 |
|
... | ... | |
376 | 373 |
for(int i=0; i<len; i++) |
377 | 374 |
{ |
378 | 375 |
float translated = B + borders[i]/A; |
379 |
|
|
380 |
android.util.Log.e("D", "offset="+offset+" borders[i]="+borders[i]+" translated="+translated+" A="+A+" B="+B); |
|
381 |
|
|
382 | 376 |
if( offset<translated ) return i; |
383 | 377 |
} |
384 | 378 |
} |
src/main/java/org/distorted/objects/TwistyMinx.java | ||
---|---|---|
514 | 514 |
{ |
515 | 515 |
mCuts = new float[6][numLayers-1]; |
516 | 516 |
float D = numLayers*MovementMinx.DIST3D; |
517 |
float E = 2*SIN54; |
|
518 |
float X = 2*D*E/(1+2*E); // height of the 'upper' part of a dodecahedron, i.e. put it on a table, |
|
519 |
// its height is then D*2*DIST3D, it has one 'lower' part of height X, one |
|
517 |
float X = 2*D/(2+SIN18); // height of the 'upper' part of a dodecahedron, i.e. put it on a table, |
|
518 |
// its height is then 2D, it has one 'lower' part of height X, one |
|
520 | 519 |
// 'middle' part of height Y and one upper part of height X again. |
521 |
// It's edge length = numLayers/3.0f. |
|
522 | 520 |
int num = (numLayers-1)/2; |
523 | 521 |
float G = X*dist/num; // height of one Layer |
524 | 522 |
|
525 | 523 |
for(int i=0; i<num; i++) |
526 | 524 |
{ |
527 |
float cut = -D + (i+0.5f)*G; |
|
525 |
float cut = -D + (i+0.85f)*G; // 0.85? not fully correct; attempt to make it |
|
526 |
// easier to rotate the outer layers |
|
528 | 527 |
int j = 2*num-1-i; |
529 | 528 |
mCuts[0][i] = +cut; |
530 | 529 |
mCuts[0][j] = -cut; |
Also available in: Unified diff
Correct the cuts of Mega/Kilominx.