Table Of Contents

Previous topic

util.Quaternion

Next topic

visible

This Page

util.Vec3

Constructor

class util.Vec3(x, y, z)
Arguments:
  • x
  • y
  • z
:returns :
a vec3 object Vec3 should be assumed to only have .x, .y, and .z.

Methods

add(rhs)
Arguments:
  • rhs – the vector to add to this vector
Returns:

vector sum of this vector and rhs

clone()
Returns:a copy of this Vec3.

Make a copy of this vector.

componentMultiply(rhs)
Arguments:
  • rhs – the vector whose components need to be multiplied
Returns:

the vector with the component wise product

cross(rhs)
Arguments:
  • rhs – a Vec3
Returns:

a Vec3 representing the vector product of this vector with rhs

div(rhs)
Arguments:
  • rhs – scalar
Returns:

returns a vector scaled by (1/rhs)

dot(rhs)
Arguments:
  • rhs – a Vec3
Returns:

a scalar representing the dot product of this vector with rhs

equal(rhs)
param rhs:any type
returns:True if rhs is not a quaternion and x,y,and z fields
of this and rhs are identical. False otherwise.
rtype:bool
length()
Returns:the length of this vector
lengthSquared()
Returns:the length-squared of this vector
max(rhs)
param rhs:a Vec3
returns:a Vec3 where each component is the maximum of the components

of this vector and rhs For example, Vec3(3, 4, 7).max( Vec3(1, 5, 6)) returns a Vec3(3, 5, 7)

min(rhs)
param rhs:a Vec3
returns:a Vec3 where each component is the minimum of the components

of this vector and rhs For example, Vec3(3, 4, 7).min( Vec3(1, 5, 6) ) returns a Vec3(1, 4, 6)

mul(rhs)
Arguments:
  • rhs
Returns:

if rhs is a number, returns what scale(rhs) returns if rhs is a Vec3, it returns the componentMultiply(rhs)

neg()
Returns:negation of this vector
normal()
Returns:the unit Vec3 normal to this vector
reflect(normal)
Arguments:
  • normal – The Vec3 across which to take reflection
Returns:

the Vec3 which is the reflection of this vector in the normal

scale(rhs)
Arguments:
  • rhs – a scalar
Returns:

returns a vector scaled by the amount rhs

sub(rhs)
Arguments:
  • rhs – the vector to subtract from this vector
Returns:

vector difference of this vector and rhs (this - rhs)