I'm trying to draw up an optical system where I can show an example of wavefront error on an exit pupil. It would be great if I could take the results of a 3D function from Plot3D and use it as a graphics object that I could transform to fit into my Graphis3D drawing. Below is some code that does not work but it shows a very simple case of what I would like to be able to do.

pic = Plot3D[Sin[x] Sin[y], {x, -5, 5}, {y, -5, 5}, 
        RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 20]];

Graphics3D[{Rotate[pic, \[Pi]/4, {1, 1, 1}], 
        Arrow[{{0, 0, 0}, {5, 5, 5}}]}]
  • $\begingroup$ Show[{Graphics3D@Arrow[{{0, 0, 0}, {5, 5, 5}}], pic}] is this what you are looking for? $\endgroup$
    – Rojo
    Commented Nov 16, 2012 at 18:06
  • $\begingroup$ You could use ParametricPlot3D[] instead, e.g. ParametricPlot3D[RotationTransform[Pi/4, {1, 1, 1}][{x, y, Sin[x] Sin[y]}] // Evaluate, {x, -5, 5}, {y, -5, 5}, RegionFunction -> ((#1^2 + #2^2 <= 20) &)]... $\endgroup$ Commented Nov 16, 2012 at 18:10
  • $\begingroup$ Yes I realize there are options where I can change the orientation of my function in Plot3D or ParametricPlot3D etc or even use Epilog. But my full problem is I want to place surface functions inside a very complex Graphic3D "Drawing" $\endgroup$
    – c186282
    Commented Nov 16, 2012 at 18:15
  • $\begingroup$ Kind of similar question: mathematica.stackexchange.com/questions/3186/… $\endgroup$
    – VLC
    Commented Nov 16, 2012 at 18:34

1 Answer 1


Just changing pic to pic[[1]] should work, that's where the GraphicsComplexfor the plot is.

   Rotate[pic[[1]], Dynamic[v], {1, 1, 1}],
   Arrow[{{0, 0, 0}, {5, 5, 5}}]}
  , PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}], {v, -Pi, Pi}]


  • 1
    $\begingroup$ As for why this works, you can always run FullForm[pic] and see that it's really just an expression of the form Graphics3d[....] which the front end interprets as an image. Therefore any manipulation that works on any normal expression also works on the graphics. $\endgroup$
    – jVincent
    Commented Nov 16, 2012 at 18:20
  • $\begingroup$ Very nice. I tried something similar to this but I took the other parts of pic and tried to rebuild the Graphics3D[GraphisComplex[]] object. after rotating pic[[1]]. Thank you! $\endgroup$
    – c186282
    Commented Nov 16, 2012 at 18:22
  • $\begingroup$ @jVincent, yea I saw it had Head Graphics3D but the error given without [[1]] was Graphics is not a Graphics3D primimtive or directive so somewhere along the line I presume there must be a Graphics $\endgroup$
    – ssch
    Commented Nov 16, 2012 at 18:22
  • $\begingroup$ Oh I get it know, the Graphics3D is the entire graphics structure, and that's why Show is even used at all $\endgroup$
    – ssch
    Commented Nov 16, 2012 at 18:31
  • 1
    $\begingroup$ @ssch Yea, just to recap, if you run Graphics3D[pic] what you end up with is: Graphics3D[Graphics3D[GraphicsComplext[...]] (Too many layers of Graphics3D!) but when you do Graphics3D[pic[[1]]] you end up with Graphics3D[GraphicsComplext[...]. $\endgroup$
    – jVincent
    Commented Nov 16, 2012 at 18:48

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.