17 #ifdef WITH_CXX_GUARDEDALLOC
22 #include <Eigen/Dense>
37 # define dc_printf printf
40 # define dc_printf(...) \
72 hermite_num(sharpness),
74 alloc_output(alloc_output_func),
75 add_vert(add_vert_func),
76 add_quad(add_quad_func)
91 #ifdef IN_VERBOSE_MODE
99 #ifdef IN_VERBOSE_MODE
115 clock_t start, finish;
126 (
double)(finish - start) / CLOCKS_PER_SEC);
138 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
139 # ifdef IN_VERBOSE_MODE
140 dc_printf(
"Holes: %d Average Length: %f Max Length: %d \n",
142 (
float)totRingLengths / (
float)numRings,
148 int tnumRings = numRings;
150 #ifdef IN_VERBOSE_MODE
151 dc_printf(
"Holes after patching: %d \n", numRings);
153 numRings = tnumRings;
162 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
188 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
203 #ifdef IN_VERBOSE_MODE
208 void Octree::initMemory()
226 void Octree::freeMemory()
228 for (
int i = 0; i < 9; i++) {
233 for (
int i = 0; i < 4; i++) {
239 void Octree::printMemUsage()
242 dc_printf(
"********* Internal nodes: \n");
243 for (
int i = 0; i < 9; i++) {
250 for (
int i = 0; i < 4; i++) {
257 dc_printf(
"Total allocated bytes on disk: %d \n", totalbytes);
258 dc_printf(
"Total leaf nodes: %d\n", totalLeafs);
261 void Octree::resetMinimalEdges()
266 void Octree::addAllTriangles()
273 int unitcount = 1000;
282 addTriangle(trian,
count);
289 if (
count % unitcount == 0) {
292 switch ((
count / unitcount) % 4) {
321 dc_printf(
" %f%% complete.", 100 * percent);
330 void Octree::addTriangle(
Triangle *trian,
int triind)
335 for (i = 0; i < 3; i++) {
336 for (j = 0; j < 3; j++)
343 for (i = 0; i < 3; i++) {
344 for (j = 0; j < 3; j++)
358 static void print_depth(
int height,
int maxDepth)
360 for (
int i = 0; i < maxDepth -
height; i++)
368 const int vertdiff[8][3] = {
369 {0, 0, 0}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}, {1, -1, -1}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}};
374 int tempdiff[3] = {0, 0, 0};
377 for (i = 0; i < 8; i++) {
378 tempdiff[0] += vertdiff[i][0];
379 tempdiff[1] += vertdiff[i][1];
380 tempdiff[2] += vertdiff[i][2];
383 if (boxmask & (1 << i)) {
384 subp->
shift(tempdiff);
385 tempdiff[0] = tempdiff[1] = tempdiff[2] = 0;
389 if (!
node->has_child(i)) {
397 if (
node->is_child_leaf(i))
404 if (
node->has_child(i))
418 int mask[3] = {0, 4, 8};
419 int oldc = 0, newc = 0;
421 float a[3], b[3],
c[3];
423 for (i = 0; i < 3; i++) {
424 if (!getEdgeParity(
node,
mask[i])) {
436 offs[newc] = getEdgeOffsetNormal(
node, oldc,
a[newc], b[newc],
c[newc]);
445 node = updateEdgeOffsetsNormals(
node, oldc, newc, offs,
a, b,
c);
454 for (
int i = 0; i < 8; i++) {
455 if (
node->has_child(i)) {
456 if (
node->is_child_leaf(i))
457 createPrimalEdgesMask(&
node->get_child(
count)->leaf);
459 preparePrimalEdgesMask(&
node->get_child(
count)->internal);
480 if (chdpath !=
NULL) {
481 dc_printf(
"there are incomplete rings.\n");
499 for (i = 0; i < 8; i++) {
500 for (j = 0; j < 3; j++) {
508 trace(chd[i], nst[i],
len, depth - 1, chdpaths[i]);
516 int df[2] = {depth - 1, depth - 1};
521 for (i = 0; i < 12; i++) {
524 for (
int j = 0; j < 2; j++) {
525 lf[j] = chdleaf[
c[j]];
543 combinePaths(chdpaths[0], chdpaths[1], conn[8], rings);
544 combinePaths(chdpaths[2], chdpaths[3], conn[9], rings);
545 combinePaths(chdpaths[4], chdpaths[5], conn[10], rings);
546 combinePaths(chdpaths[6], chdpaths[7], conn[11], rings);
548 combinePaths(chdpaths[0], chdpaths[2], conn[4], rings);
549 combinePaths(chdpaths[4], chdpaths[6], conn[5], rings);
550 combinePaths(chdpaths[0],
NULL, conn[6], rings);
551 combinePaths(chdpaths[4],
NULL, conn[7], rings);
553 combinePaths(chdpaths[0], chdpaths[4], conn[0], rings);
554 combinePaths(chdpaths[0],
NULL, conn[1], rings);
555 combinePaths(chdpaths[0],
NULL, conn[2], rings);
556 combinePaths(chdpaths[0],
NULL, conn[3], rings);
568 totRingLengths += trings->
length;
569 if (trings->
length > maxRingLength) {
570 maxRingLength = trings->
length;
572 trings = trings->
next;
576 newnode = patch(newnode, st, (
len << 1), rings);
584 void Octree::findPaths(
585 Node *
node[2],
int leaf[2],
int depth[2],
int *st[2],
int maxdep,
int dir,
PathList *&paths)
591 if (!(leaf[0] && leaf[1])) {
600 for (j = 0; j < 2; j++) {
602 node[j]->internal.fill_children(chd[j], chdleaf[j]);
605 for (i = 0; i < 8; i++) {
606 for (
int k = 0; k < 3; k++) {
607 nst[j][i][k] = st[j][k] +
len *
vertmap[i][k];
618 for (i = 0; i < 4; i++) {
620 for (
int j = 0; j < 2; j++) {
628 lf[j] = chdleaf[j][
c[j]];
629 nf[j] = chd[j][
c[j]];
630 df[j] = depth[j] - 1;
631 nstf[j] = nst[j][
c[j]];
634 findPaths(nf, lf, df, nstf, maxdep - 1,
faceProcFaceMask[dir][i][2], paths);
639 int ind = (depth[0] == maxdep ? 0 : 1);
640 int fcind = 2 * dir + (1 - ind);
646 ele1->
pos[0] = st[0][0];
647 ele1->
pos[1] = st[0][1];
648 ele1->
pos[2] = st[0][2];
650 ele2->
pos[0] = st[1][0];
651 ele2->
pos[1] = st[1][1];
652 ele2->
pos[2] = st[1][2];
680 tpaths = tpaths->
next;
687 if ((templist = combineSinglePath(list1, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
699 if ((templist = combineSinglePath(list2, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
711 if ((templist = combineSinglePath(nlist, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
720 if (isEqual(singlist->
head, singlist->
tail)) {
727 singlist->
next = rings;
731 singlist->
next = nlist;
768 if (isEqual(list1->
head, list2->
head) || isEqual(list1->
tail, list2->
tail)) {
804 if (isEqual(list1->
head, list2->
tail)) {
817 deletePath(head1, pre1, list1);
818 deletePath(head2, pre2, list2);
822 else if (isEqual(list1->
tail, list2->
head)) {
834 deletePath(head1, pre1, list1);
835 deletePath(head2, pre2, list2);
864 void Octree::printPath(
PathList *path)
872 while (n && (same == 0 || n != path->
head)) {
878 if (n == path->
head) {
893 while (n && (same == 0 || n != path)) {
907 void Octree::printPaths(
PathList *path)
911 while (iter !=
NULL) {
922 dc_printf(
"Call to PATCH with rings: \n");
945 dc_printf(
"Error! should have no list by now.\n");
951 newnode = patchSplit(newnode, st,
len, rings, 0, xlists[0], xlists[1]);
955 newnode = patchSplit(newnode, st,
len, xlists[0], 1, ylists[0], ylists[1]);
956 newnode = patchSplit(newnode, st,
len, xlists[1], 1, ylists[2], ylists[3]);
960 newnode = patchSplit(newnode, st,
len, ylists[0], 2, zlists[0], zlists[1]);
961 newnode = patchSplit(newnode, st,
len, ylists[1], 2, zlists[2], zlists[3]);
962 newnode = patchSplit(newnode, st,
len, ylists[2], 2, zlists[4], zlists[5]);
963 newnode = patchSplit(newnode, st,
len, ylists[3], 2, zlists[6], zlists[7]);
968 for (
int i = 0; i < 8; i++) {
969 if (zlists[i] !=
NULL) {
985 Node *Octree::patchSplit(
Node *newnode,
994 dc_printf(
"Call to PATCHSPLIT with direction %d and rings: \n", dir);
1001 while (rings !=
NULL) {
1003 newnode = patchSplitSingle(newnode, st,
len, rings->
head, dir, nrings1, nrings2);
1007 rings = rings->
next;
1011 #ifdef IN_DEBUG_MODE
1012 dc_printf(
"Return from PATCHSPLIT with \n");
1014 printPaths(nrings1);
1016 printPaths(nrings2);
1022 Node *Octree::patchSplitSingle(
Node *newnode,
1030 #ifdef IN_DEBUG_MODE
1031 dc_printf(
"Call to PATCHSPLITSINGLE with direction %d and path: \n", dir);
1036 #ifdef IN_DEBUG_MODE
1037 dc_printf(
"Return from PATCHSPLITSINGLE with head==NULL.\n");
1048 int side = findPair(head, st[dir] +
len / 2, dir, pre1, pre2);
1053 dc_printf(
"Location: %d %d %d Direction: %d Reso: %d\n",
1070 nring->
next = nrings1;
1074 nring->
next = nrings2;
1085 newnode = connectFace(newnode, st,
len, dir, pre1, pre2);
1087 if (isEqual(pre1, pre1->
next)) {
1088 if (pre1 == pre1->
next) {
1098 if (isEqual(pre2, pre2->
next)) {
1099 if (pre2 == pre2->
next) {
1114 newnode = patchSplitSingle(newnode, st,
len, pre1, dir, nrings1, nrings2);
1115 newnode = patchSplitSingle(newnode, st,
len, pre2, dir, nrings1, nrings2);
1118 #ifdef IN_DEBUG_MODE
1119 dc_printf(
"Return from PATCHSPLITSINGLE with \n");
1121 printPaths(nrings1);
1123 printPaths(nrings2);
1129 Node *Octree::connectFace(
1132 #ifdef IN_DEBUG_MODE
1133 dc_printf(
"Call to CONNECTFACE with direction %d and length %d path: \n", dir,
len);
1143 int pos = st[dir] +
len / 2;
1144 int xdir = (dir + 1) % 3;
1145 int ydir = (dir + 2) % 3;
1149 float p1,
q1, p2, q2;
1151 getFacePoint(f2->
next, dir, x1,
y1, p1,
q1);
1152 getFacePoint(f2, dir,
x2, y2, p2, q2);
1154 float dx =
x2 + p2 - x1 - p1;
1155 float dy = y2 + q2 -
y1 -
q1;
1158 float rx = p1, ry =
q1;
1159 int incx = 1, incy = 1;
1160 int lx = x1, ly =
y1;
1161 int hx =
x2, hy = y2;
1176 float sx = dx * incx;
1177 float sy = dy * incy;
1192 if (curN ==
NULL || curP ==
NULL) {
1207 while (ori[xdir] !=
x2 || ori[ydir] != y2) {
1209 if (sy * (1 - rx) > sx * (1 - ry)) {
1211 next = ori[ydir] + incy;
1212 if (next < ly || next > hy) {
1214 next = ori[xdir] + incx;
1219 next = ori[xdir] + incx;
1220 if (next < lx || next > hx) {
1222 next = ori[ydir] + incy;
1229 rx += (sy == 0 ? 0 : (1 - ry) * sx / sy);
1235 alpha =
x2 < x1 ? 1 - rx : rx;
1240 ry += (sx == 0 ? 0 : (1 - rx) * sy / sx);
1246 alpha = y2 <
y1 ? 1 - ry : ry;
1251 float spt[3] = {(
float)nori[0], (
float)nori[1], (
float)nori[2]};
1254 spt[(dir + walkdir) % 3] +=
mindimen;
1258 dc_printf(
"new x,y: %d %d\n", ori[xdir] / edgelen, ori[ydir] / edgelen);
1259 dc_printf(
"nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2],
alpha, walkdir);
1260 dc_printf(
"%f %f %f\n", spt[0], spt[1], spt[2]);
1264 newnode = locateCell(&newnode->
internal, st,
len, nori, dir, 1, nodeN, stN, lenN);
1265 newnode = locateCell(&newnode->
internal, st,
len, nori, dir, 0, nodeP, stP, lenP);
1272 if (curEleN->
pos[0] != stN[0] || curEleN->
pos[1] != stN[1] || curEleN->
pos[2] != stN[2]) {
1273 if (curEleN->
next->
pos[0] != stN[0] || curEleN->
next->
pos[1] != stN[1] ||
1274 curEleN->
next->
pos[2] != stN[2]) {
1277 newEleN->
pos[0] = stN[0];
1278 newEleN->
pos[1] = stN[1];
1279 newEleN->
pos[2] = stN[2];
1281 curEleN->
next = newEleN;
1284 newEleN = curEleN->
next;
1286 curN = patchAdjacent(&newnode->
internal,
1303 if (curEleP->
pos[0] != stP[0] || curEleP->
pos[1] != stP[1] || curEleP->
pos[2] != stP[2]) {
1304 if (f2->
pos[0] != stP[0] || f2->
pos[1] != stP[1] || f2->
pos[2] != stP[2]) {
1306 newEleP->
next = curEleP;
1307 newEleP->
pos[0] = stP[0];
1308 newEleP->
pos[1] = stP[1];
1309 newEleP->
pos[2] = stP[2];
1316 curP = patchAdjacent(&newnode->
internal,
1339 #ifdef IN_DEBUG_MODE
1340 dc_printf(
"Return from CONNECTFACE with \n");
1364 #ifdef IN_DEBUG_MODE
1369 "-----------------%d %d %d; %d %d %d\n", st1[0], st2[1], st1[2], st2[0], st2[1], st2[2]);
1373 int edgedir = (dir + (3 - walkdir)) % 3;
1374 int incdir = (dir + walkdir) % 3;
1375 int ind1 = (edgedir == 1 ? (dir + 3 - edgedir) % 3 - 1 : 2 - (dir + 3 - edgedir) % 3);
1376 int ind2 = (edgedir == 1 ? (incdir + 3 - edgedir) % 3 - 1 : 2 - (incdir + 3 - edgedir) % 3);
1378 int eind1 = ((edgedir << 2) | (side << ind1) | ((inc > 0 ? 1 : 0) << ind2));
1379 int eind2 = ((edgedir << 2) | (side << ind1) | ((inc > 0 ? 0 : 1) << ind2));
1381 #ifdef IN_DEBUG_MODE
1382 dc_printf(
"Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1,
alpha, eind2,
alpha);
1397 updateParent(
node,
len, st1, nleaf1);
1398 updateParent(
node,
len, st2, nleaf2);
1411 #ifdef IN_DEBUG_MODE
1429 #ifdef IN_DEBUG_MODE
1437 for (i = 0; i < 3; i++) {
1439 if (i == dir && side == 1) {
1440 ind |= (ori[i] <= (st[i] +
len) ? 0 : 1);
1443 ind |= (ori[i] < (st[i] +
len) ? 0 : 1);
1447 #ifdef IN_DEBUG_MODE
1450 "In LOCATECELL index of ori(%d %d %d) with dir %d side %d in st(%d %d %d, %d) is: %d\n",
1468 if (
node->has_child(ind)) {
1471 if (
node->is_child_leaf(ind)) {
1478 locateCell(&chd->
internal, rst,
len, ori, dir, side, rleaf, rst, rlen));
1486 rleaf = (
Node *)chd;
1492 node = addChild(
node, ind, locateCell(chd, rst,
len, ori, dir, side, rleaf, rst, rlen), 0);
1496 #ifdef IN_DEBUG_MODE
1506 if (ele !=
NULL && locateLeafCheck(ele->
pos) != ele->node) {
1507 dc_printf(
"Screwed! at pos: %d %d %d\n",
1520 while (n && (same == 0 || n != path)) {
1531 for (i = 0; i < 3; i++) {
1532 if (e1->
pos[i] != e2->
pos[i]) {
1533 if (e1->
pos[i] < e2->
pos[i]) {
1546 getFacePoint(
e, i,
x,
y, p, q);
1549 void Octree::getFacePoint(
PathElement *leaf,
int dir,
int &
x,
int &
y,
float &p,
float &q)
1552 float avg[3] = {0, 0, 0};
1554 int num = 0, num2 = 0;
1557 for (
int i = 0; i < 4; i++) {
1558 int edgeind =
faceMap[dir * 2][i];
1560 for (
int j = 0; j < 3; j++) {
1564 if (getEdgeIntersectionByIndex(nst, edgeind / 4, off, 1)) {
1570 if (getEdgeParity(leafnode, edgeind)) {
1575 dc_printf(
"Wrong! dir: %d pos: %d %d %d num: %d\n",
1582 avg[1] = (
float)leaf->
pos[1];
1596 int xdir = (dir + 1) % 3;
1597 int ydir = (dir + 2) % 3;
1599 float xf = avg[xdir];
1600 float yf = avg[ydir];
1602 #ifdef IN_DEBUG_MODE
1606 float *m = (leaf == leaf1 ? m1 : m2);
1607 if (xf < leaf->
pos[xdir] || yf < leaf->
pos[ydir] || xf > leaf->
pos[xdir] + leaf->len ||
1608 yf > leaf->
pos[ydir] + leaf->len) {
1609 dc_printf(
"Outside cube(%d %d %d), %d : %d %d %f %f\n",
1626 if (alpha < 0 || alpha > 1 || xf < leaf->
pos[xdir] || xf > leaf->
pos[xdir] + leaf->len ||
1627 yf < leaf->
pos[ydir] || yf > leaf->
pos[ydir] + leaf->len) {
1628 dc_printf(
"Alpha: %f Address: %d and %d\n",
alpha, leaf1->node, leaf2->node);
1629 dc_printf(
"GETFACEPOINT result:(%d %d %d) %d min:(%f %f %f);(%d %d %d) %d min:(%f %f %f).\n",
1644 dc_printf(
"Face point at dir %d pos %d: %f %f\n", dir,
pos, xf, yf);
1656 #ifdef IN_DEBUG_MODE
1657 dc_printf(
"Face point at dir %d : %f %f\n", dir, xf, yf);
1663 int side = getSide(head,
pos, dir);
1672 while (cur != anchor && (getSide(cur,
pos, dir) == side)) {
1676 if (cur == anchor) {
1681 side = getSide(cur,
pos, dir);
1684 while (getSide(cur,
pos, dir) == side) {
1704 return (
e->pos[dir] <
pos ? -1 : 1);
1709 return (e1->
pos[0] == e2->
pos[0] && e1->
pos[1] == e2->
pos[1] && e1->
pos[2] == e2->
pos[2]);
1717 #ifdef IN_DEBUG_MODE
1718 dc_printf(
"Call to COMPRESSRING with path: \n");
1728 while (isEqual(cur, prepre)) {
1730 if (cur == prepre) {
1747 if (anchor ==
NULL) {
1754 }
while (prepre != anchor);
1758 #ifdef IN_DEBUG_MODE
1759 dc_printf(
"Return from COMPRESSRING with path: \n");
1764 void Octree::buildSigns()
1769 unsigned char table[1 << 12];
1770 for (
int i = 0; i <
size; i++) {
1773 for (
int i = 0; i < 256; i++) {
1775 for (
int j = 11; j >= 0; j--) {
1788 buildSigns(table,
root, 0, sg,
cube);
1791 void Octree::buildSigns(
unsigned char table[],
Node *
node,
int isLeaf,
int sg,
int rvalue[8])
1794 for (
int i = 0; i < 8; i++) {
1804 node->internal.fill_children(chd, leaf);
1809 buildSigns(table, chd[0], leaf[0], sg, oris);
1813 for (
int i = 1; i < 8; i++) {
1814 buildSigns(table, chd[i], leaf[i], oris[i],
cube);
1815 rvalue[i] =
cube[i];
1820 generateSigns(&
node->leaf, table, sg);
1822 for (
int i = 0; i < 8; i++) {
1823 rvalue[i] = getSign(&
node->leaf, i);
1828 void Octree::floodFill()
1831 int st[3] = {0, 0, 0};
1839 dc_printf(
"Largest component: %d\n", threshold);
1841 dc_printf(
"Removing all components smaller than %d\n", threshold);
1843 int st2[3] = {0, 0, 0};
1854 for (i = 0; i < 12; i++) {
1855 setOutProcess(&
node->leaf, i);
1861 for (i = 0; i < 8; i++) {
1862 if (
node->internal.has_child(i)) {
1870 int Octree::floodFill(
LeafNode *leaf,
int st[3],
int len,
int ,
int threshold)
1879 for (i = 0; i < 12; i++) {
1880 par = getEdgeParity(leaf, i);
1881 inp = isInProcess(leaf, i);
1883 if (par == 1 && inp == 0) {
1895 setInProcessAll(mst, mdir);
1898 queue->pushQueue(mst, mdir);
1902 while (
queue->popQueue(nst, dir) == 1) {
1911 int stMask[3][3] = {{0, 0 -
len, 0 -
len}, {0 -
len, 0, 0 -
len}, {0 -
len, 0 -
len, 0}};
1913 for (j = 0; j < 3; j++) {
1915 cst[1][j] = nst[j] + stMask[dir][j];
1920 for (j = 0; j < 2; j++) {
1921 cs[j] = locateLeaf(cst[j]);
1925 int s = getSign(cs[0], 0);
1928 int fcCells[4] = {1, 0, 1, 0};
1929 int fcEdges[3][4][3] = {{{9, 2, 11}, {8, 1, 10}, {5, 1, 7}, {4, 2, 6}},
1930 {{10, 6, 11}, {8, 5, 9}, {1, 5, 3}, {0, 6, 2}},
1931 {{6, 10, 7}, {4, 9, 5}, {2, 9, 3}, {0, 10, 1}}};
1934 for (
int find = 0; find < 4; find++) {
1935 int cind = fcCells[find];
1939 for (eind = 0; eind < 3; eind++) {
1940 edge = fcEdges[dir][find][eind];
1941 if (getEdgeParity(cs[cind], edge) == 1) {
1948 for (eind = 2; eind >= 0; eind--) {
1949 edge = fcEdges[dir][find][eind];
1950 if (getEdgeParity(cs[cind], edge) == 1) {
1956 if (eind == 3 || eind == -1) {
1957 dc_printf(
"Wrong! this is not a consistent sign. %d\n", eind);
1964 int edir = edge / 4;
1966 if (isInProcess(cs[cind], edge) == 0) {
1967 setInProcessAll(est, edir);
1968 queue->pushQueue(est, edir);
1970 dc_printf(
"Pushed: est: %d %d %d, edir: %d\n",
1982 dc_printf(
"Size of component: %d ", total);
1984 if (threshold == 0) {
1986 if (total > maxtotal) {
1994 if (total >= threshold) {
1999 dc_printf(
"Less than %d, removing...\n", threshold);
2005 flipParityAll(mst, mdir);
2008 queue->pushQueue(mst, mdir);
2011 while (
queue->popQueue(nst, dir) == 1) {
2020 int stMask[3][3] = {{0, 0 -
len, 0 -
len}, {0 -
len, 0, 0 -
len}, {0 -
len, 0 -
len, 0}};
2022 for (j = 0; j < 3; j++) {
2024 cst[1][j] = nst[j] + stMask[dir][j];
2029 for (j = 0; j < 2; j++)
2030 cs[j] = locateLeaf(cst[j]);
2033 int s = getSign(cs[0], 0);
2036 int fcCells[4] = {1, 0, 1, 0};
2037 int fcEdges[3][4][3] = {{{9, 2, 11}, {8, 1, 10}, {5, 1, 7}, {4, 2, 6}},
2038 {{10, 6, 11}, {8, 5, 9}, {1, 5, 3}, {0, 6, 2}},
2039 {{6, 10, 7}, {4, 9, 5}, {2, 9, 3}, {0, 10, 1}}};
2042 for (
int find = 0; find < 4; find++) {
2043 int cind = fcCells[find];
2047 for (eind = 0; eind < 3; eind++) {
2048 edge = fcEdges[dir][find][eind];
2049 if (isInProcess(cs[cind], edge) == 1) {
2056 for (eind = 2; eind >= 0; eind--) {
2057 edge = fcEdges[dir][find][eind];
2058 if (isInProcess(cs[cind], edge) == 1) {
2064 if (eind == 3 || eind == -1) {
2065 dc_printf(
"Wrong! this is not a consistent sign. %d\n", eind);
2072 int edir = edge / 4;
2074 if (getEdgeParity(cs[cind], edge) == 1) {
2075 flipParityAll(est, edir);
2076 queue->pushQueue(est, edir);
2078 dc_printf(
"Pushed: est: %d %d %d, edir: %d\n",
2097 int Octree::floodFill(
Node *
node,
int st[3],
int len,
int height,
int threshold)
2103 maxtotal = floodFill(&
node->leaf, st,
len,
height, threshold);
2109 for (i = 0; i < 8; i++) {
2110 if (
node->internal.has_child(i)) {
2128 void Octree::writeOut()
2137 output_mesh = alloc_output(
numVertices, numQuads);
2139 int st[3] = {0, 0, 0};
2151 void Octree::countIntersection(
Node *
node,
int height,
int &nedge,
int &ncell,
int &nface)
2154 int total =
node->internal.get_num_children();
2155 for (
int i = 0; i < total; i++) {
2156 countIntersection(
node->internal.get_child(i),
height - 1, nedge, ncell, nface);
2160 nedge += getNumEdges2(&
node->leaf);
2162 int smask = getSignMask(&
node->leaf);
2169 if (smask > 0 && smask < 255) {
2174 for (
int i = 0; i < 3; i++) {
2175 if (getFaceEdgeNum(&
node->leaf, i * 2)) {
2185 Eigen::JacobiSVD<Eigen::Matrix3f> svd =
a.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
2188 Eigen::Vector3f((svd.singularValues().array().abs() > tolerance)
2189 .select(svd.singularValues().array().inverse(), 0))
2191 svd.matrixU().adjoint();
2196 const float midpoint[],
2200 Eigen::Matrix3f
A, pinv;
2201 A << halfA[0], halfA[1], halfA[2], halfA[1], halfA[3], halfA[4], halfA[2], halfA[4], halfA[5];
2204 Eigen::Vector3f b2(b), mp(midpoint),
result;
2208 for (
int i = 0; i < 3; i++)
2212 static void mass_point(
float mp[3],
const float pts[12][3],
const int parity[12])
2216 for (
int i = 0; i < 12; i++) {
2218 const float *p = pts[i];
2238 const float pts[12][3],
2239 const float norms[12][3],
2240 const int parity[12])
2242 float ata[6] = {0, 0, 0, 0, 0, 0};
2243 float atb[3] = {0, 0, 0};
2246 for (
int i = 0; i < 12; i++) {
2249 const float *
norm = norms[i];
2250 const float *p = pts[i];
2260 const float pn = p[0] *
norm[0] + p[1] *
norm[1] + p[2] *
norm[2];
2286 void Octree::computeMinimizer(
const LeafNode *leaf,
int st[3],
int len,
float rvalue[3])
const
2289 float pts[12][3], norms[12][3];
2291 fillEdgeIntersections(leaf, st,
len, pts, norms, parity);
2295 rvalue[0] = (
float)st[0] +
len / 2;
2296 rvalue[1] = (
float)st[1] +
len / 2;
2297 rvalue[2] = (
float)st[2] +
len / 2;
2301 rvalue[0] = rvalue[1] = rvalue[2] = 0;
2309 float mp[3] = {0, 0, 0};
2310 minimize(rvalue, mp, pts, norms, parity);
2316 if (rvalue[0] < st[0] - nh1 || rvalue[1] < st[1] - nh1 || rvalue[2] < st[2] - nh1 ||
2318 rvalue[0] > st[0] + nh2 || rvalue[1] > st[1] + nh2 || rvalue[2] > st[2] + nh2) {
2329 void Octree::generateMinimizer(
Node *
node,
int st[3],
int len,
int height,
int &offset)
2338 rvalue[0] = (
float)st[0] +
len / 2;
2339 rvalue[1] = (
float)st[1] +
len / 2;
2340 rvalue[2] = (
float)st[2] +
len / 2;
2341 computeMinimizer(&
node->leaf, st,
len, rvalue);
2345 for (j = 0; j < 3; j++) {
2350 int mult = 0, smask = getSignMask(&
node->leaf);
2356 if (smask > 0 && smask < 255) {
2361 for (j = 0; j <
mult; j++) {
2362 add_vert(output_mesh, rvalue);
2366 setMinimizerIndex(&
node->leaf, offset);
2374 for (i = 0; i < 8; i++) {
2375 if (
node->internal.has_child(i)) {
2388 void Octree::processEdgeWrite(
Node *
node[4],
int [4],
int ,
int dir)
2406 int seq[4] = {0, 1, 3, 2};
2407 for (
int k = 0; k < 4; k++) {
2412 if (vind[1] != -1) {
2416 ind[num - 1] = vind[0];
2417 ind[num - 2] = vind[1];
2440 add_quad(output_mesh, ind);
2451 void Octree::edgeProcContour(
Node *
node[4],
int leaf[4],
int depth[4],
int maxdep,
int dir)
2456 if (leaf[0] && leaf[1] && leaf[2] && leaf[3]) {
2457 processEdgeWrite(
node, depth, maxdep, dir);
2462 for (j = 0; j < 4; j++) {
2463 for (i = 0; i < 8; i++) {
2464 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2465 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2474 for (i = 0; i < 2; i++) {
2480 for (
int j = 0; j < 4; j++) {
2487 le[j] =
node[j]->internal.is_child_leaf(
c[j]);
2488 ne[j] = chd[j][
c[j]];
2489 de[j] = depth[j] - 1;
2498 void Octree::faceProcContour(
Node *
node[2],
int leaf[2],
int depth[2],
int maxdep,
int dir)
2504 if (!(leaf[0] && leaf[1])) {
2508 for (j = 0; j < 2; j++) {
2509 for (i = 0; i < 8; i++) {
2510 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2511 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2520 for (i = 0; i < 4; i++) {
2522 for (
int j = 0; j < 2; j++) {
2529 lf[j] =
node[j]->internal.is_child_leaf(
c[j]);
2530 nf[j] = chd[j][
c[j]];
2531 df[j] = depth[j] - 1;
2538 int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
2543 for (i = 0; i < 4; i++) {
2550 for (
int j = 0; j < 4; j++) {
2551 if (leaf[
order[j]]) {
2552 le[j] = leaf[
order[j]];
2554 de[j] = depth[
order[j]];
2557 le[j] =
node[
order[j]]->internal.is_child_leaf(
c[j]);
2558 ne[j] = chd[
order[j]][
c[j]];
2559 de[j] = depth[
order[j]] - 1;
2568 void Octree::cellProcContour(
Node *
node,
int leaf,
int depth)
2579 for (i = 0; i < 8; i++) {
2580 chd[i] = ((!leaf) &&
node->internal.has_child(i)) ?
2581 node->internal.get_child(
node->internal.get_child_count(i)) :
2586 for (i = 0; i < 8; i++) {
2587 cellProcContour(chd[i],
node->internal.is_child_leaf(i), depth - 1);
2593 int df[2] = {depth - 1, depth - 1};
2594 for (i = 0; i < 12; i++) {
2597 lf[0] =
node->internal.is_child_leaf(
c[0]);
2598 lf[1] =
node->internal.is_child_leaf(
c[1]);
2609 int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
2610 for (i = 0; i < 6; i++) {
2616 for (
int j = 0; j < 4; j++) {
2617 le[j] =
node->internal.is_child_leaf(
c[j]);
2626 void Octree::processEdgeParity(
LeafNode *
node[4],
int [4],
int ,
int dir)
2629 for (
int i = 0; i < 4; i++) {
2641 for (
int i = 0; i < 4; i++) {
2647 void Octree::edgeProcParity(
Node *
node[4],
int leaf[4],
int depth[4],
int maxdep,
int dir)
2652 if (leaf[0] && leaf[1] && leaf[2] && leaf[3]) {
2653 processEdgeParity((
LeafNode **)
node, depth, maxdep, dir);
2658 for (j = 0; j < 4; j++) {
2659 for (i = 0; i < 8; i++) {
2660 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2661 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2670 for (i = 0; i < 2; i++) {
2677 for (
int j = 0; j < 4; j++) {
2685 le[j] =
node[j]->internal.is_child_leaf(
c[j]);
2686 ne[j] = chd[j][
c[j]];
2687 de[j] = depth[j] - 1;
2696 void Octree::faceProcParity(
Node *
node[2],
int leaf[2],
int depth[2],
int maxdep,
int dir)
2702 if (!(leaf[0] && leaf[1])) {
2706 for (j = 0; j < 2; j++) {
2707 for (i = 0; i < 8; i++) {
2708 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2709 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2718 for (i = 0; i < 4; i++) {
2720 for (
int j = 0; j < 2; j++) {
2727 lf[j] =
node[j]->internal.is_child_leaf(
c[j]);
2728 nf[j] = chd[j][
c[j]];
2729 df[j] = depth[j] - 1;
2736 int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
2741 for (i = 0; i < 4; i++) {
2748 for (
int j = 0; j < 4; j++) {
2749 if (leaf[
order[j]]) {
2750 le[j] = leaf[
order[j]];
2752 de[j] = depth[
order[j]];
2755 le[j] =
node[
order[j]]->internal.is_child_leaf(
c[j]);
2756 ne[j] = chd[
order[j]][
c[j]];
2757 de[j] = depth[
order[j]] - 1;
2766 void Octree::cellProcParity(
Node *
node,
int leaf,
int depth)
2777 for (i = 0; i < 8; i++) {
2778 chd[i] = ((!leaf) &&
node->internal.has_child(i)) ?
2779 node->internal.get_child(
node->internal.get_child_count(i)) :
2784 for (i = 0; i < 8; i++) {
2785 cellProcParity(chd[i],
node->internal.is_child_leaf(i), depth - 1);
2791 int df[2] = {depth - 1, depth - 1};
2792 for (i = 0; i < 12; i++) {
2795 lf[0] =
node->internal.is_child_leaf(
c[0]);
2796 lf[1] =
node->internal.is_child_leaf(
c[1]);
2807 int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
2808 for (i = 0; i < 6; i++) {
2814 for (
int j = 0; j < 4; j++) {
2815 le[j] =
node->internal.is_child_leaf(
c[j]);
2860 const int faceProcFaceMask[3][4][3] = {{{4, 0, 0}, {5, 1, 0}, {6, 2, 0}, {7, 3, 0}},
2861 {{2, 0, 1}, {6, 4, 1}, {3, 1, 1}, {7, 5, 1}},
2862 {{1, 0, 2}, {3, 2, 2}, {5, 4, 2}, {7, 6, 2}}};
2865 {{1, 4, 0, 5, 1, 1}, {1, 6, 2, 7, 3, 1}, {0, 4, 6, 0, 2, 2}, {0, 5, 7, 1, 3, 2}},
2866 {{0, 2, 3, 0, 1, 0}, {0, 6, 7, 4, 5, 0}, {1, 2, 0, 6, 4, 2}, {1, 3, 1, 7, 5, 2}},
2867 {{1, 1, 0, 3, 2, 0}, {1, 5, 4, 7, 6, 0}, {0, 1, 5, 0, 4, 1}, {0, 3, 7, 2, 6, 1}}};
2870 {{3, 2, 1, 0, 0}, {7, 6, 5, 4, 0}},
2871 {{5, 1, 4, 0, 1}, {7, 3, 6, 2, 1}},
2872 {{6, 4, 2, 0, 2}, {7, 5, 3, 1, 2}},
2881 const int dirCell[3][4][3] = {{{0, -1, -1}, {0, -1, 0}, {0, 0, -1}, {0, 0, 0}},
2882 {{-1, 0, -1}, {-1, 0, 0}, {0, 0, -1}, {0, 0, 0}},
2883 {{-1, -1, 0}, {-1, 0, 0}, {0, -1, 0}, {0, 0, 0}}};
typedef float(TangentPoint)[2]
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
int isIntersecting() const
int isIntersectingPrimary(int edgeInd) const
unsigned char getBoxMask()
TriangleProjection * inherit
Inheritable portion.
float getIntersectionPrimary(int edgeInd) const
virtual float getBoundingBox(float origin[3])=0
Get bounding box.
virtual Triangle * getNextTriangle()=0
Get next triangle.
virtual int getNumTriangles()=0
Get number of triangles.
VirtualMemoryAllocator * alloc[9]
VirtualMemoryAllocator * leafalloc[4]
Octree(ModelReader *mr, DualConAllocOutput alloc_output_func, DualConAddVert add_vert_func, DualConAddQuad add_quad_func, DualConFlags flags, DualConMode mode, int depth, float threshold, float hermite_num)
virtual int getAllocated()=0
virtual void printInfo()=0
static CCL_NAMESPACE_BEGIN const double alpha
void(* DualConAddQuad)(void *output, const int vert_indices[4])
void(* DualConAddVert)(void *output, const float co[3])
void *(* DualConAllocOutput)(int totvert, int totquad)
const ManifoldIndices manifold_table[256]
ThreadQueue * queue
all scheduled work for the cpu
const int processEdgeMask[3][4]
const int edgeProcEdgeMask[3][2][5]
static void pseudoInverse(const Eigen::Matrix3f &a, Eigen::Matrix3f &result, float tolerance)
const int faceProcFaceMask[3][4][3]
static void minimize(float rvalue[3], float mp[3], const float pts[12][3], const float norms[12][3], const int parity[12])
static void solve_least_squares(const float halfA[], const float b[], const float midpoint[], float rvalue[])
const int cellProcFaceMask[12][3]
const int faceProcEdgeMask[3][4][6]
const int cellProcEdgeMask[6][5]
static void mass_point(float mp[3], const float pts[12][3], const int parity[12])
const int dirCell[3][4][3]
Node * get_child(int count)
static int childrenCountTable[256][8]
static int numChildrenTable[256]
int has_child(int index) const
static int childrenIndexTable[256][8]
void fill_children(Node *children[8], int leaf[8])
int is_child_leaf(int index) const
double norm[3]
Normal of the triangle.
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)