48 using namespace MNELIB;
49 using namespace Eigen;
50 using namespace FIFFLIB;
62 , rr(MatrixX3f::Zero(0,3))
63 , nn(MatrixX3f::Zero(0,3))
64 , tris(MatrixX3i::Zero(0,3))
65 , tri_cent(MatrixX3d::Zero(0,3))
66 , tri_nn(MatrixX3d::Zero(0,3))
67 , tri_area(VectorXd::Zero(0))
74 : id(p_MNEBemSurface.id)
75 , np(p_MNEBemSurface.np)
76 , ntri(p_MNEBemSurface.ntri)
77 , coord_frame(p_MNEBemSurface.coord_frame)
78 , sigma(p_MNEBemSurface.sigma)
79 , rr(p_MNEBemSurface.rr)
80 , nn(p_MNEBemSurface.nn)
81 , tris(p_MNEBemSurface.tris)
82 , tri_cent(p_MNEBemSurface.tri_cent)
83 , tri_nn(p_MNEBemSurface.tri_nn)
84 , tri_area(p_MNEBemSurface.tri_area)
85 , neighbor_tri(p_MNEBemSurface.neighbor_tri)
86 , neighbor_vert(p_MNEBemSurface.neighbor_vert)
106 rr = MatrixX3f::Zero(0,3);
107 nn = MatrixX3f::Zero(0,3);
108 tris = MatrixX3i::Zero(0,3);
110 tri_nn = MatrixX3d::Zero(0,3);
121 printf(
"\tCompleting triangulation info...");
130 for (qint32 i = 0; i < this->
ntri; ++i)
132 for ( qint32 j = 0; j < 3; ++j)
134 k = this->
tris(i, j);
136 r(j,0) = this->
rr(k, 0);
137 r(j,1) = this->
rr(k, 1);
138 r(j,2) = this->
rr(k, 2);
147 a = r.row(1) - r.row(0 );
148 b = r.row(2) - r.row(0);
149 this->
tri_nn(i,0) = a(1)*b(2)-a(2)*b(1);
150 this->
tri_nn(i,1) = a(2)*b(0)-a(0)*b(2);
151 this->
tri_nn(i,2) = a(0)*b(1)-a(1)*b(0);
154 size = this->
tri_nn.row(i)*this->
tri_nn.row(i).transpose();
155 size = std::pow(size, 0.5f );
158 this->
tri_nn.row(i) /= size;
161 std::fstream doc(
"./Output/tri_area.dat", std::ofstream::out | std::ofstream::trunc);
169 printf(
"Adding additional geometry info\n");
188 for (p = 0; p < this->
tris.rows(); p++) {
189 for (
k = 0;
k < 3;
k++) {
197 for (k = 0;
k < this->
np; k++) {
200 for (c = 0; c < 3; c++) {
235 for (qint32 p = 0; p < this->
ntri; ++p)
237 for (qint32 j = 0; j < 3 ; ++j)
240 nodenr = this->
tris(p,j);
241 this->
nn(nodenr,0) += this->
tri_nn(p,0);
242 this->
nn(nodenr,1) += this->
tri_nn(p,1);
243 this->
nn(nodenr,2) += this->
tri_nn(p,2);
248 for (qint32 p = 0; p < this->
np; ++p)
251 size = this->
nn.row(p)*this->
nn.row(p).transpose();
252 size = std::pow(size, 0.5f );
253 this->
nn.row(p) /= size;
264 this->
id=FIFFV_MNE_SURF_UNKNOWN;
282 case FIFFV_BEM_SURF_ID_BRAIN:
return "Brain";
283 case FIFFV_BEM_SURF_ID_SKULL:
return "Skull";
284 case FIFFV_BEM_SURF_ID_HEAD:
return "Head";
285 case FIFFV_BEM_SURF_ID_UNKNOWN:
return "Unknown";
286 default:
return "Unknown";