CE325 Assignment 1

A few years ago, a colleague and I developed a 3D model of the entire University campus in VRML. It was one of the first VRML models of significance to appear, within a week or so of the VRML specificaton. (If you have a suitable viewer, the model is still viewable.)

One feature of the model was a representation of the humps and hollows of the land around the campus, a digital elevation model or DEM. This was obtained by reading the height of the ground from a map of the campus at 12.5-metre intervals, resulting in the values

 14  25  45  55  68  70  84  91  97 101 105 105 105 105 110 110 110 110 110 110 110 
  5  18  43  62  73  82  88  94  99 102 105 105 105 105 110 110 110 110 110 110 110
  5  18  38  56  69  77  86  94  99 103 106 105 105 105 110 110 110 110 110 110 110
  5   9  31  48  60  71  81  87  95 101 106 105 105 105 110 110 110 110 110 110 110
  5   5  18  37  49  56  62  81  91  94 101 105 105 105 110 110 110 110 110 110 110
  5   5  12  23  34  40  53  66  77  82  97 103 105 105 109 110 110 110 110 115 115
  4   5   8  15  20  24  35  39  40  77  92 101 104 104 105 110 110 110 115 115 115
  5   7  22  36  46  48  48  44  50  58  80  96  96  97 106 110 110 115 115 115 115
  4  15  31  46  61  68  69  63  53  50  67  82  84 103 108 110 110 115 115 115 115
  4  12  31  46  64  78  82  80  69  54  73  71  92 105 108 110 110 115 115 115 115
  6  26  35  45  63  75  84  87  84  74  77  80  96 103 108 110 110 110 115 115 115 
 21  30  46  57  64  76  85  92  92  87  79  80  86 102 106 110 105 110 115 115 115
 27  40  48  62  75  84  92  96  97  94  88  80  80  91 104 105 105 105 110 115 115
 33  43  55  65  75  87  96 101 101 101  97  92  80  80  98 105 105 105 105 110 115
 45  50  58  68  80  91  99 102 105 105 105  99  90  80  80  97 105 105 105 110 100
 50  60  65  71  84  95 101 105 105 107 107 106 102 101  92  80  98 104 105 100 100
 60  70  76  83  88  96 103 106 107 108 110 109 108 108 106 101  90 100 100 100 100
which define a mesh of 20 × 16 quadrilaterals. The buildings around the campus were superimposed on this DEM, as the following image shows. (You will see how many new buildings have appeared in the intervening years.)

Your tasks are as follows:

  1. Download the file dem.dat, which contains the grid of values and a "header" consisting of the number of height values per line and the number of lines.
  2. Write a program that reads in the data from dem.dat and produces a visualization of the DEM using OpenGL. The scene should be coloured and feature hidden-surface removal and lighting. It must be possible to move the viewpoint around the model using the keyboard and mouse, and your program must output (to the terminal window, using printf or equivalent) instructions on how to control the viewpoint.

    You might like to install and try out a VRML viewer to see how they allow the viewpoint to be controlled, or you may like to think about how games allow the viewpoint to move. The important point is that you allow the user to move around the model and see it from all directions.

  3. Very few of the quadrilaterals resulting from neighbouring spot-heights will be planar, so your program should where necessary split quadrilaterals into triangles. You are welcome discuss with a demonstrator how to determine whether a quadrilateral is planar.

Your program may be written in any of C, C++, Java or Python and must run on the machines in the CSEE Computer Labs under Linux. If you use Java or Python, you need to discuss with the module supervisor any package you would like to use to wrap around OpenGL before writing your program.

Programs written in C, C++ or Java must have an associated Makefile to build the executable. When you upload your submission to the coursework server, you must also upload any Makefile and support files required — the intention is that one need type only

  make
  ./ass1 dem.dat
to compile and execute your assignment.

Your program should be well-structured and well-commented in accordance with good software engineering practice, and conform to the following style:

Your program will be printed using the Linux command

  enscript -E -G -j -MA4
and this paper copy is what will be marked. You should ensure your code looks sensible in terms of line length and indentation when printed in this way. Feedback will be given using a mark-sheet similar to this one and with annotations on your listing. Please read through the accompanying criteria to see where marks are awarded. I am very happy to discuss these criteria with anyone as you work through the assignment.

Summary

Submission deadline: Monday 20th February 2012 at 11:59:59 (just before noon)
What to submit:
  • the source code of your program
  • a Makefile to compile the program
  • any supporting files to compile or run the program
Please submit the files individually, not as a zip-file or similar.
Marks returned: two weeks
Marks breakdown: according to these assessment criteria

Remember to identify your work with your name (family name in UPPER CASE) and your registration number.  The coursework system allows you to upload your work as often as you like, so do keep uploading your files as you develop them.

If you have any queries, please contact Adrian Clark, preferably by email.


© Adrian F. Clark 2011-12