Xyz specifies a x,y,z position or vector.

Class Properties (see Type)

New
(Xyz) or (x,y,z)-> xyz Create a new Xyz value. Its xyz components are initialized by another Xyz or up to 3 Floats as parameters. Otherwise, the components are initialized to 0.0 (the zero vector).

Instance Methods

+
(Xyz) -> Xyz Return a new Xyz, calculated as the addition of self to the passed Xyz.
-
(Xyz) -> Xyz Return a new Xyz, calculated as the subtraction of self by the passed Xyz.
*
(Xyz) or (scalar) -> Xyz Return a new Xyz value that is scaled by a float or Xyz value.
Add
(Xyz, *scale) or (Xyz1, Xyz2, *scale) or (x,y,z)-> self Return the Xyz value after adding two Xyz vectors. If three floats are passed, they are added to self. If only one Xyz value is passed, it is added to self. If two Xyz values are passed, their addition is stored in self. If a scalar Float is also passed, it is multiplied to the latter Xyz value.
Cross
(Xyz) or (Xyz, Xyz)-> xyz. Return the Xyz value after calculating into it the cross-product of two Xyz vectors.
Distance
(Xyz)-> len Return the distance between self and passed Xyz.
DistanceSquared
(Xyz)-> len Return the square of the distance between self and passed Xyz.
Dot
(Xyz) -> Float Return the dot product of self with the passed Xyz value.
Equals?
(Xyz) -> Bool Return true if self is (almost) equal to the passed Xyz value, false if not equal, or null if an Xyz is not passed.
Length
-> len. Return the length of xyz vector as a Float: sqrt(x*x+y*y+z*z)
LengthSquared
-> lensquared. Return the squared length of xyz vector as a Float: x*x+y*y+z*z
Lerp
(Xyz1, Xyz2, scalar) -> xyz. Calculate and return Xyz value linearly interpolated between two Xyz values by a scalar from 0 to 1.
Mult
Return the Xyz value obtained from multiplying two values. If the second parm is an Xyz, it is the Xyz value used on the right side of the multiplication, otherwise self is used as the right-hand term. The first parameter (left-hand term) can be a Float scalar, Xyz scalar, Quaternion or matrix.
Negate
(Xyz) or ()-> Xyz Negate and return an Xyz value. If an Xyz value is passed, put its negative in self. Otherwise negate self.
Normalize
-> Xyz Normalize and return self to its unit equivalent (length is 1.0).
Scale
(Xyz) or (scalar)-> xyz. Return the Xyz value after scaling it up by a scalar or passed x,y,z values.
Set
(Xyz) or (x,y,z)-> xyz. Update Xyz value's x,y,z with components from passed Xyz or passed x,y,z Floats
Unit
(Xyz) or ()-> Xyz Populate a passed Xyz or return a new Xyz value that holds the unit equivalent to self (length is 1.0).
Unpack
-> x,y,z. Return the x,y,z values as separate Floats
Zero
() -> Xyz Set the xyz components to 0 and return self.
Zero?
() -> Bool Return true if (almost) equal to the zero vector or false if not.

Instance Properties

x
Get or set the 'x' component.
y
Get or set the 'y' component.
z
Get or set the 'z' component.