11. Vector Mathematics
11.1. Introduction
Vectors are mapped to the defned type VEKTOR_3.
The type VEKTOR_3 consists of 3 components X, Y and Z, all components
are of type REAL.
The vector of type vector V consists of:
V.X X component of the type REAL.
V.Y Y component of the type REAL.
V.Z Z component of the type REAL.
11.2. V3_ABS
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (Absolute length of the vector)
V3_ABS calculates the absolute value (length) of a vector in a three-
dimensional coordinate system.
V3_ABS(3,4,5) = 7.071.
11.3. V3_ADD
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_ADD adds two three dimensional vectors.
V3_ADD([3,4,5],[1,2,3]) = (4,6,8)
11.4. V3_ANG
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (angle in radians)
V3_ANG calculates the angle between two three dimensional vectors
V3_ANG([1,0,0],[0,1,0]) = 1,57 ( π / 2)
11.5. V3_DPRO
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (Scalar Product)
V3_DPRO calculates the scalar product of two-dimensional vectors.
V3_DPRO([1,2,3],[3,1,2]) = 11
The scalar product is calculated from A.X*B.X + A.Y*B.Y + A.Z*B.Z
11.6. V3_NORM
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_NORM generates from any one-dimensional vector a vector Normalized
to length 1 with the same direction. A vector of length 1 is called unit vec-
tor
V3_NORM(3,0,0) = (1,0,0)
11.7. V3_NUL
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output BOOL (TRUE if vector is a zero vector)
V3_NUL checks if the vector A is a zero vector. A vector is then a zero vec-
tor if all the components (X, Y, Z) are zero.
V3_NUL(0,0,0) = TRUE
11.8. V3_PAR
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output BOOL (TRUE if the two vectors are parallel)
V3_PAR will be TRUE if the two vectors A and B are parallel. A zero vector
is parallel to any vector because it has no direction. Two vectors A and B in
opposite directions are parallel.
V3_PAR([1,1,1],[2,2,2]) = TRUE
V3_PAR([1,1,1],[-1,-1,-1]) = TRUE
V3_PAR([1,2,3],[0,0,0]) = TRUE
V3_PAR([1,2,3],[1,0,0]) = FALSE
11.9. V3_REV
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_REV generates a vector with the same amount of A but with opposite
direction. A - V3_REV(A) = 0.
V3_REV(1,2,3) = (-1,-2,-3)
11.10. V3_SMUL
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
M: REAL (scalar multiplier)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_SMUL multiplies a three-dimensional vector A with scalar M.
V3_SMUL([1,2,3],10) = (10,20,30)
11.11. V3_SUB
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_SUB Subtracts the vector B of A
V3_SUB([3,3,3],[1,2,3]) = (2,1,0)
V3_SUB([1,2,3],[1,-2,-3]) = (0,4,6)
11.12. V3_XANG
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (angle to the X-axis)
V3_XANG calculates the angle between the X-axis of the coordinate sys-
tem and a three-dimensional vector A in radians
V3_XANG(1,2,3) = 1.300
11.13. V3_XPRO
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
B: VECTOR_3 (vector with the coordinates X, Y, Z)
Output VECTOR_3 (vector with the coordinates X, Y, Z)
V3_XPRO calculates the cross product of two-dimensional vectors A and B
V3_XPRO([1,2,3],[2,1,2]) = (1,4,-3)
11.14. V3_YANG
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (angle to the y-axis)
V3_YANG calculates the angle between the Y-axis of the coordinate system
and a three-dimensional vector A in radians
V3_YANG(1,2,3) = 1.006
11.15. V3_ZANG
Type Function
Input A: VECTOR_3 (vector with the coordinates X, Y, Z)
Output REAL (angle to the Z-axis)
V3_ZANG calculates the angle between the Z-axis of the coordinate sys-
tem and a three-dimensional vector A in radians
V3_ZANG(1,2,3) = 0.640