pymel.core.datatypes.Vector¶
digraph inheritance05bd61e821 { rankdir=TB; ranksep=0.15; nodesep=0.15; size="8.0, 12.0"; "Array" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="../pymel.util.arrays/pymel.util.arrays.Array.html#pymel.util.arrays.Array",style="setlinewidth(0.5)",tooltip="A generic n-dimensional array class using nested lists for storage.",height=0.25,shape=box,fontsize=8]; "MVector" [shape=box,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=8,style="setlinewidth(0.5)",height=0.25]; "Vector" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="#pymel.core.datatypes.Vector",style="setlinewidth(0.5)",tooltip="A 3 dimensional vector class that wraps Maya's api Vector class",height=0.25,shape=box,fontsize=8]; "VectorN" -> "Vector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "MVector" -> "Vector" [arrowsize=0.5,style="setlinewidth(0.5)"]; "VectorN" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="../pymel.util.arrays/pymel.util.arrays.VectorN.html#pymel.util.arrays.VectorN",style="setlinewidth(0.5)",tooltip="A generic size VectorN class derived from Array, basically a 1 dimensional Array.",height=0.25,shape=box,fontsize=8]; "Array" -> "VectorN" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
- class Vector(*args, **kwargs)¶
A 3 dimensional vector class that wraps Maya’s api Vector class
>>> from pymel.all import * >>> import pymel.core.datatypes as dt >>> >>> v = dt.Vector(1, 2, 3) >>> w = dt.Vector(x=1, z=2) >>> z = dt.Vector( dt.Vector.xAxis, z=1)
>>> v = dt.Vector(1, 2, 3, unit='meters') >>> print v [1.0, 2.0, 3.0]
- Axis = Enum( EnumValue('Axis', 0, 'xaxis'), EnumValue('Axis', 1, 'yaxis'), EnumValue('Axis', 2, 'zaxis'), EnumValue('Axis', 3, 'waxis'))¶
- __add__(other)¶
u.__add__(v) <==> u+v Returns the result of the addition of u and v if v is convertible to a VectorN (element-wise addition), adds v to every component of u if v is a scalar
- __contains__(value)¶
True if at least one of the vector components is equal to the argument
- __div__(other)¶
u.__div__(v) <==> u/v Returns the result of the division of u by v if v is convertible to a VectorN (element-wise division), divide every component of u by v if v is a scalar
- __eq__(other)¶
u.__eq__(v) <==> u == v Equivalence test
- __getitem__(i)¶
Get component i value from self
- __iadd__(other)¶
u.__iadd__(v) <==> u += v In place addition of u and v, see __add__
- __idiv__(other)¶
u.__idiv__(v) <==> u /= v In place division of u by v, see __div__
- __imul__(other)¶
u.__imul__(v) <==> u *= v Valid for Vector * Matrix multiplication, in place transformation of u by Matrix v or Vector by scalar multiplication only
- __isub__(other)¶
u.__isub__(v) <==> u -= v In place substraction of u and v, see __sub__
- __iter__(*args, **kwargs)¶
Iterate on the api components
- __ixor__(other)¶
u.__xor__(v) <==> u^=v Inplace cross product or transformation by inverse transpose of v is v is a MatrixN
- __len__()¶
Number of components in the Vector instance, 3 for Vector, 4 for Point and Color
- __mul__(other)¶
u.__mul__(v) <==> u*v The multiply ‘*’ operator is mapped to the dot product when both objects are Vectors, to the transformation of u by matrix v when v is a MatrixN, to element wise multiplication when v is a sequence, and multiplies each component of u by v when v is a numeric type.
- __ne__(other)¶
u.__ne__(v) <==> u != v Equivalence test
- __neg__()¶
u.__neg__() <==> -u The unary minus operator. Negates the value of each of the components of u
- __radd__(other)¶
u.__radd__(v) <==> v+u Returns the result of the addition of u and v if v is convertible to a VectorN (element-wise addition), adds v to every component of u if v is a scalar
- __rdiv__(other)¶
u.__rdiv__(v) <==> v/u Returns the result of of the division of v by u if v is convertible to a VectorN (element-wise division), invert every component of u and multiply it by v if v is a scalar
- __rmul__(other)¶
u.__rmul__(v) <==> v*u The multiply ‘*’ operator is mapped to the dot product when both objects are Vectors, to the left side multiplication (pre-multiplication) of u by matrix v when v is a MatrixN, to element wise multiplication when v is a sequence, and multiplies each component of u by v when v is a numeric type.
- __rsub__(other)¶
u.__rsub__(v) <==> v-u Returns the result of the substraction of u from v if v is convertible to a VectorN (element-wise substration), replace every component c of u by v-c if v is a scalar
- __setitem__(i, a)¶
Set component i value on self
- __sub__(other)¶
u.__sub__(v) <==> u-v Returns the result of the substraction of v from u if v is convertible to a VectorN (element-wise substration), substract v to every component of u if v is a scalar
- __xor__(other)¶
u.__xor__(v) <==> u^v Defines the cross product operator between two 3D vectors, if v is a MatrixN, u^v is equivalent to u.transformAsNormal(v)
- angle(other)¶
u.angle(v) <==> angle(u, v) –> float Returns the angle (in radians) between the two vectors u and v Note that this angle is not signed, use axis to know the direction of the rotation
- apicls¶
alias of MVector
- assign(value)¶
Wrap the Vector api assign method
- axis(other, normalize=False)¶
u.axis(v) <==> angle(u, v) –> Vector Returns the axis of rotation from u to v as the vector n = u ^ v if the normalize keyword argument is set to True, n is also normalized
- cnames = ('x', 'y', 'z')¶
- cotan(other)¶
u.cotan(v) <==> cotan(u, v) –> float : cotangent of the a, b angle, a and b should be MVectors
- cross(other)¶
cross product, only defined for two 3D vectors
- data¶
The Vector/FloatVector/Point/FloatPoint/Color data
- distanceTo(other)¶
- dot(other)¶
dot product of two vectors
- get()¶
Wrap the Vector api get method
- isEquivalent(other, tol=None)¶
Returns true if both arguments considered as Vector are equal within the specified tolerance
- isParallel(other, tol=None)¶
Returns true if both arguments considered as Vector are parallel within the specified tolerance
- length()¶
Return the length of the vector
- ndim = 1¶
- normal()¶
Return a normalized copy of self
- normalize()¶
Performs an in place normalization of self
- one = dt.Vector([1.0, 1.0, 1.0])¶
- rotateBy(*args)¶
u.rotateBy(*args) –> Vector Returns the result of rotating u by the specified arguments. There are several ways the rotation can be specified: args is a tuple of one Matrix, TransformationMatrix, Quaternion, EulerRotation arg is tuple of 4 arguments, 3 rotation value and an optionnal rotation order args is a tuple of one Vector, the axis and one float, the angle to rotate around that axis in radians
- rotateTo(other)¶
u.rotateTo(v) –> Quaternion Returns the Quaternion that represents the rotation of the Vector u into the Vector v around their mutually perpendicular axis. It amounts to rotate u by angle(u, v) around axis(u, v)
- shape = (3,)¶
- size = 3¶
- sqlength()¶
Return the square length of the vector
- transformAsNormal(other)¶
Returns the vector transformed by the matrix as a normal Normal vectors are not transformed in the same way as position vectors or points. If this vector is treated as a normal vector then it needs to be transformed by post multiplying it by the inverse transpose of the transformation matrix. This method will apply the proper transformation to the vector as if it were a normal.
- unit = None¶
- x¶
- xAxis = dt.Vector([1.0, 0.0, 0.0])¶
- xNegAxis = dt.Vector([-1.0, 0.0, 0.0])¶
- y¶
- yAxis = dt.Vector([0.0, 1.0, 0.0])¶
- yNegAxis = dt.Vector([0.0, -1.0, 0.0])¶
- z¶
- zAxis = dt.Vector([0.0, 0.0, 1.0])¶
- zNegAxis = dt.Vector([0.0, 0.0, -1.0])¶
- zero = dt.Vector([0.0, 0.0, 0.0])¶