1
$\begingroup$

I have seen the documentation for Translate (https://reference.wolfram.com/language/ref/Translate.html), which allows one to translate a graphics primitive (like Circle, Cone, etc.) and then apply Graphics[] or Graphics3D[] to it. E.g.-

Graphics[Translate[..., {1, 0}]]

Q: But what I want to know is whether one can translate (or rotate) an existing Graphics object, something like:

Translate[Graphics[...], {1, 0}]

In particular, I have the Graphics3D output of a ParametricPlot3D[] call that I want to translate in space. I don't want to go into the definition of the ParametricPlot3D[] and translate the individual quantities inside. That is cumbersome, and might even lead to errors.

I hope someone can help.

$\endgroup$
1
  • $\begingroup$ try MapAt[Translate[#, {1, 0}] &, {1}]@Graphics[...]? $\endgroup$ – kglr Feb 12 at 5:20
4
$\begingroup$

One way like this.

g = ParametricPlot3D[{x*y, x, y + x}, {x, -1, 1}, {y, -1, 1}];
Show[g, Graphics3D[
  GeometricTransformation[g[[1]], 
   RotationTransform[Pi/3, {1, 0, 0}]]]]
$\endgroup$
2
  • 1
    $\begingroup$ Thank you very much. Could you please tell me why exactly you use g[[1]] instead of using g itself? I didn't even know that a Graphics object like g was indexed. $\endgroup$ – ap21 Feb 12 at 23:28
  • $\begingroup$ @ap21 we can use g[[1]]//FullForm and g[[2]]//FullForm to see the structure of g, especially the structure of GraphicsComplex. $\endgroup$ – cvgmt Feb 13 at 1:03

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.