AutoRig/Analyze/MeshPart.cs

Data class representing one connected component of a mesh after vertex welding. Stores part index, triangle indices, bounds, surface area, a derived name, and vertex count.

using AutoRig.Mesh;

namespace AutoRig.Analyze;

/// <summary>One connected component of a mesh after vertex welding.</summary>
public sealed class MeshPart
{
    /// <summary>Position in the segmentation result (sorted by descending surface area).</summary>
    public required int Index { get; init; }

    /// <summary>Indices of triangles (triangle number, not corner index) belonging to this part.</summary>
    public required int[] TriangleIndices { get; init; }

    /// <summary>Bounds of the part's vertices.</summary>
    public required Aabb3 Bounds { get; init; }

    /// <summary>Total triangle area.</summary>
    public required float SurfaceArea { get; init; }

    /// <summary>Dominant source tag by triangle count; duplicates suffixed _2, _3, …</summary>
    public required string Name { get; init; }

    /// <summary>Number of distinct (unwelded) vertices referenced by this part.</summary>
    public required int VertexCount { get; init; }
}