Revision ca824448
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/TwistyKilominx.java | ||
---|---|---|
36 | 36 |
import static org.distorted.objects.FactoryCubit.COS18; |
37 | 37 |
import static org.distorted.objects.FactoryCubit.COS54; |
38 | 38 |
import static org.distorted.objects.FactoryCubit.SIN18; |
39 |
import static org.distorted.objects.FactoryCubit.SIN54; |
|
39 | 40 |
|
40 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 42 |
|
... | ... | |
477 | 478 |
} |
478 | 479 |
|
479 | 480 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
480 |
// TODO |
|
481 | 481 |
|
482 | 482 |
void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top) |
483 | 483 |
{ |
484 |
float S = 0.07f; |
|
485 |
float R = 0.09f; |
|
484 |
int COLORS = FACE_COLORS.length; |
|
485 |
int variant = face/COLORS; |
|
486 |
int numLayers = getNumLayers(); |
|
486 | 487 |
|
487 |
float A = 0.86f; |
|
488 |
float X1= (SQ5+1)/8; |
|
489 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
490 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8); |
|
488 |
if( variant == (numLayers-1)/2 || numLayers==3 ) |
|
489 |
{ |
|
490 |
float S = 0.07f; |
|
491 |
float R = 0.09f; |
|
492 |
|
|
493 |
float A = 0.86f; |
|
494 |
float X1= (SQ5+1)/8; |
|
495 |
float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4); |
|
496 |
float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8); |
|
497 |
|
|
498 |
float[] vertices = { -X1, Y2, 0, -A*Y1, X1, Y2, 0, Y1 }; |
|
491 | 499 |
|
492 |
float[] vertices = { -X1, Y2, 0, -A*Y1, X1, Y2, 0, Y1 }; |
|
500 |
FactorySticker factory = FactorySticker.getInstance(); |
|
501 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%NUM_FACES], R); |
|
493 | 502 |
|
494 |
FactorySticker factory = FactorySticker.getInstance(); |
|
495 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%NUM_FACES], R); |
|
503 |
float MID = TEXTURE_HEIGHT*0.5f; |
|
504 |
float WID = TEXTURE_HEIGHT*0.1f; |
|
505 |
float HEI = TEXTURE_HEIGHT*(0.47f+Y1); |
|
506 |
canvas.drawLine(left+MID-WID,top+HEI,left+MID+WID,top+HEI,paint); |
|
507 |
} |
|
508 |
else if( variant==0 ) |
|
509 |
{ |
|
510 |
float Y = COS54/(2*SIN54); |
|
511 |
float R = 0.09f; |
|
512 |
float S = 0.09f; |
|
513 |
float[] vertices = { -0.5f, 0.0f, 0.0f, -Y, 0.5f, 0.0f, 0.0f, Y }; |
|
496 | 514 |
|
497 |
float MID = TEXTURE_HEIGHT*0.5f; |
|
498 |
float WID = TEXTURE_HEIGHT*0.1f; |
|
499 |
float HEI = TEXTURE_HEIGHT*(0.47f+Y1); |
|
500 |
canvas.drawLine(left+MID-WID,top+HEI,left+MID+WID,top+HEI,paint); |
|
515 |
FactorySticker factory = FactorySticker.getInstance(); |
|
516 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%COLORS], R); |
|
517 |
} |
|
518 |
else |
|
519 |
{ |
|
520 |
float R = 0.07f; |
|
521 |
float S = 0.07f; |
|
522 |
|
|
523 |
float tmp = (numLayers/3.0f)/(numLayers-1); |
|
524 |
float height= tmp*COS18; |
|
525 |
float width = tmp + (variant-1)*tmp*SIN18; |
|
526 |
float D = height/COS18; |
|
527 |
float W = D*SIN18; |
|
528 |
float X1 = height/2; |
|
529 |
float Y1 = width/2; |
|
530 |
float[] vertices = { -X1,-Y1, X1, -Y1, X1, Y1+W,-X1, Y1 }; |
|
531 |
|
|
532 |
FactorySticker factory = FactorySticker.getInstance(); |
|
533 |
factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%COLORS], R); |
|
534 |
} |
|
501 | 535 |
} |
502 | 536 |
|
503 | 537 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Any size Kilominx: finished