MathGroup Archive 2009

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

Search the Archive

Re: 3D Animations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105963] Re: 3D Animations
  • From: Maxim <m.r at inbox.ru>
  • Date: Mon, 28 Dec 2009 04:56:40 -0500 (EST)
  • References: <hgq21f$g51$1@smc.vnet.net>

On Dec 22, 3:03 am, Artur <gra... at csl.pl> wrote:
> Dear Mathematica Gurus,
> I would like to ask that in version up 6 are available such 3D
> animations like follwing (I'm mean about second part of this video):http://www.youtube.com/watch?v=JX3VmDgiFnY&feature=related
> Merry Christmas
> Artur

Here's an animation example (where I take a conformal plot of sine for
funzies):

gr = ParametricPlot[{Re[Sin[t + I s]], Im[Sin[t + I s]]},
   {t, 0, 2 Pi}, {s, 0, 10},
   MaxRecursion -> 3, BoundaryStyle -> Green,
   Mesh -> 9, MeshStyle -> {Blue, Red},
   MeshShading -> {{Red, Blue}, {Blue, Red}}];
Cases[gr, GraphicsComplex[L_, g_, ___] :>
   (pts = L;
    prims0 = Flatten /@ Last@Reap[
        Cases[g, {___, c_RGBColor, s__} :>
          Sow[Cases[{s}, _Line, -1], c], -1], _, List];
    prims = Flatten /@ Last@Reap[Cases[g, {___, c_RGBColor, s__} :>
          Sow[Cases[{s}, Polygon[p_, ___] :> Polygon@
              Developer`ToPackedArray@Reverse[p, ArrayDepth@p], -1],
           c], -1], _, List];), -1];

Manipulate[
 d = 4 R^2 + (pts[[All, 1]] - x0)^2 + (pts[[All, 2]] - y0)^2;
 pp = {x0 + 4 R^2 (pts[[All, 1]] - x0)/d,
   y0 + 4 R^2 (pts[[All, 2]] - y0)/d, 2 R - 8 R^3/d};
 Graphics3D[
  {If[c, {}, {Opacity[.25], Sphere[{x0, y0, R}, R]}],
   GraphicsComplex[Transpose@pp,
    If[c, {EdgeForm[], prims}, prims0],
    VertexNormals -> Transpose[pp - {x0, y0, R}]]},
  Axes -> False, Boxed -> False, ViewAngle -> Pi/9],
 {{x0, 0}, -3, 3}, {{y0, 0}, -3, 3}, {{R, 1}, .5, 5},
 {{c, False, "shading"}, {False, True}},
 TrackedSymbols -> True]

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Best way to do contractions (arbitrary Tables with a Sum)?
  • Next by Date: Re: Replace and ReplaceAll -- simple application
  • Previous by thread: Re: Re: 3D Animations
  • Next by thread: .eps file in MATHEMATICA