Assignment 2: Convex hull with Graham's scan

In this assignment you will write code to find the convex hull of a set of points (in 2D) using Graham's scan. You will receive starter code on Github which contains two versions: one in c and and one in cpp. The code should compile as is, and provides the graphical interface.

What you need to do:

  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 configuration of points on which to compute the hull, and write the corresponding initializer function. It can be easy, but should not be trivial. Post your special initialier function to the whole class (maybe on Slack).

  3. Include your classmates test cases in your code.

Work in style

As usual, you need to strive to write not just code, but code that is simple, elegant and easy to understand. Furthermore, you need to strive to do this out of habit, as you start, and not only at the end as an afterthought. Writing good code has to become your second nature. Write good code not because I tell you to do it, but because you don't know any other way. Just do it.

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 enjoyable is to debug and update/extend your code. If you find debugging is frustrating and exhausting and like searching for a needle in a haystack... then your style needs to improve. Programming is supposed to be fun.

Pair programming

You are encouraged to find a partner and work as a team (make sure you read and follow the pair-programming policy on class website). But if you would rather work alone, or if you don't know anyone in the class yet --- that's totally fine, work alone.

What and how to turn in

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

Enjoy!


Last modified: Wed Sep 22 12:58:43 EDT 2021