XYZ class in Global context

3D vector

16 members:

float length
float

length

string toString
string

textual form

float x
float

x

float y
float

y

float z
float

z

function add
doesn't return a value

add

function add(XYZ)

Note: it does not return a new object, just modifies the existing one

function clone
returns XYZ

create new XYZ object copying the coordinates

function clone()

Note: copying object references does not create new objects. Use clone() if a new object is needed.

Example:
var o1=(1,2,3), o2=o1, o3=o1.clone();
o1.y=9999;
//o2 is now (1,9999,3) but o3 is still (1,2,3)

function get
returns float

get one of coordinates

function get(integer index)

this function makes the XYZ objects "indexable" (so you can use [] for accessing subsequent fields, like in Vector)

function new
returns XYZ

create new XYZ object

function new(float x, float y, float z)

3D vectors objects can be also created using the (x,y,z) notation, i.e. var v=(1,2,3) is the same as var v=XYZ.new(1,2,3);

function normalize
doesn't return a value

normalize

function normalize()

scales the vector length to 1.0

function revRotate
doesn't return a value

reverse rotate using Orient object

function revRotate(Orient)
function rotate
doesn't return a value

rotate using Orient object

function rotate(Orient)
function scale
doesn't return a value

multiply by scalar

function scale(float)
function set
doesn't return a value

set (copy) coordinates from another XYZ object

function set(XYZ)
function set3
doesn't return a value

set individual 3 coordinates

function set3(float x, float y, float z)
function sub
doesn't return a value

subtract

function sub(XYZ)

Note: it does not return a new object, just modifies the existing one


Global context