MathGroup Archive 1999

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

Search the Archive

Re: hexagon tiled torus

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20667] Re: hexagon tiled torus
  • From: Martin Kraus <Martin.Kraus at informatik.uni-stuttgart.de>
  • Date: Sun, 7 Nov 1999 02:10:04 -0500
  • Organization: Institut fuer Informatik, Universitaet Stuttgart
  • References: <7vrc11$2n2@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Guilherme Roschke wrote:
> 
> I am trying to draw a torus tiled with regular hexagons.  I've been able
> to modify the torus in <<Graphics`Shapes` to give one  tiled by triangles,
> but no luck with regular hexagons.
> 
> to make triangles
> 
> <<Graphics`Shapes`
> torus=Show[Graphics3D[Torus[]]];
> triangles=Show[torus/.Polygon[{a_,b_,c_,d_}]:>{Polygon[{a,b,c}],Polygon[{a,c,d}]}];
> 
> anybody have any references to digital/computational geometry books that
> might cover this problem?
> 
> -guilherme
> 

I don't, sorry.

Here is some code:

Generate a Graphics object (called flatGraphics) 
with the "texture" (hexagons here):

edge = 1; nx = 20; ny = 12;

hexagons = 
    Table[N[Polygon[
          Table[{If[OddQ[i], edge Sin[Pi/3], 0] + 2 edge Sin[Pi/3] j, 
                3/2 i} + {edge Sin[Pi/3], edge} + 
              edge {Sin[phi], -Cos[phi]}, {phi, 0, 2 Pi, 2 Pi/6}]]], {i,
0, 
        ny - 1}, {j, 0, nx - 1}];

flatGraphics = 
    Graphics[hexagons, 
      PlotRange -> {{0, nx edge 2 Sin[Pi/3]}, {0, ny edge 3/2}}];


Define a function to map the "texture" onto a three-dimensional
surface (given as a function of two coordinates):


EmbedIn3D[
    g_Graphics, {fx_, fy_, fz_}, {u_, umin_, umax_}, {v_, vmin_, vmax_}]
:= 
  Module[{x, y, xmin, ymin, xmax, ymax, g1, g2, 
      g3}, {{xmin, xmax}, {ymin, ymax}} = FullOptions[g, PlotRange]; 
    g2 = Evaluate[
            g][[1]] /. {{x_?NumberQ, 
              y_?NumberQ} :> {(x - xmin)/(xmax - xmin)*(umax - umin) + 
                umin, (y - ymin)/(ymax - ymin)*(vmax - vmin) + vmin}};
(* 
      map coordinates to ranges of u and v *) 
    g3 = g2 /. {{x_?NumberQ, 
              y_?NumberQ} :> ({fx, fy, fz} /. {u :> x, v :> y})}; 
    Graphics3D[g3]]


Use it for a torus with the hexagons as texture:


rTorus = 10; rTube = 5;

Show[EmbedIn3D[flatGraphics, 
      rTorus {Cos[phi], Sin[phi], 0} + 
        rTube{Cos[phi] Cos[theta], Sin[phi] Cos[theta], Sin[theta]},
{phi, 0, 
        2 Pi}, {theta, 0,  2 Pi}]];


There are several problems of this solution, but it might be good
enough in your case.

Greetings

Martin Kraus


  • Prev by Date: Re: Re: Re: list manipulation
  • Next by Date: Re: ContourPlot3D
  • Previous by thread: hexagon tiled torus
  • Next by thread: Re: hexagon tiled torus