Triangles

Here's an idea that I haven't finished.

Start with a trianglular polygon.
Find three new points by taking the midpoints of each line, plus a random amount.
Use these six points to make four smaller triangular polygons.
Repeat on smaller and smaller scales, and VOILA!
The details get a bit tricky.
Here's some playing around in that direction.

RowBox[{triangle, =, RowBox[{{, RowBox[{RowBox[{{, RowBox[{0., ,, 0., ,, 0.}], }}], ,, RowBox[{{, RowBox[{0., ,, 1., ,, 1.}], }}], ,, RowBox[{{, RowBox[{1., ,, 0., ,, .5}], }}]}], }}],  }]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{0., ,, 0., ,, 0.}], }}], ,, RowBox[{{, RowBox[{0., ,, 1., ,, 1.}], }}], ,, RowBox[{{, RowBox[{1., ,, 0., ,, 0.5}], }}]}], }}]

Show[Graphics3D[Polygon[triangle]]] ;

[Graphics:../HTMLFiles/index_12.gif]

If we have a list of such triangles, then we can use the Map function to apply Polygon to each one and plot 'em all.

another = a/2 + 1 ;   (* another triangle *)Show[Graphics3D[Map[Polygon, {triangle, another}]]] ;

[Graphics:../HTMLFiles/index_14.gif]

(* This routine takes one triangle (e . g . a list of 3 points) as input, and returns  ... {two, twothree, onetwo}, {three, threeone, twothree}, {onetwo, twothree, threeone}}] ; ] ;

(* Putting Polygon in front of each of these gives us the start of a fractal landscape . *)Show[Graphics3D[Map[Polygon, morphTriangle[triangle]]]] ;

[Graphics:../HTMLFiles/index_17.gif]

(* So here ' s our list of triangles *)triangleList = morphTriangle[triangle]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{{, RowBox[{0., ,, 0., ,, 0.}], }}], ,, RowBox[{{ ... 0.5, ,, 0.5, ,, 1.02304}], }}], ,, RowBox[{{, RowBox[{0.5, ,, 0., ,, 0.620705}], }}]}], }}]}], }}]

Dimensions[triangleList]

{4, 3, 3}

(* And here ' s where we get tricky . Since morphTriangle applied to one triangle give ... es that ' s four times longer . *)Dimensions[Flatten[Map[morphTriangle, triangleList], 1]]

{16, 3, 3}

(* So if we assign this back to triangleList, we have a recursive routine . *)triangleList = Flatten[Map[morphTriangle, triangleList], 1] ;

(* Which looks like this . *)Show[Graphics3D[Map[Polygon, triangleList]]] ;

[Graphics:../HTMLFiles/index_26.gif]

Yeah, it's a mess - the randomness is too big, and always positive.  Not good.
So all we'd need do is change the size of the random numbers on each pass, and do this repeatedly...

RowBox[{(* Putting all that together : *), , RowBox[{RowBox[{RowBox[{scale, =, 1.}], ; ... owBox[{RowBox[{-, 1.19}], ,,  , RowBox[{-, 1.485}], ,,  , 1.327}], }}]}]}], ]}], ;}], }]}]

[Graphics:../HTMLFiles/index_29.gif]

This has several flaws.
    * The random number generator isn't scaling all that well.  
    * We're pulling the edges away from each other - one of the articles I reference at the top of the page discusses this.

Still, this is the kind of approach that will recursively do smaller triangles.


Created by Mathematica  (November 15, 2004)