Vixen
dd8b0a81
csharp
public readonly record struct TriangleHit

Everything a ray found, rather than only whether it found anything.

Read the guide page for this →

Remarks

docs/plan/41-automatic-retopology.md § D12's bake casts along the output's interpolated normal and writes what it struck into an atlas texel: the source normal there, and how far along the ray it was. Both of those are Barycentric and Distance, and the Raycast that predates this reports neither — it exists for a sign vote, which asks only whether the nearest face was struck from behind.

⚠ Distance is in units of the direction handed in, not of the model. A caller that passes a unit normal reads a length; one that passes an un-normalised direction reads a fraction of it. The bake passes a direction whose length is its search radius, so the answer it wants is the fraction.

Fields and properties (5)

  • public int Triangle

    Which triangle, indexed as the caller's indices were, or -1 for a miss.

  • public Vector3 Point

    Where on it the ray struck, or the origin for a miss.

  • public float Distance

    How far along the ray, in units of the direction, or PositiveInfinity for a miss.

  • public Vector3 Barycentric

    The weights of the triangle's three vertices at .

  • public bool Backface

    Whether the face was struck from behind.

Methods (1)

  • public TriangleHit(int Triangle, Vector3 Point, float Distance, Vector3 Barycentric, bool Backface)

    Everything a ray found, rather than only whether it found anything.

Used by (4)

  • MapBakerVixen.Geometry.Remeshing
  • TriangleTreeVixen.Core.Mathematics
  • TriangleTreeTestsVixen.Core.Mathematics.Tests
  • PaintProjectionVixen.Editor.Texturing