ExtrudeEdgesAndGenerateQuads
The `ExtrudeEdgesAndGenerateQuads` component in the Sofa framework is designed to extrude a given set of edges along a specified direction and generate quads from these edges. This process involves creating new vertices, edges, and quads based on the input parameters and initial geometry. ### Key Features: - **Extrusion Direction:** The component allows you to specify the direction along which the curve will be extruded using `extrudeDirection` (a vector). - **Thickness Control:** You can control the thickness of the extruded volume with `thicknessIn` and `thicknessOut`, which define the thickness in opposite directions from the normals. - **Number of Sections:** The number of sections or steps for the extrusion is specified using `numberOfSections`. This parameter controls how many segments the curve will be divided into during the extrusion process. ### Inputs: - `curveVertices`: Position coordinates along the initial curve. - `curveEdges`: Indices of the edges of the curve to be extruded. ### Outputs: - `extrudedVertices`: Coordinates of the new vertices created during extrusion. - `extrudedEdges`: List of all edges generated during the extrusion process, including those parallel and orthogonal to the initial curve. - `extrudedQuads`: List of all quads formed by connecting the new and existing edges. ### Initialization: During initialization (`init`), the component sets its internal state as dirty. The `reinit` method ensures that inputs are checked before updating the extrusion process, while `doUpdate` performs the core logic for generating vertices, edges, and quads based on the input parameters. ### Error Handling: The component includes checks to ensure that the initial curve contains both vertices and edges. If these conditions are not met, appropriate warning messages are logged.
- abstract
- Extrudes an edge-based curve into a quad surface patch, generating new vertices, edges, and quads based on specified parameters.
- sheet
- # ExtrudeEdgesAndGenerateQuads ## Overview The `ExtrudeEdgesAndGenerateQuads` engine in the Sofa framework extrudes an edge-based curve into a quad surface patch. It generates new vertices, edges, and quads based on input parameters such as direction vector, thicknesses, and number of sections. ## Mathematical Model The process involves calculating displacements along the specified direction vector to generate new vertices at each step. The extrusion is controlled by the following parameters: - **Extrusion Direction**: $oldsymbol{d}$ (normalized) - **Thickness Parameters**: $t_{in}$ and $t_{out}$ - **Number of Sections**: $N$ ### Vertex Displacement For each vertex $v_i$ in the curve, its new position at step $k$ ($0 \leq k \leq N$) is calculated as: \[ v_{i,k} = v_i + (t_{in}\hat{\boldsymbol{d}} + ks\hat{\boldsymbol{d}}) \] where \[ s = \frac{(t_{in} + t_{out})}{N} \] and $\hat{\boldsymbol{d}}$ is the normalized direction vector. ### Edge Generation - **Parallel Edges**: Connect each original edge within the same section: \[ E_{i,k} = (v_{i,k}, v_{j,k}) \quad \text{for all } e_k = (v_i, v_j) \] - **Orthogonal Edges**: Connect corresponding vertices across different sections: \[ E^{orth}_{i,k} = (v_{i,k}, v_{i,k+1}) \quad \text{for all } i, k=0,\dots,N-1 \] ### Quad Generation Each quad is defined by four vertices at step $k$: \[ Q_{i,k} = (v_{i,k}, v_{j,k}, v_{j,k+1}, v_{i,k+1}) \quad \text{for all } e_i = (v_i, v_j) \] The set of all quads is: \[ Q_e = \bigcup_{k=0}^{N-1} \{ Q_{i,k}, i = 1,\dots,m \} \] ## Parameters and Data The significant Data fields exposed by the component are as follows: - **extrudeDirection**: Direction along which to extrude the curve (type: Coord) - **thicknessIn**: Thickness of the extruded volume in the opposite direction of the normals (type: Real) - **thicknessOut**: Thickness of the extruded volume in the direction of the normals (type: Real) - **numberOfSections**: Number of sections / steps in the extrusion (type: int) - **curveVertices**: Position coordinates along the initial curve (type: VecCoord) - **extrudedVertices**: Coordinates of the extruded vertices (type: VecCoord)
- description
- The `ExtrudeEdgesAndGenerateQuads` component in the Sofa framework is designed to extrude a given set of edges along a specified direction and generate quads from these edges. This process involves creating new vertices, edges, and quads based on the input parameters and initial geometry. ### Key Features: - **Extrusion Direction:** The component allows you to specify the direction along which the curve will be extruded using `extrudeDirection` (a vector). - **Thickness Control:** You can control the thickness of the extruded volume with `thicknessIn` and `thicknessOut`, which define the thickness in opposite directions from the normals. - **Number of Sections:** The number of sections or steps for the extrusion is specified using `numberOfSections`. This parameter controls how many segments the curve will be divided into during the extrusion process. ### Inputs: - `curveVertices`: Position coordinates along the initial curve. - `curveEdges`: Indices of the edges of the curve to be extruded. ### Outputs: - `extrudedVertices`: Coordinates of the new vertices created during extrusion. - `extrudedEdges`: List of all edges generated during the extrusion process, including those parallel and orthogonal to the initial curve. - `extrudedQuads`: List of all quads formed by connecting the new and existing edges. ### Initialization: During initialization (`init`), the component sets its internal state as dirty. The `reinit` method ensures that inputs are checked before updating the extrusion process, while `doUpdate` performs the core logic for generating vertices, edges, and quads based on the input parameters. ### Error Handling: The component includes checks to ensure that the initial curve contains both vertices and edges. If these conditions are not met, appropriate warning messages are logged.
- maths
- <h2>Description</h2> <p>The <code>ExtrudeEdgesAndGenerateQuads</code> component in the Sofa framework is designed to extrude a given set of edges along a specified direction and generate quads from these edges. This process involves creating new vertices, edges, and quads based on the input parameters and initial geometry.</p> <h3>Key Features:</h3> <ul> <li><strong>Extrusion Direction</strong>: The component allows you to specify the direction along which the curve will be extruded using an extrudeDirection vector (denoted as $\mathbf{d}$).</li> <li><strong>Thickness Control</strong>: You can control the thickness of the extruded volume with two parameters: <code>thicknessIn</code> ($t_{in}$) and <code>thicknessOut</code> ($t_{out}$), which define the thickness in opposite directions from the normals.</li> <li><strong>Number of Sections</strong>: The number of sections or steps for the extrusion is specified using <code>numberOfSections</code> (denoted as $N$). This parameter controls how many segments the curve will be divided into during the extrusion process.</li> </ul> <h3>Inputs:</h3> <ul> <li><strong>Curve Vertices ($V_c$)</strong>: The position coordinates along the initial curve. These are represented as a set of vertices $\{v_1, v_2, \dots, v_n\}$ where each vertex $v_i = (x_i, y_i, z_i)$.</li> <li><strong>Curve Edges ($E_c$)</strong>: The indices of the edges connecting these vertices. These are represented as a set of pairs $(i, j)$ indicating an edge between vertices $v_i$ and $v_j$. Each edge can be denoted as $e_k = (v_{i_k}, v_{j_k})$.</li> </ul> <h3>Outputs:</h3> <ul> <li><strong>Extruded Vertices ($V_e$)</strong>: Coordinates of the new vertices created during extrusion. These are computed by displacing each vertex along the direction vector and scaling it according to the number of sections.</li> <li><strong>Extruded Edges ($E_e$)</strong>: List of all edges generated during the extrusion process, including those parallel and orthogonal to the initial curve. The parallel edges connect vertices within the same section along the curve, while the orthogonal edges connect corresponding vertices across different sections.</li> <li><strong>Extruded Quads ($Q_e$)</strong>: List of all quads formed by connecting the new and existing edges. Each quad is a set of four vertices that form a planar surface in the extruded mesh.</li> </ul> <h3>Mathematical Details:</h3> <p>The process of generating new vertices involves calculating displacements based on the specified direction vector $\mathbf{d}$ and thickness parameters. The displacement at each step is calculated as follows:</p> <ol> <li><strong>Normalize Direction Vector</strong>: Normalize the extrusion direction vector $\mathbf{d} = (d_x, d_y, d_z)$ to get a unit vector. \[ \hat{\mathbf{d}} = \frac{\mathbf{d}}{\|\mathbf{d}\|} \] </li> <li><strong>Step Displacement</strong>: Calculate the displacement step size based on the total thickness and number of sections. \[ s = \frac{(t_{in} + t_{out})}{N} \] </li> <li><strong>New Vertex Position</strong>: For each vertex $v_i$ in the curve, calculate its new position at step $k$ ($0 \leq k \leq N$) by displacing it along the direction vector. \[ v_{i,k} = v_i + (t_{in}\hat{\mathbf{d}} + ks\hat{\mathbf{d}}) \] </li> </ol> <p>The new vertices $V_e$ are thus a set of positions calculated for each original vertex at different steps along the extrusion direction:</p> <blockquote> <pre>$$ V_e = \bigcup_{k=0}^N \{ v_{i,k}, i = 1,\dots,n \} $$</pre> </blockquote> <p>The new edges $E_e$ are formed by connecting these vertices in a structured manner:</p> <ol> <li><strong>Parallel Edges ($E_p$)</strong>: Connect each original edge within the same section. \[ E_{i,k} = (v_{i,k}, v_{j,k}) \quad \text{for all } e_k = (v_i, v_j) \] </li> <li><strong>Orthogonal Edges ($E_o$)</strong>: Connect corresponding vertices across different sections. \[ E^{orth}_{i,k} = (v_{i,k}, v_{i,k+1}) \quad \text{for all } i, k=0,\dots,N-1 \] </li> </ol> <p>The extruded edges are thus the union of parallel and orthogonal edges:</p> <blockquote> <pre>$$ E_e = E_p \cup E_o $$</pre> </blockquote> <p>Finally, quads $Q_e$ are formed by connecting four vertices from adjacent edges. For each edge in the original mesh, a quad is created for each section:</p> <ol> <li><strong>Quad Generation ($Q_k$)</strong>: Each quad is defined by four vertices at step $k$. \[ Q_{i,k} = (v_{i,k}, v_{j,k}, v_{j,k+1}, v_{i,k+1}) \quad \text{for all } e_i = (v_i, v_j) \] </li> </ol> <p>The set of all quads is:</p> <blockquote> <pre>$$ Q_e = \bigcup_{k=0}^{N-1} \{ Q_{i,k}, i = 1,\dots,m \} $$</pre> </blockquote> <p>In summary, the component performs a structured extrusion process to generate new vertices, edges, and quads based on the specified direction vector, thickness parameters, and number of sections. The resulting geometry is a volumetric mesh that extends along the given curve.</p>
{
"name": "ExtrudeEdgesAndGenerateQuads",
"main": {
"name": "ExtrudeEdgesAndGenerateQuads",
"namespace": "sofa::component::engine::generate",
"module": "Sofa.Component.Engine.Generate",
"include": "sofa/component/engine/generate/ExtrudeEdgesAndGenerateQuads.h",
"doc": "Engine extruding an edge-based curve into a quad surface patch.\n\nThis engine extrudes an edge-based curve into a quad surface patch",
"inherits": [
"DataEngine"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "d_direction",
"type": "Coord",
"xmlname": "extrudeDirection",
"help": "Direction along which to extrude the curve"
},
{
"name": "d_thickness",
"type": "Real"
},
{
"name": "d_thicknessIn",
"type": "Real",
"xmlname": "thicknessIn",
"help": "Thickness of the extruded volume in the opposite direction of the normals"
},
{
"name": "d_thicknessOut",
"type": "Real",
"xmlname": "thicknessOut",
"help": "Thickness of the extruded volume in the direction of the normals"
},
{
"name": "d_nbSections",
"type": "int",
"xmlname": "numberOfSections",
"help": "Number of sections / steps in the extrusion"
},
{
"name": "d_curveVertices",
"type": "VecCoord",
"xmlname": "curveVertices",
"help": "Position coordinates along the initial curve"
},
{
"name": "d_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": "checkInput",
"return_type": "void",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "protected"
}
]
},
"desc": {
"description": "The `ExtrudeEdgesAndGenerateQuads` component in the Sofa framework is designed to extrude a given set of edges along a specified direction and generate quads from these edges. This process involves creating new vertices, edges, and quads based on the input parameters and initial geometry.\n\n### Key Features:\n- **Extrusion Direction:** The component allows you to specify the direction along which the curve will be extruded using `extrudeDirection` (a vector).\n- **Thickness Control:** You can control the thickness of the extruded volume with `thicknessIn` and `thicknessOut`, which define the thickness in opposite directions from the normals.\n- **Number of Sections:** The number of sections or steps for the extrusion is specified using `numberOfSections`. This parameter controls how many segments the curve will be divided into during the extrusion process.\n\n### Inputs:\n- `curveVertices`: Position coordinates along the initial curve.\n- `curveEdges`: Indices of the edges of the curve to be extruded.\n\n### Outputs:\n- `extrudedVertices`: Coordinates of the new vertices created during extrusion.\n- `extrudedEdges`: List of all edges generated during the extrusion process, including those parallel and orthogonal to the initial curve.\n- `extrudedQuads`: List of all quads formed by connecting the new and existing edges.\n\n### Initialization:\nDuring initialization (`init`), the component sets its internal state as dirty. The `reinit` method ensures that inputs are checked before updating the extrusion process, while `doUpdate` performs the core logic for generating vertices, edges, and quads based on the input parameters.\n\n### Error Handling:\nThe component includes checks to ensure that the initial curve contains both vertices and edges. If these conditions are not met, appropriate warning messages are logged."
},
"maths": {
"maths": "<h2>Description</h2>\n\n<p>The <code>ExtrudeEdgesAndGenerateQuads</code> component in the Sofa framework is designed to extrude a given set of edges along a specified direction and generate quads from these edges. This process involves creating new vertices, edges, and quads based on the input parameters and initial geometry.</p>\n\n<h3>Key Features:</h3>\n\n<ul>\n <li><strong>Extrusion Direction</strong>: The component allows you to specify the direction along which the curve will be extruded using an extrudeDirection vector (denoted as $\\mathbf{d}$).</li>\n <li><strong>Thickness Control</strong>: You can control the thickness of the extruded volume with two parameters: <code>thicknessIn</code> ($t_{in}$) and <code>thicknessOut</code> ($t_{out}$), which define the thickness in opposite directions from the normals.</li>\n <li><strong>Number of Sections</strong>: The number of sections or steps for the extrusion is specified using <code>numberOfSections</code> (denoted as $N$). This parameter controls how many segments the curve will be divided into during the extrusion process.</li>\n</ul>\n\n<h3>Inputs:</h3>\n\n<ul>\n <li><strong>Curve Vertices ($V_c$)</strong>: The position coordinates along the initial curve. These are represented as a set of vertices $\\{v_1, v_2, \\dots, v_n\\}$ where each vertex $v_i = (x_i, y_i, z_i)$.</li>\n <li><strong>Curve Edges ($E_c$)</strong>: The indices of the edges connecting these vertices. These are represented as a set of pairs $(i, j)$ indicating an edge between vertices $v_i$ and $v_j$. Each edge can be denoted as $e_k = (v_{i_k}, v_{j_k})$.</li>\n</ul>\n\n<h3>Outputs:</h3>\n\n<ul>\n <li><strong>Extruded Vertices ($V_e$)</strong>: Coordinates of the new vertices created during extrusion. These are computed by displacing each vertex along the direction vector and scaling it according to the number of sections.</li>\n <li><strong>Extruded Edges ($E_e$)</strong>: List of all edges generated during the extrusion process, including those parallel and orthogonal to the initial curve. The parallel edges connect vertices within the same section along the curve, while the orthogonal edges connect corresponding vertices across different sections.</li>\n <li><strong>Extruded Quads ($Q_e$)</strong>: List of all quads formed by connecting the new and existing edges. Each quad is a set of four vertices that form a planar surface in the extruded mesh.</li>\n</ul>\n\n<h3>Mathematical Details:</h3>\n\n<p>The process of generating new vertices involves calculating displacements based on the specified direction vector $\\mathbf{d}$ and thickness parameters. The displacement at each step is calculated as follows:</p>\n\n<ol>\n <li><strong>Normalize Direction Vector</strong>: Normalize the extrusion direction vector $\\mathbf{d} = (d_x, d_y, d_z)$ to get a unit vector.\n \\[ \\hat{\\mathbf{d}} = \\frac{\\mathbf{d}}{\\|\\mathbf{d}\\|} \\]\n </li>\n\n <li><strong>Step Displacement</strong>: Calculate the displacement step size based on the total thickness and number of sections.\n \\[ s = \\frac{(t_{in} + t_{out})}{N} \\]\n </li>\n\n <li><strong>New Vertex Position</strong>: For each vertex $v_i$ in the curve, calculate its new position at step $k$ ($0 \\leq k \\leq N$) by displacing it along the direction vector.\n \\[ v_{i,k} = v_i + (t_{in}\\hat{\\mathbf{d}} + ks\\hat{\\mathbf{d}}) \\]\n </li>\n</ol>\n\n<p>The new vertices $V_e$ are thus a set of positions calculated for each original vertex at different steps along the extrusion direction:</p>\n\n<blockquote>\n <pre>$$\nV_e = \\bigcup_{k=0}^N \\{ v_{i,k}, i = 1,\\dots,n \\}\n$$</pre>\n</blockquote>\n\n<p>The new edges $E_e$ are formed by connecting these vertices in a structured manner:</p>\n\n<ol>\n <li><strong>Parallel Edges ($E_p$)</strong>: Connect each original edge within the same section.\n \\[ E_{i,k} = (v_{i,k}, v_{j,k}) \\quad \\text{for all } e_k = (v_i, v_j) \\]\n </li>\n\n <li><strong>Orthogonal Edges ($E_o$)</strong>: Connect corresponding vertices across different sections.\n \\[ E^{orth}_{i,k} = (v_{i,k}, v_{i,k+1}) \\quad \\text{for all } i, k=0,\\dots,N-1 \\]\n </li>\n</ol>\n\n<p>The extruded edges are thus the union of parallel and orthogonal edges:</p>\n\n<blockquote>\n <pre>$$\nE_e = E_p \\cup E_o\n$$</pre>\n</blockquote>\n\n<p>Finally, quads $Q_e$ are formed by connecting four vertices from adjacent edges. For each edge in the original mesh, a quad is created for each section:</p>\n\n<ol>\n <li><strong>Quad Generation ($Q_k$)</strong>: Each quad is defined by four vertices at step $k$.\n \\[ Q_{i,k} = (v_{i,k}, v_{j,k}, v_{j,k+1}, v_{i,k+1}) \\quad \\text{for all } e_i = (v_i, v_j) \\]\n </li>\n</ol>\n\n<p>The set of all quads is:</p>\n\n<blockquote>\n <pre>$$\nQ_e = \\bigcup_{k=0}^{N-1} \\{ Q_{i,k}, i = 1,\\dots,m \\}\n$$</pre>\n</blockquote>\n\n<p>In summary, the component performs a structured extrusion process to generate new vertices, edges, and quads based on the specified direction vector, thickness parameters, and number of sections. The resulting geometry is a volumetric mesh that extends along the given curve.</p>"
},
"summary": {
"abstract": "Extrudes an edge-based curve into a quad surface patch, generating new vertices, edges, and quads based on specified parameters.",
"sheet": "# ExtrudeEdgesAndGenerateQuads\n\n## Overview\nThe `ExtrudeEdgesAndGenerateQuads` engine in the Sofa framework extrudes an edge-based curve into a quad surface patch. It generates new vertices, edges, and quads based on input parameters such as direction vector, thicknesses, and number of sections.\n\n## Mathematical Model\nThe process involves calculating displacements along the specified direction vector to generate new vertices at each step. The extrusion is controlled by the following parameters:\n- **Extrusion Direction**: $\boldsymbol{d}$ (normalized)\n- **Thickness Parameters**: $t_{in}$ and $t_{out}$\n- **Number of Sections**: $N$\n\n### Vertex Displacement\nFor each vertex $v_i$ in the curve, its new position at step $k$ ($0 \\leq k \\leq N$) is calculated as:\n\\[ v_{i,k} = v_i + (t_{in}\\hat{\\boldsymbol{d}} + ks\\hat{\\boldsymbol{d}}) \\]\nwhere\n\\[ s = \\frac{(t_{in} + t_{out})}{N} \\]\nand $\\hat{\\boldsymbol{d}}$ is the normalized direction vector.\n\n### Edge Generation\n- **Parallel Edges**: Connect each original edge within the same section:\n \\[ E_{i,k} = (v_{i,k}, v_{j,k}) \\quad \\text{for all } e_k = (v_i, v_j) \\]\n- **Orthogonal Edges**: Connect corresponding vertices across different sections:\n \\[ E^{orth}_{i,k} = (v_{i,k}, v_{i,k+1}) \\quad \\text{for all } i, k=0,\\dots,N-1 \\]\n\n### Quad Generation\nEach quad is defined by four vertices at step $k$:\n\\[ Q_{i,k} = (v_{i,k}, v_{j,k}, v_{j,k+1}, v_{i,k+1}) \\quad \\text{for all } e_i = (v_i, v_j) \\]\nThe set of all quads is:\n\\[ Q_e = \\bigcup_{k=0}^{N-1} \\{ Q_{i,k}, i = 1,\\dots,m \\} \\]\n\n## Parameters and Data\nThe significant Data fields exposed by the component are as follows:\n- **extrudeDirection**: Direction along which to extrude the curve (type: Coord)\n- **thicknessIn**: Thickness of the extruded volume in the opposite direction of the normals (type: Real)\n- **thicknessOut**: Thickness of the extruded volume in the direction of the normals (type: Real)\n- **numberOfSections**: Number of sections / steps in the extrusion (type: int)\n- **curveVertices**: Position coordinates along the initial curve (type: VecCoord)\n- **extrudedVertices**: Coordinates of the extruded vertices (type: VecCoord)"
}
}