3 #ifdef WITH_CXX_GUARDEDALLOC
23 # define dc_printf printf
26 # define dc_printf(...) \
58 hermite_num(sharpness),
60 alloc_output(alloc_output_func),
61 add_vert(add_vert_func),
62 add_quad(add_quad_func)
77 #ifdef IN_VERBOSE_MODE
85 #ifdef IN_VERBOSE_MODE
101 clock_t start, finish;
112 (
double)(finish - start) / CLOCKS_PER_SEC);
124 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
125 # ifdef IN_VERBOSE_MODE
126 dc_printf(
"Holes: %d Average Length: %f Max Length: %d \n",
128 (
float)totRingLengths / (
float)numRings,
134 int tnumRings = numRings;
136 #ifdef IN_VERBOSE_MODE
137 dc_printf(
"Holes after patching: %d \n", numRings);
139 numRings = tnumRings;
148 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
174 dc_printf(
"Time taken: %f seconds \n", (
double)(finish - start) / CLOCKS_PER_SEC);
189 #ifdef IN_VERBOSE_MODE
194 void Octree::initMemory()
212 void Octree::freeMemory()
214 for (
int i = 0; i < 9; i++) {
219 for (
int i = 0; i < 4; i++) {
225 void Octree::printMemUsage()
228 dc_printf(
"********* Internal nodes: \n");
229 for (
int i = 0; i < 9; i++) {
236 for (
int i = 0; i < 4; i++) {
243 dc_printf(
"Total allocated bytes on disk: %d \n", totalbytes);
244 dc_printf(
"Total leaf nodes: %d\n", totalLeafs);
251 void Octree::resetMinimalEdges()
256 void Octree::addAllTriangles()
263 int unitcount = 1000;
272 addTriangle(trian,
count);
279 if (
count % unitcount == 0) {
282 switch ((
count / unitcount) % 4) {
311 dc_printf(
" %f%% complete.", 100 * percent);
320 void Octree::addTriangle(
Triangle *trian,
int triind)
325 for (i = 0; i < 3; i++) {
326 for (j = 0; j < 3; j++)
333 for (i = 0; i < 3; i++) {
334 for (j = 0; j < 3; j++)
348 static void print_depth(
int height,
int maxDepth)
350 for (
int i = 0; i < maxDepth -
height; i++)
358 const int vertdiff[8][3] = {
359 {0, 0, 0}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}, {1, -1, -1}, {0, 0, 1}, {0, 1, -1}, {0, 0, 1}};
364 int tempdiff[3] = {0, 0, 0};
367 for (i = 0; i < 8; i++) {
368 tempdiff[0] += vertdiff[i][0];
369 tempdiff[1] += vertdiff[i][1];
370 tempdiff[2] += vertdiff[i][2];
373 if (boxmask & (1 << i)) {
374 subp->
shift(tempdiff);
375 tempdiff[0] = tempdiff[1] = tempdiff[2] = 0;
379 if (!
node->has_child(i)) {
387 if (
node->is_child_leaf(i))
394 if (
node->has_child(i))
408 int mask[3] = {0, 4, 8};
409 int oldc = 0, newc = 0;
411 float a[3],
b[3],
c[3];
413 for (i = 0; i < 3; i++) {
414 if (!getEdgeParity(
node,
mask[i])) {
426 offs[newc] = getEdgeOffsetNormal(
node, oldc,
a[newc],
b[newc],
c[newc]);
435 node = updateEdgeOffsetsNormals(
node, oldc, newc, offs,
a,
b,
c);
444 for (
int i = 0; i < 8; i++) {
445 if (
node->has_child(i)) {
446 if (
node->is_child_leaf(i))
447 createPrimalEdgesMask(&
node->get_child(
count)->leaf);
449 preparePrimalEdgesMask(&
node->get_child(
count)->internal);
470 if (chdpath !=
NULL) {
471 dc_printf(
"there are incomplete rings.\n");
489 for (i = 0; i < 8; i++) {
490 for (j = 0; j < 3; j++) {
498 trace(chd[i], nst[i],
len, depth - 1, chdpaths[i]);
506 int df[2] = {depth - 1, depth - 1};
511 for (i = 0; i < 12; i++) {
514 for (
int j = 0; j < 2; j++) {
515 lf[j] = chdleaf[
c[j]];
533 combinePaths(chdpaths[0], chdpaths[1], conn[8], rings);
534 combinePaths(chdpaths[2], chdpaths[3], conn[9], rings);
535 combinePaths(chdpaths[4], chdpaths[5], conn[10], rings);
536 combinePaths(chdpaths[6], chdpaths[7], conn[11], rings);
538 combinePaths(chdpaths[0], chdpaths[2], conn[4], rings);
539 combinePaths(chdpaths[4], chdpaths[6], conn[5], rings);
540 combinePaths(chdpaths[0],
NULL, conn[6], rings);
541 combinePaths(chdpaths[4],
NULL, conn[7], rings);
543 combinePaths(chdpaths[0], chdpaths[4], conn[0], rings);
544 combinePaths(chdpaths[0],
NULL, conn[1], rings);
545 combinePaths(chdpaths[0],
NULL, conn[2], rings);
546 combinePaths(chdpaths[0],
NULL, conn[3], rings);
558 totRingLengths += trings->
length;
559 if (trings->
length > maxRingLength) {
560 maxRingLength = trings->
length;
562 trings = trings->
next;
566 newnode = patch(newnode,
st, (
len << 1), rings);
574 void Octree::findPaths(
575 Node *
node[2],
int leaf[2],
int depth[2],
int *
st[2],
int maxdep,
int dir,
PathList *&paths)
581 if (!(leaf[0] && leaf[1])) {
590 for (j = 0; j < 2; j++) {
592 node[j]->internal.fill_children(chd[j], chdleaf[j]);
595 for (i = 0; i < 8; i++) {
596 for (
int k = 0; k < 3; k++) {
608 for (i = 0; i < 4; i++) {
610 for (
int j = 0; j < 2; j++) {
618 lf[j] = chdleaf[j][
c[j]];
619 nf[j] = chd[j][
c[j]];
620 df[j] = depth[j] - 1;
621 nstf[j] = nst[j][
c[j]];
624 findPaths(nf, lf, df, nstf, maxdep - 1,
faceProcFaceMask[dir][i][2], paths);
629 int ind = (depth[0] == maxdep ? 0 : 1);
630 int fcind = 2 * dir + (1 - ind);
636 ele1->
pos[0] =
st[0][0];
637 ele1->
pos[1] =
st[0][1];
638 ele1->
pos[2] =
st[0][2];
640 ele2->
pos[0] =
st[1][0];
641 ele2->
pos[1] =
st[1][1];
642 ele2->
pos[2] =
st[1][2];
670 tpaths = tpaths->
next;
677 if ((templist = combineSinglePath(list1, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
689 if ((templist = combineSinglePath(list2, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
701 if ((templist = combineSinglePath(nlist, pre, tlist, singlist,
NULL, singlist)) !=
NULL) {
710 if (isEqual(singlist->
head, singlist->
tail)) {
717 singlist->
next = rings;
721 singlist->
next = nlist;
758 if (isEqual(list1->
head, list2->
head) || isEqual(list1->
tail, list2->
tail)) {
794 if (isEqual(list1->
head, list2->
tail)) {
807 deletePath(head1, pre1, list1);
808 deletePath(head2, pre2, list2);
812 else if (isEqual(list1->
tail, list2->
head)) {
824 deletePath(head1, pre1, list1);
825 deletePath(head2, pre2, list2);
854 void Octree::printPath(
PathList *path)
862 while (n && (same == 0 || n != path->
head)) {
868 if (n == path->
head) {
883 while (n && (same == 0 || n != path)) {
897 void Octree::printPaths(
PathList *path)
901 while (iter !=
NULL) {
912 dc_printf(
"Call to PATCH with rings: \n");
935 dc_printf(
"Error! should have no list by now.\n");
941 newnode = patchSplit(newnode,
st,
len, rings, 0, xlists[0], xlists[1]);
945 newnode = patchSplit(newnode,
st,
len, xlists[0], 1, ylists[0], ylists[1]);
946 newnode = patchSplit(newnode,
st,
len, xlists[1], 1, ylists[2], ylists[3]);
950 newnode = patchSplit(newnode,
st,
len, ylists[0], 2, zlists[0], zlists[1]);
951 newnode = patchSplit(newnode,
st,
len, ylists[1], 2, zlists[2], zlists[3]);
952 newnode = patchSplit(newnode,
st,
len, ylists[2], 2, zlists[4], zlists[5]);
953 newnode = patchSplit(newnode,
st,
len, ylists[3], 2, zlists[6], zlists[7]);
958 for (
int i = 0; i < 8; i++) {
959 if (zlists[i] !=
NULL) {
975 Node *Octree::patchSplit(
Node *newnode,
984 dc_printf(
"Call to PATCHSPLIT with direction %d and rings: \n", dir);
991 while (rings !=
NULL) {
993 newnode = patchSplitSingle(newnode,
st,
len, rings->
head, dir, nrings1, nrings2);
1001 #ifdef IN_DEBUG_MODE
1002 dc_printf(
"Return from PATCHSPLIT with \n");
1004 printPaths(nrings1);
1006 printPaths(nrings2);
1012 Node *Octree::patchSplitSingle(
Node *newnode,
1020 #ifdef IN_DEBUG_MODE
1021 dc_printf(
"Call to PATCHSPLITSINGLE with direction %d and path: \n", dir);
1026 #ifdef IN_DEBUG_MODE
1027 dc_printf(
"Return from PATCHSPLITSINGLE with head==NULL.\n");
1038 int side = findPair(head,
st[dir] +
len / 2, dir, pre1, pre2);
1043 dc_printf(
"Location: %d %d %d Direction: %d Reso: %d\n",
1060 nring->
next = nrings1;
1064 nring->
next = nrings2;
1075 newnode = connectFace(newnode,
st,
len, dir, pre1, pre2);
1077 if (isEqual(pre1, pre1->
next)) {
1078 if (pre1 == pre1->
next) {
1088 if (isEqual(pre2, pre2->
next)) {
1089 if (pre2 == pre2->
next) {
1104 newnode = patchSplitSingle(newnode,
st,
len, pre1, dir, nrings1, nrings2);
1105 newnode = patchSplitSingle(newnode,
st,
len, pre2, dir, nrings1, nrings2);
1108 #ifdef IN_DEBUG_MODE
1109 dc_printf(
"Return from PATCHSPLITSINGLE with \n");
1111 printPaths(nrings1);
1113 printPaths(nrings2);
1119 Node *Octree::connectFace(
1122 #ifdef IN_DEBUG_MODE
1123 dc_printf(
"Call to CONNECTFACE with direction %d and length %d path: \n", dir,
len);
1134 int xdir = (dir + 1) % 3;
1135 int ydir = (dir + 2) % 3;
1139 float p1,
q1, p2, q2;
1141 getFacePoint(f2->
next, dir, x1,
y1, p1,
q1);
1142 getFacePoint(f2, dir,
x2, y2, p2, q2);
1144 float dx =
x2 + p2 - x1 - p1;
1145 float dy = y2 + q2 -
y1 -
q1;
1148 float rx = p1, ry =
q1;
1149 int incx = 1, incy = 1;
1150 int lx = x1, ly =
y1;
1151 int hx =
x2, hy = y2;
1166 float sx = dx * incx;
1167 float sy = dy * incy;
1182 if (curN ==
NULL || curP ==
NULL) {
1197 while (ori[xdir] !=
x2 || ori[ydir] != y2) {
1199 if (
sy * (1 - rx) >
sx * (1 - ry)) {
1201 next = ori[ydir] + incy;
1202 if (next < ly || next > hy) {
1204 next = ori[xdir] + incx;
1209 next = ori[xdir] + incx;
1210 if (next < lx || next > hx) {
1212 next = ori[ydir] + incy;
1219 rx += (
sy == 0 ? 0 : (1 - ry) *
sx /
sy);
1225 alpha =
x2 < x1 ? 1 - rx : rx;
1230 ry += (
sx == 0 ? 0 : (1 - rx) *
sy /
sx);
1236 alpha = y2 <
y1 ? 1 - ry : ry;
1241 float spt[3] = {(
float)nori[0], (
float)nori[1], (
float)nori[2]};
1242 spt[(dir + (3 - walkdir)) % 3] += alpha *
mindimen;
1244 spt[(dir + walkdir) % 3] +=
mindimen;
1248 dc_printf(
"new x,y: %d %d\n", ori[xdir] / edgelen, ori[ydir] / edgelen);
1249 dc_printf(
"nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2], alpha, walkdir);
1250 dc_printf(
"%f %f %f\n", spt[0], spt[1], spt[2]);
1254 newnode = locateCell(&newnode->
internal,
st,
len, nori, dir, 1, nodeN, stN, lenN);
1255 newnode = locateCell(&newnode->
internal,
st,
len, nori, dir, 0, nodeP, stP, lenP);
1262 if (curEleN->
pos[0] != stN[0] || curEleN->
pos[1] != stN[1] || curEleN->
pos[2] != stN[2]) {
1263 if (curEleN->
next->
pos[0] != stN[0] || curEleN->
next->
pos[1] != stN[1] ||
1264 curEleN->
next->
pos[2] != stN[2]) {
1267 newEleN->
pos[0] = stN[0];
1268 newEleN->
pos[1] = stN[1];
1269 newEleN->
pos[2] = stN[2];
1271 curEleN->
next = newEleN;
1274 newEleN = curEleN->
next;
1276 curN = patchAdjacent(&newnode->
internal,
1293 if (curEleP->
pos[0] != stP[0] || curEleP->
pos[1] != stP[1] || curEleP->
pos[2] != stP[2]) {
1294 if (f2->
pos[0] != stP[0] || f2->
pos[1] != stP[1] || f2->
pos[2] != stP[2]) {
1296 newEleP->
next = curEleP;
1297 newEleP->
pos[0] = stP[0];
1298 newEleP->
pos[1] = stP[1];
1299 newEleP->
pos[2] = stP[2];
1306 curP = patchAdjacent(&newnode->
internal,
1329 #ifdef IN_DEBUG_MODE
1330 dc_printf(
"Return from CONNECTFACE with \n");
1354 #ifdef IN_DEBUG_MODE
1359 "-----------------%d %d %d; %d %d %d\n", st1[0], st2[1], st1[2], st2[0], st2[1], st2[2]);
1363 int edgedir = (dir + (3 - walkdir)) % 3;
1364 int incdir = (dir + walkdir) % 3;
1365 int ind1 = (edgedir == 1 ? (dir + 3 - edgedir) % 3 - 1 : 2 - (dir + 3 - edgedir) % 3);
1366 int ind2 = (edgedir == 1 ? (incdir + 3 - edgedir) % 3 - 1 : 2 - (incdir + 3 - edgedir) % 3);
1368 int eind1 = ((edgedir << 2) | (side << ind1) | ((inc > 0 ? 1 : 0) << ind2));
1369 int eind2 = ((edgedir << 2) | (side << ind1) | ((inc > 0 ? 0 : 1) << ind2));
1371 #ifdef IN_DEBUG_MODE
1372 dc_printf(
"Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1, alpha, eind2, alpha);
1383 LeafNode *nleaf1 = flipEdge(leaf1, eind1, alpha);
1384 LeafNode *nleaf2 = flipEdge(leaf2, eind2, alpha);
1387 updateParent(
node,
len, st1, nleaf1);
1388 updateParent(
node,
len, st2, nleaf2);
1401 #ifdef IN_DEBUG_MODE
1419 #ifdef IN_DEBUG_MODE
1427 for (i = 0; i < 3; i++) {
1429 if (i == dir && side == 1) {
1430 ind |= (ori[i] <= (
st[i] +
len) ? 0 : 1);
1433 ind |= (ori[i] < (
st[i] +
len) ? 0 : 1);
1437 #ifdef IN_DEBUG_MODE
1440 "In LOCATECELL index of ori(%d %d %d) with dir %d side %d in st(%d %d %d, %d) is: %d\n",
1458 if (
node->has_child(ind)) {
1461 if (
node->is_child_leaf(ind)) {
1468 locateCell(&chd->
internal, rst,
len, ori, dir, side, rleaf, rst, rlen));
1476 rleaf = (
Node *)chd;
1482 node = addChild(
node, ind, locateCell(chd, rst,
len, ori, dir, side, rleaf, rst, rlen), 0);
1486 #ifdef IN_DEBUG_MODE
1496 if (ele !=
NULL && locateLeafCheck(ele->
pos) != ele->node) {
1497 dc_printf(
"Screwed! at pos: %d %d %d\n",
1510 while (n && (same == 0 || n != path)) {
1521 for (i = 0; i < 3; i++) {
1522 if (e1->
pos[i] != e2->
pos[i]) {
1523 if (e1->
pos[i] < e2->
pos[i]) {
1536 getFacePoint(
e, i,
x,
y, p, q);
1539 void Octree::getFacePoint(
PathElement *leaf,
int dir,
int &
x,
int &
y,
float &p,
float &q)
1542 float avg[3] = {0, 0, 0};
1544 int num = 0, num2 = 0;
1547 for (
int i = 0; i < 4; i++) {
1548 int edgeind =
faceMap[dir * 2][i];
1550 for (
int j = 0; j < 3; j++) {
1554 if (getEdgeIntersectionByIndex(nst, edgeind / 4, off, 1)) {
1560 if (getEdgeParity(leafnode, edgeind)) {
1565 dc_printf(
"Wrong! dir: %d pos: %d %d %d num: %d\n",
1572 avg[1] = (
float)leaf->
pos[1];
1586 int xdir = (dir + 1) % 3;
1587 int ydir = (dir + 2) % 3;
1589 float xf = avg[xdir];
1590 float yf = avg[ydir];
1592 #ifdef IN_DEBUG_MODE
1596 float *m = (leaf == leaf1 ? m1 : m2);
1597 if (xf < leaf->
pos[xdir] || yf < leaf->
pos[ydir] || xf > leaf->
pos[xdir] + leaf->len ||
1598 yf > leaf->
pos[ydir] + leaf->len) {
1599 dc_printf(
"Outside cube(%d %d %d), %d : %d %d %f %f\n",
1616 if (alpha < 0 || alpha > 1 || xf < leaf->
pos[xdir] || xf > leaf->
pos[xdir] + leaf->len ||
1617 yf < leaf->
pos[ydir] || yf > leaf->
pos[ydir] + leaf->len) {
1618 dc_printf(
"Alpha: %f Address: %d and %d\n", alpha, leaf1->node, leaf2->node);
1619 dc_printf(
"GETFACEPOINT result:(%d %d %d) %d min:(%f %f %f);(%d %d %d) %d min:(%f %f %f).\n",
1634 dc_printf(
"Face point at dir %d pos %d: %f %f\n", dir,
pos, xf, yf);
1646 #ifdef IN_DEBUG_MODE
1647 dc_printf(
"Face point at dir %d : %f %f\n", dir, xf, yf);
1653 int side = getSide(head,
pos, dir);
1662 while (cur != anchor && (getSide(cur,
pos, dir) == side)) {
1666 if (cur == anchor) {
1671 side = getSide(cur,
pos, dir);
1674 while (getSide(cur,
pos, dir) == side) {
1694 return (
e->pos[dir] <
pos ? -1 : 1);
1699 return (e1->
pos[0] == e2->
pos[0] && e1->
pos[1] == e2->
pos[1] && e1->
pos[2] == e2->
pos[2]);
1707 #ifdef IN_DEBUG_MODE
1708 dc_printf(
"Call to COMPRESSRING with path: \n");
1718 while (isEqual(cur, prepre)) {
1720 if (cur == prepre) {
1737 if (anchor ==
NULL) {
1744 }
while (prepre != anchor);
1748 #ifdef IN_DEBUG_MODE
1749 dc_printf(
"Return from COMPRESSRING with path: \n");
1754 void Octree::buildSigns()
1759 unsigned char table[1 << 12];
1760 for (
int i = 0; i <
size; i++) {
1763 for (
int i = 0; i < 256; i++) {
1765 for (
int j = 11; j >= 0; j--) {
1778 buildSigns(table,
root, 0, sg,
cube);
1781 void Octree::buildSigns(
unsigned char table[],
Node *
node,
int isLeaf,
int sg,
int rvalue[8])
1784 for (
int i = 0; i < 8; i++) {
1794 node->internal.fill_children(chd, leaf);
1799 buildSigns(table, chd[0], leaf[0], sg, oris);
1803 for (
int i = 1; i < 8; i++) {
1804 buildSigns(table, chd[i], leaf[i], oris[i],
cube);
1805 rvalue[i] =
cube[i];
1810 generateSigns(&
node->leaf, table, sg);
1812 for (
int i = 0; i < 8; i++) {
1813 rvalue[i] = getSign(&
node->leaf, i);
1818 void Octree::floodFill()
1821 int st[3] = {0, 0, 0};
1833 int st2[3] = {0, 0, 0};
1844 for (i = 0; i < 12; i++) {
1845 setOutProcess(&
node->leaf, i);
1851 for (i = 0; i < 8; i++) {
1852 if (
node->internal.has_child(i)) {
1869 for (i = 0; i < 12; i++) {
1870 par = getEdgeParity(leaf, i);
1871 inp = isInProcess(leaf, i);
1873 if (par == 1 && inp == 0) {
1885 setInProcessAll(mst, mdir);
1888 queue->pushQueue(mst, mdir);
1892 while (
queue->popQueue(nst, dir) == 1) {
1901 int stMask[3][3] = {{0, 0 -
len, 0 -
len}, {0 -
len, 0, 0 -
len}, {0 -
len, 0 -
len, 0}};
1903 for (j = 0; j < 3; j++) {
1905 cst[1][j] = nst[j] + stMask[dir][j];
1910 for (j = 0; j < 2; j++) {
1911 cs[j] = locateLeaf(cst[j]);
1915 int s = getSign(cs[0], 0);
1918 int fcCells[4] = {1, 0, 1, 0};
1919 int fcEdges[3][4][3] = {{{9, 2, 11}, {8, 1, 10}, {5, 1, 7}, {4, 2, 6}},
1920 {{10, 6, 11}, {8, 5, 9}, {1, 5, 3}, {0, 6, 2}},
1921 {{6, 10, 7}, {4, 9, 5}, {2, 9, 3}, {0, 10, 1}}};
1924 for (
int find = 0; find < 4; find++) {
1925 int cind = fcCells[find];
1929 for (eind = 0; eind < 3; eind++) {
1930 edge = fcEdges[dir][find][eind];
1931 if (getEdgeParity(cs[cind], edge) == 1) {
1938 for (eind = 2; eind >= 0; eind--) {
1939 edge = fcEdges[dir][find][eind];
1940 if (getEdgeParity(cs[cind], edge) == 1) {
1946 if (eind == 3 || eind == -1) {
1947 dc_printf(
"Wrong! this is not a consistent sign. %d\n", eind);
1954 int edir =
edge / 4;
1956 if (isInProcess(cs[cind], edge) == 0) {
1957 setInProcessAll(est, edir);
1958 queue->pushQueue(est, edir);
1960 dc_printf(
"Pushed: est: %d %d %d, edir: %d\n",
1972 dc_printf(
"Size of component: %d ", total);
1976 if (total > maxtotal) {
1995 flipParityAll(mst, mdir);
1998 queue->pushQueue(mst, mdir);
2001 while (
queue->popQueue(nst, dir) == 1) {
2010 int stMask[3][3] = {{0, 0 -
len, 0 -
len}, {0 -
len, 0, 0 -
len}, {0 -
len, 0 -
len, 0}};
2012 for (j = 0; j < 3; j++) {
2014 cst[1][j] = nst[j] + stMask[dir][j];
2019 for (j = 0; j < 2; j++)
2020 cs[j] = locateLeaf(cst[j]);
2023 int s = getSign(cs[0], 0);
2026 int fcCells[4] = {1, 0, 1, 0};
2027 int fcEdges[3][4][3] = {{{9, 2, 11}, {8, 1, 10}, {5, 1, 7}, {4, 2, 6}},
2028 {{10, 6, 11}, {8, 5, 9}, {1, 5, 3}, {0, 6, 2}},
2029 {{6, 10, 7}, {4, 9, 5}, {2, 9, 3}, {0, 10, 1}}};
2032 for (
int find = 0; find < 4; find++) {
2033 int cind = fcCells[find];
2037 for (eind = 0; eind < 3; eind++) {
2038 edge = fcEdges[dir][find][eind];
2039 if (isInProcess(cs[cind], edge) == 1) {
2046 for (eind = 2; eind >= 0; eind--) {
2047 edge = fcEdges[dir][find][eind];
2048 if (isInProcess(cs[cind], edge) == 1) {
2054 if (eind == 3 || eind == -1) {
2055 dc_printf(
"Wrong! this is not a consistent sign. %d\n", eind);
2062 int edir =
edge / 4;
2064 if (getEdgeParity(cs[cind], edge) == 1) {
2065 flipParityAll(est, edir);
2066 queue->pushQueue(est, edir);
2068 dc_printf(
"Pushed: est: %d %d %d, edir: %d\n",
2099 for (i = 0; i < 8; i++) {
2100 if (
node->internal.has_child(i)) {
2118 void Octree::writeOut()
2127 output_mesh = alloc_output(
numVertices, numQuads);
2129 int st[3] = {0, 0, 0};
2141 void Octree::countIntersection(
Node *
node,
int height,
int &nedge,
int &ncell,
int &nface)
2144 int total =
node->internal.get_num_children();
2145 for (
int i = 0; i < total; i++) {
2146 countIntersection(
node->internal.get_child(i),
height - 1, nedge, ncell, nface);
2150 nedge += getNumEdges2(&
node->leaf);
2152 int smask = getSignMask(&
node->leaf);
2159 if (smask > 0 && smask < 255) {
2164 for (
int i = 0; i < 3; i++) {
2165 if (getFaceEdgeNum(&
node->leaf, i * 2)) {
2175 Eigen::JacobiSVD<Eigen::Matrix3f> svd =
a.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV);
2178 Eigen::Vector3f((svd.singularValues().array().abs() > tolerance)
2179 .select(svd.singularValues().array().inverse(), 0))
2181 svd.matrixU().adjoint();
2190 Eigen::Matrix3f
A, pinv;
2191 A << halfA[0], halfA[1], halfA[2], halfA[1], halfA[3], halfA[4], halfA[2], halfA[4], halfA[5];
2198 for (
int i = 0; i < 3; i++)
2202 static void mass_point(
float mp[3],
const float pts[12][3],
const int parity[12])
2206 for (
int i = 0; i < 12; i++) {
2208 const float *p = pts[i];
2228 const float pts[12][3],
2229 const float norms[12][3],
2230 const int parity[12])
2232 float ata[6] = {0, 0, 0, 0, 0, 0};
2233 float atb[3] = {0, 0, 0};
2236 for (
int i = 0; i < 12; i++) {
2239 const float *
norm = norms[i];
2240 const float *p = pts[i];
2250 const float pn = p[0] *
norm[0] + p[1] *
norm[1] + p[2] *
norm[2];
2276 void Octree::computeMinimizer(
const LeafNode *leaf,
int st[3],
int len,
float rvalue[3])
const
2279 float pts[12][3], norms[12][3];
2281 fillEdgeIntersections(leaf,
st,
len, pts, norms, parity);
2291 rvalue[0] = rvalue[1] = rvalue[2] = 0;
2299 float mp[3] = {0, 0, 0};
2300 minimize(rvalue, mp, pts, norms, parity);
2306 if (rvalue[0] <
st[0] - nh1 || rvalue[1] <
st[1] - nh1 || rvalue[2] <
st[2] - nh1 ||
2308 rvalue[0] >
st[0] + nh2 || rvalue[1] >
st[1] + nh2 || rvalue[2] >
st[2] + nh2) {
2331 computeMinimizer(&
node->leaf,
st,
len, rvalue);
2335 for (j = 0; j < 3; j++) {
2340 int mult = 0, smask = getSignMask(&
node->leaf);
2346 if (smask > 0 && smask < 255) {
2351 for (j = 0; j <
mult; j++) {
2352 add_vert(output_mesh, rvalue);
2364 for (i = 0; i < 8; i++) {
2365 if (
node->internal.has_child(i)) {
2378 void Octree::processEdgeWrite(
Node *
node[4],
int [4],
int ,
int dir)
2396 int seq[4] = {0, 1, 3, 2};
2397 for (
int k = 0; k < 4; k++) {
2402 if (vind[1] != -1) {
2406 ind[num - 1] = vind[0];
2407 ind[num - 2] = vind[1];
2430 add_quad(output_mesh, ind);
2441 void Octree::edgeProcContour(
Node *
node[4],
int leaf[4],
int depth[4],
int maxdep,
int dir)
2446 if (leaf[0] && leaf[1] && leaf[2] && leaf[3]) {
2447 processEdgeWrite(
node, depth, maxdep, dir);
2452 for (j = 0; j < 4; j++) {
2453 for (i = 0; i < 8; i++) {
2454 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2455 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2464 for (i = 0; i < 2; i++) {
2470 for (
int j = 0; j < 4; j++) {
2477 le[j] =
node[j]->internal.is_child_leaf(
c[j]);
2478 ne[j] = chd[j][
c[j]];
2479 de[j] = depth[j] - 1;
2488 void Octree::faceProcContour(
Node *
node[2],
int leaf[2],
int depth[2],
int maxdep,
int dir)
2494 if (!(leaf[0] && leaf[1])) {
2498 for (j = 0; j < 2; j++) {
2499 for (i = 0; i < 8; i++) {
2500 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2501 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2510 for (i = 0; i < 4; i++) {
2512 for (
int j = 0; j < 2; j++) {
2519 lf[j] =
node[j]->internal.is_child_leaf(
c[j]);
2520 nf[j] = chd[j][
c[j]];
2521 df[j] = depth[j] - 1;
2528 int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
2533 for (i = 0; i < 4; i++) {
2540 for (
int j = 0; j < 4; j++) {
2541 if (leaf[
order[j]]) {
2542 le[j] = leaf[
order[j]];
2544 de[j] = depth[
order[j]];
2547 le[j] =
node[
order[j]]->internal.is_child_leaf(
c[j]);
2548 ne[j] = chd[
order[j]][
c[j]];
2549 de[j] = depth[
order[j]] - 1;
2558 void Octree::cellProcContour(
Node *
node,
int leaf,
int depth)
2569 for (i = 0; i < 8; i++) {
2570 chd[i] = ((!leaf) &&
node->internal.has_child(i)) ?
2571 node->internal.get_child(
node->internal.get_child_count(i)) :
2576 for (i = 0; i < 8; i++) {
2577 cellProcContour(chd[i],
node->internal.is_child_leaf(i), depth - 1);
2583 int df[2] = {depth - 1, depth - 1};
2584 for (i = 0; i < 12; i++) {
2587 lf[0] =
node->internal.is_child_leaf(
c[0]);
2588 lf[1] =
node->internal.is_child_leaf(
c[1]);
2599 int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
2600 for (i = 0; i < 6; i++) {
2606 for (
int j = 0; j < 4; j++) {
2607 le[j] =
node->internal.is_child_leaf(
c[j]);
2616 void Octree::processEdgeParity(
LeafNode *
node[4],
int [4],
int ,
int dir)
2619 for (
int i = 0; i < 4; i++) {
2631 for (
int i = 0; i < 4; i++) {
2637 void Octree::edgeProcParity(
Node *
node[4],
int leaf[4],
int depth[4],
int maxdep,
int dir)
2642 if (leaf[0] && leaf[1] && leaf[2] && leaf[3]) {
2643 processEdgeParity((
LeafNode **)
node, depth, maxdep, dir);
2648 for (j = 0; j < 4; j++) {
2649 for (i = 0; i < 8; i++) {
2650 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2651 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2660 for (i = 0; i < 2; i++) {
2667 for (
int j = 0; j < 4; j++) {
2675 le[j] =
node[j]->internal.is_child_leaf(
c[j]);
2676 ne[j] = chd[j][
c[j]];
2677 de[j] = depth[j] - 1;
2686 void Octree::faceProcParity(
Node *
node[2],
int leaf[2],
int depth[2],
int maxdep,
int dir)
2692 if (!(leaf[0] && leaf[1])) {
2696 for (j = 0; j < 2; j++) {
2697 for (i = 0; i < 8; i++) {
2698 chd[j][i] = ((!leaf[j]) &&
node[j]->
internal.has_child(i)) ?
2699 node[j]->
internal.get_child(
node[j]->
internal.get_child_count(i)) :
2708 for (i = 0; i < 4; i++) {
2710 for (
int j = 0; j < 2; j++) {
2717 lf[j] =
node[j]->internal.is_child_leaf(
c[j]);
2718 nf[j] = chd[j][
c[j]];
2719 df[j] = depth[j] - 1;
2726 int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
2731 for (i = 0; i < 4; i++) {
2738 for (
int j = 0; j < 4; j++) {
2739 if (leaf[
order[j]]) {
2740 le[j] = leaf[
order[j]];
2742 de[j] = depth[
order[j]];
2745 le[j] =
node[
order[j]]->internal.is_child_leaf(
c[j]);
2746 ne[j] = chd[
order[j]][
c[j]];
2747 de[j] = depth[
order[j]] - 1;
2756 void Octree::cellProcParity(
Node *
node,
int leaf,
int depth)
2767 for (i = 0; i < 8; i++) {
2768 chd[i] = ((!leaf) &&
node->internal.has_child(i)) ?
2769 node->internal.get_child(
node->internal.get_child_count(i)) :
2774 for (i = 0; i < 8; i++) {
2775 cellProcParity(chd[i],
node->internal.is_child_leaf(i), depth - 1);
2781 int df[2] = {depth - 1, depth - 1};
2782 for (i = 0; i < 12; i++) {
2785 lf[0] =
node->internal.is_child_leaf(
c[0]);
2786 lf[1] =
node->internal.is_child_leaf(
c[1]);
2797 int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
2798 for (i = 0; i < 6; i++) {
2804 for (
int j = 0; j < 4; j++) {
2805 le[j] =
node->internal.is_child_leaf(
c[j]);
2850 const int faceProcFaceMask[3][4][3] = {{{4, 0, 0}, {5, 1, 0}, {6, 2, 0}, {7, 3, 0}},
2851 {{2, 0, 1}, {6, 4, 1}, {3, 1, 1}, {7, 5, 1}},
2852 {{1, 0, 2}, {3, 2, 2}, {5, 4, 2}, {7, 6, 2}}};
2855 {{1, 4, 0, 5, 1, 1}, {1, 6, 2, 7, 3, 1}, {0, 4, 6, 0, 2, 2}, {0, 5, 7, 1, 3, 2}},
2856 {{0, 2, 3, 0, 1, 0}, {0, 6, 7, 4, 5, 0}, {1, 2, 0, 6, 4, 2}, {1, 3, 1, 7, 5, 2}},
2857 {{1, 1, 0, 3, 2, 0}, {1, 5, 4, 7, 6, 0}, {0, 1, 5, 0, 4, 1}, {0, 3, 7, 2, 6, 1}}};
2860 {{3, 2, 1, 0, 0}, {7, 6, 5, 4, 0}},
2861 {{5, 1, 4, 0, 1}, {7, 3, 6, 2, 1}},
2862 {{6, 4, 2, 0, 2}, {7, 5, 3, 1, 2}},
2871 const int dirCell[3][4][3] = {{{0, -1, -1}, {0, -1, 0}, {0, 0, -1}, {0, 0, 0}},
2872 {{-1, 0, -1}, {-1, 0, 0}, {0, 0, -1}, {0, 0, 0}},
2873 {{-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 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 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 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
SyclQueue void void size_t num_bytes void
void(* DualConAddQuad)(void *output, const int vert_indices[4])
void(* DualConAddVert)(void *output, const float co[3])
void *(* DualConAllocOutput)(int totvert, int totquad)
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_gpu_kernel_postfix ccl_global float int int sy
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_gpu_kernel_postfix ccl_global float int sx
const ManifoldIndices manifold_table[256]
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
T midpoint(const T &a, const T &b)
SymEdge< T > * prev(const SymEdge< T > *se)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
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.
SymEdge< Arith_t > * next