Type Reference

Type TVector Implements a 3D vector. Can be used as a 2D vector by ignoring Z.

Field x:Float The X component of the vector.


Field y:Float The Y component of the vector.


Field z:Float The Z component of the vector.


Method IsNull:Int() Is the vector null.

Returns: True if the vector is null (all components zero), False otherwise.



Method Length:Float() The length of the vector.

Returns: The length of the vector.



Method Normalise() Normalise the vector so its length is 1.


Method SetLength( sc:Float ) Set the vector so its length is sc.


Method AddScalar( sc:Float ) Adds sc to all components.


Method Minus() Reverse the direction of the vector.


Method Scale( sc:Float ) Scale all components by sc.


Method Add( v:TVector ) Add another vector to this vector.


Method Subtract( v:TVector ) Subtract another vector from this vector.


Method ScaleVector( v:TVector ) Scale this vector by another vector.


Method InverseScaleVector( v:TVector ) Inverse scale this vector by another vector.


Method Cross:TVector( v:TVector ) Calculate the cross product of this vector with another.

Returns: A new TVector holding the cross product.



Method Dot:Float( v:TVector ) Calculate the dot product of this vector with another.

Returns: The dot product.



Function Create:TVector( dx:Float=0.0, dy:Float=0.0, dz:Float=0.0 ) Create a vector.

Returns: The created vector.

dx, dy and dz are the initial component values.




Module Information

Framework Simple Vector class
Copyright Public Domain
Author Ian Cowburn
Version $Revision$