Add the following functions in your `geom.h, geom.c`:

//return 1 if s1 and s2 intersect int intersect(segment s1, segment s2) //return 1 if s1 and s2 intersect properly //(ie at a point that's interior to both) int intersect_proper(segment s1, segment s2) //return 1 if s1 and s2 intersect impropery, //ie teh intersection point is the endpoint of one or both segments int intersect_improper(segment s1, segment s2)

We went over these functions in class; you can also find the code in ORourke book, for which you have access online via Bowdoin Library: O'Rourke Computational Geometry in C for Bowdoin students via Bowdoin library.

Note that your code does not need to compute the intersection point specifically; it only needs to return true if they intersect.

Hard code a few simple test cases to prove that your function works. Include a proper intersection, and couple of improper intersections, and vertical segments that do and don't intersect.

Embed these test cases in the previous render code and make it render the segments. Render segements that intersect properly with one color, improperly with a difefrent color, and segments that don't with another color.

This is an easy assignment, just before the break. You will use it in the subsequent assignments.

Always code assuming you'll have to debug. Think and structure your code incrementally so that it is easy to debug it. Test one piece before you move on to the next one. Keep in mind that pointer errors do not always manifest, and soemtimes they manifest in different ways on different computers.

Enjoy!

Last modified: Tue Mar 3 09:33:35 EST 2015