Scale 2D coordinates and keep their relative euclidean distances intact?
- by eiaxlid
I have a set of points like: pointA(3302.34,9392.32), pointB(34322.32,11102.03), etc.
I need to scale these so each x- and y-coordinate is in the range (0.0 - 1.0).
I tried doing this by first finding the largest x value in the data set (maximum_x_value), and the largest y value in the set (minimum_y_value). I then did the following:
pointA.x = (pointA.x - minimum_x_value) / (maximum_x_value - minimum_x_value)
pointA.y = (pointA.y - minimum_y_value) / (maximum_y_value - minimum_y_value)
This changes the relative distances(?), and therefore makes the data useless for my purposes. Is there a way to scale these coordinates while keeping their relative distances the intact?