Author Archives: Zevan

Array.push() Vector.push() Optimization

CLICK HERE TO COPY
Actionscript:

var tVerts:Vector.<Number> = new Vector.<Number>();

var inc:int = 0;

var t:Number, i:Number, j:Number, k:Number;

 

 // fast way

t = getTimer();

for (i= -2; i<2; i+=.03){

    for (j = -2; j<2; j+=.03){

        for (k = -2; k<2; k+=.03){

            tVerts[inc] = i;

            inc++;

      [...]

Posted in Vector, arrays | Tagged , | 1 Comment

Parametric UV Surface

CLICK HERE TO COPY
Actionscript:

var matrix:Matrix3D = new Matrix3D();

var verts:Vector.<Number> = new Vector.<Number>();

var pVerts:Vector.<Number> = new Vector.<Number>();

var uvts:Vector.<Number> = new Vector.<Number>();

var sqrt2:Number = Math.sqrt(2)

var pi:Number = Math.PI;

var pi23:Number= 2 * Math.PI / 3;

var step:Number= pi / 50;

for (var u:Number = -pi; u<pi; u+=step) {

    for (var v:Number = -pi; v<pi; v+=step) {

        [...]

Posted in 3D, BitmapData, Math, Vector, graphics algorithms, pixel manipulation | Tagged , | Leave a comment

Wormhole

CLICK HERE TO COPY
Actionscript:

var matrix:Matrix3D = new Matrix3D();

var verts:Vector.<Number> = new Vector.<Number>();

var pVerts:Vector.<Number> = new Vector.<Number>();

var uvts:Vector.<Number> = new Vector.<Number>();

for (var i:Number = -10; i<10; i+=.04) {

    for (var j:Number = -5; j<8; j+=.04) {

        for (var k:Number = -10; k<10; k+=.04) {

            var s:Number = [...]

Posted in 3D, BitmapData, Math, Vector, graphics algorithms, pixel manipulation | Tagged , | Leave a comment

Kusner-Schmitt (Tetrahedral Implicit Surface)

CLICK HERE TO COPY
Actionscript:

var matrix:Matrix3D = new Matrix3D();

var verts:Vector.<Number> = new Vector.<Number>();

var pVerts:Vector.<Number> = new Vector.<Number>();

var uvts:Vector.<Number> = new Vector.<Number>();

for (var i:Number = -2; i<2; i+=.02) {

    for (var j:Number = -2; j<2; j+=.02) {

        for (var k:Number = -2; k<2; k+=.02) {

            var s:Number = [...]

Posted in 3D, BitmapData, Vector, graphics algorithms | Tagged , | Leave a comment