Project

General

Profile

« Previous | Next » 

Revision ed01e351

Added by Leszek Koltunski almost 4 years ago

Progress with Megaminx.

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
773 773
    float[] vertices1 = { -X1, Y3, -X1, -Y3, X1, -Y2, X1, Y2 };
774 774
    float[] vertices2 = { -X2, 0.0f, 0.0f, -Y4, X2, 0.0f, 0.0f, Y4 };
775 775

  
776
    float[] bands0 = computeBands(0.04f,34,  X1,0.2f,5);
776
    float[] bands0 = computeBands(0.03f,34,0.2f,0.2f,5);
777 777
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,2);
778 778

  
779 779
    meshes[0] = new MeshPolygon(vertices0, bands0, 0, 0);
......
798 798
    {
799 799
    MeshBase[] meshes = new MeshPolygon[2];
800 800

  
801
    float R  = width/(2*COS54);
802

  
803
    float X1 = width/2;
801
    float R  = 0.5f;
802
    float X1 = R*COS54;
804 803
    float Y1 = R*SIN54;
805 804
    float X2 = R*COS18;
806 805
    float Y2 = R*SIN18;
......
1478 1477

  
1479 1478
///////////////////////////////////////////////////////////////////////////////////////////////////
1480 1479

  
1481
  VertexEffect[] createVertexEffectsMegaminxCenter()
1480
  VertexEffect[] createVertexEffectsMegaminxCenter(float width)
1482 1481
    {
1483
    VertexEffect[] effect = new VertexEffect[1];
1482
    VertexEffect[] effect = new VertexEffect[2];
1484 1483

  
1485 1484
    Static1D angle = new Static1D(DIHEDRAL2);
1486 1485
    Static3D axisX = new Static3D( 1.0f, 0.0f, 0.0f);
1487 1486
    Static3D center= new Static3D( 0, 0, 0);
1488 1487

  
1489
    effect[0] = new VertexEffectRotate(angle, axisX, center);
1488
    effect[0] = new VertexEffectScale(width/COS54);
1489
    effect[1] = new VertexEffectRotate(angle, axisX, center);
1490 1490

  
1491 1491
    return effect;
1492 1492
    }
......
1923 1923
  MeshBase createMegaminxCenterMesh(float width)
1924 1924
    {
1925 1925
    MeshBase mesh = createFacesMegaminxCenter(width);
1926
    VertexEffect[] effects = createVertexEffectsMegaminxCenter();
1926
    VertexEffect[] effects = createVertexEffectsMegaminxCenter(width);
1927 1927
    for( VertexEffect effect : effects ) mesh.apply(effect);
1928 1928

  
1929 1929
    mesh.mergeEffComponents();
src/main/java/org/distorted/objects/TwistyMegaminx.java
544 544
        }
545 545
      else
546 546
        {
547
        float Z = width/(2*COS54);
548
        float X1 = 0.5f*width;
547
        float Z  = 0.5f;
548
        float X1 = Z*COS54;
549 549
        float Y1 = Z*SIN54;
550 550
        float X2 = Z*COS18;
551 551
        float Y2 = Z*SIN18;
552 552

  
553
        R = 0.05f;
554
        S = 0.05f;
553
        R = 0.10f;
554
        S = 0.06f;
555 555
        vertices = new float[] { -X1,+Y1, -X2,-Y2, 0.0f,-Z, +X2,-Y2, +X1,+Y1 };
556 556
        }
557 557
      }

Also available in: Unified diff