Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose I have a 8x6 rectangle, with its lower left corner at the origin (0, 0). I want to scale this rectangle by 0.5 at an anchor point (3, 3). So the resulting rectangle is 4x3, but I cannot figure out how to compute the distance from the origin to the lower left corner of the new rectangle. Help is appreciated.

share|improve this question
1  
Sorry if I'm misunderstanding the construction, but doesn't that corner just go to the midpoint between the origin and (3,3)? In that case it's half the distance to (3,3), which is computed with the Pythagorean theorem. –  Jonas Meyer Oct 1 '10 at 4:19
    
What do you mean by "anchor point"? Should the newly scaled rectangle have a corner at that point, or should it be centered there? –  J. M. Oct 1 '10 at 4:20
    
It is the midpoint for this case, but not for all cases. By anchor point I mean the center of scaling (as if the rectangle was moved to the origin and then scaled). –  Tetelo Oct 1 '10 at 4:22
    
Oh, I guess you're saying you really wanted a general way to find distances of transformed points. –  Jonas Meyer Oct 1 '10 at 4:32

2 Answers 2

up vote 4 down vote accepted

Scaling by 0.5 about the center (3,3) is the same as translating by (-3,-3), scaling by 0.5 about (0,0), then translating by (3,3). So, to find the coordinates of the lower left corner of the new rectangle, take the coordinates of the lower left corner of the original rectangle, subtract 3 from each coordinate, multiply each coordinate by 0.5, and add 3 to each coordinate. Once you have the point's coordinates, you can find its distance from the origin.

share|improve this answer
    
Thanks for the this, exactly what I needed and easy to picture. –  Tetelo Oct 1 '10 at 4:25
    
It's just half the distance to the anchor point, right? The point started at the origin. –  Jonas Meyer Oct 1 '10 at 4:27
2  
@Jonas: I think so, in this case. I gave the more general explanation/method because often people ask what they think is a simpler question or what they ask ends up not being quite what they needed to know. –  Isaac Oct 1 '10 at 4:31
1  
Well the real problem is that it's arbitrary. The rectangle, center of scale, and scale can be anything. But Isaac's method works for any case. –  Tetelo Oct 1 '10 at 4:37
2  
If the scale is c and the anchor is (a,b), then the new point is (cx+(1-c)a,cy+(1-c)b), as easily follows from Isaac's method. –  Jonas Meyer Oct 1 '10 at 4:41

If you want to scale by .5 with anchor (a,b), then (x,y) will be sent to ((a+x)/2,((b+y)/2), the midpoint of the segment connecting the two points.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.