18 mat[0][0] =
_v[1]->
x() -
_v[0]->
x();
19 mat[0][1] =
_v[3]->
x() -
_v[0]->
x();
20 mat[0][2] =
_v[4]->
x() -
_v[0]->
x();
21 mat[1][0] =
_v[1]->
y() -
_v[0]->
y();
22 mat[1][1] =
_v[3]->
y() -
_v[0]->
y();
23 mat[1][2] =
_v[4]->
y() -
_v[0]->
y();
24 mat[2][0] =
_v[1]->
z() -
_v[0]->
z();
25 mat[2][1] =
_v[3]->
z() -
_v[0]->
z();
26 mat[2][2] =
_v[4]->
z() -
_v[0]->
z();
45 for(ithFace = 0; ithFace < 5; ++ithFace) {
68 static double pp[5][3] = {
69 {-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}, {0, 0, 1}};
70 static int ed[8][2] = {{0, 1}, {0, 3}, {0, 4}, {1, 2},
71 {1, 4}, {2, 3}, {2, 4}, {3, 4}};
72 int iEdge = num / numSubEdges;
73 int iSubEdge = num % numSubEdges;
75 int iVertex1 = ed[iEdge][0];
76 int iVertex2 = ed[iEdge][1];
77 double t1 = (double)iSubEdge / (
double)numSubEdges;
78 double u1 = pp[iVertex1][0] * (1. - t1) + pp[iVertex2][0] * t1;
79 double v1 = pp[iVertex1][1] * (1. - t1) + pp[iVertex2][1] * t1;
80 double w1 = pp[iVertex1][2] * (1. - t1) + pp[iVertex2][2] * t1;
82 double t2 = (double)(iSubEdge + 1) / (double)numSubEdges;
83 double u2 = pp[iVertex1][0] * (1. - t2) + pp[iVertex2][0] * t2;
84 double v2 = pp[iVertex1][1] * (1. - t2) + pp[iVertex2][1] * t2;
85 double w2 = pp[iVertex1][2] * (1. - t2) + pp[iVertex2][2] * t2;
88 pnt(u1, v1,
w1, pnt1);
89 pnt(u2, v2, w2, pnt2);
98 static const int f[8] = {0, 1, 0, 2, 2, 3, 2, 3};
107 #if defined(HAVE_VISUDEV)
127 static double pp[5][3] = {
128 {-1, -1, 0}, {1, -1, 0}, {1, 1, 0}, {-1, 1, 0}, {0, 0, 1}};
129 int iFace = num / (numSubEdges * numSubEdges);
130 int iSubFace = num % (numSubEdges * numSubEdges);
134 iSubFace = num % (2 * numSubEdges * numSubEdges);
137 int iVertex1, iVertex2, iVertex3, iVertex4;
156 for(
int i = 0; i < numSubEdges; i++) {
157 int nbl = (numSubEdges - i - 1) * 2 + 1;
161 ix = nbl - (nbt - iSubFace);
166 const double d = 1. / numSubEdges;
168 double u1, v1, u2, v2, u3, v3;
172 u2 = (ix / 2 + 1) * d;
178 u1 = (ix / 2 + 1) * d;
180 u2 = (ix / 2 + 1) * d;
186 double U1 = pp[iVertex1][0] * (1. - u1 - v1) + pp[iVertex2][0] * u1 +
187 pp[iVertex3][0] * v1;
188 double U2 = pp[iVertex1][0] * (1. - u2 - v2) + pp[iVertex2][0] * u2 +
189 pp[iVertex3][0] * v2;
190 double U3 = pp[iVertex1][0] * (1. - u3 - v3) + pp[iVertex2][0] * u3 +
191 pp[iVertex3][0] * v3;
193 double V1 = pp[iVertex1][1] * (1. - u1 - v1) + pp[iVertex2][1] * u1 +
194 pp[iVertex3][1] * v1;
195 double V2 = pp[iVertex1][1] * (1. - u2 - v2) + pp[iVertex2][1] * u2 +
196 pp[iVertex3][1] * v2;
197 double V3 = pp[iVertex1][1] * (1. - u3 - v3) + pp[iVertex2][1] * u3 +
198 pp[iVertex3][1] * v3;
200 double W1 = pp[iVertex1][2] * (1. - u1 - v1) + pp[iVertex2][2] * u1 +
201 pp[iVertex3][2] * v1;
202 double W2 = pp[iVertex1][2] * (1. - u2 - v2) + pp[iVertex2][2] * u2 +
203 pp[iVertex3][2] * v2;
204 double W3 = pp[iVertex1][2] * (1. - u3 - v3) + pp[iVertex2][2] * u3 +
205 pp[iVertex3][2] * v3;
207 pyr->
pnt(U1, V1, W1, pnt1);
208 pyr->
pnt(U2, V2, W2, pnt2);
209 pyr->
pnt(U3, V3, W3, pnt3);
224 int io = iSubFace % 2;
225 int ix = (iSubFace / 2) / numSubEdges;
226 int iy = (iSubFace / 2) % numSubEdges;
228 const double d = 2. / numSubEdges;
229 double ox = -1. + d * ix;
230 double oy = -1. + d * iy;
233 double U1 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
234 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
235 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
236 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
237 double V1 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
238 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
239 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
240 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
241 double W1 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
242 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
243 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
244 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
248 double U2 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
249 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
250 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
251 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
252 double V2 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
253 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
254 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
255 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
256 double W2 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
257 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
258 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
259 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
263 double U3 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
264 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
265 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
266 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
267 double V3 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
268 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
269 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
270 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
271 double W3 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
272 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
273 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
274 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
276 pyr->
pnt(U1, V1, W1, pnt1);
277 pyr->
pnt(U2, V2, W2, pnt2);
278 pyr->
pnt(U3, V3, W3, pnt3);
281 double U1 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
282 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
283 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
284 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
285 double V1 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
286 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
287 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
288 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
289 double W1 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
290 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
291 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
292 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
297 double U2 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
298 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
299 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
300 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
301 double V2 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
302 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
303 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
304 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
305 double W2 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
306 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
307 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
308 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
312 double U3 = pp[iVertex1][0] * (1. - ox) * (1 - oy) * .25 +
313 pp[iVertex2][0] * (1. + ox) * (1 - oy) * .25 +
314 pp[iVertex3][0] * (1. + ox) * (1 + oy) * .25 +
315 pp[iVertex4][0] * (1. - ox) * (1 + oy) * .25;
316 double V3 = pp[iVertex1][1] * (1. - ox) * (1 - oy) * .25 +
317 pp[iVertex2][1] * (1. + ox) * (1 - oy) * .25 +
318 pp[iVertex3][1] * (1. + ox) * (1 + oy) * .25 +
319 pp[iVertex4][1] * (1. - ox) * (1 + oy) * .25;
320 double W3 = pp[iVertex1][2] * (1. - ox) * (1 - oy) * .25 +
321 pp[iVertex2][2] * (1. + ox) * (1 - oy) * .25 +
322 pp[iVertex3][2] * (1. + ox) * (1 + oy) * .25 +
323 pp[iVertex4][2] * (1. - ox) * (1 + oy) * .25;
325 pyr->
pnt(U1, V1, W1, pnt1);
326 pyr->
pnt(U2, V2, W2, pnt2);
327 pyr->
pnt(U3, V3, W3, pnt3);
341 SVector3 d1(x[1] - x[0], y[1] - y[0],
z[1] -
z[0]);
342 SVector3 d2(x[2] - x[0], y[2] - y[0],
z[2] -
z[0]);
352 #if defined(HAVE_VISUDEV)
353 static const int fquad[4][4] = {
354 {0, 3, 2, 1}, {3, 2, 1, 0}, {2, 1, 0, 3}, {1, 0, 3, 2}};
369 static const int f[6][3] = {{0, 1, 4}, {3, 0, 4}, {1, 2, 4},
370 {2, 3, 4}, {0, 3, 2}, {0, 2, 1}};
400 indices.resize(ref.
size1());
401 for(
int i = 0; i < ref.
size1(); ++i) {
402 const double u = ref(i, 0);
403 const double v = ref(i, 1);
404 const double w = ref(i, 2);
405 for(
int j = 0; j < ref.
size1(); ++j) {
406 if(u == ref(j, 1) && v == ref(j, 0) && w == ref(j, 2)) {
427 std::vector<MVertex *> oldv(5 +
_vs.size());
432 for(
int i = 0; i < 5; ++i) {
_v[i] = oldv[indices[i]]; }
433 for(std::size_t i = 0; i <
_vs.size(); ++i) {
_vs[i] = oldv[indices[5 + i]]; }
439 int minVtx = num * (
_order - 1);
440 int maxVtx = (num + 1) * (
_order - 1) - 1;
443 for(
int i = minVtx; i <= maxVtx; i++) v.push_back(
_vs[i]);
445 for(
int i = maxVtx; i >= minVtx; i--) v.push_back(
_vs[i]);
455 int nb = ((num == 4) ? 4 : 3) *
_order;
456 if(complete) nb += (num == 4) ? nbQ : nbT;
512 int start = 8 * (
_order - 1) + num * nbT;
513 int nbPoints = (num == 4) ? nbQ : nbT;
514 for(
int i = start; i < start + nbPoints; i++) v.push_back(
_vs[i]);