IC8 Python API:RLPy RVector3
Contents
- 1 Description
- 2 Constructor & Destructor
- 3 Operators
- 3.1 __eq__ ( self, vV )
- 3.2 __ne__ ( self, vV )
- 3.3 __lt__ ( self, vV )
- 3.4 __gt__ ( self, vV )
- 3.5 __ge__ ( self, vV )
- 3.6 __le__ ( self, vV )
- 3.7 __add__ ( self, vV )
- 3.8 __sub__ ( self, vV )
- 3.9 __mul__ ( self, *args )
- 3.10 __truediv__ ( self, *args )
- 3.11 __neg__ ( self )
- 3.12 __iadd__ ( self, vV )
- 3.13 __isub__ ( self, vV )
- 3.14 __imul__ ( self, *args )
- 3.15 __itruediv__ ( self, *args )
- 3.16 __getitem__ ( self, i )
- 4 Member Functions
- 4.1 X ( self, *args )
- 4.2 Y ( self, *args )
- 4.3 Z ( self, *args )
- 4.4 GetPosition ( self, *args )
- 4.5 SetXYZ ( self, tX, tY, tZ )
- 4.6 XY ( self )
- 4.7 SetX ( self, tX )
- 4.8 SetY ( self, tY )
- 4.9 SetZ ( self, tZ )
- 4.10 Clear ( self )
- 4.11 AddWithWeight ( self, v, fWeight )
- 4.12 AlmostEqual ( self, vV )
- 4.13 Length ( self )
- 4.14 SquaredLength ( self )
- 4.15 Dot ( self, vV )
- 4.16 Normalize ( self )
- 4.17 NormalizeConst ( self )
- 4.18 Inverse ( self )
- 4.19 Distance ( self, vV )
- 4.20 SquaredDistance ( self, vV )
- 4.21 Cross ( self, vV )
- 4.22 Interpolate ( self, vRatio, vV )
- 4.23 AlmostZero ( self )
- 4.24 AlmostTheSame ( self, vV )
- 4.25 AlmostSame ( self, vV, fThreshold )
- 5 Properties
- 6 Constants
- 7 Description
- 8 Constructor & Destructor
- 9 Member Functions
- 9.1 AddWithWeight (self, v, fWeight)
- 9.2 AlmostEqual (self, vV)
- 9.3 AlmostSame (self, vV, fThreshold)
- 9.4 AlmostTheSame (self, vV)
- 9.5 AlmostZero (self)
- 9.6 Clear (self)
- 9.7 Cross (self, vV)
- 9.8 Distance (self, vV)
- 9.9 Dot (self, vV)
- 9.10 GetPosition (self, *args)
- 9.11 Interpolate (self, vRatio, vV)
- 9.12 Inverse (self)
- 9.13 Length (self)
- 9.14 Normalize (self)
- 9.15 NormalizeConst (self)
- 9.16 SetX (self, tX)
- 9.17 SetXYZ (self, tX, tY, tZ)
- 9.18 SetY (self, tY)
- 9.19 SetZ (self, tZ)
- 9.20 SquaredDistance (self, vV)
- 9.21 SquaredLength (self)
- 9.22 X (self, *args)
- 9.23 XY (self)
- 9.24 Y (self, *args)
- 9.25 Z (self, *args)
- 9.26 __add__ (self, vV)
- 9.27 __eq__ (self, vV)
- 9.28 __ge__ (self, vV)
- 9.29 __getitem__ (self, i)
- 9.30 __gt__ (self, vV)
- 9.31 __iadd__ (self, vV)
- 9.32 __imul__ (self, *args)
- 9.33 __isub__ (self, vV)
- 9.34 __itruediv__ (self, *args)
- 9.35 __le__ (self, vV)
- 9.36 __lt__ (self, vV)
- 9.37 __mul__ (self, *args)
- 9.38 __ne__ (self, vV)
- 9.39 __neg__ (self)
- 9.40 __sub__ (self, vV)
- 9.41 __truediv__ (self, *args)
- 10 Properties
- 11 Constants
- Main article: Modules.
- Last modified: 10/21/2026
Description
A three-component floating-point vector with arithmetic, comparison and geometric operations.
Constructor & Destructor
__init__ ( self, *args )
Create a three-component floating-point vector. The three-number form explicitly initializes x, y and z; a vector argument creates a copy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = RLPy.RVector3(1.0, 2.0, 3.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Operators
__eq__ ( self, vV )
Return whether the corresponding components are exactly equal.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__eq__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__ne__ ( self, vV )
Return whether the vectors differ under the equality test.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__ne__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__lt__ ( self, vV )
Compare vectors lexicographically: compare x first; if x is equal, compare y; if y is also equal, compare z.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 9.0, 9.0)
b = RLPy.RVector3(2.0, 0.0, 0.0)
before = [a.x, a.y, a.z]
value = a.__lt__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__gt__ ( self, vV )
Compare vectors lexicographically: compare x first; if x is equal, compare y; if y is also equal, compare z.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 9.0, 9.0)
b = RLPy.RVector3(2.0, 0.0, 0.0)
before = [a.x, a.y, a.z]
value = b.__gt__(a)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__ge__ ( self, vV )
Return whether this vector is greater than or equal to the other in lexicographic x, y, z order. The native implementation defines this as the negation of less-than.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 9.0, 9.0)
b = RLPy.RVector3(2.0, 0.0, 0.0)
before = [a.x, a.y, a.z]
value = b.__ge__(a)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__le__ ( self, vV )
Return whether this vector is less than or equal to the other in lexicographic x, y, z order. The native implementation defines this as the negation of greater-than.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 9.0, 9.0)
b = RLPy.RVector3(2.0, 0.0, 0.0)
before = [a.x, a.y, a.z]
value = a.__le__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__add__ ( self, vV )
Return the component-wise sum with another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__add__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__sub__ ( self, vV )
Return the component-wise difference from another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__sub__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__mul__ ( self, *args )
Multiply by a scalar or multiply corresponding components of another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__mul__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__truediv__ ( self, *args )
Divide by a nonzero scalar or nonzero corresponding components of another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__truediv__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__neg__ ( self )
Return a vector with the sign of every component reversed.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__neg__()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__iadd__ ( self, vV )
Add another vector to this vector in place.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__iadd__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__isub__ ( self, vV )
Subtract another vector from this vector in place.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__isub__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__imul__ ( self, *args )
Multiply this vector in place by a scalar or another vector's components.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__imul__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__itruediv__ ( self, *args )
Divide this vector in place by a nonzero scalar or nonzero vector components.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__itruediv__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__getitem__ ( self, i )
Return the component at index 0, 1 or 2. The native accessor does not supply a bounds check; use only valid indices.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__getitem__(1)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Member Functions
X ( self, *args )
In iClone 8.73, this method returns a SwigPyObject proxy for the native x-component reference. Use the source vector's x property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.X()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Y ( self, *args )
In iClone 8.73, this method returns a SwigPyObject proxy for the native y-component reference. Use the source vector's y property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Y()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Z ( self, *args )
In iClone 8.73, this method returns a SwigPyObject proxy for the native z-component reference. Use the source vector's z property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Z()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
GetPosition ( self, *args )
In iClone 8.73, this method returns a SwigPyObject proxy for the native contiguous component storage. Use the source vector's x, y and z properties for numeric component access. Keep the source vector alive while holding the proxy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.GetPosition()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SetXYZ ( self, tX, tY, tZ )
Replace all three components with the supplied x, y and z values.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SetXYZ(4.0, 5.0, 6.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
XY ( self )
Return the two-component x/y vector view supplied by the binding. Avoid assumptions about independent ownership.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.XY()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SetX ( self, tX )
Replace the x component.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SetX(4.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SetY ( self, tY )
Replace the y component.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SetY(5.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SetZ ( self, tZ )
Replace the z component.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SetZ(6.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Clear ( self )
Set all three components to zero.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Clear()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AddWithWeight ( self, v, fWeight )
Add the other vector multiplied by the supplied weight to this vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AddWithWeight(b, 0.5)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostEqual ( self, vV )
Compare corresponding components using the math library's approximate-zero test.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostEqual(a)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Length ( self )
Return the Euclidean length of this vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Length()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SquaredLength ( self )
Return the sum of the squared components.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SquaredLength()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Dot ( self, vV )
Return the scalar dot product with another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Dot(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Normalize ( self )
Normalize this vector in place when its length is nonzero, and return its original length. A zero-length vector remains unchanged.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Normalize()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
NormalizeConst ( self )
Return a normalized copy and keep this vector unchanged. A zero-length vector produces an unchanged copy.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.NormalizeConst()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Inverse ( self )
Return the component-wise reciprocal (1/x, 1/y, 1/z). Use nonzero components; this is different from unary negation.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Inverse()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Distance ( self, vV )
Return the Euclidean distance to another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Distance(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SquaredDistance ( self, vV )
Return the squared Euclidean distance to another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SquaredDistance(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Cross ( self, vV )
Return the three-dimensional cross product with another vector.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Cross(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Interpolate ( self, vRatio, vV )
Interpolate component-wise from this vector toward vV using the supplied ratio. The ratio is applied directly; values below 0 or above 1 extrapolate.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Interpolate(0.5, b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostZero ( self )
Test whether each component is approximately zero.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostZero()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostTheSame ( self, vV )
Compare corresponding components using the math library's approximate-zero test.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostTheSame(a)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostSame ( self, vV, fThreshold )
Test whether each absolute component difference is strictly below the supplied threshold.
Sample code
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostSame(b, 0.01)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Properties
thisown
SWIG wrapper ownership flag; ordinary vector code should let the binding manage ownership.
x
Component property.
y
Component property.
z
Component property.
Constants
DIMENSION
The vector dimension is 3.
COUNT
The component count is 3.
ZERO
The zero vector: (0, 0, 0).
UNIT_X
The unit vector along the x-axis: (1, 0, 0).
UNIT_Y
The unit vector along the y-axis: (0, 1, 0).
UNIT_Z
The unit vector along the z-axis: (0, 0, 1).
UNIT_XY
The vector (1, 1, 0), with x and y components set to 1.
UNIT_YZ
The vector (0, 1, 1), with y and z components set to 1.
UNIT_XZ
The vector (1, 0, 1), with x and z components set to 1.
UNIT_XYZ
The vector (1, 1, 1), with all three components set to 1.
Description
This class represent the 3D vector (x, y, z). This class provides access to RLPy's internal 3D vector math library allowing 3D vectors to be handled easily, in a manner compatible with internal RLPy data structures. It also supports operators and provides some constants for your convenience: {|class = "wikitable" !Constant !Description |- |RVector3.ZERO |3D zero vector: (0, 0, 0) |- |RVector3.UNIT_X |3D x unit vector: (1, 0, 0) |- |RVector3.UNIT_Y |3D y unit vector: (0, 1, 0) |- |RVector3.UNIT_Z |3D z unit vector: (0, 0, 1) |- |RVector3.UNIT_XY |3D vector: (1, 1, 0) |- |RVector3.UNIT_YZ |3D vector: (0, 1, 1) |- |RVector3.UNIT_XZ |3D vector: (1, 0, 1) |- |RVector3.UNIT_XYZ |3D vector: (1, 1, 1) |}
Constructor & Destructor
__init__ (self, *args)
Create a three-component floating-point vector. The three-number form explicitly initializes x, y and z; a vector argument creates a copy.
Parameters
- args
Member Functions
AddWithWeight (self, v, fWeight)
Add the other vector multiplied by the supplied weight to this vector.
Parameters
- v
- fWeight
Sample code
Calls `RLPy.RVector3.AddWithWeight` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AddWithWeight(b, 0.5)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostEqual (self, vV)
Compare corresponding components using the math library's approximate-zero test.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.AlmostEqual` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostEqual(a)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostSame (self, vV, fThreshold)
Test whether each absolute component difference is strictly below the supplied threshold.
Parameters
- vV
- fThreshold
Sample code
Calls `RLPy.RVector3.AlmostSame` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.AlmostSame(b, 0.01)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
AlmostTheSame (self, vV)
Determine if this and another 3D vector is the equivalent withing a tolerance.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.AlmostTheSame` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = RLPy.RVector3(1, 2, 3.000000001)
c = RLPy.RVector3(1, 2, 3.00001)
if a.AlmostTheSame(b): #True
print("a ≈ b")
if a.AlmostTheSame(c): #False
print("a ≈ c")
AlmostZero (self)
Determine if this 3D vector is a zeroed 3D vector.
Sample code
Calls `RLPy.RVector3.AlmostZero` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(0.00000001, 0, 0.00000003)
b = RLPy.RVector3(0.00001, 0, 0)
if a.AlmostZero(): #True
print("a is ZERO vector.")
if b.AlmostZero(): #False
print("a is ZERO vector.")
Clear (self)
Set all three components to zero.
Sample code
Calls `RLPy.RVector3.Clear` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Clear()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Cross (self, vV)
Calculate the cross production of this and another 3D vector.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.Cross` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 0, 0)
b = RLPy.RVector3(0, 1, 0)
c = a.Cross(b)
print(str(c.x) + ', ' + str(c.y) + ', ' + str(c.z)) # 0.0, 0.0, 1.0
Distance (self, vV)
Calculate the distance between this and another 3D vector.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.Distance` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(3, 0, 0)
b = RLPy.RVector3(0, 4, 0)
print(a.Distance(b)) # 5.0
Dot (self, vV)
Calculate the dot production of this and another 3D vector.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.Dot` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = RLPy.RVector3(1, 2, 3)
print(a.Dot(b)) # 14.0
GetPosition (self, *args)
In iClone 8.73, this method returns a SwigPyObject proxy for the native contiguous component storage. Use the source vector's x, y and z properties for numeric component access. Keep the source vector alive while holding the proxy.
Parameters
- args
Sample code
Calls `RLPy.RVector3.GetPosition` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.GetPosition()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Interpolate (self, vRatio, vV)
Calculate the interpolate of this and another 3D vector.
Parameters
- vRatio
- vV
Sample code
Calls `RLPy.RVector3.Interpolate` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(10, 20, 30)
b = RLPy.RVector3(1, 2, 3)
c = a.Interpolate(0.1, b)
print(str(c.x) + ', ' + str(c.y) + ', ' + str(c.z)) # 9.100000381469727, 18.200000762939453, 27.299999237060547
Inverse (self)
Invert all the elements of this 3D vector.
Sample code
Calls `RLPy.RVector3.Inverse` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = a.Inverse()
print(str(b.x) + ', ' + str(b.y) + ', ' + str(b.z)) # 1.0, 0.5, 0.3333333432674408
Length (self)
Length of the vector.
Sample code
Calls `RLPy.RVector3.Length` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
print(a.Length()) # 1.7320507764816284
Normalize (self)
Normalize this 3D vector.
Sample code
Calls `RLPy.RVector3.Normalize` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
print(a.Normalize()) #1.7320507764816284
print(str(a.x) + ', ' + str(a.y) + ', ' + str(a.z)) # 0.5773502588272095, 0.5773502588272095, 0.5773502588272095
NormalizeConst (self)
Return a normalized copy and keep this vector unchanged. A zero-length vector produces an unchanged copy.
Sample code
Calls `RLPy.RVector3.NormalizeConst` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.NormalizeConst()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SetX (self, tX)
Set the value of the x-axis for this 3D vector.
Parameters
- tX
Sample code
Calls `RLPy.RVector3.SetX` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
a.SetX(10)
print(str(a.x) + ', ' + str(a.y) + ', ' + str(a.z)) # 10.0, 1.0, 1.0
SetXYZ (self, tX, tY, tZ)
Set the value of the all axes for this 3D vector.
Parameters
- tX
- tY
- tZ
Sample code
Calls `RLPy.RVector3.SetXYZ` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
a.SetXYZ(10, 20, 30)
print(str(a.x) + ', ' + str(a.y) + ', ' + str(a.z)) # 10.0, 20.0, 30.0
SetY (self, tY)
Set the value of the y-axis for this 3D vector.
Parameters
- tY
Sample code
Calls `RLPy.RVector3.SetY` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
a.SetY(10)
print(str(a.x) + ', ' + str(a.y) + ', ' + str(a.z)) # 1.0, 10.0, 1.0
SetZ (self, tZ)
Set the value of the z-axis for this 3D vector.
Parameters
- tZ
Sample code
Calls `RLPy.RVector3.SetZ` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
a.SetZ(10)
print(str(a.x) + ', ' + str(a.y) + ', ' + str(a.z)) # 1.0, 1.0, 10.0
SquaredDistance (self, vV)
Get the squared distance between this and another 3D vector.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.SquaredDistance` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.SquaredDistance(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
SquaredLength (self)
Get the squared length of this 3D vector.
Sample code
Calls `RLPy.RVector3.SquaredLength` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 1, 1)
print(a.SquaredLength()) # 3.0
X (self, *args)
In iClone 8.73, this method returns a SwigPyObject proxy for the native x-component reference. Use the source vector's x property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Parameters
- args
Sample code
Calls `RLPy.RVector3.X` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.X()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
XY (self)
Get the x and y elements of this 3D vector.
Sample code
Calls `RLPy.RVector3.XY` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = a.XY()
print(str(b.x) + ', ' + str(b.y)) # 1.0, 2.0
Y (self, *args)
In iClone 8.73, this method returns a SwigPyObject proxy for the native y-component reference. Use the source vector's y property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Parameters
- args
Sample code
Calls `RLPy.RVector3.Y` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Y()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
Z (self, *args)
In iClone 8.73, this method returns a SwigPyObject proxy for the native z-component reference. Use the source vector's z property to read or update the numeric component. Keep the source vector alive while holding the proxy.
Parameters
- args
Sample code
Calls `RLPy.RVector3.Z` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.Z()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__add__ (self, vV)
The "addition" operator. Perform 3D vector addition. See Also: +=
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__add__` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(0, 1, 2)
b = RLPy.RVector3(1, 2, 3)
c = a + b
print(str(c.x) + ', ' + str(c.y) + ', ' + str(c.z)) #1.0, 3.0, 5.0
__eq__ (self, vV)
The "equal to" operator. See Also: !=
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__eq__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__eq__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__ge__ (self, vV)
Return whether this vector is greater than or equal to the other in lexicographic x, y, z order. The native implementation defines this as the negation of less-than.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__ge__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__ge__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__getitem__ (self, i)
Return the component at index 0, 1 or 2. The native accessor does not supply a bounds check; use only valid indices.
Parameters
- i
Sample code
Calls `RLPy.RVector3.__getitem__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__getitem__(1)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__gt__ (self, vV)
Compare vectors lexicographically: compare x first; if x is equal, compare y; if y is also equal, compare z.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__gt__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__gt__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__iadd__ (self, vV)
Add another vector to this vector in place.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__iadd__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__iadd__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__imul__ (self, *args)
Multiply this vector in place by a scalar or another vector's components.
Parameters
- args
Sample code
Calls `RLPy.RVector3.__imul__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__imul__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__isub__ (self, vV)
Subtract another vector from this vector in place.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__isub__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__isub__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__itruediv__ (self, *args)
Divide this vector in place by a nonzero scalar or nonzero vector components.
Parameters
- args
Sample code
Calls `RLPy.RVector3.__itruediv__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__itruediv__(2.0)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__le__ (self, vV)
Return whether this vector is less than or equal to the other in lexicographic x, y, z order. The native implementation defines this as the negation of greater-than.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__le__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__le__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__lt__ (self, vV)
Compare vectors lexicographically: compare x first; if x is equal, compare y; if y is also equal, compare z.
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__lt__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__lt__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__mul__ (self, *args)
The "multiplication" operator. Perform a scalar multiplication when the second operand is an integer or float. If the second operand is another 3D vector, then the respective x, y, z elements are multiplied. See Also: *=
Parameters
- args
Sample code
Calls `RLPy.RVector3.__mul__` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = a * 2
c = a * a
print(str(b.x) + ', ' + str(b.y) + ', ' + str(b.z)) #2.0, 4.0, 6.0
print(str(c.x) + ', ' + str(c.y) + ', ' + str(c.z)) #1.0, 4.0, 9.0
__ne__ (self, vV)
The "not equal to" operator. See Also: ==
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__ne__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__ne__(b)
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__neg__ (self)
Return a vector with the sign of every component reversed.
Sample code
Calls `RLPy.RVector3.__neg__` with the inputs shown in the example.
import RLPy
def _describe(value):
result = {"python_type": type(value).__module__ + "." + type(value).__name__}
if value is None or isinstance(value, (bool, int, float, str)):
result["value"] = value
elif all(hasattr(value, axis) for axis in ("x", "y", "z")):
result["components"] = [value.x, value.y, value.z]
elif all(hasattr(value, axis) for axis in ("x", "y")):
result["components"] = [value.x, value.y]
return result
def run_script():
a = RLPy.RVector3(1.0, 2.0, 3.0)
b = RLPy.RVector3(4.0, 5.0, 6.0)
before = [a.x, a.y, a.z]
value = a.__neg__()
return {"before": before, "after": [a.x, a.y, a.z], "return": _describe(value)}
__sub__ (self, vV)
The "subtraction" operator. Perform 3D vector subtraction. See Also: -=
Parameters
- vV
Sample code
Calls `RLPy.RVector3.__sub__` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(0, 1, 2)
b = RLPy.RVector3(3, 2, 1)
c = b - a
print(str(c.x) + ', ' + str(c.y) + ', ' + str(c.z)) #3.0, 1.0, -1.0
__truediv__ (self, *args)
The "division" operator. Perform a scalar division when the second operand is an integer or float. If the second operand is another 3D vector, then the respective x, y, z elements are divided. See Also: /=
Parameters
- args
Sample code
Calls `RLPy.RVector3.__truediv__` with the inputs shown in the example.
def run_script():
import RLPy
a = RLPy.RVector3(1, 2, 3)
b = a / 2
c = RLPy.RVector3(2, 2, 10)
d = a / c
print(str(b.x) + ', ' + str(b.y) + ', ' + str(b.z)) #0.5, 1.0, 1.5
print(str(d.x) + ', ' + str(d.y) + ', ' + str(d.z)) #0.5, 1.0, 0.3
Properties
thisown
Indicates whether this SWIG proxy owns the underlying C++ object.
x
The vector's X coordinate.
y
The vector's Y coordinate.
z
The vector's Z coordinate.
Constants
COUNT
The component count is 3.
DIMENSION
The vector dimension is 3.
UNIT_X
The unit vector along the x-axis: (1, 0, 0).
UNIT_XY
The vector (1, 1, 0), with x and y components set to 1.
UNIT_XYZ
The vector (1, 1, 1), with all three components set to 1.
UNIT_XZ
The vector (1, 0, 1), with x and z components set to 1.
UNIT_Y
The unit vector along the y-axis: (0, 1, 0).
UNIT_YZ
The vector (0, 1, 1), with y and z components set to 1.
UNIT_Z
The unit vector along the z-axis: (0, 0, 1).
ZERO
The zero vector: (0, 0, 0).