MathGroup Archive 2003

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

Search the Archive

RE: Merging objects before tumbling animation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43193] RE: [mg43191] Merging objects before tumbling animation
  • From: "David Park" <djmp at earthlink.net>
  • Date: Mon, 18 Aug 2003 02:50:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Narasimham,

I'm going to do this one with the DrawGraphics package from my web site
because it is a natural for it.

Needs["DrawGraphics`DrawingMaster`"]

Clear[dish, warp];
dish[u_, v_] := {u Cos[v], u Sin[v], u^2/2}
warp[v_, w_] := {{v Cos[w], v Sin[w] , w }}

frame[t_] :=
  Draw3DItems[
    {SurfaceColor[LightSteelBlue],
        EdgeForm[ColorMix[LightSteelBlue, Black][0.3]],
        ParametricDraw3D[dish[u, v] // Evaluate, {u, 0, 1}, {v, 0, 2 Pi},
          PlotPoints -> {15, 31}],

        SurfaceColor[DarkSeaGreen],
        EdgeForm[ColorMix[DarkSeaGreen, Black][0.3]],
        ParametricDraw3D[warp[v, w] // Evaluate, {v, 0, 1 }, {w, 0, 1.2},
          PlotPoints -> {15, 15}]} /.
      DrawingTransform3D[Cos[t]#1 - Sin[t]#3 &, #2 &, Sin[t]#1 + Cos[t]#3
&],

    NeutralLighting[0.3, 0.5, 0.2],
    PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}, {-1.6, 1.6}},
    BoxStyle -> Gray,
    Background -> Linen,
    ImageSize -> 400]

Animate[frame[t], {t, 0, 2Pi - 2Pi/20, 2Pi/20}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]; Pause[0.5];
FrontEndExecute[{FrontEnd`SelectionAnimate[200, AnimationDisplayTime -> 0.1,
      AnimationDirection -> Forward]}]

frame make the plot for one angle of rotation. In frame the dish is first
drawn in a LightSteelBlue color, and then the warp is drawn in DarkSeaGreen.
An EdgeForm only a little darker than the surface color was used so the
"mesh" would be subdued. ColorMix is a DrawGraphics routine that will mix
two RGBColors.  ParametricDraw3D is like ParametricPlot3D, except that it
simply extracts the primitive graphics and doesn't produce a side plot. One
of the advantages of DrawGraphics is that you can easily combine plots of
various types. For example, we could have as easily made the dish surface
using DrawSurfaceOfRevolution, which is like SurfaceOfRevolution.

Then DrawingTransform3D is used to rotate the combined set of graphics about
the y axis.

NeutralLighting inserts a set of Lighting Options. It can be used to control
the color saturation, brightness and ambient background of the lighting. By
using a lower color saturation, the lighter colors of the surfaces are not
overwhelmed by the normal Mathematica lighting colors. This gives nice
colored and shaded surfaces. NeutralLighting also allows the lighting to be
rotated, but that is not used here.

I also subdued the bounding box by making it Gray.

Animate is automatically loaded by DrawGraphics. The commands following it
were clicked in from the DrawGraphicsPalette. They automatically close up
and animate the graphics cells.

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

From: Narasimham G.L. [mailto:mathma18 at hotmail.com]
To: mathgroup at smc.vnet.net

In the program below, dish alone can be rotated through a variable
angle al, but I want dish and warp ( diwa) to be together rotated as a
merged object.  How is it done?
Since dish and warp anyhow  would be seen together later,to avoid
repetition, how can their first  ParametricPlot3D graphics output
appearance be suppressed without jeopardy to succeeding code lines
implementation ?

x=  u Cos[v]; y=u Sin[v] ; z= u^2/2 ;
dish=ParametricPlot3D[{x,y,z},{u,0,1},{v,0,2 Pi}];
warp=ParametricPlot3D[{v Cos[w], v Sin[w] ,w }, {v,0,1 },{w,0,1.2}];
diwa=Show[dish,warp]
x1=x Cos[al] - z Sin[al]; z1=x Sin[al] + z Cos[al];
Table[ParametricPlot3D[{x1,y,z1},{u,0,1},{v,0,2 Pi},
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}, {-1.6, 1.6}},
BoxRatios -> {1, 1, 1.75}], {al, 0,2 Pi,Pi/8}];

TIA and Regards


  • Prev by Date: RE: Merging objects before tumbling animation
  • Next by Date: Re: Justification of graphics in cells
  • Previous by thread: RE: Merging objects before tumbling animation
  • Next by thread: Random Number Generation : Is there a faster way of doing this ?