Utility static class for architecture contact offsets. Provides constants and helper methods to compute contact depths and adjusted ranges (Bite, Proud, Shy, Bury, Lapped) based on an optional ArchKit parameter.
using System;
namespace Sunless.Architecture;
// One place for contact depths - every coplanar pair arch_audit reports is a missing copy.
public static class ArchContact
{
// Deep enough that no float error surfaces it, shallow enough to read as contact.
public static float Bite( ArchKit kit ) => MathF.Max( 0.05f, kit?.ContactBite ?? 0.4f );
// Never shallower than a bite, or the trim is inside what it is supposed to be trimming.
public static float Proud( ArchKit kit ) => MathF.Max( Bite( kit ), kit?.WellTrimProud ?? 0.75f );
// Held BACK off a shared plane rather than lapped through it, for the one contact that cannot overlap: a solid
// taking its neighbour's own section lands two faces exactly coplanar, and coplanar faces flicker. A whole unit
// rather than a bite - a bite is sized to hide a seam, and hiding a seam is not the same as leaving one.
public const float Shy = 1f;
// Signed by the direction the solid faces - a tread's underside buries down, a skirting's foot up.
public static float Bury( ArchKit kit, float plane, float outward ) => plane - MathF.Sign( outward ) * Bite( kit );
// Grown a bite at both ends so the piece overlaps what it butts into.
public static (float From, float To) Lapped( ArchKit kit, float from, float to )
{
var bite = Bite( kit );
return (from - bite, to + bite);
}
}