Computational Geometry
This week, we'll be learning about Computational Geometry, or doing geometric calculations with computers.
The are many interesting, difficult, but always useful algorithms in this field, and many of them show up
in competitions all the time.
-
First, let's review Vector Operations which
are fundamental, yet crucial.
-
Also, look at this video about the Cross Product
which is only applicable in 2 and 3D, but is important in both area calculations and the convex hull.
Don't forget to marvel at that free-drawn hand...
-
Go ahead and write down (or memorize)
Heron's Formula which tends
to show up from time to time.
-
More generically, we have the Shoelace Formula,
which secretly uses the cross product to achieve it's ends. Only read the Intro and Definition, and
then the more complex example to see it worked through by hand.
-
Now, watch this weird video (only the first
two minutes) to learn what the Convex Hull is.
-
Here is a visualization of the Graham Scan, an
algorithm for calculating the convex hull, if you'd like to see it in action.
Delving Deeper
-
The Convex Hull is not terribly difficult to implement. Read
Graham's Original Paper which is
only a page and a half. Be sure to try and implement it yourself. Our problem set Thursday will present
a different algorithm for the convex
hull, so I recommend you look at both for comparison.
-
One interesting problem that arises is the
Closest Pairs Problem, which
is naively
O(n²)
, but can be written to be O(n logn)
instead. Try writing
up a naive implementation alongside a divide and conquer version to compare run time for large sets of
points
-
Here's a good ACM problem to puzzle at.
-
See a full list of computational
geometry topics here.