minor tweaks to the algorithm. now reliably calculates if point is within a polygon.