stt/src/stt_return_leaf.cc
2024-09-10 16:01:52 +08:00

24 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "stt_class.h"
void SttGenerator::ReturnLeaf(QuadTreeNode** p_tree){
QuadTreeNode* current_node = *p_tree;
if (current_node->children[0]==nullptr && current_node->children[1]==nullptr &&
current_node->children[2]==nullptr && current_node->children[3]==nullptr &&
current_node->out_ok==true){
// bug fix 这里将输出的节点的邻居重置为nullptr 否则在输出局部stt的邻居列表时将产生一个bug 即边缘位置的三角形会默认与0号三角形相邻
// 这是因为在之前的闭合三角面过程中我们已全部对邻居列表赋值,所以所有节点三角形的邻居列表全不为空,因此一定会输出三个邻居,但对局部
// stt而言因为在输出环节的邻居排序中并不能找到对应的三角形索引所以会输出一个默认值即0。
current_node->neighbor[0] = nullptr;
current_node->neighbor[1] = nullptr;
current_node->neighbor[2] = nullptr;
array_out_tri_pointer_.push_back(current_node);
return;
}
else{
for (int i = 0; i < 4; i++){
if (current_node->children[i]!=nullptr)
ReturnLeaf(&(current_node->children[i]));
}
return;
}
}