Methods Signatures
Initializes a new
Vector4d. |
|
Returns a string representation of the
c4d.Vector4d. |
|
Retrieves X/Y/Z/W components by index |
|
Assigns X/Y/Z/W components by index |
|
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. |
|
Checks if 2 vectors are equal. |
|
Check if 2 vectors are not equal. |
|
raise NotImplemented. |
|
raise NotImplemented. |
|
raise NotImplemented. |
|
raise NotImplemented. |
Sets all vector components to zero. |
|
Calculates the dot product of the |
|
Scales the vector so that |
|
Scales the vector so that |
|
Retrieves a |
Methods Documentation
-
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.Vector4d(5, 5, 5) c4d.Vector4d(v) # => Vector4d(5, 5, 5, 1) c4d.Vector4d(v, 2) # => Vector4d(5, 5, 5, 2) 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.
- Return type
- Returns
A new
c4d.Vector4d.
-
Vector4d.__str__(self)¶ - Returns a string representation of the
c4d.Vector4d.v = c4d.Vector4d(3.0, 4.0, 2.0, 5.0) print v # => 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) x = v[0] y = v[1] z = v[2] w = v[3] print x, y, z, w # => 1.0 2.0 3.0 4.0
- 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 print v # => Vector4d(1, 2, 3, 0)
Note
Thec4d.Vector4dobjects does not support item deletion.For instance by calling del(v[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.__add__(self, other)¶ Adds another
c4d.Vector4dto thec4d.Vector4dc4d.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 result vector.
-
Vector4d.__sub__(self, other)¶ Subtracts another
c4d.Vector4dfrom thec4d.Vector4dc4d.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 result 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 argument.
- Return type
- Returns
The result vector.
-
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)¶ raise NotImplemented.
-
Vector4d.__gt__(self, other)¶ raise NotImplemented.
-
Vector4d.__le__(self, other)¶ raise NotImplemented.
-
Vector4d.__lt__(self, other)¶ raise NotImplemented.
-
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.