15 #if defined(HAVE_MESH)
34 static const int vv[12] = {2, 2, 3, 3, 2, 0, 1, 0, 6, 5, 4, 4};
36 SVector3 t1(x[1] - x[0], y[1] - y[0],
z[1] -
z[0]);
37 SVector3 t2(v2->
x() - x[0], v2->
y() - y[0], v2->
z() -
z[0]);
50 mat[0][0] =
_v[1]->
x() -
_v[0]->
x();
51 mat[0][1] =
_v[3]->
x() -
_v[0]->
x();
52 mat[0][2] =
_v[4]->
x() -
_v[0]->
x();
53 mat[1][0] =
_v[1]->
y() -
_v[0]->
y();
54 mat[1][1] =
_v[3]->
y() -
_v[0]->
y();
55 mat[1][2] =
_v[4]->
y() -
_v[0]->
y();
56 mat[2][0] =
_v[1]->
z() -
_v[0]->
z();
57 mat[2][1] =
_v[3]->
z() -
_v[0]->
z();
58 mat[2][2] =
_v[4]->
z() -
_v[0]->
z();
76 #if defined(HAVE_MESH)
85 double innerRadius = std::numeric_limits<double>::max();
97 for(ithFace = 0; ithFace < 6; ithFace++) {
118 static double pp[8][3] = {{-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1},
119 {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}};
120 static int ed[12][2] = {{0, 1}, {0, 3}, {0, 4}, {1, 2}, {1, 5}, {2, 3},
121 {2, 6}, {3, 7}, {4, 5}, {4, 7}, {5, 6}, {7, 6}};
122 int iEdge = num / numSubEdges;
123 int iSubEdge = num % numSubEdges;
125 int iVertex1 = ed[iEdge][0];
126 int iVertex2 = ed[iEdge][1];
127 double t1 = (double)iSubEdge / (
double)numSubEdges;
128 double u1 = pp[iVertex1][0] * (1. - t1) + pp[iVertex2][0] * t1;
129 double v1 = pp[iVertex1][1] * (1. - t1) + pp[iVertex2][1] * t1;
130 double w1 = pp[iVertex1][2] * (1. - t1) + pp[iVertex2][2] * t1;
132 double t2 = (double)(iSubEdge + 1) / (double)numSubEdges;
133 double u2 = pp[iVertex1][0] * (1. - t2) + pp[iVertex2][0] * t2;
134 double v2 = pp[iVertex1][1] * (1. - t2) + pp[iVertex2][1] * t2;
135 double w2 = pp[iVertex1][2] * (1. - t2) + pp[iVertex2][2] * t2;
138 hex->
pnt(u1, v1,
w1, pnt1);
139 hex->
pnt(u2, v2, w2, pnt2);
197 static double pp[8][3] = {{-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1},
198 {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}};
200 int iFace = num / (2 * numSubEdges * numSubEdges);
201 int iSubFace = num % (2 * numSubEdges * numSubEdges);
223 int io = iSubFace % 2;
224 int ix = (iSubFace / 2) / numSubEdges;
225 int iy = (iSubFace / 2) % numSubEdges;
227 const double d = 2. / numSubEdges;
228 double ox = -1. + d * ix;
229 double oy = -1. + d * iy;
232 double U1 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
233 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
234 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
235 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
236 double V1 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
237 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
238 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
239 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
240 double W1 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
241 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
242 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
243 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
247 double U2 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
248 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
249 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
250 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
251 double V2 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
252 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
253 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
254 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
255 double W2 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
256 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
257 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
258 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
262 double U3 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
263 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
264 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
265 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
266 double V3 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
267 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
268 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
269 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
270 double W3 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
271 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
272 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
273 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
275 hex->
pnt(U1, V1, W1, pnt1);
276 hex->
pnt(U2, V2, W2, pnt2);
277 hex->
pnt(U3, V3, W3, pnt3);
280 double U1 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
281 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
282 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
283 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
284 double V1 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
285 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
286 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
287 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
288 double W1 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
289 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
290 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
291 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
296 double U2 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
297 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
298 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
299 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
300 double V2 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
301 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
302 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
303 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
304 double W2 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
305 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
306 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
307 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
311 double U3 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
312 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
313 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
314 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
315 double V3 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
316 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
317 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
318 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
319 double W3 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
320 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
321 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
322 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
324 hex->
pnt(U1, V1, W1, pnt1);
325 hex->
pnt(U2, V2, W2, pnt2);
326 hex->
pnt(U3, V3, W3, pnt3);
339 SVector3 d1(x[1] - x[0], y[1] - y[0],
z[1] -
z[0]);
340 SVector3 d2(x[2] - x[0], y[2] - y[0],
z[2] -
z[0]);
350 #if defined(HAVE_VISUDEV)
351 static const int fquad[24][4] = {
352 {0, 3, 2, 1}, {3, 2, 1, 0}, {2, 1, 0, 3}, {1, 0, 3, 2}, {0, 1, 5, 4},
353 {1, 5, 4, 0}, {5, 4, 0, 1}, {4, 0, 1, 5}, {0, 4, 7, 3}, {4, 7, 3, 0},
354 {7, 3, 0, 4}, {3, 0, 4, 7}, {1, 2, 6, 5}, {2, 6, 5, 1}, {6, 5, 1, 2},
355 {5, 1, 2, 6}, {2, 3, 7, 6}, {3, 7, 6, 2}, {7, 6, 2, 3}, {6, 2, 3, 7},
356 {4, 5, 6, 7}, {5, 6, 7, 4}, {6, 7, 4, 5}, {7, 4, 5, 6}};
368 static const int f[12][3] = {{0, 3, 2}, {0, 2, 1}, {0, 1, 5}, {0, 5, 4},
369 {0, 4, 7}, {0, 7, 3}, {1, 2, 6}, {1, 6, 5},
370 {2, 3, 7}, {2, 7, 6}, {4, 5, 6}, {4, 6, 7}};
403 #if defined(HAVE_VISUDEV)
414 return curved ? 12 * std::pow(
CTX::instance()->mesh.numSubEdges, 2) :
420 return curved ? 12 * std::pow(
CTX::instance()->mesh.numSubEdges, 2) :
426 return curved ? 12 * std::pow(
CTX::instance()->mesh.numSubEdges, 2) :
434 indices.resize(ref.
size1());
435 for(
int i = 0; i < ref.
size1(); ++i) {
436 const double u = ref(i, 0);
437 const double v = ref(i, 1);
438 const double w = ref(i, 2);
439 for(
int j = 0; j < ref.
size1(); ++j) {
440 if(u == ref(j, 1) && v == ref(j, 0) && w == ref(j, 2)) {
461 std::vector<MVertex *> oldv(8 +
_vs.size());
466 for(
int i = 0; i < 8; ++i) {
_v[i] = oldv[indices[i]]; }
467 for(std::size_t i = 0; i <
_vs.size(); ++i) {
_vs[i] = oldv[indices[8 + i]]; }