Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.6K Views
|
11 Replies
|
7 Total Likes
View groups...
Share
Share this post:

"Filled in" ParametricPlot3D?

Posted 8 years ago

Hello all! I'm currently finding my way through Mathematica (novice here), and am having issues "filling in" a Parametric3DPlot, as shown below:

ParametricPlot3D[{(1 + Cos[(8 t)]) Cos[t], (1 + Cos[8 t]) Sin[t], u}, 
{t, 0, 2 Pi}, {u, 0, 1}, Mesh -> None, PlotStyle -> Opacity[.9]]

While these "petals" somewhat work, how do I fill them in, to make them a solid shape? Thanks!

POSTED BY: David Joseph
11 Replies

The special syntax Line[{{0}, {1}}] is not used for 2D graphics, but for geometric regions. It means the line in 1D space, connecting the two zero-dimensional points {0} and {1}.

POSTED BY: Gianluca Gorni
Posted 8 years ago

Very interesting solutions! Michael, thanks, but where do you get and what is the meaning of:

Line[{{0}, {1}}] ?

I cannot find in the Line docs any such syntax for Line[].

Also,

Graphics[Line[{{0}, {1}}]]

gives the error: "Array {{0}, {1}} has the wrong dimensions for a graphics coordinate list. Am I missing something?

POSTED BY: Updating Name

This is a ligher version, with only the boundary shown:

reg = RegionBoundary@
   RegionProduct[
    BoundaryDiscretizeGraphics@
     ParametricPlot[{(1 + Cos[(8 t)]) Cos[t], (1 + Cos[8 t]) Sin[
         t]}, {t, Pi/8, 2 Pi + Pi/8}], 
    DiscretizeRegion@Line[{{0}, {1}}]];
Graphics3D[{Red, EdgeForm[], Opacity[.5], MeshPrimitives[reg, 2]}]
POSTED BY: Gianluca Gorni

Here is an example:

reg = RegionProduct[
   BoundaryDiscretizeGraphics@
    ParametricPlot[{(1 + Cos[(8 t)]) Cos[t], (1 + Cos[8 t]) Sin[
        t]}, {t, Pi/8, 2 Pi + Pi/8}],
   DiscretizeRegion@Line[{{0}, {1}}]];
Graphics3D[{Red, EdgeForm[], MeshPrimitives[reg, 2]}]
POSTED BY: Gianluca Gorni
Posted 8 years ago

@Gianluca Gorni Hm... can't seem to exactly find the right resources to convert the code you gave me into a MeshFunction. Perhaps when you get the chance you could help me. Thanks!

POSTED BY: David Joseph

Right now I cannot check with Mathematica, but you may look up MeshPrimitives, that converts a Region to Graphics3D, to which you can give color styling.

POSTED BY: Gianluca Gorni
Posted 8 years ago

@Gianluca Gorni thank you so much! One last question (sorry!): how do I change the color of this graphic? I'm confused as to where I would put it in the coding. :)

POSTED BY: David Joseph

You can also use the derived geometric region functions:

RegionProduct[
 BoundaryDiscretizeGraphics@
  ParametricPlot[{(1 + Cos[(8 t)]) Cos[t], (1 + Cos[8 t]) Sin[t]},
   {t, Pi/8, 2 Pi + Pi/8}],
 DiscretizeRegion@Line[{{0}, {1}}]]
POSTED BY: Gianluca Gorni
Posted 8 years ago

This is so helpful, thank you all. One more question: I am trying to combine this with another ParametricPlot3D, but whenever I try the command Show[{figure1,figure2,figure3}, PlotRange->All], it returns that it cannot combine them. Any help with this part?

POSTED BY: David Joseph
POSTED BY: Michael Rogers

Here is a way:

f[t_, u_, r_] = {r (1 + Cos[(8 t)]) Cos[t], r (1 + Cos[8 t]) Sin[t], 
   u};
Show[ParametricPlot3D[f[t, u, 1], {t, 0, 2 Pi}, {u, 0, 1}, 
  Mesh -> None, PlotStyle -> Opacity[.9], PlotPoints -> {40, 2}],
 ParametricPlot3D[{f[t, 1, r], f[t, -1, r]}, {t, 0, 2 Pi}, {r, 0, 1}, 
  Mesh -> None, PlotStyle -> Opacity[.9], PlotPoints -> {40, 2}]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard