Message Boards Message Boards

Combine ParametricPlot3D Curves and Surfaces in Manipulate for CDF?

GROUPS:

Greetings and Salutations, The problem I'm having with Mathematica 11 on a Mac Sierra is when trying to combine attached M1 surface plot with M2 curve plot - as in M3 - it runs ad infinitum. Problem seems to be the two parameters for the M1 Shroud surface confuses the plotting of the M2 Spikes curves only having one parameter --> when I try to combine {Shroud, Spikes} in M3. I've tried adding the other parameter as a dummy operation --> (1 / \Theta)t\Theta in the Spikes Table but it still runs same difference. Another thing is I need the Spikes to be thick, and not lose their PlotStyle. I can combine the two using Manipulate[Show[M1,M2]... but then that does not work in the CDF preview ...darnitol... Thanks for any help.

Shroud = {(\[Pi] (Sin[\[Theta]] Cos[\[Theta]] Sin[\[Lambda]]))/(
   2 (1 + Sin[\[Theta]]^2)), \[Lambda], (\[Pi] (Cos[\[Theta]] Sin[\
\[Lambda]]))/(2 (1 + Sin[\[Theta]]^2))};

Spikes = Table[{(\[Lambda]) (Sin[\[Theta]] Cos[\[Theta]] Sin[t])/(1 + 
       Sin[\[Theta]]^2), 
    t, (\[Lambda]) (Cos[\[Theta]] Sin[t])/ (1 + 
       Sin[\[Theta]]^2)}, {\[Theta], -\[Pi]/2, \[Pi]/2, \[Pi]/8}, {t, 
    0, \[Pi]/2, (2 \[Pi])/16}];

M1 = Manipulate[
  ParametricPlot3D[{Shroud}, {\[Theta], -\[Pi]/2, \[Pi]/
     2}, {\[Lambda], 0, \[Pi]/2}, 
   PlotStyle -> {{Blue, Opacity[opacity]}, {Blue, Thick}}, 
   PlotRange -> All, ViewPoint -> {3, 4, 2.5}, Axes -> True, 
   Boxed -> False, FaceGrids -> None, AxesOrigin -> {0, 0, 0}, 
   AxesLabel -> {None, None, None}, 
   ViewPoint -> {10, 5, 10}], {opacity, .3, 1}]

M2 = Manipulate[
  ParametricPlot3D[{Spikes}, {\[Lambda], 0, \[Pi]/2}, 
   PlotStyle -> {{Blue, Thick}, {Blue, Opacity[opacity]}}, 
   PlotRange -> All, ViewPoint -> {3, 4, 2.5}, Axes -> True, 
   Boxed -> False, FaceGrids -> None, AxesOrigin -> {0, 0, 0}, 
   AxesLabel -> {None, None, None}, 
   ViewPoint -> {10, 5, 10}], {opacity, .3, 1}]

M3 = Manipulate[
  ParametricPlot3D[{Shroud, 
    Spikes}, {\[Theta], -\[Pi]/2, \[Pi]/2}, {\[Lambda], 0, \[Pi]/2}, 
   PlotStyle -> {{Blue, Opacity[opacity]}, {Blue, Thick}}, 
   PlotRange -> All, ViewPoint -> {3, 4, 2.5}, Axes -> True, 
   Boxed -> False, FaceGrids -> None, AxesOrigin -> {0, 0, 0}, 
   AxesLabel -> {None, None, None}, 
   ViewPoint -> {10, 5, 10}], {opacity, .3, 1}]
POSTED BY: David Harness
Answer
1 month ago

I think that a single ParametricPlot3D cannot mix surfaces and lines. You can do it with two separate plots combined with Show:

M3 = Manipulate[
  Show[ParametricPlot3D[{Shroud}, {\[Theta], -\[Pi]/2, \[Pi]/
      2}, {\[Lambda], 0, \[Pi]/2}, 
    PlotStyle -> {{Blue, Opacity[opacity]}, {Blue, Thick}}, 
    PlotRange -> All, ViewPoint -> {3, 4, 2.5}, Axes -> True, 
    Boxed -> False, FaceGrids -> None, AxesOrigin -> {0, 0, 0}, 
    AxesLabel -> {None, None, None}, ViewPoint -> {10, 5, 10}],
   ParametricPlot3D[{Spikes}, {\[Lambda], 0, \[Pi]/2}, 
    PlotStyle -> {{Blue, Thick}, {Blue, Opacity[opacity]}}, 
    PlotRange -> All, ViewPoint -> {3, 4, 2.5}, Axes -> True, 
    Boxed -> False, FaceGrids -> None, AxesOrigin -> {0, 0, 0}, 
    AxesLabel -> {None, None, None}, 
    ViewPoint -> {10, 5, 10}]], {opacity, .3, 1}]
POSTED BY: Gianluca Gorni
Answer
1 month ago

Nope Gianluca, Like I first stated, Manipulate[Show[...,...]... works in the set-up, but the CDF player preview comes up blank...?

POSTED BY: David Harness
Answer
1 month ago

Try adding the option SaveDefinitions -> True to Manipulate, so that all the definitions of Shroud and Spikes are embedded into the output cell.

POSTED BY: Gianluca Gorni
Answer
1 month ago

Well now that worked---thanks Gianluca!

POSTED BY: David Harness
Answer
1 month ago

Group Abstract Group Abstract