47 #define VEC_DOT_50(x,y) ((x)[X_50]*(y)[X_50] + (x)[Y_50]*(y)[Y_50] + (x)[Z_50]*(y)[Z_50])
48 #define VEC_LEN_50(x) sqrt(VEC_DOT_50(x,x))
50 #define VEC_DIFF_50(from,to,diff) {\
51 (diff)[X_50] = (to)[X_50] - (from)[X_50];\
52 (diff)[Y_50] = (to)[Y_50] - (from)[Y_50];\
53 (diff)[Z_50] = (to)[Z_50] - (from)[Z_50];\
56 #define CROSS_PRODUCT_50(x,y,xy) {\
57 (xy)[X_50] = (x)[Y_50]*(y)[Z_50]-(y)[Y_50]*(x)[Z_50];\
58 (xy)[Y_50] = -((x)[X_50]*(y)[Z_50]-(y)[X_50]*(x)[Z_50]);\
59 (xy)[Z_50] = (x)[X_50]*(y)[Y_50]-(y)[X_50]*(x)[Y_50];\
66 using namespace Eigen;
67 using namespace MNELIB;
73 MneTriangle::MneTriangle()
79 MneTriangle::~MneTriangle()
85 void MneTriangle::add_triangle_data(
MneTriangle *tri)
92 VEC_DIFF_50 (tri->r1,tri->r2,tri->r12);
93 VEC_DIFF_50 (tri->r1,tri->r3,tri->r13);
94 CROSS_PRODUCT_50 (tri->r12,tri->r13,tri->nn);
95 size = VEC_LEN_50(tri->nn);
100 tri->nn[X_50] = tri->nn[X_50]/size;
101 tri->nn[Y_50] = tri->nn[Y_50]/size;
102 tri->nn[Z_50] = tri->nn[Z_50]/size;
104 tri->area = size/2.0;
105 sizey = VEC_LEN_50(tri->r13);
109 for (c = 0; c < 3; c++) {
110 tri->ey[c] = tri->r13[c]/sizey;
111 tri->cent[c] = (tri->r1[c]+tri->r2[c]+tri->r3[c])/3.0;
113 CROSS_PRODUCT_50(tri->ey,tri->nn,tri->ex);