TextureInterpolation
Create texture coordinate for a given field. This class give texture coordinate in 1D according to an input state vector.
The `TextureInterpolation` component generates one-dimensional texture coordinates from scalar field values for visualization purposes.
- module
- Sofa.GL.Component.Engine
- namespace
- sofa::gl::component::engine
- include
- sofa/gl/component/engine/TextureInterpolation.h
- inherits
-
- DataEngine
- templates
-
- sofa::defaulttype::Vec1Types
- description
The TextureInterpolation component in the SOFA framework is designed to map scalar field values onto texture coordinates. This process involves interpolating a given input state vector and generating corresponding 1D texture coordinates for visualization purposes. Here is a detailed mathematical description of this component's functionality:
Governing Equations or Operators
The TextureInterpolation component does not directly contribute to the standard FEM governing equations such as mass matrix ($M"]), stiffness matrix (\(K")), internal force (\(f_{int}")), residual (\(R")), etc. Instead, it focuses on transforming scalar field data into visualizable coordinates.
### Interpolation Process
Let \(s_i$ denote the state values from the input field array $_{inputField}$. These values are mapped to texture coordinates using a linear interpolation formula within the range defined by minimum value $ ext{ extbackslash{}_minVal}$ and maximum value $ ext{ extbackslash{}_maxVal}$.
The interpolated texture coordinate $t_i$ for each state value can be expressed as:
t_i = rac{s_i - ext{ extbackslash{}_minVal}}{ ext{ extbackslash{}_maxVal} - ext{ extbackslash{}_minVal}}
This formula scales the state values linearly from $ ext{ extbackslash{}_minVal}$ to 1, assuming that $s_i$ lies within this range. If $_changeScale$ is true, manual scaling based on specified minimum and maximum values is applied.
Constitutive or Kinematic Laws Involved
The interpolation process does not involve any constitutive laws (such as stress-strain relationships), kinematic laws, or hyperelastic potentials typical in FEM. It is purely a mapping operation that translates scalar field data into visualizable coordinates for graphical representation purposes.
Role in the Global FEM Pipeline
In the context of the broader FEM pipeline, TextureInterpolation operates outside the core simulation components such as mass and stiffness matrices, nonlinear solvers, time integration schemes, etc. Its primary role is to assist in the visualization phase by transforming scalar field data into texture coordinates that can be used for graphical rendering.
Numerical Methods or Discretization Choices
The interpolation method used here is simple linear scaling without any additional discretization techniques such as finite elements or numerical integration. It is a straightforward mapping from one set of values to another within predefined bounds.
Variational / Lagrangian Mechanics Framework
TextureInterpolation does not contribute directly to variational principles, Lagrangian mechanics, or the weak form of PDEs in FEM. Its function is purely for visualization and data transformation rather than numerical simulation.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
_inputField |
VecCoord | |
input array of state values. |
_inputCoords |
VecCoord3D | |
input array of coordinates values. |
_outputCoord |
VecCoord2D | |
output array of texture coordinates. |
_scalarField |
bool | |
To interpolate only the first dimension of input field (useful if this component need to be templated in higher dimension). |
_minVal |
Real | |
minimum value of state value for interpolation. |
_maxVal |
Real | |
maximum value of state value for interpolation. |
_changeScale |
bool | |
compute texture interpolation on manually scale defined above. |
drawPotentiels |
bool | |
Debug: view state values. |
showIndicesScale |
float | |
Debug : scale of state values displayed. |
_vertexPloted |
unsigned int | |
Vertex index of values display in graph for each iteration. |
Methods
void
init
()
virtual
void
reinit
()
virtual
void
doUpdate
()
virtual
void
draw
(const core::visual::VisualParams * vparams)
virtual
void
updateGraph
()
void
resetGraph
()
void
standardLinearInterpolation
()
{
"name": "TextureInterpolation",
"namespace": "sofa::gl::component::engine",
"module": "Sofa.GL.Component.Engine",
"include": "sofa/gl/component/engine/TextureInterpolation.h",
"doc": "Create texture coordinate for a given field.\n\nThis class give texture coordinate in 1D according to an input state vector.",
"inherits": [
"DataEngine"
],
"templates": [
"sofa::defaulttype::Vec1Types"
],
"data_fields": [
{
"name": "_inputField",
"type": "VecCoord",
"xmlname": "input_states",
"help": "input array of state values."
},
{
"name": "_inputCoords",
"type": "VecCoord3D",
"xmlname": "input_coordinates",
"help": "input array of coordinates values."
},
{
"name": "_outputCoord",
"type": "VecCoord2D",
"xmlname": "output_coordinates",
"help": "output array of texture coordinates."
},
{
"name": "_scalarField",
"type": "bool",
"xmlname": "scalarField",
"help": "To interpolate only the first dimension of input field (useful if this component need to be templated in higher dimension)."
},
{
"name": "_minVal",
"type": "Real",
"xmlname": "min_value",
"help": "minimum value of state value for interpolation."
},
{
"name": "_maxVal",
"type": "Real",
"xmlname": "max_value",
"help": "maximum value of state value for interpolation."
},
{
"name": "_changeScale",
"type": "bool",
"xmlname": "manual_scale",
"help": "compute texture interpolation on manually scale defined above."
},
{
"name": "drawPotentiels",
"type": "bool",
"xmlname": "drawPotentiels",
"help": "Debug: view state values."
},
{
"name": "showIndicesScale",
"type": "float",
"xmlname": "showIndicesScale",
"help": "Debug : scale of state values displayed."
},
{
"name": "_vertexPloted",
"type": "unsigned int",
"xmlname": "vertexPloted",
"help": "Vertex index of values display in graph for each iteration."
}
],
"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": "draw",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "updateGraph",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "resetGraph",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "standardLinearInterpolation",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
],
"description": "The `TextureInterpolation` component in the SOFA framework is part of the Sofa.GL.Component.Engine module and is designed to generate texture coordinates based on an input state vector. This class specifically provides one-dimensional texture coordinates according to the given state values, which can be useful for visualizing scalar fields or other data-driven visual effects.\n\n### Role and Purpose:\nThe primary role of `TextureInterpolation` is to map scalar field values onto texture coordinates in a 1D space. It inherits from the `DataEngine`, indicating its purpose as an engine component that processes input data and generates output for visualization purposes.\n\n### Interactions with Other Components:\n- **Input Fields**: The component interacts with other components through two main inputs: `_inputField` (an array of state values) and `_inputCoords` (an array of coordinates).\n- **Output Field**: It produces an output field, `_outputCoord`, containing the texture coordinates calculated from the input fields.\n\n### Practical Usage Guidance:\nThe component includes several data fields to customize its behavior:\n- `_scalarField`: A boolean that indicates whether only the first dimension of the input field should be interpolated (useful for higher-dimensional templates).\n- `_minVal` and `_maxVal`: Define the minimum and maximum values used in interpolation.\n- `_changeScale`: Allows manual scaling based on defined values if set to true.\n- `drawPotentiels`, `showIndicesScale`, and `_vertexPloted`: These fields are for debugging purposes, allowing visualization of state values and control over display options.",
"maths": "The `TextureInterpolation` component in the SOFA framework is designed to map scalar field values onto texture coordinates. This process involves interpolating a given input state vector and generating corresponding 1D texture coordinates for visualization purposes. Here is a detailed mathematical description of this component's functionality:\n\n### Governing Equations or Operators\n\nThe `TextureInterpolation` component does not directly contribute to the standard FEM governing equations such as mass matrix (\\(M\"]), stiffness matrix (\\(K\")), internal force (\\(f_{int}\")), residual (\\(R\")), etc. Instead, it focuses on transforming scalar field data into visualizable coordinates.\n\n### Interpolation Process\n\nLet \\(s_i\\) denote the state values from the input field array \\(_{inputField}\\). These values are mapped to texture coordinates using a linear interpolation formula within the range defined by minimum value \\(\text{\textbackslash{}_minVal}\\) and maximum value \\(\text{\textbackslash{}_maxVal}\\).\n\nThe interpolated texture coordinate \\(t_i\\) for each state value can be expressed as:\n\n\nt_i = \frac{s_i - \text{\textbackslash{}_minVal}}{\text{\textbackslash{}_maxVal} - \text{\textbackslash{}_minVal}}\n\nThis formula scales the state values linearly from \\(\text{\textbackslash{}_minVal}\\) to 1, assuming that \\(s_i\\) lies within this range. If \\(_changeScale\\) is true, manual scaling based on specified minimum and maximum values is applied.\n\n### Constitutive or Kinematic Laws Involved\n\nThe interpolation process does not involve any constitutive laws (such as stress-strain relationships), kinematic laws, or hyperelastic potentials typical in FEM. It is purely a mapping operation that translates scalar field data into visualizable coordinates for graphical representation purposes.\n\n### Role in the Global FEM Pipeline\n\nIn the context of the broader FEM pipeline, `TextureInterpolation` operates outside the core simulation components such as mass and stiffness matrices, nonlinear solvers, time integration schemes, etc. Its primary role is to assist in the visualization phase by transforming scalar field data into texture coordinates that can be used for graphical rendering.\n\n### Numerical Methods or Discretization Choices\n\nThe interpolation method used here is simple linear scaling without any additional discretization techniques such as finite elements or numerical integration. It is a straightforward mapping from one set of values to another within predefined bounds.\n\n### Variational / Lagrangian Mechanics Framework\n\n`TextureInterpolation` does not contribute directly to variational principles, Lagrangian mechanics, or the weak form of PDEs in FEM. Its function is purely for visualization and data transformation rather than numerical simulation.\n",
"abstract": "The `TextureInterpolation` component generates one-dimensional texture coordinates from scalar field values for visualization purposes.",
"sheet": "# TextureInterpolation\n\n## Overview\nThe `TextureInterpolation` component is part of the Sofa.GL.Component.Engine module. It maps scalar field values onto one-dimensional texture coordinates, facilitating data-driven visual effects and graphical rendering.\n\n## Parameters and Data\n- **_inputField** (`VecCoord`): Input array of state values.\n- **_inputCoords** (`VecCoord3D`): Input array of coordinate values.\n- **_outputCoord** (`VecCoord2D`): Output array of texture coordinates.\n- **_scalarField** (`bool`): Interpolate only the first dimension (default: `false`).\n- **_minVal** (`Real`): Minimum value for interpolation (default: 0).\n- **_maxVal** (`Real`): Maximum value for interpolation (default: 1).\n- **_changeScale** (`bool`): Use manually defined scale (default: `false`).\n- **drawPotentiels** (`bool`): Debug mode to view state values (default: `false`).\n- **showIndicesScale** (`float`): Scale of displayed state values for debugging.\n- **_vertexPloted** (`unsigned int`): Vertex index for displaying values in the graph.\n\n## Practical Notes\nThe component interpolates scalar field values linearly within a specified range to generate texture coordinates. Debugging options allow visualization and control over display settings."
}