next up previous contents
Next: Spiral running from pole Up: Representation of a sphere Previous: Representation of a sphere   Contents

Spherical grid

Figure: Sphere represented by its latitude-longitude grid
\begin{figure}\begin{picture}(290,210)(-60,0)
\epsffile{fig1.eps}\end{picture}\end{figure}

The most recognizable presentation of a sphere is to draw its grid of latitudes and longitudes, which can be as sparse as simply showing the equator and Greenwich meridian (and antimeridian).

/* geosg - represent a sphere by latitude and longitude */

geosg(r0,r,a0,m,l) double *r0, r, *a0; int m, l; {
int    i, j;
double th, ph, dt, dp, y0;
double o[3][3], w[3];

y0=r0[1];
spheu(o,a0);
dt=3.14159/((double)(l+1));
dp=0.0628318;
th=3.14159-dt;
for (i=0; i<l; i++,th-=dt) {
  ph=0.0;
  sphrv(w,r,th,ph);
  sphap(w,o,w,r0);
  pltms(w[0],w[2],0);
  for (j=0; j<100; j++) {
    ph+=dp;
    sphrv(w,r,th,ph);
    sphap(w,o,w,r0);
    pltms(w[0],w[2],w[1]>=y0);
    }}
dt=0.0628318;
dp=3.14159/((double)m);
for (i=0,ph=0.0; i<m; i++,ph+=dp) {
for (j=0,th=0.0; j<100; j++) {
  th+=dt;
  sphrv(w,r,th,ph);
  sphap(w,o,w,r0);
  pltms(w[0],w[2],w[1]>=y0);
  }}
}



Pedro Hernandez 2004-05-13