5
$\begingroup$

Since I forgot all the basics of math, I'm asking you to help me out with simple task.

enter image description here

I need to rotate text box in PDF. Rotation point is lower left corner, but I need to rotate it as if the rotation point would be on the center.

Since I am using a programming language, I can convert an angle in degrees to its radian equivalent (although I'm not sure if this will help)

Can you help me out to find lower left corner coordinates if rotation point is center?

2 Answers 2

2

First of all, we need to convert the coordinates so the center is (0, 0). Doing this, the coordinates of the right lower corner are (131.5, 49.5). Rotation formula is

$(x_1, y_1) = (x, y) * \left(\begin{matrix} \cos(\theta) & \sin(\theta) \\ -\sin(\theta) & \cos(\theta) \end{matrix}\right) = (x \cos(\theta)-y \sin(\theta), x \sin(\theta) + y \cos(\theta))$

By putting $\theta=\frac{5\pi}{180}$, you get the new coordinates

$ x_1 \approx 126.69, y_1 \approx 60.77$

To know the distance we need to move the initial rectangle, need to subtract the initial and resulting coordinates

$x_d = x_0-x_1 \approx 4.81$ $y_d = y_1-y_0 \approx 11.27$

You need to add $x_d$ to the initial $x$ coordinates and $y_d$ to initial $y$ coordinates.

  • 0
    As usual, you rock!2012-09-10
1

Subtract the difference between the center and the lower left corner from every point, do the thing you did earlier to rotate, add back the difference that you had subtracted.

  • 0
    That's not going to work that wa$y$, i can only provide values before it's rotated. So left corner value should be pre-calculated2012-09-07