feat(core): profiled heightfields, slice 1: periodicHills, mirroredRelief, flatField (L53); research R22
WorldAssemblySurfaceProfileV1 on the native SurfaceWorld recipe and plan; version 0 'natural' is omitted from serialized identity, so the owner world is unchanged. periodicHills (seeded cosine hills, plan-time grade <= 15 deg), mirroredRelief (cap mirrors the floor by lambda, clearance checked) and flatField share one profile function for points, lattice classification and exact cosine-extrema intervals (0 interval misses in brute-force audits). Style-override fixtures with planned passages. Cold whole view about 1.33 s for each profile vs 1.74 s natural SW (Clang). Owner hashes identical to L52; fast/medium/full PASS. Research R22: SurfaceWorld critical path to about 1 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dhxM43dnWvUu2B5Ph1iG1
This commit is contained in:
1 parent
408c14baff
commit
20f6c98ec5
17 files changed
+1620
-23
No files matched your search
@@ -1993,6 +1993,10 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
|
||||
&&anchor.values.size()>=3;});
|
||||
const bool hasLowerTangent=hasLowerRoute&&!hasPassageArrival
|
||||
&&routeTangent(lower,false,lowerTangent);
|
||||
const bool profiledSurfaceJoin=hasLowerTangent
|
||||
&&std::any_of(lower.anchors.begin(),lower.anchors.end(),
|
||||
[](const auto& anchor){return anchor.kind=="heightfield_profile"
|
||||
&&anchor.values.size()>=2&&anchor.values[0]>0;});
|
||||
|
||||
const std::int64_t outerRingRadius=std::max<std::int64_t>(1,
|
||||
placementRadius-mouthRadius-qPerMetre/2);
|
||||
@@ -2237,7 +2241,7 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
|
||||
helixEndIndex=xy.size()-1;
|
||||
hasAnchorHelix=helixEndIndex>0;
|
||||
}
|
||||
const std::int64_t routeGradeQ16=hasAnchorHelix
|
||||
const std::int64_t routeGradeQ16=profiledSurfaceJoin?8000:hasAnchorHelix
|
||||
&&lower.generatorKind=="SurfaceWorld"?8000
|
||||
:style==0&&anchoredIslandPassage&&!anchoredSpiral?15500:TargetGradeQ16;
|
||||
const std::array<std::int64_t,2> firstRing=ringPoint(phase);
|
||||
@@ -2310,6 +2314,7 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
|
||||
std::uint32_t lowerPhase=static_cast<std::uint32_t>(PassageSeed(seed,
|
||||
upper.strateIndex,lower.strateIndex,connection,0x4c505248u)%16);
|
||||
std::int64_t bestAlignment=std::numeric_limits<std::int64_t>::min();
|
||||
bool lowerRouteReversed=false;
|
||||
const std::uint32_t hashedLowerPhase=lowerPhase;
|
||||
for(std::uint32_t offset=0;offset<16;++offset)
|
||||
{
|
||||
@@ -2326,8 +2331,32 @@ bool PlanResolvedLayoutPassagesV1(ResolvedLayoutSnapshotV3& layout,std::int32_t
|
||||
if(score>bestAlignment)
|
||||
{bestAlignment=score;lowerPhase=candidate;}
|
||||
}
|
||||
// A route is walkable in either direction. If the approach ring lies on
|
||||
// the wrong side of its first route tangent, attach to the same endpoint
|
||||
// while traversing the route backwards instead of rejecting the layout.
|
||||
if(bestAlignment==std::numeric_limits<std::int64_t>::min())
|
||||
{
|
||||
for(std::uint32_t offset=0;offset<16;++offset)
|
||||
{
|
||||
const std::uint32_t candidate=static_cast<std::uint32_t>(
|
||||
(hashedLowerPhase+offset)%16);
|
||||
const auto terminal=ringPoint(candidate,loops);
|
||||
const std::int64_t dx=lowerMouth[0]-terminal[0];
|
||||
const std::int64_t dy=lowerMouth[1]-terminal[1];
|
||||
const std::int64_t alignment=dx*lowerTangent[0]+dy*lowerTangent[1];
|
||||
const std::int64_t cross=std::abs(dx*lowerTangent[1]-dy*lowerTangent[0]);
|
||||
if(alignment>=0||cross==0)continue;
|
||||
const auto length=distanceQ(dx,dy);
|
||||
const std::int64_t score=-alignment*65536/static_cast<std::int64_t>(length);
|
||||
if(score>bestAlignment)
|
||||
{bestAlignment=score;lowerPhase=candidate;lowerRouteReversed=true;}
|
||||
}
|
||||
}
|
||||
if(bestAlignment==std::numeric_limits<std::int64_t>::min())
|
||||
{error=passage.stableId+" could not find a non-overlapping lower landing approach";return false;}
|
||||
std::printf("[ResolvedPassageLowerApproach] id=%s direction=%s alignment_q16=%lld status=PASS\n",
|
||||
passage.stableId.c_str(),lowerRouteReversed?"reverse":"forward",
|
||||
static_cast<long long>(bestAlignment));
|
||||
if(phase!=lowerPhase)
|
||||
for(int step=1;step<=16;++step)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user