Let's assume you use C++ and call your program
seeworld.cpp
. Also, since in C++ the
coordinates of a point p
are p[0],p[1],p[2]
,
for clarity define x
to be 0
, y
to be
1
, and z
to be 2
, so you can write p[x],p[y],p[z]
for the three coordinates. (But this means you can't use x,y,z
later for other things!)
i
) going from 0
to
60
(say), use it to have a variable t
go from
0
to 2*pi
in 60 steps, and for each value of
t
, output cos(t)
and sin(t)
on one line.
Don't omit the point where i
is
R
taking the viewpoint to
infinity on the
H:\class\m149.1\continents.dat
as a named file.)
R
to get coordinates (say) p[x]
,
p[y]
, p[z]
.
p
is visible from above (i.e.,
if p[z] > 0
) then
p
is not
connected to it, write a blank line.
cout << p[x] << " " << p[y] << endl;
(If p
is hidden, do nothing. If you use nested
if...else{}
's, remember that C and C++
associate the else
with the most recent if
unless you used {
}
blocks.)
p
, to use for the
next point. (Before starting the read-data loop, you'll need to set
this information to ``hidden'' for use by the first data point. Otherwise
the first data point will be plotted connected to the circle!)