maxon.Vec4¶
Description¶
maxon.Data
class.maxon.DataType
).Inheritance diagram¶
Inheritance
Parent Class:
Children Classes:
maxon.IntVector4d32
maxon.IntVector4d64
Attributes¶
(float) the w component |
|
(float) the x component |
|
(float) the y component |
|
(float) the z component |
Methods Signature¶
|
Returns a vector that is clamped to the range [0.0 . |
Calculates the average value of ‘x’, ‘y’, ‘z’ and ‘w’. |
|
Retrieves the length of the vector. |
|
|
Returns the maximum of ‘x’, ‘y’, ‘z’ and ‘w’. |
|
Return the minimum of ‘x’, ‘y’, ‘z’ and ‘w’. |
Retrieves the squared length of the vector. |
|
|
Tests component-wise if the difference is no bigger than ‘epsilon’. |
|
Checks if each component is zero. |
Checks if each component are less or equal to v |
|
|
Converts the data to the expected type (built-in). |
|
Sets all components to zero. |
|
Adds another vector to the current vector. |
|
Divides each vector component by a scalar. |
|
Checks if two vectors are equal. |
|
Retrieves the value of the x, y, z or w component of the vector.
|
|
Returns the hash code of a vector. |
|
Adds another vector to the current vector. |
|
Divides each vector component by a scalar. |
|
Multiplies each vector components by the scalar and returns the vector result. |
|
Initializes a new four component vector.
|
|
Subtracts another vector to the current vector. |
|
Iterates vector values in the next order: x, y, z, w. |
|
|
|
|
|
Multiplies each vector components by the scalar and returns the vector result. |
|
Checks if two vectors are not equal. |
|
Assigns a value to the x, y or z w component of the vector.
|
|
Returns the string representation of a data. |
|
Subtracts another vector to the current vector. |
Methods Definition¶
-
Vec4.
Clamp01
()¶ Returns a vector that is clamped to the range [0.0 .. 1.0].
- Returns
The vector clamped.
- Return type
-
Vec4.
GetAverage
()¶ Calculates the average value of ‘x’, ‘y’, ‘z’ and ‘w’.
- Returns
the average value.
- Return type
float
-
Vec4.
GetLength
()¶ Retrieves the length of the vector.
- Returns
Vector length.
- Return type
float
-
Vec4.
GetMax
()¶ Returns the maximum of ‘x’, ‘y’, ‘z’ and ‘w’.
- Returns
The maximum value.
- Returns
float
-
Vec4.
GetMin
()¶ Return the minimum of ‘x’, ‘y’, ‘z’ and ‘w’.
- Returns
The minimum value.
- Returns
float
-
Vec4.
GetSquaredLength
()¶ Retrieves the squared length of the vector.
- Returns
Vector squared length.
- Return type
float
-
Vec4.
IsEqual
(other, epsilon=0.01)¶ Tests component-wise if the difference is no bigger than ‘epsilon’.
- Parameters
other (
maxon.Vec3
) – The other color to compare with.epsilon (float) – The tolerance value.
- Returns
True if both color are identical.
- Return type
bool
-
Vec4.
IsZero
()¶ Checks if each component is zero.
- Returns
True if all component is zero.
- Return type
bool
-
Vec4.
LessThanOrEqual
(v)¶ Checks if each component are less or equal to v
- Parameters
v – The maximum value to checks for.
- Returns
True if all components are less or equals to the passed value.
- Return type
bool
-
Vec4.
MaxonConvert
(expected=None)¶ Converts the data to the expected type (built-in).
- Parameters
expected (Any) – The expected type after the conversion.
- Returns
The data converted.
- Return type
Same as expected
-
Vec4.
SetZero
()¶ Sets all components to zero.
-
Vec4.
__add__
(scalar)¶ Adds another vector to the current vector.
- Parameters
scalar (
maxon.Vec4
) – The other vector.
-
Vec4.
__div__
(scalar)¶ Divides each vector component by a scalar.
- Parameters
scalar (Union[int, float]) – The other operand.
- Return type
- Returns
The resulting vector.
-
Vec4.
__eq__
(other)¶ Checks if two vectors are equal.
- Parameters
other (
maxon.Vec4
) – The other vector.- Return type
bool
- Returns
True if both vectors are equal.
-
Vec4.
__getitem__
(index)¶ - Retrieves the value of the x, y, z or w component of the vector.The component is identified by an index in the interval [0, 3].
- Parameters
index (int) – The component index.
- Raises
IndexError – When key does not satisfy 0 <= key < 3.
- Return type
float
- Returns
The vector component.
-
Vec4.
__hash__
()¶ Returns the hash code of a vector.
-
Vec4.
__iadd__
(other)¶ Adds another vector to the current vector.
- Parameters
other (
maxon.Vec4
) – The other vector.
-
Vec4.
__idiv__
(scalar)¶ Divides each vector component by a scalar.
- Parameters
scalar (Union[int, float]) – The other operand.
- Return type
- Returns
The resulting vector.
-
Vec4.
__imul__
(scalar)¶ Multiplies each vector components by the scalar and returns the vector result.
- Parameters
scalar (float) – The other vector.
- Return type
- Returns
The resulting vector.
-
Vec4.
__init__
(x=None, y=None, z=None, w=None)¶ - Initializes a new four component vector.It is possible to instantiate a new vector without any arguments, causing the x, y, z, wcomponents to default to the value 0. The type can otherwise be instantiated with one orfour arguments, either setting all components to the same value or copying another
maxon.Vec4
instance, or setting all three components individually.- ..note:
This type should not be instantiated directly, use instead the type
maxon.Vector4d
.
- Parameters
x (Optional[
maxon.Vec4
, float]) – If x is the only passed argument. If this is a float set this value to X/Y/Z/W components. If this is a vector, this vector is copied.y (float) – The z component. Can only be passed if z and w are also defined.
z (float) – The z component. Can only be passed if w is also defined.
w (float) – The w component.
-
Vec4.
__isub__
(other)¶ Subtracts another vector to the current vector.
- Parameters
other (
maxon.Vec4
) – The other vector.- Return type
- Returns
The resulting vector.
-
Vec4.
__iter__
()¶ Iterates vector values in the next order: x, y, z, w.
-
Vec4.
__len__
()¶
-
Vec4.
__maxon_convert__
(expected=None)¶
-
Vec4.
__mul__
(scalar)¶ Multiplies each vector components by the scalar and returns the vector result.
- Parameters
scalar (float) – The other vector.
- Return type
- Returns
The resulting vector.
-
Vec4.
__ne__
(other)¶ Checks if two vectors are not equal.
- Parameters
other (
maxon.Vec4
) – The other vector.- Return type
bool
- Returns
True if both vectors are not equal.
-
Vec4.
__setitem__
(index, value)¶ - Assigns a value to the x, y or z w component of the vector.The component is identified by an index in the interval [0, 3].
- Parameters
index (int) – The index to which the value should be assigned.
value (float) – The value to assign for the given index.
-
Vec4.
__str__
()¶ Returns the string representation of a data.
- Return type
str
-
Vec4.
__sub__
(scalar)¶ Subtracts another vector to the current vector.
- Parameters
scalar (
maxon.Vec4
) – The other vector.- Return type
- Returns
The resulting vector.