|
Easy3D 3.0.0
|
Constructing a PolyMesh (a single tetrahedron) — a volumetric mesh made of 3D cells.
Overview
This console tutorial builds the simplest polyhedral mesh: one tetrahedral cell from four vertices. It then prints the element counts, the position of every vertex, and the corner indices of the cell. It is the entry point to the PolyMesh series (113 connectivity, 114 properties, 115 I/O) and the 3D analogue of Tutorial_104_SurfaceMesh.
The technique
PolyMesh is a half-face data structure for polyhedral (volumetric) meshes. It lifts the halfedge idea of a SurfaceMesh one dimension up: the elements are vertices, edges, halffaces, faces and cells. A cell is a solid volume (a tetrahedron, hexahedron, or general polyhedron) bounded by polygonal faces; each face is represented by two oppositely oriented halffaces, one per adjacent cell, with normals pointing outward from their cell. A face on the boundary of the volume has a halfface whose opposite is invalid (the "outside"). This is the key difference from a SurfaceMesh, whose faces are 2D patches living in 3D space: a PolyMesh fills the interior with 3D cells, which is what volumetric simulation (FEM), tetrahedralization and solid modeling need. A single tetrahedron has 4 vertices, 6 edges, 4 triangular faces and 1 cell. add_tetra(v0,v1,v2,v3) creates that cell together with its faces and halffaces in one call.
Easy3D API
Running it
Console-only. It prints "#cell: 1", "#face: 4", "#vertex: 4", "#edge: 6", then a line with each vertex's coordinates and a line listing the cell's vertex indices. The mesh is a local object and is freed when main returns.