ExtrudeQuadsAndGenerateHexas
The `ExtrudeQuadsAndGenerateHexas` component in the SOFA framework is designed to extrude a quad-based surface into a set of hexahedral elements, allowing for the creation of complex geometries from simpler quad surfaces. This class inherits from `DataEngine`, which suggests it operates as part of SOFA's scene graph and handles data processing tasks. The component takes a quad mesh as input and generates a solid volume by extruding this surface into hexahedra (hexas). It allows users to specify various parameters such as the thickness in different directions, scaling factors, number of slices for the extrusion process, and whether to flip normals during creation. This makes it highly flexible for generating volumetric meshes from 2D surfaces. The component interacts with other SOFA components by providing input and output data fields. The primary inputs are `surfaceVertices` (position coordinates of the surface) and `f_surfaceQuads` (indices of quads). Outputs include `extrudedVertices`, `extrudedSurfaceQuads`, `extrudedQuads`, and `extrudedHexas`. These outputs can be connected to other components for further processing or visualization. Key data fields are: - `isVisible`: Determines whether the generated mesh is visible during rendering. - `f_scale`: Applies a scaling factor to the extruded mesh. - `f_thicknessIn` and `f_thicknessOut`: Specify thicknesses in opposite and normal directions, respectively. - `f_numberOfSlices`: Specifies the number of slices/steps for the extrusion process. - `f_flipNormals`: Inverts point order when creating hexahedra if set to true.
- abstract
- The `ExtrudeQuadsAndGenerateHexas` component extrudes quad-based surfaces into hexahedral elements using specified thicknesses, scaling factors, and number of slices. It handles normal calculations and vertex extrusions to generate volumetric meshes from 2D surfaces.
- sheet
- # ExtrudeQuadsAndGenerateHexas ## Overview The `ExtrudeQuadsAndGenerateHexas` component is an engine that extrudes quad-based surfaces into hexahedral elements, enabling the creation of complex geometries. It inherits from `DataEngine`, indicating its role in data processing within SOFA's scene graph. ## Mathematical Model The process involves several key steps: computing normals at each vertex and generating new vertices based on these normals and user-defined parameters. 1. **Normal Calculation**: - For each quad, a normal vector is computed as follows: $$( ext{normal} = \frac{V_2 - V_0}{\|V_2 - V_0\|} \times \frac{V_3 - V_0}{\|V_3 - V_0\|})$$ - This normal is then averaged for each vertex to account for shared vertices among multiple quads. 2. **Vertex Extrusion**: - The new position for each vertex after extruding it by a certain distance along its normal can be computed as follows: $$(\text{New Position} = V_i + d \cdot n_i)$$ - The displacement `d` for a given slice index `n` (ranging from 0 to `f_numberOfSlices`) is calculated as: $$d = -f_{\text{thicknessIn}} + n \cdot \left(\frac{f_{\text{thicknessOut}} + f_{\text{thicknessIn}}}{f_{\text{numberOfSlices}} + 1}\right)$$ - After scaling, the final extruded vertex position is: $$(V_i' = (V_i[0] \cdot f_{\text{scale}[0]}, V_i[1] \cdot f_{\text{scale}[1]}, V_i[2] \cdot f_{\text{scale}[2]}) + d \cdot n_i)$$ ## Parameters and Data The significant data fields exposed by the component are: - `isVisible`: Determines whether the generated mesh is visible during rendering. - `f_scale`: Applies a scaling factor to the extruded mesh. - `f_thicknessIn` and `f_thicknessOut`: Specify thicknesses in opposite and normal directions, respectively. - `f_numberOfSlices`: Specifies the number of slices/steps for the extrusion process. - `f_flipNormals`: Inverts point order when creating hexahedra if set to true.
- description
- The `ExtrudeQuadsAndGenerateHexas` component in the SOFA framework is designed to extrude a quad-based surface into a set of hexahedral elements, allowing for the creation of complex geometries from simpler quad surfaces. This class inherits from `DataEngine`, which suggests it operates as part of SOFA's scene graph and handles data processing tasks. The component takes a quad mesh as input and generates a solid volume by extruding this surface into hexahedra (hexas). It allows users to specify various parameters such as the thickness in different directions, scaling factors, number of slices for the extrusion process, and whether to flip normals during creation. This makes it highly flexible for generating volumetric meshes from 2D surfaces. The component interacts with other SOFA components by providing input and output data fields. The primary inputs are `surfaceVertices` (position coordinates of the surface) and `f_surfaceQuads` (indices of quads). Outputs include `extrudedVertices`, `extrudedSurfaceQuads`, `extrudedQuads`, and `extrudedHexas`. These outputs can be connected to other components for further processing or visualization. Key data fields are: - `isVisible`: Determines whether the generated mesh is visible during rendering. - `f_scale`: Applies a scaling factor to the extruded mesh. - `f_thicknessIn` and `f_thicknessOut`: Specify thicknesses in opposite and normal directions, respectively. - `f_numberOfSlices`: Specifies the number of slices/steps for the extrusion process. - `f_flipNormals`: Inverts point order when creating hexahedra if set to true.
- maths
- # Mathematical and Physical Description of ExtrudeQuadsAndGenerateHexas Component ## Overview The `ExtrudeQuadsAndGenerateHexas` component is designed to extrude a given quad-based surface into a set of hexahedral (hex) elements, effectively creating a volumetric mesh from a 2D surface. The process involves several key steps: computing the normals at each vertex, generating new vertices based on these normals and user-defined parameters, and constructing the topology for both the quads and hexes. ## Key Parameters - **Thickness**: Defined by `f_thicknessIn` (inward thickness) and `f_thicknessOut` (outward thickness). - **Scaling Factor**: Defined by `f_scale`, which scales the vertices in each dimension independently. - **Number of Slices**: Given by `f_numberOfSlices`, indicating how many intermediate slices to create along the extrusion direction. ## Normal Calculation and Vertex Extrusion 1. **Normal Calculation**: - For each quad, a normal vector is computed as follows: $$ n = \frac{V_2 - V_0} {\|V_2 - V_0\|} \times \frac{V_3 - V_0} {\|V_3 - V_0\|} $$(where `V_i` are the vertices of the quad). - This normal is then averaged for each vertex to account for shared vertices among multiple quads. 2. **Vertex Extrusion**: - The new position for each vertex after extruding it by a certain distance along its normal can be computed as follows: $$ \text{New Position} = V_i + d \cdot n_i $$(where `V_i` is the original vertex, `d` is the displacement, and `n_i` is the normalized normal). - The displacement `d` for a given slice index `n` (ranging from 0 to `f_numberOfSlices`) can be calculated as: $$ d = -f_{\text{thicknessIn}} + n \cdot \left(\frac{f_{\text{thicknessOut}} + f_{\text{thicknessIn}}} {f_{\text{numberOfSlices}} + 1}\right) $$(normalized by the number of slices). - After scaling, the final extruded vertex position is: $$ V_i' = (V_i[0] \cdot f_{\text{scale}[0]}, V_i[1] \cdot f_{\text{scale}[1]}, V_i[2] \cdot f_{\text{scale}[2]}) + d \cdot n_i $$(where `f_scale` is a vector of scaling factors for each dimension). ## Topology Generation - **Surface Quads**: The original quads are replicated at the outer and inner surfaces. - Outer surface: Original quad indices remain unchanged. - Inner surface: Indices shifted by the number of slices, reflecting inward extrusion. - **Intermediate Quads**: Additional quads are generated between each pair of successive layers to connect the surfaces. - **Hexahedra (Hexas)**: These are constructed from sets of four quads that form a closed volume. The order of vertices in each hex can be flipped based on the `f_flipNormals` flag, ensuring consistent orientation. ## Algorithm Summary 1. Compute normals for each vertex by averaging across all incident quads. 2. Extrude each vertex along its normal according to user-defined parameters and scaling factors. 3. Generate new vertices for each slice from 0 to `f_numberOfSlices`. 4. Create topology for extruded surface (quads) and volume (hexes), ensuring proper orientation and connectivity. ## Conclusion The `ExtrudeQuadsAndGenerateHexas` component leverages these mathematical principles to transform a quad-based surface into a volumetric mesh, enabling the creation of complex geometries with controlled parameters. The resulting hexahedral elements are suitable for various applications in simulation, visualization, and further geometric processing.
{
"name": "ExtrudeQuadsAndGenerateHexas",
"main": {
"name": "ExtrudeQuadsAndGenerateHexas",
"namespace": "sofa::component::engine::generate",
"module": "Sofa.Component.Engine.Generate",
"include": "sofa/component/engine/generate/ExtrudeQuadsAndGenerateHexas.h",
"doc": "Engine extruding a quad-based surface into a set of hexahedral elements.\n\nThis class extrudes a quad surface into a set of hexahedra",
"inherits": [
"DataEngine"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "isVisible",
"type": "bool",
"xmlname": "isVisible",
"help": "is Visible ?"
},
{
"name": "f_scale",
"type": "Coord",
"xmlname": "scale",
"help": "Apply a scaling factor to the extruded mesh"
},
{
"name": "f_thickness",
"type": "Real"
},
{
"name": "f_thicknessIn",
"type": "Real",
"xmlname": "thicknessIn",
"help": "Thickness of the extruded volume in the opposite direction of the normals"
},
{
"name": "f_thicknessOut",
"type": "Real",
"xmlname": "thicknessOut",
"help": "Thickness of the extruded volume in the direction of the normals"
},
{
"name": "f_numberOfSlices",
"type": "int",
"xmlname": "numberOfSlices",
"help": "Number of slices / steps in the extrusion"
},
{
"name": "f_flipNormals",
"type": "bool",
"xmlname": "flipNormals",
"help": "If true, will inverse point order when creating hexa"
},
{
"name": "f_surfaceVertices",
"type": "VecCoord",
"xmlname": "surfaceVertices",
"help": "Position coordinates of the surface"
},
{
"name": "f_extrudedVertices",
"type": "VecCoord",
"xmlname": "extrudedVertices",
"help": "Coordinates of the extruded vertices"
}
],
"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": "",
"type": "const core::visual::VisualParams *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `ExtrudeQuadsAndGenerateHexas` component in the SOFA framework is designed to extrude a quad-based surface into a set of hexahedral elements, allowing for the creation of complex geometries from simpler quad surfaces. This class inherits from `DataEngine`, which suggests it operates as part of SOFA's scene graph and handles data processing tasks.\n\nThe component takes a quad mesh as input and generates a solid volume by extruding this surface into hexahedra (hexas). It allows users to specify various parameters such as the thickness in different directions, scaling factors, number of slices for the extrusion process, and whether to flip normals during creation. This makes it highly flexible for generating volumetric meshes from 2D surfaces.\n\nThe component interacts with other SOFA components by providing input and output data fields. The primary inputs are `surfaceVertices` (position coordinates of the surface) and `f_surfaceQuads` (indices of quads). Outputs include `extrudedVertices`, `extrudedSurfaceQuads`, `extrudedQuads`, and `extrudedHexas`. These outputs can be connected to other components for further processing or visualization.\n\nKey data fields are:\n- `isVisible`: Determines whether the generated mesh is visible during rendering.\n- `f_scale`: Applies a scaling factor to the extruded mesh.\n- `f_thicknessIn` and `f_thicknessOut`: Specify thicknesses in opposite and normal directions, respectively.\n- `f_numberOfSlices`: Specifies the number of slices/steps for the extrusion process.\n- `f_flipNormals`: Inverts point order when creating hexahedra if set to true."
},
"maths": {
"maths": "# Mathematical and Physical Description of ExtrudeQuadsAndGenerateHexas Component\n\n## Overview\nThe `ExtrudeQuadsAndGenerateHexas` component is designed to extrude a given quad-based surface into a set of hexahedral (hex) elements, effectively creating a volumetric mesh from a 2D surface. The process involves several key steps: computing the normals at each vertex, generating new vertices based on these normals and user-defined parameters, and constructing the topology for both the quads and hexes.\n\n## Key Parameters\n- **Thickness**: Defined by `f_thicknessIn` (inward thickness) and `f_thicknessOut` (outward thickness).\n- **Scaling Factor**: Defined by `f_scale`, which scales the vertices in each dimension independently.\n- **Number of Slices**: Given by `f_numberOfSlices`, indicating how many intermediate slices to create along the extrusion direction.\n\n## Normal Calculation and Vertex Extrusion\n1. **Normal Calculation**:\n - For each quad, a normal vector is computed as follows:\n $$\n n = \\frac{V_2 - V_0} {\\|V_2 - V_0\\|} \\times \\frac{V_3 - V_0} {\\|V_3 - V_0\\|}\n $$(where `V_i` are the vertices of the quad).\n - This normal is then averaged for each vertex to account for shared vertices among multiple quads.\n\n2. **Vertex Extrusion**:\n - The new position for each vertex after extruding it by a certain distance along its normal can be computed as follows:\n $$\n \\text{New Position} = V_i + d \\cdot n_i\n $$(where `V_i` is the original vertex, `d` is the displacement, and `n_i` is the normalized normal).\n - The displacement `d` for a given slice index `n` (ranging from 0 to `f_numberOfSlices`) can be calculated as:\n $$\n d = -f_{\\text{thicknessIn}} + n \\cdot \\left(\\frac{f_{\\text{thicknessOut}} + f_{\\text{thicknessIn}}} {f_{\\text{numberOfSlices}} + 1}\\right)\n $$(normalized by the number of slices).\n - After scaling, the final extruded vertex position is:\n $$\n V_i' = (V_i[0] \\cdot f_{\\text{scale}[0]}, V_i[1] \\cdot f_{\\text{scale}[1]}, V_i[2] \\cdot f_{\\text{scale}[2]}) + d \\cdot n_i\n $$(where `f_scale` is a vector of scaling factors for each dimension).\n\n## Topology Generation\n- **Surface Quads**: The original quads are replicated at the outer and inner surfaces.\n - Outer surface: Original quad indices remain unchanged.\n - Inner surface: Indices shifted by the number of slices, reflecting inward extrusion.\n- **Intermediate Quads**: Additional quads are generated between each pair of successive layers to connect the surfaces.\n- **Hexahedra (Hexas)**: These are constructed from sets of four quads that form a closed volume. The order of vertices in each hex can be flipped based on the `f_flipNormals` flag, ensuring consistent orientation.\n\n## Algorithm Summary\n1. Compute normals for each vertex by averaging across all incident quads.\n2. Extrude each vertex along its normal according to user-defined parameters and scaling factors.\n3. Generate new vertices for each slice from 0 to `f_numberOfSlices`.\n4. Create topology for extruded surface (quads) and volume (hexes), ensuring proper orientation and connectivity.\n\n## Conclusion\nThe `ExtrudeQuadsAndGenerateHexas` component leverages these mathematical principles to transform a quad-based surface into a volumetric mesh, enabling the creation of complex geometries with controlled parameters. The resulting hexahedral elements are suitable for various applications in simulation, visualization, and further geometric processing."
},
"summary": {
"abstract": "The `ExtrudeQuadsAndGenerateHexas` component extrudes quad-based surfaces into hexahedral elements using specified thicknesses, scaling factors, and number of slices. It handles normal calculations and vertex extrusions to generate volumetric meshes from 2D surfaces.",
"sheet": "# ExtrudeQuadsAndGenerateHexas\n\n## Overview\nThe `ExtrudeQuadsAndGenerateHexas` component is an engine that extrudes quad-based surfaces into hexahedral elements, enabling the creation of complex geometries. It inherits from `DataEngine`, indicating its role in data processing within SOFA's scene graph.\n\n## Mathematical Model\nThe process involves several key steps: computing normals at each vertex and generating new vertices based on these normals and user-defined parameters.\n\n1. **Normal Calculation**:\n - For each quad, a normal vector is computed as follows:\n $$(\text{normal} = \\frac{V_2 - V_0}{\\|V_2 - V_0\\|} \\times \\frac{V_3 - V_0}{\\|V_3 - V_0\\|})$$\n - This normal is then averaged for each vertex to account for shared vertices among multiple quads.\n\n2. **Vertex Extrusion**:\n - The new position for each vertex after extruding it by a certain distance along its normal can be computed as follows:\n $$(\\text{New Position} = V_i + d \\cdot n_i)$$\n - The displacement `d` for a given slice index `n` (ranging from 0 to `f_numberOfSlices`) is calculated as:\n $$d = -f_{\\text{thicknessIn}} + n \\cdot \\left(\\frac{f_{\\text{thicknessOut}} + f_{\\text{thicknessIn}}}{f_{\\text{numberOfSlices}} + 1}\\right)$$\n - After scaling, the final extruded vertex position is:\n $$(V_i' = (V_i[0] \\cdot f_{\\text{scale}[0]}, V_i[1] \\cdot f_{\\text{scale}[1]}, V_i[2] \\cdot f_{\\text{scale}[2]}) + d \\cdot n_i)$$\n\n## Parameters and Data\nThe significant data fields exposed by the component are:\n- `isVisible`: Determines whether the generated mesh is visible during rendering.\n- `f_scale`: Applies a scaling factor to the extruded mesh.\n- `f_thicknessIn` and `f_thicknessOut`: Specify thicknesses in opposite and normal directions, respectively.\n- `f_numberOfSlices`: Specifies the number of slices/steps for the extrusion process.\n- `f_flipNormals`: Inverts point order when creating hexahedra if set to true."
}
}