Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

Is it possible to revolve a function around a line instead of an axis?

For instance I would like to revolve the quadratic function:

f[x_]:=-0.45(x-1.5)^2 

Around the x=3, z=0 line.

share|improve this question
2  
Strongly related? –  Öskå Aug 14 '13 at 8:06
    
What do you want to revolve? I may be able to translate all by {-3, 0, 0} and then use RevolutionAxis-> –  Kuba Aug 14 '13 at 8:07
    
I want to revolve a quadratic function: -0.45(x - 1.5)^2 –  Michael H Aug 14 '13 at 8:19
    
Yes, sorry x=3 z=0 –  Michael H Aug 14 '13 at 8:23
add comment

marked as duplicate by Sjoerd C. de Vries, Kuba, Yves Klett, m_goldberg, Artes Sep 13 '13 at 14:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

General approach is covered by this answer form the Q&A which link is provided by Öskå.

As I've said in comments, you may translate your function so the x = 3, z = 0 line will be an y-axis.

f[x_] := (-0.45 (x - 1.5)^2)

Plot[{f[x], f[x + 3]}, {x, -5, 5}, 
     Epilog -> {Thick, Blue, Line[{{3, -25}, {3, 5}}], Red, Line[{{0, -25}, {0, 5}}]}, 
     AxesLabel -> {"x", "y"}, AxesStyle -> Arrowheads@.05]

enter image description here

Then revolve it around y-axis:

plot = RevolutionPlot3D[{x, f[x + 3], 0}, {x, -5, 5},
                      RevolutionAxis -> {0, 1, 0}, AxesOrigin -> {0, 0, 0}, 
                      ImageSize -> 500, PlotRange -> 15, BaseStyle -> Orange,
                      AxesStyle -> {Red, Green, Blue}
                     ]

enter image description here

and translate it back:

Translate[#, {3, 0, 0}] & @@ plot //Graphics3D[#, Axes -> True, PlotRange -> 15,
                                           AxesOrigin -> {0, 0, 0},  ImageSize -> 500,
                                           AxesStyle -> {Red, Green, Blue}] &

enter image description here

share|improve this answer
1  
Add a cool MeshShading and you got a Smurf house –  Öskå Aug 14 '13 at 9:07
    
Thanks heaps @Kuba :) –  Michael H Aug 14 '13 at 9:22
    
@MichaelH General approach is covered by this answer form this Q&A which link is provided by Oska –  Kuba Aug 14 '13 at 9:28
add comment

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