RE: Merging objects before tumbling animation
- To: mathgroup at smc.vnet.net
- Subject: [mg43196] RE: [mg43191] Merging objects before tumbling animation
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 18 Aug 2003 02:50:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I thought I would add to my previous reply. In this version, another DrawGraphics routine, IteratorSubstitution, is used to reparametrize the warp surface so that it extends only from a little above the surface of the dish and does not go throught the dish. I don't know if that is better for your particular case or not but, if so, this is a method to do it. Needs["DrawGraphics`DrawingMaster`"] dish[u_, v_] := {u Cos[v], u Sin[v], u^2/2} warp[v_, w_] := {v Cos[w], v Sin[w] , w } The iterators for plot domains must have fixed limits, unlike iterators in Integrate. But we can reparametrize a surface so that it does have fixed limits. Let's say we want the warp surface to go from just a little above the dish to 1.2. We would like the w iterator to be {w, v^2/2 + 0.01, 1.2}. But that is not allowed. The IteratorSubstitution routine reparameterizes, substituting a new variable for w. IteratorSubstitution[{v Cos[w], v Sin[w] , w }, {w, v^2/2 + 0.01, 1.2}, s] // Chop {{v*Cos[0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)], v*Sin[0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)], 0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)}, {s, 0, 1}} The output is the new parametrization with the new iterator, now with fixed limits. The new code for each frame, now using DrawSurfaceOfRevolution to draw the dish, is... frame[t_] := Draw3DItems[ {SurfaceColor[LightSteelBlue], EdgeForm[ColorMix[LightSteelBlue, Black][0.3]], DrawSurfaceOfRevolution[u^2/2, {u, 0, 1}, PlotPoints -> {15, 31}], SurfaceColor[DarkSeaGreen], EdgeForm[ColorMix[DarkSeaGreen, Black][0.3]], ParametricDraw3D[{v*Cos[0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)], v*Sin[0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)], 0.01 + 0.5*v^2 + s*(1.19 - 0.5*v^2)}, {s, 0, 1}, {v, 0, 1 }, 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]}] 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