commit db3b12e654a41bea2b49850d5e943cb8011a96dd
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Oct 19 17:30:27 2020 +0100

    Progress with the Ivy.

diff --git a/src/main/java/org/distorted/objects/FactoryCubit.java b/src/main/java/org/distorted/objects/FactoryCubit.java
index eebc7f8b..84956262 100644
--- a/src/main/java/org/distorted/objects/FactoryCubit.java
+++ b/src/main/java/org/distorted/objects/FactoryCubit.java
@@ -39,7 +39,7 @@ class FactoryCubit
   private static final float SQ3 = (float)Math.sqrt(3);
   private static final float SQ6 = (float)Math.sqrt(6);
 
-  private static final float IVY_D = 0.10f;
+  private static final float IVY_D = 0.12f;
   private static final int   IVY_N = 8;
 
   private static final Static1D RADIUS = new Static1D(1);
@@ -502,7 +502,48 @@ class FactoryCubit
 
   MeshBase createFacesIvyCorner()
     {
-    return createFacesSkewbCorner();
+    MeshBase[] meshes = new MeshBase[6];
+
+    final float angle = (float)Math.PI/(2*IVY_N);
+    final float CORR  = 1.0f - IVY_D*SQ2;
+    final float DIST  = 0.4f;
+    final float CORR2 = 0.5f;
+    float[] vertices = new float[2*(IVY_N+1)+6];
+
+    vertices[0] = ( 0.5f      -DIST)*CORR2;
+    vertices[1] = (-0.5f+IVY_D-DIST)*CORR2;
+    vertices[2] = ( 0.5f      -DIST)*CORR2;
+    vertices[3] = ( 0.5f      -DIST)*CORR2;
+    vertices[4] = (-0.5f+IVY_D-DIST)*CORR2;
+    vertices[5] = ( 0.5f      -DIST)*CORR2;
+
+    for(int i=0; i<=IVY_N; i++)
+      {
+      float ang = (IVY_N-i)*angle;
+      float sin = (float)Math.sin(ang);
+      float cos = (float)Math.cos(ang);
+
+      vertices[2*i+6] = (CORR*(cos-0.5f)-DIST)*CORR2;
+      vertices[2*i+7] = (CORR*(sin-0.5f)-DIST)*CORR2;
+      }
+
+    float[] bands0 = computeBands(+0.02f,18,0.2f,0.5f,5);
+    float[] bands1 = computeBands(-0.10f,20,0.2f,0.0f,2);
+
+    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
+    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(vertices,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);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -942,7 +983,28 @@ class FactoryCubit
 
   VertexEffect[] createVertexEffectsIvyCorner()
     {
-    return createVertexEffectsSkewbCorner();
+    float DIST=0.1f;
+
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static1D angle1 = new Static1D(+90);
+    Static1D angle2 = new Static1D(-90);
+    Static3D center = new Static3D(0,0,0);
+    Static3D move1  = new Static3D(-DIST,-DIST,0);
+
+    VertexEffect[] effect = new VertexEffect[5];
+
+    effect[0] = new VertexEffectScale(2.0f);
+    effect[1] = new VertexEffectMove(move1);
+    effect[2] = new VertexEffectScale(new Static3D(1,1,-1));
+    effect[3] = new VertexEffectRotate(angle1,axisX,center);
+    effect[4] = new VertexEffectRotate(angle2,axisY,center);
+
+    effect[2].setMeshAssociation(54,-1);  // meshes 1,2,4,5
+    effect[3].setMeshAssociation(18,-1);  // meshes 1,4
+    effect[4].setMeshAssociation(36,-1);  // meshes 2,5
+
+    return effect;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1207,10 +1269,11 @@ class FactoryCubit
 
     Static3D center = new Static3D(-0.5f,-0.5f,-0.5f);
     Static3D[] vertices = new Static3D[4];
+    float DIST = IVY_D-0.5f;
     vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f);
-    vertices[1] = new Static3D(-0.5f,+0.5f,+0.5f);
-    vertices[2] = new Static3D(+0.5f,+0.5f,-0.5f);
-    vertices[3] = new Static3D(+0.5f,-0.5f,+0.5f);
+    vertices[1] = new Static3D( DIST,+0.5f,+0.5f);
+    vertices[2] = new Static3D(+0.5f, DIST,+0.5f);
+    vertices[3] = new Static3D(+0.5f,+0.5f, DIST);
 
     roundCorners(mesh,center,vertices,0.06f,0.12f);
 
