struct mrpt::opengl::COctreePointRenderer::TNode

The structure for each octree spatial node.

Each node can either be a leaf of has 8 children nodes. Instead of pointers, children are referenced by their indices in m_octree_nodes

struct TNode
{
    //
fields

    bool is_leaf {true};
    mrpt::math::TPoint3Df bb_min;
    mrpt::math::TPoint3Df bb_max;
    std::vector<size_t> pts;
    bool all {false};
    mrpt::math::TPoint3Df center;
    size_t child_id[8];

    // construction

    TNode();

    //
methods

    void update_bb(const mrpt::math::TPoint3Df& p);
    float getCornerX(int i) const;
    float getCornerY(int i) const;
    float getCornerZ(int i) const;

    void setBBFromOrderInParent(
        const TNode& parent,
        int my_child_index
        );
};

Fields

bool is_leaf {true}

true: it’s a leaf and pts has valid indices; false: children is valid.

std::vector<size_t> pts

Point indices in the derived class that fall into this node.

bool all {false}

true: All elements in the reference object; false: only those in pts

mrpt::math::TPoint3Df center

[is_leaf=false] The center of the node, whose coordinates are used to decide between the 8 children nodes.

size_t child_id[8]

[is_leaf=false] The indices in m_octree_nodes of the 8 children.

Methods

void update_bb(const mrpt::math::TPoint3Df& p)

update bounding box with a new point: