commit bbc58eff8404db82ffb8ea79ca969896e8e405e1
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Mon Dec 17 21:36:44 2018 +0000

    Further fix for the Sphere. Now hopefully only the texture mapping is wrong.

diff --git a/src/main/java/org/distorted/library/mesh/MeshSphere.java b/src/main/java/org/distorted/library/mesh/MeshSphere.java
index f721b4e..75dbcf9 100644
--- a/src/main/java/org/distorted/library/mesh/MeshSphere.java
+++ b/src/main/java/org/distorted/library/mesh/MeshSphere.java
@@ -199,9 +199,19 @@ public class MeshSphere extends MeshBase
     {
     double quotX = (double)column/level;
     double quotY = (double)row   /level;
+    double quotZ;
 
-    double lonPoint = midLongitude(lonV1,lonV2, (quotX+0.5*quotY) );
-    double latPoint = midLatitude(latV12,latV3, quotY);
+    if( latV12*latV3 < 0.0 )  // equatorial triangle
+      {
+      quotZ = quotX + 0.5*quotY;
+      }
+    else                      // polar triangle
+      {
+      quotZ = (quotY==1.0 ? 0.0 : quotX / (1.0-quotY));
+      }
+
+    double lonPoint = midLongitude(lonV1, lonV2, quotZ );
+    double latPoint = midLatitude(latV12, latV3, quotY );
 
     //android.util.Log.e("sphere", "newVertex: long:"+lonPoint+" lat:"+latPoint+" column="+column+" row="+row);
 
