SphereLoader
Loader for sphere model description files.
The `SphereLoader` loads sphere model descriptions from files and applies scale, rotation, and translation transformations to the loaded spheres.
- module
- Sofa.Component.IO.Mesh
- namespace
- sofa::component::io::mesh
- include
- sofa/component/io/mesh/SphereLoader.h
- inherits
-
- BaseLoader
- description
The SphereLoader component in the SOFA framework is designed to load model descriptions for spherical objects from files. It handles reading positions and radii of spheres specified in files, and supports applying transformations such as scaling, rotation, and translation to these loaded spheres. This component does not contribute directly to any governing equations or operators typically associated with FEM simulations (such as the mass matrix $M$, stiffness matrix $K$, internal force $oldsymbol{f}_{ ext{int}}$, residual $R$, etc.). Instead, its primary role is in the initial stage of setting up the simulation environment by loading and transforming sphere geometries.
Governing Equations or Operators
The SphereLoader does not implement any governing equations or operators directly related to FEM. Its function is more focused on data input and manipulation for setting up simulations involving spherical objects.
Constitutive or Kinematic Laws Involved
Since the component is primarily a loader, it does not involve constitutive laws (such as strain measures, stress tensors, hyperelastic potentials) or kinematic laws (like displacement fields). It simply loads position and radius data from files and applies geometric transformations to these spheres.
Role in the Global FEM Pipeline
In the context of the global FEM pipeline, SphereLoader plays a role in the initial setup phase. Specifically:
- Modeling Phase: It contributes to defining the geometry (positions and radii) of spherical objects that will be part of the simulation.
- Discretization Phase: Although it does not perform spatial discretization itself, it provides the necessary geometric data for further processing by other components that might perform mesh generation or element definition.
Numerical Methods or Discretization Choices
The SphereLoader employs basic numerical methods to apply transformations (scaling, rotation, translation) to the loaded sphere positions. Specifically:
- Scaling: Scales the position vectors and radii by a specified scale factor $\mathbf{s} = \begin{pmatrix}s_x & s_y & s_z\end{pmatrix}$.
- Rotation: Rotates the positions using Euler angles (converted to quaternion) and applies this rotation matrix to each sphere's center position vector.
- Translation: Translates the positions by adding a specified translation vector $\mathbf{t} = \begin{pmatrix} t_x & t_y & t_z \end{pmatrix}$.
The transformation is applied as follows:
egin{align}
\mathbf{x}' &= T(\mathbf{t}) R(\theta) S(\mathbf{s}) \mathbf{x}, \
r' &= s_x r,
\end{align}
where $T(\mathbf{t})$ is the translation matrix, $R(\theta)$ is the rotation matrix derived from Euler angles (converted to a quaternion), and $S(\mathbf{s})$ is the scaling matrix.
Fit into Broader Variational / Lagrangian Mechanics Framework
The SphereLoader does not directly contribute to any variational or Lagrangian mechanics formulations. Its primary function is in loading geometric data that might later be used in simulations governed by these principles. The loaded spheres could, for example, serve as elements in a larger mesh or as constraints within the simulation domain.
In summary, SphereLoader is an essential component for setting up simulations involving spherical objects but does not directly involve any of the core FEM operators or constitutive laws.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_scale |
type::Vec3 | |
Scale applied to sphere positions & radius |
d_rotation |
type::Vec3 | |
Rotation of the DOFs |
d_translation |
type::Vec3 | |
Translation applied to sphere positions |
Methods
bool
load
()
virtual
void
applyTransform
()
{
"name": "SphereLoader",
"namespace": "sofa::component::io::mesh",
"module": "Sofa.Component.IO.Mesh",
"include": "sofa/component/io/mesh/SphereLoader.h",
"doc": "Loader for sphere model description files.",
"inherits": [
"BaseLoader"
],
"templates": [],
"data_fields": [
{
"name": "d_scale",
"type": "type::Vec3",
"xmlname": "scale",
"help": "Scale applied to sphere positions & radius"
},
{
"name": "d_rotation",
"type": "type::Vec3",
"xmlname": "rotation",
"help": "Rotation of the DOFs"
},
{
"name": "d_translation",
"type": "type::Vec3",
"xmlname": "translation",
"help": "Translation applied to sphere positions"
}
],
"links": [],
"methods": [
{
"name": "load",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "applyTransform",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `SphereLoader` is a component in the SOFA framework that loads model descriptions for spheres, inheriting from `BaseLoader`. It is part of the `Sofa.Component.IO.Mesh` module and handles sphere models by reading positions and radii specified in files. This loader supports applying transformations (scale, rotation, translation) to the loaded spheres.\n\n**Interactions with other components**: The `SphereLoader` interacts with other SOFA components through its inherited methods from `BaseLoader`, particularly via the `load` method for loading sphere data. It can be used in conjunction with other mesh processing and simulation components to integrate spherical geometries into larger simulations.\n\n**Practical usage guidance**:\n- **Data Fields**: The component provides data fields for configuring scale (`scale`), rotation (`rotation`), and translation (`translation`) transformations on the loaded spheres. These fields allow users to manipulate the sphere model after loading.\n- **Methods**: It includes methods such as `load()` to load the sphere models from files and `applyTransform()` to apply specified transformations to the loaded positions.\n\nThe component is useful for setting up simulations involving spherical objects, where precise positioning and scaling are required.",
"maths": "The `SphereLoader` component in the SOFA framework is designed to load model descriptions for spherical objects from files. It handles reading positions and radii of spheres specified in files, and supports applying transformations such as scaling, rotation, and translation to these loaded spheres. This component does not contribute directly to any governing equations or operators typically associated with FEM simulations (such as the mass matrix $M$, stiffness matrix $K$, internal force $\boldsymbol{f}_{\text{int}}$, residual $R$, etc.). Instead, its primary role is in the initial stage of setting up the simulation environment by loading and transforming sphere geometries.\n\n### Governing Equations or Operators\n\nThe `SphereLoader` does not implement any governing equations or operators directly related to FEM. Its function is more focused on data input and manipulation for setting up simulations involving spherical objects.\n\n### Constitutive or Kinematic Laws Involved\n\nSince the component is primarily a loader, it does not involve constitutive laws (such as strain measures, stress tensors, hyperelastic potentials) or kinematic laws (like displacement fields). It simply loads position and radius data from files and applies geometric transformations to these spheres.\n\n### Role in the Global FEM Pipeline\n\nIn the context of the global FEM pipeline, `SphereLoader` plays a role in the initial setup phase. Specifically:\n- **Modeling Phase**: It contributes to defining the geometry (positions and radii) of spherical objects that will be part of the simulation.\n- **Discretization Phase**: Although it does not perform spatial discretization itself, it provides the necessary geometric data for further processing by other components that might perform mesh generation or element definition.\n\n### Numerical Methods or Discretization Choices\n\nThe `SphereLoader` employs basic numerical methods to apply transformations (scaling, rotation, translation) to the loaded sphere positions. Specifically:\n- **Scaling**: Scales the position vectors and radii by a specified scale factor $\\mathbf{s} = \\begin{pmatrix}s_x & s_y & s_z\\end{pmatrix}$.\n- **Rotation**: Rotates the positions using Euler angles (converted to quaternion) and applies this rotation matrix to each sphere's center position vector.\n- **Translation**: Translates the positions by adding a specified translation vector $\\mathbf{t} = \\begin{pmatrix} t_x & t_y & t_z \\end{pmatrix}$.\n\nThe transformation is applied as follows:\n\begin{align*}\n \\mathbf{x}' &= T(\\mathbf{t}) R(\\theta) S(\\mathbf{s}) \\mathbf{x}, \\\\\n r' &= s_x r,\n\\end{align*}\nwhere $T(\\mathbf{t})$ is the translation matrix, $R(\\theta)$ is the rotation matrix derived from Euler angles (converted to a quaternion), and $S(\\mathbf{s})$ is the scaling matrix.\n\n### Fit into Broader Variational / Lagrangian Mechanics Framework\n\nThe `SphereLoader` does not directly contribute to any variational or Lagrangian mechanics formulations. Its primary function is in loading geometric data that might later be used in simulations governed by these principles. The loaded spheres could, for example, serve as elements in a larger mesh or as constraints within the simulation domain.\n\nIn summary, `SphereLoader` is an essential component for setting up simulations involving spherical objects but does not directly involve any of the core FEM operators or constitutive laws.",
"abstract": "The `SphereLoader` loads sphere model descriptions from files and applies scale, rotation, and translation transformations to the loaded spheres.",
"sheet": "\n# SphereLoader\n\n## Overview\n\nThe `SphereLoader` is a component in SOFA that loads sphere model descriptions from files. It inherits from `BaseLoader` and supports applying geometric transformations (scale, rotation, translation) to the loaded spheres.\n\n## Parameters and Data\n\n- **scale**: Type `type::Vec3`, controls scaling applied to sphere positions & radius.\n- **rotation**: Type `type::Vec3`, controls rotation of the DOFs.\n- **translation**: Type `type::Vec3`, controls translation applied to sphere positions.\n\n## Dependencies and Connections\n\nThe `SphereLoader` interacts with other SOFA components through its inherited methods from `BaseLoader`. It can be used in conjunction with mesh processing and simulation components to integrate spherical geometries into larger simulations.\n\n## Practical Notes\n\n- The component provides basic numerical methods for applying transformations (scaling, rotation, translation) to the loaded sphere positions. Scaling is applied by a specified scale factor \\(\\mathbf{s} = \\begin{pmatrix}s_x & s_y & s_z\\end{pmatrix}\\).\n- Rotation uses Euler angles converted to quaternions and applies this rotation matrix to each sphere's center position vector.\n- Translation adds a specified translation vector \\(\\mathbf{t} = \\begin{pmatrix} t_x & t_y & t_z \\end{pmatrix}\\) to the positions. The transformation is applied as follows:\n\n\\[ \n \\mathbf{x}' = T(\\mathbf{t}) R(\\theta) S(\\mathbf{s}) \\mathbf{x}, \n r' = s_x r, \n\\]\nwhere \\(T(\\mathbf{t})\\) is the translation matrix, \\(R(\\theta)\\) is the rotation matrix derived from Euler angles (converted to a quaternion), and \\(S(\\mathbf{s})\\) is the scaling matrix.\n"
}