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

    Progress with the Ivy.

diff --git a/src/main/java/org/distorted/examples/meshfile/CubitFactory.java b/src/main/java/org/distorted/examples/meshfile/CubitFactory.java
deleted file mode 100644
index 3dbffda..0000000
--- a/src/main/java/org/distorted/examples/meshfile/CubitFactory.java
+++ /dev/null
@@ -1,1161 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2020 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Magic Cube.                                                              //
-//                                                                                               //
-// Magic Cube is free software: you can redistribute it and/or modify                            //
-// it under the terms of the GNU General Public License as published by                          //
-// the Free Software Foundation, either version 2 of the License, or                             //
-// (at your option) any later version.                                                           //
-//                                                                                               //
-// Magic Cube is distributed in the hope that it will be useful,                                 //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
-// GNU General Public License for more details.                                                  //
-//                                                                                               //
-// You should have received a copy of the GNU General Public License                             //
-// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.distorted.examples.meshfile;
-
-import org.distorted.library.effect.VertexEffect;
-import org.distorted.library.effect.VertexEffectDeform;
-import org.distorted.library.effect.VertexEffectMove;
-import org.distorted.library.effect.VertexEffectRotate;
-import org.distorted.library.effect.VertexEffectScale;
-import org.distorted.library.mesh.MeshBase;
-import org.distorted.library.mesh.MeshJoined;
-import org.distorted.library.mesh.MeshPolygon;
-import org.distorted.library.type.Static1D;
-import org.distorted.library.type.Static3D;
-import org.distorted.library.type.Static4D;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class CubitFactory
-  {
-  private static final float SQ2 = (float)Math.sqrt(2);
-  private static final float SQ3 = (float)Math.sqrt(3);
-  private static final float SQ6 = (float)Math.sqrt(6);
-
-  private static final Static1D RADIUS = new Static1D(1);
-
-  private static CubitFactory mThis;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private CubitFactory()
-    {
-
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static CubitFactory getInstance()
-    {
-    if( mThis==null ) mThis = new CubitFactory();
-
-    return mThis;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// H - height of the band in the middle
-// alpha - angle of the edge  [0,90]
-// dist - often in a polygon the distance from edge to center is not 1, but something else.
-// This is the distance.
-// K - where to begin the second, much more flat part of the band. [0,1]
-// N - number of bands. N>=3
-//
-// theory: two distinct parts to the band:
-// 1) (0,B) - steep
-// 2) (B,1) - flat
-//
-// In first part, we have y = g(x) ; in second - y = g(f(x)) where
-//
-// g(x) = sqrt( R^2 - (x-D)^2 ) - R*cos(alpha)
-// f(x) = ((D-B)/(1-B)*x + B*(1-D)/(1-B)
-// h(x) = R*(sin(alpha) - sin(x))
-// R = H/(1-cos(alpha))
-// D = H*sin(alpha)
-// B = h(K*alpha)
-//
-// The N points are taken at:
-//
-// 1) in the second part, there are K2 = (N-3)/3 such points
-// 2) in the first - K1 = (N-3) - K2
-// 3) also, the 3 points 0,B,1
-//
-// so we have the sequence A[i] of N points
-//
-// 0
-// h((i+1)*(1-K)*alpha/(K1+1)) (i=0,1,...,K1-1)
-// B
-// (1-B)*(i+1)/(K2+1) + B   (i=0,i,...,K2-1)
-// 1
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private float f(float D, float B, float x)
-    {
-    return ((D-B)*x + B*(1-D))/(1-B);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private float g(float R, float D, float x, float cosAlpha)
-    {
-    float d = x-D;
-    return (float)(Math.sqrt(R*R-d*d)-R*cosAlpha);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private float h(float R, float sinAlpha, float x)
-    {
-    return R*(sinAlpha-(float)Math.sin(x));
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private float[] computeBands(float H, int alpha, float dist, float K, int N)
-    {
-    float[] bands = new float[2*N];
-
-    bands[0] = 1.0f;
-    bands[1] = 0.0f;
-
-    float beta = (float)Math.atan(dist*Math.tan(Math.PI*alpha/180));
-    float sinBeta = (float)Math.sin(beta);
-    float cosBeta = (float)Math.cos(beta);
-    float R = cosBeta<1.0f ? H/(1.0f-cosBeta) : 0.0f;
-    float D = R*sinBeta;
-    float B = h(R,sinBeta,K*beta);
-
-    if( D>1.0f )
-      {
-      for(int i=1; i<N; i++)
-        {
-        bands[2*i  ] = (float)(N-1-i)/(N-1);
-        bands[2*i+1] = H*(1-bands[2*i]);
-        }
-      }
-    else
-      {
-      int K2 = (N-3)/3;
-      int K1 = (N-3)-K2;
-
-      for(int i=0; i<=K1; i++)
-        {
-        float angle = K*beta + (1-K)*beta*(K1-i)/(K1+1);
-        float x = h(R,sinBeta,angle);
-        bands[2*i+2] = 1.0f - x;
-        bands[2*i+3] = g(R,D,x,cosBeta);
-        }
-
-      for(int i=0; i<=K2; i++)
-        {
-        float x = (1-B)*(i+1)/(K2+1) + B;
-        bands[2*K1+2 + 2*i+2] = 1.0f - x;
-        bands[2*K1+2 + 2*i+3] = g(R,D,f(D,B,x),cosBeta);
-        }
-      }
-
-    return bands;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void roundCorners(MeshBase mesh, Static3D center, Static3D[] vertices, float strength, float regionRadius)
-    {
-    Static4D reg= new Static4D(0,0,0,regionRadius);
-
-    float centX = center.get0();
-    float centY = center.get1();
-    float centZ = center.get2();
-
-    for (Static3D vertex : vertices)
-      {
-      float x = strength*(centX - vertex.get0());
-      float y = strength*(centY - vertex.get1());
-      float z = strength*(centZ - vertex.get2());
-
-      VertexEffect effect = new VertexEffectDeform(new Static3D(x,y,z), RADIUS, vertex, reg);
-      mesh.apply(effect);
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesCube(int index)
-    {
-    final int MESHES=6;
-    MeshBase[] meshes = new MeshPolygon[MESHES];
-    int association = 1;
-
-    float[] bands;
-    float D = 0.027f;
-    float E = 0.5f-D;
-    float[] vertices = { -E,-E, +E,-E, +E,+E, -E,+E };
-    int extraI, extraV;
-
-    switch(index)
-      {
-      case 0 : bands = new float[] { 1.0f    ,-D,
-                                     1.0f-D/2,-D*0.55f,
-                                     1.0f-D  ,-D*0.25f,
-                                     1.0f-2*D, 0.0f,
-                                     0.50f   , 0.040f,
-                                     0.0f    , 0.048f };
-               extraI = 2;
-               extraV = 2;
-               break;
-      case 1 : bands = new float[] { 1.0f       ,-D,
-                                     1.0f-D*1.2f,-D*0.55f,
-                                     1.0f-2*D   , 0.0f,
-                                     0.50f      , 0.040f,
-                                     0.0f       , 0.048f };
-               extraI = 2;
-               extraV = 2;
-               break;
-      case 2 : bands = new float[] { 1.0f       ,-D,
-                                     1.0f-D*1.2f,-D*0.55f,
-                                     1.0f-2*D   , 0.0f,
-                                     0.50f      , 0.040f,
-                                     0.0f       , 0.048f };
-               extraI = 1;
-               extraV = 2;
-               break;
-      default: bands = new float[] { 1.0f    ,-D,
-                                     1.0f-2*D, 0.0f,
-                                     0.50f   , 0.025f,
-                                     0.0f    , 0.030f };
-               extraI = 1;
-               extraV = 1;
-               break;
-      }
-
-    meshes[0] = new MeshPolygon(vertices,bands,extraI,extraV);
-    meshes[0].setEffectAssociation(0,association,0);
-
-    for(int i=1; i<MESHES; i++)
-      {
-      association <<=1;
-      meshes[i] = meshes[0].copy(true);
-      meshes[i].setEffectAssociation(0,association,0);
-      }
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesSkewbCorner()
-    {
-    MeshBase[] meshes = new MeshBase[6];
-
-    float E = 0.5f;
-    float F = SQ2/2;
-    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
-    float[] bands0 = computeBands(0.03f,30,E/3,0.5f,7);
-
-    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
-    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);
-
-    float[] vertices1 = { 0,0, F,0, 7*F/8,(SQ3/8)*F, 5*F/8,(3*SQ3/8)*F, F/2,(SQ3/2)*F };
-    float[] bands1 = computeBands(0,0,1,0,3);
-
-    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
-    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);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesSkewbFace()
-    {
-    MeshBase[] meshes = new MeshBase[5];
-
-    float E = SQ2/4;
-    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
-    float[] bands0 = computeBands(0.05f,30,E/2,0.5f,7);
-
-    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
-    meshes[0].setEffectAssociation(0,1,0);
-
-    float[] vertices1 = { -E,-SQ3*E, -E*0.7f,-SQ3*E, +E*0.7f,-SQ3*E, +E,-SQ3*E, 0,0 };
-    float[] bands1 = computeBands(0,0,1,0,3);
-
-    meshes[1] = new MeshPolygon(vertices1,bands1,0,0);
-    meshes[1].setEffectAssociation(0,2,0);
-    meshes[2] = meshes[1].copy(true);
-    meshes[2].setEffectAssociation(0,4,0);
-    meshes[3] = meshes[1].copy(true);
-    meshes[3].setEffectAssociation(0,8,0);
-    meshes[4] = meshes[1].copy(true);
-    meshes[4].setEffectAssociation(0,16,0);
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesOcta()
-    {
-    int association = 1;
-
-    float C = 0.06f;
-    float D = 0.031f;
-    float E = SQ3/2;
-    float F = 0.5f;
-
-    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
-
-    float[] bands = new float[] { 1.0f    , 0,
-                                  1.0f  -C, D*0.55f,
-                                  1.0f-2*C, D*0.85f,
-                                  1.0f-4*C, D*1.20f,
-                                  0.5f    , D*1.40f,
-                                  0.0f    , D*1.50f };
-
-    MeshBase[] meshes = new MeshPolygon[8];
-    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
-    meshes[0].setEffectAssociation(0,association,0);
-
-    for(int i=1; i<8; i++)
-      {
-      association <<= 1;
-      meshes[i] = meshes[0].copy(true);
-      meshes[i].setEffectAssociation(0,association,0);
-      }
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesTetra()
-    {
-    MeshBase[] meshes = new MeshBase[4];
-    int association = 1;
-
-    float C = 0.06f;
-    float D = 0.035f;
-    float E = SQ3/2;
-    float F = 0.5f;
-
-    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
-
-    float[] bands = new float[] { 1.0f    , 0,
-                                  1.0f  -C, D*0.50f,
-                                  1.0f-2*C, D*0.80f,
-                                  1.0f-4*C, D*1.10f,
-                                  0.5f    , D*1.30f,
-                                  0.0f    , D*1.35f };
-
-    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
-    meshes[0].setEffectAssociation(0,association,0);
-
-    for(int i=1; i<4; i++)
-      {
-      association <<= 1;
-      meshes[i] = meshes[0].copy(true);
-      meshes[i].setEffectAssociation(0,association,0);
-      }
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesDino()
-    {
-    final int MESHES=4;
-    MeshBase[] meshes = new MeshPolygon[MESHES];
-
-    float E = 0.5f*SQ2;
-    float F = 0.5f;
-    float[] vertices0 = { -F,F/3, 0,-2*F/3, +F,F/3 };
-    float[] bands0 = computeBands(0.03f,45,F/3,0.2f,7);
-
-    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 5);
-    meshes[0].setEffectAssociation(0,1,0);
-    meshes[1] = meshes[0].copy(true);
-    meshes[1].setEffectAssociation(0,2,0);
-
-    float[] vertices1 = { -E/2,-E*(SQ3/6), E/2,-E*(SQ3/6), 0,E*(SQ3/3) };
-    float[] bands1 = computeBands(0.02f,45,F/3,0.2f,3);
-
-    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
-    meshes[2].setEffectAssociation(0,4,0);
-    meshes[3] = meshes[2].copy(true);
-    meshes[3].setEffectAssociation(0,8,0);
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesHelicopterCorner()
-    {
-    MeshBase[] meshes = new MeshBase[6];
-
-    float E = 0.5f;
-    float F = SQ2/4;
-    float G = 1.0f/12;
-    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
-    float[] bands0 = computeBands(0.03f,45,E/4,0.2f,7);
-
-    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
-    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);
-
-    float[] vertices1 = { -F,-G, 0,-G, +F,-G, 0,2*G };
-    float[] bands1 = computeBands(0.00f,0,0,0.0f,3);
-    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
-    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);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesHelicopterFace()
-    {
-    MeshBase[] meshes = new MeshBase[4];
-
-    float E = 0.5f;
-    float F = SQ2/4;
-    float G = 1.0f/12;
-    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
-    float[] bands0 = computeBands(0.03f,45,E/4,0.1f,7);
-
-    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
-    meshes[0].setEffectAssociation(0,1,0);
-
-    float[] vertices1 = { -F,-G, +F,-G, 0,2*G};
-    float[] bands1 = computeBands(0.01f,45,F,0.0f,3);
-
-    meshes[1] = new MeshPolygon(vertices1, bands1, 1, 3);
-    meshes[1].setEffectAssociation(0,2,0);
-
-    float[] vertices2 = { -E/2,-F/3, +E/2,-F/3, 0,2*F/3};
-
-    meshes[2] = new MeshPolygon(vertices2, bands1, 1, 3);
-    meshes[2].setEffectAssociation(0,4,0);
-    meshes[3] = meshes[2].copy(true);
-    meshes[3].setEffectAssociation(0,8,0);
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesRediEdge()
-    {
-    final int MESHES=6;
-    float F = 0.25f;
-
-    float[] bands0 = computeBands(0.03f,45,F,0.2f,7);
-    float[] vertices0 = { -F,+F, -F,-F, 0, -2*F, +F,-F, +F,+F };
-
-    MeshBase[] meshes = new MeshPolygon[MESHES];
-    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 2);
-    meshes[0].setEffectAssociation(0,1,0);
-    meshes[1] = meshes[0].copy(true);
-    meshes[1].setEffectAssociation(0,2,0);
-
-    float[] bands1 = computeBands(0.02f,45,F/2,0.2f,3);
-    float[] vertices1 = { -F/2, +F/2, -F/2, -1.5f*F, 1.5f*F, +F/2 };
-
-    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
-    meshes[2].setEffectAssociation(0,4,0);
-    meshes[3] = meshes[2].copy(true);
-    meshes[3].setEffectAssociation(0,8,0);
-
-    float X = 0.25f*SQ2;
-    float Y = SQ6/16;
-    float[] vertices2 = { -X, Y, -1.5f*X, -Y, +1.5f*X, -Y, +X, Y };
-
-    meshes[4] = new MeshPolygon(vertices2, bands1, 1, 1);
-    meshes[4].setEffectAssociation(0,16,0);
-    meshes[5] = meshes[4].copy(true);
-    meshes[5].setEffectAssociation(0,32,0);
-
-    return new MeshJoined(meshes);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createFacesRediCorner()
-    {
-    final int MESHES=6;
-    MeshBase[] meshes = new MeshBase[MESHES];
-
-    float E = 0.5f;
-    float[] vertices1 = { -E,-E, +E,-E, +E,+E, -E,+E };
-    float[] bands1 = computeBands(0.04f,45,E,0.3f,6);
-
-    meshes[0] = new MeshPolygon(vertices1,bands1,2,2);
-    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);
-
-    float F = SQ2/2;
-    float X = 0.5f;
-    float G = 0.72f;
-    float[] vertices2 = { -E,+F, -E+X,0, -E,-F, -E*G,-F, +E*G,-F, +E,-F, +E-X,0, +E,+F, +E*G,+F, -E*G,+F };
-    float[] bands2 = computeBands(0.0f,0,1.0f,0.0f,2);
-
-    meshes[3] = new MeshPolygon(vertices2,bands2,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);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsCube()
-    {
-    Static3D axisY   = new Static3D(0,1,0);
-    Static3D axisX   = new Static3D(1,0,0);
-    Static3D center  = new Static3D(0,0,0);
-    Static1D angle90 = new Static1D(90);
-    Static1D angle180= new Static1D(180);
-    Static1D angle270= new Static1D(270);
-
-    VertexEffect[] effect = new VertexEffect[6];
-
-    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
-    effect[1] = new VertexEffectRotate( angle180, axisX, center );
-    effect[2] = new VertexEffectRotate( angle90 , axisX, center );
-    effect[3] = new VertexEffectRotate( angle270, axisX, center );
-    effect[4] = new VertexEffectRotate( angle270, axisY, center );
-    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
-
-    effect[0].setMeshAssociation(63,-1);  // all 6 sides
-    effect[1].setMeshAssociation(32,-1);  // back
-    effect[2].setMeshAssociation( 8,-1);  // bottom
-    effect[3].setMeshAssociation( 4,-1);  // top
-    effect[4].setMeshAssociation( 2,-1);  // left
-    effect[5].setMeshAssociation( 1,-1);  // right
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsSkewbCorner()
-    {
-    float E = 0.5f;
-
-    Static3D axisX  = new Static3D(1,0,0);
-    Static3D axisY  = new Static3D(0,1,0);
-    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
-    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
-    Static1D angle1 = new Static1D(+90);
-    Static1D angle2 = new Static1D(-90);
-    Static1D angle3 = new Static1D(-15);
-    Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3)));
-    Static1D angle5 = new Static1D(120);
-    Static1D angle6 = new Static1D(240);
-    Static3D center1= new Static3D(0,0,0);
-    Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f);
-    Static3D move1  = new Static3D(-E/4,-E/4,0);
-    Static3D move2  = new Static3D(-0.5f,-0.5f,-0.5f);
-
-    VertexEffect[] effect = new VertexEffect[10];
-
-    effect[0] = new VertexEffectMove(move1);
-    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
-    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
-    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
-    effect[4] = new VertexEffectMove(move2);
-    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
-    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
-    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
-    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
-    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
-
-    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
-    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
-    effect[2].setMeshAssociation( 2,-1);  // mesh 1
-    effect[3].setMeshAssociation( 4,-1);  // mesh 2
-    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[8].setMeshAssociation(16,-1);  // mesh 4
-    effect[9].setMeshAssociation(32,-1);  // mesh 5
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsSkewbFace()
-    {
-    Static3D center = new Static3D(0,0,0);
-    Static3D axisX  = new Static3D(1,0,0);
-    Static3D axisZ  = new Static3D(0,0,1);
-    float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3));
-
-    VertexEffect[] effect = new VertexEffect[6];
-
-    effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center);
-    effect[1] = new VertexEffectRotate( new Static1D(  135), axisZ, center);
-    effect[2] = new VertexEffectRotate( new Static1D(   45), axisZ, center);
-    effect[3] = new VertexEffectRotate( new Static1D(  -45), axisZ, center);
-    effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center);
-    effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) );
-
-    effect[0].setMeshAssociation(30,-1);  // meshes 1,2,3,4
-    effect[1].setMeshAssociation( 2,-1);  // mesh 1
-    effect[2].setMeshAssociation( 5,-1);  // meshes 0,2
-    effect[3].setMeshAssociation( 8,-1);  // mesh 3
-    effect[4].setMeshAssociation(16,-1);  // mesh 4
-    effect[5].setMeshAssociation(30,-1);  // meshes 1,2,3,4
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsOcta()
-    {
-    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
-    Static1D angle1= new Static1D( 90);
-    Static1D angle2= new Static1D(180);
-    Static1D angle3= new Static1D(270);
-    Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0);
-    Static3D axisX = new Static3D(1,0,0);
-    Static3D axisY = new Static3D(0,1,0);
-    Static3D cent0 = new Static3D(0,0,0);
-    Static3D cent1 = new Static3D(0,SQ2/2,0);
-    Static3D flipY = new Static3D( 1,-1, 1);
-
-    VertexEffect[] effect = new VertexEffect[6];
-
-    effect[0] = new VertexEffectMove(move1);
-    effect[1] = new VertexEffectRotate(alpha , axisX, cent1);
-    effect[2] = new VertexEffectRotate(angle1, axisY, cent0);
-    effect[3] = new VertexEffectRotate(angle2, axisY, cent0);
-    effect[4] = new VertexEffectRotate(angle3, axisY, cent0);
-    effect[5] = new VertexEffectScale(flipY);
-
-    effect[2].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5
-    effect[3].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6
-    effect[4].setMeshAssociation (136,-1); // apply to meshes 3 & 7
-    effect[5].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsTetra()
-    {
-    Static3D flipZ = new Static3D( 1, 1,-1);
-
-    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
-    Static1D angle1= new Static1D( 90);
-    Static1D angle2= new Static1D(180);
-    Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0);
-
-    Static3D axisX = new Static3D(1,0,0);
-    Static3D axisY = new Static3D(0,1,0);
-    Static3D axisZ = new Static3D(0,0,1);
-
-    Static3D cent0 = new Static3D(0,0,0);
-    Static3D cent1 = new Static3D(0,SQ2/4,0);
-
-    VertexEffect[] effect = new VertexEffect[6];
-
-    effect[0] = new VertexEffectRotate(angle2, axisZ, cent0);
-    effect[1] = new VertexEffectMove(move1);
-    effect[2] = new VertexEffectRotate(alpha , axisX, cent1);
-    effect[3] = new VertexEffectScale(flipZ);
-    effect[4] = new VertexEffectRotate(angle1, axisY, cent0);
-    effect[5] = new VertexEffectRotate(angle2, axisZ, cent0);
-
-    effect[0].setMeshAssociation(15,-1); // meshes 0,1,2,3
-    effect[1].setMeshAssociation(15,-1); // meshes 0,1,2,3
-    effect[2].setMeshAssociation(15,-1); // meshes 0,1,2,3
-    effect[3].setMeshAssociation(10,-1); // meshes 1 & 3
-    effect[4].setMeshAssociation(12,-1); // meshes 2 & 3
-    effect[5].setMeshAssociation(12,-1); // meshes 2 & 3
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsDino()
-    {
-    float E = 0.5f*SQ2;
-    float F = 0.5f;
-    final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2)));
-
-    Static1D angle1 = new Static1D(-ANGLE);
-    Static1D angle2 = new Static1D(+ANGLE);
-    Static3D axisX  = new Static3D(1,0,0);
-    Static3D axisY  = new Static3D(0,1,0);
-    Static3D axisZ  = new Static3D(0,-1,1);
-    Static3D center0= new Static3D(0,0,0);
-    Static3D center1= new Static3D(0,-3*F,0);
-
-    VertexEffect[] effect = new VertexEffect[10];
-
-    effect[0] = new VertexEffectScale ( new Static3D(3,3,3) );
-    effect[1] = new VertexEffectMove  ( new Static3D(0,-F,0) );
-    effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 );
-    effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) );
-    effect[4] = new VertexEffectMove  ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) );
-    effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 );
-    effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) );
-    effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 );
-    effect[8] = new VertexEffectRotate( angle1           , axisZ, center1 );
-    effect[9] = new VertexEffectRotate( angle2           , axisZ, center1 );
-
-    effect[0].setMeshAssociation(15,-1);  // apply to meshes 0,1,2,3
-    effect[1].setMeshAssociation( 3,-1);  // apply to meshes 0,1
-    effect[2].setMeshAssociation( 2,-1);  // apply to mesh 1
-    effect[3].setMeshAssociation( 2,-1);  // apply to mesh 0
-    effect[4].setMeshAssociation(12,-1);  // apply to meshes 2,3
-    effect[5].setMeshAssociation(12,-1);  // apply to meshes 2,3
-    effect[6].setMeshAssociation( 8,-1);  // apply to mesh 3
-    effect[7].setMeshAssociation(12,-1);  // apply to meshes 2,3
-    effect[8].setMeshAssociation( 4,-1);  // apply to mesh 2
-    effect[9].setMeshAssociation( 8,-1);  // apply to mesh 3
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsHelicopterCorner()
-    {
-    float E = 0.5f;
-
-    Static3D axisX  = new Static3D(1,0,0);
-    Static3D axisY  = new Static3D(0,1,0);
-    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
-    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
-    Static1D angle1 = new Static1D(+90);
-    Static1D angle2 = new Static1D(-90);
-    Static1D angle3 = new Static1D(-135);
-    Static1D angle4 = new Static1D(90);
-    Static1D angle5 = new Static1D(120);
-    Static1D angle6 = new Static1D(240);
-    Static3D center1= new Static3D(0,0,0);
-    Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f);
-    Static3D move1  = new Static3D(-E/4,-E/4,0);
-    Static3D move2  = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f);
-
-    VertexEffect[] effect = new VertexEffect[10];
-
-    effect[0] = new VertexEffectMove(move1);
-    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
-    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
-    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
-    effect[4] = new VertexEffectMove(move2);
-    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
-    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
-    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
-    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
-    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
-
-    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
-    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
-    effect[2].setMeshAssociation( 2,-1);  // mesh 1
-    effect[3].setMeshAssociation( 4,-1);  // mesh 2
-    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
-    effect[8].setMeshAssociation(16,-1);  // mesh 4
-    effect[9].setMeshAssociation(32,-1);  // mesh 5
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsHelicopterFace()
-    {
-    float E = 0.5f;
-    float F = SQ2/4;
-
-    Static3D move0  = new Static3D(-E/4, -E/4, 0);
-    Static3D move1  = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0);
-    Static3D move2  = new Static3D(-E/2, F/3, 0);
-    Static3D move3  = new Static3D(+E/2, F/3, 0);
-    Static3D move4  = new Static3D(+E/3,+E/3, 0);
-    Static1D angle1 = new Static1D(135);
-    Static1D angle2 = new Static1D(90);
-    Static1D angle3 = new Static1D(-90);
-    Static1D angle4 = new Static1D(-135);
-    Static3D axisX  = new Static3D(1,0,0);
-    Static3D axisY  = new Static3D(0,1,0);
-    Static3D axisZ  = new Static3D(0,0,1);
-    Static3D axis1  = new Static3D(1,-1,0);
-    Static3D center = new Static3D(0,0,0);
-    Static3D center1= new Static3D(-E/2,-E/2,0);
-
-    VertexEffect[] effect = new VertexEffect[10];
-
-    effect[0] = new VertexEffectMove(move0);
-    effect[1] = new VertexEffectRotate(angle1, axisZ, center);
-    effect[2] = new VertexEffectMove(move1);
-    effect[3] = new VertexEffectRotate(angle2, axis1, center1);
-    effect[4] = new VertexEffectMove(move2);
-    effect[5] = new VertexEffectMove(move3);
-    effect[6] = new VertexEffectRotate(angle3, axisZ, center);
-    effect[7] = new VertexEffectRotate(angle4, axisX, center);
-    effect[8] = new VertexEffectRotate(angle1, axisY, center);
-    effect[9] = new VertexEffectMove(move4);
-
-    effect[0].setMeshAssociation( 1,-1);  // mesh 0
-    effect[1].setMeshAssociation( 2,-1);  // mesh 1
-    effect[2].setMeshAssociation( 2,-1);  // mesh 1
-    effect[3].setMeshAssociation( 2,-1);  // mesh 1
-    effect[4].setMeshAssociation( 4,-1);  // mesh 2
-    effect[5].setMeshAssociation( 8,-1);  // mesh 3
-    effect[6].setMeshAssociation( 8,-1);  // mesh 3
-    effect[7].setMeshAssociation( 4,-1);  // mesh 2
-    effect[8].setMeshAssociation( 8,-1);  // mesh 3
-    effect[9].setMeshAssociation(15,-1);  // meshes 0,1,2,3
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsRediEdge()
-    {
-    Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f);
-    Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f);
-    Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f);
-    Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8);
-    Static3D flipZ = new Static3D(1,1,-1);
-    Static3D flipX = new Static3D(-1,1,1);
-    Static3D scale = new Static3D(2,2,2);
-    Static3D cent0 = new Static3D(0,0, 0);
-    Static3D cent1 = new Static3D(0,0, -1.5f);
-    Static3D axisX = new Static3D(1,0, 0);
-    Static3D axisY = new Static3D(0,1, 0);
-    Static3D axis  = new Static3D(0,SQ2/2,-SQ2/2);
-    Static1D angle1= new Static1D(90);
-    Static1D angle2= new Static1D(45);
-    Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) );
-
-    VertexEffect[] effect = new VertexEffect[12];
-
-    effect[0] = new VertexEffectScale(scale);
-    effect[1] = new VertexEffectMove(move0);
-    effect[2] = new VertexEffectScale(flipZ);
-    effect[3] = new VertexEffectRotate(angle1,axisX,cent0);
-    effect[4] = new VertexEffectMove(move1);
-    effect[5] = new VertexEffectRotate(angle1,axisY,cent0);
-    effect[6] = new VertexEffectMove(move2);
-    effect[7] = new VertexEffectScale(flipX);
-    effect[8] = new VertexEffectRotate(angle2,axisX,cent0);
-    effect[9] = new VertexEffectMove(move3);
-    effect[10]= new VertexEffectRotate(angle3,axis ,cent1);
-    effect[11]= new VertexEffectScale(flipX);
-
-    effect[0].setMeshAssociation(63,-1);  // meshes 0,1,2,3,4,5
-    effect[1].setMeshAssociation( 3,-1);  // meshes 0,1
-    effect[2].setMeshAssociation( 2,-1);  // mesh 1
-    effect[3].setMeshAssociation( 2,-1);  // mesh 1
-    effect[4].setMeshAssociation(12,-1);  // meshes 2,3
-    effect[5].setMeshAssociation(60,-1);  // meshes 2,3,4,5
-    effect[6].setMeshAssociation(12,-1);  // meshes 2,3
-    effect[7].setMeshAssociation( 8,-1);  // mesh 3
-    effect[8].setMeshAssociation(48,-1);  // meshes 4,5
-    effect[9].setMeshAssociation(48,-1);  // meshes 4,5
-    effect[10].setMeshAssociation(48,-1); // meshes 4,5
-    effect[11].setMeshAssociation(32,-1); // mesh 5
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  VertexEffect[] createVertexEffectsRediCorner()
-    {
-    Static3D axisY   = new Static3D(0,1,0);
-    Static3D axisX   = new Static3D(1,0,0);
-    Static3D axisZ   = new Static3D(0,0,1);
-    Static3D center  = new Static3D(0,0,0);
-    Static1D angle90 = new Static1D(90);
-    Static1D angle270= new Static1D(270);
-    Static1D angle45 = new Static1D(-45);
-
-    VertexEffect[] effect = new VertexEffect[6];
-
-    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
-    effect[1] = new VertexEffectRotate( angle270, axisX, center );
-    effect[2] = new VertexEffectRotate( angle90 , axisY, center );
-    effect[3] = new VertexEffectRotate( angle45 , axisX, center );
-    effect[4] = new VertexEffectRotate( angle90 , axisY, center );
-    effect[5] = new VertexEffectRotate( angle270, axisZ, center );
-
-    effect[0].setMeshAssociation( 7,-1);  // 0,1,2
-    effect[1].setMeshAssociation( 2,-1);  // 1
-    effect[2].setMeshAssociation( 4,-1);  // 2
-    effect[3].setMeshAssociation(56,-1);  // 3
-    effect[4].setMeshAssociation(16,-1);  // 4
-    effect[5].setMeshAssociation(32,-1);  // 5
-
-    return effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// OBJECTS
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// CUBE
-
-  MeshBase createCubeMesh(int index)
-    {
-    MeshBase mesh = createFacesCube(index);
-    VertexEffect[] effects = createVertexEffectsCube();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D roundingCenter  = new Static3D(0,0,0);
-    Static3D[] vertices = new Static3D[8];
-    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[4] = new Static3D(-0.5f,+0.5f,+0.5f);
-    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
-    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
-    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
-    roundCorners(mesh,roundingCenter,vertices,0.06f,0.12f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// SKEWB
-
-  MeshBase createSkewbCornerMesh()
-    {
-    MeshBase mesh = createFacesSkewbCorner();
-    VertexEffect[] effects = createVertexEffectsSkewbCorner();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    float E = 0.5f;
-    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
-
-    Static3D[] verticesType1 = new Static3D[1];
-    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
-    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
-
-    Static3D[] verticesType2 = new Static3D[3];
-    verticesType2[0] = new Static3D(-E, 0, 0);
-    verticesType2[1] = new Static3D( 0,-E, 0);
-    verticesType2[2] = new Static3D( 0, 0,-E);
-    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createSkewbFaceMesh()
-    {
-    MeshBase mesh = createFacesSkewbFace();
-    VertexEffect[] effects = createVertexEffectsSkewbFace();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D roundingCenter = new Static3D(0,0,-0.2f);
-    float E = SQ2/4;
-    Static3D[] vertices = new Static3D[4];
-    vertices[0] = new Static3D(-E*SQ2,      0, 0);
-    vertices[1] = new Static3D(+E*SQ2,      0, 0);
-    vertices[2] = new Static3D(     0, -E*SQ2, 0);
-    vertices[3] = new Static3D(     0, +E*SQ2, 0);
-    roundCorners(mesh,roundingCenter,vertices,0.10f,0.10f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// SKEWB DIAMOND / PYRAMINX
-
-  MeshBase createOctaMesh()
-    {
-    MeshBase mesh = createFacesOcta();
-    VertexEffect[] effects = createVertexEffectsOcta();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D roundingCenter = new Static3D(0,0,0);
-    Static3D[] vertices = new Static3D[6];
-    vertices[0] = new Static3D(    0, SQ2/2,    0 );
-    vertices[1] = new Static3D( 0.5f,     0, 0.5f );
-    vertices[2] = new Static3D(-0.5f,     0, 0.5f );
-    vertices[3] = new Static3D(    0,-SQ2/2,    0 );
-    vertices[4] = new Static3D(-0.5f,     0,-0.5f );
-    vertices[5] = new Static3D( 0.5f,     0,-0.5f );
-    roundCorners(mesh,roundingCenter,vertices,0.06f,0.20f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createTetraMesh()
-    {
-    MeshBase mesh = createFacesTetra();
-    VertexEffect[] effects = createVertexEffectsTetra();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D roundingCenter = new Static3D(0,0,0);
-    Static3D[] verticesRound = new Static3D[4];
-    verticesRound[0] = new Static3D(-0.5f,+SQ2/4,   0 );
-    verticesRound[1] = new Static3D(+0.5f,+SQ2/4,   0 );
-    verticesRound[2] = new Static3D(    0,-SQ2/4,+0.5f);
-    verticesRound[3] = new Static3D(    0,-SQ2/4,-0.5f);
-    roundCorners(mesh,roundingCenter,verticesRound,0.08f,0.15f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// DINO
-
-  MeshBase createDinoMesh()
-    {
-    MeshBase mesh = createFacesDino();
-    VertexEffect[] effects = createVertexEffectsDino();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    float F = 0.5f;
-    Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F);
-    Static3D[] verticesRound = new Static3D[4];
-    verticesRound[0] = new Static3D(     0,-3*F,    0 );
-    verticesRound[1] = new Static3D(     0,   0, -3*F );
-    verticesRound[2] = new Static3D(  -3*F,   0,    0 );
-    verticesRound[3] = new Static3D(  +3*F,   0,    0 );
-    roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Helicopter
-
-  MeshBase createHelicopterCornerMesh()
-    {
-    MeshBase mesh = createFacesHelicopterCorner();
-    VertexEffect[] effects = createVertexEffectsHelicopterCorner();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    float E = 0.5f;
-    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
-
-    Static3D[] verticesType1 = new Static3D[1];
-    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
-    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
-
-    Static3D[] verticesType2 = new Static3D[3];
-    verticesType2[0] = new Static3D(-E, 0, 0);
-    verticesType2[1] = new Static3D( 0,-E, 0);
-    verticesType2[2] = new Static3D( 0, 0,-E);
-    roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createHelicopterFaceMesh()
-    {
-    MeshBase mesh = createFacesHelicopterFace();
-    VertexEffect[] effects = createVertexEffectsHelicopterFace();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    float E = 0.5f;
-    Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
-
-    Static3D[] verticesType1 = new Static3D[1];
-    verticesType1[0] = new Static3D(E/3,E/3,0.0f);
-    roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f);
-
-    Static3D[] verticesType2 = new Static3D[2];
-    verticesType2[0] = new Static3D(-E+E/3, E/3  , 0);
-    verticesType2[1] = new Static3D( E/3  ,-E+E/3, 0);
-    roundCorners(mesh,roundingCenter,verticesType2,0.10f,0.20f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Redi cube
-
-  MeshBase createRediEdgeMesh()
-    {
-    MeshBase mesh = createFacesRediEdge();
-    VertexEffect[] effects = createVertexEffectsRediEdge();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D center = new Static3D(0.0f,-0.75f,-0.75f);
-    Static3D[] vertices = new Static3D[4];
-    vertices[0] = new Static3D( 0.5f, 0.0f, 0.0f);
-    vertices[1] = new Static3D(-0.5f, 0.0f, 0.0f);
-    vertices[2] = new Static3D(0.0f, 0.0f,-1.5f);
-    vertices[3] = new Static3D(0.0f,-1.5f, 0.0f);
-
-    roundCorners(mesh,center,vertices,0.06f,0.20f);
-
-    return mesh;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  MeshBase createRediCornerMesh()
-    {
-    MeshBase mesh = createFacesRediCorner();
-    VertexEffect[] effects = createVertexEffectsRediCorner();
-    for( VertexEffect effect : effects ) mesh.apply(effect);
-
-    Static3D center = new Static3D(0,0,0);
-    Static3D[] vertices = new Static3D[8];
-    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[4] = new Static3D(-0.5f,+0.5f,+0.5f);
-    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
-    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
-    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
-
-    roundCorners(mesh,center,vertices,0.06f,0.12f);
-
-    return mesh;
-    }
-  }
diff --git a/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java b/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java
new file mode 100644
index 0000000..d67b866
--- /dev/null
+++ b/src/main/java/org/distorted/examples/meshfile/FactoryCubit.java
@@ -0,0 +1,1306 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2020 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Magic Cube.                                                              //
+//                                                                                               //
+// Magic Cube is free software: you can redistribute it and/or modify                            //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Magic Cube is distributed in the hope that it will be useful,                                 //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.meshfile;
+
+import org.distorted.library.effect.VertexEffect;
+import org.distorted.library.effect.VertexEffectDeform;
+import org.distorted.library.effect.VertexEffectMove;
+import org.distorted.library.effect.VertexEffectRotate;
+import org.distorted.library.effect.VertexEffectScale;
+import org.distorted.library.mesh.MeshBase;
+import org.distorted.library.mesh.MeshJoined;
+import org.distorted.library.mesh.MeshPolygon;
+import org.distorted.library.type.Static1D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class FactoryCubit
+  {
+  private static final float SQ2 = (float)Math.sqrt(2);
+  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 int   IVY_N = 8;
+
+  private static final Static1D RADIUS = new Static1D(1);
+
+  private static FactoryCubit mThis;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private FactoryCubit()
+    {
+
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static FactoryCubit getInstance()
+    {
+    if( mThis==null ) mThis = new FactoryCubit();
+
+    return mThis;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// H - height of the band in the middle
+// alpha - angle of the edge  [0,90]
+// dist - often in a polygon the distance from edge to center is not 1, but something else.
+// This is the distance.
+// K - where to begin the second, much more flat part of the band. [0,1]
+// N - number of bands. N>=3
+//
+// theory: two distinct parts to the band:
+// 1) (0,B) - steep
+// 2) (B,1) - flat
+//
+// In first part, we have y = g(x) ; in second - y = g(f(x)) where
+//
+// g(x) = sqrt( R^2 - (x-D)^2 ) - R*cos(alpha)
+// f(x) = ((D-B)/(1-B)*x + B*(1-D)/(1-B)
+// h(x) = R*(sin(alpha) - sin(x))
+// R = H/(1-cos(alpha))
+// D = H*sin(alpha)
+// B = h(K*alpha)
+//
+// The N points are taken at:
+//
+// 1) in the second part, there are K2 = (N-3)/3 such points
+// 2) in the first - K1 = (N-3) - K2
+// 3) also, the 3 points 0,B,1
+//
+// so we have the sequence A[i] of N points
+//
+// 0
+// h((i+1)*(1-K)*alpha/(K1+1)) (i=0,1,...,K1-1)
+// B
+// (1-B)*(i+1)/(K2+1) + B   (i=0,i,...,K2-1)
+// 1
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private float f(float D, float B, float x)
+    {
+    return ((D-B)*x + B*(1-D))/(1-B);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private float g(float R, float D, float x, float cosAlpha)
+    {
+    float d = x-D;
+    return (float)(Math.sqrt(R*R-d*d)-R*cosAlpha);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private float h(float R, float sinAlpha, float x)
+    {
+    return R*(sinAlpha-(float)Math.sin(x));
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float[] computeBands(float H, int alpha, float dist, float K, int N)
+    {
+    float[] bands = new float[2*N];
+
+    bands[0] = 1.0f;
+    bands[1] = 0.0f;
+
+    float beta = (float)Math.atan(dist*Math.tan(Math.PI*alpha/180));
+    float sinBeta = (float)Math.sin(beta);
+    float cosBeta = (float)Math.cos(beta);
+    float R = cosBeta<1.0f ? H/(1.0f-cosBeta) : 0.0f;
+    float D = R*sinBeta;
+    float B = h(R,sinBeta,K*beta);
+
+    if( D>1.0f )
+      {
+      for(int i=1; i<N; i++)
+        {
+        bands[2*i  ] = (float)(N-1-i)/(N-1);
+        bands[2*i+1] = H*(1-bands[2*i]);
+        }
+      }
+    else
+      {
+      int K2 = (int)((N-3)*K);
+      int K1 = (N-3)-K2;
+
+      for(int i=0; i<=K1; i++)
+        {
+        float angle = K*beta + (1-K)*beta*(K1-i)/(K1+1);
+        float x = h(R,sinBeta,angle);
+        bands[2*i+2] = 1.0f - x;
+        bands[2*i+3] = g(R,D,x,cosBeta);
+        }
+
+      for(int i=0; i<=K2; i++)
+        {
+        float x = (1-B)*(i+1)/(K2+1) + B;
+        bands[2*K1+2 + 2*i+2] = 1.0f - x;
+        bands[2*K1+2 + 2*i+3] = g(R,D,f(D,B,x),cosBeta);
+        }
+      }
+
+    bands[2*N-2] = 0.0f;
+    bands[2*N-1] =    H;
+
+    return bands;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void roundCorners(MeshBase mesh, Static3D center, Static3D[] vertices, float strength, float regionRadius)
+    {
+    Static4D reg= new Static4D(0,0,0,regionRadius);
+
+    float centX = center.get0();
+    float centY = center.get1();
+    float centZ = center.get2();
+
+    for (Static3D vertex : vertices)
+      {
+      float x = strength*(centX - vertex.get0());
+      float y = strength*(centY - vertex.get1());
+      float z = strength*(centZ - vertex.get2());
+
+      VertexEffect effect = new VertexEffectDeform(new Static3D(x,y,z), RADIUS, vertex, reg);
+      mesh.apply(effect);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesCube(int sizeIndex)
+    {
+    MeshBase[] meshes = new MeshPolygon[6];
+
+    float E = 0.5f;
+    int extraI, extraV, num;
+
+    switch(sizeIndex)
+      {
+      case 0 : num = 6; extraI = 2; extraV = 2; break;
+      case 1 : num = 5; extraI = 2; extraV = 2; break;
+      case 2 : num = 5; extraI = 1; extraV = 2; break;
+      default: num = 4; extraI = 1; extraV = 1; break;
+      }
+
+    float[] vertices = { -E,-E, +E,-E, +E,+E, -E,+E };
+    float[] bands = computeBands(0.048f,35,E,0.7f,num);
+
+    meshes[0] = new MeshPolygon(vertices,bands,extraI,extraV);
+    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] = meshes[0].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+    meshes[4] = meshes[0].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
+    meshes[5] = meshes[0].copy(true);
+    meshes[5].setEffectAssociation(0,32,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesSkewbCorner()
+    {
+    MeshBase[] meshes = new MeshBase[6];
+
+    float E = 0.5f;
+    float F = SQ2/2;
+    float G = SQ6/16;
+    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
+    float[] bands0 = computeBands(0.028f,35,E/3,0.7f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    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);
+
+    float[] vertices1 = { -F/2,-2*G, F/2,-2*G, 3*F/8,-G, 1*F/8,G, 0,2*G };
+    float[] bands1 = computeBands(0,0,1,0,3);
+
+    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
+    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);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesSkewbFace()
+    {
+    MeshBase[] meshes = new MeshBase[5];
+
+    float E = SQ2/4;
+    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
+    float[] bands0 = computeBands(0.051f,35,E/2,0.9f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    meshes[0].setEffectAssociation(0,1,0);
+
+    float[] vertices1 = { -E,-SQ3*E, -E*0.7f,-SQ3*E, +E*0.7f,-SQ3*E, +E,-SQ3*E, 0,0 };
+    float[] bands1 = computeBands(0,0,1,0,3);
+
+    meshes[1] = new MeshPolygon(vertices1,bands1,0,0);
+    meshes[1].setEffectAssociation(0,2,0);
+    meshes[2] = meshes[1].copy(true);
+    meshes[2].setEffectAssociation(0,4,0);
+    meshes[3] = meshes[1].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+    meshes[4] = meshes[1].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesOcta()
+    {
+    MeshBase[] meshes = new MeshPolygon[8];
+
+    float E = 0.75f;
+    float F = 0.5f;
+    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
+    float[] bands = computeBands(0.05f,35,F,0.8f,6);
+
+    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
+    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] = meshes[0].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+    meshes[4] = meshes[0].copy(true);
+    meshes[4].setEffectAssociation(0,16,0);
+    meshes[5] = meshes[0].copy(true);
+    meshes[5].setEffectAssociation(0,32,0);
+    meshes[6] = meshes[0].copy(true);
+    meshes[6].setEffectAssociation(0,64,0);
+    meshes[7] = meshes[0].copy(true);
+    meshes[7].setEffectAssociation(0,128,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesTetra()
+    {
+    MeshBase[] meshes = new MeshBase[4];
+
+    float E = 0.75f;
+    float F = 0.5f;
+    float[] vertices = { -F,-E/3, +F,-E/3, 0.0f,2*E/3};
+    float[] bands = computeBands(0.05f,35,F,0.8f,6);
+
+    meshes[0] = new MeshPolygon(vertices, bands, 2,2);
+    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] = meshes[0].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesDino()
+    {
+    MeshBase[] meshes = new MeshPolygon[4];
+
+    float E = 0.5f*SQ2;
+    float F = 0.5f;
+    float[] vertices0 = { -F,F/3, 0,-2*F/3, +F,F/3 };
+    float[] bands0 = computeBands(0.028f,30,F/3,0.8f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 5);
+    meshes[0].setEffectAssociation(0,1,0);
+    meshes[1] = meshes[0].copy(true);
+    meshes[1].setEffectAssociation(0,2,0);
+
+    float[] vertices1 = { -E/2,-E*(SQ3/6), E/2,-E*(SQ3/6), 0,E*(SQ3/3) };
+    float[] bands1 = computeBands(0.02f,45,F/3,0.2f,3);
+
+    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
+    meshes[2].setEffectAssociation(0,4,0);
+    meshes[3] = meshes[2].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesHelicopterCorner()
+    {
+    MeshBase[] meshes = new MeshBase[6];
+
+    float E = 0.5f;
+    float F = SQ2/4;
+    float G = 1.0f/12;
+    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
+    float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    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);
+
+    float[] vertices1 = { -F,-G, 0,-G, +F,-G, 0,2*G };
+    float[] bands1 = computeBands(0.00f,0,0,0.0f,3);
+    meshes[3] = new MeshPolygon(vertices1,bands1,1,5);
+    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);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesHelicopterFace()
+    {
+    MeshBase[] meshes = new MeshBase[4];
+
+    float E = 0.5f;
+    float F = SQ2/4;
+    float G = 1.0f/12;
+    float[] vertices0 = { -E+E/4,E/4, E/4,-E+E/4, E/4,E/4};
+    float[] bands0 = computeBands(0.028f,35,E/4,0.7f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 3, 3);
+    meshes[0].setEffectAssociation(0,1,0);
+
+    float[] vertices1 = { -F,-G, +F,-G, 0,2*G};
+    float[] bands1 = computeBands(0.01f,45,F,0.0f,3);
+
+    meshes[1] = new MeshPolygon(vertices1, bands1, 1, 3);
+    meshes[1].setEffectAssociation(0,2,0);
+
+    float[] vertices2 = { -E/2,-F/3, +E/2,-F/3, 0,2*F/3};
+
+    meshes[2] = new MeshPolygon(vertices2, bands1, 1, 3);
+    meshes[2].setEffectAssociation(0,4,0);
+    meshes[3] = meshes[2].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesRediEdge()
+    {
+    MeshBase[] meshes = new MeshPolygon[6];
+
+    float F = 0.25f;
+    float[] vertices0 = { -F,+F, -F,-F, 0, -2*F, +F,-F, +F,+F };
+    float[] bands0 = computeBands(0.038f,35,F,0.7f,7);
+
+    meshes[0] = new MeshPolygon(vertices0, bands0, 2, 2);
+    meshes[0].setEffectAssociation(0,1,0);
+    meshes[1] = meshes[0].copy(true);
+    meshes[1].setEffectAssociation(0,2,0);
+
+    float[] bands1 = computeBands(0.02f,35,F/2,0.2f,3);
+    float[] vertices1 = { -F/2, +F/2, -F/2, -1.5f*F, 1.5f*F, +F/2 };
+
+    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 2);
+    meshes[2].setEffectAssociation(0,4,0);
+    meshes[3] = meshes[2].copy(true);
+    meshes[3].setEffectAssociation(0,8,0);
+
+    float X = 0.25f*SQ2;
+    float Y = SQ6/16;
+    float[] vertices2 = { -X, Y, -1.5f*X, -Y, +1.5f*X, -Y, +X, Y };
+
+    meshes[4] = new MeshPolygon(vertices2, bands1, 1, 1);
+    meshes[4].setEffectAssociation(0,16,0);
+    meshes[5] = meshes[4].copy(true);
+    meshes[5].setEffectAssociation(0,32,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesRediCorner()
+    {
+    MeshBase[] meshes = new MeshBase[6];
+
+    float E = 0.5f;
+    float[] vertices0 = { -E,-E, +E,-E, +E,+E, -E,+E };
+    float[] bands0 = computeBands(0.06f,35,E,0.7f,6);
+
+    meshes[0] = new MeshPolygon(vertices0,bands0,2,2);
+    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);
+
+    float F = 0.5f;
+    float X = 0.5f;
+    float G = 0.72f;
+    float[] vertices1 = { -E,+F, -E+X,0, -E,-F, -E*G,-F, +E*G,-F, +E,-F, +E-X,0, +E,+F, +E*G,+F, -E*G,+F };
+    float[] bands1 = computeBands(0.0f,0,1.0f,0.0f,2);
+
+    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);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesIvyCorner()
+    {
+    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+IVY_D-DIST)*CORR2;
+    vertices[1] = ( 0.5f      -DIST)*CORR2;
+    vertices[2] = ( 0.5f      -DIST)*CORR2;
+    vertices[3] = ( 0.5f      -DIST)*CORR2;
+    vertices[4] = ( 0.5f      -DIST)*CORR2;
+    vertices[5] = (-0.5f+IVY_D-DIST)*CORR2;
+
+    for(int i=0; i<=IVY_N; i++)
+      {
+      float sin = (float)Math.sin(i*angle);
+      float cos = (float)Math.cos(i*angle);
+
+      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);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createFacesIvyFace()
+    {
+    MeshBase[] meshes = new MeshBase[2];
+
+    final float angle = (float)Math.PI/(2*IVY_N);
+    final float CORR  = 1.0f - IVY_D*SQ2;
+    float[] vertices = new float[4*IVY_N];
+
+    for(int i=0; i<IVY_N; i++)
+      {
+      float sin = (float)Math.sin(i*angle);
+      float cos = (float)Math.cos(i*angle);
+
+      vertices[2*i          ] = CORR*(0.5f-cos);
+      vertices[2*i+1        ] = CORR*(0.5f-sin);
+      vertices[2*i  +2*IVY_N] = CORR*(cos-0.5f);
+      vertices[2*i+1+2*IVY_N] = CORR*(sin-0.5f);
+      }
+
+    float[] bands0 = computeBands(+0.05f,35,0.5f,0.5f,5);
+    float[] bands1 = computeBands(-0.10f,45,0.5f,0.0f,2);
+
+    meshes[0] = new MeshPolygon(vertices,bands0,0,0);
+    meshes[0].setEffectAssociation(0,1,0);
+    meshes[1] = new MeshPolygon(vertices,bands1,0,0);
+    meshes[1].setEffectAssociation(0,2,0);
+
+    return new MeshJoined(meshes);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// EFFECTS
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsCube()
+    {
+    Static3D axisY   = new Static3D(0,1,0);
+    Static3D axisX   = new Static3D(1,0,0);
+    Static3D center  = new Static3D(0,0,0);
+    Static1D angle90 = new Static1D(90);
+    Static1D angle180= new Static1D(180);
+    Static1D angle270= new Static1D(270);
+
+    VertexEffect[] effect = new VertexEffect[6];
+
+    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
+    effect[1] = new VertexEffectRotate( angle180, axisX, center );
+    effect[2] = new VertexEffectRotate( angle90 , axisX, center );
+    effect[3] = new VertexEffectRotate( angle270, axisX, center );
+    effect[4] = new VertexEffectRotate( angle270, axisY, center );
+    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
+
+    effect[0].setMeshAssociation(63,-1);  // all 6 sides
+    effect[1].setMeshAssociation(32,-1);  // back
+    effect[2].setMeshAssociation( 8,-1);  // bottom
+    effect[3].setMeshAssociation( 4,-1);  // top
+    effect[4].setMeshAssociation( 2,-1);  // left
+    effect[5].setMeshAssociation( 1,-1);  // right
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsSkewbCorner()
+    {
+    float E = 0.5f;
+
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
+    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
+    Static1D angle1 = new Static1D(+90);
+    Static1D angle2 = new Static1D(-90);
+    Static1D angle3 = new Static1D(-15);
+    Static1D angle4 = new Static1D((float)((180.0f/Math.PI)*Math.acos(SQ3/3)));
+    Static1D angle5 = new Static1D(120);
+    Static1D angle6 = new Static1D(240);
+    Static3D center1= new Static3D(0,0,0);
+    Static3D center2= new Static3D(-0.5f,-0.5f,-0.5f);
+    Static3D move1  = new Static3D(-E/4,-E/4,0);
+    Static3D move2  = new Static3D(-0.5f+SQ2/4,-0.5f+SQ6/8,-0.5f);
+
+    VertexEffect[] effect = new VertexEffect[10];
+
+    effect[0] = new VertexEffectMove(move1);
+    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
+    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
+    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
+    effect[4] = new VertexEffectMove(move2);
+    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
+    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
+    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
+    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
+    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
+
+    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
+    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
+    effect[2].setMeshAssociation( 2,-1);  // mesh 1
+    effect[3].setMeshAssociation( 4,-1);  // mesh 2
+    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[8].setMeshAssociation(16,-1);  // mesh 4
+    effect[9].setMeshAssociation(32,-1);  // mesh 5
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsSkewbFace()
+    {
+    Static3D center = new Static3D(0,0,0);
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisZ  = new Static3D(0,0,1);
+    float angle = -(float)((180.0f/Math.PI)*Math.acos(SQ3/3));
+
+    VertexEffect[] effect = new VertexEffect[6];
+
+    effect[0] = new VertexEffectRotate( new Static1D(angle), axisX, center);
+    effect[1] = new VertexEffectRotate( new Static1D(  135), axisZ, center);
+    effect[2] = new VertexEffectRotate( new Static1D(   45), axisZ, center);
+    effect[3] = new VertexEffectRotate( new Static1D(  -45), axisZ, center);
+    effect[4] = new VertexEffectRotate( new Static1D( -135), axisZ, center);
+    effect[5] = new VertexEffectMove( new Static3D(0,0,-0.5f) );
+
+    effect[0].setMeshAssociation(30,-1);  // meshes 1,2,3,4
+    effect[1].setMeshAssociation( 2,-1);  // mesh 1
+    effect[2].setMeshAssociation( 5,-1);  // meshes 0,2
+    effect[3].setMeshAssociation( 8,-1);  // mesh 3
+    effect[4].setMeshAssociation(16,-1);  // mesh 4
+    effect[5].setMeshAssociation(30,-1);  // meshes 1,2,3,4
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsOcta()
+    {
+    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
+    Static1D angle1= new Static1D( 90);
+    Static1D angle2= new Static1D(180);
+    Static1D angle3= new Static1D(270);
+    Static3D move1 = new Static3D(0,SQ2/2-SQ3/3,0);
+    Static3D axisX = new Static3D(1,0,0);
+    Static3D axisY = new Static3D(0,1,0);
+    Static3D cent0 = new Static3D(0,0,0);
+    Static3D cent1 = new Static3D(0,SQ2/2,0);
+    Static3D flipY = new Static3D( 1,-1, 1);
+    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
+
+    VertexEffect[] effect = new VertexEffect[7];
+
+    effect[0] = new VertexEffectScale(scale);
+    effect[1] = new VertexEffectMove(move1);
+    effect[2] = new VertexEffectRotate(alpha , axisX, cent1);
+    effect[3] = new VertexEffectRotate(angle1, axisY, cent0);
+    effect[4] = new VertexEffectRotate(angle2, axisY, cent0);
+    effect[5] = new VertexEffectRotate(angle3, axisY, cent0);
+    effect[6] = new VertexEffectScale(flipY);
+
+    effect[3].setMeshAssociation ( 34,-1); // apply to meshes 1 & 5
+    effect[4].setMeshAssociation ( 68,-1); // apply to meshes 2 & 6
+    effect[5].setMeshAssociation (136,-1); // apply to meshes 3 & 7
+    effect[6].setMeshAssociation (240,-1); // apply to meshes 4,5,6,7
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsTetra()
+    {
+    Static3D flipZ = new Static3D( 1, 1,-1);
+    Static1D alpha = new Static1D((float)(-(180/Math.PI)*Math.asin(SQ3/3)));
+    Static1D angle1= new Static1D( 90);
+    Static1D angle2= new Static1D(180);
+    Static3D move1 = new Static3D(0,SQ2/4-SQ3/6,0);
+    Static3D axisX = new Static3D(1,0,0);
+    Static3D axisY = new Static3D(0,1,0);
+    Static3D axisZ = new Static3D(0,0,1);
+    Static3D cent0 = new Static3D(0,0,0);
+    Static3D cent1 = new Static3D(0,SQ2/4,0);
+    Static3D scale = new Static3D( 1, 2*SQ3/3, 1);
+
+    VertexEffect[] effect = new VertexEffect[7];
+
+    effect[0] = new VertexEffectScale(scale);
+    effect[1] = new VertexEffectRotate(angle2, axisZ, cent0);
+    effect[2] = new VertexEffectMove(move1);
+    effect[3] = new VertexEffectRotate(alpha , axisX, cent1);
+    effect[4] = new VertexEffectScale(flipZ);
+    effect[5] = new VertexEffectRotate(angle1, axisY, cent0);
+    effect[6] = new VertexEffectRotate(angle2, axisZ, cent0);
+
+    effect[4].setMeshAssociation(10,-1); // meshes 1 & 3
+    effect[5].setMeshAssociation(12,-1); // meshes 2 & 3
+    effect[6].setMeshAssociation(12,-1); // meshes 2 & 3
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsDino()
+    {
+    float E = 0.5f*SQ2;
+    float F = 0.5f;
+    final float ANGLE = (float)((180/Math.PI)*(Math.atan(SQ2)));
+
+    Static1D angle1 = new Static1D(-ANGLE);
+    Static1D angle2 = new Static1D(+ANGLE);
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static3D axisZ  = new Static3D(0,-1,1);
+    Static3D center0= new Static3D(0,0,0);
+    Static3D center1= new Static3D(0,-3*F,0);
+
+    VertexEffect[] effect = new VertexEffect[10];
+
+    effect[0] = new VertexEffectScale ( new Static3D(3,3,3) );
+    effect[1] = new VertexEffectMove  ( new Static3D(0,-F,0) );
+    effect[2] = new VertexEffectRotate( new Static1D(90), axisX, center0 );
+    effect[3] = new VertexEffectScale ( new Static3D(1,-1,1) );
+    effect[4] = new VertexEffectMove  ( new Static3D(3*E/2,E*(SQ3/2)-3*F,0) );
+    effect[5] = new VertexEffectRotate( new Static1D(+90), axisY, center1 );
+    effect[6] = new VertexEffectScale ( new Static3D(-1,1,1) );
+    effect[7] = new VertexEffectRotate( new Static1D( 45), axisX, center1 );
+    effect[8] = new VertexEffectRotate( angle1           , axisZ, center1 );
+    effect[9] = new VertexEffectRotate( angle2           , axisZ, center1 );
+
+    effect[0].setMeshAssociation(15,-1);  // apply to meshes 0,1,2,3
+    effect[1].setMeshAssociation( 3,-1);  // apply to meshes 0,1
+    effect[2].setMeshAssociation( 2,-1);  // apply to mesh 1
+    effect[3].setMeshAssociation( 2,-1);  // apply to mesh 0
+    effect[4].setMeshAssociation(12,-1);  // apply to meshes 2,3
+    effect[5].setMeshAssociation(12,-1);  // apply to meshes 2,3
+    effect[6].setMeshAssociation( 8,-1);  // apply to mesh 3
+    effect[7].setMeshAssociation(12,-1);  // apply to meshes 2,3
+    effect[8].setMeshAssociation( 4,-1);  // apply to mesh 2
+    effect[9].setMeshAssociation( 8,-1);  // apply to mesh 3
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsHelicopterCorner()
+    {
+    float E = 0.5f;
+
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static3D axis0  = new Static3D(-SQ2/2,0,SQ2/2);
+    Static3D axis1  = new Static3D(+SQ3/3,+SQ3/3,+SQ3/3);
+    Static1D angle1 = new Static1D(+90);
+    Static1D angle2 = new Static1D(-90);
+    Static1D angle3 = new Static1D(-135);
+    Static1D angle4 = new Static1D(90);
+    Static1D angle5 = new Static1D(120);
+    Static1D angle6 = new Static1D(240);
+    Static3D center1= new Static3D(0,0,0);
+    Static3D center2= new Static3D(-0.25f,-0.25f,-0.25f);
+    Static3D move1  = new Static3D(-E/4,-E/4,0);
+    Static3D move2  = new Static3D(-0.25f,(-1.0f/6)-0.25f,-0.25f);
+
+    VertexEffect[] effect = new VertexEffect[10];
+
+    effect[0] = new VertexEffectMove(move1);
+    effect[1] = new VertexEffectScale(new Static3D(1,1,-1));
+    effect[2] = new VertexEffectRotate(angle1,axisX,center1);
+    effect[3] = new VertexEffectRotate(angle2,axisY,center1);
+    effect[4] = new VertexEffectMove(move2);
+    effect[5] = new VertexEffectRotate(angle1,axisX,center2);
+    effect[6] = new VertexEffectRotate(angle3,axisY,center2);
+    effect[7] = new VertexEffectRotate(angle4,axis0,center2);
+    effect[8] = new VertexEffectRotate(angle5,axis1,center2);
+    effect[9] = new VertexEffectRotate(angle6,axis1,center2);
+
+    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
+    effect[1].setMeshAssociation( 6,-1);  // meshes 1,2
+    effect[2].setMeshAssociation( 2,-1);  // mesh 1
+    effect[3].setMeshAssociation( 4,-1);  // mesh 2
+    effect[4].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[5].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[6].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[7].setMeshAssociation(56,-1);  // meshes 3,4,5
+    effect[8].setMeshAssociation(16,-1);  // mesh 4
+    effect[9].setMeshAssociation(32,-1);  // mesh 5
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsHelicopterFace()
+    {
+    float E = 0.5f;
+    float F = SQ2/4;
+
+    Static3D move0  = new Static3D(-E/4, -E/4, 0);
+    Static3D move1  = new Static3D(-(SQ2/24)-E/2, -(SQ2/24)-E/2, 0);
+    Static3D move2  = new Static3D(-E/2, F/3, 0);
+    Static3D move3  = new Static3D(+E/2, F/3, 0);
+    Static3D move4  = new Static3D(+E/3,+E/3, 0);
+    Static1D angle1 = new Static1D(135);
+    Static1D angle2 = new Static1D(90);
+    Static1D angle3 = new Static1D(-90);
+    Static1D angle4 = new Static1D(-135);
+    Static3D axisX  = new Static3D(1,0,0);
+    Static3D axisY  = new Static3D(0,1,0);
+    Static3D axisZ  = new Static3D(0,0,1);
+    Static3D axis1  = new Static3D(1,-1,0);
+    Static3D center = new Static3D(0,0,0);
+    Static3D center1= new Static3D(-E/2,-E/2,0);
+
+    VertexEffect[] effect = new VertexEffect[10];
+
+    effect[0] = new VertexEffectMove(move0);
+    effect[1] = new VertexEffectRotate(angle1, axisZ, center);
+    effect[2] = new VertexEffectMove(move1);
+    effect[3] = new VertexEffectRotate(angle2, axis1, center1);
+    effect[4] = new VertexEffectMove(move2);
+    effect[5] = new VertexEffectMove(move3);
+    effect[6] = new VertexEffectRotate(angle3, axisZ, center);
+    effect[7] = new VertexEffectRotate(angle4, axisX, center);
+    effect[8] = new VertexEffectRotate(angle1, axisY, center);
+    effect[9] = new VertexEffectMove(move4);
+
+    effect[0].setMeshAssociation( 1,-1);  // mesh 0
+    effect[1].setMeshAssociation( 2,-1);  // mesh 1
+    effect[2].setMeshAssociation( 2,-1);  // mesh 1
+    effect[3].setMeshAssociation( 2,-1);  // mesh 1
+    effect[4].setMeshAssociation( 4,-1);  // mesh 2
+    effect[5].setMeshAssociation( 8,-1);  // mesh 3
+    effect[6].setMeshAssociation( 8,-1);  // mesh 3
+    effect[7].setMeshAssociation( 4,-1);  // mesh 2
+    effect[8].setMeshAssociation( 8,-1);  // mesh 3
+    effect[9].setMeshAssociation(15,-1);  // meshes 0,1,2,3
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsRediEdge()
+    {
+    Static3D move0 = new Static3D(0.0f, -0.5f, 0.0f);
+    Static3D move1 = new Static3D(0.25f, -0.25f, 0.0f);
+    Static3D move2 = new Static3D(0.5f, 0.0f, 0.0f);
+    Static3D move3 = new Static3D(0.0f, (SQ3-6)/8, (SQ3-6)/8);
+    Static3D flipZ = new Static3D(1,1,-1);
+    Static3D flipX = new Static3D(-1,1,1);
+    Static3D scale = new Static3D(2,2,2);
+    Static3D cent0 = new Static3D(0,0, 0);
+    Static3D cent1 = new Static3D(0,0, -1.5f);
+    Static3D axisX = new Static3D(1,0, 0);
+    Static3D axisY = new Static3D(0,1, 0);
+    Static3D axis  = new Static3D(0,SQ2/2,-SQ2/2);
+    Static1D angle1= new Static1D(90);
+    Static1D angle2= new Static1D(45);
+    Static1D angle3= new Static1D( (float)(180/Math.PI*Math.acos(SQ3/3)) );
+
+    VertexEffect[] effect = new VertexEffect[12];
+
+    effect[0] = new VertexEffectScale(scale);
+    effect[1] = new VertexEffectMove(move0);
+    effect[2] = new VertexEffectScale(flipZ);
+    effect[3] = new VertexEffectRotate(angle1,axisX,cent0);
+    effect[4] = new VertexEffectMove(move1);
+    effect[5] = new VertexEffectRotate(angle1,axisY,cent0);
+    effect[6] = new VertexEffectMove(move2);
+    effect[7] = new VertexEffectScale(flipX);
+    effect[8] = new VertexEffectRotate(angle2,axisX,cent0);
+    effect[9] = new VertexEffectMove(move3);
+    effect[10]= new VertexEffectRotate(angle3,axis ,cent1);
+    effect[11]= new VertexEffectScale(flipX);
+
+    effect[0].setMeshAssociation(63,-1);  // meshes 0,1,2,3,4,5
+    effect[1].setMeshAssociation( 3,-1);  // meshes 0,1
+    effect[2].setMeshAssociation( 2,-1);  // mesh 1
+    effect[3].setMeshAssociation( 2,-1);  // mesh 1
+    effect[4].setMeshAssociation(12,-1);  // meshes 2,3
+    effect[5].setMeshAssociation(60,-1);  // meshes 2,3,4,5
+    effect[6].setMeshAssociation(12,-1);  // meshes 2,3
+    effect[7].setMeshAssociation( 8,-1);  // mesh 3
+    effect[8].setMeshAssociation(48,-1);  // meshes 4,5
+    effect[9].setMeshAssociation(48,-1);  // meshes 4,5
+    effect[10].setMeshAssociation(48,-1); // meshes 4,5
+    effect[11].setMeshAssociation(32,-1); // mesh 5
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsRediCorner()
+    {
+    Static3D axisY   = new Static3D(0,1,0);
+    Static3D axisX   = new Static3D(1,0,0);
+    Static3D axisZ   = new Static3D(0,0,1);
+    Static3D center  = new Static3D(0,0,0);
+    Static1D angle90 = new Static1D(90);
+    Static1D angle270= new Static1D(270);
+    Static1D angle45 = new Static1D(-45);
+    Static3D scale   = new Static3D(1.0f, SQ2, 1.0f);
+
+    VertexEffect[] effect = new VertexEffect[7];
+
+    effect[0] = new VertexEffectMove(new Static3D(0,0,+0.5f));
+    effect[1] = new VertexEffectRotate( angle270, axisX, center );
+    effect[2] = new VertexEffectRotate( angle90 , axisY, center );
+    effect[3] = new VertexEffectScale(scale);
+    effect[4] = new VertexEffectRotate( angle45 , axisX, center );
+    effect[5] = new VertexEffectRotate( angle90 , axisY, center );
+    effect[6] = new VertexEffectRotate( angle270, axisZ, center );
+
+    effect[0].setMeshAssociation( 7,-1);  // 0,1,2
+    effect[1].setMeshAssociation( 2,-1);  // 1
+    effect[2].setMeshAssociation( 4,-1);  // 2
+    effect[3].setMeshAssociation(56,-1);  // 3,4,5
+    effect[4].setMeshAssociation(56,-1);  // 3,4,5
+    effect[5].setMeshAssociation(16,-1);  // 4
+    effect[6].setMeshAssociation(32,-1);  // 5
+
+    return effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  VertexEffect[] createVertexEffectsIvyCorner()
+    {
+    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;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// OBJECTS
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// CUBE
+
+  MeshBase createCubeMesh(int index)
+    {
+    MeshBase mesh = createFacesCube(index);
+    VertexEffect[] effects = createVertexEffectsCube();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D roundingCenter  = new Static3D(0,0,0);
+    Static3D[] vertices = new Static3D[8];
+    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[4] = new Static3D(-0.5f,+0.5f,+0.5f);
+    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
+    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
+    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
+
+    roundCorners(mesh,roundingCenter,vertices,0.06f,0.12f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// SKEWB
+
+  MeshBase createSkewbCornerMesh()
+    {
+    MeshBase mesh = createFacesSkewbCorner();
+    VertexEffect[] effects = createVertexEffectsSkewbCorner();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    float E = 0.5f;
+    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
+
+    Static3D[] verticesType1 = new Static3D[1];
+    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
+    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
+
+    Static3D[] verticesType2 = new Static3D[3];
+    verticesType2[0] = new Static3D(-E, 0, 0);
+    verticesType2[1] = new Static3D( 0,-E, 0);
+    verticesType2[2] = new Static3D( 0, 0,-E);
+    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createSkewbFaceMesh()
+    {
+    MeshBase mesh = createFacesSkewbFace();
+    VertexEffect[] effects = createVertexEffectsSkewbFace();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D roundingCenter = new Static3D(0,0,-0.2f);
+    float E = SQ2/4;
+    Static3D[] vertices = new Static3D[4];
+    vertices[0] = new Static3D(-E*SQ2,      0, 0);
+    vertices[1] = new Static3D(+E*SQ2,      0, 0);
+    vertices[2] = new Static3D(     0, -E*SQ2, 0);
+    vertices[3] = new Static3D(     0, +E*SQ2, 0);
+    roundCorners(mesh,roundingCenter,vertices,0.06f,0.10f);
+
+    mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// SKEWB DIAMOND / PYRAMINX
+
+  MeshBase createOctaMesh()
+    {
+    MeshBase mesh = createFacesOcta();
+    VertexEffect[] effects = createVertexEffectsOcta();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D roundingCenter = new Static3D(0,0,0);
+    Static3D[] vertices = new Static3D[6];
+    vertices[0] = new Static3D(    0, SQ2/2,    0 );
+    vertices[1] = new Static3D( 0.5f,     0, 0.5f );
+    vertices[2] = new Static3D(-0.5f,     0, 0.5f );
+    vertices[3] = new Static3D(    0,-SQ2/2,    0 );
+    vertices[4] = new Static3D(-0.5f,     0,-0.5f );
+    vertices[5] = new Static3D( 0.5f,     0,-0.5f );
+
+    roundCorners(mesh,roundingCenter,vertices,0.06f,0.20f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createTetraMesh()
+    {
+    MeshBase mesh = createFacesTetra();
+    VertexEffect[] effects = createVertexEffectsTetra();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D roundingCenter = new Static3D(0,0,0);
+    Static3D[] verticesRound = new Static3D[4];
+    verticesRound[0] = new Static3D(-0.5f,+SQ2/4,   0 );
+    verticesRound[1] = new Static3D(+0.5f,+SQ2/4,   0 );
+    verticesRound[2] = new Static3D(    0,-SQ2/4,+0.5f);
+    verticesRound[3] = new Static3D(    0,-SQ2/4,-0.5f);
+    roundCorners(mesh,roundingCenter,verticesRound,0.08f,0.15f);
+
+    mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// DINO
+
+  MeshBase createDinoMesh()
+    {
+    MeshBase mesh = createFacesDino();
+    VertexEffect[] effects = createVertexEffectsDino();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    float F = 0.5f;
+    Static3D roundingCenter = new Static3D(0.0f, -1.5f*F, -1.5f*F);
+    Static3D[] verticesRound = new Static3D[4];
+    verticesRound[0] = new Static3D(     0,-3*F,    0 );
+    verticesRound[1] = new Static3D(     0,   0, -3*F );
+    verticesRound[2] = new Static3D(  -3*F,   0,    0 );
+    verticesRound[3] = new Static3D(  +3*F,   0,    0 );
+    roundCorners(mesh,roundingCenter,verticesRound,0.10f,0.40f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Helicopter
+
+  MeshBase createHelicopterCornerMesh()
+    {
+    MeshBase mesh = createFacesHelicopterCorner();
+    VertexEffect[] effects = createVertexEffectsHelicopterCorner();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    float E = 0.5f;
+    Static3D roundingCenter = new Static3D(-E/2,-E/2,-E/2);
+
+    Static3D[] verticesType1 = new Static3D[1];
+    verticesType1[0] = new Static3D(0.0f,0.0f,0.0f);
+    roundCorners(mesh,roundingCenter,verticesType1,0.08f,0.15f);
+
+    Static3D[] verticesType2 = new Static3D[3];
+    verticesType2[0] = new Static3D(-E, 0, 0);
+    verticesType2[1] = new Static3D( 0,-E, 0);
+    verticesType2[2] = new Static3D( 0, 0,-E);
+    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createHelicopterFaceMesh()
+    {
+    MeshBase mesh = createFacesHelicopterFace();
+    VertexEffect[] effects = createVertexEffectsHelicopterFace();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    float E = 0.5f;
+    Static3D roundingCenter = new Static3D(-E/2 + E/3,-E/2 + E/3,-E/2);
+
+    Static3D[] verticesType1 = new Static3D[1];
+    verticesType1[0] = new Static3D(E/3,E/3,0.0f);
+    roundCorners(mesh,roundingCenter,verticesType1,0.06f,0.15f);
+
+    Static3D[] verticesType2 = new Static3D[2];
+    verticesType2[0] = new Static3D(-E+E/3, E/3  , 0);
+    verticesType2[1] = new Static3D( E/3  ,-E+E/3, 0);
+    roundCorners(mesh,roundingCenter,verticesType2,0.08f,0.20f);
+
+    mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Redi cube
+
+  MeshBase createRediEdgeMesh()
+    {
+    MeshBase mesh = createFacesRediEdge();
+    VertexEffect[] effects = createVertexEffectsRediEdge();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D center = new Static3D(0.0f,-0.75f,-0.75f);
+    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.20f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createRediCornerMesh()
+    {
+    MeshBase mesh = createFacesRediCorner();
+    VertexEffect[] effects = createVertexEffectsRediCorner();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    Static3D center = new Static3D(0,0,0);
+    Static3D[] vertices = new Static3D[8];
+    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[4] = new Static3D(-0.5f,+0.5f,+0.5f);
+    vertices[5] = new Static3D(-0.5f,+0.5f,-0.5f);
+    vertices[6] = new Static3D(-0.5f,-0.5f,+0.5f);
+    vertices[7] = new Static3D(-0.5f,-0.5f,-0.5f);
+
+    roundCorners(mesh,center,vertices,0.06f,0.12f);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createIvyCornerMesh()
+    {
+    MeshBase mesh = createFacesIvyCorner();
+    VertexEffect[] effects = createVertexEffectsIvyCorner();
+    for( VertexEffect effect : effects ) mesh.apply(effect);
+
+    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( 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);
+
+    mesh.mergeEffComponents();
+
+    return mesh;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  MeshBase createIvyFaceMesh()
+    {
+    MeshBase mesh = createFacesIvyFace();
+
+    float DIST = SQ2*(0.5f-IVY_D);
+    Static3D center = new Static3D(0.0f,0.0f,-0.0f);
+    Static3D[] vertices = new Static3D[2];
+    vertices[0] = new Static3D(+DIST,-DIST,+0.0f);
+    vertices[1] = new Static3D(-DIST,+DIST,+0.0f);
+
+    roundCorners(mesh,center,vertices,0.10f,0.30f);
+
+    mesh.mergeEffComponents();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+    mesh.addEmptyTexComponent();
+
+    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 5f0b575..6cc832b 100644
--- a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
+++ b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
@@ -32,19 +32,18 @@ import org.distorted.library.effect.MatrixEffectQuaternion;
 import org.distorted.library.effect.MatrixEffectScale;
 import org.distorted.library.effect.VertexEffectDeform;
 import org.distorted.library.effect.VertexEffectDisappear;
-import org.distorted.library.effect.VertexEffectMove;
 import org.distorted.library.effect.VertexEffectRotate;
-import org.distorted.library.effect.VertexEffectScale;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedLibrary;
 import org.distorted.library.main.DistortedScreen;
 import org.distorted.library.main.DistortedTexture;
 import org.distorted.library.mesh.MeshBase;
 import org.distorted.library.mesh.MeshFile;
-import org.distorted.library.mesh.MeshTriangle;
+import org.distorted.library.mesh.MeshPolygon;
 import org.distorted.library.type.DynamicQuat;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
+import org.distorted.examples.meshfile.FactoryCubit;
 
 import java.io.DataInputStream;
 import java.io.IOException;
@@ -260,6 +259,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
 
   private MeshBase createStaticMesh()
     {
+    /*
     MeshBase triangle = new MeshTriangle(5);
 
     VertexEffectMove move = new VertexEffectMove( new Static3D(1,0,0) );
@@ -271,6 +271,60 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
     triangle.apply(scale);
 
     return triangle;
+     */
+/*
+    final float DIST  = 0.2f;
+    float[] vertices = new float[6];
+
+    vertices[0] =  0.5f-DIST;
+    vertices[1] = -0.5f-DIST;
+
+    vertices[2] =  0.5f-DIST;
+    vertices[3] =  0.5f-DIST;
+
+    vertices[4] = -0.5f-DIST;
+    vertices[5] =  0.5f-DIST;
+
+    float[] bands0 = new float[] {1.0f, 0.0f, 0.5f, 0.03f, 0.0f, 0.05f};
+
+    MeshBase mesh = new MeshPolygon(vertices,bands0,0,0);
+    mesh.setShowNormals(true);
+
+    return mesh;
+    */
+
+    final float IVY_D = 0.10f;
+    final int   IVY_N = 8;
+
+    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[] bands = new float[] {1.0f, 0.0f, 0.5f, 0.03f, 0.0f, 0.05f};
+
+    MeshBase mesh = new MeshPolygon(vertices,bands,0,0);
+    mesh.setShowNormals(true);
+
+    return mesh;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
