PgmoMeshLayerInterface::PgmoMeshLayerInterface(const MeshLayer& mesh) : mesh_(mesh) {
block_indices_ = mesh.allocatedBlockIndices();
}
const BlockIndices& PgmoMeshLayerInterface::blockIndices() const {
return block_indices_;
}
void PgmoMeshLayerInterface::markBlockActive(const BlockIndex& block) const {
active_mesh_ = mesh_.getBlockPtr(block);
}
active_mesh_
에 해당 블록 데이터를 저장합니다. 이후 다른 메소드에서 활성화된 블록을 기반으로 데이터를 가져옵니다.size_t PgmoMeshLayerInterface::activeBlockSize() const {
return active_mesh_->points.size();
}
pcl::PointXYZRGBA PgmoMeshLayerInterface::getActiveVertex(size_t index) const {
const auto& pos = active_mesh_->points[index];
const auto& color = active_mesh_->colors[index];
...
}
std::optional<uint32_t> PgmoMeshLayerInterface::getActiveSemantics(size_t index) const {
if (index < active_mesh_->labels.size()) {
return active_mesh_->labels[index];
}
return std::nullopt;
}
std::nullopt
을 반환합니다.bool PgmoMeshLayerInterface::hasSemantics() const {
return mesh_.begin()->has_labels;
}
kimera_pgmo::MeshInterface::Ptr PgmoMeshLayerInterface::clone() const {
return std::make_shared<PgmoMeshLayerInterface>(*this);
}
단일 메쉬와 상호작용하는 인터페이스로, 위의 PgmoMeshLayerInterface와 유사한 역할을 합니다. 다만, 블록 단위의 메쉬 레이어가 아닌 단일 메쉬 객체를 다루는 데 사용
PgmoMeshInterface::PgmoMeshInterface(const Mesh& mesh) : mesh_(mesh) {
block_indices_ = {BlockIndex(0, 0, 0)};
}
const BlockIndices& PgmoMeshInterface::blockIndices() const { return block_indices_; }
size_t PgmoMeshInterface::activeBlockSize() const {
return mesh_.numVertices();
}
pcl::PointXYZRGBA PgmoMeshInterface::getActiveVertex(size_t index) const {
const auto& pos = mesh_.pos(index);
const auto& color = mesh_.color(index);
...
}
std::optional<uint32_t> PgmoMeshInterface::getActiveSemantics(size_t index) const {
if (index < mesh_.labels.size()) {
return mesh_.label(index);
}
return std::nullopt;
}
std::nullopt
을 반환합니다.bool PgmoMeshInterface::hasSemantics() const { return mesh_.has_labels; }
kimera_pgmo::MeshInterface::Ptr PgmoMeshInterface::clone() const {
return std::make_shared<PgmoMeshInterface>(*this);
}