Scale 2D coordinates and keep their relative euclidean distances intact?

Posted by eiaxlid on Stack Overflow See other posts from Stack Overflow or by eiaxlid
Published on 2010-03-15T19:53:27Z Indexed on 2010/03/15 19:59 UTC
Read the original article Hit count: 127

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about math

Related posts about coordinates