Section 3

To recap, the equation for our "heading-up" line is

y = x

And the equation for our "heading-down" line is

y = 30 - x

To determine if a point is in one of the 4 "push" segments we can test the point against the 2 lines. The point will either be Over or Under each line. Making a truth-table to show this we produce...

Truth-Table
Line Push North Push East Push South Push West
Over Over Under Under
Over Under Under Over

For example, if a point is Over the "heading-up" line and Under the "heading-down" line it must be within the "Push East" section.

Let's code this and see if we can get our unit test to pass.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com