Project

General

Profile

« Previous | Next » 

Revision 47447d4a

Added by Leszek Koltunski over 3 years ago

Use a trick to avoid having to correct the center sticker of the Kilominx.

View differences:

src/main/java/org/distorted/objects/TwistyKilominx.java
60 60

  
61 61
  private static final float CENTER_CORR = 0.87f;
62 62

  
63
  private static final float C = 1.14f; // make the 'center' sticker artificially larger, so that we paint
64
                                        // over the area in the center of the face.
65

  
63 66
  private static final float[][] STICKERS = new float[][]
64 67
      {
65
        { -0.36616942f, -0.36327124f, 0.5f, -0.36327124f, 0.23233888f, 0.4605048f, -0.36616942f, 0.26603764f },
68
        { C*-0.36616942f, C*-0.36327124f, C*0.5f, C*-0.36327124f, C*0.23233888f, C*0.4605048f, C*-0.36616942f, C*0.26603764f },
66 69
        { -0.36327127f, -0.5f, 0.36327127f, -0.26393202f, 0.36327127f, 0.5f, -0.36327127f, 0.26393202f },
67 70
        { -0.3249197f, -0.39442718f, 0.3249197f, -0.39442718f, 0.3249197f, 0.5f, -0.3249197f, 0.2888544f }
68 71
      };
......
641 644
    if( variant == (numLayers-1)/2 || numLayers==3 ) // center
642 645
      {
643 646
      float R = 0.10f;
644
      float S = 0.09f;
647
      float S = 0.20f;
645 648
      float[] RS = new float[] {R,R,R,R};
646
      float cx = STICKERS[0][2]/CENTER_CORR;
647
      float cy = STICKERS[0][3]/CENTER_CORR;
648 649

  
649 650
      FactorySticker factory = FactorySticker.getInstance();
650 651
      factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], null, S, FACE_COLORS[face%NUM_FACES], RS);
651
      canvas.drawCircle(left+(0.5f+cx)*TEXTURE_HEIGHT, top+(0.5f-cy)*TEXTURE_HEIGHT, 0.05f*TEXTURE_HEIGHT, paint);
652 652
      }
653 653
    else if( variant==0 ) // corner
654 654
      {

Also available in: Unified diff