0
$\begingroup$

Things that we have: 2 dimensions, a object with it's coordinates (object P1), it's rotation center (pivot) C1. After that lets rotate it at pivot C1 by known angle A. Now let's move that pivot by vector V1 so now C2 = C1 + V1.

So now is the time for what I'm struggling with: how can I calculate new angle for that object (and probably some translation by vector)? To be more precise - I'm trying to apply new rotation and translation to that object coordinates so all of it's vertices will remain as they were before pivot moved to position C2? I've already tried to find any dependencies between angles and I really can't figure anything that would let me solve that. Simplified image here1

EDIT: Ok, so here I'll clarify what I'm trying to achiev: please refer to this image2: we have object P1, we have rotation center C1 and we rotate that object by known angle so we get in result object P2. Now we place new point, lets call it C2 and what I'm trying to get is to transform P1 vertices referencing to C2 point (to be exact I think it will be new rotation and some translation vector) to get exact same object like P2.

EDIT2: Looks like I've found pretty short and clean solution which works:

Lets calculate vector V1:

V1 = C2 - C1

Now rotate it by the same angle that P1 was rotated about C1 (angle A), and in result we have vector V2. To calculate vector by which we will translate all P1 vertices we need to simply substract them:

Vt = V1 - V2

And that vector Vt should be added to all original P1 vetices. Thanks for help!

$\endgroup$
  • $\begingroup$ For a rectangle as you’ve pictured, the rotation angles must be the same up to a multiple of $\pi$. $\endgroup$ – amd Mar 13 at 19:23
  • $\begingroup$ I am trying to figure out what exactly you are after. Your description is really unclear, and your image doesn't define at all what angles you are referring to. Are you trying to find the rotation/translation about $C_2$ that will move the shape back to where it was before it was rotated about $C_1$? $\endgroup$ – Paul Sinclair Mar 13 at 23:16
  • $\begingroup$ @PaulSinclair I've edited my question so I think is more clear now $\endgroup$ – Kamil Nowak Mar 14 at 12:25
  • $\begingroup$ You just need to rotate about $C_2$ by the exact same angle as you did around $C_1$, then translate the rotated image to the other location. The angle has to be the same, otherwise, your shape will be in the wrong orientation, no matter how you translate it. $\endgroup$ – Paul Sinclair Mar 14 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.