2
$\begingroup$

I've got a bit of a mathematical problem.

Basically I have a square, and the width and height are multiplied by $1.02$. Now in the square is a point, which we'll refer to as $(c, d)$, and the origin of the shape is the top left corner, we'll call that $(a, b)$ Think of the square as an image of a dot, and so as the square is scaled, the dots position will move respectively. Diagram to clarify:

enter image description here

My question is, what equation would calculate a translation of the new scaled shape, so that the new point #c$, $d$ would be in the same place as its previous point $c$, $d in the unscaled position? Thanks

By the way, someone suggested to me that you would simply divide the co-ordinate a$, $b$ by $1.02$, which I don't think is correct, as I tried it and it didn't achieve the desired result.

1 Answers 1

2

If I understand your setup correctly, the coordinates of the new location of the old $(c,d)$ will be (c',d'), where c'=a +(1.02)(c-a)\qquad \text{and} \qquad d'=b+(1.02)(d-b).

The expressions can be given in various modified forms. For example, one can rewrite the expression for c' as c'=(1.02)(c) -(0.02)a.

Any point $(x,y)$ is transformed in the same way, to (x',y'), where x'=a +(1.02)(x-a)\qquad \text{and} \qquad y'=b+(1.02)(y-b).\quad\text{(Formula 1)}

Now let us suppose that you want to drag this new point (c',d') so that it is in its old location $(c,d)$. That means that we "add" ((c-c'), (d-d')) to any (x',y') that we have obtained as in Formula 1 above. If you do the details, you will obtain an explicit expression which turns out to be quite simple.

If a message from you indicates a wish for it, and someone else has not done so, I could amend this post by giving a derivation of the "formula."

Added: Inevitably, the derivation needs to assume a few things. We assume that the location "addresses" $a,b$, $c, d$ are in an ordinary Cartesian coordinate system. So somewhere there is an origin, and there are $x$ and $y$ axes as usual, and by $a, b$, for example, we mean what is usually called $(a,b)$. We do not assume that the sides of the square are parallel to the axes. Indeed the square has nothing to do with the calculation. The only thing that we assume is that the point $(a,b)$ is the center of dilatation.

One way to do the transformation is in three steps: (i) Drag $(a,b)$ to the origin, dragging everything along with it the same amount in the same direction; (ii) Do the scaling; (iii) Drag back.

So when we do the dragging, $(c,d)$ is transformed to $(c-a,d-b)$. When we do the dilatation, $(c-a, d-b)$ is transformed to $((1.02)(c-a), (1.02)(d-b))$.
And finally when we drag back, the point $((1.02)(c-a), (1.02)(d-b))$ is transformed to $(a+ (1.02)(c-a), b+ (1.02)(d-b))$. That produces the expressions for c' and d' mentioned earlier.

One can view things more simply. Draw a horizontal line and a vertical line through $(a,b)$. Then the "distance" of $(c,d)$ from the vertical line, at least in the picture, is $c-a$. That has to be scaled by a factor $1.02$. So the new distance from the vertical line is $(1.02)(c-a)$, and the new $x$-coordinate is $a+(1.02)(c-a)$. A similar calculation handles the $y$-coordinate.

I prefer the drag, dilate, drag back approach.

  • 0
    @Jessica: Good to know that. Things may seem simple in retrospect, but the effort that went into the details was probably necessary. Next time it will be routine.2011-06-26