fig 1 : A typical scene graph example.
The scene graph is used to organize the objects of a scene into a hierarchy. Thus the coordinates of the object A are transformed by the transformation T, whereas the coordinates of the object C remain unchanged.
fig 2 : A typical example of conception. The class D inherits the class C.
Besides the set of types is partitioned into components. In this example, the type D belongs to the com3 component.
processor = walker + visitor
Traversal and visit are separated into distinct objects.
walkOn. walkOn indicates whether the children have to be explored or not.
fig 3 : An example illustrating the order of calls during a DFS traversal.
Recall that the set of nodes is partitioned into components. Each component is related with a component visitor (different from a visitor!). The union of the different component visitors creates the visitor (using a proxy design pattern) which groups the visiting functions associated with the nodes of the component.
fig 4: the visitor holds the component visitors of the com1 and com3 component.
For example, we want to count the number of C in a scene graph. We only have to define the com2Visitor, visitor of the com2 component with an
enter function defined for C that increases the number of nodes.
enter of the visitor is called by the walker, the visitor calls the appropriate function of its component visitors. .
The schema shows which functions are actually applied when only some of them are defined.
fig 5 : The enter functions are defined for the nodes A, C and D. The type E inherits the enter function for the type C, whereas D redefines its enter function.
The rule is simple: For a given processor, each node inherits the functions of the node from which it derives.