|
|
@ -113,15 +113,20 @@ bool keepQuadraturePoint(const std::vector<tensor3>& tensors, const OcTreeNode& |
|
|
|
// 只需要考虑intersect polys,不用考虑fully contained polys
|
|
|
|
const auto& polyIntersectIndices = ocTreeNode.polyIntersectIndices; |
|
|
|
assert(tensors.size() == polyIntersectIndices.size()); |
|
|
|
if (polyIntersectIndices.size() == 0) { |
|
|
|
assert(ocTreeNode.blobTree.structure.back().inOut != NODE_IN_OUT_UNKNOWN); |
|
|
|
return ocTreeNode.blobTree.structure.back().inOut; |
|
|
|
} |
|
|
|
std::vector<bool> primitiveInOuts(polyIntersectIndices.size()); |
|
|
|
// if (polyIntersectIndices.size() == 0) {
|
|
|
|
// assert(ocTreeNode.blobTree.structure.back().inOut != NODE_IN_OUT_UNKNOWN);
|
|
|
|
// return ocTreeNode.blobTree.structure.back().inOut == organizer::NODE_IN;
|
|
|
|
// }
|
|
|
|
std::vector<char> primitiveInOuts(polyIntersectIndices.size()); |
|
|
|
for (int i = 0; i < ocTreeNode.polyIntersectIndices.size(); ++i) { |
|
|
|
// primitiveInOuts[i] = isInsidePowers(scene.polys[polyIntersectIndices[i]].rawPower, originPt);
|
|
|
|
primitiveInOuts[i] = isInsideBernstein(tensors[i], point); |
|
|
|
} |
|
|
|
if (primitiveInOuts.size() == 3 && primitiveInOuts[0] == NODE_IN && primitiveInOuts[1] == NODE_IN |
|
|
|
&& primitiveInOuts[2] == NODE_IN) { |
|
|
|
int aaa = 1; |
|
|
|
int bbb = 1; |
|
|
|
} |
|
|
|
// 这里blobTree是拷贝传参
|
|
|
|
auto blobTree = ocTreeNode.blobTree; |
|
|
|
int res = organizer::traverse(blobTree, ocTreeNode.polyIntersectIndices, primitiveInOuts); |
|
|
@ -615,15 +620,15 @@ void quadratureScene(const std::vector<std::shared_ptr<PrimitiveDesc>>& primitiv |
|
|
|
for (int i = 0; i < minimalReps.size(); ++i) { rootNode.polyIntersectIndices.emplace_back(i); } |
|
|
|
int cnt = 1; |
|
|
|
buildOcTreeV0(scene, rootNode, leaves, 1, cnt); |
|
|
|
|
|
|
|
basicTask(scene, leaves[14], q); |
|
|
|
std::cout << "octree built over" << std::endl; |
|
|
|
// basicTask(scene, leaves[14], q);
|
|
|
|
|
|
|
|
int i = 0; |
|
|
|
for (const auto& leaf : leaves) { |
|
|
|
auto basicRes = basicTask(scene, leaf, q); |
|
|
|
if (std::isinf(basicRes.volume)) { std::cout << "inf volume when solving leaf: " << i << std::endl; } |
|
|
|
volume += basicRes.volume; |
|
|
|
std::cout << "Solved leaves: " << ++i << "/" << leaves.size() << std::endl; |
|
|
|
std::cout << "Solved leaves: " << ++i << "/" << leaves.size() << ", volume: " << volume << std::endl; |
|
|
|
} |
|
|
|
|
|
|
|
volume *= prod(xmax - xmin); |
|
|
|