Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: How to put text on a curved surface?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87221] Re: How to put text on a curved surface?
  • From: "Fred Klingener" <gigabitbucket at gmail.com>
  • Date: Fri, 4 Apr 2008 02:59:59 -0500 (EST)
  • References: <fsvels$sto$1@smc.vnet.net>
  • Reply-to: "Fred Klingener" <gigabitbucket at gmail.com>

"P_ter" <peter_van_summeren at yahoo.co.uk> wrote in message 
news:fsvels$sto$1 at smc.vnet.net...
>I would like to put "Mathematica" on a curved surface, e.g. a torus.
> Can anyone help here?
> with friendly greetings,
> P_ter

Brute force. Not much slower than MeshShading.

Make raster of text, compose Polygons on the flat raster grid, apply 
FaceForm[RGBColor] to each Polygon, and display with Graphics3D:
w = 160; h = 40;
map = Rasterize["**** Mathematica ****"
, "RGBColor"
, RasterSize -> {w, h}
, Background -> White];
Graphics3D[{EdgeForm[],
Table[{FaceForm[map[[i, j]]],
Polygon[{{i, j, 0}, {i, j + 1, 0}, {i + 1, j + 1, 0}, {i + 1, j, 0}}]}
, {i, 1, h - 1}
, {j, 1, w - 1}]}

Next, map the 2D raster grid onto the 3D coordinates to on a torus:

r = 1.0; r0 = 0.3;
fx[i_, j_] := (r - r0 Cos[2 Pi i/40]) Cos[(2 Pi j)/160];
fy[i_, j_] := (r - r0 Cos[2 Pi i/40]) Sin[(2 Pi j)/160];
fz[i_, j_] := r0 Sin[2 Pi i/40];
w = 160; h = 40;
map = Rasterize["**** Mathematica ****"
, "RGBColor"
, Background -> White
, RasterSize -> {w, h}];
Graphics3D[{EdgeForm[]
, Table[{FaceForm[map[[i, j]]], Polygon[{{fx[i, j], fy[i, j], fz[i, j]}
, {fx[i, j + 1], fy[i, j + 1], fz[i, j + 1]}
, {fx[i + 1, j + 1], fy[i + 1, j + 1], fz[i + 1, j + 1]}
, {fx[i + 1, j], fy[i + 1, j], fz[i + 1, j]}}]}
, {i, 1, h - 1}
, {j, 1, w - 1}]}
]

It could be prettied up some, but it'd still be a pig.

Cheers,
Fred Klingener







  • Prev by Date: Re: How to display parameter in animation?
  • Next by Date: Re: How to display parameter in animation?
  • Previous by thread: Re: How to put text on a curved surface?
  • Next by thread: Re: How to put text on a curved surface?