paya.runtime.plugs.Vector#
- class Vector(*args, **kwargs)#
Inheritance
Math
Attribute
Attribute
PyNode
ProxyUnicode
- classmethod createAttr(attrName, node=None, angle=False, time=False, distance=False, keyable=None, channelBox=None, defaultValue=None, asData=False, childSuffixes='XYZ')#
- Creates a
Vector
, Point
orEulerRotation
attribute.
- Parameters
attrName (str) – the attribute name
node (
str
,DependNode
) – the node on which to add the attribute; if omitted, anetwork
node will be created; defaults toNone
angle/a (bool) – create an
EulerRotation
; defaults toFalse
time/t (bool) – create a compound of three
time
channels; defaults toFalse
distance/d (bool) – create a
Point
; defaults toFalse
keyable/k (bool) – make the children keyable; ignored if asData; defaults to
False
channelBox/cb (bool) – make the children settable; ignored if asData; defaults to
False
defaultValue/dv (
list
[float
],Vector
,Point
,EulerRotation
) – a default value for the attribute (ignored if asData)asData/ad (bool) – create as a non-compound ‘data’ attribute
childSuffixes/cs (bool) – ignored if asData; suffixes for the child attributes
- Returns
The constructed attribute.
- Return type
Vector
,Point
,EulerRotation
- Creates a
- createLocator(name=None, size=1.0)#
- isTranslateChannel()#
- Returns
True if this is the
translate
channel of a transform node, otherwise False.- Return type
- get(plug=False, **kwargs)#
Overrides
get()
to returnPoint
values if this is the translate channel of a transform node.
- __add__(other, swap=False)#
Implements element-wise addition (
+
).
- __radd__(other)#
Implements element-wise reflected addition (
-
).
- __sub__(other, swap=False)#
Implements element-wise subtraction (
-
).
- __rsub__(other)#
Implements element-wise reflected subtraction (
-
).
- __mul__(other, swap=False)#
Implements multiplication (
*
).
- __rmul__(other)#
Implements reflected multiplication (
*
).
- __neg__()#
Implements element-wise unary negation (
-
).
- __truediv__(other, swap=False)#
Implements element-wise division (
/
).
- __rtruediv__(other)#
Implements element-wise reflected division (
/
).
- __pow__(other, swap=False)#
Implements element-wise power (
**
).
- __rpow__(other)#
Implements element-wise reflected power (
**
).
- 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 blendweight/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 to0.5
swap/sw (bool) – swap the inputs around; defaults to
False
clockNormal/cn (
list
[float
],Vector
,Math3D
,str
) – if this isTrue
, this output and other will be regarded as vectors, and blended by angle; should be a vector perpendicular to both inputs; defaults toNone
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 positive2
for negative
- Returns
The blended triple or vector.
- Return type
paya.runtime.plugs.Math3D
- __xor__(other)#
Uses the exclusive-or operator (
^
) to implement point-matrix multiplication.- Parameters
other – a matrix value or plug
- dot(other, normalize=False)#
Returns the dot product of
self
and other.- Parameters
- Returns
- cross(other, normalize=False, guard=False, inlineGate=None)#
- Parameters
normalize/nr (bool) – normalize the output; defaults to
False
guard/g (bool) – switch the node to
'No Operation'
when the input vectors are aligned in either direction; defaults toFalse
inlineGate/ig (bool) – if you have a precooked gate for alignment (typically the output of a comparison operation), provide it here to prevent redundant checks; if provided, will override guard to
True
; defaults toNone
- Returns
The cross product.
- Return type
- angleTo(other, clockNormal=None)#
- projectOnto(other)#
- rejectFrom(other)#
Same as ‘make perpendicular to’ (although length will change). See https://en.wikipedia.org/wiki/Vector_projection.
- rotateByAxisAngle(axisVector, angle)#
- asTranslateMatrix()#
Inserts this into the translate row of an identity matrix, and returns the matrix.
- Returns
The translate matrix.
- Return type
- asScaleMatrix()#
Uses this output’s three components as the magnitudes of an identity matrix’s base vectors.
- Returns
The scale matrix.
- Return type
- asShearMatrix()#
Composes this output’s three components into a shear matrix.
- Returns
The shear matrix.
- Return type
- asEulerRotation()#
Returns XYZ euler rotations for this vector.
- Returns
A compound of three euler channels.
- Return type
- asQuaternion()#
- Returns
A quaternion representation of this vector’s orientation.
- Return type