Index: src/Shapes/BaseShapes.cpp
===================================================================
--- src/Shapes/BaseShapes.cpp	(revision b98a32c9973063fcbc69b436a08b1405b9df5ce1)
+++ src/Shapes/BaseShapes.cpp	(revision 12584104d42ac2cc27fdf050a70dd8c1a2141b7e)
@@ -98,44 +98,47 @@
 {
   std::vector<Vector> PointsOnSurface;
-
-    double PI=3.14159265358979323846;
-    double a=4*PI/N;
+  if (true) {
+    // Exactly N points but not symmetric.
+
+    // This formula is derived by finding a curve on the sphere that spirals down from
+    // the north pole to the south pole keeping a constant distance between consecutive turns.
+    // The curve is then parametrized by arch length and evaluated in constant intervals.
+    double a = sqrt(N) * 2;
+    for (int i=0; i<N; i++){
+      double t0 = ((double)i + 0.5) / (double)N;
+      double t = (sqrt(t0) - sqrt(1.0 - t0) + 1.0) / 2.0 * M_PI;
+      Vector point;
+      point.Zero();
+      point[0] = sin(t) * sin(t * a);
+      point[1] = sin(t) * cos(t * a);
+      point[2] = cos(t);
+      PointsOnSurface.push_back(point);
+    }
+    ASSERT(PointsOnSurface.size() == N,
+        "Sphere_impl::getHomogeneousPointsOnSurface() did not create "
+        +::toString(N)+" but "+::toString(PointsOnSurface.size())+" points.");
+  } else {
+    // Symmetric but only approximately N points.
+    double a=4*M_PI/N;
     double d= sqrt(a);
-    int Mtheta=int(PI/d);
-    double dtheta=PI/Mtheta;
+    int Mtheta=int(M_PI/d);
+    double dtheta=M_PI/Mtheta;
     double dphi=a/dtheta;
     for (int m=0; m<Mtheta; m++)
     {
-  	  double theta=PI*(m+0.5)/Mtheta;
-  	  int Mphi=int(2*PI*sin(theta)/dphi);
-  	  for (int n=0; n<Mphi;n++)
-  	  {
-  		  double phi= 2*PI*n/Mphi;
-  		  Vector point;
-  		  point.Zero();
-  		  point[0]=sin(theta)*cos(phi);
-  		  point[1]=sin(theta)*sin(phi);
-  		  point[2]=cos(theta);
-  		  PointsOnSurface.push_back(point);
-  	  }
-    }
-  /*const double dlength = M_PI*(3.-sqrt(5.));
-  double length = 0;
-  const double dz = 2.0/N;
-  double z = 1. - dz/2.;
-  Vector point;
-  for (size_t ka = 0; ka<N; ka++){
-    const double r = sqrt(1.-z*z);
-    point.Zero();
-    point[0] = cos(length)*r;
-    point[1] = sin(length)*r;
-    point[2] = z;
-    PointsOnSurface.push_back(point);
-    z = z - dz;
-    length = length + dlength;*/
-
-//  ASSERT(PointsOnSurface.size() == N,
-//      "Sphere_impl::getHomogeneousPointsOnSurface() did not create "
-//      +::toString(N)+" but "+::toString(PointsOnSurface.size())+" points.");
+      double theta=M_PI*(m+0.5)/Mtheta;
+      int Mphi=int(2*M_PI*sin(theta)/dphi);
+      for (int n=0; n<Mphi;n++)
+      {
+        double phi= 2*M_PI*n/Mphi;
+        Vector point;
+        point.Zero();
+        point[0]=sin(theta)*cos(phi);
+        point[1]=sin(theta)*sin(phi);
+        point[2]=cos(theta);
+        PointsOnSurface.push_back(point);
+      }
+    }
+  }
   return PointsOnSurface;
 }
Index: src/Shapes/unittests/BaseShapesUnitTest.cpp
===================================================================
--- src/Shapes/unittests/BaseShapesUnitTest.cpp	(revision b98a32c9973063fcbc69b436a08b1405b9df5ce1)
+++ src/Shapes/unittests/BaseShapesUnitTest.cpp	(revision 12584104d42ac2cc27fdf050a70dd8c1a2141b7e)
@@ -652,9 +652,12 @@
 void BaseShapesTest::PointsOnSurfaceTest(){
   Shape s = Sphere();
-  const size_t N = 200;
-  std::vector<Vector> PointsOnSurface = s.getHomogeneousPointsOnSurface(N);
-  for (std::vector<Vector>::const_iterator iter = PointsOnSurface.begin(); iter != PointsOnSurface.end(); ++iter) {
-    CPPUNIT_ASSERT(fabs(1. - (*iter).NormSquared()) < MYEPSILON);
+  for (size_t N = 20; N <=200; N+= 45) {
+    std::vector<Vector> PointsOnSurface = s.getHomogeneousPointsOnSurface(N);
+    for (std::vector<Vector>::const_iterator iter = PointsOnSurface.begin(); 
+        iter != PointsOnSurface.end(); 
+        ++iter) {
+      CPPUNIT_ASSERT(fabs(1. - (*iter).NormSquared()) < MYEPSILON);
+    }
+    CPPUNIT_ASSERT_EQUAL( N, PointsOnSurface.size());
   }
-  CPPUNIT_ASSERT_EQUAL((size_t)194, PointsOnSurface.size());
 }
