next up previous
Next: t_see_world Up: t_see_world Previous: t_see_world

0. Project specifications
Target due date
: Monday, February 25 with a team notification deadline of Wednesday, February 13 (see below).

Points
: This project is worth 5 points.

Teams
: You are encouraged to work with a partner as a two-person team. One of you should be ``project leader'' and the other, ``project staff''. As a comment in your program, please say who is which. It is the leader's responsibility to submit the project. If you don't have a partner, let me know and I'll help to arrange something. Please send me email by Wednesday, February 13 saying who your partner is.

Language
: For this project, you need a high-level language such as C, C++, or Java, to produce an output file in a simple format, which is then plotted by a program to be provided to you. This description is for C++ on the Windows NT network. Other options are possible.

Submitting your program
: The project leader should submit the source file (the .cpp file for C++). Use the usual submit folder, under the name of seeworld.cpp .

Grading
: As usual, grading will be pass/fail. However, if your program is well organized and well documented, with good variable names and good use of vectors and matrices, I'll make a note of it for writing recommendations later.

Description, in outline
: Imagine the earth as a unit sphere centered at the origin, with the north pole at $ (0,0,1)$ and the $ x$-axis going through the point with latitude $ 0^\circ$ and longitude $ 0^\circ$.

Input file
: This is the file H:\class\m149.1\continents.dat, which describes the outlines of the continents. Each line of this data file has three numbers for one data point. The first number is 0 or $ 1$, where $ 1$ means the point is connected to the previous point and 0 means it is not connected. The second number is the latitude of the point in degrees; the third is the longitude in degrees.
0 18.6 120.7
1 18.5 121.4
1 18.5 122.2
...

Output file
: The output file should be in a very simple form, which we may call the ``ez format'' (ez = easy): Each nonblank line of the output file contains just two numbers representing $ x$ and $ y$ for one point. A blank line means not to connect the preceding point to the following point; otherwise, consecutive lines represent points that are intended to be drawn connected. It is suggested that your output file be named earth.ez .

Arguments
(latitude and longitude of the viewpoint in degrees): The user should be able to enter these at the time the program is run. One good way is to use command-line arguments, so that the user would type the command line

seeworld.exe 30 -90 < continents.dat > earth.ez

(for example). Below is a discussion of just how to access such arguments in your program.

Another way is to have your program prompt the user for these arguments and read them in from standard input. The only disadvantage is that then you can't use standard input and output for the data files in and out; instead, you will need to build the names of those files into the program and open them for reading and writing.

Getting the relevant files
: From the folder H:\class\m149.1\lab2 you will need the files continents.dat and ez2gs.cmd; it would be easiest first to make shortcuts to these files from your own folder, the one in which you are working. (To make a shortcut, use Windows NT Explorer to go to the folder, use the right mouse button to make a copy, go to your working folder, and use the right mouse button to ``paste shortcut''.)

Getting a command line
: From the Start menu, get the Programs menu, and then click on Command Prompt. If your working folder is m149\lab2 in your home folder, type cd m149\lab2 . Then you can run commands as described.

Viewing your output
: Assuming you have made shortcuts as recommended and have generated the output file earth.ez, you can generate the graphic output by the command ez2gs.exe earth.ez on the command line. To center the picture you may need to use the horizontal and vertical scroll bars.

Summary of steps
: (Let's assume command-line arguments are used.)
Step S-0.
Make the shortcuts described above.

Step S-1.
Make your program source file, which on NT should be called seeworld.cpp.

Step S-2.
Compile your source file to make a binary file called seeworld.exe.

Step S-3.
To view the earth from the viewpoint above the point with latitude $ 30 ^\circ$ and longitude $ -90 ^\circ$, generate an output data file earth.dat by using the DOS command

seeworld.exe 30 -90 < continents.dat > earth.ez

Step S-4.
View the file using the DOS command

ez2gs.exe earth.ez

After a wait for processing the file, you will get a drawing window in which the picture will be shown.

Avoiding confusion about angles
: There are two separate uses of latitude and longitude in this program: (1) to give the direction of viewing and (2) to give the location of each point in the data file. In the first case, you'll be using the angles to make a rotation matrix; in the second case, you'll be using them to find the Cartesian coordinates of each point in R$ ^
3$. In both cases, you will need to change the angles to radians before doing anything with them. Use descriptive variable names to distinguish uses.

Remember, the latitude of a point on the earth is the angle up from the equator, as seen from the center of the earth, and the longitude is the angle east of a line that runs from pole to pole through Greenwich, England.


next up previous
Next: t_see_world Up: t_see_world Previous: t_see_world
Kirby A. Baker 2002-02-21