Tier 2 slice 1 from COMPOSER-NOTES.md 3.4. A read-only, deterministic, headless measurement of a built strate: sample a coarse grid once, flood-fill the air once, derive every metric from that same grid. What it answers today: air fraction, air component count and largest component share (the swiss-cheese signal), walkable fraction, median feature scale, median vertical clearance -- and whether two points are actually connected. The connectivity verdict is the point. Coarse sampling LIES about it in the dangerous direction: a wall thinner than the sample step vanishes and two sealed caverns read as joined. So VF_AreConnected recovers the actual BFS route and re-walks that one corridor at one-voxel spacing; a true verdict is never returned on coarse evidence alone. It fired: 2 of 21 routes were coarse false positives. The test carries a negative control, because a green suite that cannot fail is what hid the last defect. Two of them, in fact: a direct probe of the known-solid inter-strate gap (AirFraction 0.00042), and -- Codex's improvement on the spec -- a diff-layer box filled solid and measured through VF_MeasureStrate itself, so an inverted sign is caught end to end rather than around the function under test. Build clean, 18 succeeded / 0 warnings / 0 failed. KNOWN, fix in flight: the interior window excludes a whole chunk (32 voxels) at each end to avoid a 4-voxel seal band -- 8x too much. On the fixture's 4-chunk strates that discards the floor, so the reported FlatPlain/CrystalChamber air fractions of 0.999 describe the open band above the floor, not the strate. The engine is right; the window is not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bp7FxoQcSoiuhxjuLr6aBM
64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
// Read-only, headless measurements over a coarse sample of one strate.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
class UVoxelGenerator;
|
|
class UVoxelStrateManager;
|
|
|
|
/** Settings for the deterministic coarse grid used by the strate measurement pass. */
|
|
struct VOXELFORGE_API FVoxelStrateMeasureSettings
|
|
{
|
|
int32 SampleStep = 4; // Voxels between samples.
|
|
int32 RadiusInVoxels = 256; // Half-extent in X and Y around CenterXY.
|
|
FVector2D CenterXY = FVector2D::ZeroVector; // Actor-space voxel coordinates.
|
|
int32 MaxCells = 8000000; // Refuse a grid larger than this many cells.
|
|
int32 HeadroomCells = 2; // Air cells above a floor cell required for walkable.
|
|
};
|
|
|
|
/** Metrics derived from one coarse grid and its single air flood fill. */
|
|
struct VOXELFORGE_API FVoxelStrateMetrics
|
|
{
|
|
bool bValid = false;
|
|
FString RefusalReason;
|
|
|
|
int64 NumSampled = 0;
|
|
int64 NumAir = 0;
|
|
int64 NumSolid = 0;
|
|
|
|
float AirFraction = 0.f;
|
|
int32 NumAirComponents = 0;
|
|
float LargestComponentShare = 0.f;
|
|
float WalkableFraction = 0.f;
|
|
float MedianFeatureScale = 0.f;
|
|
int32 MedianVerticalClearance = 0;
|
|
};
|
|
|
|
/**
|
|
* Measure one strate in actor-space voxel coordinates.
|
|
*
|
|
* The pass samples only the interior chunks of the requested strate, flood-fills its air once,
|
|
* and derives all returned metrics from that same grid. It never mutates either input object.
|
|
*/
|
|
VOXELFORGE_API FVoxelStrateMetrics VF_MeasureStrate(
|
|
const UVoxelGenerator& Generator,
|
|
const UVoxelStrateManager& Manager,
|
|
int32 StrateIndex,
|
|
const FVoxelStrateMeasureSettings& Settings);
|
|
|
|
/**
|
|
* Test coarse connectivity and then re-check the one recovered coarse route at full resolution.
|
|
*
|
|
* bOutCoarseLied is true only when the coarse route existed but a full-resolution sample on that
|
|
* route was solid (or non-finite), in which case this function always returns false.
|
|
*/
|
|
VOXELFORGE_API bool VF_AreConnected(
|
|
const UVoxelGenerator& Generator,
|
|
const UVoxelStrateManager& Manager,
|
|
int32 StrateIndex,
|
|
const FVector& AVoxel,
|
|
const FVector& BVoxel,
|
|
const FVoxelStrateMeasureSettings& Settings,
|
|
bool& bOutCoarseLied);
|