Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}}]}]
share|improve this question
Show[{Graphics3D@Arrow[{{0, 0, 0}, {5, 5, 5}}], pic}] is this what you are looking for? – Rojo Nov 16 '12 at 18:06
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) &)]... – J. M. Nov 16 '12 at 18:10
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" – c186282 Nov 16 '12 at 18:15
Kind of similar question:… – VLC Nov 16 '12 at 18:34
up vote 5 down vote accepted

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}]


share|improve this answer
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. – jVincent Nov 16 '12 at 18:20
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! – c186282 Nov 16 '12 at 18:22
@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 – ssch Nov 16 '12 at 18:22
Oh I get it know, the Graphics3D is the entire graphics structure, and that's why Show is even used at all – ssch Nov 16 '12 at 18:31
@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[...]. – jVincent Nov 16 '12 at 18:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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