VisualVectorField
Render a vector field.
The `VisualVectorField` component renders vector fields in SOFA simulations with customizable scaling factors, draw modes (lines, cylinders, arrows), and colors.
- module
- Sofa.Component.Visual
- namespace
- sofa::component::visual
- include
- sofa/component/visual/VisualVectorField.h
- inherits
-
- VisualModel
- templates
-
- sofa::defaulttype::Vec3Types
- description
The VisualVectorField component in the SOFA framework is primarily concerned with managing visual representations and state data for graphical rendering. It does not directly implement or contribute to any governing equations, constitutive laws, or kinematic relations typical of a finite element method (FEM) simulation pipeline. Instead, it focuses on handling vertex coordinates, rest positions, and normals which are essential for visualization purposes but do not involve the mathematical machinery associated with physical simulations. component in the SOFA framework is designed to visualize vector fields within simulations. It does not contribute to any governing equations or operators involved in the Finite Element Method (FEM) simulation pipeline, such as mass matrix $ ext{start} = oldsymbol{p_i}$, stiffness matrix $ ext{end} = oldsymbol{p_i} + ( ext{vectorScale} imes oldsymbol{v_i})$, internal force $r = (\text{vectorScale} \times |\mathbf{v}_i| / 20)$, residual wzxhzdk:3, etc. Instead, it is purely a visualization tool that renders vectors in various forms (lines, cylinders, or arrows). The component allows customization through several parameters:
-
Scaling Factor: A scaling factor wzxhzdk:8 is applied to each vector for rendering purposes.
-
If the position of a point is denoted by wzxhzdk:11, and the corresponding vector at this point is given by wzxhzdk:12, then the scaled vector end-point can be computed as:
wzxhzdk:13
-
-
Draw Mode: The visualization of each vector can be customized using different draw modes (
Line,Cylinder, orArrow). For example, if the draw mode is set toLine, then a line segment will connect the start point wzxhzdk:9 and end point wzxhzdk:10.-
klzzwxh:0041: The vector is displayed as a line segment from $ ext{start} = oldsymbol{p_i}$ to $ ext{end} = oldsymbol{p_i} + ( ext{vectorScale} imes oldsymbol{v_i})$.
-
Cylinder: The vector is displayed as a cylinder with radius $r = (\text{vectorScale} \times |\mathbf{v}_i| / 20)$, extending from the start point to the end point.<!--MATH1--> -
Arrow: The vector is displayed as an arrow with a conical tip, similar to theCylindermode but with an additional cone at the end point.
-
-
Color: Each vector can be colored using an RGBA color scheme specified by the user.
The component's role in the broader simulation pipeline is limited to visualization. It does not contribute to the assembly phase (global mass and force construction), time integration, nonlinear or linear resolution, or constraint handling. Instead, it interfaces with the visualization framework of SOFA to render vector fields accurately according to specified parameters.
In summary, VisualVectorField serves as a purely visual tool for displaying vector fields within simulations, enabling users to customize the appearance and scale of vectors without influencing the underlying physics simulation.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
d_vectorScale |
SReal | |
Scaling factor applied on vectors for rendering |
d_drawMode |
VectorFieldDrawMode | |
Draw mode for the vectors |
d_color |
type::RGBAColor | |
Color of the vectors |
Methods
void
computeBBox
(const core::ExecParams * , bool )
virtual
{
"name": "VisualVectorField",
"namespace": "sofa::component::visual",
"module": "Sofa.Component.Visual",
"include": "sofa/component/visual/VisualVectorField.h",
"doc": "Render a vector field.",
"inherits": [
"VisualModel"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_vectorScale",
"type": "SReal",
"xmlname": "vectorScale",
"help": "Scaling factor applied on vectors for rendering"
},
{
"name": "d_drawMode",
"type": "VectorFieldDrawMode",
"xmlname": "Line",
"help": "Draw mode for the vectors"
},
{
"name": "d_color",
"type": "type::RGBAColor",
"xmlname": "color",
"help": "Color of the vectors"
}
],
"links": [],
"methods": [
{
"name": "computeBBox",
"return_type": "void",
"params": [
{
"name": "",
"type": "const core::ExecParams *"
},
{
"name": "",
"type": "bool"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
],
"description": "The `VisualVectorField` component is part of the Sofa.Component.Visual module and is used to render a vector field in SOFA simulations. It inherits from `core::visual::VisualModel`, enabling it to visualize vectors using lines, cylinders, or arrows. The component provides several configuration options for customization, including a scaling factor (`vectorScale`) that adjusts the length of the rendered vectors, different draw modes (`Line`, `Cylinder`, `Arrow`), and color settings for the vectors. It interacts with other SOFA components through its API by defining methods such as `computeBBox` to calculate bounding boxes and override the `doDrawVisual` method from `core::visual::VisualModel`. This ensures proper rendering of vector fields in the simulation environment.",
"maths": "The `VisualVectorField` component in the SOFA framework is designed to visualize vector fields within simulations. It does not contribute to any governing equations or operators involved in the Finite Element Method (FEM) simulation pipeline, such as mass matrix \\(M\\), stiffness matrix \\(K\\), internal force \\(f_{int}\\), residual \\(R\\), etc. Instead, it is purely a visualization tool that renders vectors in various forms (lines, cylinders, or arrows). The component allows customization through several parameters:\n\n- **Scaling Factor**: A scaling factor \\(\text{vectorScale}\\) is applied to each vector for rendering purposes.\n \n - If the position of a point is denoted by \\(\\mathbf{p}_i\\), and the corresponding vector at this point is given by \\(\\mathbf{v}_i\\), then the scaled vector end-point can be computed as:\n \n \\[\n \\mathbf{e}_i = \\mathbf{p}_i + (\\text{vectorScale} \\times \\mathbf{v}_i)\n \\]\n\n- **Draw Mode**: The visualization of each vector can be customized using different draw modes (`Line`, `Cylinder`, or `Arrow`). For example, if the draw mode is set to `Line`, then a line segment will connect the start point \\(\\mathbf{p}_i\\) and end point \\(\\mathbf{e}_i\\).\n\n - **`Line`:** The vector is displayed as a line segment from \\(\text{start} = \boldsymbol{p_i}\\) to \\(\text{end} = \boldsymbol{p_i} + (\text{vectorScale} \times \boldsymbol{v_i})\\).\n\n - **`Cylinder`:** The vector is displayed as a cylinder with radius \\(r = (\\text{vectorScale} \\times |\\mathbf{v}_i| / 20)\\), extending from the start point to the end point.\n \n \\[\n r = \\frac{1}{20} \times \\text{vectorScale} \\times |\\boldsymbol{v_i}|, \\quad\n \\mathbf{start} = \\boldsymbol{p_i},\n \\quad \\mathbf{end} = \\boldsymbol{p_i} + (\\text{vectorScale} \\times \\boldsymbol{v_i})\n \\]\n \n - **`Arrow`:** The vector is displayed as an arrow with a conical tip, similar to the `Cylinder` mode but with an additional cone at the end point.\n\n- **Color**: Each vector can be colored using an RGBA color scheme specified by the user.\n\nThe component's role in the broader simulation pipeline is limited to visualization. It does not contribute to the assembly phase (global mass and force construction), time integration, nonlinear or linear resolution, or constraint handling. Instead, it interfaces with the visualization framework of SOFA to render vector fields accurately according to specified parameters.\n\nIn summary, `VisualVectorField` serves as a purely visual tool for displaying vector fields within simulations, enabling users to customize the appearance and scale of vectors without influencing the underlying physics simulation.",
"abstract": "The `VisualVectorField` component renders vector fields in SOFA simulations with customizable scaling factors, draw modes (lines, cylinders, arrows), and colors.",
"sheet": "\n# VisualVectorField\n\n**Overview**\nThe `VisualVectorField` is part of the Sofa.Component.Visual module and inherits from `core::visual::VisualModel`. It renders vector fields in SOFA simulations using lines, cylinders, or arrows. The component allows customization through scaling factors, draw modes, and colors.\n\n**Parameters and Data**\nThe significant data fields exposed by this component are:\n- **vectorScale**: Scaling factor applied on vectors for rendering (`SReal` type).\n- **drawMode**: Draw mode for the vectors (e.g., `Line`, `Cylinder`, `Arrow`) (`VectorFieldDrawMode` type).\n- **color**: Color of the vectors (`type::RGBAColor` type).\n\n**Mathematical Model**\nThe component does not contribute to any governing equations or operators involved in the Finite Element Method (FEM) simulation pipeline. Instead, it is purely a visualization tool that renders vectors in various forms.\n- **Scaling Factor**: A scaling factor \\(\\text{vectorScale}\\) is applied to each vector for rendering purposes.\n - If the position of a point is denoted by \\(\\mathbf{p}_i\\), and the corresponding vector at this point is given by \\(\\mathbf{v}_i\\), then the scaled vector end-point can be computed as:\n \n \\[\n \\mathbf{e}_i = \\mathbf{p}_i + (\\text{vectorScale} \\times \\mathbf{v}_i)\n \\]\n\n- **Draw Mode**: The visualization of each vector can be customized using different draw modes (`Line`, `Cylinder`, or `Arrow`).\n - **`Line`:** The vector is displayed as a line segment from \\(\\text{start} = \\mathbf{p}_i\\) to \\(\\text{end} = \\mathbf{p}_i + (\\text{vectorScale} \\times \\mathbf{v}_i)\\).\n - **`Cylinder`:** The vector is displayed as a cylinder with radius \\(r = \\frac{1}{20} \\times \\text{vectorScale} \\times |\\boldsymbol{v_i}|\\), extending from the start point to the end point.\n \n \\[\n r = \\frac{1}{20} \\times \\text{vectorScale} \\times |\\mathbf{v}_i|, \\quad\n \\mathbf{start} = \\mathbf{p_i},\n \\quad \\mathbf{end} = \\mathbf{p_i} + (\\text{vectorScale} \\times \\mathbf{v_i})\n \\]\n - **`Arrow`:** The vector is displayed as an arrow with a conical tip, similar to the `Cylinder` mode but with an additional cone at the end point.\n\n- **Color**: Each vector can be colored using an RGBA color scheme specified by the user."
}