commit 0a48b96c25ca352feff5b3fd444adfde52d5c827
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Dec 20 16:49:33 2021 +0100

    Trajber's Octahedron: progress.

diff --git a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
index b067398..a38f24a 100644
--- a/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
+++ b/src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java
@@ -289,7 +289,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
 
     private void createMesh()
       {
-      int mode            =20;
+      int mode            =18;
       int numComponents   = 0;
       float[][] vertices  = null;
       int[][] vertIndexes = null;
@@ -1298,26 +1298,27 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
       else if( mode==18 )
         {
         final float CUT = 1.0f/6;
-        final float LEN = 3*SQ2/2;
+        final float LEN = 1.5f;
 
-        final float A = CUT*LEN;
-        final float B = A-LEN;
+        final float A = SQ2*CUT*LEN;
+        final float B =   2*CUT*LEN;
 
         vertices = new float[][]
           {
-             {    0,    0,    0},
-             {    0,    A,   -A},
-             {    0,   -A,   -A},
-             {    A,    0,   -A},
-             {   -A,    0,   -A},
-             {    A,    A, -2*A},
-             {    A,   -A, -2*A},
-             {   -A,    A, -2*A},
-             {   -A,   -A, -2*A},
-             {    A,    A,    B},
-             {    A,   -A,    B},
-             {   -A,    A,    B},
-             {   -A,   -A,    B}
+             {    0.01f,    0.01f,    0},
+             {    A,    A,   -A},
+             {    A,   -A,   -A},
+             {    B,    0,    0},
+             {    0,    0,   -B},
+             {  A+B,    A,   -A},
+             {  A+B,   -A,   -A},
+             {    A,    A, -A-B},
+             {    A,   -A, -A-B},
+
+             {  LEN      ,    A, SQ2*A-LEN},
+             {  LEN      ,   -A, SQ2*A-LEN},
+             {  LEN-SQ2*A,    A,      -LEN},
+             {  LEN-SQ2*A,   -A,      -LEN}
           };
 
         vertIndexes = new int[][]
@@ -1337,7 +1338,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
          bandIndexes   = new int[] { 0,0,0,0,1,1,1,1,1 };
          corners       = new float[][] { {0.03f,0.10f} };
          cornerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
-         centers       = new float[][] { {0.0f, 0.0f, -LEN/2} };
+         centers       = new float[][] { { LEN/2, 0.0f, -LEN/2} };
          centerIndexes = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
 
          numComponents = 9;
@@ -1348,21 +1349,21 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
       else if( mode==19 )
         {
         final float CUT = 1.0f/6;
-        final float LEN = 3*SQ2/2;
+        final float LEN = 1.5f;
 
-        final float A = CUT*LEN;
-        final float B = A-LEN;
+        final float A = SQ2*CUT*LEN;
+        final float C = LEN-2*LEN*CUT;
 
         vertices = new float[][]
           {
-             {    A-LEN/2,    0,   -A+LEN/2},
-             {    A-LEN/2,    A, -2*A+LEN/2},
-             {    A-LEN/2,   -A, -2*A+LEN/2},
-             {   -B-LEN/2,    0,    B+LEN/2},
-             { -B-A-LEN/2,    A,    B+LEN/2},
-             { -B-A-LEN/2,   -A,    B+LEN/2},
-             {    A-LEN/2,    A,    B+LEN/2},
-             {    A-LEN/2,   -A,    B+LEN/2},
+             {    -C,    0,   0},
+             {  -C+A,    A,  -A},
+             {  -C+A,   -A,  -A},
+             {     C,    0,   0},
+             {   C-A,    A,  -A},
+             {   C-A,   -A,  -A},
+             {     0,    A,  -C},
+             {     0,   -A,  -C},
           };
 
         vertIndexes = new int[][]
@@ -1379,7 +1380,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
         bandIndexes  = new int[] { 0,0,1,1,1,1 };
         corners      = new float[][] { {0.02f,0.10f} };
         cornerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
-        centers      = new float[][] { {-LEN/4, 0, -LEN/4} };
+        centers      = new float[][] { { 0, 0, -LEN/2} };
         centerIndexes= new int[] { 0,0,0,0,0,0,-1,-1 };
 
         numComponents = 9;
@@ -1390,17 +1391,18 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
       else if( mode==20 )
         {
         final float CUT = 1.0f/6;
-        final float LEN = 3*SQ2/2;
+        final float LEN = 1.5f;
 
-        final float A = CUT*LEN;
-        final float B = A-LEN;
+        final float A = SQ2*CUT*LEN;
+        final float C = LEN-2*LEN*CUT;
+        final float L = C-A;
 
         vertices = new float[][]
           {
-             {   A-LEN/3,   A-LEN/3, -2*A+2*LEN/3},
-             {-B-A-LEN/3,   A-LEN/3,    B+2*LEN/3},
-             {   A-LEN/3,-B-A-LEN/3,    B+2*LEN/3},
-             {   A-LEN/3,   A-LEN/3,    B+2*LEN/3},
+             { -L, -(SQ2/3)*L,   L/3 },
+             {  L, -(SQ2/3)*L,   L/3 },
+             {  0,(2*SQ2/3)*L,-2*L/3 },
+             {  0, -(SQ2/3)*L,-2*L/3 },
           };
 
         vertIndexes = new int[][]
@@ -1415,7 +1417,7 @@ class MeshFileRenderer implements GLSurfaceView.Renderer, DistortedLibrary.Excep
         bandIndexes  = new int[] { 0,1,1,1 };
         corners      = new float[][] { {0.02f,0.10f} };
         cornerIndexes= new int[] { 0,0,0,-1 };
-        centers      = new float[][] { {(A-LEN/3)/2 , (A-LEN/3)/2 , (B-LEN/3)/2} };
+        centers      = new float[][] { {0, -(SQ2/3)*L,-2*L/3} };
         centerIndexes= new int[] { 0,0,0,-1 };
 
         numComponents = 9;
