fix a couple of variable names
re-layout parameters
add integer based approximation for perpendicular distance
use integer approximation for polyline generalization