Functions
compute_edge_widths
Computes edge widths for a mesh using the inscribed circle radius of each triangle face.Mesh tuple of (vertices, faces) where vertices is an (n, 3) array and faces is an (m, 3) array of vertex indices
Small value added to edge lengths to prevent numerical instability
csr_array - Sparse adjacency matrix containing inscribed circle radii for each edge
Details:
This function uses the law of cotangents to compute the inscribed circle radius for each triangular face. The radius is computed as:
a, b, c are the edge lengths and s is the semiperimeter.
Example:
condense_mesh_to_graph
Condenses a labeled mesh into a graph representation with node and edge tables.Mesh tuple of (vertices, faces)
Cluster labels for each vertex. Vertices with label -1 are excluded from the graph.
If True, adds connected component information to node features
tuple[pd.DataFrame, pd.DataFrame] - (node_table, edge_table)
- node_table: DataFrame with columns
[x, y, z, area, n_vertices]and optionally[component_area, component_n_vertices] - edge_table: DataFrame with columns
[source, target, boundary_length, count, edge_length]
- Groups vertices by their cluster labels
- Computes aggregate geometric properties for each cluster (centroid, total area, vertex count)
- Identifies edges between clusters and computes boundary lengths
- Optionally adds connected component features
x,y,z: Mean coordinates (centroid) of all vertices in the clusterarea: Total surface area of the clustern_vertices: Number of vertices in the clustercomponent_area: (optional) Total area of the connected componentcomponent_n_vertices: (optional) Total vertices in the connected component
source: Source node (cluster) IDtarget: Target node (cluster) IDboundary_length: Total length of the boundary between clusterscount: Number of mesh edges crossing the boundaryedge_length: Euclidean distance between cluster centroids