From: Fred Klingener on 1 Aug 2010 04:55 On Jul 29, 6:43 am, David Reiss <dbre...(a)gmail.com> wrote: > If one sets the AxesLabel option for, for example, Plot3D, is there > any way to set things up so that resulting labels are always parallel > to their own axes? > > ...here is an example, and a customer would like the labels to align > along/paralle the axes rather than what is shown here.... > > Plot3D[x y, {x, 0, 1}, {y, 0, 1}, > AxesLabel -> {"This is the x", "This is the y", "This is the z"}] And here's an even worse way to do it. It puts the styled text into an Inset, which, amazingly, can be scaled, sheared, rotated and translated to visually approximate 3D text then the Inset is Epilogged into a Graphics3D. Manipulate[ DynamicModule[ {st, rt, tt} , st = ShearingTransform[ shear , {1, 0} , {0, 1} ]; (* ShearingTransform *) rt = RotationTransform[ rotate , {0, 0}]; (* RotationTransform *) tt = TranslationTransform[ {x, y} ]; (* TranslationTransform *) Graphics3D[{} , Epilog -> GeometricTransformation[ Inset[ Style["Hello,world" , FontFamily -> "Helvetica" , Bold , 14 ] (* Style *) , {0, 0} ] (* Inset *) , tt.rt.st ] (* GeometricTransformation *) , Axes -> True , AxesOrigin -> 0 ] (* Graphics3D *) ] (* DynamicModule *) , {{rotate, 0}, -Pi/4, Pi/4} , {{shear, 0}, -Pi/4, Pi/4} , {{x, 0.5}, 0, 1, Appearance -> "Labeled"} , {{y, 0.5}, 0, 1, Appearance -> "Labeled"} ] (* Manipulate *) Hth, Fred Klingener
From: David Park on 2 Aug 2010 07:06 The Presentations package has direct Text3D (with regular computer fonts and Style and with block characters also) and VectorText3D if you want to warp the text to fit on a curved surface. 3D text moves when the plot is rotated and hides behind surfaces. The difficulty with 3D text is that you must specify the orientation as well as the position. To aid in this there are VerticalText3D and VerticalVectorText3D primitives to handle the simpler, and more common, case of vertical text. There is also A Text3DOrientation dynamic to aid in more general orientation. Also, an extensive tutorial. David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Fred Klingener [mailto:gigabitbucket(a)BrockEng.com] Decent built-in 3D text is long overdue in Mathematica. I think. Hth, Fred Klingener
From: David Reiss on 3 Aug 2010 06:35 Thank you all for your various thoughts about this issue. I completely agree that 3D text is a worthy and needed addition to Mathematica. Here's a little project: create the open to StarWars along with a flyarround http://en.wikipedia.org/wiki/Star_Wars_opening_crawl --David
From: Fred Klingener on 4 Aug 2010 05:50 On Aug 3, 6:35 am, David Reiss <dbre...(a)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
From: telefunkenvf14 on 6 Aug 2010 06:58 On Aug 4, 4:50 am, Fred Klingener <gigabitbuc...(a)BrockEng.com> wrote: > On Aug 3, 6:35 am, David Reiss <dbre...(a)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 Very cool. For some reason the font gets all mashed together on my machine when I leave it set to "Bold"... Two resources you may already have: http://library.wolfram.com/infocenter/MathSource/4535/ http://library.wolfram.com/infocenter/Conferences/196/ -RG
First
|
Prev
|
Pages: 1 2 Prev: Dynamic programming and Manipulate Next: Surface integral on a 3D region |