Back

ExportVisualModelOBJVisitor

sofa::simulation::ExportVisualModelOBJVisitor
Visitor
Abstract (AI generated)

The `ExportVisualModelOBJVisitor` exports visual models in OBJ format by traversing the scene graph and processing each node's visual model.

Metadata
module
Sofa.framework.Simulation.Core
namespace
sofa::simulation
include
sofa/simulation/ExportVisualModelOBJVisitor.h
inherits
  • Visitor
description

The ExportVisualModelOBJVisitor is a SOFA component designed to export visual models in OBJ format, which is commonly used for storing 3D geometry data. This visitor class inherits from the Visitor interface and operates on nodes within the simulation graph. It processes each node's visual model by calling the processVisualModel method, which exports the model to an output stream provided during initialization. The component can handle multiple streams, one for OBJ data and another for MTL (material) data if needed.

The ExportVisualModelOBJVisitor interacts with other components through its virtual methods: processNodeTopDown, processNodeBottomUp, and processVisualModel. These methods enable the visitor to traverse the scene graph and process each visual model in a top-down manner. The traversal logic is implemented within these methods, ensuring that all relevant models are processed and exported appropriately.

For practical usage, users need to initialize this visitor with output streams for OBJ data and optionally for MTL data. They should then apply this visitor to the root node of their simulation graph to export all visual models in OBJ format. The component manages internal indices (vindex, nindex, tindex) and counters to handle multiple objects and materials correctly during the export process.

From a mathematical perspective, this component does not directly involve any physical or numerical calculations. Instead, it focuses on transforming visual data into a standardized 3D format (OBJ) for external use. The primary operations are related to file I/O and string manipulation rather than numerical computations or physical modeling.

Methods
void processVisualModel (Node * node, core::visual::VisualModel * vm) virtual
Result processNodeTopDown (Node * node) virtual
void processNodeBottomUp (Node * node) virtual
{
  "name": "ExportVisualModelOBJVisitor",
  "namespace": "sofa::simulation",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/ExportVisualModelOBJVisitor.h",
  "doc": "",
  "inherits": [
    "Visitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "processVisualModel",
      "return_type": "void",
      "params": [
        {
          "name": "node",
          "type": "Node *"
        },
        {
          "name": "vm",
          "type": "core::visual::VisualModel *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "processNodeTopDown",
      "return_type": "Result",
      "params": [
        {
          "name": "node",
          "type": "Node *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "processNodeBottomUp",
      "return_type": "void",
      "params": [
        {
          "name": "node",
          "type": "Node *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `ExportVisualModelOBJVisitor` is a SOFA component designed to export visual models in OBJ format, which is commonly used for storing 3D geometry data. This visitor class inherits from the `Visitor` interface and operates on nodes within the simulation graph. It processes each node's visual model by calling the `processVisualModel` method, which exports the model to an output stream provided during initialization. The component can handle multiple streams, one for OBJ data and another for MTL (material) data if needed.\n\nThe `ExportVisualModelOBJVisitor` interacts with other components through its virtual methods: `processNodeTopDown`, `processNodeBottomUp`, and `processVisualModel`. These methods enable the visitor to traverse the scene graph and process each visual model in a top-down manner. The traversal logic is implemented within these methods, ensuring that all relevant models are processed and exported appropriately.\n\nFor practical usage, users need to initialize this visitor with output streams for OBJ data and optionally for MTL data. They should then apply this visitor to the root node of their simulation graph to export all visual models in OBJ format. The component manages internal indices (`vindex`, `nindex`, `tindex`) and counters to handle multiple objects and materials correctly during the export process.",
  "maths": "The `ExportVisualModelOBJVisitor` is a SOFA component designed to export visual models in OBJ format, which is commonly used for storing 3D geometry data. This visitor class inherits from the `Visitor` interface and operates on nodes within the simulation graph. It processes each node's visual model by calling the `processVisualModel` method, which exports the model to an output stream provided during initialization. The component can handle multiple streams, one for OBJ data and another for MTL (material) data if needed.\n\nThe `ExportVisualModelOBJVisitor` interacts with other components through its virtual methods: `processNodeTopDown`, `processNodeBottomUp`, and `processVisualModel`. These methods enable the visitor to traverse the scene graph and process each visual model in a top-down manner. The traversal logic is implemented within these methods, ensuring that all relevant models are processed and exported appropriately.\n\nFor practical usage, users need to initialize this visitor with output streams for OBJ data and optionally for MTL data. They should then apply this visitor to the root node of their simulation graph to export all visual models in OBJ format. The component manages internal indices (`vindex`, `nindex`, `tindex`) and counters to handle multiple objects and materials correctly during the export process.\n\nFrom a mathematical perspective, this component does not directly involve any physical or numerical calculations. Instead, it focuses on transforming visual data into a standardized 3D format (OBJ) for external use. The primary operations are related to file I/O and string manipulation rather than numerical computations or physical modeling.",
  "abstract": "The `ExportVisualModelOBJVisitor` exports visual models in OBJ format by traversing the scene graph and processing each node's visual model.",
  "sheet": "# ExportVisualModelOBJVisitor\n\n## Overview\nThe `ExportVisualModelOBJVisitor` is a visitor component that exports visual models to OBJ format. It processes nodes within the simulation graph, calling methods such as `processNodeTopDown`, `processNodeBottomUp`, and `processVisualModel` to traverse and export each node's visual model.\n\n## Practical Notes\nUsers must initialize this visitor with output streams for OBJ data and optionally MTL (material) data. The component manages internal indices (`vindex`, `nindex`, `tindex`) and counters to handle multiple objects and materials correctly during the export process."
}