4
$\begingroup$

Suposing that I have precomputed a parametric plot such as pp = ParametricPlot[{2 Cos[x], 3 Sin[x]}, {x, 0, 2 \[Pi]}], an ellipse, how can I apply rotation and translation transform to it?

What I want to do is to apply rotation and translation transforms to pp and not to change the way it was generated, by changing what is inside the brackets.

Is this possible?

Can anyone tell me how to do this? For example, how can I rotate this ellipse around the origin by 45 degrees, and how can I translate it form the origin to the point (0,10)?

Best Regards.

$\endgroup$
1
  • $\begingroup$ I'm tempted to call it a duplicate of: 32468 or 100025. 3D or 2D case does not matter here. More explanation can be found in related: 148412 and 104443. What do you think? $\endgroup$
    – Kuba
    Commented Dec 21, 2017 at 18:24

1 Answer 1

8
$\begingroup$

You can use GeometricTransformation:

GraphicsRow[{
    (* rotate *)
    pp /. Graphics[prim_,opts__] :> Graphics[
        GeometricTransformation[prim, RotationTransform[Pi/4]],
        PlotRange->Automatic,opts
    ],

    (* translate *)
    pp /. Graphics[prim_,opts__] :> Graphics[
        GeometricTransformation[prim, TranslationTransform[{0,10}]],
        PlotRange->Automatic,opts
    ]
}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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