RotationTransform has options RotationTransform[{u,v},p]

gives a rotation about the point p that transforms u to the direction of v.

But why there is only Rotate[g,{u,v}]

How to set the point p in Rotate?

  • 5
    $\begingroup$ But there is a third argument (coordinate list} for Rotate which does just that... $\endgroup$
    – Yves Klett
    Nov 10 '15 at 17:28
  • $\begingroup$ @YvesKlett I can't find it, which option do you mean? $\endgroup$
    – matheorem
    Nov 11 '15 at 0:56
  • $\begingroup$ reference.wolfram.com/language/ref/Rotate.html $\endgroup$
    – Yves Klett
    Nov 11 '15 at 6:39
  • $\begingroup$ @YvesKlett Er... I am really stupid now. But I can't find the exact same thing like RotationTransform[{u,v},p]. There is only Rotate[g,{u,v}] but without a reference point. And Rotate[g,θ,{u,v}] is totally different thing. Would you help me again? $\endgroup$
    – matheorem
    Nov 11 '15 at 7:08
  • $\begingroup$ From the help: "Rotate[g,θ,{x,y}] rotates about the point". $\endgroup$
    – Yves Klett
    Nov 11 '15 at 8:06

You could translate the figure being rotated back and forth.

GeometricTransformation[g, RotationTransform[{u, v}, p]]

is equivalent to

Translate[Rotate[Translate[g, -p], {u, v}], p]

For example,

u = {1, 0};
v = {1, 1/5};
p = {1/3, 1/3};
g = Rectangle[];
Graphics[GeometricTransformation[g, RotationTransform[{u, v}, p]], Axes -> True]
Graphics[Translate[Rotate[Translate[g, -p], {u, v}], p], Axes -> True]

rotated rectangle

This works in both 2D and 3D.

  • $\begingroup$ Rotate[g, VectorAngle[u, v], p] $\endgroup$
    – yode
    Jan 28 '16 at 4:44

Your Answer

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

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