20 double *
projection(
const double *v1,
const double *v2 ) {
22 double v2_ls = v2[0]*v2[0] + v2[1]*v2[1] + v2[2]*v2[2];
24 double *result =
new double[3];
32 double temp = ((v2[0]*v1[0] + v2[1]*v1[1] + v2[2]*v1[2] )/v2_ls );
33 result[0] = v2[0] * temp;
34 result[1] = v2[1] * temp;
35 result[2] = v2[2] * temp;
47 double temp1 = A[0] - B[0];
48 double temp2 = A[1] - B[1];
49 double temp3 = A[2] - B[2];
54 return std::sqrt(temp1+temp2+temp3);
58 double temp1 = A.
x - B.
x;
59 double temp2 = A.
y - B.
y;
60 double temp3 = A.
z - B.
z;
65 return std::sqrt(temp1+temp2+temp3);
78 double v1Mag =
magnitude(vector1[0], vector1[1], vector1[2]);
79 double v2Mag =
magnitude(vector2[0], vector2[1], vector2[2]);
80 double angle = std::acos(dot/(v1Mag*v2Mag));
double euclideanDistance(double *A, double *B)
T magnitude(T x, T y, T z)
double angleBeteenVectors(const double *vector1, const double *vector2)
double * projection(const double *v1, const double *v2)
T dotProduct(const T *A, const T *B)