49 #define ACG_PRINCIPAL_AXIS_NODE_C 53 #include "PrincipalAxisNode.hh" 54 #include <ACG/GL/gl.hh> 66 template<
class VectorT>
69 set_vector(
unsigned int _i,
const Vec3d _p,
const VectorT& _v)
76 m(0,1) = m(1,0) = _v[3];
77 m(1,2) = m(2,1) = _v[4];
78 m(0,2) = m(2,0) = _v[5];
80 set_matrix(_i, _p, m);
87 template<
class MatrixT>
90 set_matrix(
unsigned int _i,
const Vec3d _p,
const MatrixT& _m)
96 for(
unsigned int i=0; i<3; ++i)
97 for(
unsigned int j=0; j<3; ++j)
104 diagonalize(s, Q, D);
106 std::vector<double> eigval;
107 for (
int i = 0; i < 3; ++i)
108 eigval.push_back(D[i][i]);
111 unsigned int pstress_idx[3];
112 if( fabs(eigval[0]) >= fabs(eigval[1]) && fabs(eigval[0]) >= fabs(eigval[2])) pstress_idx[0] = 0;
113 if( fabs(eigval[1]) >= fabs(eigval[0]) && fabs(eigval[1]) >= fabs(eigval[2])) pstress_idx[0] = 1;
114 if( fabs(eigval[2]) >= fabs(eigval[0]) && fabs(eigval[2]) >= fabs(eigval[1])) pstress_idx[0] = 2;
116 unsigned int i0 = (pstress_idx[0] + 1)%3;
117 unsigned int i1 = (pstress_idx[0] + 2)%3;
118 if( fabs(eigval[i0]) > fabs(eigval[i1]) )
132 for(
unsigned int j=0; j<3; ++j)
135 if( eigval[ pstress_idx[j]] < 0 )
140 for(
unsigned int k=0; k<3; ++k)
141 a[j][k] = eigval[ pstress_idx[j]]*Q[k][pstress_idx[j]];
145 PrincipalComponent(_p,
Namespace providing different geometric functions concerning angles.
VectorT< double, 3 > Vec3d