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)
 
 x (self)
 
 y (self)
 
 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)
 
 __eq__ (self, other)
 
bool equals (self, "Vector" other, float epsilon=1e-6)
 
 __add__ (self, other)
 
 __iadd__ (self, other)
 
 __sub__ (self, other)
 
 __isub__ (self, other)
 
 __mul__ (self, other)
 
 __imul__ (self, other)
 
 __rmul__ (self, other)
 
 __truediv__ (self, other)
 
 __itruediv__ (self, other)
 
 __rtruediv__ (self, other)
 
 __neg__ (self)
 
 __repr__ (self)
 
 __str__ (self)
 
 __lt__ (self, other)
 
 __gt__ (self, other)
 
 __le__ (self, other)
 
 __ge__ (self, other)
 

Public Attributes

 round_digits
 
 x
 
 y
 
 z
 

Static Public Attributes

 Null = None
 
 Unit_X = None
 
 Unit_Y = 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()

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

◆ y()

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

◆ z()

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

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