Mining index: a general targeting index fed by providers; the linear chunk scan goes

Zone.Targets (TargetingIndex) answers Within and best-first Best over
ITargetProvider regions. EntityTargets offers the observer's VisibleEntities;
BeltTargets keys each belt's rocks into kinetic bands and bounds each segment's
annular sector for distance, bearing and visibility. Entity.VisibleChunksInReach
queries the index with DetectionReachPerVisibility, an upper bound from the
sensors' hull. Zone.ChunksNear and AsteroidBelt.InnerRadius are deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-03 15:02:51 +02:00
commit f803151681
11 changed files with 631 additions and 41 deletions

View file

@ -4,6 +4,7 @@ using MessagePack;
using Newtonsoft.Json;
using CultMath;
using static CultMath.math;
using float2 = CultMath.float2;
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
public class BezierCurve
@ -39,6 +40,31 @@ public class BezierCurve
}
}
// The least and greatest value Evaluate can return, as (min, max): each segment is a cubic Bezier whose control
// points are p0, p0 + m0/3, p1 - m1/3 and p1, and a Bezier curve lies within their hull. A stepped segment holds
// its left key; outside the keys Evaluate clamps to the end keys. A bound, not the curve's extremes.
public float2 HullRange()
{
var low = float.PositiveInfinity;
var high = float.NegativeInfinity;
void Include(float value)
{
low = min(low, value);
high = max(high, value);
}
foreach (var key in Keys) Include(key.y);
for (var i = 0; i + 1 < Keys.Length; i++)
{
var left = Keys[i];
var right = Keys[i + 1];
if (isinf(left.w) || isinf(right.z)) continue;
var dx = right.x - left.x;
Include(left.y + left.w * dx / 3);
Include(right.y - right.z * dx / 3);
}
return float2(low, high);
}
// Integrate area under curve between start and end time
public float IntegrateCurve(float startTime, float endTime, int steps)
{