Back

RecordedCamera

sofa::component::visual::RecordedCamera
BaseCamera
Doc (from source)

A camera that is moving along a predetermined path.

Abstract (AI generated)

The `RecordedCamera` enables predefined camera movements for visualization purposes in SOFA simulations, allowing users to control zoom speed, pan speed, pivot type, start/end times, and rotation/translation paths.

Metadata
module
Sofa.Component.Visual
namespace
sofa::component::visual
include
sofa/component/visual/RecordedCamera.h
inherits
  • BaseCamera
description

The RecordedCamera is a specialized camera class in the SOFA framework designed for predefined motion along specified paths, which can be useful for visualization purposes such as recording videos or creating demonstrations. It does not directly contribute to any physical simulation components like mass matrix $ M $, stiffness matrix $ K $, internal force vector $ f_{ ext{int}} $, or residual vector $ R $. Instead, its role is focused on the visual representation of a SOFA scene over time. Here is an overview of its functionalities and numerical methods used for camera movement control:

Governing Equations and Operators

  • Rotation Mode: The camera performs rotations around a specified center point with predefined axes.
  • Translation Mode: The camera moves linearly between multiple intermediate positions.
  • Navigation Mode: The camera follows a recorded path defined by a series of positions and orientations over time.

Constitutive or Kinematic Laws Involved

The RecordedCamera does not involve constitutive laws or material properties. Instead, it relies on kinematic movements controlled through the following parameters:
- Zoom Speed (d_zoomSpeed)
- Pan Speed (d_panSpeed)
- Rotation Center (d_rotationCenter)
- Rotation Start Point (d_rotationStartPoint)
- Translation Positions (d_translationPositions)
- Translation Orientations (d_translationOrientations)

Role in the Global FEM Pipeline

The RecordedCamera plays a role outside of the core physical simulation pipeline, focusing on visualization and user interaction. It does not influence the assembly phase or numerical solution methods directly related to FEM:
- Initialization: Sets up initial positions and orientations based on predefined paths.
- Time Integration: Moves the camera position and orientation over time intervals defined by d_startTime and d_endTime.

Numerical Methods or Discretization Choices

The component uses basic linear interpolation for translations between points and quaternion-based rotation to manage smooth transitions. The key steps are:
- Linear Interpolation: For translation mode, the camera position is interpolated linearly between predefined positions over time.

$$ \mathbf{d_{position}} = \mathbf{p}_i + (\mathbf{p}_{i+1} - \mathbf{p}_i) \times \text{ratio} $$
  • Quaternion Interpolation: For rotation mode, the camera's orientation is interpolated using quaternions to ensure smooth rotation.
$$ q = (q_0 + \Delta t \cdot \omega)^t \cdot q_0 $$

How It Fits into the Broader Variational / Lagrangian Mechanics Framework

The RecordedCamera does not contribute directly to variational mechanics or Lagrangian formulations. Its primary role is in visualization, providing a way to control and record camera movements over time without influencing the physical simulation state.

Overall, the RecordedCamera component enhances the visual aspect of SOFA simulations by allowing predefined and controlled camera movements.

