ParametricPlot3D makes it easy to tile
3 dimensional objects with rectangles. Hexagons look cool too, but
involve a bit more work. Here's the idea. We start with a
parameterization of the tube. Think of it as function mapping
. Here's the parameterization of our tube.
tube[{t_, s_}] := {t, Sin[s], Cos[s]};
We now set up a planar graphic, which tiles [0,2Pi]x[0,2Pi] with
hexagons, for our parameterization to act upon.
xNum = 7; yNum = 9;
baseHex = Polygon[{{0, 0}, {1, 0}, {3/2, Sqrt[3]/2},
{1, Sqrt[3]}, {0, Sqrt[3]}, {-1/2, Sqrt[3]/2}}];
hShift[Polygon[l_List]] := Polygon[{3, 0} + # & /@ l];
firstRow = NestList[hShift, baseHex, xNum - 1];
dShift[Polygon[l_List]] := Polygon[{3/2, Sqrt[3]/2} + # & /@ l];
secondRow = dShift /@ firstRow;
vShift[Polygon[l_List]] := Polygon[{0, Sqrt[3]} + # & /@ l];
hexes = NestList[Map[vShift, #, {2}] &, {firstRow, secondRow}, yNum - 1];
coloredHexes = hexes /.
Polygon[x_] :> {RGBColor[Random[], Random[], Random[]], Polygon[x]};
scaledHexes = hexes /.
{x_?NumericQ, y_?NumericQ} -> 2Pi{x/(3 xNum), y/(yNum Sqrt[3])};
Finally, we use the parameterization to wrap this graphic around
a tube.
hexes3D = scaledHexes /. Polygon[l_List] :> Polygon[tube /@ l];
Show[Graphics3D[hexes3D]]
[UNCA |
Math Dept. |
Mark's Home]