commit 231771f321397f9c235a57776ccd4db89123f3b9
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed Sep 9 01:58:02 2020 +0100

    Convert RubikPyraminx to the new MeshPolygon - better quality of the mesh and less vertices!

diff --git a/src/main/java/org/distorted/objects/RubikCube.java b/src/main/java/org/distorted/objects/RubikCube.java
index 6941ea70..e5539f5c 100644
--- a/src/main/java/org/distorted/objects/RubikCube.java
+++ b/src/main/java/org/distorted/objects/RubikCube.java
@@ -205,8 +205,8 @@ class RubikCube extends RubikObject
     switch(size)
       {
       case 2 : bands = new float[] { 1.0f    ,-D,
-                                     1.0f-D/2,-D*0.45f,
-                                     1.0f-D  ,-D*0.80f,
+                                     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 };
diff --git a/src/main/java/org/distorted/objects/RubikPyraminx.java b/src/main/java/org/distorted/objects/RubikPyraminx.java
index f8720453..6e159074 100644
--- a/src/main/java/org/distorted/objects/RubikPyraminx.java
+++ b/src/main/java/org/distorted/objects/RubikPyraminx.java
@@ -27,13 +27,12 @@ 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.effect.VertexEffectSink;
 import org.distorted.library.main.DistortedEffects;
 import org.distorted.library.main.DistortedTexture;
 import org.distorted.library.mesh.MeshBase;
 import org.distorted.library.mesh.MeshJoined;
+import org.distorted.library.mesh.MeshPolygon;
 import org.distorted.library.mesh.MeshSquare;
-import org.distorted.library.mesh.MeshTriangle;
 import org.distorted.library.type.Static1D;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
@@ -253,10 +252,50 @@ public class RubikPyraminx extends RubikObject
     final float angleFaces = (float)((180/Math.PI)*(2*Math.asin(SQ3/3))); // angle between two faces of a tetrahedron
     final int MESHES=4;
 
+    int size = getSize();
+
     int association = 1;
-    MeshBase[] meshes = new MeshTriangle[MESHES];
+    MeshBase[] meshes;
+
+    float D = 0.01f;
+    float E = 0.5f - D*SQ2;
+    float F = 0.5f - D*SQ2*SQ3;
+    float[] bands;
+    int extraI, extraV;
+
+    float[] vertices = { -F,-E, +F,-E, 0.0f,E-D*SQ2};
+
+    switch(size)
+      {
+      case 3 : bands = new float[] { 1.0f    ,-D,
+                                     1.0f-D/2,-D*0.55f,
+                                     1.0f-D  ,-D*0.25f,
+                                     1.0f-2*D,+D*0.25f,
+                                     0.50f, 0.050f,
+                                     0.0f, 0.055f };
+                      extraI = 2;
+                      extraV = 2;
+                      break;
+      case 4 : bands = new float[] { 1.0f    ,-D,
+                                     1.0f-D*1.2f,-D*0.55f,
+                                     1.0f-2*D, +D*0.25f,
+                                     0.50f, 0.050f,
+                                     0.0f, 0.055f };
+                      extraI = 2;
+                      extraV = 2;
+                      break;
+      default: bands = new float[] { 1.0f    ,-D,
+                                     1.0f-D*1.2f,-D*0.55f,
+                                     1.0f-2*D, +D*0.25f,
+                                     0.50f, 0.050f,
+                                     0.0f, 0.055f };
+                      extraI = 2;
+                      extraV = 1;
+                      break;
+      }
 
-    meshes[0] = new MeshTriangle(9);
+    meshes = new MeshPolygon[MESHES];
+    meshes[0] = new MeshPolygon(vertices, bands, extraI,extraV);
     meshes[0].setEffectAssociation(0,association,0);
 
     for(int i=1; i<MESHES; i++)
@@ -298,9 +337,6 @@ public class RubikPyraminx extends RubikObject
     Static3D center1= new Static3D(0,-SQ3*SQ2/12,-SQ3/6);
     Static3D center2= new Static3D(0,-SQ3*SQ2/12,+SQ3/3);
 
-    Static3D center = new Static3D(0,0,0);
-    Static4D region = new Static4D(0,0,0,0.6f);
-
     VertexEffectScale   effect1 = new VertexEffectScale ( new Static3D(1,SQ3/2,1) );
     VertexEffectRotate  effect2 = new VertexEffectRotate( new Static1D(90), new Static3D(1,0,0), new Static3D(0,0,0) );
     VertexEffectMove    effect3 = new VertexEffectMove  ( new Static3D(0,-SQ3*SQ2/12,SQ3/12) );
@@ -314,8 +350,6 @@ public class RubikPyraminx extends RubikObject
     VertexEffectDeform  effect10= new VertexEffectDeform(dVec2, dRad, dCen2, dReg);
     VertexEffectDeform  effect11= new VertexEffectDeform(dVec3, dRad, dCen3, dReg);
 
-    VertexEffectSink    effect12= new VertexEffectSink( new Static1D(1.3f), center, region );
-
     effect4.setMeshAssociation(14,-1);  // apply to mesh[1], [2] and [3]
     effect5.setMeshAssociation( 2,-1);  // apply only to mesh[1]
     effect6.setMeshAssociation( 4,-1);  // apply only to mesh[2]
@@ -332,7 +366,6 @@ public class RubikPyraminx extends RubikObject
     result.apply(effect9);
     result.apply(effect10);
     result.apply(effect11);
-    result.apply(effect12);
 
     if( mRotArray[cubit]>=0 )
       {
