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:
- Fill in the graham_scan function (and anything else that
may be necessary to make it all work).
- Come up with an interesting (and not trivial) configuration of
points on which to compute the hull, and write the corresponding
initializer function.
- Post your special initialier function to the whole class using
piazza.
- Include everyone's test cases in your code (and of course, check
that it works).
- 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:
- structure your code into small functions with intuitive
arguments that allow you to test your code incrementally after every
function you add
- code should be well documented, ideally at block level but
certainly at function level. Every function should have a header
specifying what are the expected input values, what is the return value, and what
does the function actually do.
- no function should be longer than a screen
- code should be accompanied by a README tha details how to run
it, and whether there are any known bugs that the user shoud be
aware of
- [insert here all style guidelines that you know from pevious classes]
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