passages: exact density-aware outer bound skips passage work beyond its reach (L81, v214)

The carve is max(source, -roughSDF/Q), so its reach grows with -source; the outer test uses
-d*Q + 0.24 m (wall relief 0.21 + margin) beyond the route radius, disabled in mouth-support
and column-overlap tiles. Skips 16% of passage iterations on the highest-activity tiles and
all of them on ordinary tiles. 84 candidate/full pairs identical in every hash; 0 changed samples.
Evaluator 214 for cache invalidation only. Cold LOD0-2 (L80 protocol): SW 1.30->1.25,
FI 3.59->2.93, TN 3.18->3.51 (noise?), VS 1.33->1.22 s. Fast tier PASS.

Note: the export's legacy 26-point root route owner_world.passages[0] fails a full-view
pre-audit (65 solid samples, unchanged since L70); the canonical 211-point route used by the
plan passes. Stale data to clean up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
Fr0zkaandClaude Opus 5.5 committed 2026-10-27 22:58:34 +01:00
1 parent b06397df9c
commit 9cb5e53b17
8 files changed
+615 -2

No files matched your search

+75
View File
@@ -1045,6 +1045,81 @@ public:
&&!passageTileQueries->hasColumnZOverlap()
&&!passageTileQueries->hasAnyMouthSupport()
&&!passageTileQueries->mayContainUpperMouthSupport())return density;
// On solid samples, the SDF carve can still move the scalar density far outside the
// physical tunnel. The per-passage test below already accounts for this tail using the
// incoming density plus the bounded relief allowance. Apply that same proof before
// entering the passage loop for points outside the scalar influence reach. Columns and
// both mouth-support paths keep their own tile envelopes and therefore disable this
// cut. Optional extra padding is only for research sweeps; zero is the exact bound.
// Invalid values fail open.
static const double PassageBoundPaddingVoxels=[]
{
constexpr double DefaultPaddingVoxels=0.0;
const char* Value=std::getenv(
"VOXELFORGE_L81_PASSAGE_BOUND_PADDING_VOXELS");
if(!Value||!*Value)return DefaultPaddingVoxels;
char* End=nullptr;
const double Parsed=std::strtod(Value,&End);
if(End==Value||*End!='\0'||!std::isfinite(Parsed)||Parsed<0.0)
return std::numeric_limits<double>::infinity();
return Parsed;
}();
if(passageTileScopeMatches&&density<0.0f
&&std::isfinite(PassageBoundPaddingVoxels)
&&!passageTileQueries->hasColumnZOverlap()
&&!passageTileQueries->hasAnyMouthSupport()
&&!passageTileQueries->mayContainUpperMouthSupport())
{
if(passageProfile)++passageProfile->passageTileBoundChecks;
bool bAnyPassageWithinBound=false;
const double ExtraPadding=PassageBoundPaddingVoxels*Q;
for(std::size_t PassageIndex=0;
PassageIndex<ResolvedLayout->passages.size();++PassageIndex)
{
const auto& Passage=ResolvedLayout->passages[PassageIndex];
if(Passage.controlPoints.size()<2)continue;
const auto& Constants=PassageComposerConstants[PassageIndex];
if(qz>Constants.firstFloorQ+2.0*Passage.mouthRadiusSubvoxels
||qz<Constants.lastFloorQ-2.0*Passage.mouthRadiusSubvoxels)
continue;
const std::ptrdiff_t LowerMouthIndex=Constants.lowerMouthIndex;
const auto FloorProfile=[&](const auto& Point)
{return Point.positionSubvoxels[2]-Point.radiusSubvoxels
+1.13*qPerMetre;};
const auto CarveHigh=std::lower_bound(Passage.controlPoints.begin(),
Passage.controlPoints.begin()+LowerMouthIndex+1,
qz+Constants.carveSearchMargin,
[&](const auto& Point,double Value){return FloorProfile(Point)>Value;});
const auto CarveLow=std::lower_bound(Passage.controlPoints.begin(),
Passage.controlPoints.begin()+LowerMouthIndex+1,
qz-Constants.carveSearchMargin,
[&](const auto& Point,double Value){return FloorProfile(Point)>Value;});
const std::ptrdiff_t CarveBegin=std::max<std::ptrdiff_t>(0,
(CarveHigh-Passage.controlPoints.begin())-1);
const std::ptrdiff_t CarveEnd=std::min<std::ptrdiff_t>(LowerMouthIndex-1,
(CarveLow-Passage.controlPoints.begin())+1);
const double SignedDistanceLimit=-static_cast<double>(density)*Q
+0.24*qPerMetre+ExtraPadding;
if(PassageMayAffectDensity(PassageIndex,CarveBegin,CarveEnd,
LowerMouthIndex,Constants.mouthSearchBegin,Constants.mouthSearchEnd,
Constants.lastIndex,qx,qy,qz,SignedDistanceLimit))
{
bAnyPassageWithinBound=true;
break;
}
}
if(!bAnyPassageWithinBound)
{
if(passageProfile)
{
++passageProfile->passageTileBoundRejects;
passageProfile->passageTileBoundSkippedIterations
+=ResolvedLayout->passages.size();
}
return density;
}
}
bool queryNearUpperMouthSupport=false;
const auto checkUpperMouth=[&](const auto& passage)
{