A 3 dimensional vector object.
In many instances a Vec3 will be accessible from Nape which is marked
as immutable, these cases will be documented and modifying such a Vec3
will result in an error.
Static methods
staticget(x:Float = 0, y:Float = 0, z:Float = 0):Vec3
Allocate a Vec3 from the global object pool.
Use of this method should always be preferred to the constructor.
Parameters:
x | The x component of Vec3. (default 0) |
---|---|
y | The y component of Vec3. (default 0) |
z | The z component of Vec3. (default 0) |
Returns:
A Vec3 allocated from global object pool with given components.
Constructor
new(x:Float = 0, y:Float = 0, z:Float = 0)
Construct a new Vec3.
This method should not generally be used with preference for the
static get method which will make use of the global object pool.
Parameters:
x | The x component of Vec3. (default 0) |
---|---|
y | The y component of Vec3. (default 0) |
z | The z component of Vec3. (default 0) |
Returns:
A newly constructed Vec3 with given components.
Variables
Methods
dispose():Void
Produce a copy of this Vec3.
Returns:
The copy of this Vec3.
Throws:
# | If this Vec3 has been disposed of. public function copy():Vec3{
} /** Release Vec3 object to global object pool. |
---|---|
# | If this Vec3 has already been disposed of. |
# | If this Vec3 is immutable. |
lsq():Float
Compute squared length of Vec3.
Returns:
The squared length of this Vec3.
Throws:
# | If the Vec3 has been disposed of. |
---|
set(vector:Vec3):Vec3
Set values of this Vec3 from another.
Parameters:
vector | The vector to set values from. |
---|
Returns:
A reference to this Vec3.
Throws:
# | If the vector argument is null. |
---|---|
# | If this, or the vector argument are disposed of. |
# | If this Vec3 is immutable. |
setxyz(x:Float, y:Float, z:Float):Vec3
Set values of this Vec3 from numbers.
Parameters:
x | The new x component value for this vector. |
---|---|
y | The new y component value for this vector. |
z | The new z component value for this vector. |
Returns:
A reference to this Vec3.
Throws:
# | If this Vec3 has been disposed of. |
---|---|
# | If this Vec3 is immutable. |
xy(weak:Bool = false):Vec2
Produce copy of the xy components of Vec3.
This function will return a new Vec2 completely seperate
from this Vec3 with values equal to the xy components of
this Vec3.
Parameters:
weak | If true, then the allocated Vec2 will be weak so that when used as an argument to a Nape function it will be automatically released back to the global object pool. (default false) |
---|
Returns:
An allocated Vec2 representing the xy components of this vector.