3
$\begingroup$

I have three curves defined by

ParametricPlot3D[
 {
  {x*Sin[x], x*Cos[x], -(x/3)},
  {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -(x/3)},
  {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -((x*y^2)/3)}
 },
 {x, 0, 2*Pi}, 
 {y, 1, 1.15},
 PlotStyle -> LightGray, Mesh -> None, PlotPoints -> 100
]

enter image description here

As you can see, the region between the curves is filled on two sides, but not on the third, or the triangular end.

How do I complete the fill?

$\endgroup$
  • $\begingroup$ It seems like you are missing something in the first part? You have just the x variable there, and nothing with y, so that can't give you any 2-dimensional surface. $\endgroup$ – OnDragi Jun 8 at 20:36
  • $\begingroup$ In your particular case, you can put {Sqrt[1.15] x*Sin[x], 1.15^2 x*Cos[x], -(x/3) y^2} instead of what you have as the first curve. But Michael's answer is more general :) $\endgroup$ – OnDragi Jun 8 at 20:43
4
$\begingroup$

An alternative approach using a single ParametricPlot3D:

ClearAll[f1, f2, f3, f4, f5]
f1[x_, y_] := {x Sin[x], x Cos[x], -(x/3)}

f2[x_, y_] := {Sqrt[y] x Sin[x], y^2 x Cos[x], -(x/3)}

f3[x_, y_] := {Sqrt[y] x Sin[x], y^2 x Cos[x], -((x*y^2)/3)}

f4[r_: {1, 1.15}][x_, y_] := Module[{t = Rescale[y, r]}, 
   t f2[x, r[[2]]] + (1 - t) f3[x, r[[2]]]]

f5[r_: {0, 2 Pi}][x_, y_] := Module[{t = Rescale[x, r]}, 
   t f2[r[[2]], y] + (1 - t) f3[r[[2]], y]]

ParametricPlot3D[{f1[x, y], f2[x, y], f3[x, y], f4[][x, y], f5[][x, y]}, 
 {x, 0, 2 Pi}, {y, 1, 1.15}, PlotStyle -> LightGray, Mesh -> None, PlotPoints -> 50]

enter image description here

| improve this answer | |
$\endgroup$
5
$\begingroup$

You need to interpolate between the two bounding curves. One way to do this is to multiply one of the bounding curves by $t$, multiply the other by $(1-t)$, and create a ParametricPlot running from $t = 0$ to 1.

originalplot = 
  ParametricPlot3D[
   {
    {x*Sin[x], x*Cos[x], -(x/3)},
    {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -(x/3)},
    {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -((x*y^2)/3)}
   },
   {x, 0, 2*Pi}, 
   {y, 1, 1.15},
   PlotStyle -> LightGray, Mesh -> None, PlotPoints -> 100
  ]

thirdside = 
 With[{y = 1.15}, 
  ParametricPlot3D[
   t {Sqrt[y] x*Sin[x], y^2*x*Cos[x], -(x/3)} 
   + (1 - t) {Sqrt[y]*x*Sin[x], y^2*x*Cos[x], -((x*y^2)/3)},   
   {x, 0, 2 \[Pi]}, {t, 0, 1}, 
   PlotStyle -> LightGray, Mesh -> None, PlotPoints -> 100]]

Show[originalplot, thirdside]

enter image description here

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ The missing triangular cap can be plotted & added in the same way, by interpolating between the "point" and the line segment at the end. I'm short on time to code this now, so I'll leave it as an exercise to the reader. :-) $\endgroup$ – Michael Seifert Jun 8 at 20:39
  • $\begingroup$ Thanks to all - if anyone knows how to put that 'cap' on in specific terms I'd be really grateful - I'm not great with Mathematica, and in this case I'm trying to use it to design a shape for 3D printing... $\endgroup$ – Richard Burke-Ward Jun 8 at 21:46

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.