To make this happen in code, we'll need to perform 3D vector mathematics.
Vector addition is then an array of array element additions:
The dot product is a scalar value:
The cross product:
Implementations of vector subtraction, dot product, and cross product will be similar.