PDA

View Full Version : [Iso 3D] some experiments


AVisioN
12-29-2005, 06:01 PM
For pixelByPixel and IsoDraw you`ll need flash 8.

IsoGrid is a "thing" wich i think could be taken further.

I really would appreciate some feedback.

See it here (http://www.nomoremedia.com)

senocular
12-29-2005, 06:08 PM
They're really nice AVisioN ;)

AVisioN
12-29-2005, 06:29 PM
hi senocular - i hope you don`t mind that i`m trying to get feedback ;)

Here a gift for you:
import com.nomoremedia.utils.*

class com.nomoremedia.utils.VectorMath{

static function length(v:Vector):Number{

return Math.sqrt(v.x*v.x + v.y*v.y + v.z*v.z);

}

static function normalize(v:Vector):Vector{

var lngth = length(v);

var vector = new Vector();

vector.x = v.x / lngth;

vector.y = v.y / lngth;

vector.z = v.z / lngth;

return vector;

}

static function sum(a:Vector,b:Vector):Vector{

var vector = new Vector();

vector.x = a.x + b.x;

vector.y = a.y + b.y;

vector.z = a.z + b.z;

return vector;

}

static function difference(a:Vector,b:Vector):Vector{

var vector = new Vector();

vector.x = a.x - b.x;

vector.y = a.y - b.y;

vector.z = a.z - b.z;

return vector;

}

static function scalarProduct(a:Vector,b:Vector):Number{

return a.x * b.x + a.y * b.y + a.z * b.z;

}

static function crossProduct(a:Vector,b:Vector):Vector{

var vector = new Vector();

vector.x = a.y * b.z - a.z * b.y;

vector.y = a.z * b.x - a.x * b.z; ;

vector.z = a.x * b.y - a.y * b.x; ;

return vector;

}

}

Here the Vector
class com.nomoremedia.utils.Vector{

private var _x:Number;

private var _y:Number;

private var _z:Number;

public function Vector(x:Number,y:Number,z:Number){

_x = _y = _z = 0;

if(x != null) _x = x;

if(y != null) _y = y;

if(z != null) _z = z;

}

public function get x():Number{

return _x;

}

public function set x(x:Number):Void{

_x = x;

}

public function get y():Number{

return _y;

}

public function set y(y:Number):Void{

_y = y;

}

public function get z():Number{

return _z;

}

public function set z(z:Number):Void{

_z = z;

}

public function toString():String{

return "Vector{\n x:"+_x+"\n"+" y:"+_y+"\n"+" z:"+_z+"\n}";

}

}

I`m really young to OOP - but i think the world defines/calculates physics and not the "piece" of it. I saw three days ago that r.p. also has a (2d) vector class (beside of many others) and they all "teach" the Vector to "know" things..

Wouldn`t it take more memory if each Vector would be a little Mathgenie ?

Hmm... this is a crucial point for further development

PS: It could be that i hit Padova next year.