Blitz3D C++ geometry code

Blitz3D Forums/Blitz3D Programming/Blitz3D C++ geometry code

@SimonH

in "Type TQuat"
You'd better store the lenght locally...
	Method Length:Float()
		Return Sqr( w*w+v.x*v.x+v.y*v.y+v.z*v.z )
	End Method
	
	Method Normalize()
		local l_lenght:float=Lenght()
		w=w/l_lenght
		v.x=v.x/l_lenght
		v.y=v.y/l_lenght
		v.z=v.z/l_lenght
	End Method


idem for Method Normalized:TQuat()

@ Mark Sibly
not sure, but it seems to be the same
(i'm not easy with C++ programing ... so... )
I don't know how pointer "this" is archived, and don't know about redondant routines...

	void normalize(){
		float l_lenght=length();
		*this=*this/l_length;
	}
	Quat normalized()const{
		float l_lenght=length();
		return *this/l_length;
	}