# Surface Mesh Diagnostics

*The Surface Mesh Diagnostics tool provides comprehensive analysis capabilities for assessing the quality of surface meshes. When a surface mesh is loaded, this tool becomes available to help identify potential mesh quality issues.*

---

## Overview

The Surface Mesh Diagnostics tool opens a dedicated panel that allows you to inspect surface mesh quality based on pre-computed metrics. This tool is essential for:

- Identifying poor quality mesh elements
- Verifying mesh quality before volume mesh generation
- Understanding mesh characteristics across different surfaces
- Diagnosing potential issues that could affect simulation accuracy

---

## Accessing Surface Mesh Diagnostics

The Surface Mesh Diagnostics tool is available when:

- A surface mesh is loaded in the viewer
- The "Surface Mesh Diagnostic" button appears in the viewer toolbar

<div align="center">

![InspectionButton](./Figures/inspection.png)

</div>

- Clicking the button opens the "Surface Mesh Diagnostic" interface

---

## Diagnostic Features

### Quality Metrics

The "Surface mesh metrics" section provides access to various pre-computed mesh quality metrics through a searchable dropdown:

- **None**: Option to disable metric visualization
- **Area**: Surface element area
- **Aspect Ratio**:  Maximum ratio of edge length with corresponding height, normalized to unity for an equilateral triangle.
- **Incircle/Circumcircle Radius Ratio Quality**: Quality measure based on inscribed and circumscribed circles
- **Maximum Angle**: Largest angle in the element
- **Minimum Angle**: Smallest angle in the element
- **Minimum Edge Length**: Shortest edge length in the element
- **Skewness Quality**: Measure of element distortion

> The dropdown includes a search bar that allows you to quickly find metrics by typing (e.g., typing "Area" highlights the Area option).

### Surfaces List

The diagnosis settings panel includes a "Surfaces list" section that allows you to select which surfaces to analyze:

- **Search bar**: Search bar with magnifying glass icon to filter surfaces by name
- **Surface selection**: List of available surfaces (e.g., "body00001")

### Quality Filtering

The "Poor quality elements" tab allows you to filter and identify problematic mesh elements:

- **Metric selection**: Choose a mesh quality metric from the dropdown (e.g., Aspect Ratio)
- **Condition operators**: Set comparison operators (">", "<", ">=", "<=", "=", "≠")
- **Threshold values**: Enter numerical thresholds (e.g., "25" for Aspect Ratio > 25)
- **Add conditions**: Use the "+ Add condition" button to combine multiple quality criteria
- **Apply filters**: Click the green "Apply" button to filter elements based on conditions
