vcVector

vcVector is a 4x1 column vector and is generally used to define joint lengths in robots, offsets and directions, and angles of rotation.

Constructors

Name Return Type Parameters Description
new vcVector vcVector vector

or

Real x, Real y, Real z

or

Real x, Real y, Real z, Real w

or

None

Creates a new vcVector object.

One option allows you to give an existing vector, thereby creating a copy.

A second option allows you to give three components for new vector.

A third option allows you to give four components for new vector.

A fourth option allows you to give no arguments, thereby creating a zero vector.

Operators

Name Description
* Allows you to get the dot product of vectors.
^ Allows you to get the cross product of vectors.
+ Allows you to add vectors.
- Allows you to subtract vectors.

Properties

Name Type Access Description
W Real RW Defines w-component (fourth element) of vector.
X Real RW Defines x-component (first element) of vector.
Y Real RW Defines y-component (second element) of vector.
Z Real RW Defines z-component (third element) of vector.

Methods

Name Return Type Parameters Description
angle Real vcVector vector Returns the angle (in radians) between vector and a given vector.
getQuaternionAngle vcVector vcVector vector Returns the quaternion angle between vector and a given vector.
length Real None Returns the magnitude (length) of vector.
normalize None None Normalizes vector.
square Real None Returns the square of vector.

Examples

Example. Relocate component using position vector

from vcScript import *
import vcVector
 
comp = getComponent()
vec = vcVector.new(100.0,200.0,300.0) # creates a new vcVector object
m = comp.PositionMatrix
 
m.P = vec # assign the vector to position vector for matrix
comp.PositionMatrix = m
getApplication().render()