Core Scene Graph Data Structures in C++


Group

The Group class is implemented as a subclass of the Node class. Any Group node is allowed to be a child of any other Group node, as long as the directed graph defined by the parent-child relationships does not have cycles. The Transform class and the SceneGraph class are implemented as subclasses of the Group class.

This is how the Group node is defined in the VRML'97 Standard.

Group {
  MFNode children               []
  SFVec3f bboxCenter            0 0 0
  SFVec3f bboxSize              1 1 1
}

This is the public interface to the Group class as defined in the DGP2023 implementation.

class Group : public Node {
  public:
                        Group();
    virtual            ~Group();
    vector<pNode>&      getChildren();
    Node*               getChild(const string& name) const;
    int                 getNumberOfChildren() const;
    pNode               operator[](const int i);
    void                addChild(pNode child);
    void                removeChild(pNode child);
    Vec3f&              getBBoxCenter();
    Vec3f&              getBBoxSize();
    float               getBBoxDiameter();
    void                setBBoxCenter(Vec3f& value);
    void                setBBoxSize(Vec3f& value);
    void                clearBBox();
    bool                hasEmptyBBox() const;
    void                appendBBoxCoord(vector<float>& coord);
    void                updateBBox(vector<float>& coord);
    virtual void        updateBBox();
    virtual bool        isGroup() const;
    virtual string      getType() const;
};