Browse Source

blobtree

master
gjj 6 months ago
parent
commit
c490eea4bf
  1. 20
      algoim/organizer/blobtree.hpp
  2. 5
      algoim/organizer/organizer.hpp

20
algoim/organizer/blobtree.hpp

@ -25,8 +25,9 @@ bool isLeft(Blob b) { return b.isLeft == 1; }
class BlobTree
{
public:
std::vector<Blob> structure;
std::vector<unsigned int> primtiveNodeIdx;
std::vector<Blob> structure;
std::vector<unsigned int> primitiveNodeIdx; // 由primitive数组下标指向node中对应leaf的下标
BlobTree() {}
};
@ -83,14 +84,17 @@ void propagate(BlobTree& tree, unsigned int nodeIdx, bool in)
return;
}
// 这里传入的是拷贝,因为要修改,但不同traversal的修改不相互影响
// 这里传入的BlobTree是拷贝,因为要修改且不同traversal的修改不相互影响
// TODO: 最好优化掉拷贝
// TODO: std::vector<bool> 可以改成bitset之类
bool traverse(BlobTree tree, std::vector<int> possiblePrimtivies, const std::vector<bool>& primitiveInout)
// TODO: std::vector<bool> 可以改成bitset之TT
/**
* relatedPrimitives traversal需要care的primitives的索引OcTree子问题中管理的Primitive
*/
bool traverse(BlobTree tree, const std::vector<int>& relatedPrimitives, const std::vector<bool>& primitiveInout)
{
assert(possiblePrimtivies.size() == tree.primtiveNodeIdx.size());
for (int nodeIdx : tree.primtiveNodeIdx) {
propagate(tree, nodeIdx, primitiveInout[]);
assert(relatedPrimitives.size() == primitiveInout.size());
for (int primitiveIdx : relatedPrimitives) {
propagate(tree, tree.primitiveNodeIdx[primitiveIdx], primitiveInout[primitiveIdx]);
if (tree.structure.back().inOut != 0) { return tree.structure.back().inOut == 1; }
}
std::cerr << "should not be here" << std::endl;

5
algoim/organizer/organizer.hpp

@ -265,8 +265,9 @@ std::array<int, 2> sides = {-1, 1};
// 对于mark含2个及以上0的情况,尝试对每个0填1或-1的所有组合
// TODO: 参数太多了,考虑换用std::function + lambda
void visitSubcellOnBothSidesOfDir(const uvector3& nodeMid,
const int polyIntersectIndex,
const tensor3& poly,
,
const int polyIntersectIndex,
const tensor3& poly,
std::array<Node, CHILD_NUM>& subNodes,
int startIdxToCheck,

Loading…
Cancel
Save