public Point3[,] SphereCoordinates()
        {
            Point3[,] pts = new Point3[30, 20];
            Matrix3 m = new Matrix3 ();
            Matrix3 mt = Matrix3.Translate3 (xc, yc, zc);

            for (int i = 0; i < pts.GetLength(0); i++) {
                for (int j = 0; j < pts.GetLength(1); j++) {
                    pts [i, j] = m.Spherical (r, i * 180 / (pts.GetLength (0) - 1),
                        j * 360 / (pts.GetLength (1) - 1));
                    pts [i, j].Transform (mt);
                }
            }
            return pts;
        }
 public Point3 Spherical(float r, float theta, float phi)
 {
     Point3 pt = new Point3 ();
     float snt = (float)Math.Sin (theta * Math.PI / 180);
     float cnt = (float)Math.Cos (theta * Math.PI / 180);
     float snp = (float)Math.Sin (phi * Math.PI / 180);
     float cnp = (float)Math.Cos (phi * Math.PI / 180);
     pt.X = r * snt * cnp;
     pt.Y = r * cnt;
     pt.Z = -r * snt * snp;
     pt.W = 1;
     return pt;
 }
 public Point3 Cylindrical(float r, float theta, float y)
 {
     Point3 pt = new Point3 ();
     float sn = (float)Math.Sin (theta * Math.PI / 180);
     float cn = (float)Math.Cos (theta * Math.PI / 180);
     pt.X = r * cn;
     pt.Y = y;
     pt.Z = -r * sn;
     pt.W = 1;
     return pt;
 }