MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: draw vertical cylinder with no surface lines

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71626] RE: [mg71588] draw vertical cylinder with no surface lines
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 25 Nov 2006 05:37:06 -0500 (EST)

Murray,

You use EdgeForm[] to eliminate (or control) the edge lines on the
rectangular faces of a surface. Eliminating the edges still sometimes leaves
a trace of the edges where the lighting plane changes. An alternative is to
draw the edge lines but use a color that is just a little darker than the
surface. That subdues the edges.

The following draws without the edges. I used the NeutralLighting options in
DrawGraphics so the surface colors would show properly. Honeydew is probably
too light a color to use and the colors you obtained were from the lights.

There is a glitch in the SurfaceColor command in that if you use the
multi-argument form,  SurfaceColor[Honeydew, Honeydew, 2], and then
subsequently use the single argument form for another surface the other
arguments are still in affect.

Drawing lines on the vertical sides of the can depends, of course, on the
viewpoint. I did it by trial and error.

Here is the plot.

Needs["DrawGraphics`DrawingMaster`"]

SetOptions[Arrow3D, HeadScaling3D -> 1, HeadLength3D -> 0.25,
   HeadWidth3D -> 0.55];

Module[
    {\[Theta]1 = 0.25, \[Theta]2 = -0.3},
    Draw3DItems[
      {(* Draw the side surface *)
        SurfaceColor[Salmon], EdgeForm[],
        ParametricDraw3D[{Cos[\[Phi]], Sin[\[Phi]], z}, {\[Phi], 0,
            2 \[Pi]}, {z, 0, 2}, PlotPoints -> {51, 2}],

        (* Draw the top surface *)
        SurfaceColor[LightSteelBlue],
        CylindricalDraw3D[2, {r, 0, 1}, {\[Phi], 0, 2 \[Pi]},
          PlotPoints -> {2, 51}],

        (*  Draw outline *)
        ParametricDraw3D[{Cos[\[Phi]], Sin[\[Phi]], 0}, {\[Phi], 0, 2\[Pi]},
          PlotPoints -> 51],
        ParametricDraw3D[{Cos[\[Phi]], Sin[\[Phi]], 2}, {\[Phi], 0, 2\[Pi]},
          PlotPoints -> 51],

        ParametricDraw3D[{Cos[\[Theta]1], Sin[\[Theta]1], z}, {z, 0, 2},
          PlotPoints -> 2],
        ParametricDraw3D[{Cos[\[Theta]1 + \[Pi]], Sin[\[Theta]1 + \[Pi]],
            z}, {z, 0, 2}, PlotPoints -> 2],

        (* Draw and label the arrows *)
        Thickness[0.01],
        Cobalt, SurfaceColor[PrussianBlue],
        Arrow3D[{0, 0, 2}, {Cos[\[Theta]2], Sin[\[Theta]2], 2}],
        Arrow3D[{Cos[\[Theta]2], Sin[\[Theta]2], 0}, {Cos[\[Theta]2],
            Sin[\[Theta]2], 2}],
        Black,
        Text["r", {1/2Cos[\[Theta]2], 1/2Sin[\[Theta]2], 2}, {-1, -1}],
        Text["h", {Cos[\[Theta]2], Sin[\[Theta]2], 1}, {2, 0}]},

      NeutralLighting[0.3, 0.5, 0.1],
      TextStyle -> {FontSize -> 12, FontWeight -> "Bold",
          FontFamily -> "Courier"},
      Boxed -> False,
      Background -> Linen,
      ImageSize -> 300]
    ];

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




From: Murray Eisenberg [mailto:murray at math.umass.edu]

For an illustration, I want to draw a closed cylindrical "can" -- a
cylinder with its axis vertical -- along with arrows (with labels)
indicating radius and height.

The ways I've found, either using  Graphics`Shapes`Cylinder or
ParametricPlot3D, insist on drawing curves on the vertical wall of the
cylinder and, if I use ParametricPlot3D to draw the top, too, on the top.

Is there some way to suppress these curves?  Of course I still need the
circles bounding the top and bottom to be drawn as well as two vertical
lines that demarcate the wall of the cylinder from the ambient space.  I
just want to rely upon lighting and shading to suggest the
three-dimensionality.

Here's my effort so far using DrawGraphics:

SetOptions[Arrow3D,HeadScaling3D->1,HeadLength3D->0.25,
   HeadWidth3D->0.55];

Draw3DItems[{
    SurfaceColor[Honeydew,Honeydew,2],
    ParametricDraw3D[{Cos[\[Phi]],Sin[\[Phi]],z},{\[Phi],0,2Pi},{z,0,2},
       PlotPoints->{51,2}],

    SurfaceColor[Honeydew,Honeydew],
    CylindricalDraw3D[2,{r,0,1},{\[Phi],0,2Pi},PlotPoints->{2,51}],

    Thickness[0.02],Cobalt,SurfaceColor[PrussianBlue],
       Arrow3D[{0,0,2},{0.9165,-0.4,2}]
    },
    Boxed->False];

--
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305



  • Prev by Date: Re: Numerical Integration
  • Next by Date: Re: pattern matching: rules that stop other rules?
  • Previous by thread: Re: draw vertical cylinder with no surface lines
  • Next by thread: Re: draw vertical cylinder with no surface lines