Vixen
dd8b0a81
csharp
public readonly record struct ClosestTriangle

Everything a closest-point query found, rather than only how far away it was.

Read the guide page for this →

Remarks

docs/plan/41-automatic-retopology.md § D12 interpolates normals, texture coordinates, vertex colours and skin weights from the source mesh at the point a retopologised vertex lands on. A scalar distance cannot do that: the interpolation needs to know which triangle and where on it, which is Triangle and Barycentric.

⚠ Barycentric's three components always sum to one, including when the nearest point is on an edge or a vertex or the triangle has no area. Those are the cases where the interior solution divides by zero, and a transfer that read a NaN weight there would write a NaN normal into the output mesh. Each degenerate region produces its weights directly instead of dividing.

Fields and properties (4)

  • public int Triangle

    Which triangle it is, indexed as the caller's indices were, or -1 over an empty tree.

  • public Vector3 Point

    The point on that triangle nearest the query, or the query itself when empty.

  • public float DistanceSquared

    How far the query was from it, squared, or PositiveInfinity when empty.

  • public Vector3 Barycentric

    The weights of the triangle's first, second and third vertex at .

Methods (1)

  • public ClosestTriangle(int Triangle, Vector3 Point, float DistanceSquared, Vector3 Barycentric)

    Everything a closest-point query found, rather than only how far away it was.

Used by (7)

  • AttributeTransferVixen.Geometry.Remeshing
  • DensityFieldVixen.Geometry.Remeshing
  • MapBakerVixen.Geometry.Remeshing
  • TransferFixturesVixen.Geometry.Remeshing.Tests
  • TriangleTreeVixen.Core.Mathematics
  • TriangleTreeScaleTestsVixen.Core.Mathematics.Tests
  • TriangleTreeTestsVixen.Core.Mathematics.Tests