Back

AverageCoord

The `AverageCoord` component is part of the SOFA framework and belongs to the `sofa::component::engine::analyze` namespace. It computes the average of a set of coordinates, which can be useful for various analysis tasks in simulations. **Role and Purpose:** - The primary role of `AverageCoord` is to calculate the average coordinate values from a specified set of indices within a given vector type (e.g., Vec2, Vec3, Rigid). **Interactions with Other Components:** - It inherits from `DataEngine`, indicating that it processes data and provides outputs for other components in the simulation pipeline. - The component requires a mechanical state to function properly. It interacts with this state through methods like `doUpdate()` and `onBeginAnimationStep()`. **Practical Usage Guidance:** - Users can specify the indices of the coordinates to average using the `d_indices` data field. - The index of the vector to be averaged is specified by `d_vecId`, with a default value corresponding to position vectors. - The resulting average coordinate is output through the `d_average` data field. If no specific indices are provided, it will compute the average across all coordinates in the given vector.

abstract
The `AverageCoord` component computes the average of coordinates from specified indices within a given vector type.
sheet
# AverageCoord ## Overview The `AverageCoord` component, part of the SOFA framework, calculates the average coordinate values from specified indices. It inherits from `DataEngine`, indicating that it processes data and provides outputs for other components in the simulation pipeline. ## Parameters and Data - **d_indices**: Indices of the coordinates to be averaged (`VecIndex`). - **d_vecId**: Index of the vector (default value corresponds to position vectors) (`unsigned int`). - **d_average**: The resulting average coordinate (`Coord`), defaulting to the average coord of the mechanical context.
description
The `AverageCoord` component is part of the SOFA framework and belongs to the `sofa::component::engine::analyze` namespace. It computes the average of a set of coordinates, which can be useful for various analysis tasks in simulations. **Role and Purpose:** - The primary role of `AverageCoord` is to calculate the average coordinate values from a specified set of indices within a given vector type (e.g., Vec2, Vec3, Rigid). **Interactions with Other Components:** - It inherits from `DataEngine`, indicating that it processes data and provides outputs for other components in the simulation pipeline. - The component requires a mechanical state to function properly. It interacts with this state through methods like `doUpdate()` and `onBeginAnimationStep()`. **Practical Usage Guidance:** - Users can specify the indices of the coordinates to average using the `d_indices` data field. - The index of the vector to be averaged is specified by `d_vecId`, with a default value corresponding to position vectors. - The resulting average coordinate is output through the `d_average` data field. If no specific indices are provided, it will compute the average across all coordinates in the given vector.
code_snippets
  • {'file_path': 'sofa/component/engine/analyze/AverageCoord.h', 'start_line': 45, 'end_line': 68}
  • {'file_path': 'sofa/component/engine/analyze/AverageCoord.inl', 'start_line': 39, 'end_line': 71}
{
  "name": "AverageCoord",
  "main": {
    "name": "AverageCoord",
    "namespace": "sofa::component::engine::analyze",
    "module": "Sofa.Component.Engine.Analyze",
    "include": "sofa/component/engine/analyze/AverageCoord.h",
    "doc": "Compute the average of coordinates.\n\nThis class computes the average of a set of Coordinates",
    "inherits": [
      "DataEngine",
      "SingleStateAccessor"
    ],
    "templates": [
      "sofa::defaulttype::Rigid2Types",
      "sofa::defaulttype::Rigid3Types",
      "sofa::defaulttype::Vec2Types"
    ],
    "data_fields": [
      {
        "name": "d_indices",
        "type": "VecIndex",
        "xmlname": "indices",
        "help": "indices of the coordinates to average"
      },
      {
        "name": "d_vecId",
        "type": "unsigned int",
        "xmlname": "vecId",
        "help": "index of the vector (default value corresponds to core::vec_id::write_access::position )"
      },
      {
        "name": "d_average",
        "type": "Coord",
        "xmlname": "average",
        "help": "(default value corresponds to the average coord of the mechanical context)"
      }
    ],
    "links": [],
    "methods": [
      {
        "name": "init",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "reinit",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "doUpdate",
        "return_type": "void",
        "params": [],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "handleEvent",
        "return_type": "void",
        "params": [
          {
            "name": "event",
            "type": "core::objectmodel::Event *"
          }
        ],
        "is_virtual": true,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      },
      {
        "name": "onBeginAnimationStep",
        "return_type": "void",
        "params": [
          {
            "name": "",
            "type": "const double"
          }
        ],
        "is_virtual": false,
        "is_pure_virtual": false,
        "is_static": false,
        "access": "public"
      }
    ]
  },
  "desc": {
    "description": "The `AverageCoord` component is part of the SOFA framework and belongs to the `sofa::component::engine::analyze` namespace. It computes the average of a set of coordinates, which can be useful for various analysis tasks in simulations.\n\n**Role and Purpose:**\n- The primary role of `AverageCoord` is to calculate the average coordinate values from a specified set of indices within a given vector type (e.g., Vec2, Vec3, Rigid).\n\n**Interactions with Other Components:**\n- It inherits from `DataEngine`, indicating that it processes data and provides outputs for other components in the simulation pipeline.\n- The component requires a mechanical state to function properly. It interacts with this state through methods like `doUpdate()` and `onBeginAnimationStep()`.\n\n**Practical Usage Guidance:**\n- Users can specify the indices of the coordinates to average using the `d_indices` data field.\n- The index of the vector to be averaged is specified by `d_vecId`, with a default value corresponding to position vectors.\n- The resulting average coordinate is output through the `d_average` data field. If no specific indices are provided, it will compute the average across all coordinates in the given vector."
  },
  "maths": {
    "code_snippets": [
      {
        "file_path": "sofa/component/engine/analyze/AverageCoord.h",
        "start_line": 45,
        "end_line": 68
      },
      {
        "file_path": "sofa/component/engine/analyze/AverageCoord.inl",
        "start_line": 39,
        "end_line": 71
      }
    ]
  },
  "summary": {
    "abstract": "The `AverageCoord` component computes the average of coordinates from specified indices within a given vector type.",
    "sheet": "\n# AverageCoord\n\n## Overview\nThe `AverageCoord` component, part of the SOFA framework, calculates the average coordinate values from specified indices. It inherits from `DataEngine`, indicating that it processes data and provides outputs for other components in the simulation pipeline.\n\n## Parameters and Data\n- **d_indices**: Indices of the coordinates to be averaged (`VecIndex`).\n- **d_vecId**: Index of the vector (default value corresponds to position vectors) (`unsigned int`).\n- **d_average**: The resulting average coordinate (`Coord`), defaulting to the average coord of the mechanical context.\n"
  }
}