Since I forgot all the basics of math, I'm asking you to help me out with simple task.
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?
Best Answer
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.