MathGroup Archive 2010

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

Search the Archive

Re: AxesLabel parallel to 3D axes?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111526] Re: AxesLabel parallel to 3D axes?
  • From: Fred Klingener <gigabitbucket at BrockEng.com>
  • Date: Wed, 4 Aug 2010 05:49:30 -0400 (EDT)
  • References: <i2rm0a$r4c$1@smc.vnet.net> <i33cps$820$1@smc.vnet.net>

On Aug 3, 6:35 am, David Reiss <dbre... at gmail.com> wrote:
> ...
> Here's a little project: create the open to StarWars along with a
> flyarround
>
> http://en.wikipedia.org/wiki/Star_Wars_opening_crawl
>
> --David

This is all I got.

testStyle = Style[
  "It is a period of civil war.
  Rebel spaceships, striking
  from a hidden base, have
  won their first victory
  against the evil Galactic
  Empire.\n
  During the battle, rebel
  spies managed to steal
  secret plans to the Empire\[CloseCurlyQuote]s
  ultimate weapon, the
  DEATH STAR, an armored
  space station with enough
  power to destroy an entire
  planet.\n
  Pursued by the Empire\[CloseCurlyQuote]s
  sinister agents, Princess
  Leia races home aboard her
  starship, custodian of the
  stolen plans that can save
  her people and restore
  freedom to the galaxy..."
  , FontFamily -> "Helvetica"
  , Bold
  , FontSize -> 24
  , ShowStringCharacters -> False
  , TextJustification -> 1
  ] (* Style *)


Text3D[s_, pos_: {0., 0., 0.}, opos_: {0., 0.}] :=
  Module[{polys, x0, y0, xMin, xMax, yMin, yMax}
  (* Convert the styled string to Polygon representation *)
  , polys =
   Cases[
    ImportString[
     ExportString[
      s
      , "PDF"
      , ShowStringCharacters -> False
      ] (* ExportString *)
     , "PDF"
     ] (* ImportString *)
    , _Polygon
    , Infinity
    ];
  (* Get the min,
  max and extents *){{xMin, xMax, x0}, {yMin, yMax,
     y0}} = {Min[#], Max[#],
      Mean[#]} & /@ (Cases[polys, {x_, y_} :> #, Infinity] & /@ {x,
       y});
  (* outer Translate positions the 3D polygons in the scene *)
 Translate[
   (* Translate and Scale the 2D polygons *)
   (Scale[
      Translate[
       polys
       , -{x0, y0} - opos {(xMax - xMin)/2., (yMax - yMin)/2.}
       ] (* Translate *)
      , 1/72. (*
      inches per point *)
      , {0, 0} (*
      scaled relative to the origin *)
      ] )(*
    Scale *) /. {x_, y_} -> {x, y, 0.}
   , pos]
  ] (* Module *)

text = Text3D[testStyle];

Manipulate[
 Graphics3D[{
    FaceForm[Yellow]
   , EdgeForm[None]
   , Translate[text, {0., yt, 0.}]
   }
  , Boxed -> False
  , PlotRange -> {{-2, 2}, {-8, 8}, {-1, 1}}
  , Background -> Black
   , ViewPoint -> {0.0, -1, +0.25}
  , ViewCenter -> {0.5, 0.5, 0.5}
  , ViewVertical -> {0., 0., 1.}
  , ViewAngle -> 15 Degree
  , ImageSize -> {450, 300}
  ]
 , {yt, -10, 2, 0.25, Animator, DisplayAllSteps -> True}
 ]

Fred Klingener


  • Prev by Date: Re: Bare Bones Backup Button
  • Next by Date: Re: Silly question on Matrices
  • Previous by thread: Re: AxesLabel parallel to 3D axes?
  • Next by thread: Re: AxesLabel parallel to 3D axes?