nanome.util.vector3 module

class Vector3(x=0, y=0, z=0)[source]

Bases: object

A vector that holds 3 values. Used for position and scale.
classmethod cross(v1, v2)[source]
Returns the cross product of two vectors.
Parameters:
  • v1 (Vector3) – The first vector
  • v2 (Vector3) – The second vector
Returns:

Cross product of v1 and v2

Return type:

Vector3

classmethod distance(v1, v2)[source]
Returns the distance between two vectors.
Parameters:
  • v1 (Vector3) – The first vector
  • v2 (Vector3) – The second vector
classmethod dot(v1, v2)[source]
Returns the dot product of two vectors.
Parameters:
  • v1 (Vector3) – The first vector
  • v2 (Vector3) – The second vector
Returns:

Dot product of v1 and v2

Return type:

float

equals(other)[source]
Returns True if the components of this vector are the same as another’s.
Parameters:other (Vector3) – The other Vector3
Returns:Whether or not this vector is component-equal to ‘other’
Return type:bool
get_copy()[source]
Returns:A copy of this vector.
Return type:Vector3
magnitude
The magnitude of this vector
Type:float
normalize()[source]
Normalizes this vector and returns itself.
Returns:This vector, now normalized.
Return type:Vector3
normalized
The normalized version of this vector
Type:Vector3
set(x, y, z)[source]
Parameters:
  • x (float) – The x component to set this vector to
  • y (float) – The y component to set this vector to
  • z (float) – The z component to set this vector to
unpack()[source]
Returns:a 3-tuple containing this vector’s x, y, and z components.
Return type:tuple
x
The x component of this vector
Type:float
y
The y component of this vector
Type:float
z
The z component of this vector
Type:float