Galaxy links zones along a double-precision Delaunay triangulation: the vendored float MIConvexHull dropped zones, so ~2% of galaxies threw
The vendored MIConvexHull (NIH, ported from double to float) returned triangulations that left whole sets of interior zones with no cell at all (prelude seed 103: 22 of 64 zones; main seed 4247651650: 182 of 196). Those zones had no link, Distance lacked them, and the constructor threw KeyNotFoundException placing the antagonist home (prelude) or the entrance (main). Galaxy was its only consumer; Delaunay.Edges (Bowyer-Watson, double) replaces it, and the 3,896 vendored lines go. The three RestoredHullsTests loops that skipped seeds whose galaxy threw now require every seed to build, and the stale comment that Galaxy mutates Faction.InfluenceDistance goes with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
494d795550
commit
e56af28892
52 changed files with 165 additions and 4205 deletions
|
|
@ -7,7 +7,6 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using DataStructures.ViliWonka.Heap;
|
||||
using Ink.Runtime;
|
||||
using MIConvexHull;
|
||||
using JM.LinqFaster;
|
||||
using UniRx;
|
||||
using CultMath;
|
||||
|
|
@ -361,22 +360,10 @@ public class Galaxy
|
|||
progressCallback?.Invoke("Triangulating Zone Positions");
|
||||
if (progressCallback != null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
|
||||
// Create a delaunay triangulation to connect adjacent sectors
|
||||
var triangulation = DelaunayTriangulation<Vertex2<GalaxyZone>, Cell2<GalaxyZone>>
|
||||
.Create(Zones.Select(z => new Vertex2<GalaxyZone>(z.Position, z)).ToList(), 1e-7f);
|
||||
var links = new HashSet<(GalaxyZone, GalaxyZone)>();
|
||||
foreach (var cell in triangulation.Cells)
|
||||
{
|
||||
if (!links.Contains((cell.Vertices[0].StoredObject, cell.Vertices[1].StoredObject)) &&
|
||||
!links.Contains((cell.Vertices[1].StoredObject, cell.Vertices[0].StoredObject)))
|
||||
links.Add((cell.Vertices[0].StoredObject, cell.Vertices[1].StoredObject));
|
||||
if (!links.Contains((cell.Vertices[1].StoredObject, cell.Vertices[2].StoredObject)) &&
|
||||
!links.Contains((cell.Vertices[2].StoredObject, cell.Vertices[1].StoredObject)))
|
||||
links.Add((cell.Vertices[1].StoredObject, cell.Vertices[2].StoredObject));
|
||||
if (!links.Contains((cell.Vertices[0].StoredObject, cell.Vertices[2].StoredObject)) &&
|
||||
!links.Contains((cell.Vertices[2].StoredObject, cell.Vertices[0].StoredObject)))
|
||||
links.Add((cell.Vertices[0].StoredObject, cell.Vertices[2].StoredObject));
|
||||
}
|
||||
// The Delaunay triangulation connects adjacent sectors, every zone among them
|
||||
var links = Delaunay.Edges(Zones.Select(z => z.Position).ToArray())
|
||||
.Select(edge => (Zones[edge.a], Zones[edge.b]))
|
||||
.ToList();
|
||||
|
||||
progressCallback?.Invoke("Eliminating Zone Links");
|
||||
if (progressCallback != null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
|
|
|
|||
Loading…
Reference in a new issue