Editor/Geometry/ArchStoreyGeometry.cs
namespace Sunless.Architecture;

public static class ArchStoreyGeometry {
	public static float FloorAbove( ArchRoom room, ArchBuilding building, ArchKit kit, Vector2 from, Vector2 to ) {
		if ( building is null ) {
			return 0f;
		}

		var midpoint = (from + to) * 0.5f;

		foreach ( var above in building.Rooms.Where( other => other.Floor == room.Floor + 1 ) ) {
			var shell = ArchRegion.Shell( ArchRegion.Footprints( new[] { above }, false ), kit.WallThickness );

			if ( ArchFootprint.Encloses( shell, midpoint ) ) {
				return above.BaseHeight;
			}
		}

		return 0f;
	}
}