HexahedronSetGeometryAlgorithms
The `HexahedronSetGeometryAlgorithms` component is part of the SOFA framework and provides geometry-related information for hexahedral topologies in simulation scenarios. It inherits from `QuadSetGeometryAlgorithms` and specializes in handling operations related to hexahedra, such as computing volumes, barycentric coordinates, positions within elements, and other geometric properties. This component interacts with the topology container through methods that retrieve hexahedron data, including positions and connectivity. It also interfaces with numerical integration descriptors for cubature points necessary in finite element calculations. The component can compute various geometric measures such as volumes, centers, barycentric coordinates, and distances between elements. Additionally, `HexahedronSetGeometryAlgorithms` includes drawing functions that allow visualization of hexahedral structures and indices, which is useful for debugging and visual inspection. Data fields like `d_showHexaIndices`, `d_drawHexahedra`, `d_drawScaleHexahedra`, and `d_drawColorHexahedra` control the visibility and appearance settings during rendering. Practical usage includes initializing geometry algorithms, performing geometric calculations on hexahedron sets, and ensuring visualization options are configured as needed.
- abstract
- The `HexahedronSetGeometryAlgorithms` component provides geometric information for hexahedral elements in SOFA simulations, including volume calculations, centroid computations, barycentric coordinates, and shape functions.
- sheet
- # HexahedronSetGeometryAlgorithms ## Overview This component is part of the SOFA framework and specializes in providing geometry-related operations for hexahedral topologies. It inherits from `QuadSetGeometryAlgorithms` and handles various geometric computations such as volumes, centers, barycentric coordinates, and shape functions. ## Mathematical Model ### Volume Calculation The volume of a hexahedron is computed using the nodal positions: \[ V = \frac{1}{6} \left| (\mathbf{p}_2 - \mathbf{p}_0) \cdot ((\mathbf{p}_3 - \mathbf{p}_0) \times (\mathbf{p}_4 - \mathbf{p}_0)) \right| \] where \( \mathbf{p}_i \) are the nodal positions. ### Centroid Calculation The centroid of a hexahedron is computed as an average of all its vertices' coordinates: \[ \mathbf{c} = \frac{1}{8} \sum_{i=0}^{7} \mathbf{p}_i \] ### Barycentric Coordinates Barycentric coordinates for a point within the hexahedron are computed as follows: For rest configuration: \[ (\lambda_1, \lambda_2, \lambda_3) = \mathbf{J}^{-1}(\mathbf{x} - \mathbf{p}_0) \] where \( \mathbf{J} \) is the Jacobian matrix formed from edge vectors. ### Shape Functions Shape functions for hexahedra are given by: For a local coordinate \((\xi, \eta, \zeta)\), the shape function at node \(i\) is: \[ N_i(\xi, \eta, \zeta) = \frac{1}{8} (1 + l_i^x \xi)(1 + l_i^y \eta)(1 + l_i^z \zeta) \] ### Position Derivatives and Jacobian Calculation The Jacobian matrix is given by: \[ J = \begin{bmatrix} \frac{\partial x}{\partial \xi} & \frac{\partial y}{\partial \xi} & \frac{\partial z}{\partial \xi} \\ \frac{\partial x}{\partial \eta} & \frac{\partial y}{\partial \eta} & \frac{\partial z}{\partial \eta} \\ \frac{\partial x}{\partial \zeta} & \frac{\partial y}{\partial \zeta} & \frac{\partial z}{\partial \zeta} \end{bmatrix} \] The determinant of the Jacobian matrix ensures that the element remains well-defined and non-degenerate. ## Parameters and Data - **d_showHexaIndices**: `bool` - Controls whether hexahedron indices are displayed during visualization. Default: `false` - **d_drawHexahedra**: `bool` - Controls whether hexahedra are drawn during visualization. Default: `false` - **d_drawScaleHexahedra**: `float` - Scales the size of hexahedra for drawing purposes. Default: `1.0` - **d_drawColorHexahedra**: `sofa::type::RGBAColor` - Sets the color used to draw hexahedra. Default: `(1, 1, 1, 1)` (white)
- description
- The `HexahedronSetGeometryAlgorithms` component is part of the SOFA framework and provides geometry-related information for hexahedral topologies in simulation scenarios. It inherits from `QuadSetGeometryAlgorithms` and specializes in handling operations related to hexahedra, such as computing volumes, barycentric coordinates, positions within elements, and other geometric properties. This component interacts with the topology container through methods that retrieve hexahedron data, including positions and connectivity. It also interfaces with numerical integration descriptors for cubature points necessary in finite element calculations. The component can compute various geometric measures such as volumes, centers, barycentric coordinates, and distances between elements. Additionally, `HexahedronSetGeometryAlgorithms` includes drawing functions that allow visualization of hexahedral structures and indices, which is useful for debugging and visual inspection. Data fields like `d_showHexaIndices`, `d_drawHexahedra`, `d_drawScaleHexahedra`, and `d_drawColorHexahedra` control the visibility and appearance settings during rendering. Practical usage includes initializing geometry algorithms, performing geometric calculations on hexahedron sets, and ensuring visualization options are configured as needed.
- maths
- ### Mathematical and Physical Description of `HexahedronSetGeometryAlgorithms` #### Governing Equations or Operators Implemented/Contributed to The `HexahedronSetGeometryAlgorithms` component in the SOFA framework provides several geometry-related operations for hexahedral elements. These include: - **Volume Calculation**: Computes volumes of individual hexahedral elements using their nodal coordinates. \[ V = \frac{1}{6} \left| (\mathbf{p}_2 - \mathbf{p}_0) \cdot ((\mathbf{p}_3 - \mathbf{p}_0) \times (\mathbf{p}_4 - \mathbf{p}_0)) \right| \] where \( \mathbf{p}_i \) are nodal positions. - **Centroid Calculation**: Computes the centroid of a hexahedral element as an average of all its vertices' coordinates: \[ \mathbf{c} = \frac{1}{8} \sum_{i=0}^{7} \mathbf{p}_i \] - **Barycentric Coordinates**: Computes barycentric coordinates for a given point within the hexahedron. For rest configuration: \[ (\lambda_1, \lambda_2, \lambda_3) = \mathbf{J}^{-1}(\mathbf{x} - \mathbf{p}_0) \] where \( \mathbf{J} \) is the Jacobian matrix formed from edge vectors. - **Shape Functions**: Computes shape functions for hexahedra, which are used in finite element interpolation. For a local coordinate \( (\xi, \eta, \zeta) \), the shape function at node \( i \) is given by: \[ N_i(\xi, \eta, \zeta) = \frac{1}{8} (1 + l_i^x \xi)(1 + l_i^y \eta)(1 + l_i^z \zeta) \] - **Position Derivatives**: Computes derivatives of the position vector with respect to local coordinates. The Jacobian matrix is given by: \[ J = \begin{bmatrix} \frac{\partial x}{\partial \xi} & \frac{\partial y}{\partial \xi} & \frac{\partial z}{\partial \xi} \\ \frac{\partial x}{\partial \eta} & \frac{\partial y}{\partial \eta} & \frac{\partial z}{\partial \eta} \\ \frac{\partial x}{\partial \zeta} & \frac{\partial y}{\partial \zeta} & \frac{\partial z}{\partial \zeta} \end{bmatrix} \] - **Jacobian Calculation**: Computes the determinant of the Jacobian matrix to ensure that the element remains well-defined and non-degenerate. #### Constitutive or Kinematic Laws Involved The component handles kinematic relationships within hexahedra, such as mapping between global coordinates and local coordinates. The barycentric coordinate system is used for interpolation and position determination: \[ \mathbf{x} = \sum_{i=0}^{7} N_i(\xi, \eta, \zeta) \mathbf{p}_i \] where \( N_i \) are the shape functions. #### Role in the Global FEM Pipeline 1. **Mesh and Shape Function Definition**: Provides the geometric properties of hexahedral elements that are essential for defining the shape functions used in spatial discretization. 2. **Volume Calculation**: Used in assembling volume-related terms, such as mass matrix contributions or integration of internal forces over element volumes. 3. **Centroid and Barycentric Coordinates**: Useful for various purposes including contact detection and integration points definition within elements. 4. **Shape Function Evaluation**: Required for interpolating nodal values to any point inside the hexahedron, which is critical during FEM assembly. 5. **Derivative Computations**: Used in computing gradients of shape functions needed for strain measures in elasticity problems. #### Numerical Methods or Discretization Choices Encoded - The component uses numerical integration with Gauss quadrature points to compute integrals over the hexahedron volume, ensuring accurate evaluation of element matrices and vectors. - It supports higher-order elements through the definition of shape functions, allowing for more refined discretizations if needed. - The methods provided ensure that operations on hexahedral elements are consistent with variational mechanics principles used in FEM formulations. #### Integration into the Broader Variational/Lagrangian Mechanics Framework The `HexahedronSetGeometryAlgorithms` component contributes to the spatial discretization stage of the FEM pipeline by providing geometric information necessary for defining shape functions and calculating elemental contributions (e.g., mass matrix, internal forces). It supports variational formulations by enabling accurate computation of integrals over element volumes and ensuring consistency in kinematic transformations from global to local coordinates. The provided operations ensure that the finite element discretization is physically consistent with the underlying continuum mechanics model.
{
"name": "HexahedronSetGeometryAlgorithms",
"main": {
"name": "HexahedronSetGeometryAlgorithms",
"namespace": "sofa::component::topology::container::dynamic",
"module": "Sofa.Component.Topology.Container.Dynamic",
"include": "sofa/component/topology/container/dynamic/HexahedronSetGeometryAlgorithms.h",
"doc": "Geometry algorithms dedicated to an hexahedral topology.\n\nA class that provides geometry information on an HexahedronSet.",
"inherits": [
"QuadSetGeometryAlgorithms"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_showHexaIndices",
"type": "bool"
},
{
"name": "d_drawHexahedra",
"type": "bool"
},
{
"name": "d_drawScaleHexahedra",
"type": "float"
},
{
"name": "d_drawColorHexahedra",
"type": "sofa::type::RGBAColor"
}
],
"links": [],
"methods": [
{
"name": "defineHexahedronCubaturePoints",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
},
{
"name": "computeHexahedronAABB",
"return_type": "void",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "minCoord",
"type": "Coord &"
},
{
"name": "maxCoord",
"type": "Coord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronRestAABB",
"return_type": "void",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "minCoord",
"type": "Coord &"
},
{
"name": "maxCoord",
"type": "Coord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronCenter",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronRestCenter",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getHexahedronVertexCoordinates",
"return_type": "void",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "",
"type": "Coord[8]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getRestHexahedronVertexCoordinates",
"return_type": "void",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "",
"type": "Coord[8]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronVolume",
"return_type": "Real",
"params": [
{
"name": "h",
"type": "const HexaID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronVolume",
"return_type": "void",
"params": [
{
"name": "ai",
"type": "BasicArrayInterface<Real> &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeRestHexahedronVolume",
"return_type": "Real",
"params": [
{
"name": "h",
"type": "const HexaID"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeShapeFunction",
"return_type": "Real",
"params": [
{
"name": "nc",
"type": "const LocalCoord"
},
{
"name": "bi",
"type": "const HexahedronBinaryIndex"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeNodalValue",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "nc",
"type": "const LocalCoord"
},
{
"name": "p",
"type": "const VecCoord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computePositionDerivative",
"return_type": "void",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "nc",
"type": "const LocalCoord"
},
{
"name": "p",
"type": "const VecCoord &"
},
{
"name": "dpos",
"type": "Coord[3]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeJacobian",
"return_type": "Real",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "nc",
"type": "const LocalCoord"
},
{
"name": "p",
"type": "const VecCoord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "isHexahedronAffine",
"return_type": "bool",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "p",
"type": "const VecCoord &"
},
{
"name": "tolerance",
"type": "const Real"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronBarycentricCoeficients",
"return_type": "LocalCoord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "p",
"type": "const Coord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeHexahedronRestBarycentricCoeficients",
"return_type": "LocalCoord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "p",
"type": "const Coord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointPositionInHexahedron",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "baryC",
"type": "const LocalCoord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getRestPointPositionInHexahedron",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "baryC",
"type": "const LocalCoord &"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getPointPositionInHexahedron",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "baryC",
"type": "const Real[3]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getRestPointPositionInHexahedron",
"return_type": "Coord",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "baryC",
"type": "const Real[3]"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findNearestElement",
"return_type": "int",
"params": [
{
"name": "pos",
"type": "const Coord &"
},
{
"name": "baryC",
"type": "LocalCoord &"
},
{
"name": "distance",
"type": "Real &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findNearestElements",
"return_type": "void",
"params": [
{
"name": "pos",
"type": "const VecCoord &"
},
{
"name": "elem",
"type": "int &"
},
{
"name": "baryC",
"type": "int &"
},
{
"name": "dist",
"type": "int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findNearestElementInRestPos",
"return_type": "int",
"params": [
{
"name": "pos",
"type": "const Coord &"
},
{
"name": "baryC",
"type": "LocalCoord &"
},
{
"name": "distance",
"type": "Real &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "findNearestElementsInRestPos",
"return_type": "void",
"params": [
{
"name": "pos",
"type": "const VecCoord &"
},
{
"name": "elem",
"type": "int &"
},
{
"name": "baryC",
"type": "int &"
},
{
"name": "dist",
"type": "int &"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeElementDistanceMeasure",
"return_type": "Real",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "p",
"type": "const Coord"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "computeElementRestDistanceMeasure",
"return_type": "Real",
"params": [
{
"name": "h",
"type": "const HexaID"
},
{
"name": "p",
"type": "const Coord"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getHexahedronNumericalIntegrationDescriptor",
"return_type": "NumericalIntegrationDescriptor<Real, 3> &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "draw",
"return_type": "void",
"params": [
{
"name": "vparams",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "mustComputeBBox",
"return_type": "bool",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
]
},
"desc": {
"description": "The `HexahedronSetGeometryAlgorithms` component is part of the SOFA framework and provides geometry-related information for hexahedral topologies in simulation scenarios. It inherits from `QuadSetGeometryAlgorithms` and specializes in handling operations related to hexahedra, such as computing volumes, barycentric coordinates, positions within elements, and other geometric properties.\n\nThis component interacts with the topology container through methods that retrieve hexahedron data, including positions and connectivity. It also interfaces with numerical integration descriptors for cubature points necessary in finite element calculations. The component can compute various geometric measures such as volumes, centers, barycentric coordinates, and distances between elements.\n\nAdditionally, `HexahedronSetGeometryAlgorithms` includes drawing functions that allow visualization of hexahedral structures and indices, which is useful for debugging and visual inspection. Data fields like `d_showHexaIndices`, `d_drawHexahedra`, `d_drawScaleHexahedra`, and `d_drawColorHexahedra` control the visibility and appearance settings during rendering.\n\nPractical usage includes initializing geometry algorithms, performing geometric calculations on hexahedron sets, and ensuring visualization options are configured as needed."
},
"maths": {
"maths": "### Mathematical and Physical Description of `HexahedronSetGeometryAlgorithms`\n\n#### Governing Equations or Operators Implemented/Contributed to\n\nThe `HexahedronSetGeometryAlgorithms` component in the SOFA framework provides several geometry-related operations for hexahedral elements. These include:\n\n- **Volume Calculation**: Computes volumes of individual hexahedral elements using their nodal coordinates.\n \n \\[ V = \\frac{1}{6} \\left| (\\mathbf{p}_2 - \\mathbf{p}_0) \\cdot ((\\mathbf{p}_3 - \\mathbf{p}_0) \\times (\\mathbf{p}_4 - \\mathbf{p}_0)) \\right| \\]\n where \\( \\mathbf{p}_i \\) are nodal positions.\n\n- **Centroid Calculation**: Computes the centroid of a hexahedral element as an average of all its vertices' coordinates:\n \n \\[ \\mathbf{c} = \\frac{1}{8} \\sum_{i=0}^{7} \\mathbf{p}_i \\]\n\n- **Barycentric Coordinates**: Computes barycentric coordinates for a given point within the hexahedron.\n \n For rest configuration:\n \\[ (\\lambda_1, \\lambda_2, \\lambda_3) = \\mathbf{J}^{-1}(\\mathbf{x} - \\mathbf{p}_0) \\]\n where \\( \\mathbf{J} \\) is the Jacobian matrix formed from edge vectors.\n\n- **Shape Functions**: Computes shape functions for hexahedra, which are used in finite element interpolation.\n \n For a local coordinate \\( (\\xi, \\eta, \\zeta) \\), the shape function at node \\( i \\) is given by:\n \\[ N_i(\\xi, \\eta, \\zeta) = \\frac{1}{8} (1 + l_i^x \\xi)(1 + l_i^y \\eta)(1 + l_i^z \\zeta) \\]\n\n- **Position Derivatives**: Computes derivatives of the position vector with respect to local coordinates.\n \n The Jacobian matrix is given by:\n \\[ J = \\begin{bmatrix}\n \\frac{\\partial x}{\\partial \\xi} & \\frac{\\partial y}{\\partial \\xi} & \\frac{\\partial z}{\\partial \\xi} \\\\\n \\frac{\\partial x}{\\partial \\eta} & \\frac{\\partial y}{\\partial \\eta} & \\frac{\\partial z}{\\partial \\eta} \\\\\n \\frac{\\partial x}{\\partial \\zeta} & \\frac{\\partial y}{\\partial \\zeta} & \\frac{\\partial z}{\\partial \\zeta}\n \\end{bmatrix} \\]\n\n- **Jacobian Calculation**: Computes the determinant of the Jacobian matrix to ensure that the element remains well-defined and non-degenerate.\n\n#### Constitutive or Kinematic Laws Involved\n\nThe component handles kinematic relationships within hexahedra, such as mapping between global coordinates and local coordinates. The barycentric coordinate system is used for interpolation and position determination:\n\n\\[ \\mathbf{x} = \\sum_{i=0}^{7} N_i(\\xi, \\eta, \\zeta) \\mathbf{p}_i \\]\n\nwhere \\( N_i \\) are the shape functions.\n\n#### Role in the Global FEM Pipeline\n\n1. **Mesh and Shape Function Definition**: Provides the geometric properties of hexahedral elements that are essential for defining the shape functions used in spatial discretization.\n2. **Volume Calculation**: Used in assembling volume-related terms, such as mass matrix contributions or integration of internal forces over element volumes.\n3. **Centroid and Barycentric Coordinates**: Useful for various purposes including contact detection and integration points definition within elements.\n4. **Shape Function Evaluation**: Required for interpolating nodal values to any point inside the hexahedron, which is critical during FEM assembly.\n5. **Derivative Computations**: Used in computing gradients of shape functions needed for strain measures in elasticity problems.\n\n#### Numerical Methods or Discretization Choices Encoded\n\n- The component uses numerical integration with Gauss quadrature points to compute integrals over the hexahedron volume, ensuring accurate evaluation of element matrices and vectors.\n- It supports higher-order elements through the definition of shape functions, allowing for more refined discretizations if needed.\n- The methods provided ensure that operations on hexahedral elements are consistent with variational mechanics principles used in FEM formulations.\n\n#### Integration into the Broader Variational/Lagrangian Mechanics Framework\n\nThe `HexahedronSetGeometryAlgorithms` component contributes to the spatial discretization stage of the FEM pipeline by providing geometric information necessary for defining shape functions and calculating elemental contributions (e.g., mass matrix, internal forces). It supports variational formulations by enabling accurate computation of integrals over element volumes and ensuring consistency in kinematic transformations from global to local coordinates. The provided operations ensure that the finite element discretization is physically consistent with the underlying continuum mechanics model."
},
"summary": {
"abstract": "The `HexahedronSetGeometryAlgorithms` component provides geometric information for hexahedral elements in SOFA simulations, including volume calculations, centroid computations, barycentric coordinates, and shape functions.",
"sheet": "# HexahedronSetGeometryAlgorithms\n\n## Overview\n\nThis component is part of the SOFA framework and specializes in providing geometry-related operations for hexahedral topologies. It inherits from `QuadSetGeometryAlgorithms` and handles various geometric computations such as volumes, centers, barycentric coordinates, and shape functions.\n\n## Mathematical Model\n\n### Volume Calculation\nThe volume of a hexahedron is computed using the nodal positions:\n\n\\[ V = \\frac{1}{6} \\left| (\\mathbf{p}_2 - \\mathbf{p}_0) \\cdot ((\\mathbf{p}_3 - \\mathbf{p}_0) \\times (\\mathbf{p}_4 - \\mathbf{p}_0)) \\right| \\]\nwhere \\( \\mathbf{p}_i \\) are the nodal positions.\n\n### Centroid Calculation\nThe centroid of a hexahedron is computed as an average of all its vertices' coordinates:\n\n\\[ \\mathbf{c} = \\frac{1}{8} \\sum_{i=0}^{7} \\mathbf{p}_i \\]\n\n### Barycentric Coordinates\nBarycentric coordinates for a point within the hexahedron are computed as follows:\n\nFor rest configuration:\n\\[ (\\lambda_1, \\lambda_2, \\lambda_3) = \\mathbf{J}^{-1}(\\mathbf{x} - \\mathbf{p}_0) \\]\nwhere \\( \\mathbf{J} \\) is the Jacobian matrix formed from edge vectors.\n\n### Shape Functions\nShape functions for hexahedra are given by:\nFor a local coordinate \\((\\xi, \\eta, \\zeta)\\), the shape function at node \\(i\\) is:\n\\[ N_i(\\xi, \\eta, \\zeta) = \\frac{1}{8} (1 + l_i^x \\xi)(1 + l_i^y \\eta)(1 + l_i^z \\zeta) \\]\n\n### Position Derivatives and Jacobian Calculation\nThe Jacobian matrix is given by:\n\\[ J = \\begin{bmatrix}\n \\frac{\\partial x}{\\partial \\xi} & \\frac{\\partial y}{\\partial \\xi} & \\frac{\\partial z}{\\partial \\xi} \\\\\n \\frac{\\partial x}{\\partial \\eta} & \\frac{\\partial y}{\\partial \\eta} & \\frac{\\partial z}{\\partial \\eta} \\\\\n \\frac{\\partial x}{\\partial \\zeta} & \\frac{\\partial y}{\\partial \\zeta} & \\frac{\\partial z}{\\partial \\zeta}\n \\end{bmatrix} \\]\nThe determinant of the Jacobian matrix ensures that the element remains well-defined and non-degenerate.\n\n## Parameters and Data\n\n- **d_showHexaIndices**: `bool` - Controls whether hexahedron indices are displayed during visualization. Default: `false`\n- **d_drawHexahedra**: `bool` - Controls whether hexahedra are drawn during visualization. Default: `false`\n- **d_drawScaleHexahedra**: `float` - Scales the size of hexahedra for drawing purposes. Default: `1.0`\n- **d_drawColorHexahedra**: `sofa::type::RGBAColor` - Sets the color used to draw hexahedra. Default: `(1, 1, 1, 1)` (white)"
}
}