A Re-Framing Inversion: Transforming the Coordinates in BetweenDate: 03/27/2012 at 18:37:37 From: Terry Subject: "Zoom" transformation of curve Say I have a function that passes through (0, 0) to (1, 1). For example, y = x^2. Now, pick two points on that curve between (0, 0) and (1, 1). For example, (1/4, 1/16) and (1/3, 1/9). Transform the first point to (0, 0) and the second point to (1, 1). Continuing my example, (1/4, 1/16) -> (0,0) (1/3, 1/9) -> (1,1) What is the resulting function after transformation? In other words, what does y = x^2 become? If I only concerned myself with one point between (0, 0) and (1, 1) and wanted to transform it to (0, 0), the resulting equation would involve two parameters a and b, where a is the change between the x coordinate of the point and x = 0 b is the change between the y coordinate of the point and y = 0 x<transformed to zero> = (x<point> - a) or (a - x<point>) y<transformed to zero> = (y<point> - b) or (b - y<point>) I am not sure which order the terms should go, or if there are additional components that I do not know about. Involving a second point between (0, 0) and (1, 1) that needs to be simultaneously stretched to (1, 1) while the first point is being brought to (0, 0) brings in two more parameters (c, d) that respectively represent the change in x and y from 1. Terms like (1 - c) or (c - 1), (x - 1) or (1 - x), (x - c) or (c - x), as well as the respective y and d counterparts (y - d), are probably brought into play somehow. I also imagine that the order (a - x) or (x - a) for the first point will be the opposite for that of the second (x - c) or (c - x), since they are heading in different directions. Returning to my original example, I see an equation for y = x^2 with the two points (a, b) and (c, d) being something like this: [(x - a)(c - x)/(0 - a)(1 - c)]^2 y = ----------------------------------- (y - b)(d - y)/(0 - b)(1 - d) But I don't think this is correct; it's all a bit beyond me. Sadly, I would still be in trouble if I only concerned myself with the transformation of one coordinate. I asked the linear algebra teacher at my college, and he gave me x' = (x - a)/(1 - a) y' = y/b When I plugged this into y = x^2, the resulting curve did not go between (0, 0) and (1, 1). In addition, I guess he did not pay attention to the fact that I mentioned a second point, as well. He is sort of my only reference at my college, so I am out of options. This transformation would GREATLY help me with a program that I am writing for my own project. Thank you in advance for any help! Date: 03/27/2012 at 19:08:53 From: Doctor Peterson Subject: Re: Hi, Terry. Just to make sure I've got it right, and to help in labeling things, here's a picture of what we're doing: 1 +..............................................o | o: | o : | o : | o : | o : | o : | o : y_b|.......D------------------------B : | | o | : | | o | : | | o | : | | o | : y|.......R........P | : | | o: | : | | o : | : | Y| o : | : | | o : | : | | o : | : y_a|.......A--------Q---------------C : | o : X : : : | o : : : : 0 o----------------------------------------------+ 0 x_a x x_b 1 We've got fixed points A(x_a, y_a) and B(x_b, y_b), and want to transform them to a new set of coordinates X and Y in which A is (0, 0) and B is (1, 1). I'll assume that x_b > x_a and y_b > y_a, which will be true if your function is always increasing. Our coordinate X is the ratio AQ:AC, and Y is the ratio AR:AD. Thus, for point P(x,y), we have AQ x - x_a AR y - y_a X = -- = ----------- Y = -- = ------------ AC x_b - x_a AD y_b - y_a To express your function in terms of X and Y, we have to invert the formula for X: (x_b - x_a)X = x - x_a x = (x_b - x_a)X + x_a Given any function y = f(x), we have y = f(x) = f((x_b - x_a)X + x_a) Therefore, f((x_b - x_a)X + x_a) - y_a Y = --------------------------- y_b - y_a There's your formula. Let's apply it to your example, where f(x) = x^2, A is (1/4, 1/16), and B is (1/3, 1/9): f((1/3 - 1/4)X + 1/4) - 1/16 ((1/3 - 1/4)X + 1/4)^2 - 1/16 Y = ---------------------------- = ----------------------------- 1/9 - 1/16 1/9 - 1/16 You wouldn't need to do this in your program, but this simplifies to (X/12 + 1/4)^2 - 1/16 (X + 3)^2 - 9 Y = --------------------- = ------------- 7/144 7 As a check, when X = 0, Y = (9 - 9)/7 = 0 when X = 1, Y = (16 - 9)/7 = 1 This is just as you wanted. - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/ Date: 03/27/2012 at 20:45:12 From: Terry Subject: Thank you ("Zoom" transformation of curve) Wow! Thank you kindly. That helped immensely!! Terry |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/