Use the following functions for performing various vector-related operations.
Returns the euclidean length (magnitude) of a given vector. The euclidian length is equivalent to the expression sqrt(pow(Vector.x, 2) + pow(Vector.y, 2) + pow(Vector.z, 2)).
Syntax: | length(Vector) |
Arguments: |
|
Examples: |
|
Returns the scalar dot-product of two given vectors. The dot-product is the product of the lengths of two vectors and the cosine of the angle between them. If the two vectors are at a right angle (90 degrees), their dot-product is 0.
If the product of their lengths equals 1 and they point in opposite directions (180 degrees), their dot-product is -1. The dot-product is equivalent to the expression V1.x * V2.x + V1.y * V2.y + V1.z * V2.z.
Syntax: | dot(V1, V2) |
Arguments: |
|
Examples: |
|
Returns the vector cross-product of two given vectors. The cross-product is the vector perpendicular to the plane containing the two vectors. In effect, there will be a right angle between the returned vector and the first given vector, as well as a right angle between the returned vector and the second given vector. The length of the resulting vector is equal to the product of the two vectors and the sine of the angle between them. The cross-product is equivalent to the vector (V1.y * V2.z - V1.z *V2.y, V1.z * V2.x - V1.x * V2.z, V1.x * V2.y - V1.y * V2.x).
Syntax: | cross(V1, V2) |
Arguments: |
|
Examples: |
|