paya.runtime.data.Vector#

class Vector(*args, **kwargs)#

Inheritance

Vector VectorN Array MVector

createLocator(name=None, size=1.0)#
Shorthand

cl

Parameters
  • name/n (str) – an optional name for the locator transform; defaults to a contextual name

  • size/siz (float) – a single scalar for the locator’s localScale channels; defaults to 1.0

Returns

A locator with this 3D compound piped into its translate channel.

Return type

Transform

__add__(other)#

Implements addition (+).

Overloads pymel.core.datatypes.Vector.__add__() to add support for 1D or 3D plugs.

__radd__(other)#

Implements reflected addition (+).

Overloads pymel.core.datatypes.Vector.__radd__() to add support for 1D or 3D plugs.

__sub__(other)#

Implements subtraction (-).

Overloads pymel.core.datatypes.Vector.__sub__() to add support for 1D or 3D plugs.

__rsub__(other)#

Implements reflected subtraction (-).

Overloads pymel.core.datatypes.Vector.__rsub__() to add support for 1D or 3D plugs.

__mul__(other)#

Implements multiplication (*).

Overloads pymel.core.datatypes.Vector.__mul__() to add support for 1D, 3D and 16D (matrix) plugs.

__rmul__(other)#

Implements reflected multiplication (*).

Overloads pymel.core.datatypes.Vector.__rmul__() to add support for 1D and 3D plugs.

__truediv__(other)#

Implements division (/).

Overloads pymel.core.datatypes.Vector.__truediv__() to add support for 1D and 3D plugs.

__rtruediv__(other)#

Implements reflected division (/).

Overloads pymel.core.datatypes.Vector.__rtruediv__() to add support for 1D and 3D plugs.

__xor__(other)#

Uses the exclusive-or operator (^) to implement point-matrix multiplication.

Parameters

other (list, Matrix, Matrix) – a matrix plug or value

__pow__(other)#

Implements power (**).

Overloads pymel.core.datatypes.Vector.__pow__() to add support for 1D and 3D plugs.

__rpow__(other)#

Implements reflected power (**).

Overloads pymel.core.datatypes.Vector.__rpow__() to add support for 1D and 3D plugs.

blend(other, weight=0.5, swap=False, includeLength=False, clockNormal=None, unwindSwitch=None)#

Blends this triple towards other. Blending will be linear or, if clockNormal is provided, by vector angle.

Parameters
  • other (list [float], Vector, Math3D, str) – the triple or vector towards which to blend

  • weight/w (str, float, Math1D) – 0.5: the blending weight; when this is 1.0, other will take over fully; can be a value or plug; defaults to 0.5

  • swap/sw (bool) – swap the inputs around; defaults to False

  • clockNormal/cn (list [float], Vector, Math3D, str) – if this is True, this output and other will be regarded as vectors, and blended by angle; should be a vector perpendicular to both inputs; defaults to None

  • includeLength/ilg (bool) – ignored if clockNormal was omitted; include vector lengths in the blending calculation; defaults to False

  • unwindSwitch/uws (int, str, Math1D) –

    ignored if clockNormal was omitted; an integer value or plug to pick an angle unwinding mode:

    • 0 for shortest (the default)

    • 1 for positive

    • 2 for negative

Returns

The blended triple or vector.

Return type

paya.runtime.data.Vector | paya.runtime.plugs.Vector

rotateByAxisAngle(axisVector, angle)#
Parameters
  • axisVector (list, tuple, Vector or Vector) – the vector around which to rotate this vector

  • angle (float, Angle, str or class:~paya.runtime.plugs.Math3D) – the angle of rotation

Returns

This vector, rotated around axisVector by the specified angle.

Return type

Vector

dot(other, normalize=False)#

Returns the dot product of this vector and ‘other’.

Extends the base PyMEL method in these ways:

  • Adds the ‘normalize’ keyword argument

  • Works with plugs as well as values (if ‘other’ is a plug, the output will also be a plug)

Parameters
  • other (Math3D, Vector, Point, list, str) – the other vector

  • normalize/nr (bool) – normalize the output; defaults to False

Returns

The dot product.

Return type

Vector or Math1D

cross(other, normalize=False, inlineGate=None, guard=False)#

Returns the cross product of this vector and ‘other’.

Parameters
  • other (Math3D, Vector, Point, list, str) – the other vector

  • normalize/nr (bool) – normalize the output; defaults to False

  • guard/g (bool) –

    if the two vectors are in-line, then:

    • if other is a plug, switch the vectorProduct to ‘No Operation’

    • if other is a value, return self

    Defaults to False.

  • inlineGate/ig (bool, str, Math1D) – if you already have a boolean gate or value state to indicate whether the vectors are in-line, provide it here to prevent redundant checks; if this is provided, guard/g will be overriden to True; defaults to None

Returns

The cross product.

Return type

Vector or Math3D

angleTo(other, clockNormal=None)#

Differs from PyMEL’s pymel.core.datatypes.Vector.angle() in the following ways:

Parameters
  • other (Math3D, Vector, Point, list, str) – the other vector

  • clockNormal/cn (None, list, tuple, Vector, Vector) – provide this to get a 360 angle; defaults to None

Returns

The angle from this vector to other.

Return type

Angle or Angle

projectOnto(other)#

See https://en.wikipedia.org/wiki/Vector_projection.

Parameters

other (list, tuple, str, Vector, Vector) – the vector onto which to project this one

Returns

The project of this vector onto other.

Return type

Vector, Vector

rejectFrom(other)#

Same as ‘make perpendicular to’ (although length will change). See https://en.wikipedia.org/wiki/Vector_projection.

Parameters

other (list, tuple, str, Vector, Vector) – the vector from which to reject this one

Returns

The rejection of this vector from other.

Return type

Vector, Vector

asTranslateMatrix()#
Returns

An identity matrix with this vector / point as the translate component.

Return type

Matrix

asScaleMatrix()#

Uses this vectors’s three components as the magnitudes of an identity matrix’s base vectors.

Returns

The scale matrix.

Return type

Matrix

asShearMatrix()#

Composes this output’s three components into a shear matrix.

Returns

The shear matrix.

Return type

Matrix