commit fe032f5204e76e82695c640e041b04fc2d73bb48
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Dec 28 23:53:45 2020 +0100

    New shape: Kilominx corner.

diff --git a/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java b/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java
index 58d5afd..5f3e5a1 100644
--- a/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java
+++ b/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java
@@ -37,6 +37,7 @@ class FactoryCubit
   {
   private static final float SQ2 = (float)Math.sqrt(2);
   private static final float SQ3 = (float)Math.sqrt(3);
+  private static final float SQ5 = (float)Math.sqrt(5);
   private static final float SQ6 = (float)Math.sqrt(6);
 
   private static final float IVY_D = 0.003f;
@@ -46,6 +47,12 @@ class FactoryCubit
   private static final float REX_D = 0.2f;
   private static final int   REX_N = 5;
 
+  static final float MINX_C0 = (SQ5-1)/4;
+  static final float MINX_C1 = (SQ5+1)/4;                         // sin(54 deg)
+  static final float MINX_C3 = (float)(Math.sqrt(10-2*SQ5)/4);    // cos(54 deg)
+  static final float MINX_C4 = (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle)
+  static final float MINX_C5 = (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle)
+
   private static final Static1D RADIUS = new Static1D(1);
 
   private static FactoryCubit mThis;
@@ -725,6 +732,41 @@ class FactoryCubit
     return new MeshJoined(meshes);
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesMinxCorner()
+    {
+    MeshBase[] meshes = new MeshPolygon[6];
+
+    float X1= (SQ5+1)/8;
+    float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
+    float Y2= Y1 - (float)(Math.sqrt(10-2*SQ5)/8);
+    float H = 0.5f*MINX_C1/MINX_C3;
+    float X2= H*MINX_C5;
+    float Y3= H/(2*MINX_C4);
+    float Y4= H*(1/(2*MINX_C4) - MINX_C4);
+
+    float[] vertices0 = { -X1, Y2, 0, -Y1, X1, Y2, 0, Y1 };
+    float[] bands0 = computeBands(0.03f,39,0.3f,0.2f,5);
+    float[] vertices1 = { -X2, Y4, 0, -Y3, X2, Y4, 0, Y3 };
+    float[] bands1 = computeBands(0.00f,27,0.25f,0.5f,2);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1);
+    meshes[0].setEffectAssociation(0, 1,0);
+    meshes[1] = meshes[0].copy(true);
+    meshes[1].setEffectAssociation(0, 2,0);
+    meshes[2] = meshes[0].copy(true);
+    meshes[2].setEffectAssociation(0, 4,0);
+    meshes[3] = new MeshPolygon(vertices1, bands1, 0, 0);
+    meshes[3].setEffectAssociation(0, 8,0);
+    meshes[4] = meshes[3].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
+    meshes[5] = meshes[3].copy(true);
+    meshes[5].setEffectAssociation(0,32,0);
+
+    return new MeshJoined(meshes);
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // EFFECTS
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1222,6 +1264,59 @@ class FactoryCubit
     return effect;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsMinxCorner()
+    {
+    VertexEffect[] effect = new VertexEffect[9];
+
+    float H = 0.5f*(MINX_C1/MINX_C3);
+    float Y1= (float)(Math.sqrt(2+0.4f*SQ5)/4);
+    float Y2= H/(2*MINX_C4);
+    float A = (float)(Math.acos(-SQ5/5)*180/Math.PI);  // dihedral angle of a dedecahedron in degrees
+    float sin18 = MINX_C0;
+    float cos18 = (float)(Math.sqrt(1-MINX_C0*MINX_C0));
+    float LEN   = (float)Math.sqrt(H*H/(MINX_C4*MINX_C4) + 0.25f);
+
+    Static3D axisZ = new Static3D(0.0f  , 0.0f , 1.0f);
+    Static3D axisY = new Static3D(0.0f  , 1.0f , 0.0f);
+    Static3D axisA = new Static3D(-sin18, cos18, 0.0f);
+    Static3D axisC = new Static3D( H/LEN, -0.5f/LEN,-H*MINX_C5/(MINX_C4*LEN));
+
+    Static3D move1 = new Static3D(0,-Y1,0);
+    Static3D move2 = new Static3D(0,-Y2,0);
+    Static3D move3 = new Static3D(0.5f*cos18,0.5f*sin18,0);
+    Static3D center= new Static3D(0.0f, 0.0f, 0.0f);
+
+    Static1D angle1 = new Static1D(54);
+    Static1D angle2 = new Static1D(A/2+18);
+    Static1D angle3 = new Static1D(90);
+    Static1D angle4 = new Static1D(120);
+    Static1D angle5 = new Static1D(240);
+    Static1D angle6 = new Static1D(90-A/2);
+
+    effect[0] = new VertexEffectMove(move1);
+    effect[1] = new VertexEffectMove(move2);
+    effect[2] = new VertexEffectRotate(angle1, axisZ, center);
+    effect[3] = new VertexEffectRotate(angle2, axisZ, center);
+    effect[4] = new VertexEffectRotate(angle3, axisA, center);
+    effect[5] = new VertexEffectMove(move3);
+    effect[6] = new VertexEffectRotate(angle4, axisC, center);
+    effect[7] = new VertexEffectRotate(angle5, axisC, center);
+    effect[8] = new VertexEffectRotate(angle6, axisY, center);
+
+    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
+    effect[1].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[2].setMeshAssociation( 7,-1);  // meshes 0,1,2
+    effect[3].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[6].setMeshAssociation(18,-1);  // meshes 1,4
+    effect[7].setMeshAssociation(36,-1);  // meshes 2,5
+
+    return effect;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // OBJECTS
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1558,15 +1653,34 @@ class FactoryCubit
     MeshBase mesh = createFacesRexEdge();
     VertexEffect[] effects = createVertexEffectsRexEdge();
     for( VertexEffect effect : effects ) mesh.apply(effect);
-/*
+
     Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
     Static3D[] vertices = new Static3D[2];
     vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
     vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
-    roundCorners(mesh,center,vertices,0.03f,0.10f);
+    roundCorners(mesh,center,vertices,0.06f,0.10f);
 
     mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createMinxCornerMesh()
+    {
+    MeshBase mesh = createFacesMinxCorner();
+    VertexEffect[] effects = createVertexEffectsMinxCorner();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+/*
+    Static3D center = new Static3D(0.0f,-0.5f,-0.5f);
+    Static3D[] vertices = new Static3D[2];
+    vertices[0] = new Static3D(+0.5f,+0.0f,+0.0f);
+    vertices[1] = new Static3D(-0.5f,+0.0f,+0.0f);
+    roundCorners(mesh,center,vertices,0.06f,0.10f);
 */
+    //mesh.mergeEffComponents();
+
     return mesh;
     }
   }
diff --git a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
index 65a58d2..76ef874 100644
--- a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
+++ b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
@@ -85,7 +85,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
       mCurrentScale = DEFAULT_SCALE;
 
       mQuat1 = new Static4D(0,0,0,1);
-      mQuat2 = new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);
+      mQuat2 = new Static4D(0,0,0,1);
 
       DynamicQuat quatInt1 = new DynamicQuat(0,0.5f);
       DynamicQuat quatInt2 = new DynamicQuat(0,0.5f);
@@ -331,7 +331,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
     private void createMesh()
       {
       FactoryCubit factory = FactoryCubit.getInstance();
-      mMesh = factory.createRexEdgeMesh();
+      mMesh = factory.createMinxCornerMesh();
 
       //mMesh = createStaticMesh();
 
