Transformation
The `Transformation` class manages geometric transformations (translation, rotation, scaling) for visual objects within SOFA simulations. It provides methods to apply these transformations and invert transformation matrices.
- module
- Sofa.framework.Helper
- namespace
- sofa::helper::visual
- include
- sofa/helper/visual/Transformation.h
- description
The Transformation class in the SOFA framework is designed to handle geometric transformations for visual objects within simulations. The primary role of this class is to provide methods for applying and inverting transformations, which include translation, rotation, and scaling operations. These transformations are crucial for maintaining correct visual representations during simulations.
Mathematical Description:
Transformation Operators
- Translation: \wzxhzdk:10
where wzxhzdk:11 are the translation components along the x, y, and z axes. - Rotation: \wzxhzdk:12, a rotation matrix that represents rotations around the coordinate axes. The rotation matrix is defined as a 4x4 matrix in homogeneous coordinates:
- Scaling: \$$ S = (s_x, s_y, s_z) \$$, where $ s_x, s_y, s_z $ are the scaling factors along the x, y, and z axes.
Transformation Application
The Transformation class provides methods to apply these transformations. The operator multiplication (operator*) applies a combination of translation, rotation, and scaling on a vector wzxhzdk:2 as follows:
1. Scaling: \wzxhzdk:3
2. Rotation: \wzxhzdk:4, where the rotation matrix is applied to the scaled vector.
3. Translation: \wzxhzdk:5
The combined transformation can be represented as:
wzxhzdk:1
Inversion of Transformation Matrix
The InvertTransRotMatrix method inverts the transformation matrix for rotations and translations. Given a 4x4 matrix wzxhzdk:6, it performs:
1. Transpose of the rotation submatrix.
2. Negation of the translation row vector.
This inversion is essential for applying inverse transformations when necessary, such as undoing a previously applied transformation or ensuring consistency in visual representations.
Role in the FEM Pipeline
The Transformation class primarily operates at the geometric and visualization level rather than directly affecting the mechanics simulation. It does not contribute to the governing equations of motion (e.g., mass matrix wzxhzdk:7, stiffness matrix wzxhzdk:8, internal forces wzxhzdk:9) or the nonlinear solve steps. Instead, it ensures that visual objects are correctly positioned and oriented within the simulation environment.
Numerical Methods and Discretization Choices
The class does not involve explicit numerical methods for solving differential equations or discretizing physical fields. It focuses on geometric transformations and their application to vectors in a 3D space.
Fit into Variational / Lagrangian Mechanics Framework
While the Transformation class is not directly involved in variational mechanics or Lagrangian formulations, it supports the broader simulation framework by ensuring that visual objects are accurately transformed according to specified parameters. This indirect support helps maintain consistency and accuracy in the visual representation of deformable bodies and other mechanical systems within SOFA simulations.
Methods
Transformation &
operator=
(const Transformation & transform)
void
Apply
()
virtual
void
ApplyWithCentring
()
virtual
void
ApplyInverse
()
virtual
Vector
operator*
(Vector v)
void
InvertTransRotMatrix
(SReal[4][4] matrix)
void
InvertTransRotMatrix
(SReal[4][4] sMatrix, SReal[4][4] dMatrix)
{
"name": "Transformation",
"namespace": "sofa::helper::visual",
"module": "Sofa.framework.Helper",
"include": "sofa/helper/visual/Transformation.h",
"doc": "",
"inherits": [],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "operator=",
"return_type": "Transformation &",
"params": [
{
"name": "transform",
"type": "const Transformation &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "Apply",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "ApplyWithCentring",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "ApplyInverse",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "operator*",
"return_type": "Vector",
"params": [
{
"name": "v",
"type": "Vector"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "InvertTransRotMatrix",
"return_type": "void",
"params": [
{
"name": "matrix",
"type": "SReal[4][4]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "InvertTransRotMatrix",
"return_type": "void",
"params": [
{
"name": "sMatrix",
"type": "SReal[4][4]"
},
{
"name": "dMatrix",
"type": "SReal[4][4]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
],
"description": "The `Transformation` class in the SOFA framework is part of the `sofa::helper::visual` namespace and is defined in `Sofa.framework.Helper`. It manages transformations (translation, rotation, scaling) for visual objects within SOFA simulations. The class provides methods to apply these transformations directly (`Apply`, `ApplyWithCentring`, `ApplyInverse`) and invert transformation matrices (`InvertTransRotMatrix`). Its primary role is to handle the geometric transformations required for rendering or displaying 3D objects in a visually consistent manner.\n\nThe `Transformation` component interacts with other SOFA components by providing transformation capabilities, which are crucial for maintaining correct visual representations during simulations. It can be used to manipulate and render objects accurately within the simulation environment.\n\nUsage involves creating instances of `Transformation`, setting their translation, rotation, and scale parameters as needed, and applying these transformations through its methods. The class does not have explicit data fields but manages internal state for translations, scales, rotations, and object centers.",
"maths": "The `Transformation` class in the SOFA framework is designed to handle geometric transformations for visual objects within simulations. The primary role of this class is to provide methods for applying and inverting transformations, which include translation, rotation, and scaling operations. These transformations are crucial for maintaining correct visual representations during simulations.\n\n### Mathematical Description:\n\n#### Transformation Operators\n- **Translation**: \\\\[ \\mathbf{t} = (t_x, t_y, t_z) \\\\]\n where \\( t_x, t_y, t_z \\) are the translation components along the x, y, and z axes.\n- **Rotation**: \\\\[ R \\\\], a rotation matrix that represents rotations around the coordinate axes. The rotation matrix is defined as a 4x4 matrix in homogeneous coordinates:\n\\[ R = \\begin{pmatrix}\nR_{11} & R_{12} & R_{13} & 0 \\\\\nR_{21} & R_{22} & R_{23} & 0 \\\\\nR_{31} & R_{32} & R_{33} & 0 \\\\\n0 & 0 & 0 & 1\n\\end{pmatrix} \\]\n- **Scaling**: \\\\[ S = (s_x, s_y, s_z) \\\\], where \\( s_x, s_y, s_z \\) are the scaling factors along the x, y, and z axes.\n\n#### Transformation Application\nThe `Transformation` class provides methods to apply these transformations. The operator multiplication (`operator*`) applies a combination of translation, rotation, and scaling on a vector \\( \\\\[ \\mathbf{v} = (v_x, v_y, v_z) \\\\] \\\\) as follows:\n1. **Scaling**: \\\\[ \\mathbf{v}_s = s_x v_x, s_y v_y, s_z v_z \\\\]\n2. **Rotation**: \\\\[ \\mathbf{r} = R \\mathbf{v}_s \\\\], where the rotation matrix is applied to the scaled vector.\n3. **Translation**: \\\\[ \\mathbf{v}_{final} = \\mathbf{r} + \\mathbf{t} \\\\]\n\nThe combined transformation can be represented as:\n\\[ \\mathbf{v}_{final} = R (s_x v_x, s_y v_y, s_z v_z) + (t_x, t_y, t_z) \\]\n\n#### Inversion of Transformation Matrix\nThe `InvertTransRotMatrix` method inverts the transformation matrix for rotations and translations. Given a 4x4 matrix \\( M \\\\), it performs:\n1. Transpose of the rotation submatrix.\n2. Negation of the translation row vector.\n\nThis inversion is essential for applying inverse transformations when necessary, such as undoing a previously applied transformation or ensuring consistency in visual representations.\n\n### Role in the FEM Pipeline\nThe `Transformation` class primarily operates at the geometric and visualization level rather than directly affecting the mechanics simulation. It does not contribute to the governing equations of motion (e.g., mass matrix \\( M \\\\), stiffness matrix \\( K \\\\), internal forces \\( f_{int} \\\\)) or the nonlinear solve steps. Instead, it ensures that visual objects are correctly positioned and oriented within the simulation environment.\n\n### Numerical Methods and Discretization Choices\nThe class does not involve explicit numerical methods for solving differential equations or discretizing physical fields. It focuses on geometric transformations and their application to vectors in a 3D space.\n\n### Fit into Variational / Lagrangian Mechanics Framework\nWhile the `Transformation` class is not directly involved in variational mechanics or Lagrangian formulations, it supports the broader simulation framework by ensuring that visual objects are accurately transformed according to specified parameters. This indirect support helps maintain consistency and accuracy in the visual representation of deformable bodies and other mechanical systems within SOFA simulations.",
"abstract": "The `Transformation` class manages geometric transformations (translation, rotation, scaling) for visual objects within SOFA simulations. It provides methods to apply these transformations and invert transformation matrices.",
"sheet": "# Transformation\n\n## Overview\nThe `Transformation` class in the SOFA framework handles geometric transformations (translation, rotation, scaling) of visual objects within the simulation environment. It ensures that visual objects are correctly positioned and oriented according to specified parameters.\n\n## Mathematical Model\n### Transformation Operators\n- **Translation**: \\[ \\\\mathbf{t} = (t_x, t_y, t_z) \\]\n where \\( t_x, t_y, t_z \\) are the translation components along the x, y, and z axes.\n- **Rotation**: \\[ R \\], a rotation matrix that represents rotations around the coordinate axes. The rotation matrix is defined as a 4x4 matrix in homogeneous coordinates:\n\\[\nR = \\\\begin{pmatrix}\nR_{11} & R_{12} & R_{13} & 0 \\\\\nR_{21} & R_{22} & R_{23} & 0 \\\\\nR_{31} & R_{32} & R_{33} & 0 \\\\\n0 & 0 & 0 & 1\n\\\\end{pmatrix}\n\\]\n- **Scaling**: \\[ S = (s_x, s_y, s_z) \\], where \\( s_x, s_y, s_z \\) are the scaling factors along the x, y, and z axes.\n\n### Transformation Application\nThe `Transformation` class provides methods to apply these transformations. The operator multiplication (`operator*`) applies a combination of translation, rotation, and scaling on a vector \\[ \\\\mathbf{v} = (v_x, v_y, v_z) \\] as follows:\n1. **Scaling**: \\[ \\\\mathbf{v}_s = s_x v_x, s_y v_y, s_z v_z \\]\n2. **Rotation**: \\[ \\\\mathbf{r} = R \\\\mathbf{v}_s \\], where the rotation matrix is applied to the scaled vector.\n3. **Translation**: \\[ \\\\mathbf{v}_{final} = \\\\mathbf{r} + \\\\mathbf{t} \\]\nThe combined transformation can be represented as:\n\\[\n\\\\mathbf{v}_{final} = R (s_x v_x, s_y v_y, s_z v_z) + (t_x, t_y, t_z)\n\\]\n\n### Inversion of Transformation Matrix\nThe `InvertTransRotMatrix` method inverts the transformation matrix for rotations and translations. Given a 4x4 matrix \\( M \\), it performs:\n1. Transpose of the rotation submatrix.\n2. Negation of the translation row vector.\nThis inversion is essential for applying inverse transformations when necessary, such as undoing a previously applied transformation or ensuring consistency in visual representations."
}