Assignment: Convex hull with Graham's scan

Write code in C/C++ to compute the convex hull of a set of points in 2D using Graham's scan.

Base code is provided here, and you'll also receive it on GitHub. There are two versions of the code: one in c and and one in cpp. This code should compile as is, and it provides the interface. You will need to:

  1. Fill in the graham_scan function (and anything else that may be necessary to make it all work).

  2. Come up with an interesting (and not trivial) configuration of points on which to compute the hull, and write the corresponding initializer function.

  3. Post your special initialier function to the whole class using piazza.

  4. Include everyone's test cases in your code (and of course, check that it works).

  5. Share on piazza anything that you learn while working on the project, so that the whole class can benefit.

Work in style

As usual, you need to strive you write not merely code, but simple, elegant and easy to understand code. Furthermore, you need to strive to do this out of habit, as you start programming, and not only at the end. Writing good code has to become your second nature. Write good code not because you have to, but because you don't know any other way.

People often disagree what consitutues elegant when it comes to coding, but everyone agrees on the following:

How do you know if you write good code? My theory is that the the quality of your code is directly proportional to how easy and enjoyablet is to debug and update/extend your code. If you find debugging is frustrating and like searching a needle in a haystack, then your code style is probably not that good.

What and how to turn in

You will receive the assignment on GitHub, including the startup code. You are encouraged to do pair-programming, but feel free to work alone. Push your code into your github repository for this assignment. Provide a README that describe the state of your code (does it work on all test cases, do you know of any bugs, any extra features).

Enjoy!


Last modified: Mon Mar 28 18:26:56 EDT 2016