# Draw triangles

**URL:** <https://forum.kirupa.com/t/draw-triangles/323215>\
**Category:** Uncategorized\
**Created:** [June 21, 2011, 3:23pm UTC](https://forum.kirupa.com/t/draw-triangles/323215 "2011-06-21T15:23:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![radi](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@radi](https://forum.kirupa.com/u/radi)\
**Post date:** [June 21, 2011, 3:23pm UTC](https://forum.kirupa.com/t/draw-triangles/323215/1 "2011-06-21T15:23:05Z")

</div>

if anyone familiar with how the drawl triangle works, i would like to try turning a perlin noise into a 3d object, i got the whole thing setup except for how the triangles are actually made

```auto

import flash.display.Bitmap;
import flash.display.BitmapData;

var bmd:BitmapData = new BitmapData(401, 401, false, 0x00CCCCCC);

var seed:Number = Math.floor(Math.random() * 10);
var channels:uint = 0x00000000 | 0xFFFFFFFF;
bmd.perlinNoise(100, 80, 6, seed, false, true, channels, true, null);

var bm:Bitmap = new Bitmap(bmd);
addChild(bm);
rotationX =-45

stage.addEventListener(MouseEvent.CLICK , triangles);
var i:int = 0
var n:int = 0
var j:int = 0
var spotx:Array = new Array()
var spoty:Array = new Array()
var spotz:Array = new Array()

while(i<400){i++;n=0;trace(i)
while(n<400){n++;j++
var pixelValue:uint = bmd.getPixel(i, n);

spotx[j] = i
spoty[j] = n
spotz[j] = pixelValue * 0.00001
}
}
function triangles(e:Event):void
{

    }

```
