How would I go about changing points that are 'near' linear (within a threshold), actually linear?
I have some code that checks if 3 points are linear to one another (give or take), and I want to replace those coordinates with new ones that are 100% inline.
double distance = (x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3);
double threshold = 4;
if (Math.abs(distance) <= threshold) {
// is Near line
return true;
}
else
return false;
This is an EXTENSION of another post of mine... This is NOT a repost, simply a related topic: