This section covers how to create and place vectors, as well as how to perform basic operations on them.
When working in 3D space, it's convenient to treat values in groups of three, like (X, Y, Z).
For example, a position in space is defined by its (X, Y, Z) coordinates. A direction in space is likewise represented by a set of three components (Vx, Vy, Vz), and the displacement of a moving object over a unit of time can be described similarly using (dx, dy, dz).
In this way, a vector is simply a group of three components treated as a single unit in 3D space.
In VCSSL, vectors can be created and placed in coordinate systems, allowing for convenient operations like coordinate transformations, dot products, and cross products.
To create a vector, use the newVector(...) function:
- Function Format -
The arguments x, y, and z specify the X, Y, and Z components of the vector.
This function creates a vector with those components and returns a unique ID assigned to it.
You can also create a copy of an existing vector by passing its ID:
- Function Format -
Once created, a vector can be placed into a coordinate system, just like models or polygons. To place a vector, use the mountVector(...) function.
- Function Format -
These two variations allow you to:
Arguments:
To set the components of a vector, use the setVector(...) function:
- Function Format -
Arguments:
This function updates the components of an existing vector.
To retrieve the components of a vector, use the getVectorX(...), getVectorY(...), and getVectorZ(...) functions:
- Function Format -
Each function returns the X, Y, or Z component of the vector, respectively.
The "vectorID" argument specifies the target vector.
To calculate the dot product (inner product) of two vectors, use the getVectorInnerProduct(...) function:
- Function Format -
Arguments:
This function returns the dot product of the two specified vectors.
To calculate the cross product of two vectors, use the getVectorCrossProduct(...) function:
- Function Format -
Arguments: