Class DrawSceneGraph


  • public class DrawSceneGraph
    extends Object
    This program converts a Scene data structure into a DOT description of the scene. The DOT description is written to a file and that file is processed by the dot.exe program to produce a png file graphical image of the scene data structure.

    A scene.png image file is created from a scene.dot file with the following command-line.

    
       > dot.exe -Tpng -O scene.dot
       

    See
    https://www.graphviz.org/Documentation.php

    This class has four static boolean variables that can be used to control the complexity of the scene graph drawing.

    • Method Detail

      • draw

        public static void draw​(Scene scene,
                                String fileName)
        This method converts a Scene data structure into a dot language description. The dot code for the scene is written into a dot file. Then the dot.exe program is called to convert the dot file into a png image of the scene data structure.
        Parameters:
        scene - Scene that needs to be converted to a dot description
        fileName - base name for the dot and png files
      • scene2dot

        public static String scene2dot​(Scene scene)
        This method generates a dot language description of the DAG rooted at a Scene node.

        This method generates the dot code for the forest of top-level positions just below the scene node. Each position node just below the scene node is the root of a DAG. This method calls the position2dot() method to traverse the DAG of each top-level position.

        Parameters:
        scene - Scene that needs to be converted to a dot description
        Returns:
        a String containing the dot language description of the scene
      • position2dot

        public static String position2dot​(Position position,
                                          String positionName)
        This method generates a dot language description of the DAG rooted at a Position node.

        positionName is the id that has been assigned to the dot node representing the given Position node.

        Every Position node has attached to it a translation Vector and a Model.

        Parameters:
        position - Position that needs to be converted to a dot description
        positionName - the String name that has been assigned to position
        Returns:
        a String containing the dot language description of position
      • model2dot

        public static String model2dot​(Model model,
                                       String nodeName)
        This method generates a dot language description of the tree rooted at a Model node.

        nodeName is the id that has been assigned to the dot node representing the given Model node.

        Every Model node has attached to it a List of vertices, a List of colors, and a List of primitives.

        Parameters:
        model - Model that needs to be converted to a dot description
        nodeName - the String name that has been assigned to model
        Returns:
        a String containing the dot language description of the model