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;