pymel.core.datatypes.Vector

Inheritance diagram of Vector

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'))
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])

Previous topic

pymel.core.datatypes.Unit

Next topic

pymel.core.datatypes.VectorN

Core

Core Modules

Other Modules

This Page