Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Math.Vector.Vector Class Reference

Public Member Functions

None __init__ (self, Optional[float] x=None, Optional[float] y=None, Optional[float] z=None, Optional[numpy.ndarray] data=None, Optional[int] round_digits=None)
 
numpy.ndarray getData (self)
 
None setRoundDigits (self, int digits)
 
def x (self)
 
def y (self)
 
def z (self)
 
"Vector" set (self, Optional[float] x=None, Optional[float] y=None, Optional[float] z=None)
 
float angleToVector (self, "Vector" vector)
 
"Vector" normalized (self)
 
float length (self)
 
numpy.ndarray dot (self, other)
 
"Vector" cross (self, other)
 
"Vector" multiply (self, "Matrix" matrix)
 
"Vector" preMultiply (self, "Matrix" matrix)
 
"Vector" scale (self, "Vector" other)
 
def __eq__ (self, other)
 
bool equals (self, "Vector" other, float epsilon=1e-6)
 
def __add__ (self, other)
 
def __iadd__ (self, other)
 
def __sub__ (self, other)
 
def __isub__ (self, other)
 
def __mul__ (self, other)
 
def __imul__ (self, other)
 
def __rmul__ (self, other)
 
def __truediv__ (self, other)
 
def __itruediv__ (self, other)
 
def __rtruediv__ (self, other)
 
def __neg__ (self)
 
def __repr__ (self)
 
def __str__ (self)
 
def __lt__ (self, other)
 
def __gt__ (self, other)
 
def __le__ (self, other)
 
def __ge__ (self, other)
 

Public Attributes

 round_digits
 

Static Public Attributes

None Null = None
 
None Unit_X = None
 
None Unit_Y = None
 
None Unit_Z = None
 

Protected Member Functions

numpy.ndarray _normalizeVector (self, numpy.ndarray data)
 

Protected Attributes

 _data
 

Detailed Description

Simple 3D-vector class based on numpy arrays.

This class represents an immutable 3-dimensional vector.

Constructor & Destructor Documentation

◆ __init__()

None UM.Math.Vector.Vector.__init__ (   self,
Optional[float]   x = None,
Optional[float]   y = None,
Optional[float]   z = None,
Optional[numpy.ndarray]   data = None,
Optional[int]   round_digits = None 
)
Initialize a new vector
:param x: X coordinate of vector.
:param y: Y coordinate of vector.
:param z: Z coordinate of vector.

Member Function Documentation

◆ _normalizeVector()

numpy.ndarray UM.Math.Vector.Vector._normalizeVector (   self,
numpy.ndarray  data 
)
protected
Return length, i.e. Euclidean norm, of ndarray along axis.

◆ angleToVector()

float UM.Math.Vector.Vector.angleToVector (   self,
"Vector"  vector 
)
Get the angle from this vector to another

◆ equals()

bool UM.Math.Vector.Vector.equals (   self,
"Vector"  other,
float   epsilon = 1e-6 
)
Compares this vector to another vector.

:param epsilon: optional tolerance value for the comparision.
:returns: True if the two vectors are the same.

◆ getData()

numpy.ndarray UM.Math.Vector.Vector.getData (   self)
Get numpy array with the data
:returns: numpy array of length 3 holding xyz data.

◆ scale()

"Vector" UM.Math.Vector.Vector.scale (   self,
"Vector"  other 
)
Scale a vector by another vector.

This will do a component-wise multiply of the two vectors.

◆ x()

def UM.Math.Vector.Vector.x (   self)
Return the x component of this vector

◆ y()

def UM.Math.Vector.Vector.y (   self)
Return the y component of this vector

◆ z()

def UM.Math.Vector.Vector.z (   self)
Return the z component of this vector

The documentation for this class was generated from the following file: