In the Open Reality SDK there is small set of functions for working with vectors, matrices and quaternions. Propose to gather some convenient common library.
Here is example
double DotProduct(const FBVector3d v1, double *v2)
return v1 * v2 + v1 * v2 + v1 * v2;
Full set of math helper function you can download here math3d