TsdfBlock은 TSDF 데이터를 저장하고, 블록 단위로 업데이트 상태를 추적하는 중요한 구조체구조체 정의:
struct TsdfBlock : public spatial_hash::VoxelBlock<TsdfVoxel> {
TsdfBlock은 spatial_hash::VoxelBlock<TsdfVoxel>을 상속받습니다. TsdfVoxel은 각 voxel에 대한 정보를 저장하는 데이터 구조로, 거리 정보(TSDF 값)와 해당 voxel이 얼마나 중요한지를 나타내는 가중치 정보(weight)를 가지고 있습니다.생성자 (TsdfBlock::TsdfBlock):
TsdfBlock(const float voxel_size, const float voxels_per_side, const BlockIndex& index)
: spatial_hash::VoxelBlock<TsdfVoxel>(voxel_size, voxels_per_side, index) {}
voxel_size, voxels_per_side, BlockIndex를 인자로 받아 TsdfBlock 객체를 초기화합니다.voxel_size는 각 voxel의 크기를 나타내며, voxels_per_side는 블록 당 voxel의 개수를 나타냅니다. BlockIndex는 해당 블록의 3D 공간에서의 위치를 나타내는 인덱스입니다.VoxelBlock의 생성자를 호출하여 기본적인 블록을 초기화하고, TSDF voxel 데이터를 저장할 준비를 합니다.상태 플래그 (업데이트 상태 관리):
mutable bool esdf_updated = false;
mutable bool mesh_updated = false;
mutable bool tracking_updated = false;
esdf_updated, mesh_updated, tracking_updated는 각 블록의 업데이트 상태를 추적하는 플래그입니다.esdf_updated: ESDF(Euclidean Signed Distance Function) 업데이트 상태.mesh_updated: 해당 블록에서 메쉬가 생성 또는 업데이트되었는지 여부.tracking_updated: 트래킹과 관련된 정보가 업데이트되었는지 여부.업데이트 상태 설정 (setUpdated):
void setUpdated() const {
updated = true;
esdf_updated = true;
mesh_updated = true;
tracking_updated = true;
}
setUpdated() 메서드는 이 블록이 업데이트되었음을 표시합니다.정적 메서드 (esdfUpdated, meshUpdated, trackingUpdated):
static bool esdfUpdated(const TsdfBlock& block) { return block.esdf_updated; }
static bool meshUpdated(const TsdfBlock& block) { return block.mesh_updated; }
static bool trackingUpdated(const TsdfBlock& block) { return block.tracking_updated; }
esdfUpdated()는 해당 블록이 ESDF 작업에서 업데이트되었는지를 나타냅니다.