49 #define VEC_DOT_43(x,y) ((x)[X_43]*(y)[X_43] + (x)[Y_43]*(y)[Y_43] + (x)[Z_43]*(y)[Z_43])
51 #define FREE_43(x) if ((char *)(x) != NULL) free((char *)(x))
57 using namespace Eigen;
58 using namespace MNELIB;
64 MnePatchInfo::MnePatchInfo()
89 for (
k = 0;
k < p->nmemb;
k++) {
90 nneigh = s->nneighbor_tri[p->memb_vert[
k]];
91 neigh = s->neighbor_tri[p->memb_vert[
k]];
92 for (q = 0; q < nneigh; q++)
93 p->area += s->tris[neigh[q]].area/3.0;
102 float cos_theta,size;
104 p->ave_nn[X_43] = 0.0;
105 p->ave_nn[Y_43] = 0.0;
106 p->ave_nn[Z_43] = 0.0;
108 for (
k = 0;
k < p->nmemb;
k++) {
109 p->ave_nn[X_43] += s->nn[p->memb_vert[
k]][X_43];
110 p->ave_nn[Y_43] += s->nn[p->memb_vert[
k]][Y_43];
111 p->ave_nn[Z_43] += s->nn[p->memb_vert[
k]][Z_43];
113 size = sqrt(VEC_DOT_43(p->ave_nn,p->ave_nn));
114 p->ave_nn[X_43] = p->ave_nn[X_43]/size;
115 p->ave_nn[Y_43] = p->ave_nn[Y_43]/size;
116 p->ave_nn[Z_43] = p->ave_nn[Z_43]/size;
119 for (
k = 0;
k < p->nmemb;
k++) {
120 cos_theta = VEC_DOT_43(s->nn[p->memb_vert[
k]],p->ave_nn);
121 if (cos_theta < -1.0)
123 else if (cos_theta > 1.0)
125 p->dev_nn += acos(cos_theta);
127 p->dev_nn = p->dev_nn/p->nmemb;