The final project is open-ended. Pick something that you like and/or you want to learn more about. You can choose to work alone or in a team of two people (if you work in a team the amount of work for the project should scale up accordingly). A list of topics is suggested below. If you have any other ideas you have to run them by me.

Note: "final" in "final project" should read as "final=the last one". It does not mean that it has to be bigger or that it is more important than Project 1 or 2. All the project ideas listed below are doable in 10 days of work. This time there is no extension! it has to be ready by the due date. We want to end the semester on a positive note! So manage your time carefully and start working asap (please no segfaults the night before it's due..)

**Extending flow modeling on grids: computing watersheds.**

The watershed`W(x)`

of a point`x`

in the grid is the set of points in the grid that flow to point`x`

. Assume you start with given elevation, flow direction and flow accumulation grids. The first part of this project is to compute and display the watershed of an arbitrary point in the grid. The second part is to ask the user for a threshold value`r`

and compute the watersheds of all points with flow accumulation larger than`r`

. For a given`r`

, this defines a partition of the terrain into watersheds. As this threshold increases, the number of watersheds goes down and the size of each watershed goes up.**Extending terrain simplification (refinement) to incorporate Delaunay triangulation.**

You noticed that your terrain simplification program (Project 2) produces many skinny triangles. In general these triangles are undesirable for various reasons. Of all possible triangulations of a point set, the one which maximizes the minimum angle of any triangle is the Delaunay triangulation (DT). Extend your terrain simplification project to use Delaunay triangulations. Use the same approach as the incremental construction of DT algorithm discussed in class: after inserting a point into a triangle, check whether the 3 new triangles are locally Delaunay and if not flip the edge; repeat until there are no more suspicious triangles.**Terrain simplification for very large datasets.**

Start by doing an experimental analysis of the performance of your improved terrain simplification algorithm (Project 2) on large datasets (do not lose your patience -- let it run overnight!!) Why does this happen? Analyze the I/O-complexity of your algorithm. Design a new algorithm for large datasets and analyze its I/O-complexity. Implement it and analyse its scalability experimentally.**Visualize and simplify site (LIDAR) data.**

This is essentially terrain simplification, but instead of starting with a grid, it starts from a site dataset. A site dataset is a set of sites (points) (x,y,z), that is, each point comes with its coordinates (x,y) and height z. While remote sensing devices normally produce terrain data in grid form, the more recent LIDAR technology samples elevation data at random points resulting in these very accurate (1m resolution) unevennly distributed site datasets. The first part is to write functions to read a site dataset from a file, load it into memory, and render it. The second part is to extend your terrain simplification program to handle these points (which are distributed arbitrarily in space, therefore you cannot store them in a 2Darray). The last part is to save the simplified site dataset to a file to disk (same format as the input).**Computing contour lines on grids.**

The program should work two ways: (1)Contours are produced from a user-specified list of levels. (2) Contours are produced at some regular increment from user-specified minimum level to maximum level. If no minimum or maximum level is specified, use minimum or maximum data values. You can chose to do (1) or (2) or both. In either case, display the contour lines on top of the grid.**Computing contour lines on TINs.**

Same as above, except that the input is a TIN instead of a grid. I am mainly interested in having something that runs, so you can use the bruteforce approach (check each triangle). If you want to implement the interval tree that would be great, but have it working first. To try out your algorithm, you'll have to produce a couple of TIN datasets. Decide on a data format for a TIN and save the output of your terrain simplificaton angorithm to a file in this format; then run the terrain simplification algoritmhm on a couple of datasets to produce corresponding TIN datasets.**Graphics: lighting and animation effects; texture mapping; rendering photos (pgm format).**

Playing with new features in OpenGL is always fun!! (but don't expect me to know all the answers :) ). For instance, you can load textures onto the terrain and play with lighting.For lighting, you'll need to specify the direction of the normal to the surface in each point. You can easily compute the normal to a point using the equation of the plane that goes through the triangle, the problem is that a vertex may be part of several triangles, and in each one it will have a different normal. This will look really bad (try it!). In order to get good lighting effects you have to compute the normal to a point basically by averaging all normals in all the triangles that contain that point. In this way a point will have the same normal in each triangle. This comes down to figuring out the neighboring triangles of a point in a grid (TIN). The elegant way would be to build a TIN from the grid that stores also the topology, not just coordinates---i.e. for each vertex the list of triangles that contain it.

Another idea is to extend your grid visualization to handle pgm picture format. This format is very similar to the ArcAscii grid format: the picture is stored as a list of say 640 by 480 pixels, each of which has an associated value in the range 0-255, representing its color. Here is an example: pic1.pgm. You can read in a picture just like you read a grid and render it in 3D by interpreting the color as height. Of course it wil not look good since the color is not continuous. Then scale it down (the multiply function) and watch how it starts to resemble a picture.

Another idea is to implement a fancier animation through the terrain (fly-through?). Or try to obtain a rain effect by having drops (circles) start out of each grid point and flow downhill using the flow directions.

**Line-segment intersection (Bentley-Ottmann sweep).**

Implement the Bentley-Ottmann sweep algorithm to detect the intersection points of a set of segments in 2D. The main goal is to have something working, which you can then refine if there is time left. I would suggest starting with a simple linked list to store the segments intersected by a sweep line (rather then a balanced binary tree). Be ready to be ableto generate your own datasets to test your program.**Triangulation (meshing) using quadtrees.**

The input to this project will be a set of points (either a site dataset, or a set of points representing a simplified grid---the output of the terrain simplification project). Assume the set of points is in 2D. Given this set of points, build a quadtree and use it to triangulate the set of points as follows: Once you get down to a cell that contains only one point, draw a horizontal and vertical line through the point and add a diagonal in each of the resulting 8 rectangles. If a cell is empty draw a diagonal and split it into two triangles. The resulting triangulation will look like a grid, just that the resolution of the grid (the distance between points) will vary according to the distribution of the points. Note that, for each cell (leaf) in the quadtree, you will add its 4 corner points to the triangulation. This is different than what we have seen in class, where the triangulation was not allowed to contain new points. The advantage is that the resulting triangulation is a hybrid between grids and TINs.**Computing the convex hull of a set of points in 2D**

Implement any of the algorithms discussed in class for computing the convex of a set of points in 2D.