|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
29 #include <MonitoringModel.hxx>
33 double distance(
double pos[3],
double pos2[3]);
49 double dotProduct(
double vec1[3],
double vec2[3]);
52 void crossProduct(
double vec1[3],
double vec2[3],
double res[3]);
58 double normOf(
double vec[3]);
61 inline double distance(
double pos[3],
double pos2[3]) {
62 return sqrt((pos[0] - pos2[0]) * (pos[0] - pos2[0])
63 + (pos[1] - pos2[1]) * (pos[1] - pos2[1])
64 + (pos[2] - pos2[2]) * (pos[2] - pos2[2]));
68 inline double dotProduct(
double vec1[3],
double vec2[3]) {
69 return vec1[0] * vec2[0] + vec1[1] * vec2[1] + vec1[2] * vec2[2];
73 inline void crossProduct(
double vec1[3],
double vec2[3],
double res[3]) {
74 res[0] = vec1[1] * vec1[2] - vec1[2] * vec1[1];
75 res[1] = vec1[2] * vec1[0] - vec1[0] * vec1[2];
76 res[2] = vec1[0] * vec1[1] - vec1[1] * vec1[0];
81 double norm = sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
83 vec[0] = vec[0] / norm;
84 vec[1] = vec[1] / norm;
85 vec[2] = vec[2] / norm;
90 inline double normOf(
double vec[3]) {
91 return sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
94 #endif // TOOLS_TOOLS_H