commit a76cc4f49ddeb23c645be7e69071f9df95baac8a
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Mar 21 22:26:02 2022 +0100

    Progress with BandagedCreator.

diff --git a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
index 780d06e7..c8974f26 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
@@ -38,6 +38,7 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
    private final GLSurfaceView mView;
    private final DistortedScreen mScreen;
    private final Static3D mScale;
+   private final Static3D[] mMove;
 
    private final float[][] POSITIONS = new float[][]
         {
@@ -87,13 +88,16 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
      mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
      mScale= new Static3D(1,1,1);
 
-     BandagedCubit cubit = new BandagedCubit(POSITIONS[0], mQuat1, mQuat2, mScale);
-     DistortedNode node = cubit.getNode();
-     mScreen.attach(node);
+     int len = POSITIONS.length;
+     mMove = new Static3D[len];
+
+     for(int i=0; i<len; i++) mMove[i] = new Static3D(0,0,0);
+
+     BandagedCubit[] cubits = createCubits();
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
-/*
+
    private BandagedCubit[] createCubits()
      {
      int len = POSITIONS.length;
@@ -101,14 +105,36 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
 
      for(int c=0; c<len; c++)
        {
-       cubits[c] = new BandagedCubit(POSITIONS[c],mQuat1,mQuat2,mScale);
+       computeMove(mMove[c],POSITIONS[c]);
+       cubits[c] = new BandagedCubit(POSITIONS[c],mQuat1,mQuat2,mMove[c],mScale);
        DistortedNode node = cubits[c].getNode();
        mScreen.attach(node);
        }
 
      return cubits;
      }
-*/
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    private void computeMove(Static3D move, float[] position)
+      {
+      int numCenters = position.length/3;
+      float totalX=0.0f, totalY=0.0f, totalZ=0.0f;
+
+      for(int center=0; center<numCenters; center++)
+        {
+        totalX += position[3*center  ];
+        totalY += position[3*center+1];
+        totalZ += position[3*center+2];
+        }
+
+      totalX /= numCenters;
+      totalY /= numCenters;
+      totalZ /= numCenters;
+
+      move.set(totalX,totalY,totalZ);
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
    @Override
@@ -123,8 +149,19 @@ public class BandagedCreatorRenderer implements GLSurfaceView.Renderer, Distorte
    @Override
    public void onSurfaceChanged(GL10 glUnused, int width, int height)
       {
-      final float Q = 0.3f;
-      final float scale = width<height ? Q*width : Q*height;
+      final float Q = 0.15f;
+      float scale = width<height ? Q*width : Q*height;
+
+      int len = POSITIONS.length;
+
+      for(int i=0; i<len; i++)
+        {
+        float x = mMove[i].get0();
+        float y = mMove[i].get1();
+        float z = mMove[i].get2();
+
+        mMove[i].set(x*scale,y*scale,z*scale);
+        }
 
       mScale.set( scale,scale,scale );
       mScreenMin = Math.min(width, height);
diff --git a/src/main/java/org/distorted/bandaged/BandagedCubit.java b/src/main/java/org/distorted/bandaged/BandagedCubit.java
index 97f5d708..2783a2e8 100644
--- a/src/main/java/org/distorted/bandaged/BandagedCubit.java
+++ b/src/main/java/org/distorted/bandaged/BandagedCubit.java
@@ -42,32 +42,11 @@ public class BandagedCubit
     private final MeshBase mMesh;
     private final float[] mPosition;
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    private Static3D computeMove(float[] position)
-      {
-      int numCenters = position.length/3;
-      float totalX=0.0f, totalY=0.0f, totalZ=0.0f;
-
-      for(int center=0; center<numCenters; center++)
-        {
-        totalX += position[3*center  ];
-        totalY += position[3*center+1];
-        totalZ += position[3*center+2];
-        }
-
-      totalX /= numCenters;
-      totalY /= numCenters;
-      totalZ /= numCenters;
-
-      return new Static3D(totalX,totalY,totalZ);
-      }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public BandagedCubit(float[] position, Static4D quat1, Static4D quat2, Static3D scale)
+    public BandagedCubit(float[] position, Static4D quat1, Static4D quat2, Static3D move, Static3D scale)
       {
       mPosition = position;
 
@@ -77,18 +56,16 @@ public class BandagedCubit
       mTexture = new DistortedTexture();
       mTexture.setColorARGB(0xffffff55);
 
-      Static3D move = computeMove(position);
-
       MatrixEffectScale scaleEffect = new MatrixEffectScale(scale);
-      MatrixEffectQuaternion quat1Effect = new MatrixEffectQuaternion(quat2, CENTER);
-      MatrixEffectQuaternion quat2Effect = new MatrixEffectQuaternion(quat1, CENTER);
+      MatrixEffectQuaternion quat1Effect = new MatrixEffectQuaternion(quat1, CENTER);
+      MatrixEffectQuaternion quat2Effect = new MatrixEffectQuaternion(quat2, CENTER);
       MatrixEffectMove moveEffect = new MatrixEffectMove(move);
 
       mEffects = new DistortedEffects();
-      mEffects.apply(quat1Effect);
-      mEffects.apply(quat2Effect);
       mEffects.apply(scaleEffect);
       mEffects.apply(moveEffect);
+      mEffects.apply(quat2Effect);
+      mEffects.apply(quat1Effect);
 
       mNode = new DistortedNode(mTexture,mEffects,mMesh);
       }
