Fix a problem with the normals.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Sep 2012 11:39:07 +0000 (13:39 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 17 Sep 2012 11:39:07 +0000 (13:39 +0200)
opt.cc

diff --git a/opt.cc b/opt.cc
index bb318a4..87b632e 100644 (file)
--- a/opt.cc
+++ b/opt.cc
@@ -93,8 +93,8 @@ BSPTreeNode* make_bsp_tree(const vector<int>& remaining_roads)
                const LineSegment& ls = roads[remaining_roads[i]];
 
                // find the normal
-               double a = -(ls.to.x - ls.from.x);
-               double b =  ls.to.y - ls.from.y;
+               double a =   ls.to.y - ls.from.y;
+               double b = -(ls.to.x - ls.from.x);
                double invlen = 1.0 / hypot(a, b);
                a *= invlen, b *= invlen;