Data Fields
NameTypeDefaultHelp
d_zoomSpeed double Zoom Speed
d_panSpeed double Pan Speed
d_pivot int Pivot (0 => Scene center, 1 => World Center
d_startTime SReal Time when the camera moves will start
d_endTime SReal Time when the camera moves will end (or loop)
d_rotationMode bool If true, rotation will be performed
d_translationMode bool If true, translation will be performed
d_navigationMode bool If true, navigation will be performed
d_rotationSpeed SReal rotation Speed
d_rotationCenter type::Vec3 Rotation center coordinates
d_rotationStartPoint type::Vec3 Rotation start position coordinates
d_rotationLookAt type::Vec3 Position to be focused during rotation
d_rotationAxis type::Vec3 Rotation axis
d_cameraUp type::Vec3 Camera Up axis
d_drawRotation bool If true, will draw the rotation path
d_drawTranslation bool If true, will draw the translation path
Methods
void init () virtual
void reinit () virtual
void reset () virtual
void handleEvent (sofa::core::objectmodel::Event * ) virtual
void draw (const core::visual::VisualParams * vparams) virtual
{
  "name": "RecordedCamera",
  "namespace": "sofa::component::visual",
  "module": "Sofa.Component.Visual",
  "include": "sofa/component/visual/RecordedCamera.h",
  "doc": "A camera that is moving along a predetermined path.",
  "inherits": [
    "BaseCamera"
  ],
  "templates": [],
  "data_fields": [
    {
      "name": "d_zoomSpeed",
      "type": "double",
      "xmlname": "zoomSpeed",
      "help": "Zoom Speed"
    },
    {
      "name": "d_panSpeed",
      "type": "double",
      "xmlname": "panSpeed",
      "help": "Pan Speed"
    },
    {
      "name": "d_pivot",
      "type": "int",
      "xmlname": "pivot",
      "help": "Pivot (0 => Scene center, 1 => World Center"
    },
    {
      "name": "d_startTime",
      "type": "SReal",
      "xmlname": "startTime",
      "help": "Time when the camera moves will start"
    },
    {
      "name": "d_endTime",
      "type": "SReal",
      "xmlname": "endTime",
      "help": "Time when the camera moves will end (or loop)"
    },
    {
      "name": "d_rotationMode",
      "type": "bool",
      "xmlname": "rotationMode",
      "help": "If true, rotation will be performed"
    },
    {
      "name": "d_translationMode",
      "type": "bool",
      "xmlname": "translationMode",
      "help": "If true, translation will be performed"
    },
    {
      "name": "d_navigationMode",
      "type": "bool",
      "xmlname": "navigationMode",
      "help": "If true, navigation will be performed"
    },
    {
      "name": "d_rotationSpeed",
      "type": "SReal",
      "xmlname": "rotationSpeed",
      "help": "rotation Speed"
    },
    {
      "name": "d_rotationCenter",
      "type": "type::Vec3",
      "xmlname": "rotationCenter",
      "help": "Rotation center coordinates"
    },
    {
      "name": "d_rotationStartPoint",
      "type": "type::Vec3",
      "xmlname": "rotationStartPoint",
      "help": "Rotation start position coordinates"
    },
    {
      "name": "d_rotationLookAt",
      "type": "type::Vec3",
      "xmlname": "rotationLookAt",
      "help": "Position to be focused during rotation"
    },
    {
      "name": "d_rotationAxis",
      "type": "type::Vec3",
      "xmlname": "rotationAxis",
      "help": "Rotation axis"
    },
    {
      "name": "d_cameraUp",
      "type": "type::Vec3",
      "xmlname": "cameraUp",
      "help": "Camera Up axis"
    },
    {
      "name": "d_drawRotation",
      "type": "bool",
      "xmlname": "drawRotation",
      "help": "If true, will draw the rotation path"
    },
    {
      "name": "d_drawTranslation",
      "type": "bool",
      "xmlname": "drawTranslation",
      "help": "If true, will draw the translation path"
    }
  ],
  "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": "reset",
      "return_type": "void",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "handleEvent",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "sofa::core::objectmodel::Event *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "draw",
      "return_type": "void",
      "params": [
        {
          "name": "vparams",
          "type": "const core::visual::VisualParams *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `RecordedCamera` is a specialized camera class in SOFA that can move along a predetermined path for visualization purposes. It inherits from the base `BaseCamera` class and provides functionalities to control its movement through rotation, translation, or navigation modes over time.\n\n**Role and Purpose: **\nThe primary purpose of `RecordedCamera` is to enable predefined camera movements within SOFA simulations, which are useful for recording videos or creating demonstrations. It can perform rotations around a specified center, translations between multiple positions, and navigation along recorded paths. The camera movement is controlled based on time intervals defined by the user.\n\n**Interactions with Other Components: **\nThe `RecordedCamera` interacts with other components through its inherited methods from `BaseCamera`, such as initialization (`init()`), reinitialization (`reinit()`), and event handling (`handleEvent(Event*)`). It also interfaces with visual parameters for drawing the camera's path when requested.\n\n**Practical Usage: **\nThe component allows users to set various data fields, including zoom speed, pan speed, pivot type (scene center or world center), start time, end time, and other properties related to rotation and translation. Users can define intermediate positions and orientations for navigation and enable the drawing of these paths.\n\n**Data Fields: **\nThe component exposes several configurable data fields:\n- `zoomSpeed` and `panSpeed`: Controls the speed of zooming and panning actions.\n- `pivot`: Specifies whether to pivot around the scene center or world center.\n- `startTime` and `endTime`: Define the time interval for camera movement.\n- `rotationMode`, `translationMode`, and `navigationMode`: Boolean flags to enable specific types of movements.\n- `d_rotationCenter`, `d_rotationStartPoint`, etc.: Coordinates for defining rotation paths.\n- `d_translationPositions` and `d_translationOrientations`: Vectors containing positions and orientations for translation paths.\n\n**Summary: **\nThe `RecordedCamera` provides a flexible way to simulate predefined camera movements in SOFA, enhancing the visualization capabilities of simulations by allowing users to control and record detailed views over time.",
  "maths": "The `RecordedCamera` is a specialized camera class in the SOFA framework designed for predefined motion along specified paths, which can be useful for visualization purposes such as recording videos or creating demonstrations. It does not directly contribute to any physical simulation components like mass matrix \\( M \\), stiffness matrix \\( K \\), internal force vector \\( f_{\text{int}} \\), or residual vector \\( R \\). Instead, its role is focused on the visual representation of a SOFA scene over time. Here is an overview of its functionalities and numerical methods used for camera movement control:\n\n### Governing Equations and Operators\n- **Rotation Mode:** The camera performs rotations around a specified center point with predefined axes.\n- **Translation Mode:** The camera moves linearly between multiple intermediate positions.\n- **Navigation Mode:** The camera follows a recorded path defined by a series of positions and orientations over time.\n\n### Constitutive or Kinematic Laws Involved\nThe `RecordedCamera` does not involve constitutive laws or material properties. Instead, it relies on kinematic movements controlled through the following parameters:\n- **Zoom Speed** (`d_zoomSpeed`)\n- **Pan Speed** (`d_panSpeed`)\n- **Rotation Center** (`d_rotationCenter`)\n- **Rotation Start Point** (`d_rotationStartPoint`)\n- **Translation Positions** (`d_translationPositions`)\n- **Translation Orientations** (`d_translationOrientations`)\n\n### Role in the Global FEM Pipeline\nThe `RecordedCamera` plays a role outside of the core physical simulation pipeline, focusing on visualization and user interaction. It does not influence the assembly phase or numerical solution methods directly related to FEM:\n- **Initialization:** Sets up initial positions and orientations based on predefined paths.\n- **Time Integration:** Moves the camera position and orientation over time intervals defined by `d_startTime` and `d_endTime`.\n\n### Numerical Methods or Discretization Choices\nThe component uses basic linear interpolation for translations between points and quaternion-based rotation to manage smooth transitions. The key steps are:\n- **Linear Interpolation:** For translation mode, the camera position is interpolated linearly between predefined positions over time.\n  \n  \\[ \\mathbf{d_{position}} = \\mathbf{p}_i + (\\mathbf{p}_{i+1} - \\mathbf{p}_i) \\times \\text{ratio} \\]\n\n- **Quaternion Interpolation:** For rotation mode, the camera's orientation is interpolated using quaternions to ensure smooth rotation.\n  \n  \\[ q = (q_0 + \\Delta t \\cdot \\omega)^t \\cdot q_0 \\]\n\n### How It Fits into the Broader Variational / Lagrangian Mechanics Framework\nThe `RecordedCamera` does not contribute directly to variational mechanics or Lagrangian formulations. Its primary role is in visualization, providing a way to control and record camera movements over time without influencing the physical simulation state.\n\nOverall, the `RecordedCamera` component enhances the visual aspect of SOFA simulations by allowing predefined and controlled camera movements.",
  "abstract": "The `RecordedCamera` enables predefined camera movements for visualization purposes in SOFA simulations, allowing users to control zoom speed, pan speed, pivot type, start/end times, and rotation/translation paths.",
  "sheet": "# RecordedCamera\n\n## Overview\nThe `RecordedCamera` is a specialized camera class that moves along predetermined paths for visualization purposes. It inherits from the base `BaseCamera` class and provides functionalities to control its movement through rotation, translation, or navigation modes over time.\n\n## Parameters and Data\nThe component exposes several configurable data fields:\n- **zoomSpeed**: Controls the speed of zooming actions (`double`, default not specified).\n- **panSpeed**: Controls the speed of panning actions (`double`, default not specified).\n- **pivot**: Specifies whether to pivot around the scene center or world center (`int`, 0 for scene center, 1 for world center).\n- **startTime**: Defines when the camera movement starts (`SReal`, default not specified).\n- **endTime**: Defines when the camera movement ends (or loops) (`SReal`, default not specified).\n- **rotationMode**: Boolean flag to enable rotation movements (`bool`, default not specified).\n- **translationMode**: Boolean flag to enable translation movements (`bool`, default not specified).\n- **navigationMode**: Boolean flag to enable navigation movements (`bool`, default not specified).\n- **rotationSpeed**: Rotation speed (`SReal`, default not specified).\n- **rotationCenter**: Coordinates for the rotation center (`type::Vec3`, default not specified).\n- **rotationStartPoint**: Coordinates for the rotation start position (`type::Vec3`, default not specified).\n- **rotationLookAt**: Position to be focused during rotation (`type::Vec3`, default not specified).\n- **rotationAxis**: Rotation axis (`type::Vec3`, default not specified).\n- **cameraUp**: Camera Up axis (`type::Vec3`, default not specified).\n- **drawRotation**: Boolean flag to draw the rotation path (`bool`, default not specified).\n- **drawTranslation**: Boolean flag to draw the translation path (`bool`, default not specified).\n\n## Dependencies and Connections\nThe `RecordedCamera` interacts with other components through its inherited methods from `BaseCamera`, such as initialization (`init()`), reinitialization (`reinit()`), and event handling (`handleEvent(Event*)`). It also interfaces with visual parameters for drawing the camera's path when requested.\n\n## Practical Notes\nUsers can define intermediate positions and orientations for navigation and enable the drawing of these paths. The component is useful for recording videos or creating demonstrations, but it does not influence physical simulation components."
}