Overview¶
Initializes a new
Vector4d. |
|
Returns a string representation of the Vector4D object.
|
|
Retrieves X/Y/Z/W components by index |
|
Assigns X/Y/Z/W components by index |
|
Not implemented. |
|
Adds another |
|
Subtracts another |
|
If other is a
c4d.Vector4d, multiplies each vector component in the left-hand vector by its counterpart in the right-hand vector and returns the vector result. |
|
Not implemented. |
|
Checks if 2 vectors are equal. |
|
Check if 2 vectors are not equal. |
|
Not implemented. |
|
Not implemented. |
|
Not implemented. |
|
Not implemented. |
Sets all vector components to zero. |
|
Calculates the dot product of the |
|
Scales the vector so that |
|
Scales the vector so that |
|
Retrieves a |
Members¶
-
Vector4d.__init__(self, x, y, z, w)¶ - Initializes a new
Vector4d.All arguments are optional so it is possible to create a new vector without any arguments. X/Y/Z components are simply 0 and W 1.If only 1 argument is passed, it can be either a number orc4d.Vector: - number: All components are set to this number. -c4d.Vector: X/Y/Z components of the passed vector are copied to the new vector and W is set 1.If 2 arguments are passed: - The first argument has to be ac4d.Vectorand the second one a number. X/Y/Z components of the passed vector are copied to the new vector and W is set the number argument.If 4 arguments are passed: - x, y, z, w have to be floats and are respectively assigned to X/Y/Z/W components.>>> c4d.Vector4d() Vector4d(0,0,0,1) >>> c4d.Vector4d(5) Vector4d(5, 5, 5, 5) >>> v = c4d.Vector(5, 5, 5) >>> c4d.Vector(v) Vector4d(5, 5, 5, 1) >>> c4d.Vector4d(1, 2, 3, 4) Vector4d(1, 2, 3, 4)
- Parameters
x (Union[int, float, c4d.Vector]) – If x is a number and is the only passed argument, set this to X/Y/Z components. If x is a
c4d.Vector, its X/Y/Z components are copied to the new vector. Otherwise set the X component.y (number) – The Y component. If 2 arguments are passed, set to W component.
z (number) – The Z component.
w (number) – The W component.
-
Vector4d.__str__(self)¶ - Returns a string representation of the Vector4D object.Called if str() is invoked on a
Vector4dobject. See object.__str__() for more information on Python’s data model.>>> c4d.Vector4d(3.0, 4.0, 2.0, 5.0) Vector4d(3, 4, 2, 5)
- Return type
str
- Returns
The
c4d.Vector4das string.
-
Vector4d.__getitem__(self, key)¶ Retrieves X/Y/Z/W components by index
>>> v = c4d.Vector4d(1, 2, 3, 4) >>> v[0] 1 >>> v[1] 2 >>> v[2] 3 >>> v[3] 4
- Parameters
key (int) – The component index.
- Raises
IndexError – If the index key is out of range : 0<=key<3.
- Return type
float
- Returns
The
c4d.Vector4dcomponent.
-
Vector4d.__setitem__(self, key, value)¶ Assigns X/Y/Z/W components by index
>>> v = c4d.Vector4d(1, 2, 3, 4) >>> v[3] = 0 >>> v Vector4d(1, 2, 3, 0)
- Parameters
key (int) – The component index.
value (float) – The new value for the
c4d.Vector4dcomponent.
- Raises
IndexError – If the index key is out of range : 0<=key<3.
-
Vector4d.__del__(self)¶ Not implemented.
Note
The
Vector4ddoes not support item deletion, e.g., by calling del(v[0]).- Raise
TypeError.
-
Vector4d.__add__(self, other)¶ Adds another
c4d.Vector4dto thec4d.Vector4d>>> c4d.Vector4d(1, 2, 3, 4) + c4d.Vector4d(2, 3, 4, 5) Vector4d(3, 5, 7, 9)
- Parameters
other (c4d.Vector4d) – The other vector.
- Return type
- Returns
The resulting vector.
-
Vector4d.__sub__(self, other)¶ Subtracts another
c4d.Vector4dfrom thec4d.Vector4d>>> c4d.Vector4d(1, 2, 3, 4) - c4d.Vector4d(2, 3, 4, 5) Vector4d(-1, -1, -1, -1)
- Parameters
other (c4d.Vector4d) – The other vector.
- Return type
- Returns
The resulting vector.
-
Vector4d.__mul__(self, other)¶ - If other is a
c4d.Vector4d, multiplies each vector component in the left-hand vector by its counterpart in the right-hand vector and returns the vector result.If other is a number, multiplies each vector components by the scalar and returns the vector result.>>> c4d.Vector4d(1, 2, 3, 4) * c4d.Vector4d(2, 3, 4, 5) Vector4d(2, 6, 12, 20) >>> c4d.Vector4d(1, 2, 3, 4) * 5 Vector4d(5, 10, 15, 20)
- Parameters
other (Union[int, float, c4d.Vector]) – The other operand.
- Return type
- Returns
The resulting vector.
-
Vector4d.__rmul__(self, other)¶ Not implemented.
- Raise
TypeError.
-
Vector4d.__eq__(self, other)¶ Checks if 2 vectors are equal.
- Parameters
other (c4d.Vector4d) – The other vector.
- Return type
bool
- Returns
True if both vectors are equal, otherwise False.
-
Vector4d.__ne__(self, other)¶ Check if 2 vectors are not equal.
- Parameters
other (c4d.Vector4d) – The other vector.
- Return type
bool
- Returns
True if both vectors are not equal, otherwise False.
-
Vector4d.__ge__(self, other)¶ Not implemented.
- Raise
TypeError.
-
Vector4d.__gt__(self, other)¶ Not implemented.
- Raise
TypeError.
-
Vector4d.__le__(self, other)¶ Not implemented.
- Raise
TypeError.
-
Vector4d.__lt__(self, other)¶ Not implemented.
- Raise
TypeError.
-
Vector4d.SetZero(self)¶ Sets all vector components to zero.
-
Vector4d.Dot(self, b)¶ Calculates the dot product of the
c4d.Vector4dandc4d.Vector4db.- Parameters
b (c4d.Vector4d) – The other vector.
- Return type
float
- Returns
The dot product.
-
Vector4d.MakeVector3(self)¶ Scales the vector so that
Vector4d.wequals 1.
-
Vector4d.NormalizeW(self)¶ Scales the vector so that
Vector4d.wequals 1.New in version R20.
-
Vector4d.GetVector3(self)¶ Retrieves a
c4d.Vectorfrom thec4d.Vector4d.- Return type
- Returns
The converted
c4d.Vector.