12 #ifndef GLVIS_GEOM_UTILS_HPP
13 #define GLVIS_GEOM_UTILS_HPP
19 const double b,
const double y[],
double z[])
21 z[0] = a*x[0] + b*y[0];
22 z[1] = a*x[1] + b*y[1];
23 z[2] = a*x[2] + b*y[2];
26 inline double InnerProd(
const double a[],
const double b[])
28 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
31 inline void CrossProd(
const double a[],
const double b[],
double cp[])
33 cp[0] = a[1] * b[2] - a[2] * b[1];
34 cp[1] = a[2] * b[0] - a[0] * b[2];
35 cp[2] = a[0] * b[1] - a[1] * b[0];
49 for (
int i = 0; i < 3; i++)
59 for (
int i = 0; i < normals.Width(); i++)
70 for (
int i = 0; i < 3; i++)
78 double cp[3][3], max_a = 0.;
80 for (
int i = 0; i < 3; i++)
93 for (
int i = 0; i < 3; i++)
95 nor[i] = cp[k][i] / max_a;
102 const double p3[],
double nor[])
106 for (
int i = 0; i < 3; i++)
108 v[0][i] = p2[i] - p1[i];
109 v[1][i] = p3[i] - p2[i];
110 v[2][i] = p1[i] - p3[i];
117 const double p3[],
const double p4[],
double nor[])
121 for (
int i = 0; i < 3; i++)
133 v[0][i] = 0.5 * ((p2[i] + p3[i]) - (p1[i] + p4[i]));
134 v[1][i] = 0.5 * ((p4[i] + p3[i]) - (p1[i] + p2[i]));
135 v[2][i] = p1[i] - p3[i];
148 #endif // GLVIS_GEOM_UTILS_HPP
int ProjectVector(double v[], const double n[])
int Normalize(double v[])
int Compute3DUnitNormal(const double p1[], const double p2[], const double p3[], double nor[])
void CrossProd(const double a[], const double b[], double cp[])
double InnerProd(const double a[], const double b[])
int UnitCrossProd(double v[][3], double nor[])
void LinearCombination(const double a, const double x[], const double b, const double y[], double z[])