MeshClosingEngine
Close a given mesh. This class closes a triangle mesh and provides : - a closed mesh (position, and triangles) - a index list of closing points (in closed mesh) - a mesh of the closing (position, and triangles) @author benjamin gilles
The `MeshClosingEngine` closes an open triangle mesh by adding necessary vertices and triangles to ensure the surface is watertight, providing a closed mesh with updated positions and triangles, an index list of closing points, and a separate mesh representing only the added closing parts.
- module
- Sofa.Component.Engine.Generate
- namespace
- sofa::component::engine::generate
- include
- sofa/component/engine/generate/MeshClosingEngine.h
- inherits
-
- DataEngine
- templates
-
- sofa::defaulttype::Vec3Types
- description
The MeshClosingEngine is a SOFA engine component that processes an open triangle mesh to ensure it is closed, or watertight. The primary function of this component is to add vertices and triangles where necessary to seal any open edges in the input mesh. This process involves several key steps and outputs:
Governing Equations and Operators
- Input Mesh: Given a set of vertices $V = \{v_1, v_2, \\.\.\., v_n\}$ with coordinates $p_i$, and triangles $T = \{t_1, t_2, \\.\.\., t_m\}$ where each triangle $t_j$ is defined by three vertices.
- Output Mesh: The closed mesh consists of updated positions $P = \{p'_1, p'_2, \\.\.\., p'_{n'}\}$ and triangles $T' = \{t'_1, t'_2, \\.\.\., t'_{m'}\}$. Additionally, it outputs a list of indices $I$ for closing points and a separate mesh representing the added closing parts with positions $P_c$ and triangles $T_c$.
Constitutive or Kinematic Laws Involved
- Edge Detection: The algorithm identifies edges that are not shared by two triangles, indicating open boundaries. An edge $(v_i, v_j)$ is represented as an ordered pair in a set $E$ of edges.
- Loop Identification: Loops are identified from the set of border edges using a mapping structure to trace through all edges forming continuous loops around holes in the mesh.
- Centroid Calculation and Triangle Insertion: For each loop, a centroid is calculated as the average position of vertices along the loop. New triangles connecting this centroid to the original vertices ensure closure.
Role in the Global FEM Pipeline
The MeshClosingEngine operates at the preprocessing stage before spatial discretization (FEM). Its role is critical for ensuring that any input mesh is closed, which is a necessary condition for performing valid finite element analysis. The component contributes to the overall simulation pipeline by providing a fully enclosed geometry suitable for subsequent steps such as mass and stiffness matrix assembly.
Numerical Methods or Discretization Choices
- Mesh Operations: The component performs geometric operations on the mesh data structure, specifically focusing on identifying and closing gaps in the triangle mesh. No classical FEM operators like mass or stiffness matrices are directly involved here; instead, it ensures a proper topology for subsequent finite element discretizations.
- Data Structures: Uses sets and maps to efficiently manage edge lists and loop identification, ensuring robustness even with complex input geometries.
Fit into the Broader Variational / Lagrangian Mechanics Framework
While the MeshClosingEngine does not directly contribute mathematical operators or equations central to variational mechanics (such as Lagrangian formulations or weak forms), it is a crucial preprocessing step that ensures any subsequent FEM-based simulation can be performed on a well-defined, closed geometric domain. This closure process facilitates accurate and physically meaningful simulations by ensuring the integrity of the mesh topology.
Data Fields
| Name | Type | Default | Help |
|---|---|---|---|
inputPosition |
SeqPositions | |
|
inputTriangles |
SeqTriangles | |
|
inputQuads |
SeqQuads | |
|
position |
SeqPositions | |
|
triangles |
SeqTriangles | |
|
quads |
SeqQuads | |
|
indices |
VecSeqIndex | |
|
closingPosition |
SeqPositions | |
|
closingTriangles |
SeqTriangles | |
Methods
void
init
()
virtual
void
reinit
()
virtual
void
doUpdate
()
virtual
{
"name": "MeshClosingEngine",
"namespace": "sofa::component::engine::generate",
"module": "Sofa.Component.Engine.Generate",
"include": "sofa/component/engine/generate/MeshClosingEngine.h",
"doc": "Close a given mesh.\n\nThis class closes a triangle mesh and provides :\n- a closed mesh (position, and triangles)\n- a index list of closing points (in closed mesh)\n- a mesh of the closing (position, and triangles)\n@author benjamin gilles",
"inherits": [
"DataEngine"
],
"templates": [
"sofa::defaulttype::Vec3Types"
],
"data_fields": [
{
"name": "inputPosition",
"type": "SeqPositions"
},
{
"name": "inputTriangles",
"type": "SeqTriangles"
},
{
"name": "inputQuads",
"type": "SeqQuads"
},
{
"name": "position",
"type": "SeqPositions"
},
{
"name": "triangles",
"type": "SeqTriangles"
},
{
"name": "quads",
"type": "SeqQuads"
},
{
"name": "indices",
"type": "VecSeqIndex"
},
{
"name": "closingPosition",
"type": "SeqPositions"
},
{
"name": "closingTriangles",
"type": "SeqTriangles"
}
],
"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"
}
],
"description": "The `MeshClosingEngine` is a SOFA engine component designed to close an open triangle mesh by adding necessary vertices and triangles to ensure the mesh's surface is watertight. This component provides several outputs:\n- A closed mesh with updated positions and triangles.\n- An index list of closing points used in the closed mesh.\n- A separate mesh representing only the added closing parts (positions, and triangles).\nThe `MeshClosingEngine` inherits from `DataEngine`, a base class for engines that handle data processing within SOFA. It operates on input vertices (`inputPosition`), triangles (`inputTriangles`), and quads (`inputQuads`).\n\nThe component interacts with other SOFA components by taking mesh data as inputs and producing closed meshes as outputs, which can then be used in further simulation or visualization stages. The `doUpdate()` method is responsible for the core logic of closing the mesh.\n\nTo use this component effectively:\n- Ensure that the input mesh is a valid triangle mesh with open edges needing closure.\n- Utilize the output fields (`position`, `triangles`, `quads`, `indices`, `closingPosition`, and `closingTriangles`) for downstream processing, such as simulation or visualization.",
"maths": "The `MeshClosingEngine` is a SOFA engine component that processes an open triangle mesh to ensure it is closed, or watertight. The primary function of this component is to add vertices and triangles where necessary to seal any open edges in the input mesh. This process involves several key steps and outputs:\n\n### Governing Equations and Operators\n- **Input Mesh:** Given a set of vertices $V = \\{v_1, v_2, \\\\.\\.\\., v_n\\}$ with coordinates $p_i$, and triangles $T = \\{t_1, t_2, \\\\.\\.\\., t_m\\}$ where each triangle $t_j$ is defined by three vertices.\n- **Output Mesh:** The closed mesh consists of updated positions $P = \\{p'_1, p'_2, \\\\.\\.\\., p'_{n'}\\}$ and triangles $T' = \\{t'_1, t'_2, \\\\.\\.\\., t'_{m'}\\}$. Additionally, it outputs a list of indices $I$ for closing points and a separate mesh representing the added closing parts with positions $P_c$ and triangles $T_c$.\n\n### Constitutive or Kinematic Laws Involved\n- **Edge Detection:** The algorithm identifies edges that are not shared by two triangles, indicating open boundaries. An edge $(v_i, v_j)$ is represented as an ordered pair in a set $E$ of edges.\n- **Loop Identification:** Loops are identified from the set of border edges using a mapping structure to trace through all edges forming continuous loops around holes in the mesh.\n- **Centroid Calculation and Triangle Insertion:** For each loop, a centroid is calculated as the average position of vertices along the loop. New triangles connecting this centroid to the original vertices ensure closure.\n\n### Role in the Global FEM Pipeline\nThe `MeshClosingEngine` operates at the preprocessing stage before spatial discretization (FEM). Its role is critical for ensuring that any input mesh is closed, which is a necessary condition for performing valid finite element analysis. The component contributes to the overall simulation pipeline by providing a fully enclosed geometry suitable for subsequent steps such as mass and stiffness matrix assembly.\n\n### Numerical Methods or Discretization Choices\n- **Mesh Operations:** The component performs geometric operations on the mesh data structure, specifically focusing on identifying and closing gaps in the triangle mesh. No classical FEM operators like mass or stiffness matrices are directly involved here; instead, it ensures a proper topology for subsequent finite element discretizations.\n- **Data Structures:** Uses sets and maps to efficiently manage edge lists and loop identification, ensuring robustness even with complex input geometries.\n\n### Fit into the Broader Variational / Lagrangian Mechanics Framework\nWhile the `MeshClosingEngine` does not directly contribute mathematical operators or equations central to variational mechanics (such as Lagrangian formulations or weak forms), it is a crucial preprocessing step that ensures any subsequent FEM-based simulation can be performed on a well-defined, closed geometric domain. This closure process facilitates accurate and physically meaningful simulations by ensuring the integrity of the mesh topology.",
"abstract": "The `MeshClosingEngine` closes an open triangle mesh by adding necessary vertices and triangles to ensure the surface is watertight, providing a closed mesh with updated positions and triangles, an index list of closing points, and a separate mesh representing only the added closing parts.",
"sheet": "# MeshClosingEngine\n\n## Overview\nThe `MeshClosingEngine` is an engine component that processes an open triangle mesh to ensure it is closed or watertight. It identifies open edges in the input mesh, calculates centroids for new triangles, and adds necessary vertices and triangles to seal any gaps. The output includes a fully enclosed geometry suitable for subsequent finite element analysis.\n\n## Parameters and Data\nThe `MeshClosingEngine` exposes several significant data fields:\n- **inputPosition**: Input vertex positions (`SeqPositions`).\n- **inputTriangles**: Input triangle indices (`SeqTriangles`).\n- **inputQuads**: Input quad indices (`SeqQuads`).\n- **position**: Updated vertex positions of the closed mesh (`SeqPositions`).\n- **triangles**: Triangles of the closed mesh (`SeqTriangles`).\n- **quads**: Quads of the closed mesh (`SeqQuads`).\n- **indices**: Index list of closing points used in the closed mesh (`VecSeqIndex`).\n- **closingPosition**: Positions of vertices added for closure (`SeqPositions`).\n- **closingTriangles**: Triangles representing only the added closing parts (`SeqTriangles`).\n\n## Practical Notes\nEnsure that the input mesh is a valid triangle mesh with open edges needing closure. Utilize the output fields for downstream processing, such as simulation or visualization. The `MeshClosingEngine` ensures robustness even with complex input geometries by efficiently managing edge lists and loop identification."
}