From ccee9802088f0677db726578cbf2442a8ced6252 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 21:20:44 +0000 Subject: [PATCH 01/50] Add robustness analysis and red test suite for known bugs Analysis of the library's behavior on topologically dirty input and floating point edge cases (docs/Robustheitsanalyse.md), backed by tests: - Red tests (category "KnownBug", 20 tests) documenting confirmed bugs: crossing segments producing invalid meshes, exceptions or a stack overflow; RobustPredicates.Default not being thread-safe; Dwyer stack overflow on identical points; SimpleSmoother failing far from the origin; missing NaN/Infinity validation; vertex id heuristic; Vertex Equals/GetHashCode contract; SweepLine not exactly Delaunay. - Green regression tests for degenerate input that is handled correctly. - MeshAssert helpers (consistency, inverted triangles, segment coverage, area, termination). - Scenarios that crash or hang the process run in a child process via a custom entry point of the test assembly. - CI runs KnownBug tests separately with continue-on-error. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .github/workflows/dotnet.yml | 6 +- docs/Robustheitsanalyse.md | 175 ++++++++ src/Triangle.Tests/Program.cs | 20 + .../Robustness/InputValidationTest.cs | 158 +++++++ .../Robustness/IsolatedProcess.cs | 121 ++++++ .../Robustness/IsolatedScenarios.cs | 65 +++ src/Triangle.Tests/Robustness/KnownBug.cs | 16 + src/Triangle.Tests/Robustness/MeshAssert.cs | 151 +++++++ .../Robustness/MiscellaneousBugsTest.cs | 89 ++++ .../Robustness/RobustnessRegressionTest.cs | 411 ++++++++++++++++++ .../Robustness/SegmentIntersectionTest.cs | 123 ++++++ src/Triangle.Tests/Robustness/TestData.cs | 80 ++++ .../Robustness/ThreadSafetyTest.cs | 88 ++++ src/Triangle.Tests/Triangle.Tests.csproj | 2 + 14 files changed, 1504 insertions(+), 1 deletion(-) create mode 100644 docs/Robustheitsanalyse.md create mode 100644 src/Triangle.Tests/Program.cs create mode 100644 src/Triangle.Tests/Robustness/InputValidationTest.cs create mode 100644 src/Triangle.Tests/Robustness/IsolatedProcess.cs create mode 100644 src/Triangle.Tests/Robustness/IsolatedScenarios.cs create mode 100644 src/Triangle.Tests/Robustness/KnownBug.cs create mode 100644 src/Triangle.Tests/Robustness/MeshAssert.cs create mode 100644 src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs create mode 100644 src/Triangle.Tests/Robustness/RobustnessRegressionTest.cs create mode 100644 src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs create mode 100644 src/Triangle.Tests/Robustness/TestData.cs create mode 100644 src/Triangle.Tests/Robustness/ThreadSafetyTest.cs diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 073bcae..d627f42 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -24,5 +24,9 @@ jobs: run: dotnet build Triangle.sln --no-restore working-directory: ./src - name: Test - run: dotnet test Triangle.sln --no-build --verbosity normal + run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory!=KnownBug" working-directory: ./src + - name: Known bugs (red tests, expected to fail) + run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory=KnownBug" + working-directory: ./src + continue-on-error: true diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md new file mode 100644 index 0000000..d24952c --- /dev/null +++ b/docs/Robustheitsanalyse.md @@ -0,0 +1,175 @@ +# Robustheitsanalyse Triangle.NET + +Stand: Oktober 2026, Commit `fa6f2fd` (master). Fokus: Verhalten bei topologisch unsauberen +Eingaben und Gleitkomma-Grenzfällen. + +## Kurzfazit + +* **Die reine Delaunay-Triangulation von Punktmengen ist sehr robust.** Die adaptiven exakten + Prädikate von Shewchuk sind korrekt portiert. Doppelte und fast doppelte Punkte, Kollinearitäten, + Raster, fast kozirkuläre Punkte und Koordinaten bis 1e9 liefern mit Dwyer (Default) und + Incremental korrekte Netze. +* **Die Schwachstelle sind sich kreuzende Segmente.** Bei zufälligen PSLGs auf einem ganzzahligen + Raster (Kreuzungen, Berührungen, kollineare Überlappungen) scheitern **43 von 200 Eingaben + (≈ 22 %)**: in 28 Fällen **stillschweigend** mit einem Netz aus invertierten Dreiecken, in + 15 Fällen mit einer Exception. Ein 5-Segment-Fall bringt durch einen Stack Overflow den + **ganzen Prozess** zum Absturz. Drei kreuzende Segmente reichen bereits aus. +* **Das ist kein Portierungsfehler.** Ein Differenztest gegen das C-Original (Triangle 1.6) zeigt + bei allen 43 Fällen dasselbe Fehlverhalten. Die Ursache liegt im Algorithmus: Schnittpunkte + werden auf `double` gerundet eingefügt und liegen danach auf keinem der beiden Segmente exakt. +* **Gut umgehbar:** Wenn die Schnittpunkte vorab berechnet und die Segmente geteilt werden + (Noding), scheitern **0 von 200** Eingaben. +* **Thread-Sicherheit:** `RobustPredicates.Default` ist **nicht thread-sicher**. Bei parallelem + Vermaschen liefern genau die heiklen, fast degenerierten Prädikat-Aufrufe falsche Ergebnisse. + Abhilfe: pro Mesher eine eigene `RobustPredicates`-Instanz verwenden. + +Mit den Workarounds unten (Noding, eigene Prädikate, Steiner-Limit, Eingabeprüfung) ist die +Bibliothek für unsaubere Daten gut einsetzbar. + +## Methodik + +1. **Code-Review** der robustheitsrelevanten Teile (`RobustPredicates`, `ConstraintMesher`, + `Mesh.InsertVertex/TransferNodes`, Triangulatoren, `QualityMesher`, Smoother). +2. **Sondierungstests** mit gezielt „schmutzigen" Eingaben, z. B. Duplikate, Fast-Duplikate, + Selbstüberschneidungen, Spikes, kollineare Überlappungen, berührende Löcher, große + Koordinaten, kleine Winkel und Slivers zwischen Nachbarflächen. +3. **Fuzzing** mit zufälligen Segmenten (ganzzahlig und reell), Prüfung auf Konsistenz, + invertierte Dreiecke, vollständig enthaltene Eingabesegmente, Gesamtfläche und Terminierung. +4. **Minimierung** jedes Fehlschlags auf den kleinsten reproduzierenden Fall (Delta-Debugging, + jede Prüfung in eigenem Prozess wegen der Abstürze). +5. **Differenztest gegen das C-Original** (Shewchuks Triangle über das PyPI-Paket `triangle`), + um geerbte Fehler von Portierungsfehlern zu trennen. +6. **Verifikation der Ursache** durch einen probeweisen Fix, wo das mit wenig Aufwand ging + (Smoother: rot → grün). + +## Befunde + +| # | Befund | Schwere | Geerbt aus C? | Test | +|---|--------|---------|---------------|------| +| 1 | Kreuzende Segmente erzeugen **stillschweigend** ungültige Netze (invertierte Dreiecke) | kritisch | ja | `SegmentIntersectionTest.ThreeCrossingSegmentsProduceInvalidMesh` | +| 2 | Kreuzende Segmente: Endlosrekursion `ScoutSegment`/`ConstrainedEdge` → StackOverflow, **Prozess stirbt** | kritisch | ja (C hängt) | `SegmentIntersectionTest.FiveCrossingSegmentsCrashProcess` | +| 3 | Kreuzende Segmente: `Exception("Topological inconsistency after splitting a segment")` | hoch | ja | `SegmentIntersectionTest.ThreeCrossingSegmentsThrow`, `RandomIntegerSegments` | +| 4 | `RobustPredicates.Default` nicht thread-sicher (gemeinsame Arbeits-Arrays) | kritisch bei Parallelbetrieb | nein (C ist single-threaded) | `ThreadSafetyTest.DefaultPredicatesInParallel` | +| 5 | Dwyer (Default) mit nur identischen Punkten: Endlosrekursion → StackOverflow | hoch | – | `InputValidationTest.AllPointsIdenticalDwyer` | +| 6 | `SimpleSmoother` bei großen Koordinaten (z. B. UTM): hängt/stürzt ab | hoch | nein | `MiscellaneousBugsTest.SmoothMeshWithLargeCoordinates` | +| 7 | NaN/Infinity-Koordinaten: `IndexOutOfRangeException` tief in den Prädikaten | mittel | – | `InputValidationTest.NaNCoordinate`, `InfiniteCoordinate` | +| 8 | Vertex-IDs: Heuristik „erste zwei IDs verschieden ⇒ alle verschieden" → `ArgumentException: same key` | mittel | nein | `InputValidationTest.PartiallyDuplicateUserIds`, `ReuseMeshVerticesAndAddVertex` | +| 9 | `Vertex.Equals` (Koordinaten) und `GetHashCode` (interner Hash) widersprechen sich | mittel | nein | `MiscellaneousBugsTest.VertexEqualsAndHashCodeContract` | +| 10 | SweepLine: bei fast kozirkulären Punkten nicht exakt Delaunay (Abweichungen ~1e-16) | niedrig | vermutlich | `MiscellaneousBugsTest.SweepLineNearlyCocircularPoints` | +| 11 | SweepLine wirft bei nur identischen Punkten, Incremental liefert ein leeres Netz | niedrig | – | `InputValidationTest.AllPointsIdenticalSweepLine` | + +### Details und Ursachen + +**1–3 Kreuzende Segmente** (`src/Triangle/Meshing/ConstraintMesher.cs:663`, `SegmentIntersection`) +Beim Einfügen eines Segments, das ein bereits eingefügtes Segment kreuzt, wird der Schnittpunkt in +Gleitkomma berechnet und als neuer Knoten eingefügt. Der gerundete Punkt liegt nicht exakt auf den +Segmenten. Kreuzen sich drei Segmente auf engem Raum, bilden die gerundeten Schnittpunkte ein +winziges Dreieck mit falscher Orientierung. Dann +* wirft `SegmentIntersection` die Exception aus Zeile 768, oder +* entstehen invertierte Dreiecke **ohne Fehlermeldung** (gefährlichster Fall), oder +* pendeln `ScoutSegment` und `ConstrainedEdge` endlos (StackOverflow, im C-Original eine + Endlosschleife). + +Minimalbeispiel (Quadrat 0..10 plus drei Segmente): +`(2,4)-(4,8)`, `(1,5)-(6,6)`, `(1,7)-(5,3)` → inkonsistentes Netz ohne Exception. + +Das C-Original verhält sich identisch. Von den 200 Fuzz-Eingaben scheitern in Triangle.NET 43, +in C 44 (die 43 plus eine weitere). Mit vorab geteilten Segmenten (Noding) scheitert keine der +200 Eingaben, auch nicht beim Runden der Schnittpunkte auf 1e-6. + +**4 Thread-Sicherheit** (`src/Triangle/RobustPredicates.cs:37`, `:1259`) +`RobustPredicates.Default` ist ein Singleton. Die exakte Arithmetik schreibt Zwischenergebnisse in +Instanz-Arrays (`fin1`, `abdet`, `axbc` …). Im Test gaben 4 Threads auf fast kozirkulären +Punkten **über 100.000 falsche Vorzeichen** zurück. Betroffen sind also genau die Fälle, für die +die exakte Arithmetik da ist. Die Instanz wird von `new Configuration()` verwendet und zusätzlich +direkt von `MeshValidator`, `Contour.FindInteriorPoint`, den Voronoi-Klassen und `SimpleSmoother`. +`MeshValidator` schaltet außerdem das statische `Behavior.NoExact` um, und `Statistic` sowie +`Log.Instance` sind globale, nicht synchronisierte Zustände. + +**5 Dwyer mit identischen Punkten** (`src/Triangle/Meshing/Algorithm/Dwyer.cs:487`) +Nach dem Entfernen der Duplikate bleibt ein einziger Punkt übrig. `DivconqRecurse` hat für +`vertices == 1` keinen Abbruchfall. + +**6 Smoother** (`src/Triangle/Smoothing/SimpleSmoother.cs:181`) +Der Zellschwerpunkt wird per Shoelace-Formel mit **absoluten** Koordinaten berechnet. +Bei Koordinaten um 1e6 sind die Produkte ~1e12, die Zellfläche ~1e-1, und die Auslöschung frisst +alle signifikanten Stellen. Die Division durch die falsch berechnete Fläche liefert Unsinn/NaN. +Verifiziert: Werden die Koordinaten relativ zum Generator der Zelle gerechnet, ist der Test grün. + +**7 NaN/Infinity**: Es gibt keine Eingabeprüfung. Die Ausnahme entsteht in +`FastExpansionSumZeroElim`, wo bereits ein Workaround gegen Indexfehler im Code steht +(`RobustPredicates.cs:639`). Im Smoother-Kontext führen NaN-Werte auch zu Hängern. + +**8 Vertex-IDs** (`src/Triangle/Mesh.cs:400`): Sind die IDs der ersten beiden Punkte verschieden, +werden alle IDs als eindeutig angenommen. Ein realistischer Auslöser ist +`mesh.Vertices` eines bestehenden Netzes plus ein neuer Punkt (ID 0). + +**9 Hashcode-Vertrag** (`src/Triangle/Geometry/Vertex.cs:123`): Zwei koordinatengleiche Vertices +sind `Equals`, haben aber verschiedene Hashcodes. `HashSet` bzw. +`Dictionary` verhalten sich dadurch fehlerhaft. + +**10 SweepLine**: Die Reihenfolge der Kreis-Ereignisse wird in Gleitkomma bestimmt +(`SweepLine.cs:655`, `CircleTop`). Das Ergebnis ist konsistent, aber nicht exakt Delaunay. + +### Kein Bug, aber eine Praxisfalle: Slivers + Qualitätsvermaschung + +Zwei Nachbarflächen, deren gemeinsame Kante doppelt und minimal abweichend digitalisiert wurde, +erzeugen schmale Slivers. Mit `MinimumAngle` **terminiert die Verfeinerung praktisch nicht**, +weil ein Sliver der Breite ε etwa Länge/ε Dreiecke braucht (gemessen: unbegrenzt > 30 s bzw. +400.000 Dreiecke bei 200.000 Steinerpunkten). Ohne Qualitätsoptionen oder mit +`QualityOptions.SteinerPoints` ist das Ergebnis konsistent. Das Verhalten ist algorithmisch +korrekt, es fehlt aber eine Standard-Obergrenze. + +### Was robust funktioniert (grüne Regressionstests) + +Die folgenden Fälle stehen in `RobustnessRegressionTest`: +geschlossene Ringe mit wiederholtem Startpunkt (GIS-Konvention), selbstüberschneidende Konturen +(Bowtie), kollinear überlappende Segmente, doppelte/umgekehrte Segmente, Spikes, Fast-Duplikate +(bis 1e-15), Punkte fast auf Segmenten, Segmente durch Punkte, kleine Eingabewinkel bis 0,01°, +dünne Löcher, Lochpunkt auf dem Rand, sich berührende Löcher, Loch am Außenrand, große +Koordinaten (1e5–1e9) mit Millimeter-Details, zweifaches Verfeinern, Maximalwinkel, +Raster mit allen drei Algorithmen, zufällige reelle Kreuzungen inkl. Qualitätsvermaschung, +paralleles Vermaschen mit eigenen Prädikaten. + +## Empfehlungen für den Einsatz mit unsauberen Daten + +1. **Eingabe vorher noden.** Alle Segmentschnitte selbst berechnen und die Segmente dort teilen, + damit der Mesher nie kreuzende Segmente sieht. Für GIS-Daten bietet sich NetTopologySuite an + (Noding bzw. Snap-Rounding, z. B. `GeometryNoder`/`SnapRoundingNoder`). Das beseitigt + Befunde 1–3 und im Test alle 43 Fehlschläge. +2. **Gemeinsame Punkte als dieselben `Vertex`-Objekte übergeben** oder vorab auf ein Raster + snappen. Das ist nicht zwingend nötig (Duplikate werden erkannt), vermeidet aber Slivers. +3. **Bei Parallelbetrieb eigene Prädikate pro Mesher:** + `new GenericMesher(new Configuration(() => new RobustPredicates()))`. + `MeshValidator` und `SimpleSmoother` nicht parallel verwenden. +4. **Immer ein `SteinerPoints`-Limit setzen** und die Laufzeit begrenzen (`CancellationToken`). +5. **Ergebnis validieren:** `MeshValidator.IsConsistent(mesh)` nach der Triangulation, weil + Fehler sonst still bleiben können. Bei Fehlschlag Fallback nutzen (z. B. Noding/Snapping mit + gröberem Raster). +6. **Eingabe prüfen:** NaN/Infinity filtern, IDs eindeutig setzen oder alle auf 0 lassen. +7. **Für den Smoother Koordinaten zentrieren** (lokales Koordinatensystem) oder den Smoother-Fix + abwarten. +8. **Default-Algorithmus Dwyer beibehalten.** Er ist exakt Delaunay; SweepLine ist es nicht. + +## Die Testsuite (`src/Triangle.Tests/Robustness`) + +* **Red Tests** tragen die Kategorie `KnownBug` (20 Tests) und dokumentieren jeweils einen Fehler + mit Schweregrad in der `[Description]`. Wird ein Fehler behoben, wird der Test grün; dann die + Kategorie entfernen, und er wird zum Regressionstest. +* **Grüne Tests** (`RobustnessRegressionTest` u. a.) sichern das heute korrekte Verhalten ab. +* `MeshAssert` prüft Konsistenz, invertierte Dreiecke, vollständige Eingabesegmente, Fläche und + Terminierung (mit Timeout). +* Fälle, die den Prozess abstürzen lassen (StackOverflow) oder hängen, laufen über + `IsolatedProcess` in einem **Kindprozess**: Die Test-Assembly hat dafür einen eigenen + Einstiegspunkt (`Program.cs`). So reißen sie nicht den ganzen Testlauf mit. +* CI (`.github/workflows/dotnet.yml`) führt die regulären Tests blockierend und die `KnownBug`-Tests + informativ (`continue-on-error`) aus. + +``` +dotnet test src/Triangle.Tests --filter "TestCategory!=KnownBug" # muss grün sein +dotnet test src/Triangle.Tests --filter "TestCategory=KnownBug" # bekannte Bugs (rot) +``` + +Für jede neue Bug-Vermutung: Minimalfall als Test mit `[Category(KnownBug.Category)]` anlegen, +mit `MeshAssert` die erwartete Eigenschaft prüfen und bei Absturz- oder Hängegefahr ein Szenario in +`IsolatedScenarios` hinterlegen. diff --git a/src/Triangle.Tests/Program.cs b/src/Triangle.Tests/Program.cs new file mode 100644 index 0000000..4d7812d --- /dev/null +++ b/src/Triangle.Tests/Program.cs @@ -0,0 +1,20 @@ +namespace TriangleNet.Tests +{ + using TriangleNet.Tests.Robustness; + + /// + /// Entry point of the test assembly. + /// + /// + /// The test runner doesn't use this entry point. It is used by + /// to execute scenarios that might crash the process (e.g. StackOverflowException) or never + /// terminate, so they can't take down the whole test run. + /// + public static class Program + { + public static int Main(string[] args) + { + return IsolatedProcess.RunScenario(args); + } + } +} diff --git a/src/Triangle.Tests/Robustness/InputValidationTest.cs b/src/Triangle.Tests/Robustness/InputValidationTest.cs new file mode 100644 index 0000000..14232cf --- /dev/null +++ b/src/Triangle.Tests/Robustness/InputValidationTest.cs @@ -0,0 +1,158 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Invalid or unusual input should either work or be rejected with a meaningful exception. + /// + public class InputValidationTest + { + [Test, Category(KnownBug.Category)] + [Description("Severity: medium. NaN coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] + public void NaNCoordinate() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Vertex(double.NaN, 0.5)); + + Assert.Throws(() => poly.Triangulate()); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: medium. Infinite coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] + public void InfiniteCoordinate() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Vertex(double.PositiveInfinity, 0.5)); + + Assert.Throws(() => poly.Triangulate()); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: medium. Mesh.TransferNodes assumes all ids are distinct if the first two are. Otherwise: 'An item with the same key has already been added'.")] + public void PartiallyDuplicateUserIds() + { + var points = new List + { + new Vertex(0, 0) { ID = 1 }, + new Vertex(1, 0) { ID = 2 }, + new Vertex(1, 1) { ID = 2 }, + new Vertex(0, 1) { ID = 3 } + }; + + var mesh = new Dwyer().Triangulate(points, new Configuration()); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 1.0); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: medium. Re-triangulating the vertices of an existing mesh plus a new vertex fails, because the new vertex has id 0 which is already in use.")] + public void ReuseMeshVerticesAndAddVertex() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + + var points = poly.Triangulate().Vertices.ToList(); + + points.Add(new Vertex(0.5, 0.5)); + + var mesh = new Dwyer().Triangulate(points, new Configuration()); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count, Is.EqualTo(5)); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: high. Dwyer (the default triangulator) recurses infinitely if all points are identical (StackOverflowException kills the process).")] + public void AllPointsIdenticalDwyer() + { + IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.DwyerAllPointsIdentical)); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: low. SweepLine throws if all points are identical, while Incremental returns an empty mesh (and all algorithms return an empty mesh for collinear input).")] + public void AllPointsIdenticalSweepLine() + { + var points = Enumerable.Range(0, 5).Select(_ => new Vertex(1, 1)).ToList(); + + var mesh = new SweepLine().Triangulate(points, new Configuration()); + + Assert.That(mesh.Triangles.Count, Is.Zero); + } + + [Test] + public void AllPointsIdenticalIncremental() + { + var points = Enumerable.Range(0, 5).Select(_ => new Vertex(1, 1)).ToList(); + + var mesh = new Incremental().Triangulate(points, new Configuration()); + + Assert.That(mesh.Triangles.Count, Is.Zero); + } + + [Test] + public void AllPointsCollinear([ValueSource(nameof(Triangulators))] ITriangulator triangulator) + { + var points = Enumerable.Range(0, 10).Select(i => new Vertex(i, 2 * i)).ToList(); + + var mesh = triangulator.Triangulate(points, new Configuration()); + + Assert.That(mesh.Triangles.Count, Is.Zero); + } + + [Test] + public void AllPointsCollinearPolygon() + { + var poly = new Polygon(); + poly.Add(new Contour(Enumerable.Range(0, 5).Select(i => new Vertex(i, i)))); + + Assert.That(poly.Triangulate().Triangles.Count, Is.Zero); + } + + [Test] + public void SegmentEndpointsNotInPointList() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Segment(new Vertex(0.2, 0.2), new Vertex(0.8, 0.8)), false); + + // Documents current behavior: a generic exception with a cryptic message. + var e = Assert.Throws(() => poly.Triangulate()); + Assert.That(e.Message, Does.Contain("Unable to locate PSLG vertex")); + } + + [Test] + public void PolygonTriangulatedTwice() + { + // The mesher modifies the input vertices (id, type, triangle reference). + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Segment(new Vertex(0.2, 0.2), new Vertex(0.8, 0.8)), true); + poly.Add(new Vertex(0.2, 0.2)); + + var quality = new QualityOptions { MinimumAngle = 25 }; + + var mesh1 = poly.Triangulate(quality); + var mesh2 = poly.Triangulate(quality); + + MeshAssert.IsValid(mesh2); + MeshAssert.ContainsSegments(mesh2, poly.Segments); + Assert.That(mesh2.Triangles.Count, Is.EqualTo(mesh1.Triangles.Count)); + } + + private static IEnumerable Triangulators() + { + yield return new Dwyer(); + yield return new SweepLine(); + yield return new Incremental(); + } + } +} diff --git a/src/Triangle.Tests/Robustness/IsolatedProcess.cs b/src/Triangle.Tests/Robustness/IsolatedProcess.cs new file mode 100644 index 0000000..80aa0ff --- /dev/null +++ b/src/Triangle.Tests/Robustness/IsolatedProcess.cs @@ -0,0 +1,121 @@ +using NUnit.Framework; +using System; +using System.Diagnostics; +using System.Reflection; +using System.Text; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Runs a scenario (a public static method of ) in a child + /// process. Use this for code that might crash the process (StackOverflowException can't be + /// caught in .NET) or might never terminate. + /// + static class IsolatedProcess + { + public const int ExitSuccess = 0; + public const int ExitException = 1; + public const int ExitUnknownScenario = 2; + + public static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30); + + /// + /// Assert that the given scenario completes successfully in a child process. + /// + public static void AssertSucceeds(string scenario, TimeSpan? timeout = null) + { + var result = Run(scenario, timeout ?? DefaultTimeout); + + if (result.TimedOut) + { + Assert.Fail($"Scenario '{scenario}' did not terminate within {(timeout ?? DefaultTimeout).TotalSeconds}s (infinite loop?)."); + } + + if (result.ExitCode != ExitSuccess) + { + string reason = result.ExitCode == ExitException + ? "threw an exception" + : $"crashed the process (exit code {result.ExitCode}, e.g. StackOverflowException)"; + + Assert.Fail($"Scenario '{scenario}' {reason}:\n{Truncate(result.Output, 2000)}"); + } + } + + public static (bool TimedOut, int ExitCode, string Output) Run(string scenario, TimeSpan timeout) + { + var assembly = typeof(IsolatedProcess).Assembly.Location; + var host = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; + + var psi = new ProcessStartInfo(host) + { + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false + }; + + psi.ArgumentList.Add(assembly); + psi.ArgumentList.Add(scenario); + + var output = new StringBuilder(); + + using var process = new Process { StartInfo = psi }; + + // Read asynchronously: a stack overflow trace can fill the pipe buffer. + process.OutputDataReceived += (s, e) => { if (e.Data != null) lock (output) output.AppendLine(e.Data); }; + process.ErrorDataReceived += (s, e) => { if (e.Data != null) lock (output) output.AppendLine(e.Data); }; + + process.Start(); + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + + if (!process.WaitForExit((int)timeout.TotalMilliseconds)) + { + process.Kill(true); + return (true, -1, output.ToString()); + } + + process.WaitForExit(); + + lock (output) + { + return (false, process.ExitCode, output.ToString()); + } + } + + /// + /// Executed in the child process (see ). + /// + public static int RunScenario(string[] args) + { + if (args.Length != 1) + { + Console.Error.WriteLine("Usage: Triangle.Tests "); + return ExitUnknownScenario; + } + + var method = typeof(IsolatedScenarios).GetMethod(args[0], BindingFlags.Public | BindingFlags.Static); + + if (method == null) + { + Console.Error.WriteLine($"Unknown scenario '{args[0]}'."); + return ExitUnknownScenario; + } + + try + { + method.Invoke(null, null); + return ExitSuccess; + } + catch (TargetInvocationException e) + { + Console.Error.WriteLine(e.InnerException); + return ExitException; + } + } + + private static string Truncate(string s, int length) + { + return s.Length <= length ? s : s.Substring(0, length) + "..."; + } + } +} diff --git a/src/Triangle.Tests/Robustness/IsolatedScenarios.cs b/src/Triangle.Tests/Robustness/IsolatedScenarios.cs new file mode 100644 index 0000000..42990c4 --- /dev/null +++ b/src/Triangle.Tests/Robustness/IsolatedScenarios.cs @@ -0,0 +1,65 @@ +using System; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; +using TriangleNet.Smoothing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Scenarios executed in a child process by , because they + /// crash the process or don't terminate. Each scenario must throw if the result is wrong. + /// + public static class IsolatedScenarios + { + /// + /// Dwyer: all input points identical. + /// + public static void DwyerAllPointsIdentical() + { + var points = Enumerable.Range(0, 5).Select(_ => new Vertex(1, 1)).ToList(); + + var mesh = new Dwyer().Triangulate(points, new Configuration()); + + Check(mesh.Triangles.Count == 0, "Expected empty mesh."); + } + + /// + /// Five segments with integer coordinates (found by fuzzing). + /// + public static void FiveCrossingSegments() + { + var poly = TestData.SquareWithSegments( + (9, 3, 2, 0), (7, 2, 1, 8), (7, 3, 3, 6), (10, 6, 9, 1), (10, 10, 8, 2)); + + var mesh = poly.Triangulate(); + + Check(MeshValidator.IsConsistent((Mesh)mesh), "Mesh is inconsistent."); + } + + /// + /// Smoothing a mesh located far away from the origin (e.g. UTM coordinates). + /// + public static void SmoothMeshWithLargeCoordinates() + { + const double offset = 1e6; + + var poly = new Polygon(); + poly.Add(TestData.Square(offset, offset, 10)); + poly.Add(new Segment(new Vertex(offset + 1, offset + 1), new Vertex(offset + 9, offset + 1.000001)), true); + + var mesh = poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, new QualityOptions { MinimumAngle = 25 }); + + new SimpleSmoother().Smooth(mesh, 10); + + Check(MeshValidator.IsConsistent((Mesh)mesh), "Mesh is inconsistent."); + Check(mesh.Vertices.All(v => double.IsFinite(v.X) && double.IsFinite(v.Y)), "Mesh contains non-finite vertices."); + } + + private static void Check(bool condition, string message) + { + if (!condition) throw new Exception(message); + } + } +} diff --git a/src/Triangle.Tests/Robustness/KnownBug.cs b/src/Triangle.Tests/Robustness/KnownBug.cs new file mode 100644 index 0000000..4393f3a --- /dev/null +++ b/src/Triangle.Tests/Robustness/KnownBug.cs @@ -0,0 +1,16 @@ +namespace TriangleNet.Tests.Robustness +{ + /// + /// Test category for red tests documenting known bugs. Tests in this category are + /// expected to fail until the corresponding bug is fixed. Once a test turns green, + /// remove the category so it becomes a regular regression test. + /// + /// + /// Run only the known bugs: dotnet test --filter TestCategory=KnownBug + /// Run everything else: dotnet test --filter TestCategory!=KnownBug + /// + static class KnownBug + { + public const string Category = "KnownBug"; + } +} diff --git a/src/Triangle.Tests/Robustness/MeshAssert.cs b/src/Triangle.Tests/Robustness/MeshAssert.cs new file mode 100644 index 0000000..6325586 --- /dev/null +++ b/src/Triangle.Tests/Robustness/MeshAssert.cs @@ -0,0 +1,151 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Validation helpers for robustness tests. A mesh is considered valid if it is + /// topologically consistent, has no flat or inverted triangles, and all input + /// segments are fully represented by mesh subsegments. + /// + static class MeshAssert + { + /// + /// Default timeout for meshing operations that might not terminate. + /// + public static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(10); + + /// + /// Run the given meshing function on a separate thread and fail if it does + /// not finish within the timeout (detects infinite loops). + /// + public static T Terminates(Func func, TimeSpan? timeout = null) + { + var task = Task.Factory.StartNew(func, CancellationToken.None, + TaskCreationOptions.LongRunning, TaskScheduler.Default); + + if (!task.Wait(timeout ?? DefaultTimeout)) + { + Assert.Fail($"Operation did not terminate within {(timeout ?? DefaultTimeout).TotalSeconds}s (infinite loop?)."); + } + + return task.Result; + } + + /// + /// Assert that the mesh is topologically consistent and contains no + /// flat or inverted triangles. + /// + public static void IsValid(IMesh mesh) + { + Assert.That(mesh, Is.Not.Null); + Assert.That(mesh.Triangles.Count, Is.GreaterThan(0), "Mesh has no triangles."); + Assert.That(MeshValidator.IsConsistent((Mesh)mesh), Is.True, "Mesh is not consistent."); + + foreach (var t in mesh.Triangles) + { + var a = t.GetVertex(0); + var b = t.GetVertex(1); + var c = t.GetVertex(2); + + Assert.That(RobustPredicates.Default.CounterClockwise(a, b, c), Is.GreaterThan(0.0), + $"Triangle {t.ID} is flat or inverted."); + + foreach (var v in new[] { a, b, c }) + { + Assert.That(double.IsFinite(v.X) && double.IsFinite(v.Y), Is.True, + $"Triangle {t.ID} has a non-finite vertex."); + } + } + } + + /// + /// Assert that every input segment (with non-coincident endpoints) is completely + /// covered by mesh subsegments lying on it. + /// + public static void ContainsSegments(IMesh mesh, IEnumerable segments, double relTol = 1e-9) + { + var subsegs = mesh.Segments.Select(s => (s.GetVertex(0), s.GetVertex(1))).ToList(); + + foreach (var seg in segments) + { + var p = seg.GetVertex(0); + var q = seg.GetVertex(1); + + double length = Distance(p, q); + + if (length == 0.0) continue; + + double tol = relTol * Math.Max(length, Scale(p, q)); + + double covered = subsegs + .Where(s => DistanceToSegment(s.Item1, p, q) <= tol && DistanceToSegment(s.Item2, p, q) <= tol) + .Sum(s => Distance(s.Item1, s.Item2)); + + Assert.That(covered, Is.EqualTo(length).Within(tol * 10), + $"Input segment ({p.X}, {p.Y}) - ({q.X}, {q.Y}) is not fully contained in the mesh."); + } + } + + /// + /// Assert that the total area of the mesh equals the expected area. + /// + public static void HasArea(IMesh mesh, double expected, double relTol = 1e-9) + { + double area = mesh.Triangles.Sum(t => Area(t)); + + Assert.That(area, Is.EqualTo(expected).Within(Math.Abs(expected) * relTol), + "Mesh area doesn't match."); + } + + /// + /// Assert that each input vertex coordinate is present in the mesh. + /// + public static void ContainsPoints(IMesh mesh, IEnumerable points) + { + var set = new HashSet<(double, double)>(mesh.Vertices + .Where(v => v.Type != VertexType.UndeadVertex) + .Select(v => (v.X, v.Y))); + + foreach (var p in points) + { + Assert.That(set.Contains((p.X, p.Y)), Is.True, $"Input point ({p.X}, {p.Y}) missing in mesh."); + } + } + + public static double Area(ITriangle t) + { + var a = t.GetVertex(0); + var b = t.GetVertex(1); + var c = t.GetVertex(2); + + return 0.5 * ((b.X - a.X) * (c.Y - a.Y) - (c.X - a.X) * (b.Y - a.Y)); + } + + private static double Scale(Point p, Point q) + { + return Math.Max(Math.Max(Math.Abs(p.X), Math.Abs(p.Y)), Math.Max(Math.Abs(q.X), Math.Abs(q.Y))); + } + + private static double Distance(Point a, Point b) + { + double dx = a.X - b.X, dy = a.Y - b.Y; + return Math.Sqrt(dx * dx + dy * dy); + } + + private static double DistanceToSegment(Point v, Point p, Point q) + { + double dx = q.X - p.X, dy = q.Y - p.Y; + double len2 = dx * dx + dy * dy; + double t = ((v.X - p.X) * dx + (v.Y - p.Y) * dy) / len2; + t = Math.Max(0.0, Math.Min(1.0, t)); + return Distance(v, new Point(p.X + t * dx, p.Y + t * dy)); + } + } +} diff --git a/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs b/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs new file mode 100644 index 0000000..d517b3e --- /dev/null +++ b/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs @@ -0,0 +1,89 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; + +namespace TriangleNet.Tests.Robustness +{ + public class MiscellaneousBugsTest + { + [Test, Category(KnownBug.Category)] + [Description("Severity: high. SimpleSmoother computes cell centroids with absolute coordinates (catastrophic cancellation far from the origin), producing invalid vertices.")] + public void SmoothMeshWithLargeCoordinates() + { + IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.SmoothMeshWithLargeCoordinates), TimeSpan.FromSeconds(15)); + } + + [Test] + public void SmoothMeshNearOrigin() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Segment(new Vertex(1, 1), new Vertex(9, 1.000001)), true); + + var mesh = poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, new QualityOptions { MinimumAngle = 25 }); + + MeshAssert.Terminates(() => new TriangleNet.Smoothing.SimpleSmoother().Smooth(mesh, 10)); + MeshAssert.IsValid(mesh); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: low. SweepLine output isn't Delaunay for nearly cocircular points (violations of order 1e-16), because the event queue uses inexact circle tops.")] + public void SweepLineNearlyCocircularPoints([Range(1, 5)] int seed) + { + var random = new Random(seed); + var points = new List(); + + for (int i = 0; i < 10; i++) + { + double a = random.NextDouble() * 2 * Math.PI; + points.Add(new Vertex(Math.Cos(a), Math.Sin(a))); + } + + var mesh = (Mesh)new SweepLine().Triangulate(points, new Configuration()); + + MeshAssert.IsValid(mesh); + Assert.That(MeshValidator.IsDelaunay(mesh), Is.True); + } + + [Test] + public void NearlyCocircularPoints([Values(0.0, 1e6)] double offset) + { + foreach (var triangulator in new ITriangulator[] { new Dwyer(), new Incremental() }) + { + var random = new Random(1); + var points = new List(); + + for (int i = 0; i < 500; i++) + { + double a = random.NextDouble() * 2 * Math.PI; + points.Add(new Vertex(offset + Math.Cos(a), offset + Math.Sin(a))); + } + + var mesh = (Mesh)triangulator.Triangulate(points, new Configuration()); + + MeshAssert.IsValid(mesh); + Assert.That(MeshValidator.IsDelaunay(mesh), Is.True, triangulator.GetType().Name); + } + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: medium. Point.Equals compares coordinates, but Vertex.GetHashCode returns the internal hash, so equal vertices have different hash codes (breaks HashSet/Dictionary).")] + public void VertexEqualsAndHashCodeContract() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Vertex(0, 0)); + + poly.Triangulate(); + + var a = poly.Points[0]; + var b = poly.Points[4]; + + Assert.That(a.Equals(b), Is.True); + Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode())); + } + } +} diff --git a/src/Triangle.Tests/Robustness/RobustnessRegressionTest.cs b/src/Triangle.Tests/Robustness/RobustnessRegressionTest.cs new file mode 100644 index 0000000..52f1e01 --- /dev/null +++ b/src/Triangle.Tests/Robustness/RobustnessRegressionTest.cs @@ -0,0 +1,411 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Degenerate and "dirty" input which is handled correctly. These tests guard against + /// regressions. + /// + public class RobustnessRegressionTest + { + private static readonly TimeSpan LongTimeout = TimeSpan.FromSeconds(30); + + [Test] + public void ClosedRingWithDistinctFirstAndLastVertex() + { + // GIS formats usually repeat the first vertex at the end of a ring. + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(1, 0), new Vertex(1, 1), new Vertex(0, 1), new Vertex(0, 0) })); + + var mesh = poly.Triangulate(); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 1.0); + } + + [Test] + public void SelfIntersectingContour() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(1, 1), new Vertex(1, 0), new Vertex(0, 1) })); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 0.5); + } + + [Test] + public void OverlappingCollinearSegments() + { + var poly = TestData.SquareWithSegments((1, 5, 6, 5), (4, 5, 9, 5)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void SelfOverlappingCollinearContour() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(10, 0), new Vertex(10, 10), new Vertex(5, 10), new Vertex(8, 10), new Vertex(0, 10) })); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void DuplicateSegmentReversed() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + + var a = new Vertex(2, 2); + var b = new Vertex(8, 7); + + poly.Add(new Segment(a, b), true); + poly.Add(new Segment(b, a)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void SpikeInContour() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(10, 0), new Vertex(10, 5), new Vertex(15, 5), new Vertex(10, 5), new Vertex(10, 10), new Vertex(0, 10) })); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void SegmentEndpointsDuplicateContourVertices() + { + var poly = TestData.SquareWithSegments((0, 0, 10, 10)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + } + + [Test] + public void SegmentThroughVertices() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 4)); + poly.Add(new Vertex(2, 2)); + poly.Add(new Vertex(1, 1)); + poly.Add(new Segment(new Vertex(0.5, 0.5), new Vertex(3.5, 3.5)), true); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + } + + [Test] + public void CrossingSegmentsNearlyThroughVertex([Values(1e-8, 1e-12, 1e-15)] double eps) + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 4)); + poly.Add(new Vertex(2, 2 + eps)); + poly.Add(new Segment(new Vertex(0.5, 0.5), new Vertex(3.5, 3.5)), true); + poly.Add(new Segment(new Vertex(0.5, 3.5), new Vertex(3.5, 0.5)), true); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments, 1e-7); + } + + [Test] + public void NearlyDuplicateVertices([Values(1e-6, 1e-10, 1e-13, 1e-15)] double eps) + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + poly.Add(new Vertex(0.5, 0.5)); + poly.Add(new Vertex(0.5 + eps, 0.5)); + poly.Add(new Vertex(0.5, 0.5 + eps)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 1.0); + } + + [Test] + public void VertexNearlyOnSegment([Values(1e-6, 1e-10, 1e-14)] double eps) + { + var poly = TestData.SquareWithSegments((1, 5, 9, 5)); + poly.Add(new Vertex(5, 5 + eps)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void LargeCoordinatesWithSmallFeatures([Values(1e5, 1e7, 1e9)] double offset) + { + // Typical GIS coordinates (UTM / Gauss-Krueger) with millimeter-sized features. + var poly = new Polygon(); + poly.Add(TestData.Square(offset, offset, 10)); + + var random = new Random(1); + + for (int i = 0; i < 30; i++) + { + double x = offset + 1 + random.NextDouble() * 8; + double y = offset + 1 + random.NextDouble() * 8; + + poly.Add(new Segment(new Vertex(x, y), new Vertex(x + 0.001, y + 0.0005)), true); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100, 1e-6); + } + + [Test] + public void SmallInputAngle([Values(1.0, 0.1, 0.01)] double angle) + { + var poly = new Polygon(); + var a = angle * Math.PI / 180; + + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(1, 0), new Vertex(Math.Cos(a), Math.Sin(a)) })); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 30 }), LongTimeout); + + MeshAssert.IsValid(mesh); + } + + [Test] + public void FanOfSegmentsWithSmallAngles() + { + var poly = new Polygon(); + poly.Add(TestData.Square(-1, -1, 2)); + + var center = new Vertex(0, 0); + poly.Add(center); + + for (int i = 0; i < 20; i++) + { + double a = i * 0.001; + poly.Add(new Segment(center, new Vertex(0.9 * Math.Cos(a), 0.9 * Math.Sin(a))), 1); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 25 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 4); + } + + [Test] + public void ThinRectangleWithMaximumAngle() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(100, 0), new Vertex(100, 0.01), new Vertex(0, 0.01) })); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20, MaximumAngle = 100 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 1.0); + } + + [Test] + public void ThinHole() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Contour(new[] { new Vertex(2, 2), new Vertex(8, 2), new Vertex(8, 2.00001), new Vertex(2, 2.00001) }), true); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100 - 6 * 0.00001, 1e-9); + } + + [Test] + public void HolePointOnBoundary() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(2, 2, 2), new Point(2, 3)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 96); + } + + [Test] + public void TouchingHoles() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(2, 2, 2), true); + poly.Add(TestData.Square(4, 2, 2), true); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 25 })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 92); + } + + [Test] + public void HoleTouchingOuterBoundary() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Contour(new[] { new Vertex(0, 4), new Vertex(3, 4), new Vertex(3, 6), new Vertex(0, 6) }), new Point(1, 5)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 25 })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 94); + } + + [Test] + public void RefineTwice() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(3, 3, 2), true); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = 20 }); + + mesh.Refine(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.5 }, false); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 96); + } + + [Test] + public void AdjacentPolygonsWithMismatchedBoundary([Values(1e-6, 1e-9, 1e-12)] double eps) + { + var poly = TestData.AdjacentPolygonsWithMismatchedBoundary(eps); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 200, 1e-6); + } + + [Test] + public void AdjacentPolygonsWithMismatchedBoundaryQuality([Values(1e-6, 1e-9, 1e-12)] double eps) + { + // Without a Steiner point limit, quality meshing of the slivers between the two + // boundaries practically doesn't terminate (a sliver of width eps requires about + // length/eps triangles to satisfy the minimum angle). With a limit, the result is + // valid (though the minimum angle can't be satisfied). + var poly = TestData.AdjacentPolygonsWithMismatchedBoundary(eps); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20, SteinerPoints = 5000 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 200, 1e-6); + } + + [Test] + public void GridPoints([ValueSource(nameof(Triangulators))] ITriangulator triangulator) + { + var points = new List(); + + for (int i = 0; i < 30; i++) + { + for (int j = 0; j < 30; j++) + { + points.Add(new Vertex(i * 0.1, j * 0.1)); + } + } + + var mesh = triangulator.Triangulate(points, new Configuration()); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 2.9 * 2.9); + } + + [Test] + public void RandomCrossingSegmentsQuality([Range(0, 49)] int seed) + { + var random = new Random(seed); + var poly = new Polygon(); + + poly.Add(TestData.Square(0, 0, 10)); + + for (int i = 0; i < 15; i++) + { + poly.Add(new Segment( + new Vertex(random.NextDouble() * 10, random.NextDouble() * 10), + new Vertex(random.NextDouble() * 10, random.NextDouble() * 10)), true); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 28 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void ParallelMeshingWithPrivatePredicates() + { + // Workaround for the thread safety issue (see ThreadSafetyTest). + static IMesh Triangulate() + { + var poly = new Polygon(); + poly.Add(TestData.Square(1e6, 1e6, 10)); + + var random = new Random(7); + + for (int i = 0; i < 40; i++) + { + poly.Add(new Segment( + new Vertex(1e6 + random.NextDouble() * 10, 1e6 + random.NextDouble() * 10), + new Vertex(1e6 + random.NextDouble() * 10, 1e6 + random.NextDouble() * 10)), true); + } + + var mesher = new GenericMesher(new Configuration(() => new RobustPredicates())); + + return mesher.Triangulate(poly, new QualityOptions { MinimumAngle = 25 }); + } + + int expected = Triangulate().Triangles.Count; + + var counts = new int[32]; + + Parallel.For(0, counts.Length, i => counts[i] = Triangulate().Triangles.Count); + + Assert.That(counts, Is.All.EqualTo(expected)); + } + + private static IEnumerable Triangulators() + { + yield return new Dwyer(); + yield return new SweepLine(); + yield return new Incremental(); + } + } +} diff --git a/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs b/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs new file mode 100644 index 0000000..123cece --- /dev/null +++ b/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs @@ -0,0 +1,123 @@ +using NUnit.Framework; +using System.Collections.Generic; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Input segments that cross each other. The mesher inserts a vertex at each intersection, + /// but the intersection point is rounded to double precision and thus doesn't lie exactly on + /// either segment. With three or more segments crossing in a small region, this breaks the + /// topology. + /// + /// + /// All of these failures can be reproduced with the original C code of Triangle 1.6, i.e. they + /// are not porting bugs. Workaround: compute all intersections before triangulating + /// (noding), so the mesher never has to split crossing segments. + /// + public class SegmentIntersectionTest + { + [Test, Category(KnownBug.Category)] + [Description("Severity: high. Three crossing segments throw 'Topological inconsistency after splitting a segment'.")] + public void ThreeCrossingSegmentsThrow() + { + var poly = TestData.SquareWithSegments((9, 5, 5, 7), (7, 7, 4, 1), (6, 5, 3, 10)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: critical. Three crossing segments silently produce a mesh with inverted triangles (no exception).")] + [TestCase(2, 4, 4, 8, 1, 5, 6, 6, 1, 7, 5, 3)] + [TestCase(2, 5, 9, 5, 6, 3, 10, 10, 8, 7, 5, 0)] + [TestCase(5, 0, 1, 10, 7, 7, 0, 7, 3, 3, 8, 8)] + public void ThreeCrossingSegmentsProduceInvalidMesh( + double x1, double y1, double x2, double y2, + double x3, double y3, double x4, double y4, + double x5, double y5, double x6, double y6) + { + var poly = TestData.SquareWithSegments((x1, y1, x2, y2), (x3, y3, x4, y4), (x5, y5, x6, y6)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: critical. Five crossing segments cause an infinite recursion (StackOverflowException kills the process).")] + public void FiveCrossingSegmentsCrashProcess() + { + IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.FiveCrossingSegments)); + } + + [Test, Category(KnownBug.Category)] + [Description("Severity: high. Fuzzing with random integer segments: about 20% of the inputs fail.")] + public void RandomIntegerSegments() + { + var failures = new List(); + + for (int seed = 0; seed < 200; seed++) + { + var poly = TestData.SquareWithSegments(TestData.RandomIntegerSegments(seed, 15)); + + try + { + var mesh = (Mesh)MeshAssert.Terminates(() => poly.Triangulate()); + + if (!MeshValidator.IsConsistent(mesh)) + { + failures.Add($"seed {seed}: inconsistent mesh"); + } + } + catch (System.Exception e) + { + failures.Add($"seed {seed}: {e.GetBaseException().Message}"); + } + } + + Assert.That(failures, Is.Empty, $"{failures.Count} of 200 inputs failed:\n" + string.Join("\n", failures)); + } + + [Test] + public void RandomCrossingSegments([Values(10, 50)] int count) + { + // Random (non-integer) coordinates are less degenerate and work. + var poly = new Polygon(); + poly.Add(TestData.Square(-1, -1, 102)); + + var random = new System.Random(42); + + for (int i = 0; i < count; i++) + { + poly.Add(new Segment( + new Vertex(random.NextDouble() * 100, random.NextDouble() * 100), + new Vertex(random.NextDouble() * 100, random.NextDouble() * 100)), true); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate()); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments, 1e-7); + MeshAssert.HasArea(mesh, 102 * 102); + } + + [Test] + public void TwoCrossingSegments() + { + var poly = TestData.SquareWithSegments((1, 1, 9, 9), (1, 9, 9, 1)); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = 25 }); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + } + } +} diff --git a/src/Triangle.Tests/Robustness/TestData.cs b/src/Triangle.Tests/Robustness/TestData.cs new file mode 100644 index 0000000..95bc96c --- /dev/null +++ b/src/Triangle.Tests/Robustness/TestData.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; + +namespace TriangleNet.Tests.Robustness +{ + static class TestData + { + public static Contour Square(double x, double y, double size) + { + return new Contour(new[] + { + new Vertex(x, y), new Vertex(x + size, y), + new Vertex(x + size, y + size), new Vertex(x, y + size) + }); + } + + /// + /// Square [0,10]x[0,10] with additional segments given as (x1, y1, x2, y2). + /// Segment endpoints are separate vertex instances (duplicates are handled by the mesher). + /// + public static Polygon SquareWithSegments(params (double, double, double, double)[] segments) + { + var poly = new Polygon(); + + poly.Add(Square(0, 0, 10)); + + foreach (var (x1, y1, x2, y2) in segments) + { + poly.Add(new Segment(new Vertex(x1, y1), new Vertex(x2, y2)), true); + } + + return poly; + } + + /// + /// Random segments with integer coordinates in [0,10] (many crossings, touching + /// endpoints and collinear overlaps). + /// + public static (double, double, double, double)[] RandomIntegerSegments(int seed, int count) + { + var random = new Random(seed); + + return Enumerable.Range(0, count) + .Select(_ => ((double)random.Next(11), (double)random.Next(11), (double)random.Next(11), (double)random.Next(11))) + .ToArray(); + } + + /// + /// Two polygons sharing a common boundary which was digitized twice, with the + /// vertices of the second copy perturbed by up to eps (typical GIS data). + /// + public static Polygon AdjacentPolygonsWithMismatchedBoundary(double eps) + { + var poly = new Polygon(); + var random = new Random(3); + + var left = new List { new Vertex(0, 0) }; + var right = new List(); + + for (int i = 0; i <= 10; i++) + { + double x = 10 + Math.Sin(i), y = i; + + left.Add(new Vertex(x, y)); + right.Add(new Vertex(x + (random.NextDouble() - 0.5) * eps, y + (random.NextDouble() - 0.5) * eps)); + } + + left.Add(new Vertex(0, 10)); + right.Add(new Vertex(20, 10)); + right.Add(new Vertex(20, 0)); + + poly.Add(new Contour(left)); + poly.Add(new Contour(right)); + + return poly; + } + } +} diff --git a/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs b/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs new file mode 100644 index 0000000..157a4fb --- /dev/null +++ b/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs @@ -0,0 +1,88 @@ +using NUnit.Framework; +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using TriangleNet.Geometry; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// is a singleton, but the adaptive (exact) arithmetic + /// uses workspace arrays stored in instance fields. Concurrent calls overwrite each other's + /// intermediate results. + /// + /// + /// Since uses the singleton by default, meshing in parallel + /// (e.g. in a web service) can produce wrong predicate results for nearly degenerate input, + /// which is exactly the case the exact arithmetic is meant for. The default instance is also + /// used directly by MeshValidator, Contour.FindInteriorPoint, the Voronoi classes and the + /// SimpleSmoother. + /// Workaround: new GenericMesher(new Configuration(() => new RobustPredicates())). + /// + public class ThreadSafetyTest + { + [Test, Category(KnownBug.Category)] + [Description("Severity: critical (for multi-threaded use). Concurrent use of RobustPredicates.Default returns wrong results.")] + public void DefaultPredicatesInParallel() + { + Assert.That(CountWrongResultsInParallel(() => RobustPredicates.Default), Is.Zero); + } + + [Test] + public void PrivatePredicatesInParallel() + { + // One instance per thread works. + var local = new ThreadLocal(() => new RobustPredicates()); + + Assert.That(CountWrongResultsInParallel(() => local.Value), Is.Zero); + } + + private static int CountWrongResultsInParallel(Func predicates) + { + const int n = 5000; + + var random = new Random(1); + + // Nearly cocircular point sets, forcing the adaptive (exact) code path. + var input = new Point[n][]; + + for (int i = 0; i < n; i++) + { + double cx = random.NextDouble() * 1e3, cy = random.NextDouble() * 1e3; + double r = 1 + random.NextDouble(); + + input[i] = Enumerable.Range(0, 4).Select(_ => + { + double a = random.NextDouble() * 2 * Math.PI; + return new Point(cx + r * Math.Cos(a), cy + r * Math.Sin(a)); + }).ToArray(); + } + + var reference = new RobustPredicates(); + var expected = input.Select(p => Math.Sign(reference.InCircle(p[0], p[1], p[2], p[3]))).ToArray(); + + int wrong = 0; + + Parallel.For(0, 4, new ParallelOptions { MaxDegreeOfParallelism = 4 }, _ => + { + var pred = predicates(); + + for (int repeat = 0; repeat < 10; repeat++) + { + for (int i = 0; i < n; i++) + { + var p = input[i]; + + if (Math.Sign(pred.InCircle(p[0], p[1], p[2], p[3])) != expected[i]) + { + Interlocked.Increment(ref wrong); + } + } + } + }); + + return wrong; + } + } +} diff --git a/src/Triangle.Tests/Triangle.Tests.csproj b/src/Triangle.Tests/Triangle.Tests.csproj index 6d5ee9e..de63911 100644 --- a/src/Triangle.Tests/Triangle.Tests.csproj +++ b/src/Triangle.Tests/Triangle.Tests.csproj @@ -5,6 +5,8 @@ TriangleNet.Tests Triangle.Tests false + + false From 0fd5bba53e00e3b6b3a4f22cf31da5c91993ebb4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 22:17:39 +0000 Subject: [PATCH 02/50] Fix robustness bugs found by the red test suite - Add SegmentNoder: split crossing segments in advance (exact crossing detection), merge new vertices with existing ones within a small tolerance and snap vertices lying almost on a segment onto it. Enabled by default via ConstraintOptions.ResolveIntersections. - ConstraintMesher: replace tail recursion in ScoutSegment/ConstrainedEdge by loops, guard against non-terminating insertion and check orientation after inserting intersection vertices (never return an invalid mesh). - RobustPredicates: thread-local workspace, so instances are thread-safe. - QualityMesher: choose the point location start edge for aCute locations by orientation test (inverted triangles) and fall back to the circumcenter if the aCute location hits an existing vertex. - Dwyer/SweepLine: return an empty mesh for identical input points. - SweepLine: restore the Delaunay property by exact edge flips. - SimpleSmoother: compute centroids relative to the generator. - Mesh: reject NaN/infinite coordinates, check user ids for uniqueness. - Vertex: hash code consistent with Point.Equals. All former KnownBug tests pass and are now regular regression tests; add tests for noding and quality refinement of noded input. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Robustness/InputValidationTest.cs | 24 +- .../Robustness/MiscellaneousBugsTest.cs | 14 +- .../Robustness/NodingAndRefinementTest.cs | 125 +++++ .../Robustness/SegmentIntersectionTest.cs | 16 +- .../Robustness/ThreadSafetyTest.cs | 4 +- src/Triangle/Geometry/Vertex.cs | 4 +- src/Triangle/Mesh.cs | 36 +- src/Triangle/Meshing/Algorithm/Dwyer.cs | 7 + src/Triangle/Meshing/Algorithm/SweepLine.cs | 54 ++ src/Triangle/Meshing/ConstraintMesher.cs | 285 ++++++---- src/Triangle/Meshing/ConstraintOptions.cs | 10 + src/Triangle/Meshing/GenericMesher.cs | 6 + src/Triangle/Meshing/QualityMesher.cs | 185 +++--- src/Triangle/Meshing/SegmentNoder.cs | 530 ++++++++++++++++++ src/Triangle/RobustPredicates.cs | 329 +++++------ src/Triangle/Smoothing/SimpleSmoother.cs | 22 +- 16 files changed, 1247 insertions(+), 404 deletions(-) create mode 100644 src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs create mode 100644 src/Triangle/Meshing/SegmentNoder.cs diff --git a/src/Triangle.Tests/Robustness/InputValidationTest.cs b/src/Triangle.Tests/Robustness/InputValidationTest.cs index 14232cf..f61a00a 100644 --- a/src/Triangle.Tests/Robustness/InputValidationTest.cs +++ b/src/Triangle.Tests/Robustness/InputValidationTest.cs @@ -13,8 +13,8 @@ namespace TriangleNet.Tests.Robustness /// public class InputValidationTest { - [Test, Category(KnownBug.Category)] - [Description("Severity: medium. NaN coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] + [Test] + [Description("Fixed (severity: medium). NaN coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] public void NaNCoordinate() { var poly = new Polygon(); @@ -24,8 +24,8 @@ public void NaNCoordinate() Assert.Throws(() => poly.Triangulate()); } - [Test, Category(KnownBug.Category)] - [Description("Severity: medium. Infinite coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] + [Test] + [Description("Fixed (severity: medium). Infinite coordinates cause an IndexOutOfRangeException deep inside RobustPredicates.")] public void InfiniteCoordinate() { var poly = new Polygon(); @@ -35,8 +35,8 @@ public void InfiniteCoordinate() Assert.Throws(() => poly.Triangulate()); } - [Test, Category(KnownBug.Category)] - [Description("Severity: medium. Mesh.TransferNodes assumes all ids are distinct if the first two are. Otherwise: 'An item with the same key has already been added'.")] + [Test] + [Description("Fixed (severity: medium). Mesh.TransferNodes assumes all ids are distinct if the first two are. Otherwise: 'An item with the same key has already been added'.")] public void PartiallyDuplicateUserIds() { var points = new List @@ -53,8 +53,8 @@ public void PartiallyDuplicateUserIds() MeshAssert.HasArea(mesh, 1.0); } - [Test, Category(KnownBug.Category)] - [Description("Severity: medium. Re-triangulating the vertices of an existing mesh plus a new vertex fails, because the new vertex has id 0 which is already in use.")] + [Test] + [Description("Fixed (severity: medium). Re-triangulating the vertices of an existing mesh plus a new vertex fails, because the new vertex has id 0 which is already in use.")] public void ReuseMeshVerticesAndAddVertex() { var poly = new Polygon(); @@ -70,15 +70,15 @@ public void ReuseMeshVerticesAndAddVertex() Assert.That(mesh.Vertices.Count, Is.EqualTo(5)); } - [Test, Category(KnownBug.Category)] - [Description("Severity: high. Dwyer (the default triangulator) recurses infinitely if all points are identical (StackOverflowException kills the process).")] + [Test] + [Description("Fixed (severity: high). Dwyer (the default triangulator) recurses infinitely if all points are identical (StackOverflowException kills the process).")] public void AllPointsIdenticalDwyer() { IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.DwyerAllPointsIdentical)); } - [Test, Category(KnownBug.Category)] - [Description("Severity: low. SweepLine throws if all points are identical, while Incremental returns an empty mesh (and all algorithms return an empty mesh for collinear input).")] + [Test] + [Description("Fixed (severity: low). SweepLine throws if all points are identical, while Incremental returns an empty mesh (and all algorithms return an empty mesh for collinear input).")] public void AllPointsIdenticalSweepLine() { var points = Enumerable.Range(0, 5).Select(_ => new Vertex(1, 1)).ToList(); diff --git a/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs b/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs index d517b3e..45e7eaa 100644 --- a/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs +++ b/src/Triangle.Tests/Robustness/MiscellaneousBugsTest.cs @@ -9,8 +9,8 @@ namespace TriangleNet.Tests.Robustness { public class MiscellaneousBugsTest { - [Test, Category(KnownBug.Category)] - [Description("Severity: high. SimpleSmoother computes cell centroids with absolute coordinates (catastrophic cancellation far from the origin), producing invalid vertices.")] + [Test] + [Description("Fixed (severity: high). SimpleSmoother computes cell centroids with absolute coordinates (catastrophic cancellation far from the origin), producing invalid vertices.")] public void SmoothMeshWithLargeCoordinates() { IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.SmoothMeshWithLargeCoordinates), TimeSpan.FromSeconds(15)); @@ -29,8 +29,8 @@ public void SmoothMeshNearOrigin() MeshAssert.IsValid(mesh); } - [Test, Category(KnownBug.Category)] - [Description("Severity: low. SweepLine output isn't Delaunay for nearly cocircular points (violations of order 1e-16), because the event queue uses inexact circle tops.")] + [Test] + [Description("Fixed (severity: low). SweepLine output isn't Delaunay for nearly cocircular points (violations of order 1e-16), because the event queue uses inexact circle tops.")] public void SweepLineNearlyCocircularPoints([Range(1, 5)] int seed) { var random = new Random(seed); @@ -51,7 +51,7 @@ public void SweepLineNearlyCocircularPoints([Range(1, 5)] int seed) [Test] public void NearlyCocircularPoints([Values(0.0, 1e6)] double offset) { - foreach (var triangulator in new ITriangulator[] { new Dwyer(), new Incremental() }) + foreach (var triangulator in new ITriangulator[] { new Dwyer(), new SweepLine(), new Incremental() }) { var random = new Random(1); var points = new List(); @@ -69,8 +69,8 @@ public void NearlyCocircularPoints([Values(0.0, 1e6)] double offset) } } - [Test, Category(KnownBug.Category)] - [Description("Severity: medium. Point.Equals compares coordinates, but Vertex.GetHashCode returns the internal hash, so equal vertices have different hash codes (breaks HashSet/Dictionary).")] + [Test] + [Description("Fixed (severity: medium). Point.Equals compares coordinates, but Vertex.GetHashCode returns the internal hash, so equal vertices have different hash codes (breaks HashSet/Dictionary).")] public void VertexEqualsAndHashCodeContract() { var poly = new Polygon(); diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs new file mode 100644 index 0000000..33e2b29 --- /dev/null +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -0,0 +1,125 @@ +using NUnit.Framework; +using System; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Tests for the segment noder and for quality refinement of noded input. + /// + public class NodingAndRefinementTest + { + private static readonly TimeSpan LongTimeout = TimeSpan.FromSeconds(30); + + [Test] + public void NoderReturnsInputIfNothingToDo() + { + var poly = TestData.SquareWithSegments((1, 1, 9, 2), (1, 5, 9, 6)); + + Assert.That(SegmentNoder.Node(poly, new RobustPredicates()), Is.SameAs(poly)); + } + + [Test] + public void NoderSplitsCrossingSegments() + { + var poly = TestData.SquareWithSegments((1, 1, 9, 9), (1, 9, 9, 1)); + + var noded = SegmentNoder.Node(poly, new RobustPredicates()); + + Assert.That(noded, Is.Not.SameAs(poly)); + Assert.That(noded.Points.Count, Is.EqualTo(poly.Points.Count + 1)); + Assert.That(noded.Segments.Count, Is.EqualTo(poly.Segments.Count + 2)); + + // Both segments are split at the same vertex instance. + var center = noded.Points.Last(); + Assert.That(center.X, Is.EqualTo(5.0)); + Assert.That(center.Y, Is.EqualTo(5.0)); + Assert.That(noded.Segments.Count(s => s.GetVertex(0) == center || s.GetVertex(1) == center), Is.EqualTo(4)); + + // Input isn't modified. + Assert.That(poly.Segments.Count, Is.EqualTo(6)); + } + + [Test] + public void NoderSnapsVertexNearSegment() + { + var poly = TestData.SquareWithSegments((1, 5, 9, 5)); + poly.Add(new Vertex(5, 5 + 1e-14)); + + var noded = SegmentNoder.Node(poly, new RobustPredicates()); + + // The segment now runs through the vertex (the vertex isn't moved). + Assert.That(noded.Segments.Count, Is.EqualTo(poly.Segments.Count + 1)); + Assert.That(noded.Points.Any(p => p.Y == 5 + 1e-14), Is.True); + } + + [Test] + public void WithoutNodingFailuresAreReported() + { + // Without noding, the mesher must fail loudly (never return an invalid mesh). + var poly = TestData.SquareWithSegments((2, 4, 4, 8), (1, 5, 6, 6), (1, 7, 5, 3)); + + Assert.Throws(Is.InstanceOf(), () => poly.Triangulate(new ConstraintOptions { ResolveIntersections = false })); + } + + [Test] + [Description("Fixed: quality refinement of noded input produced zero-length edges (IndexOutOfRangeException in BadTriQueue), because vertices lying almost on segments weren't snapped.")] + public void QualityMeshingOfCrossingSegments([Range(0, 19)] int seed) + { + var poly = TestData.SquareWithSegments(TestData.RandomIntegerSegments(seed, 40)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 25 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments, 1e-7); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + [Description("Fixed: aCute refinement started point location from an edge the new vertex isn't left of, inserting it into the wrong triangle (inverted triangles).")] + public void AcuteLocationOutsideTriangle() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 20)); + + var random = new Random(23); + + for (int i = 0; i < 100; i++) + { + poly.Add(new Segment(new Vertex(random.Next(21), random.Next(21)), new Vertex(random.Next(21), random.Next(21))), true); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 400); + } + + [Test] + [Description("Fixed: aCute location coinciding with an existing vertex threw 'The new vertex is at the circumcenter of triangle' instead of falling back to the circumcenter.")] + public void AcuteLocationOnExistingVertex([Values(172, 173, 176)] int seed) + { + var poly = TestData.SquareWithSegments(TestData.RandomIntegerSegments(seed, 40)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 30 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100); + } + + [Test] + public void AdjacentPolygonsWithMismatchedBoundaryQualityWithoutLimit() + { + // The noder snaps the two nearly coincident boundaries together, so the slivers + // disappear and quality meshing terminates without a Steiner point limit. + var poly = TestData.AdjacentPolygonsWithMismatchedBoundary(1e-12); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 25 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 200, 1e-6); + } + } +} diff --git a/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs b/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs index 123cece..54051ac 100644 --- a/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs +++ b/src/Triangle.Tests/Robustness/SegmentIntersectionTest.cs @@ -18,8 +18,8 @@ namespace TriangleNet.Tests.Robustness /// public class SegmentIntersectionTest { - [Test, Category(KnownBug.Category)] - [Description("Severity: high. Three crossing segments throw 'Topological inconsistency after splitting a segment'.")] + [Test] + [Description("Fixed (severity: high). Three crossing segments throw 'Topological inconsistency after splitting a segment'.")] public void ThreeCrossingSegmentsThrow() { var poly = TestData.SquareWithSegments((9, 5, 5, 7), (7, 7, 4, 1), (6, 5, 3, 10)); @@ -31,8 +31,8 @@ public void ThreeCrossingSegmentsThrow() MeshAssert.HasArea(mesh, 100); } - [Test, Category(KnownBug.Category)] - [Description("Severity: critical. Three crossing segments silently produce a mesh with inverted triangles (no exception).")] + [Test] + [Description("Fixed (severity: critical). Three crossing segments silently produce a mesh with inverted triangles (no exception).")] [TestCase(2, 4, 4, 8, 1, 5, 6, 6, 1, 7, 5, 3)] [TestCase(2, 5, 9, 5, 6, 3, 10, 10, 8, 7, 5, 0)] [TestCase(5, 0, 1, 10, 7, 7, 0, 7, 3, 3, 8, 8)] @@ -50,15 +50,15 @@ public void ThreeCrossingSegmentsProduceInvalidMesh( MeshAssert.HasArea(mesh, 100); } - [Test, Category(KnownBug.Category)] - [Description("Severity: critical. Five crossing segments cause an infinite recursion (StackOverflowException kills the process).")] + [Test] + [Description("Fixed (severity: critical). Five crossing segments cause an infinite recursion (StackOverflowException kills the process).")] public void FiveCrossingSegmentsCrashProcess() { IsolatedProcess.AssertSucceeds(nameof(IsolatedScenarios.FiveCrossingSegments)); } - [Test, Category(KnownBug.Category)] - [Description("Severity: high. Fuzzing with random integer segments: about 20% of the inputs fail.")] + [Test] + [Description("Fixed (severity: high). Fuzzing with random integer segments: about 20% of the inputs fail.")] public void RandomIntegerSegments() { var failures = new List(); diff --git a/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs b/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs index 157a4fb..00990cf 100644 --- a/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs +++ b/src/Triangle.Tests/Robustness/ThreadSafetyTest.cs @@ -22,8 +22,8 @@ namespace TriangleNet.Tests.Robustness /// public class ThreadSafetyTest { - [Test, Category(KnownBug.Category)] - [Description("Severity: critical (for multi-threaded use). Concurrent use of RobustPredicates.Default returns wrong results.")] + [Test] + [Description("Fixed (severity: critical (for multi-threaded use)). Concurrent use of RobustPredicates.Default returns wrong results.")] public void DefaultPredicatesInParallel() { Assert.That(CountWrongResultsInParallel(() => RobustPredicates.Default), Is.Zero); diff --git a/src/Triangle/Geometry/Vertex.cs b/src/Triangle/Geometry/Vertex.cs index e84b9e4..d6c5b09 100644 --- a/src/Triangle/Geometry/Vertex.cs +++ b/src/Triangle/Geometry/Vertex.cs @@ -119,7 +119,7 @@ public double this[int i] #endregion - /// - public override int GetHashCode() => hash; + // NOTE: GetHashCode isn't overridden, so the coordinate based hash code of the + // Point class is used, which is consistent with Point.Equals. } } diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index eb012ea..52383ad 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -394,10 +394,17 @@ private void TransferNodes(IList points) this.nextras = v.attributes == null ? 0 : v.attributes.Length; #endif - // Simple heuristic to check if ids are already set. We assume that if the - // first two vertex ids are distinct, then all input vertices have pairwise - // distinct ids. - bool userId = (v.id != points[1].id); + foreach (var p in points) + { + if (double.IsNaN(p.x) || double.IsInfinity(p.x) || + double.IsNaN(p.y) || double.IsInfinity(p.y)) + { + throw new ArgumentException("Input vertex (ID " + p.id + ") has a NaN or infinite coordinate.", nameof(points)); + } + } + + // Use the user defined ids only if they are pairwise distinct. + bool userId = HasDistinctIds(points); foreach (var p in points) { @@ -418,6 +425,27 @@ private void TransferNodes(IList points) } } + private static bool HasDistinctIds(IList points) + { + // Fast path: all ids zero (not set by the user). + if (points[0].id == points[1].id) + { + return false; + } + + var ids = new HashSet(); + + foreach (var p in points) + { + if (!ids.Add(p.id)) + { + return false; + } + } + + return true; + } + /// /// Construct a mapping from vertices to triangles to improve the speed of /// point location for segment insertion. diff --git a/src/Triangle/Meshing/Algorithm/Dwyer.cs b/src/Triangle/Meshing/Algorithm/Dwyer.cs index 7d4425e..323ed08 100644 --- a/src/Triangle/Meshing/Algorithm/Dwyer.cs +++ b/src/Triangle/Meshing/Algorithm/Dwyer.cs @@ -106,6 +106,13 @@ public IMesh Triangulate(IList points, Configuration config) } } i++; + + if (i < 2) + { + // All input vertices are identical, so there is no triangulation. + return mesh; + } + if (UseDwyer) { // Re-sort the array of vertices to accommodate alternating cuts. diff --git a/src/Triangle/Meshing/Algorithm/SweepLine.cs b/src/Triangle/Meshing/Algorithm/SweepLine.cs index 4362fb5..cdded65 100644 --- a/src/Triangle/Meshing/Algorithm/SweepLine.cs +++ b/src/Triangle/Meshing/Algorithm/SweepLine.cs @@ -67,6 +67,18 @@ public IMesh Triangulate(IList points, Configuration config) int heapsize; bool check4events, farrightflag = false; + if (mesh.bounds.Width == 0.0 && mesh.bounds.Height == 0.0) + { + // All input vertices are identical, so there is no triangulation. + for (int i = 1; i < points.Count; i++) + { + points[i].type = VertexType.UndeadVertex; + mesh.undeads++; + } + + return mesh; + } + splaynodes = new List(); splayroot = null; @@ -254,9 +266,51 @@ public IMesh Triangulate(IList points, Configuration config) this.mesh.hullsize = RemoveGhosts(ref bottommost); + // The order of circle events is computed using inexact arithmetic, so for + // nearly cocircular vertices the triangulation might not be Delaunay. + RestoreDelaunay(); + return this.mesh; } + /// + /// Flip all edges which are not locally Delaunay (using exact predicates). + /// + private void RestoreDelaunay() + { + Otri tri = default(Otri); + Otri oppo = default(Otri); + + bool flipped = true; + + while (flipped) + { + flipped = false; + + foreach (var t in mesh.triangles) + { + tri.tri = t; + + for (tri.orient = 0; tri.orient < 3; tri.orient++) + { + tri.Sym(ref oppo); + + // Test each edge only once. + if (oppo.tri.id == Mesh.DUMMY || tri.tri.id > oppo.tri.id) + { + continue; + } + + if (predicates.InCircle(tri.Org(), tri.Dest(), tri.Apex(), oppo.Apex()) > 0.0) + { + mesh.Flip(ref tri); + flipped = true; + } + } + } + } + } + #region Heap void HeapInsert(SweepEvent[] heap, int heapsize, SweepEvent newevent) diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 2073a1c..191326a 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -25,6 +25,13 @@ internal class ConstraintMesher Log logger = Log.Instance; + // Number of steps taken while inserting the current segment and the upper bound + // for the number of steps (used to detect infinite loops). + int steps, maxSteps; + + // Number of vertices inserted at the intersection of two segments. + int intersections; + public ConstraintMesher(Mesh mesh, Configuration config) { this.mesh = mesh; @@ -269,6 +276,14 @@ private void FormSkeleton(IPolygon input) InsertSegment(p, q, seg.Label); } } + + if (intersections > 0) + { + // Vertices inserted at segment intersections are rounded and don't lie + // exactly on the segments, which can break the topology. Make sure + // this doesn't go unnoticed. + CheckOrientation(); + } } if (behavior.Convex || !behavior.Poly) @@ -278,6 +293,26 @@ private void FormSkeleton(IPolygon input) } } + /// + /// Throw if the mesh contains flat or inverted triangles. + /// + private void CheckOrientation() + { + Otri tri = default(Otri); + + foreach (var t in mesh.triangles) + { + tri.tri = t; + tri.orient = 0; + + if (predicates.CounterClockwise(tri.Org(), tri.Dest(), tri.Apex()) <= 0.0) + { + logger.Error("Inverted triangle after inserting intersecting segments.", "ConstraintMesher.CheckOrientation()"); + throw new Exception("Inserting intersecting segments produced an invalid mesh."); + } + } + } + #region Carving holes /// @@ -722,6 +757,8 @@ private void SegmentIntersection(ref Otri splittri, ref Osub splitsubseg, Vertex mesh.vertices.Add(newvertex.hash, newvertex); + intersections++; + // Insert the intersection vertex. This should always succeed. success = mesh.InsertVertex(newvertex, ref splittri, ref splitsubseg, false, false); if (success != InsertVertexResult.Successful) @@ -800,56 +837,62 @@ private bool ScoutSegment(ref Otri searchtri, Vertex endpoint2, int newmark) Vertex leftvertex, rightvertex; FindDirectionResult collinear; - collinear = FindDirection(ref searchtri, endpoint2); - rightvertex = searchtri.Dest(); - leftvertex = searchtri.Apex(); - if (((leftvertex.x == endpoint2.x) && (leftvertex.y == endpoint2.y)) || - ((rightvertex.x == endpoint2.x) && (rightvertex.y == endpoint2.y))) + // Loop instead of tail recursion (avoids stack overflow). + while (true) { - // The segment is already an edge in the mesh. - if ((leftvertex.x == endpoint2.x) && (leftvertex.y == endpoint2.y)) + Step(); + + collinear = FindDirection(ref searchtri, endpoint2); + rightvertex = searchtri.Dest(); + leftvertex = searchtri.Apex(); + if (((leftvertex.x == endpoint2.x) && (leftvertex.y == endpoint2.y)) || + ((rightvertex.x == endpoint2.x) && (rightvertex.y == endpoint2.y))) { - searchtri.Lprev(); + // The segment is already an edge in the mesh. + if ((leftvertex.x == endpoint2.x) && (leftvertex.y == endpoint2.y)) + { + searchtri.Lprev(); + } + // Insert a subsegment, if there isn't already one there. + mesh.InsertSubseg(ref searchtri, newmark); + return true; } - // Insert a subsegment, if there isn't already one there. - mesh.InsertSubseg(ref searchtri, newmark); - return true; - } - else if (collinear == FindDirectionResult.Leftcollinear) - { - // We've collided with a vertex between the segment's endpoints. - // Make the collinear vertex be the triangle's origin. - searchtri.Lprev(); - mesh.InsertSubseg(ref searchtri, newmark); - // Insert the remainder of the segment. - return ScoutSegment(ref searchtri, endpoint2, newmark); - } - else if (collinear == FindDirectionResult.Rightcollinear) - { - // We've collided with a vertex between the segment's endpoints. - mesh.InsertSubseg(ref searchtri, newmark); - // Make the collinear vertex be the triangle's origin. - searchtri.Lnext(); - // Insert the remainder of the segment. - return ScoutSegment(ref searchtri, endpoint2, newmark); - } - else - { - searchtri.Lnext(ref crosstri); - crosstri.Pivot(ref crosssubseg); - // Check for a crossing segment. - if (crosssubseg.seg.hash == Mesh.DUMMY) + else if (collinear == FindDirectionResult.Leftcollinear) { - return false; + // We've collided with a vertex between the segment's endpoints. + // Make the collinear vertex be the triangle's origin. + searchtri.Lprev(); + mesh.InsertSubseg(ref searchtri, newmark); + // Insert the remainder of the segment. + continue; } - else + else if (collinear == FindDirectionResult.Rightcollinear) { - // Insert a vertex at the intersection. - SegmentIntersection(ref crosstri, ref crosssubseg, endpoint2); - crosstri.Copy(ref searchtri); + // We've collided with a vertex between the segment's endpoints. mesh.InsertSubseg(ref searchtri, newmark); + // Make the collinear vertex be the triangle's origin. + searchtri.Lnext(); // Insert the remainder of the segment. - return ScoutSegment(ref searchtri, endpoint2, newmark); + continue; + } + else + { + searchtri.Lnext(ref crosstri); + crosstri.Pivot(ref crosssubseg); + // Check for a crossing segment. + if (crosssubseg.seg.hash == Mesh.DUMMY) + { + return false; + } + else + { + // Insert a vertex at the intersection. + SegmentIntersection(ref crosstri, ref crosssubseg, endpoint2); + crosstri.Copy(ref searchtri); + mesh.InsertSubseg(ref searchtri, newmark); + // Insert the remainder of the segment. + continue; + } } } } @@ -1016,92 +1059,113 @@ private void ConstrainedEdge(ref Otri starttri, Vertex endpoint2, int newmark) bool collision; bool done; - endpoint1 = starttri.Org(); - starttri.Lnext(ref fixuptri); - mesh.Flip(ref fixuptri); - // 'collision' indicates whether we have found a vertex directly - // between endpoint1 and endpoint2. - collision = false; - done = false; - do + // Loop instead of tail recursion (avoids stack overflow). + while (true) { - farvertex = fixuptri.Org(); - // 'farvertex' is the extreme point of the polygon we are "digging" - // to get from endpoint1 to endpoint2. - if ((farvertex.x == endpoint2.x) && (farvertex.y == endpoint2.y)) - { - fixuptri.Oprev(ref fixuptri2); - // Enforce the Delaunay condition around endpoint2. - DelaunayFixup(ref fixuptri, false); - DelaunayFixup(ref fixuptri2, true); - done = true; - } - else + endpoint1 = starttri.Org(); + starttri.Lnext(ref fixuptri); + mesh.Flip(ref fixuptri); + // 'collision' indicates whether we have found a vertex directly + // between endpoint1 and endpoint2. + collision = false; + done = false; + do { - // Check whether farvertex is to the left or right of the segment being - // inserted, to decide which edge of fixuptri to dig through next. - area = predicates.CounterClockwise(endpoint1, endpoint2, farvertex); - if (area == 0.0) + Step(); + + farvertex = fixuptri.Org(); + // 'farvertex' is the extreme point of the polygon we are "digging" + // to get from endpoint1 to endpoint2. + if ((farvertex.x == endpoint2.x) && (farvertex.y == endpoint2.y)) { - // We've collided with a vertex between endpoint1 and endpoint2. - collision = true; fixuptri.Oprev(ref fixuptri2); - // Enforce the Delaunay condition around farvertex. + // Enforce the Delaunay condition around endpoint2. DelaunayFixup(ref fixuptri, false); DelaunayFixup(ref fixuptri2, true); done = true; } else { - if (area > 0.0) + // Check whether farvertex is to the left or right of the segment being + // inserted, to decide which edge of fixuptri to dig through next. + area = predicates.CounterClockwise(endpoint1, endpoint2, farvertex); + if (area == 0.0) { - // farvertex is to the left of the segment. + // We've collided with a vertex between endpoint1 and endpoint2. + collision = true; fixuptri.Oprev(ref fixuptri2); - // Enforce the Delaunay condition around farvertex, on the - // left side of the segment only. - DelaunayFixup(ref fixuptri2, true); - // Flip the edge that crosses the segment. After the edge is - // flipped, one of its endpoints is the fan vertex, and the - // destination of fixuptri is the fan vertex. - fixuptri.Lprev(); - } - else - { - // farvertex is to the right of the segment. + // Enforce the Delaunay condition around farvertex. DelaunayFixup(ref fixuptri, false); - // Flip the edge that crosses the segment. After the edge is - // flipped, one of its endpoints is the fan vertex, and the - // destination of fixuptri is the fan vertex. - fixuptri.Oprev(); - } - // Check for two intersecting segments. - fixuptri.Pivot(ref crosssubseg); - if (crosssubseg.seg.hash == Mesh.DUMMY) - { - mesh.Flip(ref fixuptri); // May create inverted triangle at left. + DelaunayFixup(ref fixuptri2, true); + done = true; } else { - // We've collided with a segment between endpoint1 and endpoint2. - collision = true; - // Insert a vertex at the intersection. - SegmentIntersection(ref fixuptri, ref crosssubseg, endpoint2); - done = true; + if (area > 0.0) + { + // farvertex is to the left of the segment. + fixuptri.Oprev(ref fixuptri2); + // Enforce the Delaunay condition around farvertex, on the + // left side of the segment only. + DelaunayFixup(ref fixuptri2, true); + // Flip the edge that crosses the segment. After the edge is + // flipped, one of its endpoints is the fan vertex, and the + // destination of fixuptri is the fan vertex. + fixuptri.Lprev(); + } + else + { + // farvertex is to the right of the segment. + DelaunayFixup(ref fixuptri, false); + // Flip the edge that crosses the segment. After the edge is + // flipped, one of its endpoints is the fan vertex, and the + // destination of fixuptri is the fan vertex. + fixuptri.Oprev(); + } + // Check for two intersecting segments. + fixuptri.Pivot(ref crosssubseg); + if (crosssubseg.seg.hash == Mesh.DUMMY) + { + mesh.Flip(ref fixuptri); // May create inverted triangle at left. + } + else + { + // We've collided with a segment between endpoint1 and endpoint2. + collision = true; + // Insert a vertex at the intersection. + SegmentIntersection(ref fixuptri, ref crosssubseg, endpoint2); + done = true; + } } } - } - } while (!done); - // Insert a subsegment to make the segment permanent. - mesh.InsertSubseg(ref fixuptri, newmark); - // If there was a collision with an interceding vertex, install another - // segment connecting that vertex with endpoint2. - if (collision) - { - // Insert the remainder of the segment. - if (!ScoutSegment(ref fixuptri, endpoint2, newmark)) + } while (!done); + // Insert a subsegment to make the segment permanent. + mesh.InsertSubseg(ref fixuptri, newmark); + // If there was a collision with an interceding vertex, install another + // segment connecting that vertex with endpoint2. + if (collision) { - ConstrainedEdge(ref fixuptri, endpoint2, newmark); + // Insert the remainder of the segment. + if (!ScoutSegment(ref fixuptri, endpoint2, newmark)) + { + fixuptri.Copy(ref starttri); + continue; + } } + + return; + } + } + + /// + /// Count a step of the segment insertion and throw if the insertion doesn't terminate. + /// + private void Step() + { + if (++steps > maxSteps) + { + logger.Error("Segment insertion doesn't terminate.", "ConstraintMesher.Step()"); + throw new Exception("Segment insertion doesn't terminate (probably due to intersecting segments)."); } } @@ -1118,6 +1182,11 @@ private void InsertSegment(Vertex endpoint1, Vertex endpoint2, int newmark) var dummytri = mesh.dummytri; + // Each step either walks to a vertex, flips an edge or inserts an intersection + // vertex, so this bound is never reached by a terminating insertion. + steps = 0; + maxSteps = 10 * (mesh.triangles.Count + mesh.vertices.Count + mesh.subsegs.Count) + 100; + // Find a triangle whose origin is the segment's first endpoint. searchtri1 = endpoint1.tri; if (searchtri1.tri != null) diff --git a/src/Triangle/Meshing/ConstraintOptions.cs b/src/Triangle/Meshing/ConstraintOptions.cs index 684273e..69ec5b4 100644 --- a/src/Triangle/Meshing/ConstraintOptions.cs +++ b/src/Triangle/Meshing/ConstraintOptions.cs @@ -36,5 +36,15 @@ public class ConstraintOptions /// 2 = prevent all segment splitting, including internal boundaries /// public int SegmentSplitting { get; set; } + + /// + /// Gets or sets a value indicating whether intersecting segments are split at their + /// intersection points before they are inserted into the mesh (default = true). + /// + /// + /// Inserting intersecting segments one by one is not robust, since the rounded + /// intersection points don't lie exactly on the segments. See . + /// + public bool ResolveIntersections { get; set; } = true; } } diff --git a/src/Triangle/Meshing/GenericMesher.cs b/src/Triangle/Meshing/GenericMesher.cs index 83cd60e..2fc5f83 100644 --- a/src/Triangle/Meshing/GenericMesher.cs +++ b/src/Triangle/Meshing/GenericMesher.cs @@ -114,6 +114,12 @@ public IMesh Triangulate(IPolygon polygon, QualityOptions quality, CancellationT /// The mesh. public IMesh Triangulate(IPolygon polygon, ConstraintOptions options, QualityOptions quality, CancellationToken cancellationToken = default) { + if (options?.ResolveIntersections ?? true) + { + // Split intersecting segments in advance. + polygon = SegmentNoder.Node(polygon, config.Predicates()); + } + var mesh = (Mesh)triangulator.Triangulate(polygon.Points, config); var cmesher = new ConstraintMesher(mesh, config); diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 7a97565..97b5f3e 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -720,7 +720,7 @@ private void SplitTriangle(BadTriangle badtri) Point newloc; // Location of the new vertex double xi = 0, eta = 0; InsertVertexResult success; - bool errorflag; + bool errorflag = false; badotri = badtri.poortri; borg = badotri.Org(); @@ -733,101 +733,130 @@ private void SplitTriangle(BadTriangle badtri) if (!Otri.IsDead(badotri.tri) && (borg == badtri.org) && (bdest == badtri.dest) && (bapex == badtri.apex)) { - errorflag = false; - // Create a new vertex at the triangle's circumcenter. - if (enableAcute) + // If the aCute location coincides with an existing vertex, fall back to + // the circumcenter (classic Delaunay refinement). + for (int attempt = 0; attempt < 2; attempt++) { - newloc = newLocation.FindLocation(borg, bdest, bapex, ref xi, ref eta, true, badotri); - } - else - { - newloc = predicates.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant); - } - - // Check whether the new vertex lies on a triangle vertex. - if (((newloc.x == borg.x) && (newloc.y == borg.y)) || - ((newloc.x == bdest.x) && (newloc.y == bdest.y)) || - ((newloc.x == bapex.x) && (newloc.y == bapex.y))) - { - if (Log.Verbose) - { - logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()"); - } - errorflag = true; - } - else - { - // The new vertex must be in the interior, and therefore is a - // free vertex with a marker of zero. - Vertex newvertex = new Vertex(newloc.x, newloc.y, 0 -#if USE_ATTRIBS - , mesh.nextras -#endif - ); - - newvertex.type = VertexType.FreeVertex; - - // Ensure that the handle 'badotri' does not represent the longest - // edge of the triangle. This ensures that the circumcenter must - // fall to the left of this edge, so point location will work. - // (If the angle org-apex-dest exceeds 90 degrees, then the - // circumcenter lies outside the org-dest edge, and eta is - // negative. Roundoff error might prevent eta from being - // negative when it should be, so I test eta against xi.) - if (eta < xi) - { - badotri.Lprev(); - } - - // Assign triangle for attributes interpolation. - newvertex.tri.tri = newvertex_tri; - - // Insert the circumcenter, searching from the edge of the triangle, - // and maintain the Delaunay property of the triangulation. - Osub tmp = default(Osub); - success = mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); + bool useAcute = enableAcute && attempt == 0; - if (success == InsertVertexResult.Successful) + if (attempt > 0) { - newvertex.hash = mesh.hash_vtx++; - newvertex.id = newvertex.hash; -#if USE_ATTRIBS - if (mesh.nextras > 0) + if (!errorflag || !enableAcute) { - Interpolation.InterpolateAttributes(newvertex, newvertex.tri.tri, mesh.nextras); + break; } -#endif -#if USE_Z - Interpolation.InterpolateZ(newvertex, newvertex.tri.tri); -#endif - mesh.vertices.Add(newvertex.hash, newvertex); - if (mesh.steinerleft > 0) - { - mesh.steinerleft--; - } + // A failed insertion might have moved the handle. + badotri = badtri.poortri; } - else if (success == InsertVertexResult.Encroaching) + + errorflag = false; + // Create a new vertex at the triangle's circumcenter. + if (useAcute) { - // If the newly inserted vertex encroaches upon a subsegment, - // delete the new vertex. - mesh.UndoVertex(); + newloc = newLocation.FindLocation(borg, bdest, bapex, ref xi, ref eta, true, badotri); } - else if (success == InsertVertexResult.Violating) + else { - // Failed to insert the new vertex, but some subsegment was - // marked as being encroached. + newloc = predicates.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant); } - else - { // success == DUPLICATEVERTEX - // Couldn't insert the new vertex because a vertex is already there. + + // Check whether the new vertex lies on a triangle vertex. + if (((newloc.x == borg.x) && (newloc.y == borg.y)) || + ((newloc.x == bdest.x) && (newloc.y == bdest.y)) || + ((newloc.x == bapex.x) && (newloc.y == bapex.y))) + { if (Log.Verbose) { logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()"); } errorflag = true; } + else + { + // The new vertex must be in the interior, and therefore is a + // free vertex with a marker of zero. + Vertex newvertex = new Vertex(newloc.x, newloc.y, 0 + #if USE_ATTRIBS + , mesh.nextras + #endif + ); + + newvertex.type = VertexType.FreeVertex; + + // Ensure that the handle 'badotri' does not represent the longest + // edge of the triangle. This ensures that the circumcenter must + // fall to the left of this edge, so point location will work. + // (If the angle org-apex-dest exceeds 90 degrees, then the + // circumcenter lies outside the org-dest edge, and eta is + // negative. Roundoff error might prevent eta from being + // negative when it should be, so I test eta against xi.) + if (useAcute) + { + // The aCute location isn't necessarily the circumcenter and might + // lie outside the triangle, so xi and eta can't be used. Point + // location requires the new vertex to lie to the left of the edge. + for (int i = 0; i < 2 && predicates.CounterClockwise(badotri.Org(), badotri.Dest(), newloc) <= 0.0; i++) + { + badotri.Lnext(); + } + } + else if (eta < xi) + { + badotri.Lprev(); + } + + // Assign triangle for attributes interpolation. + newvertex.tri.tri = newvertex_tri; + + // Insert the circumcenter, searching from the edge of the triangle, + // and maintain the Delaunay property of the triangulation. + Osub tmp = default(Osub); + success = mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); + + if (success == InsertVertexResult.Successful) + { + newvertex.hash = mesh.hash_vtx++; + newvertex.id = newvertex.hash; + #if USE_ATTRIBS + if (mesh.nextras > 0) + { + Interpolation.InterpolateAttributes(newvertex, newvertex.tri.tri, mesh.nextras); + } + #endif + #if USE_Z + Interpolation.InterpolateZ(newvertex, newvertex.tri.tri); + #endif + mesh.vertices.Add(newvertex.hash, newvertex); + + if (mesh.steinerleft > 0) + { + mesh.steinerleft--; + } + } + else if (success == InsertVertexResult.Encroaching) + { + // If the newly inserted vertex encroaches upon a subsegment, + // delete the new vertex. + mesh.UndoVertex(); + } + else if (success == InsertVertexResult.Violating) + { + // Failed to insert the new vertex, but some subsegment was + // marked as being encroached. + } + else + { // success == DUPLICATEVERTEX + // Couldn't insert the new vertex because a vertex is already there. + if (Log.Verbose) + { + logger.Warning("New vertex falls on existing vertex.", "Quality.SplitTriangle()"); + } + errorflag = true; + } + } } + if (errorflag) { logger.Error("The new vertex is at the circumcenter of triangle: This probably " diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs new file mode 100644 index 0000000..612aeae --- /dev/null +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -0,0 +1,530 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET Copyright (c) 2012-2022 Christian Woltering +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Meshing +{ + using System; + using System.Collections.Generic; + using TriangleNet.Geometry; + + /// + /// Splits the segments of a polygon at their intersections (noding). + /// + /// + /// The constraint mesher can insert intersecting segments by itself, but it does so one + /// intersection at a time. The rounded intersection vertex doesn't lie exactly on the + /// segments, which can break the topology if several segments cross in a small region. + /// + /// The noder computes all intersections in advance and splits the segments, so the mesher + /// never sees crossing segments. Crossings are detected using exact predicates. + /// + /// Additionally, vertices closer than a small tolerance to a segment are snapped onto the + /// segment (the segment is split at the vertex, the vertex isn't moved). Otherwise, vertices + /// lying almost on a segment (like rounded intersection points) produce nearly degenerate + /// triangles, which can be inverted by subsequent refinement (inserting rounded segment + /// midpoints). After snapping, the distance of a vertex to a segment is either zero or + /// larger than the tolerance. + /// + /// Since both steps can create new crossings, they are repeated until no more changes occur. + /// + public static class SegmentNoder + { + /// + /// Relative snap tolerance (with respect to the maximum of the coordinate magnitudes + /// and the extent of the input), about 1e-12. + /// + public const double DefaultRelativeTolerance = 1.0 / (1L << 40); + + /// + /// Split all segments of the polygon at their intersections and at vertices lying + /// (almost) on the segments. + /// + /// The input polygon (won't be modified). + /// The predicates used to detect crossings. + /// Maximum number of noding iterations. + /// The input polygon, if nothing had to be changed, otherwise a new polygon. + public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIterations = 50) + { + if (polygon.Segments.Count == 0) + { + return polygon; + } + + var segments = new List(polygon.Segments); + var newPoints = new List(); + + double tolerance = GetTolerance(polygon); + + var vertices = new VertexIndex(polygon.Points, tolerance); + + bool changed = false; + + for (int iteration = 0; iteration < maxIterations; iteration++) + { + var splits = new Dictionary>(); + + AddIntersections(segments, FindCrossings(segments, predicates), vertices, newPoints, splits); + + if (splits.Count == 0) + { + AddNearbyVertices(segments, vertices.All, tolerance, splits); + } + + if (splits.Count == 0) + { + break; + } + + segments = Split(segments, splits); + changed = true; + } + + if (!changed) + { + return polygon; + } + + var result = new Polygon(polygon.Points.Count + newPoints.Count) + { + HasPointMarkers = polygon.HasPointMarkers, + HasSegmentMarkers = polygon.HasSegmentMarkers + }; + + result.Points.AddRange(polygon.Points); + result.Points.AddRange(newPoints); + result.Segments.AddRange(segments); + result.Holes.AddRange(polygon.Holes); + result.Regions.AddRange(polygon.Regions); + + return result; + } + + private static double GetTolerance(IPolygon polygon) + { + var bounds = new Rectangle(); + double max = 0.0; + + foreach (var v in polygon.Points) + { + bounds.Expand(v); + max = Math.Max(max, Math.Max(Math.Abs(v.x), Math.Abs(v.y))); + } + + return DefaultRelativeTolerance * Math.Max(max, Math.Max(bounds.Width, bounds.Height)); + } + + /// + /// Find all pairs of segments that cross in their interiors (sweep along x-axis). + /// + private static List<(int, int)> FindCrossings(List segments, IPredicates predicates) + { + int n = segments.Count; + + var order = new int[n]; + var xmin = new double[n]; + + for (int i = 0; i < n; i++) + { + order[i] = i; + xmin[i] = Math.Min(segments[i].GetVertex(0).x, segments[i].GetVertex(1).x); + } + + Array.Sort((double[])xmin.Clone(), order); + + var crossings = new List<(int, int)>(); + + for (int k = 0; k < n; k++) + { + var s = segments[order[k]]; + var a = s.GetVertex(0); + var b = s.GetVertex(1); + + double xmax = Math.Max(a.x, b.x); + double ymin = Math.Min(a.y, b.y); + double ymax = Math.Max(a.y, b.y); + + for (int m = k + 1; m < n && xmin[order[m]] <= xmax; m++) + { + var t = segments[order[m]]; + var c = t.GetVertex(0); + var d = t.GetVertex(1); + + if (Math.Max(c.y, d.y) < ymin || Math.Min(c.y, d.y) > ymax) + { + continue; + } + + if (Cross(a, b, c, d, predicates)) + { + crossings.Add((order[k], order[m])); + } + } + } + + return crossings; + } + + /// + /// Returns true, if the segments (a,b) and (c,d) cross in a single point which is + /// interior to both segments. + /// + private static bool Cross(Vertex a, Vertex b, Vertex c, Vertex d, IPredicates predicates) + { + double o1 = predicates.CounterClockwise(a, b, c); + double o2 = predicates.CounterClockwise(a, b, d); + + if (!((o1 > 0.0 && o2 < 0.0) || (o1 < 0.0 && o2 > 0.0))) + { + return false; + } + + double o3 = predicates.CounterClockwise(c, d, a); + double o4 = predicates.CounterClockwise(c, d, b); + + return (o3 > 0.0 && o4 < 0.0) || (o3 < 0.0 && o4 > 0.0); + } + + private static void AddIntersections(List segments, List<(int, int)> crossings, + VertexIndex vertices, List newPoints, + Dictionary> splits) + { + foreach (var (i, j) in crossings) + { + var s = segments[i]; + var t = segments[j]; + + var a = s.GetVertex(0); + var b = s.GetVertex(1); + var c = t.GetVertex(0); + var d = t.GetVertex(1); + + double abx = b.x - a.x, aby = b.y - a.y; + double cdx = d.x - c.x, cdy = d.y - c.y; + + double denom = abx * cdy - aby * cdx; + + if (denom == 0.0) + { + // Nearly parallel, can't compute the intersection. + continue; + } + + double ts = ((c.x - a.x) * cdy - (c.y - a.y) * cdx) / denom; + + ts = Math.Max(0.0, Math.Min(1.0, ts)); + + double x = a.x + ts * abx; + double y = a.y + ts * aby; + + var v = GetOrCreateVertex(x, y, s.Label, vertices, newPoints); + + AddSplit(splits, i, Parameter(a, b, v), v); + AddSplit(splits, j, Parameter(c, d, v), v); + } + } + + /// + /// Find vertices which lie in the interior of a segment or closer than the given + /// tolerance to the segment. + /// + private static void AddNearbyVertices(List segments, ICollection vertices, + double tolerance, Dictionary> splits) + { + var grid = new VertexGrid(vertices); + + for (int i = 0; i < segments.Count; i++) + { + var s = segments[i]; + var a = s.GetVertex(0); + var b = s.GetVertex(1); + + double dx = b.x - a.x, dy = b.y - a.y; + double length = Math.Sqrt(dx * dx + dy * dy); + + if (length == 0.0) + { + continue; + } + + foreach (var v in grid.Query( + Math.Min(a.x, b.x) - tolerance, Math.Min(a.y, b.y) - tolerance, + Math.Max(a.x, b.x) + tolerance, Math.Max(a.y, b.y) + tolerance)) + { + if (SameLocation(v, a) || SameLocation(v, b)) + { + continue; + } + + // Distance to the line and parameter along the segment. + double distance = Math.Abs(dx * (v.y - a.y) - dy * (v.x - a.x)) / length; + double t = ((v.x - a.x) * dx + (v.y - a.y) * dy) / (length * length); + + if (distance <= tolerance && t > 0.0 && t < 1.0) + { + AddSplit(splits, i, t, v); + } + } + } + } + + private static List Split(List segments, Dictionary> splits) + { + var result = new List(segments.Count + 2 * splits.Count); + + for (int i = 0; i < segments.Count; i++) + { + var s = segments[i]; + + if (!splits.TryGetValue(i, out var list)) + { + result.Add(s); + continue; + } + + list.Sort((p, q) => p.Item1.CompareTo(q.Item1)); + + var prev = s.GetVertex(0); + + var last = s.GetVertex(1); + + foreach (var (t, v) in list) + { + if (t <= 0.0 || t >= 1.0 || SameLocation(v, last)) + { + continue; + } + + if (!SameLocation(prev, v)) + { + result.Add(new Segment(prev, v, s.Label)); + prev = v; + } + } + + if (!SameLocation(prev, last)) + { + result.Add(new Segment(prev, last, s.Label)); + } + } + + return result; + } + + private static void AddSplit(Dictionary> splits, int i, double t, Vertex v) + { + if (!splits.TryGetValue(i, out var list)) + { + list = new List<(double, Vertex)>(); + splits.Add(i, list); + } + + list.Add((t, v)); + } + + private static double Parameter(Vertex a, Vertex b, Vertex v) + { + double dx = b.x - a.x, dy = b.y - a.y; + + return ((v.x - a.x) * dx + (v.y - a.y) * dy) / (dx * dx + dy * dy); + } + + private static Vertex GetOrCreateVertex(double x, double y, int label, + VertexIndex vertices, List newPoints) + { + // Merging with vertices closer than the tolerance guarantees that new vertices + // have a minimum distance, so the noding terminates. + var v = vertices.Find(x, y); + + if (v == null) + { + v = new Vertex(x, y, label); + vertices.Add(v); + newPoints.Add(v); + } + + return v; + } + + private static bool SameLocation(Vertex a, Vertex b) + { + return a.x == b.x && a.y == b.y; + } + + /// + /// Spatial hash to find a vertex within the given tolerance. + /// + private class VertexIndex + { + readonly Dictionary<(long, long), List> cells = new Dictionary<(long, long), List>(); + readonly double tolerance, size; + + public List All { get; } = new List(); + + public VertexIndex(IEnumerable vertices, double tolerance) + { + this.tolerance = tolerance; + this.size = tolerance > 0.0 ? tolerance : 1.0; + + // Input vertices are never merged (only exact duplicates are skipped). + foreach (var v in vertices) + { + if (!ContainsExact(v)) + { + Add(v); + } + } + } + + public void Add(Vertex v) + { + var key = Key(v.x, v.y); + + if (!cells.TryGetValue(key, out var list)) + { + list = new List(); + cells.Add(key, list); + } + + list.Add(v); + All.Add(v); + } + + /// + /// Find the closest vertex within the tolerance (or null). + /// + public Vertex Find(double x, double y) + { + var (i, j) = Key(x, y); + + Vertex result = null; + double best = double.MaxValue; + + for (long di = -1; di <= 1; di++) + { + for (long dj = -1; dj <= 1; dj++) + { + if (!cells.TryGetValue((i + di, j + dj), out var list)) + { + continue; + } + + foreach (var v in list) + { + double dx = v.x - x, dy = v.y - y; + double d = Math.Sqrt(dx * dx + dy * dy); + + if (d <= tolerance && d < best) + { + best = d; + result = v; + } + } + } + } + + return result; + } + + private bool ContainsExact(Vertex v) + { + return cells.TryGetValue(Key(v.x, v.y), out var list) && list.Exists(p => SameLocation(p, v)); + } + + private (long, long) Key(double x, double y) + { + return ((long)Math.Floor(x / size), (long)Math.Floor(y / size)); + } + } + + /// + /// Simple uniform grid for range queries. + /// + private class VertexGrid + { + readonly Dictionary<(long, long), List> cells = new Dictionary<(long, long), List>(); + readonly ICollection vertices; + readonly double left, bottom, size; + + public VertexGrid(ICollection vertices) + { + this.vertices = vertices; + + var bounds = new Rectangle(); + + foreach (var v in vertices) + { + bounds.Expand(v); + } + + left = bounds.Left; + bottom = bounds.Bottom; + + // About one vertex per cell. + size = Math.Max(bounds.Width, bounds.Height) / Math.Max(1.0, Math.Sqrt(vertices.Count)); + + if (size <= 0.0) + { + size = 1.0; + } + + foreach (var v in vertices) + { + var key = (Cell(v.x, left), Cell(v.y, bottom)); + + if (!cells.TryGetValue(key, out var list)) + { + list = new List(); + cells.Add(key, list); + } + + list.Add(v); + } + } + + public IEnumerable Query(double x0, double y0, double x1, double y1) + { + long i0 = Cell(x0, left), i1 = Cell(x1, left); + long j0 = Cell(y0, bottom), j1 = Cell(y1, bottom); + + if ((double)(i1 - i0 + 1) * (j1 - j0 + 1) > cells.Count) + { + // Large query range: scan all vertices. + foreach (var v in vertices) + { + if (v.x >= x0 && v.x <= x1 && v.y >= y0 && v.y <= y1) + { + yield return v; + } + } + + yield break; + } + + for (long i = i0; i <= i1; i++) + { + for (long j = j0; j <= j1; j++) + { + if (cells.TryGetValue((i, j), out var list)) + { + foreach (var v in list) + { + if (v.x >= x0 && v.x <= x1 && v.y >= y0 && v.y <= y1) + { + yield return v; + } + } + } + } + } + } + + private long Cell(double x, double origin) + { + return (long)Math.Floor((x - origin) / size); + } + } + } +} diff --git a/src/Triangle/RobustPredicates.cs b/src/Triangle/RobustPredicates.cs index 336d66a..00afd4d 100644 --- a/src/Triangle/RobustPredicates.cs +++ b/src/Triangle/RobustPredicates.cs @@ -126,7 +126,6 @@ static RobustPredicates() /// public RobustPredicates() { - AllocateWorkspace(); } /// @@ -736,6 +735,8 @@ private double CounterClockwiseAdapt(Point pa, Point pb, Point pc, double detsum /// private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double permanent) { + var w = Workspace.Current; + double adx, bdx, cdx, ady, bdy, cdy; double det, errbound; @@ -810,36 +811,36 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm cdxbdy1 = (double)(cdx * bdy); c = (double)(splitter * cdx); abig = (double)(c - cdx); ahi = c - abig; alo = cdx - ahi; c = (double)(splitter * bdy); abig = (double)(c - bdy); bhi = c - abig; blo = bdy - bhi; err1 = cdxbdy1 - (ahi * bhi); err2 = err1 - (alo * bhi); err3 = err2 - (ahi * blo); cdxbdy0 = (alo * blo) - err3; _i = (double)(bdxcdy0 - cdxbdy0); bvirt = (double)(bdxcdy0 - _i); avirt = _i + bvirt; bround = bvirt - cdxbdy0; around = bdxcdy0 - avirt; bc[0] = around + bround; _j = (double)(bdxcdy1 + _i); bvirt = (double)(_j - bdxcdy1); avirt = _j - bvirt; bround = _i - bvirt; around = bdxcdy1 - avirt; _0 = around + bround; _i = (double)(_0 - cdxbdy1); bvirt = (double)(_0 - _i); avirt = _i + bvirt; bround = bvirt - cdxbdy1; around = _0 - avirt; bc[1] = around + bround; bc3 = (double)(_j + _i); bvirt = (double)(bc3 - _j); avirt = bc3 - bvirt; bround = _i - bvirt; around = _j - avirt; bc[2] = around + bround; bc[3] = bc3; - axbclen = ScaleExpansionZeroElim(4, bc, adx, axbc); - axxbclen = ScaleExpansionZeroElim(axbclen, axbc, adx, axxbc); - aybclen = ScaleExpansionZeroElim(4, bc, ady, aybc); - ayybclen = ScaleExpansionZeroElim(aybclen, aybc, ady, ayybc); - alen = FastExpansionSumZeroElim(axxbclen, axxbc, ayybclen, ayybc, adet); + axbclen = ScaleExpansionZeroElim(4, bc, adx, w.axbc); + axxbclen = ScaleExpansionZeroElim(axbclen, w.axbc, adx, w.axxbc); + aybclen = ScaleExpansionZeroElim(4, bc, ady, w.aybc); + ayybclen = ScaleExpansionZeroElim(aybclen, w.aybc, ady, w.ayybc); + alen = FastExpansionSumZeroElim(axxbclen, w.axxbc, ayybclen, w.ayybc, w.adet); cdxady1 = (double)(cdx * ady); c = (double)(splitter * cdx); abig = (double)(c - cdx); ahi = c - abig; alo = cdx - ahi; c = (double)(splitter * ady); abig = (double)(c - ady); bhi = c - abig; blo = ady - bhi; err1 = cdxady1 - (ahi * bhi); err2 = err1 - (alo * bhi); err3 = err2 - (ahi * blo); cdxady0 = (alo * blo) - err3; adxcdy1 = (double)(adx * cdy); c = (double)(splitter * adx); abig = (double)(c - adx); ahi = c - abig; alo = adx - ahi; c = (double)(splitter * cdy); abig = (double)(c - cdy); bhi = c - abig; blo = cdy - bhi; err1 = adxcdy1 - (ahi * bhi); err2 = err1 - (alo * bhi); err3 = err2 - (ahi * blo); adxcdy0 = (alo * blo) - err3; _i = (double)(cdxady0 - adxcdy0); bvirt = (double)(cdxady0 - _i); avirt = _i + bvirt; bround = bvirt - adxcdy0; around = cdxady0 - avirt; ca[0] = around + bround; _j = (double)(cdxady1 + _i); bvirt = (double)(_j - cdxady1); avirt = _j - bvirt; bround = _i - bvirt; around = cdxady1 - avirt; _0 = around + bround; _i = (double)(_0 - adxcdy1); bvirt = (double)(_0 - _i); avirt = _i + bvirt; bround = bvirt - adxcdy1; around = _0 - avirt; ca[1] = around + bround; ca3 = (double)(_j + _i); bvirt = (double)(ca3 - _j); avirt = ca3 - bvirt; bround = _i - bvirt; around = _j - avirt; ca[2] = around + bround; ca[3] = ca3; - bxcalen = ScaleExpansionZeroElim(4, ca, bdx, bxca); - bxxcalen = ScaleExpansionZeroElim(bxcalen, bxca, bdx, bxxca); - bycalen = ScaleExpansionZeroElim(4, ca, bdy, byca); - byycalen = ScaleExpansionZeroElim(bycalen, byca, bdy, byyca); - blen = FastExpansionSumZeroElim(bxxcalen, bxxca, byycalen, byyca, bdet); + bxcalen = ScaleExpansionZeroElim(4, ca, bdx, w.bxca); + bxxcalen = ScaleExpansionZeroElim(bxcalen, w.bxca, bdx, w.bxxca); + bycalen = ScaleExpansionZeroElim(4, ca, bdy, w.byca); + byycalen = ScaleExpansionZeroElim(bycalen, w.byca, bdy, w.byyca); + blen = FastExpansionSumZeroElim(bxxcalen, w.bxxca, byycalen, w.byyca, w.bdet); adxbdy1 = (double)(adx * bdy); c = (double)(splitter * adx); abig = (double)(c - adx); ahi = c - abig; alo = adx - ahi; c = (double)(splitter * bdy); abig = (double)(c - bdy); bhi = c - abig; blo = bdy - bhi; err1 = adxbdy1 - (ahi * bhi); err2 = err1 - (alo * bhi); err3 = err2 - (ahi * blo); adxbdy0 = (alo * blo) - err3; bdxady1 = (double)(bdx * ady); c = (double)(splitter * bdx); abig = (double)(c - bdx); ahi = c - abig; alo = bdx - ahi; c = (double)(splitter * ady); abig = (double)(c - ady); bhi = c - abig; blo = ady - bhi; err1 = bdxady1 - (ahi * bhi); err2 = err1 - (alo * bhi); err3 = err2 - (ahi * blo); bdxady0 = (alo * blo) - err3; _i = (double)(adxbdy0 - bdxady0); bvirt = (double)(adxbdy0 - _i); avirt = _i + bvirt; bround = bvirt - bdxady0; around = adxbdy0 - avirt; ab[0] = around + bround; _j = (double)(adxbdy1 + _i); bvirt = (double)(_j - adxbdy1); avirt = _j - bvirt; bround = _i - bvirt; around = adxbdy1 - avirt; _0 = around + bround; _i = (double)(_0 - bdxady1); bvirt = (double)(_0 - _i); avirt = _i + bvirt; bround = bvirt - bdxady1; around = _0 - avirt; ab[1] = around + bround; ab3 = (double)(_j + _i); bvirt = (double)(ab3 - _j); avirt = ab3 - bvirt; bround = _i - bvirt; around = _j - avirt; ab[2] = around + bround; ab[3] = ab3; - cxablen = ScaleExpansionZeroElim(4, ab, cdx, cxab); - cxxablen = ScaleExpansionZeroElim(cxablen, cxab, cdx, cxxab); - cyablen = ScaleExpansionZeroElim(4, ab, cdy, cyab); - cyyablen = ScaleExpansionZeroElim(cyablen, cyab, cdy, cyyab); - clen = FastExpansionSumZeroElim(cxxablen, cxxab, cyyablen, cyyab, cdet); + cxablen = ScaleExpansionZeroElim(4, ab, cdx, w.cxab); + cxxablen = ScaleExpansionZeroElim(cxablen, w.cxab, cdx, w.cxxab); + cyablen = ScaleExpansionZeroElim(4, ab, cdy, w.cyab); + cyyablen = ScaleExpansionZeroElim(cyablen, w.cyab, cdy, w.cyyab); + clen = FastExpansionSumZeroElim(cxxablen, w.cxxab, cyyablen, w.cyyab, w.cdet); - ablen = FastExpansionSumZeroElim(alen, adet, blen, bdet, abdet); - finlength = FastExpansionSumZeroElim(ablen, abdet, clen, cdet, fin1); + ablen = FastExpansionSumZeroElim(alen, w.adet, blen, w.bdet, w.abdet); + finlength = FastExpansionSumZeroElim(ablen, w.abdet, clen, w.cdet, w.fin1); - det = Estimate(finlength, fin1); + det = Estimate(finlength, w.fin1); errbound = iccerrboundB * permanent; if ((det >= errbound) || (-det >= errbound)) { @@ -870,8 +871,8 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm return det; } - finnow = fin1; - finother = fin2; + finnow = w.fin1; + finother = w.fin2; if ((bdxtail != 0.0) || (bdytail != 0.0) || (cdxtail != 0.0) || (cdytail != 0.0)) { @@ -898,97 +899,97 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm if (adxtail != 0.0) { axtbclen = ScaleExpansionZeroElim(4, bc, adxtail, axtbc); - temp16alen = ScaleExpansionZeroElim(axtbclen, axtbc, 2.0 * adx, temp16a); + temp16alen = ScaleExpansionZeroElim(axtbclen, axtbc, 2.0 * adx, w.temp16a); axtcclen = ScaleExpansionZeroElim(4, cc, adxtail, axtcc); - temp16blen = ScaleExpansionZeroElim(axtcclen, axtcc, bdy, temp16b); + temp16blen = ScaleExpansionZeroElim(axtcclen, axtcc, bdy, w.temp16b); axtbblen = ScaleExpansionZeroElim(4, bb, adxtail, axtbb); - temp16clen = ScaleExpansionZeroElim(axtbblen, axtbb, -cdy, temp16c); + temp16clen = ScaleExpansionZeroElim(axtbblen, axtbb, -cdy, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } if (adytail != 0.0) { aytbclen = ScaleExpansionZeroElim(4, bc, adytail, aytbc); - temp16alen = ScaleExpansionZeroElim(aytbclen, aytbc, 2.0 * ady, temp16a); + temp16alen = ScaleExpansionZeroElim(aytbclen, aytbc, 2.0 * ady, w.temp16a); aytbblen = ScaleExpansionZeroElim(4, bb, adytail, aytbb); - temp16blen = ScaleExpansionZeroElim(aytbblen, aytbb, cdx, temp16b); + temp16blen = ScaleExpansionZeroElim(aytbblen, aytbb, cdx, w.temp16b); aytcclen = ScaleExpansionZeroElim(4, cc, adytail, aytcc); - temp16clen = ScaleExpansionZeroElim(aytcclen, aytcc, -bdx, temp16c); + temp16clen = ScaleExpansionZeroElim(aytcclen, aytcc, -bdx, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } if (bdxtail != 0.0) { bxtcalen = ScaleExpansionZeroElim(4, ca, bdxtail, bxtca); - temp16alen = ScaleExpansionZeroElim(bxtcalen, bxtca, 2.0 * bdx, temp16a); + temp16alen = ScaleExpansionZeroElim(bxtcalen, bxtca, 2.0 * bdx, w.temp16a); bxtaalen = ScaleExpansionZeroElim(4, aa, bdxtail, bxtaa); - temp16blen = ScaleExpansionZeroElim(bxtaalen, bxtaa, cdy, temp16b); + temp16blen = ScaleExpansionZeroElim(bxtaalen, bxtaa, cdy, w.temp16b); bxtcclen = ScaleExpansionZeroElim(4, cc, bdxtail, bxtcc); - temp16clen = ScaleExpansionZeroElim(bxtcclen, bxtcc, -ady, temp16c); + temp16clen = ScaleExpansionZeroElim(bxtcclen, bxtcc, -ady, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } if (bdytail != 0.0) { bytcalen = ScaleExpansionZeroElim(4, ca, bdytail, bytca); - temp16alen = ScaleExpansionZeroElim(bytcalen, bytca, 2.0 * bdy, temp16a); + temp16alen = ScaleExpansionZeroElim(bytcalen, bytca, 2.0 * bdy, w.temp16a); bytcclen = ScaleExpansionZeroElim(4, cc, bdytail, bytcc); - temp16blen = ScaleExpansionZeroElim(bytcclen, bytcc, adx, temp16b); + temp16blen = ScaleExpansionZeroElim(bytcclen, bytcc, adx, w.temp16b); bytaalen = ScaleExpansionZeroElim(4, aa, bdytail, bytaa); - temp16clen = ScaleExpansionZeroElim(bytaalen, bytaa, -cdx, temp16c); + temp16clen = ScaleExpansionZeroElim(bytaalen, bytaa, -cdx, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } if (cdxtail != 0.0) { cxtablen = ScaleExpansionZeroElim(4, ab, cdxtail, cxtab); - temp16alen = ScaleExpansionZeroElim(cxtablen, cxtab, 2.0 * cdx, temp16a); + temp16alen = ScaleExpansionZeroElim(cxtablen, cxtab, 2.0 * cdx, w.temp16a); cxtbblen = ScaleExpansionZeroElim(4, bb, cdxtail, cxtbb); - temp16blen = ScaleExpansionZeroElim(cxtbblen, cxtbb, ady, temp16b); + temp16blen = ScaleExpansionZeroElim(cxtbblen, cxtbb, ady, w.temp16b); cxtaalen = ScaleExpansionZeroElim(4, aa, cdxtail, cxtaa); - temp16clen = ScaleExpansionZeroElim(cxtaalen, cxtaa, -bdy, temp16c); + temp16clen = ScaleExpansionZeroElim(cxtaalen, cxtaa, -bdy, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } if (cdytail != 0.0) { cytablen = ScaleExpansionZeroElim(4, ab, cdytail, cytab); - temp16alen = ScaleExpansionZeroElim(cytablen, cytab, 2.0 * cdy, temp16a); + temp16alen = ScaleExpansionZeroElim(cytablen, cytab, 2.0 * cdy, w.temp16a); cytaalen = ScaleExpansionZeroElim(4, aa, cdytail, cytaa); - temp16blen = ScaleExpansionZeroElim(cytaalen, cytaa, bdx, temp16b); + temp16blen = ScaleExpansionZeroElim(cytaalen, cytaa, bdx, w.temp16b); cytbblen = ScaleExpansionZeroElim(4, bb, cdytail, cytbb); - temp16clen = ScaleExpansionZeroElim(cytbblen, cytbb, -adx, temp16c); + temp16clen = ScaleExpansionZeroElim(cytbblen, cytbb, -adx, w.temp16c); - temp32alen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32a); - temp48len = FastExpansionSumZeroElim(temp16clen, temp16c, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16clen, w.temp16c, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; } @@ -1025,53 +1026,53 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm if (adxtail != 0.0) { - temp16alen = ScaleExpansionZeroElim(axtbclen, axtbc, adxtail, temp16a); + temp16alen = ScaleExpansionZeroElim(axtbclen, axtbc, adxtail, w.temp16a); axtbctlen = ScaleExpansionZeroElim(bctlen, bct, adxtail, axtbct); - temp32alen = ScaleExpansionZeroElim(axtbctlen, axtbct, 2.0 * adx, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(axtbctlen, axtbct, 2.0 * adx, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; if (bdytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, cc, adxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, bdytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, cc, adxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, bdytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } if (cdytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, bb, -adxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, cdytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, bb, -adxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, cdytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } - temp32alen = ScaleExpansionZeroElim(axtbctlen, axtbct, adxtail, temp32a); + temp32alen = ScaleExpansionZeroElim(axtbctlen, axtbct, adxtail, w.temp32a); axtbcttlen = ScaleExpansionZeroElim(bcttlen, bctt, adxtail, axtbctt); - temp16alen = ScaleExpansionZeroElim(axtbcttlen, axtbctt, 2.0 * adx, temp16a); - temp16blen = ScaleExpansionZeroElim(axtbcttlen, axtbctt, adxtail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(axtbcttlen, axtbctt, 2.0 * adx, w.temp16a); + temp16blen = ScaleExpansionZeroElim(axtbcttlen, axtbctt, adxtail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } if (adytail != 0.0) { - temp16alen = ScaleExpansionZeroElim(aytbclen, aytbc, adytail, temp16a); + temp16alen = ScaleExpansionZeroElim(aytbclen, aytbc, adytail, w.temp16a); aytbctlen = ScaleExpansionZeroElim(bctlen, bct, adytail, aytbct); - temp32alen = ScaleExpansionZeroElim(aytbctlen, aytbct, 2.0 * ady, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(aytbctlen, aytbct, 2.0 * ady, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; - temp32alen = ScaleExpansionZeroElim(aytbctlen, aytbct, adytail, temp32a); + temp32alen = ScaleExpansionZeroElim(aytbctlen, aytbct, adytail, w.temp32a); aytbcttlen = ScaleExpansionZeroElim(bcttlen, bctt, adytail, aytbctt); - temp16alen = ScaleExpansionZeroElim(aytbcttlen, aytbctt, 2.0 * ady, temp16a); - temp16blen = ScaleExpansionZeroElim(aytbcttlen, aytbctt, adytail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(aytbcttlen, aytbctt, 2.0 * ady, w.temp16a); + temp16blen = ScaleExpansionZeroElim(aytbcttlen, aytbctt, adytail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } } @@ -1108,52 +1109,52 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm if (bdxtail != 0.0) { - temp16alen = ScaleExpansionZeroElim(bxtcalen, bxtca, bdxtail, temp16a); + temp16alen = ScaleExpansionZeroElim(bxtcalen, bxtca, bdxtail, w.temp16a); bxtcatlen = ScaleExpansionZeroElim(catlen, cat, bdxtail, bxtcat); - temp32alen = ScaleExpansionZeroElim(bxtcatlen, bxtcat, 2.0 * bdx, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(bxtcatlen, bxtcat, 2.0 * bdx, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; if (cdytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, aa, bdxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, cdytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, aa, bdxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, cdytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } if (adytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, cc, -bdxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, adytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, cc, -bdxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, adytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } - temp32alen = ScaleExpansionZeroElim(bxtcatlen, bxtcat, bdxtail, temp32a); + temp32alen = ScaleExpansionZeroElim(bxtcatlen, bxtcat, bdxtail, w.temp32a); bxtcattlen = ScaleExpansionZeroElim(cattlen, catt, bdxtail, bxtcatt); - temp16alen = ScaleExpansionZeroElim(bxtcattlen, bxtcatt, 2.0 * bdx, temp16a); - temp16blen = ScaleExpansionZeroElim(bxtcattlen, bxtcatt, bdxtail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(bxtcattlen, bxtcatt, 2.0 * bdx, w.temp16a); + temp16blen = ScaleExpansionZeroElim(bxtcattlen, bxtcatt, bdxtail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } if (bdytail != 0.0) { - temp16alen = ScaleExpansionZeroElim(bytcalen, bytca, bdytail, temp16a); + temp16alen = ScaleExpansionZeroElim(bytcalen, bytca, bdytail, w.temp16a); bytcatlen = ScaleExpansionZeroElim(catlen, cat, bdytail, bytcat); - temp32alen = ScaleExpansionZeroElim(bytcatlen, bytcat, 2.0 * bdy, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(bytcatlen, bytcat, 2.0 * bdy, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; - temp32alen = ScaleExpansionZeroElim(bytcatlen, bytcat, bdytail, temp32a); + temp32alen = ScaleExpansionZeroElim(bytcatlen, bytcat, bdytail, w.temp32a); bytcattlen = ScaleExpansionZeroElim(cattlen, catt, bdytail, bytcatt); - temp16alen = ScaleExpansionZeroElim(bytcattlen, bytcatt, 2.0 * bdy, temp16a); - temp16blen = ScaleExpansionZeroElim(bytcattlen, bytcatt, bdytail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(bytcattlen, bytcatt, 2.0 * bdy, w.temp16a); + temp16blen = ScaleExpansionZeroElim(bytcattlen, bytcatt, bdytail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } } @@ -1190,53 +1191,53 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm if (cdxtail != 0.0) { - temp16alen = ScaleExpansionZeroElim(cxtablen, cxtab, cdxtail, temp16a); + temp16alen = ScaleExpansionZeroElim(cxtablen, cxtab, cdxtail, w.temp16a); cxtabtlen = ScaleExpansionZeroElim(abtlen, abt, cdxtail, cxtabt); - temp32alen = ScaleExpansionZeroElim(cxtabtlen, cxtabt, 2.0 * cdx, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(cxtabtlen, cxtabt, 2.0 * cdx, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; if (adytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, bb, cdxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, adytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, bb, cdxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, adytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } if (bdytail != 0.0) { - temp8len = ScaleExpansionZeroElim(4, aa, -cdxtail, temp8); - temp16alen = ScaleExpansionZeroElim(temp8len, temp8, bdytail, temp16a); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, temp16a, finother); + temp8len = ScaleExpansionZeroElim(4, aa, -cdxtail, w.temp8); + temp16alen = ScaleExpansionZeroElim(temp8len, w.temp8, bdytail, w.temp16a); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp16alen, w.temp16a, finother); finswap = finnow; finnow = finother; finother = finswap; } - temp32alen = ScaleExpansionZeroElim(cxtabtlen, cxtabt, cdxtail, temp32a); + temp32alen = ScaleExpansionZeroElim(cxtabtlen, cxtabt, cdxtail, w.temp32a); cxtabttlen = ScaleExpansionZeroElim(abttlen, abtt, cdxtail, cxtabtt); - temp16alen = ScaleExpansionZeroElim(cxtabttlen, cxtabtt, 2.0 * cdx, temp16a); - temp16blen = ScaleExpansionZeroElim(cxtabttlen, cxtabtt, cdxtail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(cxtabttlen, cxtabtt, 2.0 * cdx, w.temp16a); + temp16blen = ScaleExpansionZeroElim(cxtabttlen, cxtabtt, cdxtail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } if (cdytail != 0.0) { - temp16alen = ScaleExpansionZeroElim(cytablen, cytab, cdytail, temp16a); + temp16alen = ScaleExpansionZeroElim(cytablen, cytab, cdytail, w.temp16a); cytabtlen = ScaleExpansionZeroElim(abtlen, abt, cdytail, cytabt); - temp32alen = ScaleExpansionZeroElim(cytabtlen, cytabt, 2.0 * cdy, temp32a); - temp48len = FastExpansionSumZeroElim(temp16alen, temp16a, temp32alen, temp32a, temp48); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, temp48, finother); + temp32alen = ScaleExpansionZeroElim(cytabtlen, cytabt, 2.0 * cdy, w.temp32a); + temp48len = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp32alen, w.temp32a, w.temp48); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp48len, w.temp48, finother); finswap = finnow; finnow = finother; finother = finswap; - temp32alen = ScaleExpansionZeroElim(cytabtlen, cytabt, cdytail, temp32a); + temp32alen = ScaleExpansionZeroElim(cytabtlen, cytabt, cdytail, w.temp32a); cytabttlen = ScaleExpansionZeroElim(abttlen, abtt, cdytail, cytabtt); - temp16alen = ScaleExpansionZeroElim(cytabttlen, cytabtt, 2.0 * cdy, temp16a); - temp16blen = ScaleExpansionZeroElim(cytabttlen, cytabtt, cdytail, temp16b); - temp32blen = FastExpansionSumZeroElim(temp16alen, temp16a, temp16blen, temp16b, temp32b); - temp64len = FastExpansionSumZeroElim(temp32alen, temp32a, temp32blen, temp32b, temp64); - finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, temp64, finother); + temp16alen = ScaleExpansionZeroElim(cytabttlen, cytabtt, 2.0 * cdy, w.temp16a); + temp16blen = ScaleExpansionZeroElim(cytabttlen, cytabtt, cdytail, w.temp16b); + temp32blen = FastExpansionSumZeroElim(temp16alen, w.temp16a, temp16blen, w.temp16b, w.temp32b); + temp64len = FastExpansionSumZeroElim(temp32alen, w.temp32a, temp32blen, w.temp32b, w.temp64); + finlength = FastExpansionSumZeroElim(finlength, finnow, temp64len, w.temp64, finother); finswap = finnow; finnow = finother; finother = finswap; } } @@ -1246,53 +1247,25 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm #region Workspace - // InCircleAdapt workspace: - double[] fin1, fin2, abdet; + /// + /// Workspace of the InCircleAdapt method. The workspace is thread-local, so a + /// single instance can be used from multiple threads. + /// + private sealed class Workspace + { + [ThreadStatic] + private static Workspace current; - double[] axbc, axxbc, aybc, ayybc, adet; - double[] bxca, bxxca, byca, byyca, bdet; - double[] cxab, cxxab, cyab, cyyab, cdet; + public static Workspace Current => current ?? (current = new Workspace()); - double[] temp8, temp16a, temp16b, temp16c; - double[] temp32a, temp32b, temp48, temp64; + public readonly double[] fin1 = new double[1152], fin2 = new double[1152], abdet = new double[64]; - private void AllocateWorkspace() - { - fin1 = new double[1152]; - fin2 = new double[1152]; - abdet = new double[64]; - - axbc = new double[8]; - axxbc = new double[16]; - aybc = new double[8]; - ayybc = new double[16]; - adet = new double[32]; - - bxca = new double[8]; - bxxca = new double[16]; - byca = new double[8]; - byyca = new double[16]; - bdet = new double[32]; - - cxab = new double[8]; - cxxab = new double[16]; - cyab = new double[8]; - cyyab = new double[16]; - cdet = new double[32]; - - temp8 = new double[8]; - temp16a = new double[16]; - temp16b = new double[16]; - temp16c = new double[16]; - - temp32a = new double[32]; - temp32b = new double[32]; - temp48 = new double[48]; - temp64 = new double[64]; - } + public readonly double[] axbc = new double[8], axxbc = new double[16], aybc = new double[8], ayybc = new double[16], adet = new double[32]; + public readonly double[] bxca = new double[8], bxxca = new double[16], byca = new double[8], byyca = new double[16], bdet = new double[32]; + public readonly double[] cxab = new double[8], cxxab = new double[16], cyab = new double[8], cyyab = new double[16], cdet = new double[32]; - private void ClearWorkspace() - { + public readonly double[] temp8 = new double[8], temp16a = new double[16], temp16b = new double[16], temp16c = new double[16]; + public readonly double[] temp32a = new double[32], temp32b = new double[32], temp48 = new double[48], temp64 = new double[64]; } #endregion diff --git a/src/Triangle/Smoothing/SimpleSmoother.cs b/src/Triangle/Smoothing/SimpleSmoother.cs index 30e4b05..ee70a02 100644 --- a/src/Triangle/Smoothing/SimpleSmoother.cs +++ b/src/Triangle/Smoothing/SimpleSmoother.cs @@ -173,22 +173,34 @@ private void Centroid(Face face, out double x, out double y) Point p, q; + // Use coordinates relative to the generator to avoid catastrophic + // cancellation for meshes located far away from the origin. + double ox = face.generator.x; + double oy = face.generator.y; + + double px, py, qx, qy; + do { p = edge.Origin; q = edge.Twin.Origin; - ai = p.x * q.y - q.x * p.y; + px = p.x - ox; + py = p.y - oy; + qx = q.x - ox; + qy = q.y - oy; + + ai = px * qy - qx * py; atmp += ai; - xtmp += (q.x + p.x) * ai; - ytmp += (q.y + p.y) * ai; + xtmp += (qx + px) * ai; + ytmp += (qy + py) * ai; edge = edge.Next; } while (edge.Next.ID != first); - x = xtmp / (3 * atmp); - y = ytmp / (3 * atmp); + x = ox + xtmp / (3 * atmp); + y = oy + ytmp / (3 * atmp); //area = atmp / 2; } From a202b6613f19f19433668978befdeef5fb9ba843 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 22:17:39 +0000 Subject: [PATCH 03/50] Update robustness analysis and add assessment of the old custom version Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Alter-Stand-Bewertung.md | 96 +++++++++++++++++++++++++++++++++++ docs/Robustheitsanalyse.md | 41 +++++++++++++-- 2 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 docs/Alter-Stand-Bewertung.md diff --git a/docs/Alter-Stand-Bewertung.md b/docs/Alter-Stand-Bewertung.md new file mode 100644 index 0000000..d120817 --- /dev/null +++ b/docs/Alter-Stand-Bewertung.md @@ -0,0 +1,96 @@ +# Bewertung des alten, angepassten Stands + +Gegenstand: `HarmenGrosseDeters/Triangle.Net-Old-Custom` (TriangleLib, früher Triangle.NET-Stand +um 2012/13 mit `InputGeometry`, `Primitives.cs`, `Carver.cs`) plus eigene Erweiterungen. +Verglichen mit diesem Fork nach den Robustheits-Fixes. + +## Kurzfazit + +* **Fallback auf den alten Stand bringt nichts.** In einem Differenztest (600 Eingaben × 3 Varianten) + (Details unten) gab es **keinen einzigen Fall, in dem der alte Stand ein gültiges Netz liefert + und der neue nicht**. Umgekehrt scheitert der alte Stand bei kreuzenden Bruchkanten in + ~30 % der Fälle, davon etwa ein Drittel **still** mit invertierten Dreiecken oder NaN-Flächen. + Als Fallback eingesetzt, würde er also vor allem Fehler einschleppen, die ohne + Validierung nicht auffallen. +* **Dein Wrapper schaltet die exakte Arithmetik ab** (`Behavior.NoExact = true` in + `TriangulierenV2.cs`). Damit verlieren Shewchuks Prädikate jede Robustheitsgarantie. Das + sollte auf keinen Fall übernommen werden. +* Von den fachlichen Erweiterungen lohnen sich **gesperrte Kanten** und eine + **Iterations-/Fehlerberichterstattung**. Höheninterpolation und das Retten verworfener + Dreiecke lassen sich besser außerhalb der Bibliothek lösen (siehe unten). + +## Differenztest alt ↔ neu + +Alter Stand mit Stubs für die RWE-Typen gebaut (`Punkt`, `Dreieck`, `PointInPolygon`, +`QuadTree`) und so konfiguriert wie `TriangulierenV2` (`ConformingDelaunay`, `Quality`, +`MinAngle`), einmal mit `NoExact = true` (wie im Wrapper) und einmal mit exakter Arithmetik. +Jede Triangulierung in eigenem Prozess; geprüft: keine flachen/invertierten Dreiecke (exakt), +Gesamtfläche korrekt. Je 100 zufällige Eingaben. + +| Szenario | alt, NoExact (Wrapper) | alt, exakt | neu | +|----------|------------------------|------------|-----| +| 15 Integer-Segmente, ohne Qualität | 67 OK · 22 Exception · **10 still ungültig** · 1 Endlosschleife | 71 OK · 18 Exception · **10 still ungültig** · 1 Endlosschleife | **100 OK** | +| dto., 20° | 66 OK · 24 Exception · **9 still ungültig (NaN/invertiert)** · 1 Timeout | 69 OK · 30 Exception · **1 still ungültig** | **100 OK** | +| dto. mit UTM-Offset (3,5e5), ohne Qualität | 73 OK · 15 Exception · **12 still ungültig** | 71 OK · 15 Exception · **14 still ungültig** | **100 OK** | +| dto. mit UTM-Offset, 20° | 71 OK · 18 Exception · **11 still ungültig** | 68 OK · 31 Exception · 1 Timeout | **100 OK** | +| Nicht kreuzende Bruchkanten + 300 Punkte, Gauß-Krüger (5,6e6), 20° | 98 OK · **2 still ungültig** | 99 OK · **1 still ungültig** | **100 OK** | +| Parallele Bruchkanten 0,1 mm Abstand, ohne Qualität | 100 OK | 100 OK | **100 OK** | +| dto., 20° | terminiert nicht (ohne `maxIterationen`) | – | **OK** (mit Steiner-Limit) | + +Auffällig: Selbst **ohne jede Kreuzung** (realistische Bruchkanten in Gauß-Krüger-Koordinaten) +liefert der alte Stand in 1–2 % der Fälle still ein Netz mit invertierten Dreiecken. + +## Die Anpassungen im Einzelnen + +| Anpassung | Wo | Bewertung | Empfehlung | +|-----------|----|-----------|------------| +| `Behavior.NoExact = true` | `TriangulierenV2.cs:186` | Schaltet die exakten Prädikate ab, also genau den Mechanismus, der Triangle robust macht. Wahrscheinlich eine wesentliche Ursache der früheren Gleitkomma-Probleme. | **Nicht übernehmen.** | +| Abbruchzähler in `ScoutSegment`/`ConstrainedEdge` (`ScoutSegmentInfinityLoopException` bei 1000 Rekursionen) | `Mesh.cs:2440`, `:2770` | Richtige Idee (StackOverflow → Exception). | **Erledigt**, besser gelöst: Schleife statt Rekursion plus Schrittzähler, und durch das Noding tritt der Fall praktisch nicht mehr auf. | +| Eigene Exception-Typen mit Koordinaten (`TopologicalInconsistencyException`, `RanOutOfPrecisionException`, …) | `Exceptions/` | Diagnostisch wertvoll (wo im Gelände ist das Problem?), aber an `Rwe.Core.Model.Entities.Punkt` gebunden und 8 fast identische Klassen. | **Konzept übernehmen:** *eine* `TriangulationException` mit `Point`-Property und Fehlerart als Enum. Klein. | +| Gesperrte Kanten (`GesperrteKanten`, `NoBisect = 3`): Bruchkanten dürfen nicht geteilt werden, andere Segmente schon | `Mesh.cs:267`, `Quality.cs:328/351`, `Mesh.cs:1125/2071` | Fachlich sinnvoll (Bruchkanten im DGM unverändert lassen). Der neue Stand kennt nur `SegmentSplitting` 0/1/2 global. | **Portieren**, aber sauberer: über das Segment-Label statt Index-Lookup, z. B. `ConstraintOptions.CanSplitSegment = label => …`. Mittel. Hinweis: Nicht teilbare Segmente heben die Winkelgarantie auf; daher immer mit Steiner-Limit kombinieren. | +| `maxIterationen` (globale Grenze) | `Quality.cs:1103` | Schutz gegen Endlosverfeinerung. | **Vorhanden:** `QualityOptions.SteinerPoints` + `CancellationToken`. | +| `anzahlOk` (Dreieck höchstens n-mal neu einreihen), Rückgabe von `schlechteDreiecke`/`problematischeDreiecke`, `maxOK` | `Quality.cs:594`, `:1118`, `:1148–1190` | Nützlich, um bei gesperrten Kanten nicht endlos am selben Dreieck zu arbeiten und dem Aufrufer zu melden, wo die Qualität nicht erreicht wurde. | **Teilweise portieren:** Pro-Dreieck-Limit zusammen mit gesperrten Kanten; die Liste der schlechten Dreiecke kann man auch nachträglich über die Winkel ermitteln (`QualityMeasure`), ohne die Bibliothek zu ändern. | +| Höhe (Z) neuer Punkte aus der **ursprünglichen** Triangulierung per QuadTree statt `xi`/`eta` | `Mesh.cs:556`, `Quality.cs:956` | Inhaltlich richtig, denn die Original-Interpolation extrapoliert, wenn der neue Punkt außerhalb des Dreiecks liegt. Aber: **feste Fallback-Höhen 211.0 bzw. 199.0** bei Fehlschlag → stillschweigend falsche Höhen. | **Nicht in die Bibliothek.** Besser: erst ohne Qualität triangulieren (Referenz-TIN), dann mit Qualität; Z der neuen Punkte danach per `TriangleQuadTree` im Referenz-TIN interpolieren. Kein Treffer = Fehler, keine Magic Numbers. Der neue Stand braucht dafür kein `USE_Z`. | +| `pruefeDreieckExtern` / `FehlerhaftVerworfeneDreiecke`: beim Löcherschneiden „versehentlich“ entfernte Dreiecke wieder hinzufügen | `Carver.cs:200`, `Mesh.cs:3083` | Workaround für ein Symptom: Wenn Bruchkanten einen Innenring „öffnen“ oder kreuzen, ist das Loch nicht geschlossen und die Infektion beim Carving läuft aus. Die geretteten Dreiecke gehören dann nicht zur Topologie des Netzes. | **Nicht übernehmen.** Ursache beheben: Das Noding hält Ringe jetzt auch bei kreuzenden Bruchkanten geschlossen. Robuster: Innenringe über **Regionen** (Label) statt Lochpunkte markieren und die Dreiecke danach per Label filtern; dann gibt es kein Auslaufen mehr. | +| Lochpunkt-Bestimmung im Wrapper (Schwerpunkt der ersten konvexen Ecke, die innen liegt) | `TriangulierenV2.cs:671` | Kann bei schmalen/konkaven Ringen fehlschlagen; dann fehlt das Loch. | Neu: `Contour.FindInteriorPoint()` bzw. Regionen-Ansatz. | +| aCute-Puffer 500 → 1500 Punkte | `NewLocation.cs:2089` | Sinnvoll. Der neue Stand hat 500 und bricht bei Überlauf aCute ab (Issue #58); dann greift jetzt der neue Rückfall auf den Umkreismittelpunkt. | **Optional übernehmen** (dynamische Größe). Klein. | +| Rundung der Ergebnis-Koordinaten (cm) und Zuordnung neuer Punkte zu Bruchkanten/Ringen mit 1 cm Toleranz | `TriangulierenV2.cs:307`, `:376–487` | Nachbearbeitung im Aufrufer. Achtung: Durch das Runden **nach** der Triangulierung können Dreiecke kippen. | Im Aufrufer belassen; nach dem Runden Orientierung prüfen. Besser: Eingabe vorher auf das Zielraster runden, dann ist die Triangulierung exakt auf dem Raster. | + +## Rolle des Clipper-Wrappers + +`Core.Wrapper.ClipperLibrary` rechnet in Ganzzahlkoordinaten (Faktor 10⁵ bzw. 10¹) mit Clippers +exakter Arithmetik: + +* In `TriangleLib` wird nur `PointInPolygon` genutzt (Ring- und Innenringtests in + `pruefeDreieckExtern`, Lochpunkt im Wrapper). Ergebnis `Innen`/`Auf`/`Außen`. +* `GlaettePolygone` (`Clipper.SimplifyPolygon`, entfernt Eigenschnitte) und `BereinigePolygone` + (`Clipper.CleanPolygon`, entfernt Fast-Kollinearitäten) sind faktisch Snap-Rounding + **pro Ring**. Kreuzungen **zwischen** Bruchkanten untereinander und zwischen Bruchkanten und + Ringen behandeln sie nicht. Genau diese Fälle haben im alten Stand die Fehler erzeugt, und + genau sie löst jetzt der `SegmentNoder` im Fork. + +Die Clipper-Vorverarbeitung der Ringe kann bleiben; sie schadet nicht. + +## Empfohlene Architektur statt Fallback + +``` +Eingabe ──► (Clipper: Ringe bereinigen, wie bisher) + ──► Fork: Triangulate(poly, constraints, quality{SteinerPoints, ggf. CanSplitSegment}) + │ (Noding/Snapping intern, exakte Prädikate, thread-sicher) + ├─ MeshValidator.IsConsistent(mesh) ── ok ──► Z aus Referenz-TIN interpolieren + └─ Exception / inkonsistent + ├─► Retry 1: QualityOptions.UseLegacyRefinement = true (ohne aCute) + ├─► Retry 2: Eingabe auf gröberes Raster runden (z. B. 1 mm), erneut + └─► Fehler mit Koordinate melden (TriangulationException) +``` + +Der alte Stand kommt in dieser Kette nicht mehr vor. Falls du ihn für eine Übergangszeit +trotzdem parallel betreiben willst, dann nur **mit** Validierung des Ergebnisses +(Orientierung aller Dreiecke, Fläche) und mit `NoExact = false`. + +## Nebenbefund zum Repository + +Im alten Repository liegen `bin/` und `obj/` mit eingecheckt, darunter interne +Binärbibliotheken (`Rwe.Core.*`) und Drittanbieter-DLLs (z. B. Oracle, PdfSharp). Falls das +Repository nicht privat ist oder geteilt wird, sollten diese Verzeichnisse entfernt und per +`.gitignore` ausgeschlossen werden. diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index d24952c..52ade16 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -3,6 +3,10 @@ Stand: Oktober 2026, Commit `fa6f2fd` (master). Fokus: Verhalten bei topologisch unsauberen Eingaben und Gleitkomma-Grenzfällen. +> **Update:** Alle Befunde sind inzwischen behoben, siehe [Abschnitt „Fixes“](#fixes). Die +> Analyse unten beschreibt den Zustand **vor** den Fixes. Die Bewertung des alten, +> angepassten Stands steht in [Alter-Stand-Bewertung.md](Alter-Stand-Bewertung.md). + ## Kurzfazit * **Die reine Delaunay-Triangulation von Punktmengen ist sehr robust.** Die adaptiven exakten @@ -151,11 +155,42 @@ paralleles Vermaschen mit eigenen Prädikaten. abwarten. 8. **Default-Algorithmus Dwyer beibehalten.** Er ist exakt Delaunay; SweepLine ist es nicht. +## Fixes + +| # | Fix | Datei | +|---|-----|-------| +| 1–3 | **Noding mit Snapping** vor dem Einfügen der Segmente (`ConstraintOptions.ResolveIntersections`, Standard an): alle Schnittpunkte werden vorab berechnet (exakte Kreuzungserkennung), neue Punkte näher als r ≈ 1e-12 · Ausdehnung an einem bestehenden Punkt werden mit ihm verschmolzen, und Punkte näher als r an einem Segment werden ins Segment eingebunden. Eingabepunkte werden nie verschoben. Das Verfahren terminiert nachweisbar, weil neue Punkte einen Mindestabstand haben. | `Meshing/SegmentNoder.cs` | +| 1–3 | **Sicherheitsnetz:** `ScoutSegment`/`ConstrainedEdge` als Schleife statt Rekursion (kein StackOverflow), Schrittzähler gegen Endlosschleifen, Orientierungsprüfung nach dem Einfügen von Schnittpunkten. Ungültige Netze werden damit nie still zurückgegeben. | `Meshing/ConstraintMesher.cs` | +| 4 | Arbeits-Arrays der exakten Arithmetik thread-lokal; jede `RobustPredicates`-Instanz ist jetzt thread-sicher. | `RobustPredicates.cs` | +| 5, 11 | Identische Punkte: leeres Netz statt StackOverflow (Dwyer) bzw. Exception (SweepLine). | `Dwyer.cs`, `SweepLine.cs` | +| 6 | Smoother: Schwerpunkt relativ zum Generator. | `Smoothing/SimpleSmoother.cs` | +| 7, 8 | NaN/Infinity → `ArgumentException`; vollständige Prüfung auf eindeutige IDs. | `Mesh.cs` | +| 9 | `Vertex` nutzt den koordinatenbasierten Hashcode von `Point`. | `Geometry/Vertex.cs` | +| 10 | SweepLine: abschließender Flip-Durchlauf mit exakten Prädikaten. | `SweepLine.cs` | +| neu | **aCute-Verfeinerung** (seit 2022 Standard) startete die Punktsuche an einer Kante, links von der der neue Punkt nicht liegt → Punkt im falschen Dreieck, invertierte Dreiecke. Jetzt wird die Startkante per Orientierungstest gewählt. | `Meshing/QualityMesher.cs` | +| neu | aCute-Ort fällt auf einen bestehenden Punkt → Rückfall auf den Umkreismittelpunkt statt Exception. | `Meshing/QualityMesher.cs` | + +**Ergebnis (Fuzzing, jeder Fall in eigenem Prozess):** + +| Szenario | vorher | nachher | +|----------|--------|---------| +| 15 zufällige Integer-Segmente, ohne Qualität | 157/200 | 500/500 | +| 40 Segmente, Mindestwinkel 25° | – (meist Fehler) | 300/300 | +| 40 Segmente, 30° | – | 200/200 | +| 15 Segmente, 20°, Offset 1e6 | – | 200/200 | +| 100 Segmente, 20° / 28° | – | 200/200, 100/100 | +| 200 Segmente auf 50er-Raster, 20° | – | 50/50 | +| Nachbarflächen mit Abweichung 1e-12, 25°, **ohne** Steiner-Limit | terminiert nicht | ~30 ms | + +Die Testsuite hat jetzt 203 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre +Regressionstests geworden. + ## Die Testsuite (`src/Triangle.Tests/Robustness`) -* **Red Tests** tragen die Kategorie `KnownBug` (20 Tests) und dokumentieren jeweils einen Fehler - mit Schweregrad in der `[Description]`. Wird ein Fehler behoben, wird der Test grün; dann die - Kategorie entfernen, und er wird zum Regressionstest. +* **Red Tests** tragen die Kategorie `KnownBug` und dokumentieren jeweils einen Fehler mit + Schweregrad in der `[Description]`. Wird ein Fehler behoben, wird der Test grün; dann die + Kategorie entfernen, und er wird zum Regressionstest. Derzeit gibt es keine offenen + `KnownBug`-Tests. * **Grüne Tests** (`RobustnessRegressionTest` u. a.) sichern das heute korrekte Verhalten ab. * `MeshAssert` prüft Konsistenz, invertierte Dreiecke, vollständige Eingabesegmente, Fläche und Terminierung (mit Timeout). From 9129022dc01df10e738eb111577f3188f36b1de6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 23 Oct 2026 22:35:01 +0000 Subject: [PATCH 04/50] Add per-segment split control (locked segments) ConstraintOptions.CanSplitSegment decides, based on the subsegment (e.g. its label), whether refinement may insert vertices on a segment. Locked segments (e.g. breaklines of a terrain model) keep their input vertices, except for intersections with other segments. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Robustness/LockedSegmentsTest.cs | 120 ++++++++++++++++++ src/Triangle/Behavior.cs | 6 + src/Triangle/Mesh.cs | 4 + src/Triangle/Meshing/ConstraintMesher.cs | 1 + src/Triangle/Meshing/ConstraintOptions.cs | 14 ++ src/Triangle/Meshing/QualityMesher.cs | 3 +- src/Triangle/Smoothing/SimpleSmoother.cs | 1 + 7 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/Triangle.Tests/Robustness/LockedSegmentsTest.cs diff --git a/src/Triangle.Tests/Robustness/LockedSegmentsTest.cs b/src/Triangle.Tests/Robustness/LockedSegmentsTest.cs new file mode 100644 index 0000000..db40bc9 --- /dev/null +++ b/src/Triangle.Tests/Robustness/LockedSegmentsTest.cs @@ -0,0 +1,120 @@ +using NUnit.Framework; +using System; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Segments which may not be split during refinement (e.g. breaklines of a terrain model), + /// see . + /// + public class LockedSegmentsTest + { + private const int Breakline = 100; + + private static readonly TimeSpan LongTimeout = TimeSpan.FromSeconds(30); + + private static ConstraintOptions LockBreaklines() => new ConstraintOptions + { + CanSplitSegment = s => s.Label != Breakline + }; + + private static Polygon SquareWithBreakline(double x1, double y1, double x2, double y2) + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Segment(new Vertex(x1, y1), new Vertex(x2, y2), Breakline), true); + return poly; + } + + private static int VerticesInSegmentInterior(IMesh mesh, Point a, Point b) + { + var predicates = new RobustPredicates(); + + return mesh.Vertices.Count(v => + !(v.X == a.X && v.Y == a.Y) && !(v.X == b.X && v.Y == b.Y) && + predicates.CounterClockwise(a, b, v) == 0.0 && + Math.Min(a.X, b.X) <= v.X && v.X <= Math.Max(a.X, b.X) && + Math.Min(a.Y, b.Y) <= v.Y && v.Y <= Math.Max(a.Y, b.Y)); + } + + [Test] + public void LockedBreaklineKeepsItsVertices() + { + var poly = SquareWithBreakline(1, 1, 9, 2); + var seg = poly.Segments.Last(); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(LockBreaklines(), new QualityOptions { MinimumAngle = 30, MaximumArea = 0.05 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 100); + + Assert.That(VerticesInSegmentInterior(mesh, seg.GetVertex(0), seg.GetVertex(1)), Is.Zero); + + // The breakline is still a single subsegment. + Assert.That(mesh.Segments.Count(s => s.Label == Breakline), Is.EqualTo(1)); + } + + [Test] + public void UnlockedBreaklineIsSplit() + { + // Counter check: without the filter, refinement inserts vertices on the breakline. + var poly = SquareWithBreakline(1, 1, 9, 2); + var seg = poly.Segments.Last(); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.05 }); + + Assert.That(mesh.Segments.Count(s => s.Label == Breakline), Is.GreaterThan(1)); + } + + [Test] + public void OuterBoundaryIsStillSplit() + { + var poly = SquareWithBreakline(1, 1, 9, 2); + + var mesh = poly.Triangulate(LockBreaklines(), new QualityOptions { MinimumAngle = 30, MaximumArea = 0.05 }); + + Assert.That(mesh.Segments.Count(s => s.Label != Breakline), Is.GreaterThan(4)); + } + + [Test] + public void CrossingLockedBreaklinesAreSplitOnlyAtIntersection() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Segment(new Vertex(1, 1), new Vertex(9, 9), Breakline), true); + poly.Add(new Segment(new Vertex(1, 9), new Vertex(9, 1), Breakline), true); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(LockBreaklines(), new QualityOptions { MinimumAngle = 30, MaximumArea = 0.05 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + + // Each breakline consists of exactly two subsegments (split at the intersection). + Assert.That(mesh.Segments.Count(s => s.Label == Breakline), Is.EqualTo(4)); + } + + [Test] + public void ManyLockedCrossingBreaklines([Range(0, 19)] int seed) + { + var random = new Random(seed); + var poly = new Polygon(); + + poly.Add(TestData.Square(0, 0, 10)); + + for (int i = 0; i < 30; i++) + { + poly.Add(new Segment(new Vertex(random.Next(11), random.Next(11)), new Vertex(random.Next(11), random.Next(11)), Breakline), true); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(LockBreaklines(), new QualityOptions { MinimumAngle = 25 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments, 1e-7); + MeshAssert.HasArea(mesh, 100); + } + } +} diff --git a/src/Triangle/Behavior.cs b/src/Triangle/Behavior.cs index 61fb062..04af78f 100644 --- a/src/Triangle/Behavior.cs +++ b/src/Triangle/Behavior.cs @@ -179,6 +179,12 @@ public double MaxArea /// 1 = no new vertices on the boundary /// 2 = prevent all segment splitting, including internal boundaries /// + /// + /// Optional filter deciding whether a subsegment may be split (in addition to + /// ). If null, all subsegments may be split. + /// + public Func CanSplitSegment { get; set; } + public int NoBisect { get => noBisect; diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 52383ad..c492cc9 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -663,6 +663,10 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, horiz.Sym(ref testtri); enq = testtri.tri.id != DUMMY; } + if (enq && (behavior.CanSplitSegment != null)) + { + enq = behavior.CanSplitSegment(brokensubseg.seg); + } if (enq) { // Add the subsegment to the list of encroached subsegments. diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 191326a..578bc4c 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -59,6 +59,7 @@ public void Apply(IPolygon input, ConstraintOptions options) behavior.ConformingDelaunay = options.ConformingDelaunay; behavior.Convex = options.Convex; behavior.NoBisect = options.SegmentSplitting; + behavior.CanSplitSegment = options.CanSplitSegment; if (behavior.ConformingDelaunay) { diff --git a/src/Triangle/Meshing/ConstraintOptions.cs b/src/Triangle/Meshing/ConstraintOptions.cs index 69ec5b4..695cf72 100644 --- a/src/Triangle/Meshing/ConstraintOptions.cs +++ b/src/Triangle/Meshing/ConstraintOptions.cs @@ -46,5 +46,19 @@ public class ConstraintOptions /// intersection points don't lie exactly on the segments. See . /// public bool ResolveIntersections { get; set; } = true; + + /// + /// Gets or sets a filter deciding whether a segment may be split during mesh + /// refinement (in addition to ). If null (default), + /// all segments may be split. + /// + /// + /// The filter is called with mesh subsegments, so it should decide based on + /// (labels of input segments are passed on to their + /// subsegments). Segments that may not be split keep their input vertices only + /// (except for intersections with other segments), but the quality constraints + /// can't be guaranteed near them. + /// + public System.Func CanSplitSegment { get; set; } } } diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 97b5f3e..2a1aefe 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -207,7 +207,8 @@ public int CheckSeg4Encroach(ref Osub testsubseg) } } - if (encroached > 0 && (behavior.NoBisect == 0 || ((behavior.NoBisect == 1) && (sides == 2)))) + if (encroached > 0 && (behavior.NoBisect == 0 || ((behavior.NoBisect == 1) && (sides == 2))) && + (behavior.CanSplitSegment == null || behavior.CanSplitSegment(testsubseg.seg))) { // Add the subsegment to the list of encroached subsegments. // Be sure to get the orientation right. diff --git a/src/Triangle/Smoothing/SimpleSmoother.cs b/src/Triangle/Smoothing/SimpleSmoother.cs index ee70a02..9351295 100644 --- a/src/Triangle/Smoothing/SimpleSmoother.cs +++ b/src/Triangle/Smoothing/SimpleSmoother.cs @@ -95,6 +95,7 @@ public int Smooth(IMesh mesh, int limit = 10, double tol = .01, CancellationToke // The smoother should respect the mesh segment splitting behavior. options.SegmentSplitting = smoothedMesh.behavior.NoBisect; + options.CanSplitSegment = smoothedMesh.behavior.CanSplitSegment; // The maximum distances moved from any site at the previous and // current iterations. From 7a5ea3323e0a8af49852f039010be4adc289c42b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 00:00:23 +0000 Subject: [PATCH 05/50] Harden noding and refinement against the GEOS robustness corpus Findings from triangulating the 2156 cases of the GEOS XML test suite (overlay/noding failures reported against JTS, GEOS, PostGIS, QGIS and Shapely) as PSLGs: - SegmentNoder: merge vertices closer than the snap tolerance (exact duplicates are kept), don't snap vertices that are within the tolerance of a segment endpoint, avoid duplicate new segments. Tiny rings with coordinate noise made the noder split segments forever. - SegmentNoder: if noding doesn't converge (many nearly coincident segments), retry with a larger snap tolerance (up to 2^-32 relative, like the GEOS snapping noder), otherwise throw instead of running forever. - QualityMesher: if splitting a subsegment would create a flat or inverted triangle (exact test) or the split point coincides with an endpoint, don't split it and exclude it from further splitting instead of silently inverting triangles or throwing "Ran out of precision". Leave triangles that can't be refined instead of throwing "new vertex at circumcenter". Check orientation after refinement. - RobustPredicates: guard reads past the end of an expansion in FastExpansionSumZeroElim (IndexOutOfRangeException for infinite input). - Tests: regression tests for the above; explicit corpus tests (category "Corpus") for the GEOS test suite and for NRW open data (ALKIS parcels, DGM1), each case in a child process. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 44 +++- src/Triangle.Tests/Corpus/CorpusCase.cs | 71 +++++ src/Triangle.Tests/Corpus/CorpusCheck.cs | 158 +++++++++++ src/Triangle.Tests/Corpus/CorpusReaders.cs | 182 +++++++++++++ src/Triangle.Tests/Corpus/CorpusTest.cs | 175 +++++++++++++ src/Triangle.Tests/Program.cs | 5 + .../Robustness/IsolatedProcess.cs | 14 +- .../Robustness/NodingAndRefinementTest.cs | 83 ++++++ .../Robustness/PredicatesTest.cs | 58 +++++ src/Triangle/Mesh.cs | 4 +- src/Triangle/Meshing/QualityMesher.cs | 103 +++++++- src/Triangle/Meshing/SegmentNoder.cs | 246 +++++++++++++++--- src/Triangle/RobustPredicates.cs | 20 +- 13 files changed, 1096 insertions(+), 67 deletions(-) create mode 100644 src/Triangle.Tests/Corpus/CorpusCase.cs create mode 100644 src/Triangle.Tests/Corpus/CorpusCheck.cs create mode 100644 src/Triangle.Tests/Corpus/CorpusReaders.cs create mode 100644 src/Triangle.Tests/Corpus/CorpusTest.cs create mode 100644 src/Triangle.Tests/Robustness/PredicatesTest.cs diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 52ade16..8499278 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -159,7 +159,7 @@ paralleles Vermaschen mit eigenen Prädikaten. | # | Fix | Datei | |---|-----|-------| -| 1–3 | **Noding mit Snapping** vor dem Einfügen der Segmente (`ConstraintOptions.ResolveIntersections`, Standard an): alle Schnittpunkte werden vorab berechnet (exakte Kreuzungserkennung), neue Punkte näher als r ≈ 1e-12 · Ausdehnung an einem bestehenden Punkt werden mit ihm verschmolzen, und Punkte näher als r an einem Segment werden ins Segment eingebunden. Eingabepunkte werden nie verschoben. Das Verfahren terminiert nachweisbar, weil neue Punkte einen Mindestabstand haben. | `Meshing/SegmentNoder.cs` | +| 1–3 | **Noding mit Snapping** vor dem Einfügen der Segmente (`ConstraintOptions.ResolveIntersections`, Standard an). Toleranz r ≈ 1e-12 × Koordinatengröße (bei UTM ≈ 5 µm). Punkte näher als r zueinander werden verschmolzen (exakte Duplikate bleiben erhalten). Alle Schnittpunkte werden vorab berechnet (exakte Kreuzungserkennung) und mit Punkten in Reichweite r zusammengefasst. Punkte näher als r an einem Segment werden ins Segment eingebunden. Konvergiert das nicht (z. B. viele fast deckungsgleiche Kanten), wird die Toleranz in Stufen bis 2,3e-10 × Koordinatengröße (UTM ≈ 1,4 mm) erhöht, wie beim Snapping-Noder von GEOS. Danach gibt es eine klare `InvalidOperationException`, keinen Hänger. | `Meshing/SegmentNoder.cs` | | 1–3 | **Sicherheitsnetz:** `ScoutSegment`/`ConstrainedEdge` als Schleife statt Rekursion (kein StackOverflow), Schrittzähler gegen Endlosschleifen, Orientierungsprüfung nach dem Einfügen von Schnittpunkten. Ungültige Netze werden damit nie still zurückgegeben. | `Meshing/ConstraintMesher.cs` | | 4 | Arbeits-Arrays der exakten Arithmetik thread-lokal; jede `RobustPredicates`-Instanz ist jetzt thread-sicher. | `RobustPredicates.cs` | | 5, 11 | Identische Punkte: leeres Netz statt StackOverflow (Dwyer) bzw. Exception (SweepLine). | `Dwyer.cs`, `SweepLine.cs` | @@ -169,6 +169,8 @@ paralleles Vermaschen mit eigenen Prädikaten. | 10 | SweepLine: abschließender Flip-Durchlauf mit exakten Prädikaten. | `SweepLine.cs` | | neu | **aCute-Verfeinerung** (seit 2022 Standard) startete die Punktsuche an einer Kante, links von der der neue Punkt nicht liegt → Punkt im falschen Dreieck, invertierte Dreiecke. Jetzt wird die Startkante per Orientierungstest gewählt. | `Meshing/QualityMesher.cs` | | neu | aCute-Ort fällt auf einen bestehenden Punkt → Rückfall auf den Umkreismittelpunkt statt Exception. | `Meshing/QualityMesher.cs` | +| neu | **Präzisionsgrenze bei der Verfeinerung:** Würde das Teilen eines Segments (mit exakter Prüfung) ein flaches/invertiertes Dreieck erzeugen oder fällt der Teilungspunkt auf einen Endpunkt, wird das Teilsegment nicht geteilt und für den Rest der Verfeinerung gesperrt (statt still invertierter Dreiecke bzw. „Ran out of precision“). Zu kleine Dreiecke bleiben stehen (statt „new vertex at circumcenter“). Abschließende Orientierungsprüfung → laute Exception statt ungültigem Netz. | `Meshing/QualityMesher.cs` | +| neu | `FastExpansionSumZeroElim` las (wie das C-Original) ein Element hinter dem Ende einer Expansion; in C# eine `IndexOutOfRangeException`, ausgelöst durch unendliche Koordinaten. | `RobustPredicates.cs` | **Ergebnis (Fuzzing, jeder Fall in eigenem Prozess):** @@ -182,9 +184,47 @@ paralleles Vermaschen mit eigenen Prädikaten. | 200 Segmente auf 50er-Raster, 20° | – | 50/50 | | Nachbarflächen mit Abweichung 1e-12, 25°, **ohne** Steiner-Limit | terminiert nicht | ~30 ms | -Die Testsuite hat jetzt 203 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre +Die Testsuite hat jetzt 234 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre Regressionstests geworden. +### Externer Korpus: GEOS-Robustheitstests + +Die XML-Testsuite von GEOS (`tests/xmltester/tests`) enthält 2156 Fälle, an denen Overlay/Noding +in JTS, GEOS, PostGIS, QGIS oder Shapely gescheitert ist (OSM-Wasserflächen, Isochronen, +Mikropolygone mit Koordinatenrauschen, fast deckungsgleiche Kanten, Nadeldreiecke). Jeder Fall +wurde als PSLG trianguliert (alle Kanten von A und B plus Rahmen), ohne und mit 20° +Mindestwinkel, jeweils in eigenem Prozess: + +| Stand | ohne Qualität | 20° | +|-------|---------------|-----| +| nach den ersten Fixes | 2142 gültig, 7 Abstürze/Exceptions, 3 Hänger | 2105 gültig, 31 Exceptions, **2 still inkonsistent**, 5 Hänger | +| jetzt | **2152 gültig** | **2151 gültig**, 1 langsam (> 60 s) | + +Die verbleibenden 4 Fälle je Spalte enthalten absichtlich NaN/Inf und werden korrekt mit +`ArgumentException` abgewiesen. Der langsame Fall (extrem lange Nadeldreiecke, 10⁶ : 1) ist +gültig, braucht aber ~70 s. Der Original-Stand ist dort 30× schneller, liefert aber bis zu 18.000 +invertierte Dreiecke. Bei normalen Daten liegt der Mehraufwand der Fixes bei 0–25 %. + +Der Korpuslauf ist Teil der Testsuite (Kategorie `Corpus`, explizit), ebenso Läufe mit +**ALKIS-Flurstücken** und **DGM1** aus NRW: + +``` +# GEOS: git clone --depth 1 --filter=blob:none --sparse https://github.com/libgeos/geos +# git -C geos sparse-checkout set tests/xmltester/tests +export TRIANGLE_GEOS_TESTS=/pfad/geos/tests/xmltester/tests +# NRW (Open Data, DL-DE Zero 2.0): Flurstücke als GeoJSON (UTM32), DGM1 als xyz(.gz) +export TRIANGLE_NRW_ALKIS=/pfad/flurstuecke.geojson +export TRIANGLE_NRW_DGM=/pfad/dgm1_32_xxx_yyyy_1_nw.xyz.gz +export TRIANGLE_CORPUS_TILES=200 # Anzahl Kacheln (Standard 200) +export TRIANGLE_CORPUS_TILE=200 # Kachelgröße in m (Standard 200) +dotnet test src/Triangle.Tests --filter TestCategory=Corpus +``` + +Die NRW-Läufe zerlegen die Flurstücke in Kacheln (vollständige Flurstücke inklusive ihrer +Nachbarn, also mit doppelt digitalisierten gemeinsamen Grenzen) bzw. kombinieren ein 1-m-Raster +des DGM1 mit den Flurstücksgrenzen als Bruchkanten. In dieser Entwicklungsumgebung waren die +NRW-Portale nicht erreichbar; geprüft wurde der Ablauf mit synthetischen Daten im gleichen Format. + ## Die Testsuite (`src/Triangle.Tests/Robustness`) * **Red Tests** tragen die Kategorie `KnownBug` und dokumentieren jeweils einen Fehler mit diff --git a/src/Triangle.Tests/Corpus/CorpusCase.cs b/src/Triangle.Tests/Corpus/CorpusCase.cs new file mode 100644 index 0000000..92c44bc --- /dev/null +++ b/src/Triangle.Tests/Corpus/CorpusCase.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; + +namespace TriangleNet.Tests.Corpus +{ + /// + /// A test case of an external corpus: polylines (become segments) and single points. + /// + public class CorpusCase + { + public string Name { get; set; } + + public List> Lines { get; } = new List>(); + + public List<(double X, double Y)> Points { get; } = new List<(double X, double Y)>(); + + /// + /// Save the case in a simple text format (one line per polyline / point). + /// + public void Save(string path) + { + using var writer = new StreamWriter(path); + + writer.WriteLine("# " + Name); + + foreach (var line in Lines) + { + writer.WriteLine("L " + string.Join(" ", line.Select(p => Format(p.X) + "," + Format(p.Y)))); + } + + foreach (var p in Points) + { + writer.WriteLine("P " + Format(p.X) + "," + Format(p.Y)); + } + } + + public static CorpusCase Load(string path) + { + var c = new CorpusCase(); + + foreach (var row in File.ReadLines(path)) + { + if (row.StartsWith("# ")) + { + c.Name = row.Substring(2); + } + else if (row.StartsWith("L ")) + { + c.Lines.Add(row.Substring(2).Split(' ').Select(Parse).ToList()); + } + else if (row.StartsWith("P ")) + { + c.Points.Add(Parse(row.Substring(2))); + } + } + + return c; + } + + private static string Format(double x) => x.ToString("R", CultureInfo.InvariantCulture); + + private static (double, double) Parse(string s) + { + var parts = s.Split(','); + return (double.Parse(parts[0], CultureInfo.InvariantCulture), double.Parse(parts[1], CultureInfo.InvariantCulture)); + } + } +} diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs new file mode 100644 index 0000000..dea2339 --- /dev/null +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Corpus +{ + /// + /// Triangulates a corpus case (all polylines as segments, enclosed by a frame) and + /// validates the result. + /// + public static class CorpusCheck + { + /// + /// Returns "OK ..." or a description of the failure. + /// + public static string Run(CorpusCase c, double minAngle, int steinerPoints) + { + var poly = new Polygon(); + var map = new Dictionary<(double, double), Vertex>(); + + Vertex V((double, double) p) + { + if (!map.TryGetValue(p, out var v)) + { + v = new Vertex(p.Item1, p.Item2); + map[p] = v; + poly.Add(v); + } + return v; + } + + foreach (var line in c.Lines) + { + foreach (var p in line) V(p); + + for (int i = 0; i + 1 < line.Count; i++) + { + if (line[i] != line[i + 1]) + { + poly.Add(new Segment(V(line[i]), V(line[i + 1]))); + } + } + } + + foreach (var p in c.Points) V(p); + + if (poly.Points.Count == 0) + { + return "SKIPPED (empty)"; + } + + // Frame enclosing everything. + var b = poly.Bounds(); + double mag = new[] { b.Left, b.Right, b.Top, b.Bottom }.Max(Math.Abs); + double w = Math.Max(Math.Max(b.Width, b.Height) * 0.1, mag * 1e-6 + 1e-6); + var f = new[] { (b.Left - w, b.Bottom - w), (b.Right + w, b.Bottom - w), (b.Right + w, b.Top + w), (b.Left - w, b.Top + w) }; + + for (int i = 0; i < 4; i++) + { + poly.Add(new Segment(V(f[i]), V(f[(i + 1) % 4]))); + } + + double area = (f[1].Item1 - f[0].Item1) * (f[2].Item2 - f[1].Item2); + double scale = Math.Max(mag + w, Math.Max(b.Width, b.Height) + 2 * w); + + Mesh mesh; + + try + { + var quality = minAngle > 0 ? new QualityOptions { MinimumAngle = minAngle, SteinerPoints = steinerPoints } : null; + mesh = (Mesh)poly.Triangulate(new ConstraintOptions(), quality); + } + catch (Exception e) + { + var ex = e.GetBaseException(); + return "EXCEPTION " + ex.GetType().Name + ": " + ex.Message; + } + + if (!MeshValidator.IsConsistent(mesh)) + { + return "INCONSISTENT"; + } + + var predicates = new RobustPredicates(); + + if (mesh.Triangles.Any(t => predicates.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2)) <= 0.0)) + { + return "INVERTED"; + } + + double sum = mesh.Triangles.Sum(t => + { + var p = t.GetVertex(0); var q = t.GetVertex(1); var r = t.GetVertex(2); + return 0.5 * ((q.X - p.X) * (r.Y - p.Y) - (r.X - p.X) * (q.Y - p.Y)); + }); + + if (Math.Abs(sum - area) > 1e-9 * area) + { + return $"AREA {sum:R} != {area:R}"; + } + + // Every input segment must be covered by mesh subsegments (within the snap tolerance). + SegmentNoder.Node(poly, predicates, out double noderTolerance); + double tol = Math.Max(scale * 1e-11, 4 * noderTolerance); + + var subsegs = mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(); + int missing = poly.Segments.Count(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tol)); + + if (missing > 0) + { + return $"SEGMENTS_MISSING {missing}"; + } + + return $"OK triangles={mesh.Triangles.Count}"; + } + + private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, double tol) + { + double dx = p1.X - p0.X, dy = p1.Y - p0.Y, len = Math.Sqrt(dx * dx + dy * dy); + + // Union of the subsegments lying on p0-p1, projected onto p0-p1. + var intervals = new List<(double, double)>(); + + foreach (var (a, b) in subsegs) + { + if (DistanceToSegment(a, p0, p1) > tol || DistanceToSegment(b, p0, p1) > tol) continue; + + double ta = ((a.X - p0.X) * dx + (a.Y - p0.Y) * dy) / len; + double tb = ((b.X - p0.X) * dx + (b.Y - p0.Y) * dy) / len; + + intervals.Add((Math.Max(0, Math.Min(ta, tb)), Math.Min(len, Math.Max(ta, tb)))); + } + + intervals.Sort(); + + double covered = 0, end = double.NegativeInfinity; + + foreach (var (s, e) in intervals) + { + if (e <= end) continue; + covered += e - Math.Max(s, end); + end = e; + } + + return Math.Abs(covered - len) <= tol * 10 + len * 1e-9; + } + + private static double DistanceToSegment(Point v, Point p, Point q) + { + double dx = q.X - p.X, dy = q.Y - p.Y, l2 = dx * dx + dy * dy; + double t = l2 == 0 ? 0 : Math.Max(0, Math.Min(1, ((v.X - p.X) * dx + (v.Y - p.Y) * dy) / l2)); + double ex = p.X + t * dx - v.X, ey = p.Y + t * dy - v.Y; + return Math.Sqrt(ex * ex + ey * ey); + } + } +} diff --git a/src/Triangle.Tests/Corpus/CorpusReaders.cs b/src/Triangle.Tests/Corpus/CorpusReaders.cs new file mode 100644 index 0000000..40796af --- /dev/null +++ b/src/Triangle.Tests/Corpus/CorpusReaders.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Text.Json; +using System.Text.RegularExpressions; +using System.Xml.Linq; + +namespace TriangleNet.Tests.Corpus +{ + public static class CorpusReaders + { + /// + /// Read all test cases of the GEOS XML test suite (directory tests/xmltester/tests of + /// https://github.com/libgeos/geos). Each case combines the linework of geometries A and B. + /// + public static IEnumerable ReadGeosXml(string directory) + { + foreach (var file in Directory.GetFiles(directory, "*.xml", SearchOption.AllDirectories).OrderBy(f => f, StringComparer.Ordinal)) + { + XDocument doc; + + try { doc = XDocument.Load(file); } catch { continue; } + + int n = 0; + + foreach (var c in doc.Descendants("case")) + { + n++; + + var result = new CorpusCase { Name = Path.GetRelativePath(directory, file) + "#" + n }; + + foreach (var g in c.Elements().Where(e => e.Name == "a" || e.Name == "b")) + { + var wkt = g.Value.Trim(); + + // Skip WKB (hex) input. + if (wkt.Length == 0 || !char.IsLetter(wkt[0])) continue; + + AddWkt(result, wkt); + } + + if (result.Lines.Sum(l => l.Count) + result.Points.Count >= 3) + { + yield return result; + } + } + } + } + + /// + /// Add the linework of a WKT geometry (any type) to the case. + /// + public static void AddWkt(CorpusCase c, string wkt) + { + // Innermost coordinate lists "(x y, x y, ...)". + foreach (Match m in Regex.Matches(wkt, @"\(([^()]*)\)")) + { + var points = new List<(double, double)>(); + + foreach (var token in m.Groups[1].Value.Split(',')) + { + var xy = token.Trim().Split((char[])null, StringSplitOptions.RemoveEmptyEntries); + + if (xy.Length >= 2 && + double.TryParse(xy[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var x) && + double.TryParse(xy[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var y)) + { + points.Add((x, y)); + } + } + + if (points.Count == 1) c.Points.Add(points[0]); + else if (points.Count > 1) c.Lines.Add(points); + } + } + + /// + /// Read all rings of Polygon/MultiPolygon features of a GeoJSON file (e.g. ALKIS parcels). + /// + public static List> ReadGeoJsonRings(string path) + { + var rings = new List>(); + + using var stream = File.OpenRead(path); + using var doc = JsonDocument.Parse(stream); + + foreach (var feature in doc.RootElement.GetProperty("features").EnumerateArray()) + { + if (!feature.TryGetProperty("geometry", out var geometry) || geometry.ValueKind != JsonValueKind.Object) continue; + + var type = geometry.GetProperty("type").GetString(); + var coordinates = geometry.GetProperty("coordinates"); + + if (type == "Polygon") + { + AddPolygon(rings, coordinates); + } + else if (type == "MultiPolygon") + { + foreach (var polygon in coordinates.EnumerateArray()) AddPolygon(rings, polygon); + } + } + + return rings; + } + + private static void AddPolygon(List> rings, JsonElement polygon) + { + foreach (var ring in polygon.EnumerateArray()) + { + rings.Add(ring.EnumerateArray().Select(p => (p[0].GetDouble(), p[1].GetDouble())).ToList()); + } + } + + /// + /// Read points of an xyz file (e.g. DGM1 NRW, optionally gzip compressed) inside the given window. + /// + public static List<(double X, double Y)> ReadXyz(string path, double left, double bottom, double right, double top) + { + var points = new List<(double X, double Y)>(); + + using Stream file = File.OpenRead(path); + using Stream stream = path.EndsWith(".gz", StringComparison.OrdinalIgnoreCase) ? new GZipStream(file, CompressionMode.Decompress) : file; + using var reader = new StreamReader(stream); + + string row; + + while ((row = reader.ReadLine()) != null) + { + var v = row.Split((char[])null, StringSplitOptions.RemoveEmptyEntries); + + if (v.Length < 2 || + !double.TryParse(v[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var x) || + !double.TryParse(v[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var y)) continue; + + if (x >= left && x <= right && y >= bottom && y <= top) points.Add((x, y)); + } + + return points; + } + + /// + /// Split parcel rings into square tiles. Each tile contains all rings whose bounding box + /// intersects the tile (rings are not clipped, so neighboring parcels and their shared, + /// possibly mismatched boundaries are complete). + /// + public static IEnumerable Tiles(string name, List> rings, double tileSize, int maxTiles) + { + var boxes = rings.Select(r => (r, r.Min(p => p.X), r.Min(p => p.Y), r.Max(p => p.X), r.Max(p => p.Y))).ToList(); + + double left = boxes.Min(b => b.Item2), bottom = boxes.Min(b => b.Item3); + double right = boxes.Max(b => b.Item4), top = boxes.Max(b => b.Item5); + + int count = 0; + + for (double x = left; x < right && count < maxTiles; x += tileSize) + { + for (double y = bottom; y < top && count < maxTiles; y += tileSize) + { + var c = new CorpusCase { Name = $"{name} tile {x:F0}/{y:F0}" }; + + foreach (var b in boxes) + { + if (b.Item2 <= x + tileSize && b.Item4 >= x && b.Item3 <= y + tileSize && b.Item5 >= y) + { + c.Lines.Add(b.r); + } + } + + if (c.Lines.Count > 0) + { + count++; + yield return c; + } + } + } + } + } +} diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs new file mode 100644 index 0000000..da424b1 --- /dev/null +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -0,0 +1,175 @@ +using NUnit.Framework; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Corpus +{ + /// + /// Robustness tests with external data. The tests are explicit (not part of the regular + /// test run) and skipped if the data isn't available. Each case is triangulated in a child + /// process (with timeout), with and without quality refinement. + /// + /// + /// Environment variables: + /// TRIANGLE_GEOS_TESTS directory tests/xmltester/tests of a GEOS checkout + /// (https://github.com/libgeos/geos) + /// TRIANGLE_NRW_ALKIS GeoJSON file with ALKIS parcels (ETRS89/UTM32), e.g. from + /// https://www.opengeodata.nrw.de (Liegenschaftskataster) or the + /// open data portals of NRW cities + /// TRIANGLE_NRW_DGM DGM1 xyz(.gz) tile from https://www.opengeodata.nrw.de (dgm1_xyz) + /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) + /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) + /// + /// Run: dotnet test --filter TestCategory=Corpus + /// + [Category("Corpus"), Explicit("Requires external data, see remarks.")] + public class CorpusTest + { + private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(120); + + private const int SteinerPoints = 100000; + + [Test] + public void GeosXmlTestSuite() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_GEOS_TESTS"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_GEOS_TESTS not set."); + } + + RunCases(CorpusReaders.ReadGeosXml(directory)); + } + + [Test] + public void NrwParcels() + { + var path = Environment.GetEnvironmentVariable("TRIANGLE_NRW_ALKIS"); + + if (string.IsNullOrEmpty(path) || !File.Exists(path)) + { + Assert.Ignore("TRIANGLE_NRW_ALKIS not set."); + } + + var rings = CorpusReaders.ReadGeoJsonRings(path); + + RunCases(CorpusReaders.Tiles(Path.GetFileName(path), rings, TileSize(), MaxTiles())); + } + + [Test] + public void NrwTerrainWithParcelBoundaries() + { + var dgm = Environment.GetEnvironmentVariable("TRIANGLE_NRW_DGM"); + + if (string.IsNullOrEmpty(dgm) || !File.Exists(dgm)) + { + Assert.Ignore("TRIANGLE_NRW_DGM not set."); + } + + var alkis = Environment.GetEnvironmentVariable("TRIANGLE_NRW_ALKIS"); + var rings = !string.IsNullOrEmpty(alkis) && File.Exists(alkis) ? CorpusReaders.ReadGeoJsonRings(alkis) : null; + + // Use a few windows of the tile: grid points (1 m spacing, highly cocircular) and, + // if available, parcel boundaries as breaklines. + var all = CorpusReaders.ReadXyz(dgm, double.MinValue, double.MinValue, double.MaxValue, double.MaxValue); + double left = all.Min(p => p.X), bottom = all.Min(p => p.Y); + double size = TileSize(); + + var cases = new List(); + + for (int i = 0; i < 4; i++) + { + double x = left + i * 2.5 * size, y = bottom + i * 2.5 * size; + var c = new CorpusCase { Name = $"{Path.GetFileName(dgm)} window {x:F0}/{y:F0}" }; + + c.Points.AddRange(all.Where(p => p.X >= x && p.X <= x + size && p.Y >= y && p.Y <= y + size)); + + if (rings != null) + { + c.Lines.AddRange(rings.Where(r => r.Any(p => p.X >= x && p.X <= x + size && p.Y >= y && p.Y <= y + size))); + } + + if (c.Points.Count > 0) cases.Add(c); + } + + RunCases(cases); + } + + /// + /// Entry point of the child process: corpus-case <file> <minimum angle> + /// + public static int RunCase(string[] args) + { + var c = CorpusCase.Load(args[1]); + double minAngle = double.Parse(args[2], CultureInfo.InvariantCulture); + + Console.WriteLine("RESULT " + CorpusCheck.Run(c, minAngle, SteinerPoints)); + + return 0; + } + + private static void RunCases(IEnumerable cases) + { + var directory = Path.Combine(Path.GetTempPath(), "triangle-corpus-" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(directory); + + var files = new List<(string Name, string File)>(); + + foreach (var c in cases) + { + var file = Path.Combine(directory, files.Count + ".txt"); + c.Save(file); + files.Add((c.Name, file)); + } + + var results = new ConcurrentBag<(string Name, double MinAngle, string Result)>(); + + var jobs = files.SelectMany(f => new[] { (f, 0.0), (f, 20.0) }); + + Parallel.ForEach(jobs, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, job => + { + var ((name, file), minAngle) = job; + + var run = IsolatedProcess.Run(new[] { "corpus-case", file, minAngle.ToString(CultureInfo.InvariantCulture) }, Timeout); + + string result = run.TimedOut ? "TIMEOUT" + : run.Output.Split('\n').Select(l => l.Trim()).LastOrDefault(l => l.StartsWith("RESULT "))?.Substring(7) + ?? $"CRASH (exit code {run.ExitCode})"; + + results.Add((name, minAngle, result)); + }); + + Directory.Delete(directory, true); + + var failures = results.Where(r => !r.Result.StartsWith("OK") && !r.Result.StartsWith("SKIPPED")) + .OrderBy(r => r.Name, StringComparer.Ordinal).ThenBy(r => r.MinAngle).ToList(); + + TestContext.Out.WriteLine($"{files.Count} cases, {results.Count} runs, {failures.Count} failures"); + + foreach (var g in results.GroupBy(r => (r.MinAngle, r.Result.Split(' ')[0])).OrderBy(g => g.Key)) + { + TestContext.Out.WriteLine($" min angle {g.Key.MinAngle}: {g.Key.Item2} x {g.Count()}"); + } + + foreach (var f in failures) + { + TestContext.Out.WriteLine($" {f.Name} (min angle {f.MinAngle}): {f.Result}"); + } + + Assert.That(failures, Is.Empty, string.Join("\n", failures.Take(50).Select(f => $"{f.Name} (min angle {f.MinAngle}): {f.Result}"))); + } + + private static double TileSize() => + double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_TILE"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 200.0; + + private static int MaxTiles() => + int.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_TILES"), out var n) ? n : 200; + } +} diff --git a/src/Triangle.Tests/Program.cs b/src/Triangle.Tests/Program.cs index 4d7812d..5529580 100644 --- a/src/Triangle.Tests/Program.cs +++ b/src/Triangle.Tests/Program.cs @@ -14,6 +14,11 @@ public static class Program { public static int Main(string[] args) { + if (args.Length > 0 && args[0] == "corpus-case") + { + return Corpus.CorpusTest.RunCase(args); + } + return IsolatedProcess.RunScenario(args); } } diff --git a/src/Triangle.Tests/Robustness/IsolatedProcess.cs b/src/Triangle.Tests/Robustness/IsolatedProcess.cs index 80aa0ff..bf4f689 100644 --- a/src/Triangle.Tests/Robustness/IsolatedProcess.cs +++ b/src/Triangle.Tests/Robustness/IsolatedProcess.cs @@ -42,6 +42,14 @@ public static void AssertSucceeds(string scenario, TimeSpan? timeout = null) } public static (bool TimedOut, int ExitCode, string Output) Run(string scenario, TimeSpan timeout) + { + return Run(new[] { scenario }, timeout); + } + + /// + /// Run the test assembly in a child process with the given arguments (see ). + /// + public static (bool TimedOut, int ExitCode, string Output) Run(string[] arguments, TimeSpan timeout) { var assembly = typeof(IsolatedProcess).Assembly.Location; var host = Environment.GetEnvironmentVariable("DOTNET_HOST_PATH") ?? "dotnet"; @@ -54,7 +62,11 @@ public static (bool TimedOut, int ExitCode, string Output) Run(string scenario, }; psi.ArgumentList.Add(assembly); - psi.ArgumentList.Add(scenario); + + foreach (var argument in arguments) + { + psi.ArgumentList.Add(argument); + } var output = new StringBuilder(); diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs index 33e2b29..d1569e4 100644 --- a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System; +using System.Collections.Generic; using System.Linq; using TriangleNet.Geometry; using TriangleNet.Meshing; @@ -121,5 +122,87 @@ public void AdjacentPolygonsWithMismatchedBoundaryQualityWithoutLimit() MeshAssert.IsValid(mesh); MeshAssert.HasArea(mesh, 200, 1e-6); } + [Test] + [Description("Fixed: tiny rings with vertices closer than the snap tolerance (coordinate noise) made the noder split segments forever.")] + public void MicroRingsWithCoordinateNoise() + { + var poly = new Polygon(); + var random = new Random(5); + + for (int k = 0; k < 5; k++) + { + double x = -92.66 + 0.002 * k, y = 36.59 + 0.001 * k; + var ring = new List(); + + for (int i = 0; i < 5; i++) + { + ring.Add(new Vertex(x + (random.NextDouble() - 0.5) * 1e-13, y + (random.NextDouble() - 0.5) * 1e-13)); + } + + poly.Add(new Contour(ring)); + } + + poly.Add(TestData.Square(-92.67, 36.58, 0.03)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20, SteinerPoints = 20000 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 0.03 * 0.03, 1e-6); + } + + private static Polygon StackedSquares(double offset) + { + var poly = new Polygon(); + + for (int k = 0; k < 40; k++) + { + double a = 0.8 + k * offset * 0.1, d = k * offset; + var c = new[] { (0.0, 0.0), (2.0, 0.0), (2.0, 2.0), (0.0, 2.0) } + .Select(p => new Vertex(600 + d + p.Item1 * Math.Cos(a) - p.Item2 * Math.Sin(a), 600 + d + p.Item1 * Math.Sin(a) + p.Item2 * Math.Cos(a))); + + poly.Add(new Contour(c)); + } + + poly.Add(TestData.Square(595, 595, 10)); + + return poly; + } + + [Test] + [Description("Fixed: many stacked, nearly identical squares made noding explode; now the snap tolerance is increased.")] + public void StackedNearlyIdenticalSquares([Values(1e-10, 1e-8)] double offset) + { + var poly = StackedSquares(offset); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100, 1e-9); + } + + [Test] + public void StackedNearlyIdenticalSquaresBeyondTolerance() + { + // Offsets larger than the maximum snap tolerance: noding can't converge in + // reasonable time, which must be reported (instead of running forever). + var poly = StackedSquares(1e-6); + + var e = Assert.Throws(() => MeshAssert.Terminates(() => poly.Triangulate(), LongTimeout)); + Assert.That(e.InnerException, Is.InstanceOf()); + } + + [Test] + [Description("Fixed: refinement of needle-shaped regions silently produced inverted triangles (segment splits beyond floating point precision).")] + public void NeedleTriangles() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(101, 99), new Vertex(101, 1000000), new Vertex(102, 1000000) })); + poly.Add(new Contour(new[] { new Vertex(100, 100), new Vertex(1000000, 110), new Vertex(1000000, 100) })); + poly.Add(TestData.Square(-100000, -100000, 1200000)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20, SteinerPoints = 10000 }), LongTimeout); + + MeshAssert.IsValid(mesh); + } } } diff --git a/src/Triangle.Tests/Robustness/PredicatesTest.cs b/src/Triangle.Tests/Robustness/PredicatesTest.cs new file mode 100644 index 0000000..0f8b8c6 --- /dev/null +++ b/src/Triangle.Tests/Robustness/PredicatesTest.cs @@ -0,0 +1,58 @@ +using NUnit.Framework; +using System; +using TriangleNet.Geometry; + +namespace TriangleNet.Tests.Robustness +{ + public class PredicatesTest + { + [Test] + [Description("Fixed: FastExpansionSumZeroElim read one element past the end of an expansion (harmless in the original C code, IndexOutOfRangeException in C#).")] + public void NearlyCollinearPointsOfDifferentMagnitude() + { + var predicates = new RobustPredicates(); + var random = new Random(1); + + Exception error = null; + + for (int i = 0; i < 200000 && error == null; i++) + { + // Points on a line with tiny perturbations and coordinates of very different magnitude. + double scale = Math.Pow(2, random.Next(-60, 60)); + double ax = (random.NextDouble() - 0.5) * scale, ay = (random.NextDouble() - 0.5) * scale; + double dx = random.NextDouble() - 0.5, dy = random.NextDouble() - 0.5; + double t1 = random.NextDouble() * Math.Pow(2, random.Next(-40, 40)); + double t2 = random.NextDouble() * Math.Pow(2, random.Next(-40, 40)); + + var a = new Point(ax, ay); + var b = new Point(ax + t1 * dx, ay + t1 * dy); + var c = new Point(ax + t2 * dx + Math.Pow(2, random.Next(-80, 0)), ay + t2 * dy); + + try + { + predicates.CounterClockwise(a, b, c); + predicates.InCircle(a, b, c, new Point(ax - t2 * dy, ay + t1 * dx)); + } + catch (Exception e) + { + error = e; + } + } + + Assert.That(error, Is.Null); + } + + [Test] + [Description("Fixed: infinite coordinates caused an IndexOutOfRangeException in FastExpansionSumZeroElim (the noder runs before input validation).")] + public void InfiniteSegmentCoordinates() + { + double inf = double.PositiveInfinity; + + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(inf, inf), new Vertex(-inf, inf), new Vertex(-inf, -inf), new Vertex(inf, -inf) })); + poly.Add(new Vertex(1, 1)); + + Assert.Throws(() => poly.Triangulate()); + } + } +} diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index c492cc9..7cfdaac 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -663,9 +663,9 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, horiz.Sym(ref testtri); enq = testtri.tri.id != DUMMY; } - if (enq && (behavior.CanSplitSegment != null)) + if (enq && (qualityMesher != null)) { - enq = behavior.CanSplitSegment(brokensubseg.seg); + enq = qualityMesher.CanSplit(brokensubseg.seg); } if (enq) { diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 2a1aefe..2d0a97d 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -28,6 +28,9 @@ class QualityMesher NewLocation newLocation; + // Subsegments which can't be split due to the limited precision of floating point arithmetic. + HashSet unsplittable = new HashSet(); + Log logger = Log.Instance; // Stores the vertices of the triangle that contains newvertex @@ -208,7 +211,7 @@ public int CheckSeg4Encroach(ref Osub testsubseg) } if (encroached > 0 && (behavior.NoBisect == 0 || ((behavior.NoBisect == 1) && (sides == 2))) && - (behavior.CanSplitSegment == null || behavior.CanSplitSegment(testsubseg.seg))) + CanSplit(testsubseg.seg)) { // Add the subsegment to the list of encroached subsegments. // Be sure to get the orientation right. @@ -657,17 +660,23 @@ private void SplitEncSegs(bool triflaws) } } - // Check whether the new vertex lies on an endpoint. + // Check whether the new vertex lies on an endpoint, or whether inserting it + // would create flat or inverted triangles. In both cases, the segment is too + // small to be split with the finite precision of floating point arithmetic. if (((newvertex.x == eorg.x) && (newvertex.y == eorg.y)) || - ((newvertex.x == edest.x) && (newvertex.y == edest.y))) + ((newvertex.x == edest.x) && (newvertex.y == edest.y)) || + !IsValidSplit(ref enctri, newvertex)) { + if (Log.Verbose) + { + logger.Warning("Ran out of precision: segment can't be split.", "Quality.SplitEncSegs()"); + } - logger.Error("Ran out of precision: I attempted to split a" - + " segment to a smaller size than can be accommodated by" - + " the finite precision of floating point arithmetic.", - "Quality.SplitEncSegs()"); - - throw new Exception("Ran out of precision"); + // Don't split this subsegment (quality may be compromised near it). + mesh.vertices.Remove(newvertex.hash); + unsplittable.Add(currentenc.seg); + seg.org = null; + continue; } // Insert the splitting vertex. This should always succeed. success = mesh.InsertVertex(newvertex, ref enctri, ref currentenc, true, triflaws); @@ -860,12 +869,76 @@ private void SplitTriangle(BadTriangle badtri) if (errorflag) { - logger.Error("The new vertex is at the circumcenter of triangle: This probably " - + "means that I am trying to refine triangles to a smaller size than can be " - + "accommodated by the finite precision of floating point arithmetic.", - "Quality.SplitTriangle()"); + // The triangle is too small to be refined with the finite precision of + // floating point arithmetic. Leave it as it is (it remains a bad triangle). + if (Log.Verbose) + { + logger.Warning("The new vertex is at the circumcenter of triangle: triangle can't be refined.", + "Quality.SplitTriangle()"); + } + } + } + } + + /// + /// Returns true, if the given subsegment may be split. + /// + internal bool CanSplit(SubSegment seg) + { + return !unsplittable.Contains(seg) && + (behavior.CanSplitSegment == null || behavior.CanSplitSegment(seg)); + } + + /// + /// Check whether inserting the vertex on the edge of the given triangle creates + /// only positively oriented triangles (using exact predicates). + /// + private bool IsValidSplit(ref Otri tri, Vertex v) + { + Otri sym = default(Otri); + + var org = tri.Org(); + var dest = tri.Dest(); + var apex = tri.Apex(); + + if (predicates.CounterClockwise(org, v, apex) <= 0.0 || + predicates.CounterClockwise(v, dest, apex) <= 0.0) + { + return false; + } + + tri.Sym(ref sym); + + if (sym.tri.id != Mesh.DUMMY) + { + apex = sym.Apex(); + + if (predicates.CounterClockwise(dest, v, apex) <= 0.0 || + predicates.CounterClockwise(v, org, apex) <= 0.0) + { + return false; + } + } - throw new Exception("The new vertex is at the circumcenter of triangle."); + return true; + } + + /// + /// Throw if refinement produced flat or inverted triangles. + /// + private void CheckOrientation() + { + Otri tri = default(Otri); + + foreach (var t in mesh.triangles) + { + tri.tri = t; + tri.orient = 0; + + if (predicates.CounterClockwise(tri.Org(), tri.Dest(), tri.Apex()) <= 0.0) + { + logger.Error("Inverted triangle after mesh refinement.", "QualityMesher.CheckOrientation()"); + throw new Exception("Mesh refinement produced an invalid mesh."); } } } @@ -918,6 +991,8 @@ private void EnforceQuality(CancellationToken cancellationToken) // of Steiner points, the triangulation should be (conforming) Delaunay // and have no low-quality triangles. + CheckOrientation(); + // Might we have run out of Steiner points too soon? if (Log.Verbose && behavior.ConformingDelaunay && (badsubsegs.Count > 0) && (mesh.steinerleft == 0)) { diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index 612aeae..6910c42 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Meshing { using System; using System.Collections.Generic; + using System.Linq; using TriangleNet.Geometry; /// @@ -21,7 +22,8 @@ namespace TriangleNet.Meshing /// The noder computes all intersections in advance and splits the segments, so the mesher /// never sees crossing segments. Crossings are detected using exact predicates. /// - /// Additionally, vertices closer than a small tolerance to a segment are snapped onto the + /// Vertices closer than a small tolerance to each other are merged (the first one is kept). + /// Additionally, vertices closer than the tolerance to a segment are snapped onto the /// segment (the segment is split at the vertex, the vertex isn't moved). Otherwise, vertices /// lying almost on a segment (like rounded intersection points) produce nearly degenerate /// triangles, which can be inverted by subsequent refinement (inserting rounded segment @@ -38,31 +40,108 @@ public static class SegmentNoder /// public const double DefaultRelativeTolerance = 1.0 / (1L << 40); + /// + /// Largest relative snap tolerance used if noding doesn't converge (about 2.3e-10, + /// i.e. 1.4 mm for UTM coordinates). + /// + public const double MaxRelativeTolerance = 1.0 / (1L << 32); + + /// + /// Split all segments of the polygon at their intersections and at vertices lying + /// (almost) on the segments. + /// + /// The input polygon (won't be modified). + /// The predicates used to detect crossings. + /// Maximum number of noding iterations per tolerance. + /// The input polygon, if nothing had to be changed, otherwise a new polygon. + public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIterations = 10) + { + return Node(polygon, predicates, out _, maxIterations); + } + /// /// Split all segments of the polygon at their intersections and at vertices lying /// (almost) on the segments. /// /// The input polygon (won't be modified). /// The predicates used to detect crossings. - /// Maximum number of noding iterations. + /// The absolute snap tolerance used. + /// Maximum number of noding iterations per tolerance. /// The input polygon, if nothing had to be changed, otherwise a new polygon. - public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIterations = 50) + /// + /// If noding doesn't converge (e.g. for many nearly coincident segments, where rounded + /// intersection points keep creating new intersections), it is repeated with a larger + /// tolerance (up to ), like the snapping noder of GEOS. + /// + /// Noding doesn't converge. + public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double tolerance, int maxIterations = 10) { - if (polygon.Segments.Count == 0) + tolerance = 0.0; + + if (polygon.Segments.Count == 0 || !polygon.Points.All(IsFinite)) { + // Nothing to do, or invalid input (rejected by input validation later). return polygon; } - var segments = new List(polygon.Segments); + double scale = GetScale(polygon); + + // Limit for the number of new vertices (to detect non-convergence early). + int maxNewPoints = 50 * (polygon.Points.Count + polygon.Segments.Count) + 1000; + + for (double relative = DefaultRelativeTolerance; relative <= MaxRelativeTolerance; relative *= 16) + { + tolerance = relative * scale; + + if (TryNode(polygon, predicates, tolerance, maxIterations, maxNewPoints, out var result)) + { + return result; + } + } + + throw new InvalidOperationException("Segment noding doesn't converge (too many nearly coincident segments). " + + "Consider cleaning the input (e.g. snapping it to a grid)."); + } + + private static bool TryNode(IPolygon polygon, IPredicates predicates, double tolerance, + int maxIterations, int maxNewPoints, out IPolygon result) + { + result = polygon; + var newPoints = new List(); - double tolerance = GetTolerance(polygon); + // Merge vertices closer than the tolerance. Afterwards, all vertices have a minimum + // distance, which is required for the noding to terminate. + var vertices = new VertexIndex(tolerance); + var merged = MergeVertices(polygon.Points, vertices); + + var segments = new List(polygon.Segments.Count); - var vertices = new VertexIndex(polygon.Points, tolerance); + foreach (var s in polygon.Segments) + { + var a = s.GetVertex(0); + var b = s.GetVertex(1); + + if (!merged.TryGetValue(a, out var ma) & !merged.TryGetValue(b, out var mb)) + { + segments.Add(s); + continue; + } - bool changed = false; + ma = ma ?? a; + mb = mb ?? b; - for (int iteration = 0; iteration < maxIterations; iteration++) + // Segments shorter than the tolerance vanish. + if (!SameLocation(ma, mb)) + { + segments.Add(new Segment(ma, mb, s.Label)); + } + } + + bool changed = merged.Count > 0; + bool converged = false; + + for (int iteration = 0; iteration < maxIterations && newPoints.Count <= maxNewPoints; iteration++) { var splits = new Dictionary>(); @@ -75,6 +154,7 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte if (splits.Count == 0) { + converged = true; break; } @@ -82,27 +162,58 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte changed = true; } - if (!changed) + if (!converged) { - return polygon; + return false; } - var result = new Polygon(polygon.Points.Count + newPoints.Count) + if (changed) { - HasPointMarkers = polygon.HasPointMarkers, - HasSegmentMarkers = polygon.HasSegmentMarkers - }; + var noded = new Polygon(polygon.Points.Count + newPoints.Count) + { + HasPointMarkers = polygon.HasPointMarkers, + HasSegmentMarkers = polygon.HasSegmentMarkers + }; - result.Points.AddRange(polygon.Points); - result.Points.AddRange(newPoints); - result.Segments.AddRange(segments); - result.Holes.AddRange(polygon.Holes); - result.Regions.AddRange(polygon.Regions); + noded.Points.AddRange(polygon.Points.Where(p => !merged.ContainsKey(p))); + noded.Points.AddRange(newPoints); + noded.Segments.AddRange(segments); + noded.Holes.AddRange(polygon.Holes); + noded.Regions.AddRange(polygon.Regions); - return result; + result = noded; + } + + return true; } - private static double GetTolerance(IPolygon polygon) + /// + /// Add the vertices to the index. Vertices closer than the tolerance to a vertex + /// already in the index are mapped to that vertex. + /// + private static Dictionary MergeVertices(IEnumerable points, VertexIndex index) + { + var merged = new Dictionary(new ReferenceComparer()); + + foreach (var v in points) + { + var target = index.Find(v.x, v.y); + + if (target == null) + { + index.Add(v); + } + else if (!SameLocation(target, v)) + { + // Exact duplicates are kept (handled by the triangulator). + merged[v] = target; + } + } + + return merged; + } + + private static double GetScale(IPolygon polygon) { var bounds = new Rectangle(); double max = 0.0; @@ -113,7 +224,7 @@ private static double GetTolerance(IPolygon polygon) max = Math.Max(max, Math.Max(Math.Abs(v.x), Math.Abs(v.y))); } - return DefaultRelativeTolerance * Math.Max(max, Math.Max(bounds.Width, bounds.Height)); + return Math.Max(max, Math.Max(bounds.Width, bounds.Height)); } /// @@ -258,6 +369,14 @@ private static void AddNearbyVertices(List segments, ICollection Split(List segments, Dictionary(segments.Count + 2 * splits.Count); + // Endpoints (unordered) of all segments which are kept unchanged and of all new + // segments, used to avoid duplicate new segments. + var existing = new HashSet<(Vertex, Vertex)>(new EdgeComparer()); + + for (int i = 0; i < segments.Count; i++) + { + if (!splits.ContainsKey(i)) + { + existing.Add((segments[i].GetVertex(0), segments[i].GetVertex(1))); + } + } + + void AddNew(Vertex a, Vertex b, int label) + { + if (existing.Add((a, b))) + { + result.Add(new Segment(a, b, label)); + } + } + for (int i = 0; i < segments.Count; i++) { var s = segments[i]; @@ -299,14 +438,14 @@ private static List Split(List segments, Dictionary + { + public bool Equals(Vertex a, Vertex b) => ReferenceEquals(a, b); + + public int GetHashCode(Vertex v) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(v); + } + + /// + /// Compares edges by their endpoint locations (ignoring direction). + /// + private class EdgeComparer : IEqualityComparer<(Vertex, Vertex)> + { + public bool Equals((Vertex, Vertex) e, (Vertex, Vertex) f) + { + return (SameLocation(e.Item1, f.Item1) && SameLocation(e.Item2, f.Item2)) || + (SameLocation(e.Item1, f.Item2) && SameLocation(e.Item2, f.Item1)); + } + + public int GetHashCode((Vertex, Vertex) e) + { + // Symmetric in the two endpoints. + return Hash(e.Item1) ^ Hash(e.Item2); + } + + private static int Hash(Vertex v) + { + return v.x.GetHashCode() * 31 + v.y.GetHashCode(); + } + } + /// /// Spatial hash to find a vertex within the given tolerance. /// @@ -363,19 +543,10 @@ private class VertexIndex public List All { get; } = new List(); - public VertexIndex(IEnumerable vertices, double tolerance) + public VertexIndex(double tolerance) { this.tolerance = tolerance; this.size = tolerance > 0.0 ? tolerance : 1.0; - - // Input vertices are never merged (only exact duplicates are skipped). - foreach (var v in vertices) - { - if (!ContainsExact(v)) - { - Add(v); - } - } } public void Add(Vertex v) @@ -428,11 +599,6 @@ public Vertex Find(double x, double y) return result; } - private bool ContainsExact(Vertex v) - { - return cells.TryGetValue(Key(v.x, v.y), out var list) && list.Exists(p => SameLocation(p, v)); - } - private (long, long) Key(double x, double y) { return ((long)Math.Floor(x / size), (long)Math.Floor(y / size)); diff --git a/src/Triangle/RobustPredicates.cs b/src/Triangle/RobustPredicates.cs index 00afd4d..24dd1a8 100644 --- a/src/Triangle/RobustPredicates.cs +++ b/src/Triangle/RobustPredicates.cs @@ -431,18 +431,22 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, int eindex, findex, hindex; double enow, fnow; + // NOTE: the original C code reads one element past the end of an expansion + // after it has been consumed (the value is never used). Guard those reads + // to avoid IndexOutOfRangeException. + enow = e[0]; fnow = f[0]; eindex = findex = 0; if ((fnow > enow) == (fnow > -enow)) { Q = enow; - enow = e[++eindex]; + if (++eindex < elen) enow = e[eindex]; } else { Q = fnow; - fnow = f[++findex]; + if (++findex < flen) fnow = f[findex]; } hindex = 0; if ((eindex < elen) && (findex < flen)) @@ -450,12 +454,12 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, if ((fnow > enow) == (fnow > -enow)) { Qnew = (double)(enow + Q); bvirt = Qnew - enow; hh = Q - bvirt; - enow = e[++eindex]; + if (++eindex < elen) enow = e[eindex]; } else { Qnew = (double)(fnow + Q); bvirt = Qnew - fnow; hh = Q - bvirt; - fnow = f[++findex]; + if (++findex < flen) fnow = f[findex]; } Q = Qnew; if (hh != 0.0) @@ -473,7 +477,7 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, around = Q - avirt; hh = around + bround; - enow = e[++eindex]; + if (++eindex < elen) enow = e[eindex]; } else { @@ -484,7 +488,7 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, around = Q - avirt; hh = around + bround; - fnow = f[++findex]; + if (++findex < flen) fnow = f[findex]; } Q = Qnew; if (hh != 0.0) @@ -502,7 +506,7 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, around = Q - avirt; hh = around + bround; - enow = e[++eindex]; + if (++eindex < elen) enow = e[eindex]; Q = Qnew; if (hh != 0.0) { @@ -518,7 +522,7 @@ private int FastExpansionSumZeroElim(int elen, double[] e, int flen, double[] f, around = Q - avirt; hh = around + bround; - fnow = f[++findex]; + if (++findex < flen) fnow = f[findex]; Q = Qnew; if (hh != 0.0) { From 3e8142e509828862a035f2edaa9dc95052b97d97 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 01:32:38 +0000 Subject: [PATCH 06/50] Add SnapTolerance for data precision, fix snap cycles in noder - ConstraintOptions.SnapTolerance: minimum noder tolerance in coordinate units (e.g. 0.01 = 1 cm) merges nearly coincident lines instead of meshing slivers - SegmentNoder: don't recreate already split segments from their pieces (snap cycle with large tolerance) - Corpus harness: snap tolerance support, even tile sampling, fix coverage check for subsegments beyond segment endpoints, treat rejected non-finite input as skipped - Tests for snap tolerance and snap cycle Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 2 + src/Triangle.Tests/Corpus/CorpusCheck.cs | 17 +++-- src/Triangle.Tests/Corpus/CorpusReaders.cs | 45 +++++++------ src/Triangle.Tests/Corpus/CorpusTest.cs | 8 ++- .../Robustness/NodingAndRefinementTest.cs | 65 +++++++++++++++++++ src/Triangle/Meshing/ConstraintOptions.cs | 13 ++++ src/Triangle/Meshing/GenericMesher.cs | 2 +- src/Triangle/Meshing/SegmentNoder.cs | 40 ++++++++++-- 8 files changed, 160 insertions(+), 32 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 8499278..eb28a28 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -170,6 +170,8 @@ paralleles Vermaschen mit eigenen Prädikaten. | neu | **aCute-Verfeinerung** (seit 2022 Standard) startete die Punktsuche an einer Kante, links von der der neue Punkt nicht liegt → Punkt im falschen Dreieck, invertierte Dreiecke. Jetzt wird die Startkante per Orientierungstest gewählt. | `Meshing/QualityMesher.cs` | | neu | aCute-Ort fällt auf einen bestehenden Punkt → Rückfall auf den Umkreismittelpunkt statt Exception. | `Meshing/QualityMesher.cs` | | neu | **Präzisionsgrenze bei der Verfeinerung:** Würde das Teilen eines Segments (mit exakter Prüfung) ein flaches/invertiertes Dreieck erzeugen oder fällt der Teilungspunkt auf einen Endpunkt, wird das Teilsegment nicht geteilt und für den Rest der Verfeinerung gesperrt (statt still invertierter Dreiecke bzw. „Ran out of precision“). Zu kleine Dreiecke bleiben stehen (statt „new vertex at circumcenter“). Abschließende Orientierungsprüfung → laute Exception statt ungültigem Netz. | `Meshing/QualityMesher.cs` | +| neu | **`ConstraintOptions.SnapTolerance`** (Standard 0 = automatisch): Mindesttoleranz des Noders in Koordinateneinheiten, passend zur Datengenauigkeit (z. B. `0.01` = 1 cm). Fast deckungsgleiche Linien (Gebäude an Flurstücksgrenzen, doppelt digitalisierte Grenzen) werden zusammengeführt statt zu Slivers vermascht. Die Geometrie ändert sich dabei um höchstens die Toleranz. | `Meshing/ConstraintOptions.cs`, `Meshing/SegmentNoder.cs` | +| neu | Snap-Zyklus: Bei großer Toleranz konnte ein Punkt in ein Segment gesnappt werden, dessen Teilstück dann den ursprünglichen Endpunkt wieder einfing (Endlosschleife bis zum Iterationslimit → Exception). Bereits geteilte Segmente werden jetzt nicht erneut aus ihren Teilstücken erzeugt. | `Meshing/SegmentNoder.cs` | | neu | `FastExpansionSumZeroElim` las (wie das C-Original) ein Element hinter dem Ende einer Expansion; in C# eine `IndexOutOfRangeException`, ausgelöst durch unendliche Koordinaten. | `RobustPredicates.cs` | **Ergebnis (Fuzzing, jeder Fall in eigenem Prozess):** diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index dea2339..0225e74 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -15,7 +15,7 @@ public static class CorpusCheck /// /// Returns "OK ..." or a description of the failure. /// - public static string Run(CorpusCase c, double minAngle, int steinerPoints) + public static string Run(CorpusCase c, double minAngle, int steinerPoints, double snapTolerance = 0.0) { var poly = new Polygon(); var map = new Dictionary<(double, double), Vertex>(); @@ -70,7 +70,11 @@ Vertex V((double, double) p) try { var quality = minAngle > 0 ? new QualityOptions { MinimumAngle = minAngle, SteinerPoints = steinerPoints } : null; - mesh = (Mesh)poly.Triangulate(new ConstraintOptions(), quality); + mesh = (Mesh)poly.Triangulate(new ConstraintOptions { SnapTolerance = snapTolerance }, quality); + } + catch (ArgumentException) when (poly.Points.Any(p => !IsFinite(p.X) || !IsFinite(p.Y))) + { + return "SKIPPED (non-finite input rejected)"; } catch (Exception e) { @@ -102,7 +106,7 @@ Vertex V((double, double) p) } // Every input segment must be covered by mesh subsegments (within the snap tolerance). - SegmentNoder.Node(poly, predicates, out double noderTolerance); + SegmentNoder.Node(poly, predicates, out double noderTolerance, minTolerance: snapTolerance); double tol = Math.Max(scale * 1e-11, 4 * noderTolerance); var subsegs = mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(); @@ -130,7 +134,10 @@ private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, double ta = ((a.X - p0.X) * dx + (a.Y - p0.Y) * dy) / len; double tb = ((b.X - p0.X) * dx + (b.Y - p0.Y) * dy) / len; - intervals.Add((Math.Max(0, Math.Min(ta, tb)), Math.Min(len, Math.Max(ta, tb)))); + double s = Math.Max(0, Math.Min(ta, tb)), e = Math.Min(len, Math.Max(ta, tb)); + + // Subsegments beyond an endpoint (within tolerance) don't cover anything. + if (e > s) intervals.Add((s, e)); } intervals.Sort(); @@ -147,6 +154,8 @@ private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, return Math.Abs(covered - len) <= tol * 10 + len * 1e-9; } + private static bool IsFinite(double x) => !double.IsNaN(x) && !double.IsInfinity(x); + private static double DistanceToSegment(Point v, Point p, Point q) { double dx = q.X - p.X, dy = q.Y - p.Y, l2 = dx * dx + dy * dy; diff --git a/src/Triangle.Tests/Corpus/CorpusReaders.cs b/src/Triangle.Tests/Corpus/CorpusReaders.cs index 40796af..7e7521b 100644 --- a/src/Triangle.Tests/Corpus/CorpusReaders.cs +++ b/src/Triangle.Tests/Corpus/CorpusReaders.cs @@ -145,38 +145,45 @@ private static void AddPolygon(List> rings, JsonEleme /// /// Split parcel rings into square tiles. Each tile contains all rings whose bounding box /// intersects the tile (rings are not clipped, so neighboring parcels and their shared, - /// possibly mismatched boundaries are complete). + /// possibly mismatched boundaries are complete). If there are more than maxTiles + /// non-empty tiles, tiles are sampled evenly. /// public static IEnumerable Tiles(string name, List> rings, double tileSize, int maxTiles) { - var boxes = rings.Select(r => (r, r.Min(p => p.X), r.Min(p => p.Y), r.Max(p => p.X), r.Max(p => p.Y))).ToList(); + var tiles = new Dictionary<(long, long), List>>(); - double left = boxes.Min(b => b.Item2), bottom = boxes.Min(b => b.Item3); - double right = boxes.Max(b => b.Item4), top = boxes.Max(b => b.Item5); - - int count = 0; - - for (double x = left; x < right && count < maxTiles; x += tileSize) + foreach (var r in rings) { - for (double y = bottom; y < top && count < maxTiles; y += tileSize) - { - var c = new CorpusCase { Name = $"{name} tile {x:F0}/{y:F0}" }; + long i0 = (long)Math.Floor(r.Min(p => p.X) / tileSize), i1 = (long)Math.Floor(r.Max(p => p.X) / tileSize); + long j0 = (long)Math.Floor(r.Min(p => p.Y) / tileSize), j1 = (long)Math.Floor(r.Max(p => p.Y) / tileSize); - foreach (var b in boxes) + for (long i = i0; i <= i1; i++) + { + for (long j = j0; j <= j1; j++) { - if (b.Item2 <= x + tileSize && b.Item4 >= x && b.Item3 <= y + tileSize && b.Item5 >= y) + if (!tiles.TryGetValue((i, j), out var list)) { - c.Lines.Add(b.r); + list = new List>(); + tiles.Add((i, j), list); } - } - if (c.Lines.Count > 0) - { - count++; - yield return c; + list.Add(r); } } } + + var keys = tiles.Keys.OrderBy(k => k.Item1).ThenBy(k => k.Item2).ToList(); + double step = Math.Max(1.0, (double)keys.Count / maxTiles); + + for (double k = 0; k < keys.Count; k += step) + { + var key = keys[(int)k]; + var c = new CorpusCase { Name = $"{name} tile {key.Item1 * tileSize:F0}/{key.Item2 * tileSize:F0}" }; + + c.Lines.AddRange(tiles[key]); + + yield return c; + } } } } diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index da424b1..49bfc26 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -25,6 +25,7 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_NRW_DGM DGM1 xyz(.gz) tile from https://www.opengeodata.nrw.de (dgm1_xyz) /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) + /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) /// /// Run: dotnet test --filter TestCategory=Corpus /// @@ -110,7 +111,9 @@ public static int RunCase(string[] args) var c = CorpusCase.Load(args[1]); double minAngle = double.Parse(args[2], CultureInfo.InvariantCulture); - Console.WriteLine("RESULT " + CorpusCheck.Run(c, minAngle, SteinerPoints)); + double snap = args.Length > 3 ? double.Parse(args[3], CultureInfo.InvariantCulture) : SnapTolerance(); + + Console.WriteLine("RESULT " + CorpusCheck.Run(c, minAngle, SteinerPoints, snap)); return 0; } @@ -166,6 +169,9 @@ private static void RunCases(IEnumerable cases) Assert.That(failures, Is.Empty, string.Join("\n", failures.Take(50).Select(f => $"{f.Name} (min angle {f.MinAngle}): {f.Result}"))); } + private static double SnapTolerance() => + double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_SNAP"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 0.0; + private static double TileSize() => double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_TILE"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 200.0; diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs index d1569e4..b3546f5 100644 --- a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -204,5 +204,70 @@ public void NeedleTriangles() MeshAssert.IsValid(mesh); } + private static Polygon ParcelWithBuilding(double gap) + { + // A parcel and a building whose wall runs along the parcel boundary at a distance + // of 'gap' (typical for cadastral data: separately digitized, nearly coincident lines). + var poly = new Polygon(); + + poly.Add(new Contour(new[] { new Vertex(370000, 5710000), new Vertex(370030, 5710000), new Vertex(370030, 5710020), new Vertex(370000, 5710020) })); + poly.Add(new Contour(new[] { new Vertex(370005, 5710000 + gap), new Vertex(370015, 5710000 + gap), new Vertex(370015, 5710008), new Vertex(370005, 5710008) })); + + return poly; + } + + [Test] + public void SnapToleranceRemovesSlivers() + { + // Building wall 5 mm inside the parcel boundary: with the automatic tolerance the + // sliver is kept (and needs many triangles), with 1 cm it is merged. + var quality = new QualityOptions { MinimumAngle = 20, SteinerPoints = 50000 }; + + var automatic = MeshAssert.Terminates(() => ParcelWithBuilding(0.005).Triangulate(new ConstraintOptions(), quality), LongTimeout); + var snapped = MeshAssert.Terminates(() => ParcelWithBuilding(0.005).Triangulate(new ConstraintOptions { SnapTolerance = 0.01 }, quality), LongTimeout); + + MeshAssert.IsValid(automatic); + MeshAssert.IsValid(snapped); + MeshAssert.HasArea(automatic, 600, 1e-9); + + // Snapping routes the parcel boundary through the building corners, i.e. geometry + // changes by at most the tolerance (area change <= perimeter * tolerance). + MeshAssert.HasArea(snapped, 600, 100 * 0.01 / 600); + + Assert.That(snapped.Triangles.Count, Is.LessThan(automatic.Triangles.Count / 4)); + } + + [Test] + public void SnapToleranceKeepsLargerGaps() + { + // A gap larger than the snap tolerance is kept. + var mesh = ParcelWithBuilding(0.05).Triangulate(new ConstraintOptions { SnapTolerance = 0.01 }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count(v => v.Y == 5710000 + 0.05), Is.EqualTo(2)); + } + [Test] + [Description("Fixed: three vertices just over the snap tolerance apart (each within the tolerance of the segment between the other two) made snapping go back and forth forever.")] + public void SnapCycle() + { + // Configuration found in ALKIS data (Herne) with a snap tolerance of 1 cm: + // C is within 1 cm of A-B, and after splitting A-B at C, B is within 1 cm of A-C. + var a = new Vertex(0, 0); + var b = new Vertex(0.010, 0.019); + var c = new Vertex(0, 0.020); + + var poly = new Polygon(); + poly.Add(TestData.Square(-1, -1, 2)); + poly.Add(a); + poly.Add(b); + poly.Add(c); + poly.Add(new Segment(a, b)); + poly.Add(new Segment(a, c)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SnapTolerance = 0.01 }), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 4, 1e-9); + } } } diff --git a/src/Triangle/Meshing/ConstraintOptions.cs b/src/Triangle/Meshing/ConstraintOptions.cs index 695cf72..25f4cc4 100644 --- a/src/Triangle/Meshing/ConstraintOptions.cs +++ b/src/Triangle/Meshing/ConstraintOptions.cs @@ -47,6 +47,19 @@ public class ConstraintOptions /// public bool ResolveIntersections { get; set; } = true; + /// + /// Gets or sets the minimum absolute snap tolerance used to resolve intersections + /// (default = 0, automatic: about 1e-12 times the coordinate magnitude). + /// + /// + /// Vertices closer than the tolerance are merged, vertices closer than the tolerance to + /// a segment are inserted into the segment. Set this to the precision of the input data + /// (e.g. 0.01 for coordinates in meters with centimeter accuracy) to remove slivers + /// between nearly coincident boundaries, which otherwise lead to huge numbers of + /// triangles when refining with a minimum angle. + /// + public double SnapTolerance { get; set; } + /// /// Gets or sets a filter deciding whether a segment may be split during mesh /// refinement (in addition to ). If null (default), diff --git a/src/Triangle/Meshing/GenericMesher.cs b/src/Triangle/Meshing/GenericMesher.cs index 2fc5f83..5d35050 100644 --- a/src/Triangle/Meshing/GenericMesher.cs +++ b/src/Triangle/Meshing/GenericMesher.cs @@ -117,7 +117,7 @@ public IMesh Triangulate(IPolygon polygon, ConstraintOptions options, QualityOpt if (options?.ResolveIntersections ?? true) { // Split intersecting segments in advance. - polygon = SegmentNoder.Node(polygon, config.Predicates()); + polygon = SegmentNoder.Node(polygon, config.Predicates(), minTolerance: options?.SnapTolerance ?? 0.0); } var mesh = (Mesh)triangulator.Triangulate(polygon.Points, config); diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index 6910c42..f6b3d67 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -53,10 +53,11 @@ public static class SegmentNoder /// The input polygon (won't be modified). /// The predicates used to detect crossings. /// Maximum number of noding iterations per tolerance. + /// Minimum absolute snap tolerance (0 = automatic). /// The input polygon, if nothing had to be changed, otherwise a new polygon. - public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIterations = 10) + public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIterations = 10, double minTolerance = 0.0) { - return Node(polygon, predicates, out _, maxIterations); + return Node(polygon, predicates, out _, maxIterations, minTolerance); } /// @@ -67,6 +68,9 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte /// The predicates used to detect crossings. /// The absolute snap tolerance used. /// Maximum number of noding iterations per tolerance. + /// Minimum absolute snap tolerance (0 = automatic). Use this to + /// merge features below the precision of the data, e.g. 0.01 for coordinates in meters + /// which are only accurate to a centimeter. /// The input polygon, if nothing had to be changed, otherwise a new polygon. /// /// If noding doesn't converge (e.g. for many nearly coincident segments, where rounded @@ -74,7 +78,7 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte /// tolerance (up to ), like the snapping noder of GEOS. /// /// Noding doesn't converge. - public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double tolerance, int maxIterations = 10) + public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double tolerance, int maxIterations = 10, double minTolerance = 0.0) { tolerance = 0.0; @@ -89,9 +93,21 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double // Limit for the number of new vertices (to detect non-convergence early). int maxNewPoints = 50 * (polygon.Points.Count + polygon.Segments.Count) + 1000; + var tolerances = new List(); + for (double relative = DefaultRelativeTolerance; relative <= MaxRelativeTolerance; relative *= 16) { - tolerance = relative * scale; + double t = Math.Max(relative * scale, minTolerance); + + if (tolerances.Count == 0 || t > tolerances[tolerances.Count - 1]) + { + tolerances.Add(t); + } + } + + foreach (var t in tolerances) + { + tolerance = t; if (TryNode(polygon, predicates, tolerance, maxIterations, maxNewPoints, out var result)) { @@ -141,6 +157,10 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol bool changed = merged.Count > 0; bool converged = false; + // Segments which have been split. Snapping must not create them again: for vertices + // with distances close to the tolerance, snapping could otherwise go back and forth. + var retired = new HashSet<(Vertex, Vertex)>(new EdgeComparer()); + for (int iteration = 0; iteration < maxIterations && newPoints.Count <= maxNewPoints; iteration++) { var splits = new Dictionary>(); @@ -149,7 +169,7 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol if (splits.Count == 0) { - AddNearbyVertices(segments, vertices.All, tolerance, splits); + AddNearbyVertices(segments, vertices.All, tolerance, retired, splits); } if (splits.Count == 0) @@ -158,6 +178,11 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol break; } + foreach (var i in splits.Keys) + { + retired.Add((segments[i].GetVertex(0), segments[i].GetVertex(1))); + } + segments = Split(segments, splits); changed = true; } @@ -342,7 +367,7 @@ private static void AddIntersections(List segments, List<(int, int)> c /// tolerance to the segment. /// private static void AddNearbyVertices(List segments, ICollection vertices, - double tolerance, Dictionary> splits) + double tolerance, HashSet<(Vertex, Vertex)> retired, Dictionary> splits) { var grid = new VertexGrid(vertices); @@ -381,7 +406,8 @@ private static void AddNearbyVertices(List segments, ICollection 0.0 && t < 1.0) + if (distance <= tolerance && t > 0.0 && t < 1.0 && + !retired.Contains((a, v)) && !retired.Contains((v, b))) { AddSplit(splits, i, t, v); } From 78e69c351a4f57f59ee6a2a320430e368f5d8a3e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 02:11:59 +0000 Subject: [PATCH 07/50] Fix aCute refinement: dropped bad triangles, area constraints, relocation cycles - If the aCute location doesn't destroy the bad triangle (it may lie outside the circumcircle), insert the circumcenter instead. Before, the triangle was dropped from the queue: maximum area violated, many triangles below the minimum angle (ALKIS tile at 30 degrees: 618 instead of 9 bad triangles). - Accept an aCute location only strictly inside the circumcircle and not on a vertex of the triangle. - Relocate each vertex at most once. Region area constraints made aCute move the same vertex back and forth (upstream: exception, then cycling until the Steiner point limit with a coarse result). - Characterization suite: scenario catalog (point sets, polygons, real ALKIS tiles x algorithms, quality, conforming, segment splitting, locked segments, area constraints, refine, smooth), invariant tests (consistency, orientation, constrained/conforming Delaunay, area, segments, locked segments, angle and area guarantees) and golden fingerprints of the exact output. - Corpus harness: configurable angles, timing and quality statistics. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Data/herne_371800_5710600.txt | 34 ++ .../Data/herne_373600_5709000.txt | 262 +++++++++++ .../Data/herne_381000_5710400.txt | 13 + .../Characterization/GoldenMeshTest.cs | 68 +++ .../Characterization/InvariantTest.cs | 40 ++ .../Characterization/MeshCases.cs | 428 ++++++++++++++++++ .../Characterization/MeshInvariants.cs | 229 ++++++++++ .../Characterization/golden.txt | 77 ++++ src/Triangle.Tests/Corpus/CorpusCheck.cs | 25 +- src/Triangle.Tests/Corpus/CorpusTest.cs | 25 +- .../Robustness/AcuteRefinementTest.cs | 85 ++++ src/Triangle.Tests/Triangle.Tests.csproj | 4 + src/Triangle/Meshing/QualityMesher.cs | 69 ++- src/Triangle/NewLocation.cs | 29 +- 14 files changed, 1379 insertions(+), 9 deletions(-) create mode 100644 src/Triangle.Tests/Characterization/Data/herne_371800_5710600.txt create mode 100644 src/Triangle.Tests/Characterization/Data/herne_373600_5709000.txt create mode 100644 src/Triangle.Tests/Characterization/Data/herne_381000_5710400.txt create mode 100644 src/Triangle.Tests/Characterization/GoldenMeshTest.cs create mode 100644 src/Triangle.Tests/Characterization/InvariantTest.cs create mode 100644 src/Triangle.Tests/Characterization/MeshCases.cs create mode 100644 src/Triangle.Tests/Characterization/MeshInvariants.cs create mode 100644 src/Triangle.Tests/Characterization/golden.txt create mode 100644 src/Triangle.Tests/Robustness/AcuteRefinementTest.cs diff --git a/src/Triangle.Tests/Characterization/Data/herne_371800_5710600.txt b/src/Triangle.Tests/Characterization/Data/herne_371800_5710600.txt new file mode 100644 index 0000000..336a884 --- /dev/null +++ b/src/Triangle.Tests/Characterization/Data/herne_371800_5710600.txt @@ -0,0 +1,34 @@ +# tile 371800.0/5710600.0 +L 371970.983,5710613.975 371971.712,5710611.484 371984.24,5710568.647 371984.801,5710566.728 371999.51,5710570.993 371998.944,5710572.912 371985.803,5710618.331 371970.983,5710613.975 +L 371946.04,5710606.657 371946.736,5710604.24 371950.273,5710591.966 371950.548,5710592.008 371946.282,5710606.728 371946.04,5710606.657 +L 371792.574,5710605.649 371800.724,5710577.762 371800.801,5710577.499 371802.348,5710577.966 371794.178,5710606.133 371792.574,5710605.649 +L 371932.04,5710599.985 371945.073,5710557.213 371945.105,5710557.108 371959.429,5710561.39 371950.548,5710592.008 371950.273,5710591.966 371946.736,5710604.24 371946.292,5710604.111 371932.04,5710599.985 +L 371804.031,5710622.289 371805.364,5710617.667 371808.844,5710605.602 371811.734,5710595.582 371813.018,5710591.13 371815.702,5710581.914 371827.657,5710585.448 371830.454,5710586.275 371828.933,5710591.521 371818.824,5710626.397 371815.042,5710625.347 371804.031,5710622.289 +L 371772.143,5710599.421 371778.783,5710585.172 371779.601,5710583.856 371780.568,5710582.778 371781.908,5710581.984 371783.235,5710581.421 371785.186,5710580.847 371786.531,5710580.29 371787.299,5710579.925 371787.473,5710579.842 371788.382,5710579.33 371790.89,5710577.785 371791.778,5710577.314 371793.283,5710576.9 371794.776,5710576.88 371800.724,5710577.762 371792.574,5710605.649 371776.969,5710600.891 371772.143,5710599.421 +L 371984.801,5710566.728 371988.322,5710554.69 372010.846,5710561.19 372011.076,5710561.257 372007.434,5710573.203 372014.553,5710575.267 372013.961,5710577.272 372001.345,5710620.004 372000.642,5710622.525 371985.803,5710618.331 371998.944,5710572.912 371999.51,5710570.993 371984.801,5710566.728 +L 371955.161,5710606.697 371958.778,5710594.316 371958.839,5710594.334 371959.772,5710591.578 371959.905,5710591.616 371967.917,5710563.86 371971.995,5710549.978 371988.322,5710554.69 371984.801,5710566.728 371984.24,5710568.647 371971.712,5710611.484 371955.161,5710606.697 +L 371790.576,5710618.552 371794.178,5710606.133 371802.348,5710577.966 371803.689,5710578.362 371815.702,5710581.914 371813.018,5710591.13 371811.734,5710595.582 371808.844,5710605.602 371805.364,5710617.667 371804.031,5710622.289 371790.576,5710618.552 +L 371946.282,5710606.728 371950.548,5710592.008 371959.429,5710561.39 371967.917,5710563.86 371959.905,5710591.616 371959.772,5710591.578 371958.839,5710594.334 371958.778,5710594.316 371955.161,5710606.697 371954.452,5710609.126 371946.282,5710606.728 +L 371711.318,5710800.312 371711.5,5710799.624 371714.092,5710789.985 371716.844,5710780.379 371719.626,5710770.771 371752.552,5710658.928 371755.266,5710649.921 371758.4,5710640.426 371761.655,5710630.967 371765.033,5710621.562 371768.595,5710612.229 371790.576,5710618.552 371804.031,5710622.289 371815.042,5710625.347 371818.824,5710626.397 371828.933,5710591.521 371830.454,5710586.275 371873.224,5710598.726 371880.647,5710600.88 371944.749,5710619.352 371945.508,5710619.537 371950.13,5710620.664 371956.309,5710622.172 371964.888,5710624.264 372000.473,5710634.782 372007.32,5710637.558 372009.998,5710638.903 372016.035,5710641.933 372026.637,5710647.257 372037.532,5710651.873 372041.899,5710653.723 372049.333,5710658.796 372053.862,5710668.702 372038.042,5710721.514 372034.393,5710732.137 372026.705,5710748.498 372014.408,5710771.801 372002.772,5710793.176 371991.529,5710812.424 371980.321,5710829.321 371958.036,5710861.831 371946.08,5710879.418 371939.51,5710878.779 371929.355,5710894.631 371918.655,5710914.328 371917.894,5710916.029 371904.768,5710909.76 371897.609,5710871.357 371893.313,5710847.19 371888.755,5710821.522 371885.354,5710802.759 371845.347,5710801.387 371824.533,5710803.29 371734.442,5710800.929 371733.346,5710800.899 371713.523,5710800.371 371711.318,5710800.312 +L 371954.452,5710609.126 371955.161,5710606.697 371971.712,5710611.484 371970.983,5710613.975 371954.568,5710609.159 371954.452,5710609.126 +L 371588.669,5710503.449 371591.359,5710504.193 371606.667,5710508.59 371620.827,5710512.657 371635.503,5710516.871 371649.917,5710521.041 371664.774,5710525.315 371679.309,5710529.497 371682.708,5710529.487 371701.823,5710535.125 371716.419,5710539.419 371733.476,5710544.441 371734.044,5710542.437 371734.301,5710542.511 371737.505,5710543.444 371748.936,5710546.774 371748.902,5710546.889 371748.351,5710548.766 371764.954,5710553.697 371765.794,5710553.946 371769.414,5710555.021 371777.041,5710557.372 371785.389,5710559.811 371786.109,5710557.25 371787.707,5710551.567 371787.555,5710552.327 371787.502,5710553.1 371787.549,5710553.874 371787.695,5710554.635 371787.939,5710555.371 371788.275,5710556.069 371788.689,5710556.719 371789.183,5710557.311 371789.75,5710557.835 371790.379,5710558.281 371791.061,5710558.642 371791.784,5710558.913 371817.268,5710566.382 371829.83,5710570.065 371844.229,5710574.284 371843.632,5710576.837 371869.631,5710584.438 371885.699,5710589.099 371886.421,5710586.634 371898.854,5710590.272 371932.04,5710599.985 371946.292,5710604.111 371946.736,5710604.24 371946.04,5710606.657 371946.282,5710606.728 371954.452,5710609.126 371954.568,5710609.159 371970.983,5710613.975 371985.803,5710618.331 372000.642,5710622.525 372014.77,5710626.681 372015.528,5710626.905 372025.749,5710629.889 372036.637,5710633.16 372037.44,5710630.465 372037.457,5710630.409 372055.291,5710635.628 372060.161,5710637.049 372063.023,5710637.886 372062.184,5710640.641 372069.686,5710642.853 372087.102,5710647.99 372113.472,5710655.683 372126.91,5710659.604 372141.264,5710663.704 372142.097,5710660.849 372157.232,5710665.316 372157.424,5710665.372 372167.878,5710668.427 372170.296,5710669.133 372170.787,5710669.277 372170.019,5710671.917 372185.599,5710676.268 372224.969,5710688.308 372227.651,5710689.129 372228.719,5710689.455 372228.534,5710690.016 372226.523,5710696.128 372226.079,5710697.473 372225.887,5710698.055 372222.286,5710696.987 372211.339,5710693.773 372208.427,5710692.919 372187.913,5710686.897 372187.663,5710686.825 372187.392,5710686.745 372172.776,5710682.467 372172.566,5710682.406 372161.996,5710679.361 372154.454,5710677.156 372151.375,5710676.256 372150.463,5710679.363 372150.243,5710679.299 372136.363,5710675.217 372136.393,5710675.111 372126.097,5710672.102 372117.24,5710669.631 372095.351,5710663.946 372087.396,5710662.596 372083.185,5710661.96 372079.48,5710663.394 372041.899,5710653.723 372037.532,5710651.873 372026.637,5710647.257 372016.035,5710641.933 372009.998,5710638.903 372007.32,5710637.558 372000.473,5710634.782 371964.888,5710624.264 371956.309,5710622.172 371950.13,5710620.664 371945.508,5710619.537 371944.749,5710619.352 371880.647,5710600.88 371873.224,5710598.726 371830.454,5710586.275 371831.271,5710583.456 371831.41,5710582.977 371816.587,5710578.801 371803.2,5710575.029 371802.348,5710577.966 371800.801,5710577.499 371795.718,5710576.019 371795.837,5710575.616 371794.35,5710575.179 371794.231,5710575.582 371789.012,5710574.048 371789.082,5710573.809 371787.742,5710573.411 371787.671,5710573.651 371778.863,5710571.036 371775.483,5710570.033 371778.467,5710568.164 371762.117,5710563.223 371764.099,5710566.803 371760.829,5710565.85 371760.797,5710565.801 371760.728,5710565.824 371750.441,5710562.86 371750.472,5710562.752 371751.239,5710560.078 371739.488,5710556.682 371730.518,5710554.09 371729.721,5710556.742 371725.15,5710555.418 371723.278,5710554.875 371718.294,5710553.431 371718.054,5710553.361 371718.848,5710550.716 371708.149,5710547.623 371707.363,5710550.305 371707.114,5710550.233 371702.854,5710549.002 371700.369,5710548.284 371696.109,5710547.053 371695.86,5710546.981 371695.61,5710546.909 371689.84,5710545.256 371689.581,5710545.182 371690.371,5710542.485 371677.194,5710538.676 371676.985,5710539.389 371676.39,5710541.428 371673.41,5710540.513 371666.132,5710538.361 371626.233,5710526.919 371618.923,5710524.814 371619.726,5710522.105 371608.046,5710518.676 371592.011,5710513.968 371588.669,5710503.449 +L 371892.111,5710979.102 371893.268,5710979.074 371894.418,5710978.939 371895.551,5710978.698 371896.656,5710978.353 371897.724,5710977.907 371898.747,5710977.365 371899.715,5710976.73 371900.62,5710976.008 371901.454,5710975.205 371902.21,5710974.328 371902.882,5710973.385 371903.463,5710972.384 371903.949,5710971.333 371904.336,5710970.241 371904.619,5710969.119 371904.798,5710967.975 371904.88,5710967.302 371907.113,5710956.557 371909.974,5710945.494 371912.212,5710936.58 371913.589,5710936.732 371915.291,5710921.848 371917.894,5710916.029 371918.655,5710914.328 371929.355,5710894.631 371939.51,5710878.779 371946.08,5710879.418 371958.036,5710861.831 371980.321,5710829.321 371991.529,5710812.424 372002.772,5710793.176 372014.408,5710771.801 372026.705,5710748.498 372034.393,5710732.137 372038.042,5710721.514 372053.862,5710668.702 372049.333,5710658.796 372041.899,5710653.723 372079.48,5710663.394 372076.515,5710665.289 372074.129,5710667.899 372072.669,5710671.331 372067.361,5710688.829 372062.741,5710703.574 372058.913,5710714.696 372053.797,5710727.861 372051.678,5710733.55 372050.236,5710738.91 372050.178,5710740.923 372050.439,5710742.413 372051.19,5710743.892 372041.125,5710757.046 372038.933,5710756.393 372034.479,5710771.302 372034.17,5710771.23 372018.555,5710823.434 372018.872,5710823.54 372016.32,5710832.081 372012.794,5710843.893 372012.675,5710844.292 372019.088,5710845.977 372027.627,5710848.222 372034.139,5710849.933 372031.205,5710861.108 372028.851,5710870.073 372024.694,5710868.714 372017.472,5710893.696 372014.028,5710892.786 372011.505,5710892.119 372005.895,5710890.636 372000.624,5710889.243 371999.411,5710888.923 371996.509,5710888.16 371993.048,5710899.584 371991.324,5710905.272 371983.591,5710903.246 371982.673,5710903.002 371959.25,5710896.78 371954.499,5710905.828 371950.714,5710913.703 371950.129,5710914.92 371945.993,5710924.123 371942.118,5710933.826 371939.199,5710941.963 371938.534,5710943.816 371936.724,5710951.674 371937.574,5710955.61 371939.538,5710959.122 371942.459,5710961.834 371946.161,5710963.343 371949.51,5710963.536 371917.956,5710980.654 371917.36,5710977.559 371912.227,5710980.051 371908.497,5710980.854 371903.374,5710980.406 371892.111,5710979.102 +L 371795.658,5710619.943 371797.053,5710614.871 371799.511,5710615.558 371802.347,5710616.384 371801.494,5710618.953 371804.375,5710619.794 371803.645,5710622.18 371795.658,5710619.943 +L 371999.889,5710607.673 372001.455,5710607.274 372000.896,5710605.106 372002.672,5710599.299 372007.091,5710600.608 372004.35,5710609.739 372004.134,5710609.687 372004.144,5710609.647 372000.033,5710608.445 372000.236,5710607.783 371999.889,5710607.673 +L 371995.321,5710595.71 371996.195,5710592.61 372008.377,5710596.19 372007.091,5710600.608 372002.672,5710599.299 372002.994,5710597.863 371995.321,5710595.71 +L 371799.511,5710615.558 371802.917,5710603.873 371808.718,5710605.566 371805.166,5710617.205 371802.347,5710616.384 371799.511,5710615.558 +L 371805.194,5710617.623 371808.844,5710605.602 371814.61,5710607.257 371811.007,5710619.143 371808.47,5710618.48 371805.364,5710617.667 371805.194,5710617.623 +L 371801.494,5710618.953 371802.347,5710616.384 371805.166,5710617.205 371804.375,5710619.794 371801.494,5710618.953 +L 371991.915,5710652.037 371993.407,5710652.065 371996.091,5710654.324 371993.629,5710655.527 371991.915,5710652.037 +L 371987.155,5710615.828 371990.344,5710604.798 371992.831,5710605.546 371989.816,5710616.607 371987.155,5710615.828 +L 371968.386,5710610.503 371972.002,5710598.162 371974.741,5710598.949 371971.084,5710611.302 371968.386,5710610.503 +L 371936.775,5710664.572 371937.825,5710649.346 371944.993,5710645.892 371945.744,5710646.371 371945.569,5710648.469 371945.511,5710649.261 371951.001,5710652.797 371952.891,5710651.999 371953.06,5710648.771 371973.999,5710638.515 371975.038,5710639.217 371975.888,5710639.792 371976.149,5710639.969 371976.697,5710640.338 371977.777,5710641.069 371977.834,5710640.987 371984.14,5710645.234 371984.422,5710645.423 371986.272,5710646.669 371983.494,5710647.975 371983.462,5710649.397 371983.445,5710650.448 371987.682,5710648.361 371990.54,5710649.253 371991.915,5710652.037 371993.407,5710652.065 371996.091,5710654.324 371993.629,5710655.527 371995.723,5710659.771 371994.811,5710662.4 371993.692,5710665.628 371989.208,5710667.785 371988.88,5710667.108 371987.418,5710667.819 371987.91,5710668.108 371981.434,5710671.237 371981.016,5710678.387 371974.977,5710681.38 371974.196,5710681.767 371967.281,5710685.195 371961.321,5710681.179 371954.809,5710684.296 371948.14,5710679.838 371948.659,5710672.656 371936.775,5710664.572 +L 371973.012,5710607.047 371975.285,5710599.105 371975.891,5710597.083 371978.197,5710597.769 371977.782,5710599.387 371977.591,5710599.334 371975.198,5710607.667 371973.012,5710607.047 +L 371973.999,5710638.515 371983.289,5710633.967 371989.967,5710638.451 371989.403,5710646.399 371983.462,5710649.397 371983.494,5710647.975 371986.272,5710646.669 371977.834,5710640.987 371977.777,5710641.069 371973.999,5710638.515 +L 371930.122,5710599.427 371931.368,5710595.146 371933.696,5710587.141 371941.036,5710589.242 371949.877,5710591.774 371946.292,5710604.111 371932.04,5710599.985 371930.122,5710599.427 +L 371808.844,5710605.602 371811.734,5710595.582 371814.867,5710596.505 371814.269,5710598.697 371821.452,5710600.792 371819.297,5710608.603 371814.61,5710607.257 371808.844,5710605.602 +L 371804.031,5710622.289 371805.364,5710617.667 371808.47,5710618.48 371807.239,5710623.18 371804.031,5710622.289 +L 371946.486,5710604.167 371949.999,5710591.925 371950.273,5710591.966 371950.548,5710592.008 371956.642,5710593.779 371956.983,5710592.636 371955.666,5710591.32 371956.978,5710586.862 371960.214,5710587.786 371960.251,5710587.661 371960.81,5710587.82 371959.702,5710591.558 371958.778,5710594.316 371958.694,5710594.292 371954.967,5710606.642 371946.984,5710604.314 371946.736,5710604.24 371946.486,5710604.167 +L 371986.579,5710615.661 371989.769,5710604.625 371990.344,5710604.798 371992.831,5710605.546 371993.256,5710604.098 371998.362,5710605.596 371997.907,5710607.047 371999.889,5710607.673 372000.236,5710607.783 372000.033,5710608.445 372004.144,5710609.647 372004.134,5710609.687 372001.186,5710619.953 371989.816,5710616.607 371987.155,5710615.828 371986.579,5710615.661 +L 371973.926,5710612.1 371975.198,5710607.667 371977.591,5710599.334 371977.782,5710599.387 371980.727,5710600.212 371981.168,5710598.637 371985.39,5710599.825 371984.949,5710601.395 371989.328,5710602.622 371985.687,5710615.417 371973.926,5710612.1 +L 371954.967,5710606.642 371958.694,5710594.292 371958.778,5710594.316 371959.702,5710591.558 371959.772,5710591.578 371959.905,5710591.616 371962.239,5710592.326 371961.178,5710595.031 371972.002,5710598.162 371974.741,5710598.949 371975.285,5710599.105 371973.012,5710607.047 371971.712,5710611.484 371971.084,5710611.302 371968.386,5710610.503 371954.967,5710606.642 diff --git a/src/Triangle.Tests/Characterization/Data/herne_373600_5709000.txt b/src/Triangle.Tests/Characterization/Data/herne_373600_5709000.txt new file mode 100644 index 0000000..dee8636 --- /dev/null +++ b/src/Triangle.Tests/Characterization/Data/herne_373600_5709000.txt @@ -0,0 +1,262 @@ +# tile 373600/5709000 +L 373657.743,5709051.521 373658.738,5709050.621 373664.01,5709049.364 373663.184,5709049.604 373662.384,5709049.922 373661.618,5709050.315 373660.893,5709050.778 373660.215,5709051.309 373659.591,5709051.901 373659.026,5709052.55 373657.743,5709051.521 +L 373662.121,5709116.041 373662.174,5709116.673 373662.326,5709117.289 373662.571,5709117.873 373662.905,5709118.413 373663.319,5709118.893 373667.126,5709122.641 373664.116,5709122.694 373662.13,5709120.873 373662.121,5709116.041 +L 373662.098,5709073.767 373662.109,5709069.864 373662.099,5709064.396 373668.099,5709064.388 373679.935,5709064.372 373683.085,5709064.368 373683.081,5709065.343 373683.095,5709073.748 373683.085,5709073.749 373679.653,5709073.749 373665.277,5709073.763 373662.098,5709073.767 +L 373586.972,5709136.319 373609.303,5709136.184 373609.396,5709175.2 373601.395,5709175.264 373588.144,5709175.375 373587.139,5709142.199 373586.972,5709136.319 +L 373621.84,5709068.429 373621.863,5709055.061 373651.834,5709055.046 373651.852,5709056.956 373651.842,5709068.414 373621.84,5709068.429 +L 373692.008,5709135.707 373695.71,5709135.685 373714.762,5709135.528 373714.671,5709136.239 373711.629,5709159.881 373711.415,5709161.99 373709.271,5709183.183 373705.93,5709177.286 373699.029,5709175.207 373692.31,5709176.343 373692.008,5709135.707 +L 373715.909,5709092.918 373723.355,5709092.924 373722.048,5709105.455 373722.054,5709122.457 373715.939,5709122.467 373715.909,5709092.918 +L 373462.462,5709124.443 373468.063,5709124.393 373476.993,5709124.308 373476.992,5709124.028 373487.49,5709124.011 373501.337,5709123.949 373504.337,5709123.936 373504.345,5709127.012 373521.569,5709126.645 373521.548,5709122.856 373561.222,5709122.876 373565.504,5709122.882 373582.754,5709122.897 373599.716,5709122.924 373600.917,5709122.925 373613.156,5709122.936 373621.732,5709122.946 373627.665,5709122.913 373633.789,5709122.903 373639.904,5709122.892 373646.028,5709122.883 373649.871,5709122.875 373651.873,5709122.874 373652.123,5709122.864 373664.116,5709122.694 373667.126,5709122.641 373673.227,5709122.552 373679.329,5709122.462 373679.669,5709122.458 373685.473,5709122.452 373694.581,5709122.45 373698.814,5709122.446 373702.678,5709122.468 373703.689,5709122.467 373709.814,5709122.467 373715.939,5709122.467 373722.054,5709122.457 373733.202,5709122.472 373733.162,5709122.954 373761.445,5709123.019 373760.337,5709127.017 373763.714,5709126.878 373761.151,5709135.16 373727.518,5709134.025 373715.011,5709133.595 373714.762,5709135.528 373695.71,5709135.685 373692.008,5709135.707 373666.802,5709135.846 373653.785,5709135.927 373637.806,5709136.021 373634.805,5709136.032 373609.303,5709136.184 373586.972,5709136.319 373579.003,5709136.349 373565.97,5709136.421 373552.857,5709136.497 373540.194,5709136.573 373526.771,5709136.652 373516.719,5709136.702 373513.749,5709136.724 373513.674,5709134.906 373502.238,5709135.123 373465.23,5709135.836 373463.968,5709130.629 373463.28,5709127.791 373462.462,5709124.443 +L 373676.744,5709218.215 373690.791,5709195.185 373691.988,5709194.42 373707.601,5709197.89 373705.98,5709212.162 373698.177,5709223.92 373676.744,5709218.215 +L 373760.337,5709127.017 373761.445,5709123.019 373762.421,5709119.507 373771.12,5709088.196 373777.279,5709064.096 373782.448,5709039.776 373787.227,5709015.421 373790.386,5709015.867 373788.912,5709023.411 373787.206,5709032.147 373780.455,5709063.453 373772.736,5709092.183 373763.714,5709126.878 373760.337,5709127.017 +L 373790.013,5709060.522 373792.266,5709051.88 373796.247,5709036.612 373798.563,5709024.37 373799.619,5709024.478 373801.292,5709024.649 373797.741,5709042.629 373793.689,5709061.432 373791.949,5709061.002 373790.013,5709060.522 +L 373788.781,5709127.15 373788.808,5709127.057 373793.306,5709128.349 373793.569,5709127.203 373794.649,5709127.21 373794.247,5709128.646 373788.781,5709127.15 +L 373777.17,5709123.719 373779.802,5709114.459 373782.634,5709115.261 373782.73,5709115.288 373780.138,5709124.568 373780.52,5709124.677 373780.463,5709124.874 373780.071,5709124.767 373779.948,5709124.733 373780.002,5709124.54 373777.17,5709123.719 +L 373780.405,5709125.078 373780.463,5709124.874 373788.781,5709127.15 373788.693,5709127.459 373780.405,5709125.078 +L 373753.185,5709209.098 373754.277,5709205.226 373755.804,5709199.815 373759.874,5709200.3 373766.629,5709201.841 373768.551,5709203.951 373788.147,5709203.754 373787.214,5709208.748 373759.171,5709209.036 373753.185,5709209.098 +L 373797.741,5709042.629 373801.292,5709024.649 373836.748,5709028.288 373836.896,5709039.881 373837.025,5709050.004 373797.741,5709042.629 +L 373649.871,5709122.875 373651.871,5709120.872 373651.873,5709122.874 373649.871,5709122.875 +L 373779.552,5709114.389 373789.186,5709079.821 373806.519,5709084.475 373813.786,5709086.426 373827.461,5709086.351 373827.618,5709099.654 373816.132,5709099.632 373804.916,5709099.611 373804.757,5709116.05 373803.254,5709116.045 373803.171,5709127.263 373794.649,5709127.21 373793.569,5709127.203 373793.306,5709128.349 373788.808,5709127.057 373788.781,5709127.15 373780.463,5709124.874 373780.52,5709124.677 373780.138,5709124.568 373782.73,5709115.288 373782.634,5709115.261 373779.802,5709114.459 373779.552,5709114.389 +L 373789.186,5709079.821 373791.485,5709071.383 373793.414,5709063.982 373794.002,5709061.511 373793.689,5709061.432 373797.741,5709042.629 373837.025,5709050.004 373837.142,5709060.13 373837.282,5709072.235 373837.39,5709080.273 373837.472,5709086.296 373827.461,5709086.351 373813.786,5709086.426 373806.519,5709084.475 373789.186,5709079.821 +L 373755.606,5709199.791 373757.233,5709193.989 373761.683,5709194.562 373767.238,5709195.07 373772.325,5709191.617 373816.654,5709190.996 373821.035,5709190.935 373829.932,5709190.635 373843.63,5709190.174 373857.137,5709189.691 373871.101,5709189.192 373871.499,5709189.177 373879.547,5709188.233 373883.678,5709186.918 373888.374,5709185.422 373898.591,5709181.102 373899.437,5709180.744 373902.275,5709179.544 373925.171,5709169.632 373933.913,5709165.848 373936.371,5709164.784 373943.857,5709161.713 373944.56,5709161.419 373953.936,5709157.511 373954.434,5709157.304 373981.575,5709145.657 373986.231,5709143.679 374000.938,5709137.432 374011.1,5709133.115 374021.092,5709128.852 374034.849,5709123.01 374041.681,5709120.109 374043.287,5709119.445 374051.554,5709116.023 374059.681,5709112.657 374068.087,5709109.177 374076.298,5709105.777 374086.727,5709101.459 374095.647,5709097.766 374100.361,5709095.814 374129.796,5709083.641 374131.051,5709083.122 374138.456,5709080.06 374150.64,5709075.019 374177.065,5709064.063 374182.138,5709061.996 374182.558,5709061.824 374182.932,5709070.983 374183.061,5709074.12 374183.443,5709083.582 374180.687,5709084.691 374140.835,5709100.626 374139.428,5709101.122 374132.009,5709104.104 374109.061,5709113.329 374088.021,5709121.819 374048.663,5709137.703 374047.143,5709138.334 373998.983,5709157.686 373988.08,5709162.018 373954.94,5709174.832 373954.358,5709175.062 373944.915,5709178.792 373944.34,5709179.015 373929.696,5709184.651 373900.751,5709195.79 373893.514,5709198.657 373888.785,5709200.337 373886.152,5709201.272 373883.003,5709201.872 373878.158,5709202.794 373871.666,5709203.451 373859.948,5709203.444 373843.75,5709203.435 373826.017,5709203.425 373821.05,5709203.422 373814.068,5709203.492 373788.147,5709203.754 373768.551,5709203.951 373766.629,5709201.841 373759.874,5709200.3 373755.804,5709199.815 373755.606,5709199.791 +L 373725.273,5709165.583 373725.987,5709162.715 373752.076,5709167.866 373750.834,5709172.211 373747.243,5709171.28 373743.788,5709170.384 373728.271,5709166.361 373725.273,5709165.583 +L 373703.116,5709092.621 373703.437,5709092.628 373703.429,5709092.929 373703.119,5709092.931 373703.116,5709092.621 +L 373677.345,5709018.456 373678.726,5709018.219 373679.582,5709018.084 373679.6,5709045.653 373677.371,5709046.195 373677.345,5709018.456 +L 373683.103,5709092.949 373683.108,5709092.328 373699.581,5709092.576 373699.576,5709092.936 373694.562,5709092.941 373685.444,5709092.944 373683.103,5709092.949 +L 373679.31,5709092.944 373679.65,5709092.95 373679.669,5709122.458 373679.329,5709122.462 373679.31,5709092.944 +L 373651.834,5709055.046 373651.848,5709052.724 373651.836,5709022.844 373653.873,5709022.491 373653.886,5709048.487 373657.743,5709051.521 373653.105,5709055.784 373651.834,5709055.046 +L 373652.105,5709096.288 373654.496,5709096.287 373654.509,5709115.332 373653.978,5709115.332 373653.978,5709116.344 373654.51,5709116.344 373654.51,5709116.965 373657.044,5709116.927 373656.889,5709117.488 373656.654,5709118.02 373656.344,5709118.513 373655.966,5709118.955 373652.123,5709122.864 373652.119,5709117.143 373652.111,5709105.631 373652.105,5709096.288 +L 373701.278,5709044.195 373701.456,5709041.205 373712.754,5709041.853 373724.473,5709042.533 373724.884,5709037.492 373725.616,5709028.514 373726.91,5709012.642 373729.943,5709012.407 373729.134,5709022.369 373728.842,5709025.756 373727.662,5709040.235 373727.386,5709043.623 373727.215,5709045.703 373701.278,5709044.195 +L 373659.851,5709063.362 373662.099,5709060.359 373662.099,5709064.396 373662.109,5709069.864 373659.852,5709065.363 373659.851,5709063.362 +L 373702.678,5709122.468 373703.429,5709092.929 373703.679,5709092.928 373703.689,5709122.467 373702.678,5709122.468 +L 373653.978,5709115.332 373654.509,5709115.332 373654.496,5709096.287 373657.108,5709096.284 373657.122,5709116.145 373657.087,5709116.668 373657.044,5709116.927 373654.51,5709116.965 373654.51,5709116.344 373653.978,5709116.344 373653.978,5709115.332 +L 373613.156,5709122.936 373613.164,5709119.733 373613.169,5709110.082 373613.214,5709087.242 373613.226,5709086.041 373621.813,5709086.09 373621.799,5709093.315 373621.771,5709105.679 373621.745,5709117.174 373621.739,5709119.751 373621.735,5709121.391 373621.732,5709122.946 373613.156,5709122.936 +L 373707.601,5709197.89 373708.595,5709189.409 373740.038,5709196.837 373737.848,5709204.528 373707.601,5709197.89 +L 373685.444,5709092.944 373694.562,5709092.941 373694.571,5709107.92 373694.574,5709111.15 373694.578,5709116.97 373694.581,5709122.45 373685.473,5709122.452 373685.444,5709092.944 +L 373700.085,5709065.588 373708.637,5709065.717 373708.638,5709067.93 373708.64,5709070.921 373703.096,5709070.928 373700.094,5709070.931 373700.085,5709065.588 +L 373568.444,5709085.781 373570.843,5709078.599 373580.832,5709078.691 373580.527,5709073.671 373586.006,5709073.305 373594.248,5709072.785 373599.068,5709072.488 373621.845,5709070.99 373621.825,5709075.644 373621.821,5709082.858 373621.813,5709086.09 373613.226,5709086.041 373599.853,5709085.967 373582.878,5709085.861 373568.444,5709085.781 +L 373698.814,5709122.446 373699.576,5709092.936 373703.119,5709092.931 373703.429,5709092.929 373702.678,5709122.468 373698.814,5709122.446 +L 373621.825,5709075.644 373621.845,5709070.99 373621.84,5709068.429 373651.842,5709068.414 373651.847,5709075.617 373621.825,5709075.644 +L 373683.081,5709065.343 373700.085,5709065.588 373700.094,5709070.931 373703.096,5709070.928 373703.116,5709092.621 373699.581,5709092.576 373683.108,5709092.328 373683.095,5709073.748 373683.081,5709065.343 +L 373689.091,5709016.643 373698.371,5709015.233 373700.853,5709014.971 373700.884,5709041.169 373699.028,5709041.065 373689.115,5709043.402 373689.112,5709039.612 373689.101,5709027.268 373689.091,5709016.643 +L 373722.048,5709105.455 373723.355,5709092.924 373724.313,5709081.166 373736.877,5709082.212 373733.202,5709122.472 373722.054,5709122.457 373722.048,5709105.455 +L 373673.205,5709092.954 373679.31,5709092.944 373679.329,5709122.462 373673.227,5709122.552 373673.205,5709092.954 +L 373651.851,5709093.287 373651.852,5709082.831 373657.097,5709082.826 373657.105,5709093.282 373651.851,5709093.287 +L 373679.6,5709045.653 373689.115,5709043.402 373699.028,5709041.065 373700.884,5709041.169 373701.456,5709041.205 373701.278,5709044.195 373700.393,5709059.221 373696.152,5709060.245 373688.727,5709061.991 373683.075,5709058.139 373683.073,5709055.167 373682.492,5709054.522 373681.851,5709053.937 373681.157,5709053.416 373680.416,5709052.964 373679.635,5709052.586 373679.6,5709045.653 +L 373637.441,5709155.157 373637.807,5709148.644 373637.806,5709136.021 373653.785,5709135.927 373653.807,5709140.432 373653.839,5709148.671 373653.883,5709155.177 373650.781,5709155.174 373645.406,5709155.163 373637.441,5709155.157 +L 373651.851,5709093.287 373657.105,5709093.282 373657.108,5709096.284 373654.496,5709096.287 373652.105,5709096.288 373652.111,5709105.631 373652.119,5709117.143 373652.123,5709122.864 373651.873,5709122.874 373651.871,5709120.872 373651.851,5709093.287 +L 373725.987,5709162.715 373726.3,5709161.455 373727.769,5709155.544 373727.906,5709154.992 373727.641,5709145.614 373727.553,5709136.2 373727.518,5709134.025 373761.151,5709135.16 373760.53,5709137.398 373752.076,5709167.866 373725.987,5709162.715 +L 373700.393,5709059.221 373701.278,5709044.195 373727.215,5709045.703 373726.202,5709058.113 373725.926,5709061.491 373725.562,5709065.965 373708.637,5709065.717 373708.634,5709064.927 373704.641,5709064.931 373700.393,5709059.221 +L 373652.123,5709122.864 373655.966,5709118.955 373656.344,5709118.513 373656.654,5709118.02 373656.889,5709117.488 373657.044,5709116.927 373657.087,5709116.668 373657.122,5709116.145 373657.108,5709096.284 373657.105,5709093.282 373657.097,5709082.826 373657.1,5709075.612 373657.096,5709068.408 373657.084,5709058.132 373657.125,5709057.273 373657.249,5709056.422 373657.452,5709055.587 373657.735,5709054.774 373658.094,5709053.993 373658.525,5709053.249 373659.026,5709052.55 373659.591,5709051.901 373660.215,5709051.309 373660.893,5709050.778 373661.618,5709050.315 373662.384,5709049.922 373663.184,5709049.604 373664.01,5709049.364 373677.371,5709046.195 373679.6,5709045.653 373679.635,5709052.586 373678.741,5709052.263 373677.817,5709052.037 373676.875,5709051.909 373675.925,5709051.881 373674.977,5709051.953 373674.042,5709052.125 373667.331,5709053.721 373666.602,5709053.936 373665.903,5709054.232 373665.24,5709054.604 373664.623,5709055.048 373664.06,5709055.557 373663.557,5709056.127 373663.12,5709056.749 373662.756,5709057.416 373662.469,5709058.119 373662.262,5709058.85 373662.138,5709059.6 373662.099,5709060.359 373659.851,5709063.362 373659.852,5709065.363 373662.109,5709069.864 373662.098,5709073.767 373662.106,5709092.968 373662.121,5709116.041 373662.13,5709120.873 373664.116,5709122.694 373652.123,5709122.864 +L 373633.768,5709093.306 373634.012,5709093.306 373639.882,5709093.295 373639.904,5709122.892 373633.789,5709122.903 373633.768,5709093.306 +L 373711.415,5709161.99 373711.629,5709159.881 373725.987,5709162.715 373725.273,5709165.583 373711.415,5709161.99 +L 373653.785,5709135.927 373666.802,5709135.846 373667.054,5709174.733 373654.02,5709174.843 373653.883,5709155.177 373653.839,5709148.671 373653.807,5709140.432 373653.785,5709135.927 +L 373739.142,5709054.851 373742.706,5709011.724 373748.298,5709011.526 373755.476,5709011.271 373769.092,5709012.863 373787.227,5709015.421 373782.448,5709039.776 373777.279,5709064.096 373739.142,5709054.851 +L 373651.842,5709068.414 373651.852,5709056.956 373653.105,5709055.784 373657.084,5709058.132 373657.096,5709068.408 373651.842,5709068.414 +L 373694.562,5709092.941 373699.576,5709092.936 373698.814,5709122.446 373694.581,5709122.45 373694.578,5709116.97 373694.574,5709111.15 373694.571,5709107.92 373694.562,5709092.941 +L 373759.907,5709003.402 373763.432,5708985.051 373778.38,5708986.973 373788.493,5708988.273 373792.458,5708988.782 373788.92,5709006.784 373759.907,5709003.402 +L 373621.821,5709082.858 373621.825,5709075.644 373651.847,5709075.617 373651.852,5709082.831 373621.821,5709082.858 +L 373712.705,5709013.805 373716.732,5709013.409 373726.91,5709012.642 373725.616,5709028.514 373724.884,5709037.492 373724.473,5709042.533 373712.754,5709041.853 373712.747,5709037.638 373712.725,5709025.277 373712.705,5709013.805 +L 373709.793,5709092.928 373715.909,5709092.918 373715.939,5709122.467 373709.814,5709122.467 373709.793,5709092.928 +L 373627.643,5709093.306 373633.768,5709093.306 373633.789,5709122.903 373627.665,5709122.913 373627.661,5709117.168 373627.643,5709093.306 +L 373679.643,5709092.28 373679.653,5709073.749 373683.085,5709073.749 373683.095,5709073.748 373683.108,5709092.328 373679.643,5709092.28 +L 373683.075,5709058.139 373688.727,5709061.991 373696.152,5709060.245 373700.092,5709065.517 373700.085,5709065.588 373683.081,5709065.343 373683.085,5709064.368 373683.075,5709058.139 +L 373634.987,5709174.995 373637.073,5709161.869 373637.441,5709155.157 373645.406,5709155.163 373650.781,5709155.174 373653.883,5709155.177 373654.02,5709174.843 373640.287,5709174.951 373634.987,5709174.995 +L 373622.448,5709209.044 373625.561,5709202.994 373628.32,5709196.619 373630.743,5709190.087 373662.034,5709200.997 373650.298,5709222.693 373642.63,5709218.936 373622.448,5709209.044 +L 373621.863,5709055.061 373621.936,5709027.501 373651.836,5709022.844 373651.848,5709052.724 373651.834,5709055.046 373621.863,5709055.061 +L 373724.313,5709081.166 373724.451,5709079.503 373724.728,5709076.116 373725.401,5709067.903 373725.562,5709065.965 373725.926,5709061.491 373726.202,5709058.113 373727.215,5709045.703 373727.386,5709043.623 373727.662,5709040.235 373728.842,5709025.756 373729.134,5709022.369 373729.943,5709012.407 373736.319,5709011.956 373742.706,5709011.724 373739.142,5709054.851 373736.877,5709082.212 373724.313,5709081.166 +L 373609.303,5709136.184 373634.805,5709136.032 373634.805,5709148.647 373634.088,5709161.54 373633.197,5709167.175 373631.957,5709175.018 373609.396,5709175.2 373609.303,5709136.184 +L 373711.629,5709159.881 373714.671,5709136.239 373714.762,5709135.528 373715.011,5709133.595 373727.518,5709134.025 373727.553,5709136.2 373727.641,5709145.614 373727.906,5709154.992 373727.769,5709155.544 373726.3,5709161.455 373725.987,5709162.715 373711.629,5709159.881 +L 373651.847,5709075.617 373657.1,5709075.612 373657.097,5709082.826 373651.852,5709082.831 373651.847,5709075.617 +L 373696.152,5709060.245 373700.393,5709059.221 373704.641,5709064.931 373708.634,5709064.927 373708.637,5709065.717 373700.085,5709065.588 373700.092,5709065.517 373696.152,5709060.245 +L 373733.162,5709122.954 373733.202,5709122.472 373736.877,5709082.212 373739.142,5709054.851 373777.279,5709064.096 373771.12,5709088.196 373762.421,5709119.507 373761.445,5709123.019 373733.162,5709122.954 +L 373703.679,5709092.928 373709.793,5709092.928 373709.814,5709122.467 373703.689,5709122.467 373703.679,5709092.928 +L 373600.917,5709122.925 373601.043,5709087.169 373613.214,5709087.242 373613.169,5709110.082 373613.164,5709119.733 373613.156,5709122.936 373600.917,5709122.925 +L 373705.98,5709212.162 373707.601,5709197.89 373737.848,5709204.528 373733.554,5709219.611 373705.98,5709212.162 +L 373621.799,5709093.315 373621.813,5709086.09 373621.821,5709082.858 373651.852,5709082.831 373651.851,5709093.287 373651.813,5709093.288 373646.006,5709093.296 373643.033,5709093.296 373642.674,5709093.296 373639.882,5709093.295 373634.012,5709093.306 373633.768,5709093.306 373627.643,5709093.306 373621.799,5709093.315 +L 373662.098,5709073.767 373665.277,5709073.763 373679.653,5709073.749 373679.643,5709092.28 373679.65,5709092.95 373679.31,5709092.944 373673.205,5709092.954 373671.205,5709092.955 373668.225,5709092.96 373665.236,5709092.964 373662.106,5709092.968 373662.098,5709073.767 +L 373621.732,5709122.946 373621.735,5709121.391 373621.739,5709119.751 373621.745,5709117.174 373621.771,5709105.679 373621.799,5709093.315 373627.643,5709093.306 373627.661,5709117.168 373627.665,5709122.913 373621.732,5709122.946 +L 373666.802,5709135.846 373692.008,5709135.707 373692.31,5709176.343 373687.945,5709177.052 373678.357,5709180.997 373671.24,5709186.844 373667.113,5709191.615 373667.054,5709174.733 373666.802,5709135.846 +L 373636.358,5709248.26 373636.645,5709247.765 373637.518,5709246.257 373637.864,5709245.653 373638.331,5709244.858 373650.298,5709222.693 373662.034,5709200.997 373667.113,5709191.615 373671.24,5709186.844 373678.357,5709180.997 373687.945,5709177.052 373692.31,5709176.343 373699.029,5709175.207 373705.93,5709177.286 373709.271,5709183.183 373741.796,5709190.541 373745.364,5709191.348 373743.515,5709197.658 373740.038,5709196.837 373708.595,5709189.409 373701.913,5709192.109 373692.595,5709192.143 373685.59,5709195.111 373681.074,5709199.969 373677.388,5709204.476 373671.141,5709216.723 373662.759,5709233.157 373652.365,5709253.533 373649.295,5709252.523 373645.386,5709251.235 373643.096,5709250.48 373636.358,5709248.26 +L 373671.141,5709216.723 373677.388,5709204.476 373681.074,5709199.969 373685.59,5709195.111 373692.595,5709192.143 373701.913,5709192.109 373708.595,5709189.409 373707.601,5709197.89 373691.988,5709194.42 373690.791,5709195.185 373676.744,5709218.215 373671.141,5709216.723 +L 373737.848,5709204.528 373740.038,5709196.837 373743.515,5709197.658 373741.366,5709205.361 373737.848,5709204.528 +L 373601.395,5709175.264 373609.396,5709175.2 373631.957,5709175.018 373630.194,5709181.803 373627.89,5709189.091 373625.505,5709195.542 373622.818,5709201.745 373619.837,5709207.599 373615.691,5709214.552 373605.048,5709215.544 373604.552,5709210.484 373603.768,5709202.367 373601.395,5709175.264 +L 373757.233,5709193.989 373770.542,5709146.152 373773.691,5709147.064 373773.719,5709146.969 373773.813,5709146.642 373776.377,5709137.796 373789.523,5709141.55 373793.418,5709141.712 373792.702,5709152.124 373794.033,5709152.441 373792.555,5709173.004 373804.632,5709173.659 373816.819,5709174.32 373816.654,5709190.996 373772.325,5709191.617 373767.238,5709195.07 373761.683,5709194.562 373757.233,5709193.989 +L 373792.555,5709173.004 373794.033,5709152.441 373792.702,5709152.124 373793.418,5709141.712 373797.313,5709141.873 373797.54,5709138.743 373806.255,5709139.223 373805.175,5709153.617 373804.632,5709173.659 373792.555,5709173.004 +L 373709.271,5709183.183 373711.415,5709161.99 373725.273,5709165.583 373728.271,5709166.361 373743.788,5709170.384 373747.243,5709171.28 373750.834,5709172.211 373745.364,5709191.348 373741.796,5709190.541 373709.271,5709183.183 +L 373788.92,5709006.784 373792.458,5708988.782 373795.023,5708989.112 373793.795,5708998.415 373792.107,5709007.156 373788.92,5709006.784 +L 373751.596,5709199.313 373753.202,5709193.47 373756.137,5709193.848 373757.233,5709193.989 373755.606,5709199.791 373754.484,5709199.658 373751.596,5709199.313 +L 373599.716,5709122.924 373599.853,5709085.967 373613.226,5709086.041 373613.214,5709087.242 373601.043,5709087.169 373600.917,5709122.925 373599.716,5709122.924 +L 373653.105,5709055.784 373657.743,5709051.521 373659.026,5709052.55 373658.525,5709053.249 373658.094,5709053.993 373657.735,5709054.774 373657.452,5709055.587 373657.249,5709056.422 373657.125,5709057.273 373657.084,5709058.132 373653.105,5709055.784 +L 373679.643,5709092.28 373683.108,5709092.328 373683.103,5709092.949 373683.093,5709092.949 373679.65,5709092.95 373679.643,5709092.28 +L 373699.576,5709092.936 373699.581,5709092.576 373703.116,5709092.621 373703.119,5709092.931 373699.576,5709092.936 +L 373703.429,5709092.929 373703.437,5709092.628 373723.355,5709092.924 373715.909,5709092.918 373709.793,5709092.928 373703.679,5709092.928 373703.429,5709092.929 +L 373651.834,5709055.046 373653.105,5709055.784 373651.852,5709056.956 373651.834,5709055.046 +L 373520.803,5708983.825 373532.916,5708984.925 373537.576,5708985.371 373538.322,5708984.948 373542.692,5708982.487 373554.929,5708983.418 373572.223,5708984.2 373584.3,5708984.437 373589.613,5708983.939 373603.938,5708985.499 373621.878,5708987.452 373636.676,5708989.063 373651.943,5708990.725 373671.496,5708993.267 373673.89,5708993.578 373679.5,5708994.308 373743.597,5709001.498 373712.199,5708999.002 373712.538,5709004.353 373679.82,5709009.488 373621.959,5709010.937 373613.289,5709010.832 373603.114,5709009.898 373593.657,5709008.434 373583.162,5709006.011 373566.775,5709000.978 373548.288,5709004.026 373520.978,5709009.087 373520.803,5708983.825 +L 373703.096,5709070.928 373708.64,5709070.921 373708.638,5709067.93 373719.08,5709067.913 373725.391,5709067.903 373725.401,5709067.903 373724.728,5709076.116 373724.451,5709079.503 373724.313,5709081.166 373723.355,5709092.924 373703.437,5709092.628 373703.116,5709092.621 373703.096,5709070.928 +L 373579.724,5709061.127 373589.403,5709060.468 373609.916,5709059.072 373610.076,5709029.579 373621.936,5709027.501 373621.863,5709055.061 373621.84,5709068.429 373621.845,5709070.99 373599.068,5709072.488 373594.248,5709072.785 373586.006,5709073.305 373580.527,5709073.671 373579.724,5709061.127 +L 373679.582,5709018.084 373689.091,5709016.643 373689.101,5709027.268 373689.112,5709039.612 373689.115,5709043.402 373679.6,5709045.653 373679.582,5709018.084 +L 373679.5,5708994.308 373679.821,5708989.191 373682.963,5708939.037 373685.368,5708900.721 373695.635,5708893.093 373709.11,5708893.729 373706.952,5708940.101 373731.785,5708941.21 373748.768,5708941.968 373748.818,5708941.97 373759.376,5708942.445 373758.918,5708953.305 373754.114,5708983.791 373751.189,5709002.389 373743.597,5709001.498 373679.5,5708994.308 +L 373700.853,5709014.971 373712.705,5709013.805 373712.725,5709025.277 373712.747,5709037.638 373712.754,5709041.853 373701.456,5709041.205 373700.884,5709041.169 373700.853,5709014.971 +L 373589.403,5709060.468 373589.457,5709033.164 373610.076,5709029.579 373609.916,5709059.072 373589.403,5709060.468 +L 373708.637,5709065.717 373725.562,5709065.965 373725.401,5709067.903 373725.391,5709067.903 373719.08,5709067.913 373708.638,5709067.93 373708.637,5709065.717 +L 373679.65,5709092.95 373683.093,5709092.949 373683.103,5709092.949 373685.444,5709092.944 373685.473,5709122.452 373679.669,5709122.458 373679.65,5709092.95 +L 373662.099,5709060.359 373662.138,5709059.6 373662.262,5709058.85 373662.469,5709058.119 373662.756,5709057.416 373663.12,5709056.749 373663.557,5709056.127 373664.06,5709055.557 373664.623,5709055.048 373665.24,5709054.604 373665.903,5709054.232 373666.602,5709053.936 373667.331,5709053.721 373674.042,5709052.125 373674.977,5709051.953 373675.925,5709051.881 373676.875,5709051.909 373677.817,5709052.037 373678.741,5709052.263 373679.635,5709052.586 373680.416,5709052.964 373681.157,5709053.416 373681.851,5709053.937 373682.492,5709054.522 373683.073,5709055.167 373683.075,5709058.139 373683.085,5709064.368 373679.935,5709064.372 373668.099,5709064.388 373662.099,5709064.396 373662.099,5709060.359 +L 373751.189,5709002.389 373754.114,5708983.791 373763.432,5708985.051 373759.907,5709003.402 373751.189,5709002.389 +L 373630.743,5709190.087 373633.077,5709182.608 373634.987,5709174.995 373640.287,5709174.951 373654.02,5709174.843 373667.054,5709174.733 373667.113,5709191.615 373662.034,5709200.997 373630.743,5709190.087 +L 373651.842,5709068.414 373657.096,5709068.408 373657.1,5709075.612 373651.847,5709075.617 373651.842,5709068.414 +L 373653.873,5709022.491 373677.345,5709018.456 373677.371,5709046.195 373664.01,5709049.364 373658.738,5709050.621 373657.743,5709051.521 373653.886,5709048.487 373653.873,5709022.491 +L 373662.106,5709092.968 373665.236,5709092.964 373668.225,5709092.96 373671.205,5709092.955 373673.205,5709092.954 373673.227,5709122.552 373667.126,5709122.641 373663.319,5709118.893 373662.905,5709118.413 373662.571,5709117.873 373662.326,5709117.289 373662.174,5709116.673 373662.121,5709116.041 373662.106,5709092.968 +L 373639.882,5709093.295 373642.674,5709093.296 373643.033,5709093.296 373646.006,5709093.296 373646.008,5709096.036 373646.008,5709096.261 373646.015,5709105.64 373646.028,5709122.883 373639.904,5709122.892 373639.882,5709093.295 +L 373442.699,5709021.65 373444.157,5709021.416 373451.157,5709020.293 373487.219,5709014.503 373487.12,5708994.522 373487.046,5708980.745 373503.859,5708982.277 373507.883,5708982.644 373520.803,5708983.825 373520.978,5709009.087 373548.288,5709004.026 373566.775,5709000.978 373583.162,5709006.011 373593.657,5709008.434 373603.114,5709009.898 373613.289,5709010.832 373621.959,5709010.937 373679.82,5709009.488 373712.538,5709004.353 373712.199,5708999.002 373743.597,5709001.498 373751.189,5709002.389 373759.907,5709003.402 373788.92,5709006.784 373787.727,5709012.869 373787.227,5709015.421 373769.092,5709012.863 373755.476,5709011.271 373748.298,5709011.526 373742.706,5709011.724 373736.319,5709011.956 373729.943,5709012.407 373726.91,5709012.642 373716.732,5709013.409 373712.705,5709013.805 373700.853,5709014.971 373698.371,5709015.233 373689.091,5709016.643 373679.582,5709018.084 373678.726,5709018.219 373677.345,5709018.456 373653.873,5709022.491 373651.836,5709022.844 373621.936,5709027.501 373610.076,5709029.579 373589.457,5709033.164 373578.035,5709035.149 373569.754,5709036.589 373555.635,5709039.043 373533.136,5709042.644 373521.092,5709044.571 373504.127,5709047.219 373487.33,5709049.842 373485.688,5709050.098 373450.395,5709055.608 373449.768,5709052.84 373448.99,5709049.406 373448.759,5709048.387 373442.699,5709021.65 +L 373646.006,5709093.296 373651.813,5709093.288 373651.851,5709093.287 373651.871,5709120.872 373649.871,5709122.875 373646.028,5709122.883 373646.015,5709105.64 373646.008,5709096.261 373646.008,5709096.036 373646.006,5709093.296 +L 373587.045,5709175.388 373588.144,5709175.375 373601.395,5709175.264 373603.768,5709202.367 373604.552,5709210.484 373605.048,5709215.544 373592.881,5709216.991 373587.045,5709175.388 +L 373784.308,5708840.957 373820.917,5708831.703 373823.424,5708831.07 373841.344,5708826.5 373859.208,5708821.989 373865.007,5708820.525 373868.602,5708834.093 373871.098,5708841.358 373873.951,5708848.367 373877.306,5708855.194 373881.113,5708861.837 373882.053,5708863.125 373885.418,5708868.191 373890.089,5708874.258 373895.137,5708879.977 373900.524,5708885.396 373905.27,5708889.178 373910.363,5708892.572 373914.333,5708894.795 373915.596,5708895.596 373918.196,5708896.759 373921.629,5708897.165 373924.191,5708895.345 373931.077,5708902.662 373927.581,5708910.458 373924.425,5708917.439 373920.969,5708930.993 373918.668,5708943.855 373917.294,5708954.647 373916.338,5708965.719 373916.271,5708967.704 373916.204,5708969.689 373915.494,5708980.653 373915.036,5708991.654 373914.818,5709002.712 373914.672,5709013.704 373914.851,5709019.422 373915.329,5709034.745 373915.442,5709038.35 373915.908,5709049.375 373916.895,5709060.123 373917.215,5709061.812 373923.598,5709095.53 373938.474,5709092.819 373943.682,5709091.871 373944.056,5709091.803 373945.747,5709095.152 373947.616,5709098.854 373938.918,5709105.456 373928.118,5709113.652 373920.066,5709119.764 373914.245,5709087.749 373911.936,5709075.047 373909.061,5709061.406 373908.642,5709055.383 373908.091,5709047.453 373907.575,5709035.808 373907.5,5709033.611 373906.942,5709017.299 373906.795,5709012.939 373906.899,5709001.868 373907.179,5708990.835 373907.684,5708979.781 373908.303,5708968.86 373909.059,5708957.875 373910.441,5708946.998 373912.112,5708936.128 373914.114,5708925.307 373917.853,5708911.152 373917.51,5708907.614 373915.093,5708905.324 373911.687,5708903.802 373905.862,5708900.486 373900.076,5708896.665 373896.163,5708893.478 373894.589,5708892.197 373888.581,5708886.258 373887.864,5708885.43 373883.167,5708880.005 373880.352,5708876.422 373878.165,5708873.475 373873.548,5708866.563 373869.482,5708859.475 373867.798,5708856.071 373867.29,5708854.983 373860.191,5708839.765 373858.16,5708836.738 373855.201,5708834.651 373851.763,5708833.71 373848.07,5708834.056 373843.14,5708835.315 373835.74,5708837.204 373822.634,5708840.549 373819.341,5708841.391 373802.99,5708845.564 373798.382,5708846.741 373789.01,5708849.133 373787.707,5708849.466 373784.308,5708840.957 +L 373798.563,5709024.37 373801.753,5709007.819 373802.778,5709002.239 373803.912,5709002.386 373805.445,5709002.585 373806.001,5709002.657 373860.227,5709009.691 373860.255,5709007.842 373862.18,5709008.049 373906.795,5709012.939 373906.942,5709017.299 373907.5,5709033.611 373907.575,5709035.808 373874.224,5709032.33 373868.609,5709031.745 373852.629,5709030.011 373836.748,5709028.288 373801.292,5709024.649 373799.619,5709024.478 373798.563,5709024.37 +L 373482.903,5709256.537 373484.464,5709256.561 373494.789,5709256.72 373494.641,5709257.42 373494.555,5709258.131 373494.534,5709258.847 373494.593,5709259.699 373494.742,5709260.54 373494.98,5709261.361 373495.304,5709262.151 373495.71,5709262.903 373496.194,5709263.607 373496.459,5709263.94 373498.748,5709266.815 373507.033,5709277.21 373515.215,5709287.471 373519.181,5709292.446 373523.333,5709297.653 373531.45,5709307.845 373536.761,5709314.51 373544.218,5709315.054 373544.975,5709314.332 373563.807,5709296.387 373570.439,5709290.082 373571.999,5709288.533 373573.496,5709286.922 373574.926,5709285.252 373576.287,5709283.526 373577.577,5709281.746 373578.794,5709279.915 373579.936,5709278.036 373581.074,5709275.973 373582.121,5709273.863 373583.076,5709271.71 373583.936,5709269.517 373584.7,5709267.289 373585.367,5709265.029 373585.935,5709262.743 373587.763,5709254.703 373593.209,5709230.798 373593.497,5709229.534 373615.691,5709214.552 373619.837,5709207.599 373622.818,5709201.745 373625.505,5709195.542 373627.89,5709189.091 373630.194,5709181.803 373631.957,5709175.018 373633.197,5709167.175 373634.088,5709161.54 373634.805,5709148.647 373634.805,5709136.032 373637.806,5709136.021 373637.807,5709148.644 373637.441,5709155.157 373637.073,5709161.869 373634.987,5709174.995 373633.077,5709182.608 373630.743,5709190.087 373628.32,5709196.619 373625.561,5709202.994 373622.448,5709209.044 373613.975,5709223.846 373613.677,5709224.472 373613.47,5709225.134 373613.36,5709225.819 373613.348,5709226.512 373613.434,5709227.2 373613.624,5709227.87 373613.908,5709228.507 373614.28,5709229.096 373614.731,5709229.627 373615.254,5709230.088 373622.357,5709235.592 373630.019,5709240.813 373637.864,5709245.653 373637.518,5709246.257 373636.645,5709247.765 373636.358,5709248.26 373628.411,5709243.411 373620.684,5709238.148 373613.41,5709232.559 373612.838,5709232.165 373612.257,5709231.831 373611.645,5709231.556 373611.011,5709231.34 373610.361,5709231.186 373609.7,5709231.096 373609.033,5709231.069 373608.366,5709231.107 373599.037,5709232.07 373595.033,5709249.628 373591.734,5709264.096 373591.225,5709266.218 373590.638,5709268.319 373589.973,5709270.397 373589.231,5709272.449 373588.414,5709274.473 373587.523,5709276.464 373586.514,5709278.505 373585.427,5709280.506 373584.263,5709282.463 373583.024,5709284.374 373581.713,5709286.235 373580.33,5709288.044 373574.599,5709294.383 373570.836,5709297.969 373560.307,5709307.988 373549.795,5709317.971 373537.379,5709329.779 373535.283,5709327.763 373526.503,5709319.315 373526.97,5709318.836 373527.375,5709318.303 373527.709,5709317.724 373527.969,5709317.107 373528.15,5709316.463 373528.249,5709315.801 373528.263,5709315.132 373528.194,5709314.467 373528.042,5709313.816 373527.81,5709313.189 373527.502,5709312.595 373527.122,5709312.045 373522.868,5709306.707 373515.319,5709297.232 373507.708,5709287.679 373497.32,5709274.638 373482.903,5709256.537 +L 373717.263,5709295.875 373721.655,5709276.451 373718.012,5709275.262 373718.207,5709274.538 373721.897,5709261.041 373724.926,5709249.954 373724.959,5709249.829 373725.03,5709249.846 373728.739,5709250.73 373732.04,5709238.869 373737.122,5709220.574 373741.366,5709205.361 373743.515,5709197.658 373745.364,5709191.348 373750.834,5709172.211 373752.076,5709167.866 373760.53,5709137.398 373761.151,5709135.16 373763.714,5709126.878 373772.736,5709092.183 373780.455,5709063.453 373787.206,5709032.147 373788.912,5709023.411 373790.386,5709015.867 373787.227,5709015.421 373787.727,5709012.869 373788.92,5709006.784 373792.107,5709007.156 373793.795,5708998.415 373795.023,5708989.112 373796.918,5708974.746 373798.942,5708958.068 373800.542,5708945.721 373801.282,5708940.055 373803.589,5708928.788 373803.984,5708918.132 373800.155,5708920.972 373799.771,5708918.175 373792.95,5708899.342 373790.548,5708892.701 373785.399,5708877.647 373782.14,5708868.313 373773.957,5708845.884 373768.2,5708830.11 373762.807,5708815.322 373751.05,5708782.694 373741.752,5708759.389 373734.238,5708738.939 373735.44,5708738.511 373736.12,5708738.263 373742.974,5708739.404 373744.181,5708739.604 373752.681,5708762.883 373752.143,5708763.085 373753.704,5708767.377 373753.874,5708767.846 373760.015,5708784.733 373766.752,5708803.254 373769.46,5708802.186 373769.953,5708801.992 373784.308,5708840.957 373787.707,5708849.466 373788.175,5708850.637 373790.134,5708855.543 373794.129,5708866.817 373797.519,5708876.387 373794.448,5708877.498 373802.168,5708898.684 373804.008,5708903.736 373806.831,5708912.861 373810.074,5708923.341 373810.223,5708931.606 373810.373,5708939.181 373809.603,5708946.926 373808.001,5708963.034 373807.433,5708968.744 373806.456,5708978.562 373805.699,5708986.173 373804.936,5708990.367 373802.778,5709002.239 373801.753,5709007.819 373798.563,5709024.37 373796.247,5709036.612 373792.266,5709051.88 373790.013,5709060.522 373791.949,5709061.002 373793.689,5709061.432 373794.002,5709061.511 373793.414,5709063.982 373791.485,5709071.383 373789.186,5709079.821 373779.552,5709114.389 373779.802,5709114.459 373777.17,5709123.719 373780.002,5709124.54 373779.948,5709124.733 373780.071,5709124.767 373776.377,5709137.796 373773.813,5709146.642 373773.719,5709146.969 373773.691,5709147.064 373770.542,5709146.152 373757.233,5709193.989 373756.137,5709193.848 373753.202,5709193.47 373751.596,5709199.313 373754.484,5709199.658 373755.606,5709199.791 373755.804,5709199.815 373754.277,5709205.226 373753.185,5709209.098 373747.079,5709230.727 373744.619,5709239.438 373738.149,5709262.832 373734.581,5709276.029 373731.894,5709289.494 373730.876,5709299.213 373730.607,5709299.187 373725.452,5709298.699 373728.245,5709308.511 373731.74,5709313.983 373731.163,5709329.763 373720.614,5709320.146 373717.396,5709316.263 373717.271,5709310.928 373717.263,5709295.875 +L 373776.377,5709137.796 373780.071,5709124.767 373780.463,5709124.874 373780.405,5709125.078 373788.693,5709127.459 373788.781,5709127.15 373794.247,5709128.646 373794.649,5709127.21 373803.171,5709127.263 373807.183,5709127.288 373807.163,5709131.452 373815.777,5709131.758 373828.001,5709131.918 373841.037,5709132.15 373852.833,5709131.759 373856.764,5709131.505 373874.962,5709129.523 373887.705,5709127.645 373887.963,5709127.607 373904.617,5709123.879 373920.066,5709119.764 373928.118,5709113.652 373938.918,5709105.456 373947.616,5709098.854 373949.676,5709098.147 373965.094,5709092.86 373967.493,5709092.037 373977.757,5709088.548 373988.747,5709084.785 373999.474,5709080.897 374010.318,5709077.138 374021.177,5709073.143 374032.027,5709068.833 374042.959,5709064.585 374054.438,5709059.72 374065.399,5709055.021 374075.26,5709050.705 374083.79,5709046.919 374093.154,5709042.399 374102.731,5709037.601 374111.384,5709033.35 374121.314,5709027.842 374127.338,5709023.8 374131.429,5709018.969 374133.46,5709014.415 374136.326,5709006.986 374154.033,5708997.704 374157.144,5708999.238 374160.925,5709000.289 374179.41,5708999.058 374182.166,5708998.875 374184.631,5708998.711 374191.631,5708998.245 374196.584,5708997.915 374199.94,5708997.691 374200.168,5709001.439 374200.4,5709005.267 374191.933,5709005.807 374184.978,5709006.248 374182.211,5709006.423 374179.779,5709006.577 374151.755,5709008.354 374149.325,5709009.5 374146.436,5709011.594 374144.226,5709014.225 374142.585,5709018.157 374141.387,5709025.194 374134.587,5709029.314 374118.96,5709038.782 374113.798,5709041.895 374112.177,5709041.412 374096.277,5709049.231 374078.683,5709057.35 374069.718,5709061.341 374060.299,5709065.493 374051.452,5709069.211 374043.062,5709072.771 374034.565,5709076.07 374026.163,5709079.304 374020.386,5709081.423 374020.11,5709081.524 374017.754,5709082.391 374008.646,5709085.647 373999.689,5709088.846 373991.107,5709091.833 373988.998,5709092.611 373970.251,5709099.524 373954.043,5709105.501 373950.835,5709106.926 373948.917,5709109.889 373938.115,5709125.117 373937.967,5709125.325 373928.639,5709125.924 373919.584,5709127.57 373915.081,5709128.79 373906.293,5709131.172 373892.43,5709134.748 373891.539,5709134.868 373880.029,5709136.414 373867.567,5709138.293 373855.022,5709139.161 373842.473,5709139.747 373829.974,5709139.7 373817.163,5709139.436 373814.955,5709139.561 373806.255,5709139.223 373797.54,5709138.743 373797.313,5709141.873 373793.418,5709141.712 373789.523,5709141.55 373776.377,5709137.796 +L 373602.08,5709082.48 373606.409,5709082.398 373606.433,5709086.008 373602.096,5709086.041 373602.08,5709082.48 +L 373634.353,5709083.86 373638.185,5709083.834 373638.189,5709090.211 373638.191,5709090.294 373634.406,5709090.293 373634.353,5709083.86 +L 373785.887,5709180.391 373785.939,5709176.354 373791.924,5709176.432 373791.871,5709180.468 373785.887,5709180.391 +L 373668.099,5709064.388 373668.102,5709058.011 373679.938,5709057.994 373679.935,5709064.372 373668.099,5709064.388 +L 373754.53,5709096.089 373755.963,5709090.737 373756.38,5709089.179 373756.482,5709088.797 373756.586,5709088.411 373756.689,5709088.024 373756.79,5709087.648 373756.89,5709087.271 373758.439,5709081.484 373767.032,5709083.79 373765.455,5709089.679 373764.776,5709092.212 373763.13,5709098.362 373754.839,5709096.171 373754.53,5709096.089 +L 373668.096,5709070.754 373668.099,5709064.388 373679.935,5709064.372 373679.932,5709070.742 373668.096,5709070.754 +L 373621.745,5709117.174 373621.771,5709105.679 373627.632,5709105.669 373627.631,5709117.168 373621.745,5709117.174 +L 373688.367,5709073.328 373688.766,5709073.328 373688.766,5709074.447 373690.825,5709074.448 373690.825,5709070.949 373697.993,5709070.951 373697.992,5709073.36 373700.082,5709073.36 373700.081,5709076.529 373700.079,5709083.547 373700.079,5709084.106 373688.4,5709084.101 373688.367,5709073.328 +L 373636.892,5709188.081 373637.691,5709180.928 373641.673,5709181.332 373643.558,5709181.524 373643.954,5709181.564 373644.352,5709181.605 373644.751,5709181.645 373647.621,5709181.937 373647.719,5709181.947 373646.956,5709189.221 373646.828,5709189.207 373646.676,5709190.598 373642.501,5709190.177 373642.654,5709188.734 373636.892,5709188.081 +L 373713.157,5709105.448 373728.629,5709105.438 373728.712,5709118.446 373721.903,5709118.446 373721.902,5709117.946 373719.903,5709117.947 373719.904,5709118.446 373713.205,5709118.447 373713.157,5709105.448 +L 373639.183,5709061.062 373651.355,5709061.065 373651.354,5709061.426 373650.905,5709061.425 373650.916,5709065.295 373651.355,5709065.295 373651.357,5709068.393 373639.183,5709068.4 373639.183,5709061.062 +L 373765.11,5709054.697 373766.258,5709049.277 373766.666,5709047.35 373766.749,5709046.959 373766.832,5709046.568 373766.915,5709046.176 373766.997,5709045.795 373767.077,5709045.413 373768.229,5709039.974 373776.911,5709041.857 373775.659,5709047.801 373775.126,5709050.327 373773.811,5709056.575 373765.11,5709054.697 +L 373689.101,5709027.268 373696.689,5709027.243 373696.715,5709039.611 373693.209,5709039.611 373693.208,5709039.06 373689.512,5709039.062 373689.512,5709039.612 373689.112,5709039.612 373689.101,5709027.268 +L 373713.551,5709145.737 373714.522,5709136.239 373714.671,5709136.239 373727.553,5709136.2 373727.641,5709145.614 373727.491,5709145.613 373724.328,5709145.592 373724.338,5709146.121 373723.343,5709147.116 373722.357,5709147.147 373721.453,5709148.114 373720.467,5709147.154 373717.479,5709147.202 373717.515,5709145.67 373713.581,5709145.751 373713.551,5709145.737 +L 373627.661,5709117.168 373627.672,5709105.67 373633.766,5709105.66 373633.744,5709117.161 373627.661,5709117.168 +L 373708.257,5709084.147 373709.501,5709083.22 373709.497,5709081.07 373710.588,5709079.921 373710.58,5709075.692 373720.577,5709075.676 373720.602,5709089.912 373709.365,5709089.93 373709.364,5709089.381 373710.593,5709089.379 373710.589,5709087.3 373709.359,5709087.302 373708.261,5709085.846 373708.257,5709084.147 +L 373685.487,5709106.14 373691.549,5709106.127 373691.559,5709118.454 373691.259,5709118.454 373691.259,5709118.204 373689.349,5709118.206 373689.349,5709118.457 373685.499,5709118.462 373685.487,5709106.14 +L 373639.93,5709117.155 373639.941,5709105.65 373646.015,5709105.64 373646.004,5709117.149 373639.93,5709117.155 +L 373613.164,5709119.733 373613.169,5709110.082 373614.719,5709110.086 373616.238,5709110.088 373621.561,5709110.099 373621.552,5709119.742 373619.249,5709119.739 373618.849,5709119.74 373618.449,5709119.739 373618.048,5709119.739 373613.164,5709119.733 +L 373694.574,5709111.15 373697.554,5709111.148 373697.556,5709116.968 373694.578,5709116.97 373694.574,5709111.15 +L 373670.196,5709108.458 373673.167,5709108.469 373673.163,5709117.491 373670.215,5709117.488 373670.206,5709113.811 373670.196,5709108.458 +L 373637.968,5709147.065 373637.987,5709141.063 373640.968,5709141.082 373640.948,5709147.084 373637.968,5709147.065 +L 373606.176,5709059.678 373609.226,5709059.508 373609.31,5709060.816 373609.367,5709061.702 373606.325,5709061.896 373606.176,5709059.678 +L 373725.926,5709061.491 373726.202,5709058.113 373726.301,5709058.121 373738.258,5709059.098 373737.983,5709062.475 373725.926,5709061.491 +L 373645.308,5709152.254 373645.31,5709149.007 373645.309,5709148.686 373650.77,5709148.677 373650.781,5709155.174 373645.406,5709155.163 373645.308,5709152.254 +L 373700.927,5709026.961 373703.888,5709026.96 373703.91,5709035.995 373700.959,5709035.993 373700.94,5709030.407 373700.927,5709026.961 +L 373646.006,5709093.296 373651.813,5709093.288 373651.816,5709096.257 373646.008,5709096.261 373646.008,5709096.036 373646.006,5709093.296 +L 373689.182,5709147.673 373691.942,5709147.677 373692.007,5709153.142 373689.235,5709153.158 373689.182,5709147.673 +L 373704.117,5709175.875 373705.602,5709161.553 373711.378,5709162.147 373709.906,5709176.468 373704.117,5709175.875 +L 373719.08,5709067.913 373725.391,5709067.903 373725.105,5709071.389 373720.286,5709071.447 373719.092,5709071.461 373719.08,5709067.913 +L 373634.008,5709090.293 373643.029,5709090.295 373643.033,5709093.296 373642.674,5709093.296 373639.882,5709093.295 373634.012,5709093.306 373634.008,5709090.293 +L 373657.279,5709148.649 373662.429,5709148.616 373662.512,5709154.207 373657.319,5709154.269 373657.279,5709148.649 +L 373599.983,5709033.673 373603.687,5709033.638 373603.727,5709037.898 373600.022,5709037.898 373599.983,5709033.673 +L 373746.952,5709074.755 373747.745,5709070.984 373749.862,5709071.414 373748.936,5709075.185 373746.952,5709074.755 +L 373590.363,5709142.412 373602.041,5709142.344 373606.153,5709142.364 373606.231,5709148.409 373606.289,5709159.058 373596.724,5709159.099 373596.708,5709151.938 373590.391,5709151.962 373590.363,5709142.412 +L 373602.012,5709139.344 373609.099,5709139.29 373609.154,5709148.402 373606.231,5709148.409 373606.153,5709142.364 373602.041,5709142.344 373602.012,5709139.344 +L 373626.102,5709042.205 373631.341,5709042.205 373631.539,5709051.254 373626.182,5709051.294 373626.102,5709042.205 +L 373635.971,5709096.845 373636.011,5709093.696 373639.133,5709093.696 373639.133,5709096.845 373635.971,5709096.845 +L 373732.474,5709076.76 373732.846,5709072.245 373737.669,5709072.647 373737.295,5709077.157 373736.797,5709077.119 373732.474,5709076.76 +L 373732.129,5709100.798 373732.524,5709096.05 373735.592,5709096.286 373735.097,5709101.051 373732.129,5709100.798 +L 373603.768,5709202.367 373603.848,5709202.36 373608.497,5709201.909 373608.167,5709198.063 373611.988,5709197.716 373612.315,5709201.599 373612.997,5709209.733 373604.552,5709210.484 373603.768,5709202.367 +L 373603.52,5709198.495 373608.167,5709198.063 373608.497,5709201.909 373603.848,5709202.36 373603.52,5709198.495 +L 373608.483,5709175.691 373615.482,5709175.59 373615.533,5709179.122 373608.534,5709179.223 373608.483,5709175.691 +L 373787.517,5709099.799 373792.18,5709083.423 373801.26,5709085.921 373799.353,5709092.617 373799.737,5709092.726 373798.812,5709095.978 373798.427,5709095.869 373796.597,5709102.297 373787.517,5709099.799 +L 373796.498,5709153.028 373797.313,5709141.873 373805.994,5709142.5 373805.258,5709152.491 373801.441,5709152.232 373801.365,5709153.358 373796.498,5709153.028 +L 373641.939,5709162.191 373642.77,5709162.208 373642.769,5709162.689 373641.949,5709162.692 373641.939,5709162.191 +L 373650.903,5709163.888 373651.413,5709164.389 373651.425,5709166.39 373650.925,5709166.881 373650.903,5709163.888 +L 373642.501,5709190.177 373642.654,5709188.734 373646.828,5709189.207 373646.676,5709190.598 373642.501,5709190.177 +L 373630.991,5709093.306 373631.013,5709090.288 373634.008,5709090.293 373634.012,5709093.306 373630.991,5709093.306 +L 373646.189,5709090.21 373650.362,5709090.209 373652.264,5709090.182 373652.243,5709093.287 373646.189,5709093.296 373646.189,5709090.21 +L 373600.552,5709056.602 373609.032,5709056.025 373609.243,5709059.118 373600.762,5709059.695 373600.552,5709056.602 +L 373650.77,5709148.677 373653.839,5709148.671 373657.279,5709148.649 373657.319,5709154.269 373657.269,5709154.724 373653.88,5709154.714 373653.871,5709153.455 373653.48,5709153.454 373650.778,5709153.484 373650.77,5709148.677 +L 373633.794,5709117.161 373633.826,5709105.66 373639.881,5709105.651 373639.87,5709117.156 373633.794,5709117.161 +L 373671.497,5709146.822 373687.576,5709146.755 373687.61,5709153.166 373687.651,5709160.753 373680.982,5709160.787 373680.982,5709160.857 373678.237,5709160.87 373678.236,5709160.8 373671.577,5709160.834 373671.497,5709146.822 +L 373697.645,5709105.458 373713.107,5709105.448 373713.155,5709118.447 373706.486,5709118.448 373706.486,5709117.948 373704.466,5709117.949 373704.467,5709118.448 373697.658,5709118.449 373697.645,5709105.458 +L 373679.348,5709106.153 373685.437,5709106.14 373685.449,5709118.462 373685.148,5709118.463 373685.148,5709118.212 373683.221,5709118.215 373683.221,5709118.465 373679.357,5709118.473 373679.348,5709106.153 +L 373645.309,5709148.686 373645.31,5709148.203 373645.31,5709147.803 373645.311,5709145.898 373645.311,5709144.331 373645.312,5709141.236 373645.312,5709140.48 373653.807,5709140.432 373653.839,5709148.671 373650.77,5709148.677 373645.309,5709148.686 +L 373653.807,5709140.432 373662.307,5709140.387 373662.429,5709148.616 373657.279,5709148.649 373653.839,5709148.671 373653.807,5709140.432 +L 373634.88,5709041.418 373638.389,5709041.431 373638.386,5709042.43 373643.121,5709042.449 373643.118,5709041.449 373643.107,5709036.681 373650.596,5709036.704 373650.577,5709048.921 373646.51,5709048.915 373646.51,5709049.044 373646.39,5709049.044 373640.04,5709049.033 373640.04,5709048.904 373634.895,5709048.895 373634.88,5709041.418 +L 373758.439,5709081.484 373759.965,5709075.782 373760.473,5709073.885 373760.578,5709073.494 373760.684,5709073.099 373760.789,5709072.703 373760.895,5709072.308 373762.336,5709066.926 373770.933,5709069.22 373769.281,5709075.388 373768.608,5709077.902 373767.032,5709083.79 373758.439,5709081.484 +L 373715.173,5709208.024 373717.581,5709199.522 373729.223,5709202.83 373728.958,5709203.802 373737.348,5709206.184 373734.343,5709216.766 373725.938,5709214.38 373725.986,5709214.322 373720.117,5709212.651 373717.303,5709211.861 373717.288,5709211.93 373717.016,5709211.854 373715.643,5709209.395 373715.966,5709208.25 373715.173,5709208.024 +L 373638.177,5709075.649 373650.356,5709075.638 373650.356,5709075.998 373649.916,5709075.998 373649.908,5709079.981 373650.358,5709079.98 373650.359,5709082.802 373638.184,5709082.823 373638.177,5709075.649 +L 373740.286,5709114.418 373741.816,5709108.626 373741.913,5709108.259 373742.01,5709107.892 373742.11,5709107.514 373742.209,5709107.137 373742.309,5709106.76 373742.707,5709105.251 373744.235,5709099.468 373753.311,5709101.902 373751.648,5709108.135 373750.976,5709110.657 373749.329,5709116.833 373740.286,5709114.418 +L 373768.229,5709039.974 373769.371,5709034.583 373769.779,5709032.656 373769.862,5709032.264 373769.945,5709031.873 373770.031,5709031.472 373770.115,5709031.071 373770.2,5709030.67 373771.35,5709025.241 373780.016,5709027.119 373778.701,5709033.358 373778.167,5709035.894 373776.911,5709041.857 373768.229,5709039.974 +L 373672.782,5709052.505 373678.581,5709052.497 373678.589,5709057.956 373672.79,5709057.974 373672.782,5709052.505 +L 373668.223,5709087.162 373671.193,5709087.159 373671.205,5709092.955 373668.225,5709092.96 373668.223,5709087.162 +L 373637.563,5709202.341 373637.589,5709202.195 373638.67,5709196.184 373639.407,5709196.316 373639.403,5709196.345 373652.284,5709198.65 373651.182,5709204.779 373649.332,5709204.446 373648.131,5709211.136 373644.173,5709210.437 373639.761,5709209.669 373639.553,5709209.633 373640.737,5709202.923 373637.563,5709202.341 +L 373639.92,5709049.033 373640.04,5709049.033 373646.39,5709049.044 373646.375,5709055.028 373639.947,5709055.032 373639.92,5709049.033 +L 373725.702,5709164.416 373726.425,5709161.486 373726.3,5709161.455 373727.769,5709155.544 373727.568,5709148.331 373730.968,5709148.13 373731.346,5709166.264 373728.271,5709166.361 373728.274,5709165.051 373725.702,5709164.416 +L 373613.288,5709190.235 373616.589,5709190.065 373617.242,5709198.001 373613.918,5709198.177 373613.288,5709190.235 +L 373613.107,5709187.945 373616.404,5709187.82 373616.589,5709190.065 373613.288,5709190.235 373613.107,5709187.945 +L 373697.991,5709030.397 373700.94,5709030.407 373700.959,5709035.993 373698.001,5709035.993 373697.991,5709030.397 +L 373675.584,5709070.761 373683.082,5709070.758 373683.085,5709073.729 373675.584,5709073.731 373675.584,5709070.761 +L 373724.451,5709079.503 373724.728,5709076.116 373724.841,5709076.125 373732.474,5709076.76 373736.797,5709077.119 373736.516,5709080.506 373724.451,5709079.503 +L 373601.782,5709059.922 373606.176,5709059.678 373606.325,5709061.896 373601.928,5709062.182 373601.782,5709059.922 +L 373664.366,5709093.065 373670.165,5709093.048 373670.195,5709108.008 373664.399,5709108.023 373664.366,5709093.065 +L 373653.971,5709038.445 373656.921,5709038.441 373656.925,5709044.038 373653.974,5709044.046 373653.971,5709038.445 +L 373719.596,5709064.995 373725.394,5709064.985 373725.4,5709067.854 373719.602,5709067.863 373719.596,5709064.995 +L 373649.837,5709196.401 373650.388,5709192.642 373654.158,5709193.023 373654.18,5709192.833 373657.853,5709193.631 373656.185,5709198.566 373649.837,5709196.401 +L 373674.376,5709037.673 373674.382,5709032.144 373674.386,5709028.675 373677.334,5709028.646 373677.343,5709037.646 373674.376,5709037.673 +L 373611.21,5709144.647 373616.471,5709144.556 373616.515,5709148.235 373616.915,5709148.232 373616.933,5709151.571 373611.328,5709151.643 373611.21,5709144.647 +L 373601.512,5709112.987 373604.811,5709112.992 373604.803,5709118.59 373601.514,5709118.585 373601.512,5709112.987 +L 373720.286,5709071.447 373725.105,5709071.389 373724.923,5709074.88 373722.058,5709074.912 373720.312,5709072.742 373720.286,5709071.447 +L 373744.769,5709081.171 373745.662,5709076.706 373748.407,5709077.367 373747.547,5709081.733 373744.769,5709081.171 +L 373601.262,5709095.61 373602.322,5709094.549 373603.822,5709094.549 373604.883,5709095.61 373604.851,5709096.91 373603.887,5709098.059 373602.388,5709098.109 373601.262,5709097.11 373601.262,5709095.61 +L 373750.416,5709055.092 373750.838,5709050.018 373755.295,5709050.389 373754.872,5709055.463 373750.416,5709055.092 +L 373724.889,5709075.528 373724.923,5709074.88 373725.105,5709071.389 373729.21,5709071.604 373728.993,5709075.743 373724.889,5709075.528 +L 373793.694,5709077.07 373797.704,5709061.331 373806.702,5709063.629 373802.692,5709079.313 373793.694,5709077.07 +L 373769.711,5709162.873 373774.192,5709146.75 373783.376,5709149.377 373781.596,5709155.773 373781.982,5709155.881 373781.077,5709159.095 373780.7,5709158.99 373778.907,5709165.433 373769.711,5709162.873 +L 373797.704,5709061.331 373801.693,5709045.678 373810.706,5709047.965 373806.702,5709063.629 373797.704,5709061.331 +L 373783.122,5709115.243 373787.517,5709099.799 373796.597,5709102.297 373794.771,5709108.71 373795.155,5709108.819 373794.237,5709112.041 373793.854,5709111.931 373792.204,5709117.726 373783.122,5709115.243 +L 373779.948,5709124.733 373780.002,5709124.54 373782.634,5709115.261 373782.675,5709115.116 373783.122,5709115.243 373792.204,5709117.726 373796.936,5709119.026 373794.247,5709128.646 373788.781,5709127.15 373780.463,5709124.874 373780.071,5709124.767 373779.948,5709124.733 +L 373638.386,5709042.43 373638.389,5709041.431 373640.623,5709041.44 373643.118,5709041.449 373643.121,5709042.449 373638.386,5709042.43 +L 373654.18,5709192.833 373654.617,5709188.982 373656.966,5709189.258 373656.6,5709193.359 373654.18,5709192.833 +L 373653.879,5709033.538 373656.873,5709033.538 373656.921,5709038.441 373653.971,5709038.445 373653.879,5709033.538 +L 373773.813,5709146.642 373776.377,5709137.796 373789.523,5709141.55 373787.01,5709150.417 373783.376,5709149.377 373774.192,5709146.75 373773.813,5709146.642 +L 373762.156,5709188.736 373763.11,5709185.304 373772.083,5709187.79 373771.133,5709191.223 373762.156,5709188.736 +L 373646.034,5709117.149 373646.045,5709105.64 373652.111,5709105.631 373652.119,5709117.143 373646.034,5709117.149 +L 373776.812,5709000.898 373778.38,5708986.973 373788.493,5708988.273 373787.847,5708994.009 373788.697,5708994.497 373788.514,5708996.115 373787.557,5708996.59 373786.925,5709002.198 373776.812,5709000.898 +L 373639.182,5709068.44 373651.356,5709068.433 373651.356,5709068.794 373650.907,5709068.793 373650.917,5709072.78 373651.358,5709072.779 373651.359,5709075.578 373639.182,5709075.598 373639.182,5709068.44 +L 373708.668,5709056.015 373715.644,5709056.003 373715.635,5709051.023 373722.59,5709051.009 373722.62,5709064.956 373708.683,5709064.97 373708.668,5709056.015 +L 373646.496,5709192.248 373646.676,5709190.598 373646.828,5709189.207 373646.956,5709189.221 373647.719,5709181.947 373647.621,5709181.937 373647.734,5709180.894 373655.446,5709181.679 373654.18,5709192.833 373654.158,5709193.023 373650.388,5709192.642 373646.496,5709192.248 +L 373638.184,5709082.853 373650.359,5709082.862 373650.359,5709083.222 373649.92,5709083.222 373649.921,5709087.221 373650.361,5709087.221 373650.362,5709090.209 373638.189,5709090.211 373638.184,5709082.853 +L 373705.14,5709025.291 373712.725,5709025.277 373712.747,5709037.638 373712.347,5709037.639 373712.345,5709037.1 373708.636,5709037.109 373708.639,5709037.647 373705.17,5709037.656 373705.14,5709025.291 +L 373639.402,5709168.702 373639.902,5709168.701 373639.848,5709162.707 373641.949,5709162.692 373641.939,5709162.191 373642.77,5709162.208 373642.769,5709162.689 373650.902,5709162.628 373650.903,5709163.888 373651.413,5709164.389 373651.425,5709166.39 373650.925,5709166.881 373650.957,5709171.625 373641.945,5709171.681 373639.434,5709171.703 373639.402,5709168.702 +L 373695.097,5709142.672 373698.816,5709142.659 373700.041,5709141.405 373702.88,5709141.405 373704.124,5709142.64 373706.513,5709142.631 373707.739,5709141.377 373710.577,5709141.367 373711.792,5709142.612 373713.741,5709142.605 373713.452,5709145.739 373713.551,5709145.737 373713.581,5709145.751 373712.306,5709155.466 373695.185,5709155.618 373695.097,5709142.672 +L 373720.304,5709028.504 373725.616,5709028.514 373724.884,5709037.492 373720.325,5709037.472 373720.304,5709028.504 +L 373604.803,5709118.59 373604.811,5709112.992 373604.815,5709110.068 373606.461,5709110.071 373609.026,5709110.075 373613.049,5709110.082 373613.169,5709110.082 373613.164,5709119.733 373612.944,5709119.733 373610.667,5709119.726 373610.267,5709119.725 373609.866,5709119.724 373609.466,5709119.722 373604.807,5709119.71 373604.803,5709118.59 +L 373616.424,5709140.686 373630.872,5709140.593 373631.146,5709155.273 373623.395,5709155.328 373623.389,5709154.839 373624.088,5709154.833 373624.057,5709152.053 373622.597,5709152.064 373622.584,5709150.945 373625.213,5709150.956 373625.141,5709148.179 373616.915,5709148.232 373616.515,5709148.235 373616.471,5709144.556 373616.424,5709140.686 +L 373681.512,5709027.292 373689.101,5709027.268 373689.112,5709039.612 373688.711,5709039.614 373688.709,5709039.075 373684.99,5709039.091 373684.992,5709039.631 373681.524,5709039.647 373681.512,5709027.292 +L 373727.491,5709145.613 373727.641,5709145.614 373727.553,5709136.2 373743.672,5709135.349 373750.073,5709135.444 373756.419,5709136.63 373753.603,5709151.368 373737.407,5709148.257 373737.496,5709147.743 373730.968,5709148.13 373727.568,5709148.331 373727.491,5709145.613 +L 373658.413,5709045.063 373658.427,5709032.126 373674.382,5709032.144 373674.376,5709037.673 373674.37,5709044.091 373664.173,5709044.08 373664.173,5709045.08 373658.457,5709045.074 373658.413,5709045.063 +L 373712.725,5709025.277 373720.297,5709025.264 373720.298,5709025.719 373720.304,5709028.504 373720.325,5709037.472 373720.326,5709037.621 373716.858,5709037.629 373716.855,5709037.09 373713.147,5709037.098 373713.149,5709037.637 373712.747,5709037.638 373712.725,5709025.277 +L 373673.234,5709106.168 373679.298,5709106.154 373679.307,5709118.472 373679.028,5709118.472 373679.027,5709118.223 373677.123,5709118.226 373677.123,5709118.475 373673.244,5709118.481 373673.234,5709106.168 +L 373641.945,5709171.681 373650.957,5709171.625 373650.979,5709174.847 373641.967,5709174.923 373641.945,5709171.681 +L 373616.238,5709110.088 373616.246,5709105.691 373617.477,5709105.693 373618.666,5709105.695 373621.562,5709105.702 373621.561,5709110.099 373616.238,5709110.088 +L 373643.624,5709055.083 373649.424,5709055.084 373649.424,5709061.015 373643.624,5709061.004 373643.624,5709055.083 +L 373598.37,5709059.906 373599.169,5709059.853 373601.766,5709059.683 373601.782,5709059.922 373601.928,5709062.182 373598.508,5709062.403 373598.37,5709059.906 +L 373665.233,5709087.164 373668.223,5709087.162 373668.225,5709092.96 373665.236,5709092.964 373665.233,5709087.164 +L 373692.244,5709162.09 373698.019,5709162.048 373698.009,5709167.87 373698.079,5709167.87 373698.104,5709170.745 373692.299,5709170.788 373692.244,5709162.09 +L 373735.565,5709168.045 373737.045,5709162.749 373745.307,5709165.076 373743.788,5709170.384 373735.565,5709168.045 +L 373700.079,5709083.547 373700.081,5709076.529 373703.059,5709076.53 373703.058,5709083.548 373700.079,5709083.547 +L 373691.602,5709107.922 373694.571,5709107.92 373694.574,5709111.15 373694.578,5709116.97 373691.607,5709116.971 373691.602,5709107.922 +L 373677.376,5709030.486 373680.355,5709030.476 373680.361,5709039.492 373677.394,5709039.506 373677.376,5709030.486 +L 373665.277,5709073.763 373679.653,5709073.749 373683.085,5709073.749 373683.078,5709079.569 373665.28,5709079.584 373665.277,5709073.763 +L 373594.543,5709086.071 373594.568,5709082.538 373602.08,5709082.48 373602.096,5709086.041 373594.543,5709086.071 +L 373731.567,5709107.283 373732.129,5709100.798 373735.097,5709101.051 373734.547,5709107.526 373731.567,5709107.283 +L 373727.386,5709043.623 373727.662,5709040.235 373727.741,5709040.242 373739.748,5709041.221 373739.472,5709044.609 373727.386,5709043.623 +L 373664.269,5709108.023 373664.399,5709108.023 373670.195,5709108.008 373670.196,5709108.458 373670.206,5709113.811 373664.276,5709113.821 373664.269,5709108.023 +L 373663.81,5709153.882 373666.898,5709153.867 373667.018,5709153.867 373667.057,5709159.927 373666.929,5709159.928 373663.862,5709159.942 373663.813,5709154.192 373663.81,5709153.882 +L 373728.842,5709025.756 373729.134,5709022.369 373729.248,5709022.379 373741.205,5709023.354 373740.929,5709026.742 373728.842,5709025.756 +L 373671.193,5709087.159 373683.091,5709087.149 373683.093,5709092.949 373679.65,5709092.95 373679.31,5709092.944 373673.205,5709092.954 373671.205,5709092.955 373671.193,5709087.159 +L 373720.298,5709025.719 373725.843,5709025.726 373725.616,5709028.514 373720.304,5709028.504 373720.298,5709025.719 +L 373592.435,5709055.598 373592.447,5709047.103 373602.44,5709047.108 373602.437,5709055.586 373592.435,5709055.598 +L 373715.173,5709208.024 373717.581,5709199.522 373729.223,5709202.83 373728.958,5709203.802 373720.018,5709201.261 373717.535,5709202.68 373715.966,5709208.25 373715.173,5709208.024 +L 373674.093,5709019.016 373677.346,5709019.009 373677.351,5709024.697 373674.104,5709024.7 373674.093,5709019.016 +L 373662.086,5709168.984 373667.017,5709168.952 373667.054,5709174.733 373662.135,5709174.775 373662.129,5709174.025 373662.086,5709168.984 +L 373754.48,5709036.254 373755.428,5709031.675 373759.298,5709032.476 373758.35,5709037.055 373754.48,5709036.254 +L 373667.054,5709174.733 373671.399,5709174.718 373671.417,5709179.902 373667.072,5709179.917 373667.054,5709174.733 +L 373729.342,5709050.187 373729.618,5709046.796 373734.438,5709047.19 373734.162,5709050.58 373729.342,5709050.187 +L 373641.778,5709144.331 373641.794,5709141.299 373645.312,5709141.236 373645.311,5709144.331 373641.778,5709144.331 +L 373642.653,5709095.973 373642.674,5709093.296 373643.033,5709093.296 373646.006,5709093.296 373646.008,5709096.036 373642.653,5709095.973 +L 373595.299,5709203.122 373595.993,5709203.046 373595.746,5709200.04 373599.939,5709199.65 373600.235,5709202.681 373603.768,5709202.367 373604.552,5709210.484 373596.098,5709211.246 373595.299,5709203.122 +L 373763.065,5709185.292 373765.392,5709176.918 373765.778,5709177.025 373769.711,5709162.873 373778.907,5709165.433 373776.268,5709174.909 373776.654,5709175.017 373775.738,5709178.269 373775.361,5709178.165 373772.636,5709187.95 373772.083,5709187.79 373763.11,5709185.304 373763.065,5709185.292 diff --git a/src/Triangle.Tests/Characterization/Data/herne_381000_5710400.txt b/src/Triangle.Tests/Characterization/Data/herne_381000_5710400.txt new file mode 100644 index 0000000..971113d --- /dev/null +++ b/src/Triangle.Tests/Characterization/Data/herne_381000_5710400.txt @@ -0,0 +1,13 @@ +# tile 381000.0/5710400.0 +L 381190.126,5710540.762 381194.129,5710526.603 381195.787,5710520.737 381204.863,5710524.501 381223.929,5710532.409 381259.052,5710555.731 381269.226,5710542.285 381270.549,5710540.536 381279.344,5710542.497 381286.075,5710544.004 381306.902,5710559.526 381342.897,5710572.066 381358.697,5710574.989 381364.68,5710574.87 381364.517,5710584.649 381362.068,5710584.244 381352.934,5710582.733 381348.853,5710586.331 381343.078,5710599.417 381331.958,5710598.36 381309.329,5710600.787 381271.377,5710610.161 381263.471,5710610.843 381259.112,5710608.549 381262.21,5710591.432 381245.604,5710570.886 381190.126,5710540.762 +L 380881.998,5710780.666 380882.262,5710778.946 380882.826,5710775.308 380882.866,5710775.047 380883.355,5710771.633 380885.111,5710756.895 380894.402,5710707.369 380901.482,5710669.837 380904.268,5710654.894 380913.646,5710604.174 380917.133,5710585.313 380920.745,5710565.482 380923.122,5710552.283 380926.005,5710536.265 380930.07,5710512.481 380934.132,5710488.699 380940.432,5710451.61 380944.47,5710429.041 380964.828,5710315.244 380966.803,5710303.455 380966.991,5710296.859 380966.016,5710292.17 380968.081,5710288.175 380973.909,5710276.902 380974.485,5710279.716 380978.905,5710301.33 380976.453,5710317.326 380962.679,5710394.122 380960.662,5710405.368 380957.139,5710425.013 380951.98,5710453.777 380945.088,5710492.083 380933.037,5710558.95 380921.175,5710627.444 380916.058,5710656.993 380913.201,5710673.149 380906.346,5710711.86 380897.588,5710761.424 380897.031,5710766.157 380899.176,5710771.309 380904.086,5710776.478 380942.201,5710792.881 380971.559,5710805.008 380974.957,5710806.411 380989.951,5710812.609 380988.757,5710820.658 380995.836,5710822.908 380997.366,5710815.675 381034.06,5710830.844 381032.85,5710834.694 381061.23,5710845.934 381062.262,5710842.801 381072.736,5710847.284 381071.83,5710850.031 381082.545,5710854.734 381095.304,5710861.184 381096.522,5710857.474 381099.169,5710858.608 381137.708,5710875.119 381148.07,5710879.554 381181.302,5710892.912 381183.572,5710894.059 381213.699,5710909.26 381217.707,5710911.287 381218.215,5710911.947 381224.302,5710919.73 381230.501,5710934.865 381231.945,5710937.608 381235.59,5710942.984 381248.008,5710961.31 381255.369,5710972.147 381256.941,5710973.66 381273.288,5710989.199 381275.229,5710991.0 381276.182,5710991.666 381274.32,5710997.353 381274.032,5710998.26 381273.718,5710999.249 381270.044,5710997.018 381249.102,5710976.542 381227.766,5710943.041 381225.16,5710938.353 381218.097,5710925.642 381214.514,5710923.707 381208.98,5710920.863 381190.967,5710912.226 381176.151,5710905.113 381154.196,5710895.41 381142.814,5710890.379 381092.496,5710869.191 381086.485,5710866.658 381038.076,5710846.261 381033.549,5710844.33 381027.994,5710841.96 380981.399,5710822.079 380967.652,5710816.27 380959.27,5710812.853 380944.725,5710806.999 380941.314,5710805.626 380936.781,5710803.801 380894.611,5710785.968 380888.731,5710783.482 380881.998,5710780.666 +L 381178.406,5710479.434 381206.392,5710435.43 381293.179,5710504.815 381313.032,5710520.684 381368.328,5710550.383 381367.249,5710556.837 381364.68,5710574.87 381358.697,5710574.989 381342.897,5710572.066 381306.902,5710559.526 381286.075,5710544.004 381279.344,5710542.497 381270.549,5710540.536 381245.066,5710523.542 381236.778,5710515.904 381183.006,5710482.304 381178.406,5710479.434 +L 381162.795,5710506.241 381168.317,5710496.235 381172.235,5710489.135 381178.406,5710479.434 381183.006,5710482.304 381236.778,5710515.904 381245.066,5710523.542 381270.549,5710540.536 381269.226,5710542.285 381259.052,5710555.731 381223.929,5710532.409 381204.863,5710524.501 381195.787,5710520.737 381162.795,5710506.241 +L 380962.679,5710394.122 380976.453,5710317.326 380978.905,5710301.33 380980.034,5710286.57 380980.38,5710282.04 380980.445,5710281.191 380980.705,5710277.772 381010.989,5710287.904 381023.35,5710262.011 381027.921,5710252.451 381034.605,5710257.08 381039.89,5710260.732 381048.683,5710265.835 381142.942,5710320.62 381163.213,5710333.166 381178.291,5710342.498 381238.587,5710390.68 381212.436,5710425.921 381206.392,5710435.43 381178.406,5710479.434 381172.235,5710489.135 381168.317,5710496.235 380962.679,5710394.122 +L 381043.657,5710219.576 381047.519,5710205.944 381084.279,5710200.232 381089.613,5710197.232 381095.219,5710194.079 381110.211,5710192.261 381118.188,5710189.049 381126.184,5710185.825 381153.267,5710177.07 381158.469,5710175.388 381162.867,5710176.2 381214.071,5710172.099 381214.558,5710172.06 381218.977,5710171.705 381219.698,5710169.876 381227.397,5710150.33 381224.282,5710146.643 381223.735,5710145.995 381221.884,5710143.805 381216.487,5710137.419 381219.38,5710108.366 381203.948,5710082.759 381193.31,5710070.153 381186.387,5710050.784 381183.234,5710025.332 381188.443,5710014.293 381186.454,5710000.075 381199.107,5710001.272 381208.831,5710050.062 381220.854,5710089.8 381245.445,5710152.75 381259.44,5710190.55 381305.27,5710259.222 381330.423,5710293.001 381360.607,5710326.022 381393.911,5710350.041 381387.699,5710273.429 381383.583,5710222.707 381382.62,5710210.815 381381.556,5710197.655 381400.804,5710207.121 381416.685,5710214.935 381431.658,5710224.525 381445.304,5710232.879 381459.334,5710238.958 381490.073,5710251.492 381537.338,5710269.883 381570.251,5710286.757 381582.997,5710291.012 381631.147,5710295.244 381666.134,5710299.765 381683.687,5710306.544 381703.273,5710319.673 381680.181,5710383.317 381675.055,5710409.294 381668.64,5710469.063 381665.078,5710506.335 381625.265,5710567.862 381615.368,5710553.473 381579.58,5710501.232 381566.752,5710483.268 381564.039,5710484.268 381555.644,5710476.297 381544.291,5710467.647 381539.764,5710464.198 381523.898,5710442.636 381512.271,5710449.188 381493.966,5710444.437 381492.473,5710444.049 381490.118,5710442.448 381480.857,5710436.154 381437.847,5710406.92 381426.355,5710401.9 381411.213,5710395.285 381407.433,5710391.838 381385.335,5710369.99 381377.409,5710363.145 381371.729,5710358.24 381361.715,5710355.225 381352.616,5710349.967 381345.758,5710342.101 381345.461,5710337.598 381338.467,5710335.871 381323.983,5710324.167 381317.828,5710315.453 381311.17,5710312.712 381298.226,5710287.51 381296.756,5710273.373 381280.462,5710264.816 381266.798,5710280.204 381304.305,5710341.47 381331.416,5710371.058 381363.8,5710397.297 381396.858,5710421.694 381417.501,5710431.258 381510.423,5710494.521 381530.639,5710508.293 381543.766,5710517.235 381563.468,5710558.116 381574.901,5710598.377 381518.262,5710534.78 381512.76,5710530.822 381419.096,5710465.259 381259.97,5710330.615 381239.475,5710302.485 381203.043,5710188.19 381198.371,5710185.83 381235.945,5710304.017 381257.112,5710333.198 381415.155,5710467.145 381395.037,5710462.97 381393.757,5710462.705 381392.304,5710461.819 381370.107,5710448.278 381342.295,5710433.932 381324.004,5710420.666 381319.862,5710417.864 381297.949,5710400.831 381280.102,5710386.889 381260.161,5710366.969 381239.804,5710345.333 381205.681,5710312.101 381178.873,5710282.662 381123.686,5710243.391 381120.398,5710240.396 381085.392,5710208.253 381054.297,5710216.805 381043.657,5710219.576 +L 381053.72,5710595.965 381070.281,5710588.926 381079.705,5710584.92 381090.1,5710580.503 381144.139,5710586.236 381143.978,5710588.932 381172.487,5710590.814 381169.691,5710611.128 381168.888,5710615.28 381164.56,5710637.687 381134.719,5710627.467 381105.438,5710616.071 381105.126,5710615.95 381053.72,5710595.965 +L 380945.088,5710492.083 380951.98,5710453.777 380957.139,5710425.013 380960.662,5710405.368 380962.679,5710394.122 381168.317,5710496.235 381162.795,5710506.241 381195.787,5710520.737 381194.129,5710526.603 381190.126,5710540.762 381167.138,5710558.206 381158.057,5710567.112 381147.561,5710569.858 381131.963,5710570.512 381111.495,5710571.795 381108.069,5710570.153 381067.864,5710550.893 381054.456,5710544.471 380945.088,5710492.083 +L 381022.714,5710700.24 381023.914,5710695.53 381029.872,5710672.142 381033.244,5710661.372 381053.72,5710595.965 381105.126,5710615.95 381098.435,5710636.166 381090.075,5710661.431 381088.816,5710665.222 381075.001,5710706.976 381066.7,5710732.07 381066.195,5710733.595 381022.714,5710700.24 +L 381198.371,5710185.83 381203.043,5710188.19 381239.475,5710302.485 381259.97,5710330.615 381419.096,5710465.259 381512.76,5710530.822 381518.262,5710534.78 381574.901,5710598.377 381572.605,5710601.48 381515.513,5710537.331 381417.495,5710469.502 381415.155,5710467.145 381257.112,5710333.198 381235.945,5710304.017 381198.371,5710185.83 +L 380913.201,5710673.149 380916.058,5710656.993 380921.175,5710627.444 380933.037,5710558.95 380945.088,5710492.083 381054.456,5710544.471 381067.864,5710550.893 381108.069,5710570.153 381111.495,5710571.795 381090.1,5710580.503 381079.705,5710584.92 381070.281,5710588.926 381053.72,5710595.965 381033.244,5710661.372 381029.872,5710672.142 381023.914,5710695.53 381022.714,5710700.24 381021.774,5710703.949 381006.872,5710699.717 380913.201,5710673.149 +L 381090.1,5710580.503 381111.495,5710571.795 381131.963,5710570.512 381147.561,5710569.858 381158.057,5710567.112 381167.138,5710558.206 381190.126,5710540.762 381245.604,5710570.886 381262.21,5710591.432 381259.112,5710608.549 381240.883,5710607.079 381221.118,5710603.531 381206.301,5710607.192 381193.495,5710613.542 381180.784,5710615.028 381169.691,5710611.128 381172.487,5710590.814 381143.978,5710588.932 381144.139,5710586.236 381090.1,5710580.503 diff --git a/src/Triangle.Tests/Characterization/GoldenMeshTest.cs b/src/Triangle.Tests/Characterization/GoldenMeshTest.cs new file mode 100644 index 0000000..2f8a4bc --- /dev/null +++ b/src/Triangle.Tests/Characterization/GoldenMeshTest.cs @@ -0,0 +1,68 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Characterization +{ + /// + /// Pins the exact output (geometry of all triangles and subsegments) of every scenario of + /// . Performance work that is meant to be behavior-neutral must + /// keep all fingerprints. If a change intentionally alters the output, check the + /// results and quality statistics, then regenerate the file: + /// + /// TRIANGLE_UPDATE_GOLDEN=1 dotnet test --filter Name~Golden + /// + /// + /// The fingerprints depend on IEEE double arithmetic only (no transcendental functions in + /// the meshing code paths that decide vertex positions, except the trigonometry of the + /// aCute refinement), so they are stable across x64 platforms. + /// + [Category("Characterization")] + public class GoldenMeshTest + { + public static IEnumerable Cases() => + MeshCases.All().Select(c => new TestCaseData(c).SetName("Golden(" + c.Name + ")")); + + private static readonly object Lock = new object(); + + [TestCaseSource(nameof(Cases))] + public void Golden(MeshCases.Case c) + { + var mesh = MeshAssert.Terminates(() => c.Run(c.Input()), TimeSpan.FromSeconds(120)); + var actual = MeshInvariants.Fingerprint(mesh); + + var golden = Load(); + + if (Environment.GetEnvironmentVariable("TRIANGLE_UPDATE_GOLDEN") == "1") + { + lock (Lock) + { + golden = Load(); + golden[c.Name] = actual; + File.WriteAllLines(GoldenFile(), golden.OrderBy(g => g.Key, StringComparer.Ordinal).Select(g => g.Key + " " + g.Value)); + } + + return; + } + + Assert.That(golden.ContainsKey(c.Name), Is.True, $"No fingerprint for '{c.Name}' (run with TRIANGLE_UPDATE_GOLDEN=1)."); + Assert.That(actual, Is.EqualTo(golden[c.Name]), "Mesh differs from the pinned result."); + } + + private static Dictionary Load() + { + var file = GoldenFile(); + + return File.Exists(file) + ? File.ReadAllLines(file).Where(l => l.Length > 0).ToDictionary(l => l.Substring(0, l.IndexOf(' ')), l => l.Substring(l.IndexOf(' ') + 1)) + : new Dictionary(); + } + + private static string GoldenFile([CallerFilePath] string path = "") => + Path.Combine(Path.GetDirectoryName(path), "golden.txt"); + } +} diff --git a/src/Triangle.Tests/Characterization/InvariantTest.cs b/src/Triangle.Tests/Characterization/InvariantTest.cs new file mode 100644 index 0000000..3b7351d --- /dev/null +++ b/src/Triangle.Tests/Characterization/InvariantTest.cs @@ -0,0 +1,40 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Characterization +{ + /// + /// Every scenario of must produce a valid mesh: consistent, + /// no inverted triangles, (constrained) Delaunay, area preserved, all input segments + /// present, locked segments unsplit, minimum angle and maximum area met where guaranteed. + /// + [Category("Characterization")] + public class InvariantTest + { + public static IEnumerable Cases() => + MeshCases.All().Select(c => new TestCaseData(c).SetName("Invariants(" + c.Name + ")")); + + [TestCaseSource(nameof(Cases))] + public void Invariants(MeshCases.Case c) + { + var input = c.Input(); + var mesh = MeshAssert.Terminates(() => c.Run(input), TimeSpan.FromSeconds(120)); + + // Reference area: plain triangulation of the same input. + var reference = c.Input(); + var plain = reference.Segments.Count == 0 + ? (Mesh)new GenericMesher().Triangulate(reference.Points) + : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); + double area = plain.Triangles.Sum(MeshInvariants.Area); + + var errors = MeshInvariants.Check(mesh, input, c, area); + + Assert.That(errors, Is.Empty, string.Join(", ", errors)); + } + } +} diff --git a/src/Triangle.Tests/Characterization/MeshCases.cs b/src/Triangle.Tests/Characterization/MeshCases.cs new file mode 100644 index 0000000..c2631d1 --- /dev/null +++ b/src/Triangle.Tests/Characterization/MeshCases.cs @@ -0,0 +1,428 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; +using TriangleNet.Smoothing; +using TriangleNet.Tests.Corpus; + +namespace TriangleNet.Tests.Characterization +{ + /// + /// Catalog of deterministic meshing scenarios (input × options). Used by the invariant + /// tests, the golden fingerprint tests and the benchmarks, so that performance work is + /// checked against exactly the workloads it is measured on. + /// + public static class MeshCases + { + /// + /// A meshing scenario. + /// + public class Case + { + public string Name { get; set; } + + /// + /// Creates a fresh input (inputs are modified by the mesher, e.g. vertex IDs). + /// + public Func Input { get; set; } + + public Func Run { get; set; } + + /// + /// Minimum angle requested (0 = no quality). + /// + public double MinAngle { get; set; } + + /// + /// Maximum triangle area requested (0 = none). + /// + public double MaxArea { get; set; } + + /// + /// The input has no angles below 60° between segments, so every triangle must + /// meet the minimum angle. + /// + public bool AngleGuarantee { get; set; } + + /// + /// The result must be (conforming) Delaunay, not only constrained Delaunay. + /// + public bool Conforming { get; set; } + + /// + /// Segments that must not be split by refinement. + /// + public Func Locked { get; set; } + + /// + /// Snap tolerance (). + /// + public double Snap { get; set; } + + public override string ToString() => Name; + } + + public const int SteinerLimit = 200000; + + private static readonly string DataDirectory = + Path.Combine(Path.GetDirectoryName(typeof(MeshCases).Assembly.Location), "Characterization", "Data"); + + /// + /// All scenarios. + /// + public static IEnumerable All() + { + // Point sets: all three triangulation algorithms. + foreach (var (name, input) in PointSets()) + { + yield return Points(name + "/dwyer", input, () => new Dwyer()); + yield return Points(name + "/incremental", input, () => new Incremental()); + yield return Points(name + "/sweepline", input, () => new SweepLine()); + yield return Quality(name + "/q30", input, new ConstraintOptions(), 30, angleGuarantee: true); + } + + // Polygons with segments. + foreach (var (name, input, nice) in Polygons()) + { + yield return Quality(name + "/cdt", input, new ConstraintOptions(), 0); + yield return Quality(name + "/conforming", input, new ConstraintOptions { ConformingDelaunay = true }, 0, conforming: true); + yield return Quality(name + "/q20", input, new ConstraintOptions(), 20, angleGuarantee: nice); + yield return Quality(name + "/q28-legacy", input, new ConstraintOptions(), 28, angleGuarantee: nice, legacy: true); + yield return Quality(name + "/q33", input, new ConstraintOptions(), 33, angleGuarantee: nice); + yield return Quality(name + "/q25-conforming", input, new ConstraintOptions { ConformingDelaunay = true }, 25, angleGuarantee: nice, conforming: true); + yield return Quality(name + "/q20-split1", input, new ConstraintOptions { SegmentSplitting = 1 }, 20); + yield return Quality(name + "/q20-split2", input, new ConstraintOptions { SegmentSplitting = 2 }, 20); + yield return Quality(name + "/q20-locked", input, new ConstraintOptions { CanSplitSegment = s => s.Label != 7 }, 20, + locked: s => s.Label == 7); + } + + // Maximum area, regions with area constraints, refinement in two steps, smoothing. + yield return Quality("square/q20-area", () => SquareWithHole(), new ConstraintOptions(), 20, maxArea: 0.5, angleGuarantee: true); + yield return Quality("regions/q25-variable-area", Regions, new ConstraintOptions(), 25, variableArea: true, angleGuarantee: true); + + yield return new Case + { + Name = "square/refine-twice", + Input = () => SquareWithHole(), + MinAngle = 30, + MaxArea = 0.2, + AngleGuarantee = true, + Run = p => + { + var mesh = (Mesh)p.Triangulate(new ConstraintOptions(), new QualityOptions { MinimumAngle = 20, MaximumArea = 2 }); + mesh.Refine(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.2 }); + return mesh; + } + }; + + yield return new Case + { + Name = "square/smooth", + Input = () => SquareWithHole(), + Run = p => + { + var mesh = (Mesh)p.Triangulate(new ConstraintOptions(), new QualityOptions { MinimumAngle = 25, MaximumArea = 1 }); + new SimpleSmoother().Smooth(mesh, 5); + return mesh; + } + }; + + // Real data (ALKIS Herne, parcels and buildings) with and without snapping. + foreach (var tile in new[] { "herne_371800_5710600", "herne_373600_5709000", "herne_381000_5710400" }) + { + IPolygon Tile() => LoadTile(tile); + + yield return Quality(tile + "/cdt", Tile, new ConstraintOptions(), 0); + yield return Quality(tile + "/q20", Tile, new ConstraintOptions(), 20); + yield return Quality(tile + "/q20-snap1cm", Tile, new ConstraintOptions { SnapTolerance = 0.01 }, 20); + yield return Quality(tile + "/q30-snap1cm", Tile, new ConstraintOptions { SnapTolerance = 0.01 }, 30); + } + } + + private static Case Points(string name, Func input, Func algorithm) + { + return new Case + { + Name = name, + Input = input, + Conforming = true, + Run = p => (Mesh)new GenericMesher(algorithm()).Triangulate(p.Points) + }; + } + + private static Case Quality(string name, Func input, ConstraintOptions options, double minAngle, + double maxArea = 0, bool variableArea = false, bool angleGuarantee = false, bool conforming = false, + bool legacy = false, Func locked = null) + { + return new Case + { + Name = name, + Input = input, + MinAngle = minAngle, + MaxArea = maxArea, + AngleGuarantee = angleGuarantee && minAngle > 0, + Conforming = conforming, + Locked = locked, + Snap = options.SnapTolerance, + Run = p => + { + // Conforming Delaunay without quality constraints has no Steiner point + // limit otherwise. + var quality = minAngle > 0 || maxArea > 0 || variableArea || options.ConformingDelaunay + ? new QualityOptions + { + MinimumAngle = minAngle, + MaximumArea = maxArea, + VariableArea = variableArea, + SteinerPoints = SteinerLimit, + UseLegacyRefinement = legacy + } + : null; + + return (Mesh)p.Triangulate(options, quality); + } + }; + } + + #region Inputs + + private static IEnumerable<(string, Func)> PointSets() + { + yield return ("points-random", () => RandomPoints(1, 3000, 0, 0, 1000)); + yield return ("points-utm", () => RandomPoints(2, 2000, 372000, 5710000, 200)); + yield return ("points-grid", Grid); + yield return ("points-clustered", Clustered); + } + + private static IEnumerable<(string, Func, bool)> Polygons() + { + yield return ("square-hole", () => SquareWithHole(), true); + yield return ("star", Star, false); + yield return ("crossing-segments", CrossingSegments, false); + yield return ("parcels-mismatch", ParcelsWithMismatchedBoundaries, false); + yield return ("utm-breaklines", UtmBreaklines, false); + } + + private static IPolygon RandomPoints(int seed, int n, double x0, double y0, double size) + { + var random = new Random(seed); + var poly = new Polygon(n); + + for (int i = 0; i < n; i++) + { + poly.Add(new Vertex(x0 + random.NextDouble() * size, y0 + random.NextDouble() * size)); + } + + return poly; + } + + private static IPolygon Grid() + { + // Highly cocircular (worst case for the incircle test). + var poly = new Polygon(); + + for (int i = 0; i < 40; i++) + { + for (int j = 0; j < 40; j++) + { + poly.Add(new Vertex(372000 + i, 5710000 + j)); + } + } + + return poly; + } + + private static IPolygon Clustered() + { + var random = new Random(3); + var poly = new Polygon(); + + for (int c = 0; c < 20; c++) + { + double cx = random.NextDouble() * 1000, cy = random.NextDouble() * 1000; + double r = Math.Pow(10, -random.Next(1, 6)); + + for (int i = 0; i < 100; i++) + { + poly.Add(new Vertex(cx + (random.NextDouble() - 0.5) * r, cy + (random.NextDouble() - 0.5) * r)); + } + } + + return poly; + } + + private static Polygon SquareWithHole(double size = 10) + { + var poly = new Polygon(); + + poly.Add(Contour(7, (0, 0), (size, 0), (size, size), (0, size))); + poly.Add(Contour(2, (3, 3), (3, 6), (6, 6), (6, 3)), true); + + return poly; + } + + private static IPolygon Regions() + { + var poly = new Polygon(); + + poly.Add(Contour(1, (0, 0), (10, 0), (10, 10), (0, 10))); + poly.Add(new Segment(poly.Points[0], poly.Points[2], 3)); + poly.Regions.Add(new RegionPointer(7, 2, 1, 0.1)); + poly.Regions.Add(new RegionPointer(2, 7, 2, 2.0)); + + return poly; + } + + private static IPolygon Star() + { + // Small input angles (5°) at the tips and the center. + var poly = new Polygon(); + var center = new Vertex(0, 0); + poly.Add(center); + + int n = 12; + + for (int i = 0; i < n; i++) + { + double a = 2 * Math.PI * i / n; + var tip = new Vertex(10 * Math.Cos(a), 10 * Math.Sin(a)); + var side = new Vertex(10 * Math.Cos(a + 0.087), 10 * Math.Sin(a + 0.087)); + + poly.Add(tip); + poly.Add(side); + poly.Add(new Segment(center, tip, 7)); + poly.Add(new Segment(tip, side, 1)); + } + + poly.Add(Contour(1, (-15, -15), (15, -15), (15, 15), (-15, 15))); + + return poly; + } + + private static IPolygon CrossingSegments() + { + var poly = new Polygon(); + var random = new Random(4); + + poly.Add(Contour(1, (0, 0), (100, 0), (100, 100), (0, 100))); + + for (int i = 0; i < 40; i++) + { + var a = new Vertex(random.NextDouble() * 100, random.NextDouble() * 100); + var b = new Vertex(random.NextDouble() * 100, random.NextDouble() * 100); + + poly.Add(a); + poly.Add(b); + poly.Add(new Segment(a, b, i % 2 == 0 ? 7 : 2)); + } + + return poly; + } + + private static IPolygon ParcelsWithMismatchedBoundaries() + { + // 4 × 4 parcels, each digitized separately; shared boundaries differ by up to 1 mm. + var poly = new Polygon(); + var random = new Random(5); + double x0 = 372000, y0 = 5710000; + + double Jitter() => (random.NextDouble() - 0.5) * 1e-3; + + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) + { + double x = x0 + i * 25, y = y0 + j * 20; + + poly.Add(Contour((i + j) % 2 == 0 ? 7 : 1, + (x + Jitter(), y + Jitter()), (x + 25 + Jitter(), y + Jitter()), + (x + 25 + Jitter(), y + 20 + Jitter()), (x + Jitter(), y + 20 + Jitter()))); + } + } + + return poly; + } + + private static IPolygon UtmBreaklines() + { + // Non-crossing polylines in Gauss-Krüger coordinates plus scattered points. + var poly = new Polygon(); + var random = new Random(6); + double x0 = 2580000, y0 = 5640000; + + poly.Add(Contour(1, (x0, y0), (x0 + 300, y0), (x0 + 300, y0 + 300), (x0, y0 + 300))); + + for (int k = 0; k < 8; k++) + { + Vertex prev = null; + + for (int i = 0; i <= 20; i++) + { + var v = new Vertex(x0 + 10 + i * 14 + random.NextDouble(), y0 + 20 + k * 35 + 5 * Math.Sin(i * 0.7 + k) + random.NextDouble() * 0.01); + poly.Add(v); + + if (prev != null) poly.Add(new Segment(prev, v, k % 2 == 0 ? 7 : 2)); + + prev = v; + } + } + + for (int i = 0; i < 300; i++) + { + poly.Add(new Vertex(x0 + 1 + random.NextDouble() * 298, y0 + 1 + random.NextDouble() * 298)); + } + + return poly; + } + + private static IPolygon LoadTile(string name) + { + var c = CorpusCase.Load(Path.Combine(DataDirectory, name + ".txt")); + var poly = new Polygon(); + var map = new Dictionary<(double, double), Vertex>(); + + Vertex V((double, double) p) + { + if (!map.TryGetValue(p, out var v)) + { + map[p] = v = new Vertex(p.Item1, p.Item2); + poly.Add(v); + } + + return v; + } + + int k = 0; + + foreach (var line in c.Lines) + { + for (int i = 0; i + 1 < line.Count; i++) + { + if (line[i] != line[i + 1]) + { + poly.Add(new Segment(V(line[i]), V(line[i + 1]), k % 3 == 0 ? 7 : 1)); + } + } + + k++; + } + + // Frame (5 % margin). + var b = poly.Bounds(); + double w = Math.Max(b.Width, b.Height) * 0.05; + poly.Add(Contour(1, (b.Left - w, b.Bottom - w), (b.Right + w, b.Bottom - w), (b.Right + w, b.Top + w), (b.Left - w, b.Top + w))); + + return poly; + } + + private static Contour Contour(int label, params (double X, double Y)[] points) + { + return new Contour(points.Select(p => new Vertex(p.X, p.Y, label)), label); + } + + #endregion + } +} diff --git a/src/Triangle.Tests/Characterization/MeshInvariants.cs b/src/Triangle.Tests/Characterization/MeshInvariants.cs new file mode 100644 index 0000000..26a9ee6 --- /dev/null +++ b/src/Triangle.Tests/Characterization/MeshInvariants.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using TriangleNet.Geometry; +using TriangleNet.Topology; + +namespace TriangleNet.Tests.Characterization +{ + /// + /// Checks of properties every mesh must have, independent of how it was computed. + /// + public static class MeshInvariants + { + /// + /// Returns a list of violated invariants (empty if the mesh is fine). + /// + /// The mesh. + /// The input polygon (after meshing). + /// The scenario. + /// The expected meshed area (NaN to skip the check). + public static List Check(Mesh mesh, IPolygon input, MeshCases.Case c, double area) + { + var errors = new List(); + var predicates = new RobustPredicates(); + + if (mesh.Triangles.Count == 0) errors.Add("no triangles"); + + if (!MeshValidator.IsConsistent(mesh)) errors.Add("inconsistent topology"); + + int inverted = mesh.Triangles.Count(t => predicates.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2)) <= 0); + if (inverted > 0) errors.Add($"{inverted} flat or inverted triangles"); + + double sum = mesh.Triangles.Sum(t => Area(t)); + if (!double.IsNaN(area) && Math.Abs(sum - area) > 1e-9 * Math.Abs(area)) + { + errors.Add($"area {sum:R}, expected {area:R}"); + } + + // (Constrained) Delaunay: no vertex inside the circumcircle of a neighbor, unless + // the shared edge is a segment (constrained) - for conforming meshes, never. + int nonDelaunay = 0; + + // Conforming Delaunay is only guaranteed if the Steiner point limit wasn't reached. + bool conforming = c.Conforming && mesh.Vertices.Count - input.Points.Count < MeshCases.SteinerLimit; + + foreach (var t in mesh.Triangles) + { + var tri = new Otri { tri = t }; + + for (tri.orient = 0; tri.orient < 3; tri.orient++) + { + var neighbor = default(Otri); + tri.Sym(ref neighbor); + + if (neighbor.tri.id == Mesh.DUMMY || neighbor.tri.id < t.id) continue; + + var seg = default(Osub); + tri.Pivot(ref seg); + + if (seg.seg.hash != Mesh.DUMMY && !conforming) continue; + + if (predicates.InCircle(tri.Org(), tri.Dest(), tri.Apex(), neighbor.Apex()) > 0 && + !IsRoundoffArtifact(tri.Org(), tri.Dest(), tri.Apex(), neighbor.Apex())) + { + nonDelaunay++; + } + } + } + + if (nonDelaunay > 0) errors.Add($"{nonDelaunay} non-Delaunay edges"); + + // Input segments are present in the mesh (as chains of subsegments). + var noded = TriangleNet.Meshing.SegmentNoder.Node(input, predicates, out double noderTolerance, minTolerance: c.Snap); + double tolerance = Math.Max(Scale(input) * 1e-11, 4 * noderTolerance); + + var subsegs = mesh.Segments.Select(s => (s.GetVertex(0), s.GetVertex(1))).ToList(); + int missing = input.Segments.Count(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tolerance)); + if (missing > 0) errors.Add($"{missing} input segments missing"); + + // Locked segments are not split by refinement: every piece of a locked segment + // after noding (crossings are split, that's unavoidable) is a single subsegment. + if (c.Locked != null) + { + var meshEdges = new HashSet<(double, double, double, double)>(mesh.Segments.Select(s => Key(s.GetVertex(0), s.GetVertex(1)))); + int split = noded.Segments.Where(c.Locked).Count(s => !meshEdges.Contains(Key(s.GetVertex(0), s.GetVertex(1)))); + + if (split > 0) errors.Add($"{split} locked segments split"); + } + + // Quality. + if (c.AngleGuarantee && mesh.Vertices.Count - input.Points.Count < MeshCases.SteinerLimit) + { + int bad = mesh.Triangles.Count(t => MinimumAngle(t) < c.MinAngle - 1e-6); + if (bad > 0) errors.Add($"{bad} triangles below {c.MinAngle}°"); + } + + if (c.MaxArea > 0) + { + int large = mesh.Triangles.Count(t => Area(t) > c.MaxArea * (1 + 1e-9)); + if (large > 0) errors.Add($"{large} triangles larger than {c.MaxArea}"); + } + + return errors; + } + + /// + /// Fingerprint of the mesh geometry, independent of the order of triangles and vertices. + /// + public static string Fingerprint(Mesh mesh) + { + string P(Vertex v) => BitConverter.DoubleToInt64Bits(v.X).ToString("x16") + BitConverter.DoubleToInt64Bits(v.Y).ToString("x16"); + + var triangles = mesh.Triangles.Select(t => + { + var v = new[] { P(t.GetVertex(0)), P(t.GetVertex(1)), P(t.GetVertex(2)) }; + int k = Array.IndexOf(v, v.Min(StringComparer.Ordinal)); + return v[k] + v[(k + 1) % 3] + v[(k + 2) % 3] + ":" + t.Label; + }).OrderBy(s => s, StringComparer.Ordinal); + + var segments = mesh.Segments.Select(s => + { + string a = P(s.GetVertex(0)), b = P(s.GetVertex(1)); + return (string.CompareOrdinal(a, b) < 0 ? a + b : b + a) + ":" + s.Label; + }).OrderBy(s => s, StringComparer.Ordinal); + + using var sha = SHA256.Create(); + var hash = sha.ComputeHash(Encoding.ASCII.GetBytes(string.Join("\n", triangles) + "\n#\n" + string.Join("\n", segments))); + + return $"V={mesh.Vertices.Count} T={mesh.Triangles.Count} S={mesh.Segments.Count} H={BitConverter.ToString(hash, 0, 8).Replace("-", "").ToLowerInvariant()}"; + } + + /// + /// A vertex inserted on a segment is rounded to the nearest representable point, so it + /// can lie a few ulps off the segment. The edges at such a vertex are not flipped (in + /// exact arithmetic they'd be Delaunay), so the exact incircle test can report a + /// violation. Detect this case: the apex, an edge vertex and the far vertex are + /// collinear up to a few ulps. + /// + private static bool IsRoundoffArtifact(Vertex a, Vertex b, Vertex apex, Vertex far) + { + foreach (var x in new[] { a, b }) + { + double dx = far.X - apex.X, dy = far.Y - apex.Y, len = Math.Sqrt(dx * dx + dy * dy); + double deviation = Math.Abs((x.X - apex.X) * dy - (x.Y - apex.Y) * dx) / len; + double ulp = 8 * Math.Max(Ulp(x.X), Ulp(x.Y)); + + if (deviation <= ulp) return true; + } + + return false; + } + + private static double Ulp(double x) => Math.BitIncrement(Math.Abs(x)) - Math.Abs(x); + + public static double Area(ITriangle t) + { + Point p = t.GetVertex(0), q = t.GetVertex(1), r = t.GetVertex(2); + return 0.5 * ((q.X - p.X) * (r.Y - p.Y) - (r.X - p.X) * (q.Y - p.Y)); + } + + public static double MinimumAngle(ITriangle t) + { + double min = 180; + + for (int i = 0; i < 3; i++) + { + Point a = t.GetVertex(i), b = t.GetVertex((i + 1) % 3), c = t.GetVertex((i + 2) % 3); + double ux = b.X - a.X, uy = b.Y - a.Y, vx = c.X - a.X, vy = c.Y - a.Y; + min = Math.Min(min, Math.Atan2(Math.Abs(ux * vy - uy * vx), ux * vx + uy * vy) * 180 / Math.PI); + } + + return min; + } + + private static (double, double, double, double) Key(Point a, Point b) + { + return a.X < b.X || (a.X == b.X && a.Y < b.Y) ? (a.X, a.Y, b.X, b.Y) : (b.X, b.Y, a.X, a.Y); + } + + private static double Scale(IPolygon input) + { + var b = input.Bounds(); + return new[] { b.Left, b.Right, b.Top, b.Bottom }.Max(Math.Abs) + Math.Max(b.Width, b.Height); + } + + private static bool IsCovered(List<(Vertex, Vertex)> subsegs, Point p0, Point p1, double tol) + { + double dx = p1.X - p0.X, dy = p1.Y - p0.Y, len = Math.Sqrt(dx * dx + dy * dy); + + if (len == 0) return true; + + var intervals = new List<(double, double)>(); + + foreach (var (a, b) in subsegs) + { + if (Distance(a, p0, p1) > tol || Distance(b, p0, p1) > tol) continue; + + double ta = ((a.X - p0.X) * dx + (a.Y - p0.Y) * dy) / len; + double tb = ((b.X - p0.X) * dx + (b.Y - p0.Y) * dy) / len; + double s = Math.Max(0, Math.Min(ta, tb)), e = Math.Min(len, Math.Max(ta, tb)); + + if (e > s) intervals.Add((s, e)); + } + + intervals.Sort(); + + double covered = 0, end = double.NegativeInfinity; + + foreach (var (s, e) in intervals) + { + if (e <= end) continue; + covered += e - Math.Max(s, end); + end = e; + } + + return Math.Abs(covered - len) <= tol * 10 + len * 1e-9; + } + + private static double Distance(Point v, Point p, Point q) + { + double dx = q.X - p.X, dy = q.Y - p.Y, l2 = dx * dx + dy * dy; + double t = l2 == 0 ? 0 : Math.Max(0, Math.Min(1, ((v.X - p.X) * dx + (v.Y - p.Y) * dy) / l2)); + double ex = p.X + t * dx - v.X, ey = p.Y + t * dy - v.Y; + return Math.Sqrt(ex * ex + ey * ey); + } + } +} diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt new file mode 100644 index 0000000..97b2f78 --- /dev/null +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -0,0 +1,77 @@ +crossing-segments/cdt V=254 T=502 S=384 H=bf81edf07e78350b +crossing-segments/conforming V=826 T=1575 S=956 H=d68dce809dfb02b1 +crossing-segments/q20 V=965 T=1868 S=909 H=cd766e07ae7859e0 +crossing-segments/q20-locked V=660 T=1260 S=671 H=18736ebac0fe9137 +crossing-segments/q20-split1 V=840 T=1674 S=831 H=7648bb604452d0d6 +crossing-segments/q20-split2 V=292 T=578 S=384 H=3d8695cf266810d6 +crossing-segments/q25-conforming V=1805 T=3516 S=1476 H=53d733fb7263e4dd +crossing-segments/q28-legacy V=2288 T=4481 S=1421 H=231417f572d6dae6 +crossing-segments/q33 V=2765 T=5422 S=1643 H=fd4bab1e0c019495 +herne_371800_5710600/cdt V=491 T=976 S=544 H=54a5e03ff0eeac65 +herne_371800_5710600/q20 V=46384 T=92744 S=27033 H=01f5e0e243cc3b88 +herne_371800_5710600/q20-snap1cm V=8677 T=17330 S=5177 H=4352755ce1d0fcbe +herne_371800_5710600/q30-snap1cm V=18226 T=36412 S=7805 H=1e7da1df8d2dab8b +herne_373600_5709000/cdt V=1784 T=3562 S=2063 H=d7ddd7fbf8711b31 +herne_373600_5709000/q20 V=199721 T=399430 S=167413 H=2b346cc7a40d0a74 +herne_373600_5709000/q20-snap1cm V=25058 T=50089 S=16681 H=77eccba3d1a15ed3 +herne_373600_5709000/q30-snap1cm V=53621 T=107196 S=26285 H=2a7f307adbcbc52f +herne_381000_5710400/cdt V=327 T=648 S=337 H=585803801bb4cf8b +herne_381000_5710400/q20 V=873 T=1719 S=572 H=c2a78415e6c9a816 +herne_381000_5710400/q20-snap1cm V=873 T=1719 S=572 H=c2a78415e6c9a816 +herne_381000_5710400/q30-snap1cm V=1622 T=3203 S=784 H=77e26fd7c406612e +parcels-mismatch/cdt V=108 T=167 S=152 H=8e88cc31ffcacbba +parcels-mismatch/conforming V=200108 T=400049 S=200152 H=6efccf3d5846008d +parcels-mismatch/q20 V=200108 T=400108 S=200152 H=5417863646e7c5d0 +parcels-mismatch/q20-locked V=801 T=1482 S=737 H=fdbfd50a504ea2f2 +parcels-mismatch/q20-split1 V=200108 T=400167 S=200152 H=7b43b1061b86ef49 +parcels-mismatch/q20-split2 V=113 T=177 S=152 H=dcb986ada444adb6 +parcels-mismatch/q25-conforming V=200108 T=400049 S=200152 H=6efccf3d5846008d +parcels-mismatch/q28-legacy V=200108 T=400094 S=200152 H=c852544447ef6ff4 +parcels-mismatch/q33 V=200108 T=400094 S=200152 H=fb8c3a0f8067adfa +points-clustered/dwyer V=2000 T=3976 S=0 H=649e44e5c65be466 +points-clustered/incremental V=2000 T=3976 S=0 H=649e44e5c65be466 +points-clustered/q30 V=7805 T=15044 S=564 H=5f45fb5ec24bf6e7 +points-clustered/sweepline V=2000 T=3976 S=0 H=649e44e5c65be466 +points-grid/dwyer V=1600 T=3042 S=0 H=feff1717255601ff +points-grid/incremental V=1600 T=3042 S=0 H=60478d3ad5eb6646 +points-grid/q30 V=1600 T=3042 S=156 H=fe9d78aceb8acda4 +points-grid/sweepline V=1600 T=3042 S=0 H=e86b86057f825335 +points-random/dwyer V=3000 T=5980 S=0 H=68345fc2ad9d8fb5 +points-random/incremental V=3000 T=5980 S=0 H=68345fc2ad9d8fb5 +points-random/q30 V=7069 T=13679 S=457 H=fff702d196455123 +points-random/sweepline V=3000 T=5980 S=0 H=68345fc2ad9d8fb5 +points-utm/dwyer V=2000 T=3979 S=0 H=23343a853965d5a8 +points-utm/incremental V=2000 T=3979 S=0 H=23343a853965d5a8 +points-utm/q30 V=4907 T=9411 S=401 H=9d7598274860ce32 +points-utm/sweepline V=2000 T=3979 S=0 H=23343a853965d5a8 +regions/q25-variable-area V=463 T=861 S=92 H=94d37520ac45974f +square-hole/cdt V=8 T=8 S=8 H=d3cbe572ce5dd341 +square-hole/conforming V=12 T=12 S=12 H=588f772472ed13c9 +square-hole/q20 V=12 T=12 S=12 H=588f772472ed13c9 +square-hole/q20-locked V=8 T=8 S=8 H=d3cbe572ce5dd341 +square-hole/q20-split1 V=8 T=8 S=8 H=d3cbe572ce5dd341 +square-hole/q20-split2 V=8 T=8 S=8 H=d3cbe572ce5dd341 +square-hole/q25-conforming V=12 T=12 S=12 H=588f772472ed13c9 +square-hole/q28-legacy V=12 T=12 S=12 H=588f772472ed13c9 +square-hole/q33 V=12 T=12 S=12 H=588f772472ed13c9 +square/q20-area V=162 T=280 S=44 H=8a117daac27c7154 +square/refine-twice V=398 T=711 S=85 H=dd221b6c4fffc0ce +square/smooth V=91 T=140 S=42 H=5d33718df5e1431a +star/cdt V=29 T=52 S=28 H=5bc51ce8a1a2dccd +star/conforming V=41 T=64 S=40 H=995ef7419a113eb9 +star/q20 V=73 T=132 S=57 H=ab2301bf2fe73b12 +star/q20-locked V=49 T=84 S=36 H=0bc39207f1f5f124 +star/q20-split1 V=54 T=102 S=49 H=932863524c089401 +star/q20-split2 V=33 T=60 S=28 H=46b9bb857ec5a8d1 +star/q25-conforming V=119 T=220 S=82 H=9c180df1bfdb281f +star/q28-legacy V=217 T=402 S=104 H=713f81fc266ce714 +star/q33 V=175 T=318 S=95 H=4842c2404cb50c07 +utm-breaklines/cdt V=472 T=938 S=164 H=7dd74060ee3f73cf +utm-breaklines/conforming V=745 T=1392 S=437 H=469273a785ce5031 +utm-breaklines/q20 V=994 T=1911 S=377 H=f2bd7f6462bcee59 +utm-breaklines/q20-locked V=840 T=1602 S=312 H=fd3e4981d9bf9ff0 +utm-breaklines/q20-split1 V=900 T=1794 S=306 H=6016275b703bca6b +utm-breaklines/q20-split2 V=574 T=1142 S=164 H=e676886a86201859 +utm-breaklines/q25-conforming V=1440 T=2761 S=548 H=0e9c30ea67a8421a +utm-breaklines/q28-legacy V=1973 T=3836 S=530 H=4c9fa8625248c6c7 +utm-breaklines/q33 V=2260 T=4391 S=608 H=e424fbc1bb925618 diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index 0225e74..9f6e6b2 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -66,6 +66,7 @@ Vertex V((double, double) p) double scale = Math.Max(mag + w, Math.Max(b.Width, b.Height) + 2 * w); Mesh mesh; + var watch = System.Diagnostics.Stopwatch.StartNew(); try { @@ -82,6 +83,8 @@ Vertex V((double, double) p) return "EXCEPTION " + ex.GetType().Name + ": " + ex.Message; } + watch.Stop(); + if (!MeshValidator.IsConsistent(mesh)) { return "INCONSISTENT"; @@ -117,7 +120,27 @@ Vertex V((double, double) p) return $"SEGMENTS_MISSING {missing}"; } - return $"OK triangles={mesh.Triangles.Count}"; + // Quality statistics (no failure: small input angles can't be fixed, and the + // Steiner point limit may stop the refinement). + int bad = minAngle > 0 ? mesh.Triangles.Count(t => MinimumAngle(t) < minAngle - 0.01) : 0; + bool limit = minAngle > 0 && mesh.Vertices.Count - poly.Points.Count >= steinerPoints; + + return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)}"; + } + + private static double MinimumAngle(Topology.Triangle t) + { + double min = 180; + + for (int i = 0; i < 3; i++) + { + Point a = t.GetVertex(i), b = t.GetVertex((i + 1) % 3), c = t.GetVertex((i + 2) % 3); + double ux = b.X - a.X, uy = b.Y - a.Y, vx = c.X - a.X, vy = c.Y - a.Y; + double angle = Math.Atan2(Math.Abs(ux * vy - uy * vx), ux * vx + uy * vy) * 180 / Math.PI; + min = Math.Min(min, angle); + } + + return min; } private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, double tol) diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index 49bfc26..ea9eb0a 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -26,6 +26,7 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) + /// TRIANGLE_CORPUS_ANGLES comma separated minimum angles (default 0,20; 0 = no quality) /// /// Run: dotnet test --filter TestCategory=Corpus /// @@ -134,7 +135,7 @@ private static void RunCases(IEnumerable cases) var results = new ConcurrentBag<(string Name, double MinAngle, string Result)>(); - var jobs = files.SelectMany(f => new[] { (f, 0.0), (f, 20.0) }); + var jobs = files.SelectMany(f => Angles().Select(a => (f, a))); Parallel.ForEach(jobs, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, job => { @@ -161,6 +162,20 @@ private static void RunCases(IEnumerable cases) TestContext.Out.WriteLine($" min angle {g.Key.MinAngle}: {g.Key.Item2} x {g.Count()}"); } + foreach (var g in results.Where(r => r.Result.StartsWith("OK")).GroupBy(r => r.MinAngle).OrderBy(g => g.Key)) + { + var stats = g.Select(r => (r.Name, Stats: Stats(r.Result))).ToList(); + + TestContext.Out.WriteLine($" min angle {g.Key}: total {stats.Sum(r => r.Stats["ms"]) / 1000:F1} s, " + + $"{stats.Sum(r => r.Stats["triangles"])} triangles, Steiner limit reached x {stats.Count(r => r.Stats["limit"] > 0)}, " + + $"cases with bad triangles x {stats.Count(r => r.Stats["bad"] > 0)}"); + + foreach (var r in stats.OrderByDescending(r => r.Stats["ms"]).Take(5)) + { + TestContext.Out.WriteLine($" slow: {r.Name} {r.Stats["ms"]} ms, {r.Stats["triangles"]} triangles, bad {r.Stats["bad"]}"); + } + } + foreach (var f in failures) { TestContext.Out.WriteLine($" {f.Name} (min angle {f.MinAngle}): {f.Result}"); @@ -169,6 +184,14 @@ private static void RunCases(IEnumerable cases) Assert.That(failures, Is.Empty, string.Join("\n", failures.Take(50).Select(f => $"{f.Name} (min angle {f.MinAngle}): {f.Result}"))); } + private static Dictionary Stats(string result) => + result.Split(' ').Select(t => t.Split('=')).Where(t => t.Length == 2) + .ToDictionary(t => t[0], t => long.Parse(t[1], CultureInfo.InvariantCulture)); + + private static double[] Angles() => + (Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_ANGLES") ?? "0,20").Split(',') + .Select(a => double.Parse(a, CultureInfo.InvariantCulture)).ToArray(); + private static double SnapTolerance() => double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_SNAP"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 0.0; diff --git a/src/Triangle.Tests/Robustness/AcuteRefinementTest.cs b/src/Triangle.Tests/Robustness/AcuteRefinementTest.cs new file mode 100644 index 0000000..e340877 --- /dev/null +++ b/src/Triangle.Tests/Robustness/AcuteRefinementTest.cs @@ -0,0 +1,85 @@ +using NUnit.Framework; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tests.Characterization; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Bugs of the aCute refinement (default since 2022, + /// = false). All of them exist in upstream Triangle.NET. + /// + public class AcuteRefinementTest + { + private static Polygon Square(double size = 10) + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(size, 0), new Vertex(size, size), new Vertex(0, size) }, 1)); + return poly; + } + + /// + /// The aCute location doesn't necessarily destroy the bad triangle (it may lie + /// outside the circumcircle). The triangle was then dropped from the queue and stayed + /// in the mesh: upstream leaves 9 triangles larger than the maximum area here. + /// + [Test] + public void MaximumAreaIsRespected([Values(0, 20, 30)] double minAngle, [Values(false, true)] bool legacy) + { + var mesh = Square().Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = minAngle, MaximumArea = 0.5, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.5), Is.Zero); + } + + /// + /// Same cause as , for the angle: on real parcel + /// data (ALKIS Herne) upstream leaves 618 of 2061 triangles below 30°. + /// + [Test] + public void BadTrianglesAreNotDropped() + { + var c = MeshCases.All().First(x => x.Name == "herne_381000_5710400/q30-snap1cm"); + var mesh = c.Run(c.Input()); + + MeshAssert.IsValid(mesh); + + // Remaining bad triangles are at small input angles (few). + int bad = mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < 30 - 1e-6); + Assert.That(bad, Is.LessThan(20)); + } + + /// + /// Area constraints of regions: aCute relocated (deleted and re-inserted) the same + /// vertex back and forth. Upstream throws "The new vertex is at the circumcenter of + /// triangle", with the first fixes the refinement cycled until the Steiner point + /// limit and returned a coarse mesh (5 triangles). + /// + [Test] + public void RegionAreaConstraint([Values(false, true)] bool diagonal) + { + var poly = Square(); + + if (diagonal) + { + poly.Add(new Segment(poly.Points[0], poly.Points[2], 3)); + } + + poly.Regions.Add(new RegionPointer(7, 2, 1, 0.1)); + poly.Regions.Add(new RegionPointer(2, 7, 2, 2.0)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, VariableArea = true, SteinerPoints = 100000 })); + + MeshAssert.IsValid(mesh); + + double limit = diagonal ? 0.1 : 2.0; + + Assert.That(mesh.Triangles.Where(t => !diagonal || t.Label == 1).Count(t => MeshInvariants.Area(t) > limit * (1 + 1e-9)), Is.Zero); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < 25 - 1e-6), Is.Zero); + Assert.That(mesh.Vertices.Count, Is.LessThan(5000)); + } + } +} diff --git a/src/Triangle.Tests/Triangle.Tests.csproj b/src/Triangle.Tests/Triangle.Tests.csproj index de63911..7461677 100644 --- a/src/Triangle.Tests/Triangle.Tests.csproj +++ b/src/Triangle.Tests/Triangle.Tests.csproj @@ -19,6 +19,10 @@ + + + + diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 2d0a97d..d995ef2 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -743,15 +743,21 @@ private void SplitTriangle(BadTriangle badtri) if (!Otri.IsDead(badotri.tri) && (borg == badtri.org) && (bdest == badtri.dest) && (bapex == badtri.apex)) { - // If the aCute location coincides with an existing vertex, fall back to - // the circumcenter (classic Delaunay refinement). + // If the aCute location coincides with an existing vertex, or if it doesn't + // destroy the bad triangle (the aCute location may lie outside the + // circumcircle, so e.g. a too large triangle would remain and never be + // tested again), fall back to the circumcenter (classic Delaunay refinement). + bool survived = false; + bool relocated = false; + for (int attempt = 0; attempt < 2; attempt++) { bool useAcute = enableAcute && attempt == 0; if (attempt > 0) { - if (!errorflag || !enableAcute) + // After a relocation the bad triangle doesn't exist anymore. + if (!(errorflag || survived) || !enableAcute || relocated) { break; } @@ -762,11 +768,22 @@ private void SplitTriangle(BadTriangle badtri) errorflag = false; // Create a new vertex at the triangle's circumcenter. + newloc = null; + if (useAcute) { newloc = newLocation.FindLocation(borg, bdest, bapex, ref xi, ref eta, true, badotri); + relocated = newLocation.Relocated; + + // A relocation already deleted a vertex, so the location must be used. + if (!relocated && !IsAcuteLocationValid(borg, bdest, bapex, newloc)) + { + useAcute = false; + newloc = null; + } } - else + + if (newloc == null) { newloc = predicates.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant); } @@ -843,6 +860,13 @@ private void SplitTriangle(BadTriangle badtri) { mesh.steinerleft--; } + + if (relocated) + { + newLocation.MarkRelocated(newvertex); + } + + survived = useAcute && !relocated && mesh.steinerleft != 0 && IsAlive(badtri); } else if (success == InsertVertexResult.Encroaching) { @@ -880,6 +904,43 @@ private void SplitTriangle(BadTriangle badtri) } } + /// + /// Returns true, if the aCute location can be used to refine the triangle: it must lie + /// strictly inside the circumcircle (otherwise inserting it doesn't destroy the triangle) + /// and not (almost) on one of the triangle's vertices (otherwise it creates degenerate + /// triangles, which are refined again and again). + /// + private bool IsAcuteLocationValid(Vertex org, Vertex dest, Vertex apex, Point p) + { + if (p == null || double.IsNaN(p.x) || double.IsNaN(p.y) || + predicates.InCircle(org, dest, apex, p) <= 0.0) + { + return false; + } + + double shortest = Math.Min(Distance2(org, dest), Math.Min(Distance2(dest, apex), Distance2(apex, org))); + double tolerance = 1e-4 * shortest; + + return Distance2(p, org) > tolerance && Distance2(p, dest) > tolerance && Distance2(p, apex) > tolerance; + } + + private static double Distance2(Point a, Point b) + { + double dx = a.x - b.x, dy = a.y - b.y; + return dx * dx + dy * dy; + } + + /// + /// Returns true, if the triangle still exists (unchanged). + /// + private static bool IsAlive(BadTriangle badtri) + { + var tri = badtri.poortri; + + return !Otri.IsDead(tri.tri) && tri.Org() == badtri.org && + tri.Dest() == badtri.dest && tri.Apex() == badtri.apex; + } + /// /// Returns true, if the given subsegment may be split. /// diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 4e09f54..e01f1ce 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -27,6 +27,25 @@ class NewLocation Mesh mesh; Behavior behavior; + // Vertices created by relocation. They are not relocated again, otherwise the same + // vertex can be moved back and forth forever without refining the mesh. + readonly System.Collections.Generic.HashSet relocatedVertices = new System.Collections.Generic.HashSet(); + + /// + /// Gets a value indicating whether the last call to deleted + /// a vertex of the triangle to relocate it (the returned location is the new position + /// of the deleted vertex, and the triangle doesn't exist anymore). + /// + internal bool Relocated { get; private set; } + + /// + /// Mark a vertex inserted at a relocated position. + /// + internal void MarkRelocated(Vertex v) + { + relocatedVertices.Add(v); + } + // Work arrays for wegde intersection double[] petalx = new double[20]; double[] petaly = new double[20]; @@ -66,6 +85,8 @@ public NewLocation(Mesh mesh, IPredicates predicates) public Point FindLocation(Vertex org, Vertex dest, Vertex apex, ref double xi, ref double eta, bool offcenter, Otri badotri) { + Relocated = false; + // Based on using -U switch, call the corresponding function if (behavior.MaxAngle == 0.0) { @@ -390,6 +411,7 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t if (relocated > 0) { Statistic.RelocationCount++; + Relocated = true; dx = newloc[0] - torg.x; dy = newloc[1] - torg.y; @@ -1090,6 +1112,7 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, if (relocated > 0) { Statistic.RelocationCount++; + Relocated = true; dx = newloc[0] - torg.x; dy = newloc[1] - torg.y; @@ -2067,7 +2090,7 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, // m.counterclockcount--; // INTERSECTION OF PETALS // first check whether the star angles are appropriate for relocation - if (torg.type == VertexType.FreeVertex && numpoints_p != 0 && ValidPolygonAngles(numpoints_p, points_p)) + if (torg.type == VertexType.FreeVertex && !relocatedVertices.Contains(torg) && numpoints_p != 0 && ValidPolygonAngles(numpoints_p, points_p)) { //newLocFound = getPetalIntersection(m, b, numpoints_p, points_p, newloc); //newLocFound = getPetalIntersectionBruteForce(m, b,numpoints_p, points_p, newloc,torg[0],torg[1]); @@ -2112,7 +2135,7 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, // m.counterclockcount--; // INTERSECTION OF PETALS // first check whether the star angles are appropriate for relocation - if (tdest.type == VertexType.FreeVertex && numpoints_q != 0 && ValidPolygonAngles(numpoints_q, points_q)) + if (tdest.type == VertexType.FreeVertex && !relocatedVertices.Contains(tdest) && numpoints_q != 0 && ValidPolygonAngles(numpoints_q, points_q)) { //newLocFound = getPetalIntersection(m, b,numpoints_q, points_q, newloc); //newLocFound = getPetalIntersectionBruteForce(m, b,numpoints_q, points_q, newloc,tapex[0],tapex[1]); @@ -2158,7 +2181,7 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, // m.counterclockcount--; // INTERSECTION OF PETALS // first check whether the star angles are appropriate for relocation - if (tapex.type == VertexType.FreeVertex && numpoints_r != 0 && ValidPolygonAngles(numpoints_r, points_r)) + if (tapex.type == VertexType.FreeVertex && !relocatedVertices.Contains(tapex) && numpoints_r != 0 && ValidPolygonAngles(numpoints_r, points_r)) { //newLocFound = getPetalIntersection(m, b,numpoints_r, points_r, newloc); //newLocFound = getPetalIntersectionBruteForce(m, b,numpoints_r, points_r, newloc,tdest[0],tdest[1]); From b44665ed8b6819bfcdb873000e3e3f0915c87990 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 02:59:41 +0000 Subject: [PATCH 08/50] Noder: crossings merged into an endpoint don't split (or retire) the segment A crossing close to a segment endpoint was merged into that endpoint and the segment was 'split' there. Nothing changed, but the segment was retired, so snapping a nearly collinear vertex into it was blocked. Two segments with an angle of 0.0002 degrees remained, and quality refinement spent the whole Steiner point budget in that wedge (ALKIS Herne, parcels + buildings + land use, 1 cm snapping: tile with 203,175 triangles, 154,870 below 20 degrees -> 24,355 triangles, 222 below 20 degrees). The useless splits also used up the noding iterations: stacked squares with offsets of 1e-6 now converge. Also: BenchmarkDotNet project on the characterization scenarios, corpus summary with total bad triangles and the worst cases. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Benchmarks/MeshingBenchmark.cs | 54 ++++++++++++++++ src/Triangle.Benchmarks/Program.cs | 20 ++++++ .../Triangle.Benchmarks.csproj | 25 ++++++++ .../Characterization/golden.txt | 4 +- src/Triangle.Tests/Corpus/CorpusTest.cs | 7 +- .../Robustness/NodingAndRefinementTest.cs | 64 +++++++++++++++++-- src/Triangle.sln | 32 ++++++++++ src/Triangle/Meshing/SegmentNoder.cs | 14 +++- 8 files changed, 210 insertions(+), 10 deletions(-) create mode 100644 src/Triangle.Benchmarks/MeshingBenchmark.cs create mode 100644 src/Triangle.Benchmarks/Program.cs create mode 100644 src/Triangle.Benchmarks/Triangle.Benchmarks.csproj diff --git a/src/Triangle.Benchmarks/MeshingBenchmark.cs b/src/Triangle.Benchmarks/MeshingBenchmark.cs new file mode 100644 index 0000000..e405fcf --- /dev/null +++ b/src/Triangle.Benchmarks/MeshingBenchmark.cs @@ -0,0 +1,54 @@ +using BenchmarkDotNet.Attributes; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Tests.Characterization; + +namespace TriangleNet.Benchmarks +{ + /// + /// Runs scenarios of . The time includes creating the input + /// (small compared to meshing), because the mesher modifies its input. + /// + [MemoryDiagnoser] + public class MeshingBenchmark + { + /// + /// Representative scenarios: Delaunay of point sets, constrained/quality meshing of + /// synthetic and real data, refinement with area constraints, smoothing. + /// + public static readonly string[] Representative = + { + "points-random/dwyer", + "points-utm/sweepline", + "points-grid/dwyer", + "points-random/q30", + "crossing-segments/q20", + "utm-breaklines/q33", + "parcels-mismatch/q20", + "regions/q25-variable-area", + "square/smooth", + "herne_371800_5710600/q20-snap1cm", + "herne_373600_5709000/q20-snap1cm", + "herne_373600_5709000/q30-snap1cm", + }; + + private MeshCases.Case scenario; + + public IEnumerable Scenarios() => Representative; + + [ParamsSource(nameof(Scenarios))] + public string Scenario { get; set; } + + [GlobalSetup] + public void Setup() + { + scenario = MeshCases.All().First(c => c.Name == Scenario); + } + + [Benchmark] + public int Mesh() + { + return scenario.Run(scenario.Input()).Triangles.Count; + } + } +} diff --git a/src/Triangle.Benchmarks/Program.cs b/src/Triangle.Benchmarks/Program.cs new file mode 100644 index 0000000..f174957 --- /dev/null +++ b/src/Triangle.Benchmarks/Program.cs @@ -0,0 +1,20 @@ +using BenchmarkDotNet.Running; + +namespace TriangleNet.Benchmarks +{ + /// + /// Benchmarks for performance work. Correctness is guarded by the characterization tests + /// (Triangle.Tests/Characterization): run them before and after every optimization. + /// + /// + /// dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*" + /// dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*" --job short + /// + public static class Program + { + public static void Main(string[] args) + { + BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); + } + } +} diff --git a/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj b/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj new file mode 100644 index 0000000..20dd07c --- /dev/null +++ b/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj @@ -0,0 +1,25 @@ + + + + Exe + net10.0 + TriangleNet.Benchmarks + false + + + + + + + + + + + + + + + + + + diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt index 97b2f78..ae042ef 100644 --- a/src/Triangle.Tests/Characterization/golden.txt +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -9,8 +9,8 @@ crossing-segments/q28-legacy V=2288 T=4481 S=1421 H=231417f572d6dae6 crossing-segments/q33 V=2765 T=5422 S=1643 H=fd4bab1e0c019495 herne_371800_5710600/cdt V=491 T=976 S=544 H=54a5e03ff0eeac65 herne_371800_5710600/q20 V=46384 T=92744 S=27033 H=01f5e0e243cc3b88 -herne_371800_5710600/q20-snap1cm V=8677 T=17330 S=5177 H=4352755ce1d0fcbe -herne_371800_5710600/q30-snap1cm V=18226 T=36412 S=7805 H=1e7da1df8d2dab8b +herne_371800_5710600/q20-snap1cm V=4488 T=8952 S=2718 H=29dfa4cc0161165b +herne_371800_5710600/q30-snap1cm V=9347 T=18654 S=4086 H=3f6d2e1acf519aac herne_373600_5709000/cdt V=1784 T=3562 S=2063 H=d7ddd7fbf8711b31 herne_373600_5709000/q20 V=199721 T=399430 S=167413 H=2b346cc7a40d0a74 herne_373600_5709000/q20-snap1cm V=25058 T=50089 S=16681 H=77eccba3d1a15ed3 diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index ea9eb0a..cf203e9 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -168,12 +168,17 @@ private static void RunCases(IEnumerable cases) TestContext.Out.WriteLine($" min angle {g.Key}: total {stats.Sum(r => r.Stats["ms"]) / 1000:F1} s, " + $"{stats.Sum(r => r.Stats["triangles"])} triangles, Steiner limit reached x {stats.Count(r => r.Stats["limit"] > 0)}, " + - $"cases with bad triangles x {stats.Count(r => r.Stats["bad"] > 0)}"); + $"bad triangles {stats.Sum(r => r.Stats["bad"])} ({100.0 * stats.Sum(r => r.Stats["bad"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %) in {stats.Count(r => r.Stats["bad"] > 0)} cases"); foreach (var r in stats.OrderByDescending(r => r.Stats["ms"]).Take(5)) { TestContext.Out.WriteLine($" slow: {r.Name} {r.Stats["ms"]} ms, {r.Stats["triangles"]} triangles, bad {r.Stats["bad"]}"); } + + foreach (var r in stats.OrderByDescending(r => r.Stats["bad"]).Take(5)) + { + TestContext.Out.WriteLine($" worst: {r.Name} bad {r.Stats["bad"]} of {r.Stats["triangles"]} triangles, {r.Stats["ms"]} ms"); + } } foreach (var f in failures) diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs index b3546f5..5bf6105 100644 --- a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -181,14 +181,26 @@ public void StackedNearlyIdenticalSquares([Values(1e-10, 1e-8)] double offset) } [Test] - public void StackedNearlyIdenticalSquaresBeyondTolerance() + [Description("Fixed: offsets larger than the maximum snap tolerance made noding fail (crossings merged into " + + "segment endpoints counted as splits and used up the iterations).")] + public void StackedNearlyIdenticalSquaresBeyondTolerance([Values(1e-6, 1e-5, 1e-4)] double offset) { - // Offsets larger than the maximum snap tolerance: noding can't converge in - // reasonable time, which must be reported (instead of running forever). + var poly = StackedSquares(offset); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(), LongTimeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100, 1e-9); + } + + [Test] + public void NodingThatDoesNotConvergeIsReported() + { + // If noding doesn't converge (here: only one iteration allowed), this must be + // reported instead of running forever or returning crossing segments. var poly = StackedSquares(1e-6); - var e = Assert.Throws(() => MeshAssert.Terminates(() => poly.Triangulate(), LongTimeout)); - Assert.That(e.InnerException, Is.InstanceOf()); + Assert.Throws(() => SegmentNoder.Node(poly, new RobustPredicates(), maxIterations: 1)); } [Test] @@ -269,5 +281,47 @@ public void SnapCycle() MeshAssert.IsValid(mesh); MeshAssert.HasArea(mesh, 4, 1e-9); } + + [Test] + [Description("Fixed: a crossing merged into a segment endpoint 'split' the segment at its endpoint and blocked snapping into it. " + + "The nearly collinear segments (0.0002°) remained and quality refinement spent 97,000 Steiner points in this wedge (ALKIS Herne).")] + public void CrossingAtEndpointDoesNotBlockSnapping() + { + // Land use boundary and building edge (ALKIS Herne), sharing S; B is 0.02 mm from S-A. + // The third segment passes S at about 1 mm and crosses both close to S. + var s = new Vertex(377985.407, 5710096.824); + var a = new Vertex(377981.985, 5710100.365); + var b = new Vertex(377982.302, 5710100.037); + var c = new Vertex(377983.573, 5710095.053); + var d = new Vertex(377997.164, 5710108.182); + + var poly = new Polygon(); + foreach (var v in new[] { s, a, b, c, d }) poly.Add(v); + poly.Add(new Segment(s, a)); + poly.Add(new Segment(b, s)); + poly.Add(new Segment(c, d)); + + var noded = SegmentNoder.Node(poly, new RobustPredicates(), minTolerance: 0.01); + + // S-A is split at B, so S-B is shared and there is no tiny angle at S. + Assert.That(noded.Segments.Any(x => Connects(x, s, a)), Is.False); + Assert.That(noded.Segments.Any(x => Connects(x, b, a)), Is.True); + + poly.Add(TestData.Square(377970, 5710085, 40)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SnapTolerance = 0.01 }, + new QualityOptions { MinimumAngle = 20, SteinerPoints = 100000 }), LongTimeout); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count, Is.LessThan(2000)); + } + + private static bool Connects(ISegment seg, Vertex p, Vertex q) + { + Point u = seg.GetVertex(0), v = seg.GetVertex(1); + + return (u.X == p.X && u.Y == p.Y && v.X == q.X && v.Y == q.Y) || + (u.X == q.X && u.Y == q.Y && v.X == p.X && v.Y == p.Y); + } } } diff --git a/src/Triangle.sln b/src/Triangle.sln index e69823c..326e38c 100644 --- a/src/Triangle.sln +++ b/src/Triangle.sln @@ -11,46 +11,78 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Triangle.Examples", "Triang EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Triangle.Rendering", "Triangle.Rendering\Triangle.Rendering.csproj", "{20D64FA8-EC38-4507-9D99-96F855ED62C0}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Triangle.Benchmarks", "Triangle.Benchmarks\Triangle.Benchmarks.csproj", "{52A7E760-562D-43DA-BFBF-DAA31B377C6C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|Any CPU.Build.0 = Debug|Any CPU {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|x64.ActiveCfg = Debug|x64 {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|x64.Build.0 = Debug|x64 + {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|x86.ActiveCfg = Debug|Any CPU + {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Debug|x86.Build.0 = Debug|Any CPU {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|Any CPU.ActiveCfg = Release|Any CPU {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|Any CPU.Build.0 = Release|Any CPU {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|x64.ActiveCfg = Release|x64 {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|x64.Build.0 = Release|x64 + {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|x86.ActiveCfg = Release|Any CPU + {F7907A0A-B75F-400B-9E78-BFAD00DB4D6B}.Release|x86.Build.0 = Release|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|Any CPU.Build.0 = Debug|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|x64.ActiveCfg = Debug|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|x64.Build.0 = Debug|Any CPU + {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|x86.ActiveCfg = Debug|Any CPU + {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Debug|x86.Build.0 = Debug|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|Any CPU.ActiveCfg = Release|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|Any CPU.Build.0 = Release|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|x64.ActiveCfg = Release|Any CPU {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|x64.Build.0 = Release|Any CPU + {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|x86.ActiveCfg = Release|Any CPU + {67CCA496-DCD1-4D43-85D5-0A19A3948774}.Release|x86.Build.0 = Release|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|Any CPU.Build.0 = Debug|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|x64.ActiveCfg = Debug|x64 {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|x64.Build.0 = Debug|x64 + {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|x86.ActiveCfg = Debug|Any CPU + {70EC2A88-E7CC-4678-9936-ED539969B003}.Debug|x86.Build.0 = Debug|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|Any CPU.ActiveCfg = Release|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|Any CPU.Build.0 = Release|Any CPU {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|x64.ActiveCfg = Release|x64 {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|x64.Build.0 = Release|x64 + {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|x86.ActiveCfg = Release|Any CPU + {70EC2A88-E7CC-4678-9936-ED539969B003}.Release|x86.Build.0 = Release|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|x64.ActiveCfg = Debug|x64 {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|x64.Build.0 = Debug|x64 + {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|x86.ActiveCfg = Debug|Any CPU + {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Debug|x86.Build.0 = Debug|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|Any CPU.ActiveCfg = Release|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|Any CPU.Build.0 = Release|Any CPU {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|x64.ActiveCfg = Release|x64 {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|x64.Build.0 = Release|x64 + {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|x86.ActiveCfg = Release|Any CPU + {20D64FA8-EC38-4507-9D99-96F855ED62C0}.Release|x86.Build.0 = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|x64.ActiveCfg = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|x64.Build.0 = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|x86.ActiveCfg = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Debug|x86.Build.0 = Debug|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|Any CPU.Build.0 = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|x64.ActiveCfg = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|x64.Build.0 = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|x86.ActiveCfg = Release|Any CPU + {52A7E760-562D-43DA-BFBF-DAA31B377C6C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index f6b3d67..eb43af9 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -357,8 +357,18 @@ private static void AddIntersections(List segments, List<(int, int)> c var v = GetOrCreateVertex(x, y, s.Label, vertices, newPoints); - AddSplit(splits, i, Parameter(a, b, v), v); - AddSplit(splits, j, Parameter(c, d, v), v); + // The intersection may be merged with an endpoint of a segment. That's no split + // of this segment (and it must not be retired: snapping a nearly collinear + // vertex into it would be blocked, leaving a tiny angle between the segments). + if (!SameLocation(v, a) && !SameLocation(v, b)) + { + AddSplit(splits, i, Parameter(a, b, v), v); + } + + if (!SameLocation(v, c) && !SameLocation(v, d)) + { + AddSplit(splits, j, Parameter(c, d, v), v); + } } } From 41d4910a222816ca452268c4b6e9ec7a55adca6e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 03:18:47 +0000 Subject: [PATCH 09/50] Docs: quality refinement fixes, ALKIS/DGM results, safety net and benchmark baseline Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 104 +++++++++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 3 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index eb28a28..56d32e3 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -6,6 +6,12 @@ Eingaben und Gleitkomma-Grenzfällen. > **Update:** Alle Befunde sind inzwischen behoben, siehe [Abschnitt „Fixes“](#fixes). Die > Analyse unten beschreibt den Zustand **vor** den Fixes. Die Bewertung des alten, > angepassten Stands steht in [Alter-Stand-Bewertung.md](Alter-Stand-Bewertung.md). +> +> **Zweite Runde (Qualitätsvermaschung):** Drei Fehler der aCute-Verfeinerung (auch in Upstream) +> und ein Noder-Fehler beim Snapping sind behoben; auf ALKIS-Daten (Flurstücke, Gebäude, Nutzung) +> sank der Anteil schlechter Dreiecke von 8,7 % auf 1,1 %. Siehe +> [Ergebnisse mit echten Daten](#ergebnisse-mit-echten-daten-alkis-und-dgm1-herne-opengeodatanrwde) +> und [Absicherung für Performance-Arbeit](#absicherung-für-performance-arbeit-srctriangletestscharacterization). ## Kurzfazit @@ -172,6 +178,9 @@ paralleles Vermaschen mit eigenen Prädikaten. | neu | **Präzisionsgrenze bei der Verfeinerung:** Würde das Teilen eines Segments (mit exakter Prüfung) ein flaches/invertiertes Dreieck erzeugen oder fällt der Teilungspunkt auf einen Endpunkt, wird das Teilsegment nicht geteilt und für den Rest der Verfeinerung gesperrt (statt still invertierter Dreiecke bzw. „Ran out of precision“). Zu kleine Dreiecke bleiben stehen (statt „new vertex at circumcenter“). Abschließende Orientierungsprüfung → laute Exception statt ungültigem Netz. | `Meshing/QualityMesher.cs` | | neu | **`ConstraintOptions.SnapTolerance`** (Standard 0 = automatisch): Mindesttoleranz des Noders in Koordinateneinheiten, passend zur Datengenauigkeit (z. B. `0.01` = 1 cm). Fast deckungsgleiche Linien (Gebäude an Flurstücksgrenzen, doppelt digitalisierte Grenzen) werden zusammengeführt statt zu Slivers vermascht. Die Geometrie ändert sich dabei um höchstens die Toleranz. | `Meshing/ConstraintOptions.cs`, `Meshing/SegmentNoder.cs` | | neu | Snap-Zyklus: Bei großer Toleranz konnte ein Punkt in ein Segment gesnappt werden, dessen Teilstück dann den ursprünglichen Endpunkt wieder einfing (Endlosschleife bis zum Iterationslimit → Exception). Bereits geteilte Segmente werden jetzt nicht erneut aus ihren Teilstücken erzeugt. | `Meshing/SegmentNoder.cs` | +| neu | **aCute: schlechte Dreiecke gingen verloren.** Der aCute-Ort liegt nicht immer im Umkreis des schlechten Dreiecks; dann blieb das Dreieck nach dem Einfügen bestehen, war aber schon aus der Warteschlange entfernt. Folge: `MaximumArea` wurde verletzt (Quadrat, 20°: 9 zu große Dreiecke), und auf ALKIS-Daten blieben viele Dreiecke unter dem Mindestwinkel (Kachel 381000/5710400, 30°: **618 statt 9**, zugleich 20× langsamer). Jetzt wird ein aCute-Ort nur verwendet, wenn er echt im Umkreis und nicht (fast) auf einer Ecke liegt, und ein überlebendes Dreieck wird über den Umkreismittelpunkt geteilt. Fehler auch in Upstream. | `Meshing/QualityMesher.cs` | +| neu | **aCute: Endlosverschiebung von Punkten.** aCute verschiebt („relocation“) Punkte, indem es sie löscht und neu einfügt. Mit Flächenvorgaben pro Region wurde derselbe Punkt immer wieder hin und her verschoben. Upstream wirft „The new vertex is at the circumcenter of triangle“; nach den ersten Fixes lief die Verfeinerung bis zum Steiner-Limit und lieferte ein grobes Netz (5 Dreiecke). Jetzt wird jeder Punkt höchstens einmal verschoben. | `NewLocation.cs`, `Meshing/QualityMesher.cs` | +| neu | **Noder: Schnittpunkt am Segmentende blockierte das Snapping.** Ein Schnittpunkt nahe einem Segmentende wurde mit dem Endpunkt verschmolzen und das Segment dort „geteilt“. Das änderte nichts, markierte das Segment aber als bereits geteilt, sodass ein fast kollinearer Punkt nicht mehr hineingesnappt wurde. Zwei Segmente mit 0,0002° Zwischenwinkel blieben stehen, und die Qualitätsvermaschung verbrauchte das gesamte Steiner-Budget in diesem Keil (ALKIS Herne mit Nutzung, 1 cm: 203.175 Dreiecke, davon 154.870 unter 20° → 24.355 Dreiecke, 222 unter 20°). Die unnötigen Teilungen verbrauchten außerdem Noding-Iterationen: Gestapelte Quadrate mit 1e-6 Versatz werden jetzt vernetzt statt abgelehnt. | `Meshing/SegmentNoder.cs` | | neu | `FastExpansionSumZeroElim` las (wie das C-Original) ein Element hinter dem Ende einer Expansion; in C# eine `IndexOutOfRangeException`, ausgelöst durch unendliche Koordinaten. | `RobustPredicates.cs` | **Ergebnis (Fuzzing, jeder Fall in eigenem Prozess):** @@ -186,7 +195,7 @@ paralleles Vermaschen mit eigenen Prädikaten. | 200 Segmente auf 50er-Raster, 20° | – | 50/50 | | Nachbarflächen mit Abweichung 1e-12, 25°, **ohne** Steiner-Limit | terminiert nicht | ~30 ms | -Die Testsuite hat jetzt 234 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre +Die Testsuite hat jetzt 404 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre Regressionstests geworden. ### Externer Korpus: GEOS-Robustheitstests @@ -224,8 +233,97 @@ dotnet test src/Triangle.Tests --filter TestCategory=Corpus Die NRW-Läufe zerlegen die Flurstücke in Kacheln (vollständige Flurstücke inklusive ihrer Nachbarn, also mit doppelt digitalisierten gemeinsamen Grenzen) bzw. kombinieren ein 1-m-Raster -des DGM1 mit den Flurstücksgrenzen als Bruchkanten. In dieser Entwicklungsumgebung waren die -NRW-Portale nicht erreichbar; geprüft wurde der Ablauf mit synthetischen Daten im gleichen Format. +des DGM1 mit den Flurstücksgrenzen als Bruchkanten. `TRIANGLE_CORPUS_ANGLES` (z. B. `20,25,30,33`) +legt die Mindestwinkel fest; die Ausgabe enthält je Winkel Laufzeit, Dreiecke, Anzahl der Fälle +am Steiner-Limit, Anteil schlechter Dreiecke und die schlechtesten Kacheln. + +### Ergebnisse mit echten Daten: ALKIS und DGM1 Herne (opengeodata.nrw.de) + +201 Kacheln à 200 m (gleichmäßig über das Stadtgebiet verteilt), jeweils 20°, 25°, 30° und 33° +Mindestwinkel, 100.000 Steiner-Punkte, jeder Lauf in eigenem Prozess (Release): + +| Daten | Snap | gültig | schlechte Dreiecke 20° / 30° | vorher (vor aCute- und Noder-Fix) | +|-------|------|--------|-----------------------------|-----------------------------------| +| Flurstücke | 5 µm (auto) | 804/804 | 0,44 % / 0,47 % | nicht gemessen (Einzelkachel 381000/5710400, 30°: 618 statt 9 schlechte Dreiecke) | +| Flurstücke | 1 cm | 804/804 | 0,44 % / 0,47 % | 0,44 % / 1,08 % | +| Flurstücke + Gebäude + Nutzung | 1 cm | 804/804, kein Steiner-Limit | **1,10 % / 0,98 %** | 8,70 % / 10,74 %, 1–2 Kacheln am Steiner-Limit | +| DGM1-Raster (1 m) + Flurstücksgrenzen | 5 µm | 8/8 | – | – | + +Bei Flurstücken + Gebäuden + Nutzung ohne Snapping laufen einzelne Kacheln ans Steiner-Limit +(z. B. 400.000 statt 50.000 Dreiecke), deshalb ist 1 cm im Fallback-Adapter jetzt Standard. + +Die verbleibenden schlechten Dreiecke liegen fast alle an Segmenten, in Keilen sehr kleiner +Eingabewinkel: Linien verschiedener Ebenen (Nutzung, Gebäude, Flurstück), die über viele Meter +mit 0,01–0,1° auseinanderlaufen und erst nach mehr als 1 cm getrennt sind. Dort verfeinert +Triangle bewusst nicht weiter (sonst terminiert die Verfeinerung nicht). Abhilfe ist nur eine +größere Snap-Toleranz, also eine Datenentscheidung: In der schlechtesten Kachel sinkt der Anteil +mit 2 cm von 1.931 auf 105 schlechte Dreiecke (und halb so viele Dreiecke). + +## Absicherung für Performance-Arbeit (`src/Triangle.Tests/Characterization`) + +Performance-Optimierungen dürfen das Ergebnis nicht unbemerkt verändern. Dafür gibt es drei +Bausteine, die alle auf demselben Szenario-Katalog `MeshCases` arbeiten (77 Szenarien: Punktmengen +mit allen drei Algorithmen, Polygone mit Loch, Stern mit 5°-Winkeln, kreuzende Segmente, +Flurstücke mit 1-mm-Abweichungen, Bruchkanten in Gauß-Krüger-Koordinaten, drei echte +ALKIS-Kacheln aus Herne; jeweils CDT, Conforming Delaunay, 20°/25°/28° (legacy)/30°/33°, +`SegmentSplitting` 1/2, gesperrte Segmente, Flächenvorgaben fest und pro Region, zweifaches +Verfeinern, Glätten, Snapping 1 cm): + +| Baustein | Prüft | Zweck | +|----------|-------|-------| +| `InvariantTest` | Konsistenz, keine flachen/invertierten Dreiecke, **(eingeschränkt) Delaunay** mit exaktem InCircle-Test, Fläche gegenüber der unverfeinerten Triangulierung, alle Eingabesegmente vorhanden, gesperrte Segmente ungeteilt, Mindestwinkel (wo garantiert), Maximalfläche | Eigenschaften, die jede korrekte Implementierung erfüllen muss. Gilt auch nach Optimierungen, die das Ergebnis legitim ändern. | +| `GoldenMeshTest` | Fingerabdruck (SHA-256 über alle Dreiecke und Teilsegmente, bitgenau, unabhängig von der Reihenfolge) gegen `golden.txt` | Verhaltensneutrale Optimierungen müssen alle Fingerabdrücke erhalten. Ändert eine Optimierung das Ergebnis bewusst: Invarianten prüfen, Qualitätsstatistik vergleichen, dann mit `TRIANGLE_UPDATE_GOLDEN=1` neu erzeugen und die Änderung im Commit begründen. | +| `Triangle.Benchmarks` | BenchmarkDotNet (Zeit, Allokationen) für 12 repräsentative Szenarien | Messen vor/nach jeder Optimierung. | + +``` +dotnet test src/Triangle.Tests --filter TestCategory=Characterization +TRIANGLE_UPDATE_GOLDEN=1 dotnet test src/Triangle.Tests --filter Name~Golden # bewusst neu erzeugen +dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*" +``` + +Die Invariantentests haben bereits beim Aufbau drei echte Fehler gefunden (aCute, siehe Fixes) +und eine Präzisionsgrenze sichtbar gemacht: Ein auf ein Segment eingefügter Punkt wird auf den +nächsten darstellbaren Punkt gerundet und kann einige ulp neben dem Segment liegen. Die Kanten an +diesem Punkt werden (wie im C-Original) nicht geflippt, sodass der exakte InCircle-Test in seltenen +Fällen eine Delaunay-Verletzung meldet. Das ist für die Gültigkeit des Netzes unerheblich und wird +im Test als Rundungsartefakt erkannt (Kollinearität bis auf 8 ulp). + +Die Zeilenabdeckung der Kernklassen liegt bei 87–98 % (`Mesh` 92 %, `QualityMesher` 92 %, +`ConstraintMesher` 87 %, `SegmentNoder` 98 %, Prädikate 93 %); `NewLocation` (aCute) 74 %. + +### Gemessene Hotspots (Ausgangspunkt für die Performance-Arbeit) + +Profil mit `dotnet-trace` (Sampling, Release): + +* **Reale Daten** (ALKIS-Kachel, 30°, Snap 1 cm): Die aCute-Ortsbestimmung (`NewLocation`) + braucht rund 45 % der Zeit, davon `GetNeighborsVertex` 19 %, `SplitConvexPolygon` 9 % und + `HalfPlaneIntersection` 4 %; `Mesh.InsertVertex` 23 %. Die Allokationen liegen bei rund 100 MB + für 100.000 Dreiecke. +* **Pathologischer Fall** (GEOS `TestRelateAA#74`, zwei Nadeldreiecke 10⁶ : 1, 8 Eingabepunkte): + 92 % der Zeit in `InsertVertex` und `UndoVertex`. Ein Umkreismittelpunkt wird eingefügt, löst + eine lange Flip-Kaskade aus, beeinträchtigt dann ein Segment („encroaching“) und wird komplett + zurückgenommen. Das ist quadratisch (100.000 Punkte in 85 s statt rund 1 s). Ansatz: das + Beeinträchtigen von Segmenten vor dem Umbau des Netzes prüfen. + +Ausgangswerte (`Triangle.Benchmarks`, `--job short`, Release, Container mit 4 Kernen): + +| Szenario | Zeit | Allokationen | +|----------|-----:|-------------:| +| points-random/dwyer (3.000 Punkte) | 3,0 ms | 1,8 MB | +| points-grid/dwyer (1.600 Rasterpunkte) | 3,3 ms | 7,3 MB | +| points-utm/sweepline | 4,0 ms | 2,3 MB | +| points-random/q30 | 44 ms | 10,5 MB | +| crossing-segments/q20 | 4,6 ms | 2,0 MB | +| utm-breaklines/q33 | 11,5 ms | 4,0 MB | +| regions/q25-variable-area | 5,7 ms | 1,8 MB | +| square/smooth | 2,5 ms | 1,7 MB | +| parcels-mismatch/q20 (Steiner-Limit) | 1.513 ms | 246 MB | +| herne_371800_5710600/q20-snap1cm | 42 ms | 9,4 MB | +| herne_373600_5709000/q20-snap1cm | 317 ms | 51 MB | +| herne_373600_5709000/q30-snap1cm | 902 ms | 104 MB | + +Vorgehen pro Optimierung: Benchmark vorher/nachher (Standard-Job), Charakterisierungstests grün +(bei verhaltensneutralen Änderungen unveränderte Fingerabdrücke). ## Die Testsuite (`src/Triangle.Tests/Robustness`) From 9b8b21b1b1516594a095cd5b011276ffd3ce370e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 04:57:24 +0000 Subject: [PATCH 10/50] aCute: reuse work arrays, cheaper neighbor lookup, skip stars of fixed vertices Behavior-neutral (all golden fingerprints unchanged): - per-call work arrays of NewLocation are fields, cleared where they used to be allocated - GetNeighborsVertex only visits the neighbor across the matching edge - DoSmoothing computes vertex stars only for vertices that can be relocated ALKIS tile, 30 degrees: 810 -> 617 ms, 104 -> 73 MB allocated. Benchmarks: TRIANGLE_BENCH_SCENARIOS selects scenarios. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Benchmarks/MeshingBenchmark.cs | 11 +- src/Triangle/NewLocation.cs | 242 ++++++++------------ 2 files changed, 105 insertions(+), 148 deletions(-) diff --git a/src/Triangle.Benchmarks/MeshingBenchmark.cs b/src/Triangle.Benchmarks/MeshingBenchmark.cs index e405fcf..5817fbf 100644 --- a/src/Triangle.Benchmarks/MeshingBenchmark.cs +++ b/src/Triangle.Benchmarks/MeshingBenchmark.cs @@ -34,7 +34,16 @@ public class MeshingBenchmark private MeshCases.Case scenario; - public IEnumerable Scenarios() => Representative; + /// + /// The scenarios to run: , or the comma separated list in the + /// environment variable TRIANGLE_BENCH_SCENARIOS. + /// + public IEnumerable Scenarios() + { + var selection = System.Environment.GetEnvironmentVariable("TRIANGLE_BENCH_SCENARIOS"); + + return string.IsNullOrEmpty(selection) ? Representative : selection.Split(','); + } [ParamsSource(nameof(Scenarios))] public string Scenario { get; set; } diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index e01f1ce..5f8273e 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -27,6 +27,27 @@ class NewLocation Mesh mesh; Behavior behavior; + // Per-call work arrays (reused instead of allocated on every call; cleared where the + // original code allocated them, so the values are the same). + readonly double[] workFindNewLocationWithoutMaxAngle_thirdPoint = new double[2]; + readonly double[] workFindNewLocationWithoutMaxAngle_p = new double[5]; + readonly double[] workFindNewLocationWithoutMaxAngle_voronoiOrInter = new double[4]; + readonly double[] workFindNewLocationWithoutMaxAngle_newloc = new double[2]; + readonly double[] workFindNewLocation_thirdPoint = new double[2]; + readonly double[] workFindNewLocation_p = new double[5]; + readonly double[] workFindNewLocation_voronoiOrInter = new double[4]; + readonly double[] workFindNewLocation_newloc = new double[2]; + readonly double[] workFindNewLocation_line_p = new double[3]; + readonly double[] workFindNewLocation_line_result = new double[4]; + readonly double[] workDoSmoothing_possibilities = new double[6]; + readonly double[] workGetStarPoints_returnPoint = new double[2]; + readonly double[] workGetWedgeIntersectionWithoutMaxAngle_p1 = new double[3]; + readonly double[] workGetWedgeIntersection_p1 = new double[3]; + readonly double[] workGetWedgeIntersection_p2 = new double[3]; + readonly double[] workGetWedgeIntersection_p3 = new double[3]; + readonly double[] workGetWedgeIntersection_p4 = new double[3]; + readonly double[] workSplitConvexPolygon_p = new double[3]; + // Vertices created by relocation. They are not relocated again, otherwise the same // vertex can be moved back and forth forever without refining the mesh. readonly System.Collections.Generic.HashSet relocatedVertices = new System.Collections.Generic.HashSet(); @@ -147,7 +168,7 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t double dxcenter1, dycenter1, dxcenter2, dycenter2; // for finding neighbor Otri neighborotri = default(Otri); - double[] thirdPoint = new double[2]; + double[] thirdPoint = workFindNewLocationWithoutMaxAngle_thirdPoint; Array.Clear(thirdPoint, 0, 2); //int neighborNotFound = -1; bool neighborNotFound; // for keeping the vertices of the neighbor triangle @@ -159,7 +180,8 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t //vertex thirdVertex; // for petal intersection double vector_x, vector_y, xMidOfLongestEdge, yMidOfLongestEdge, inter_x, inter_y; - double[] p = new double[5], voronoiOrInter = new double[4]; + double[] p = workFindNewLocationWithoutMaxAngle_p; Array.Clear(p, 0, 5); + double[] voronoiOrInter = workFindNewLocationWithoutMaxAngle_voronoiOrInter; Array.Clear(voronoiOrInter, 0, 4); bool isCorrect; // for vector calculations in perturbation @@ -170,7 +192,7 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t double justAcute = 1; // used for making the program working for one direction only // for smoothing int relocated = 0;// used to differentiate between calling the deletevertex and just proposing a steiner point - double[] newloc = new double[2]; // new location suggested by smoothing + double[] newloc = workFindNewLocationWithoutMaxAngle_newloc; Array.Clear(newloc, 0, 2); // new location suggested by smoothing double origin_x = 0, origin_y = 0; // for keeping torg safe Otri delotri; // keeping the original orientation for relocation process // keeps the first and second direction suggested points @@ -835,7 +857,7 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, double dxcenter1, dycenter1, dxcenter2, dycenter2; // for finding neighbor Otri neighborotri = default(Otri); - double[] thirdPoint = new double[2]; + double[] thirdPoint = workFindNewLocation_thirdPoint; Array.Clear(thirdPoint, 0, 2); //int neighborNotFound = -1; // for keeping the vertices of the neighbor triangle Vertex neighborvertex_1; @@ -846,7 +868,8 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, //vertex thirdVertex; // for petal intersection double vector_x, vector_y, xMidOfLongestEdge, yMidOfLongestEdge, inter_x, inter_y; - double[] p = new double[5], voronoiOrInter = new double[4]; + double[] p = workFindNewLocation_p; Array.Clear(p, 0, 5); + double[] voronoiOrInter = workFindNewLocation_voronoiOrInter; Array.Clear(voronoiOrInter, 0, 4); bool isCorrect; // for vector calculations in perturbation @@ -857,7 +880,7 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, double justAcute = 1; // used for making the program working for one direction only // for smoothing int relocated = 0;// used to differentiate between calling the deletevertex and just proposing a steiner point - double[] newloc = new double[2]; // new location suggested by smoothing + double[] newloc = workFindNewLocation_newloc; Array.Clear(newloc, 0, 2); // new location suggested by smoothing double origin_x = 0, origin_y = 0; // for keeping torg safe Otri delotri; // keeping the original orientation for relocation process // keeps the first and second direction suggested points @@ -870,8 +893,8 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, double linepnt1_x, linepnt1_y, linepnt2_x, linepnt2_y; // two points of the line double line_inter_x = 0, line_inter_y = 0; double line_vector_x, line_vector_y; - double[] line_p = new double[3]; // used for getting the return values of functions related to line intersection - double[] line_result = new double[4]; + double[] line_p = workFindNewLocation_line_p; Array.Clear(line_p, 0, 3); // used for getting the return values of functions related to line intersection + double[] line_result = workFindNewLocation_line_result; Array.Clear(line_result, 0, 4); // intersection of slab and the petal double petal_slab_inter_x_first, petal_slab_inter_y_first, petal_slab_inter_x_second, petal_slab_inter_y_second, x_1, y_1, x_2, y_2; double petal_bisector_x, petal_bisector_y, dist; @@ -2058,7 +2081,7 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, int numpoints_q = 0; int numpoints_r = 0; //int i; - double[] possibilities = new double[6];//there can be more than one possibilities + double[] possibilities = workDoSmoothing_possibilities; Array.Clear(possibilities, 0, 6);//there can be more than one possibilities int num_pos = 0; // number of possibilities int flag1 = 0, flag2 = 0, flag3 = 0; bool newLocFound = false; @@ -2070,7 +2093,9 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, //********************* TRY TO RELOCATE POINT "p" *************** // get the surrounding points of p, so this gives us the triangles - numpoints_p = GetStarPoints(badotri, torg, tdest, tapex, 1, ref points_p); + // Only free vertices can be relocated (checked first, the star is expensive). + numpoints_p = torg.type == VertexType.FreeVertex && !relocatedVertices.Contains(torg) + ? GetStarPoints(badotri, torg, tdest, tapex, 1, ref points_p) : 0; // check if the points in counterclockwise order // p1[0] = points_p[0]; p1[1] = points_p[1]; // p2[0] = points_p[2]; p2[1] = points_p[3]; @@ -2116,7 +2141,9 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, //********************* TRY TO RELOCATE POINT "q" *************** // get the surrounding points of q, so this gives us the triangles - numpoints_q = GetStarPoints(badotri, torg, tdest, tapex, 2, ref points_q); + // Only free vertices can be relocated (checked first, the star is expensive). + numpoints_q = tdest.type == VertexType.FreeVertex && !relocatedVertices.Contains(tdest) + ? GetStarPoints(badotri, torg, tdest, tapex, 2, ref points_q) : 0; // // check if the points in counterclockwise order // v1[0] = points_q[0]; v1[1] = points_q[1]; // v2[0] = points_q[2]; v2[1] = points_q[3]; @@ -2162,7 +2189,9 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, //********************* TRY TO RELOCATE POINT "q" *************** // get the surrounding points of r, so this gives us the triangles - numpoints_r = GetStarPoints(badotri, torg, tdest, tapex, 3, ref points_r); + // Only free vertices can be relocated (checked first, the star is expensive). + numpoints_r = tapex.type == VertexType.FreeVertex && !relocatedVertices.Contains(tapex) + ? GetStarPoints(badotri, torg, tdest, tapex, 3, ref points_r) : 0; // check if the points in counterclockwise order // v1[0] = points_r[0]; v1[1] = points_r[1]; // v2[0] = points_r[2]; v2[1] = points_r[3]; @@ -2261,7 +2290,7 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r, double first_x = 0, first_y = 0; // keeps the first point to be considered double second_x = 0, second_y = 0; // for determining the edge we will begin double third_x = 0, third_y = 0; // termination - double[] returnPoint = new double[2]; // for keeping the returned point + double[] returnPoint = workGetStarPoints_returnPoint; Array.Clear(returnPoint, 0, 2); // for keeping the returned point int numvertices = 0; // for keeping number of surrounding vertices // first determine which point to be used to find its neighbor triangles @@ -2350,153 +2379,72 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r, /// Neighbor's third vertex incident to given edge. /// Pointer for the neighbor triangle. /// Returns true if vertex was found. + /// + /// Find the neighbor of the triangle across the edge (first, second) and its third vertex. + /// + /// True, if there is no neighbor (the edge is on the boundary). + /// + /// The original implementation compared the vertex coordinates of all three neighbors. + /// The edge is identified by the coordinates of its endpoints (as before), but only the + /// neighbor across the matching edge is visited. The returned handle is the same as + /// before: the neighbor across the edge, or (if not found) across the edge of + /// orientation 2. + /// private bool GetNeighborsVertex(Otri badotri, double first_x, double first_y, double second_x, double second_y, ref double[] thirdpoint, ref Otri neighotri) { + Otri neighbor = default(Otri); - Otri neighbor = default(Otri); // keeps the neighbor triangles - bool notFound = false; // boolean variable if we can find that neighbor or not - - // for keeping the vertices of the neighbor triangle - Vertex neighborvertex_1 = null; - Vertex neighborvertex_2 = null; - Vertex neighborvertex_3 = null; - - // used for finding neighbor triangle - int firstVertexMatched = 0, secondVertexMatched = 0; // to find the correct neighbor - //triangle ptr; // Temporary variable used by sym() - //int i; // index variable - // find neighbors - // Check each of the triangle's three neighbors to find the correct one for (badotri.orient = 0; badotri.orient < 3; badotri.orient++) { - // Find the neighbor. - badotri.Sym(ref neighbor); - // check if it is the one we are looking for by checking the corners - // first check if the neighbor is nonexistent, since it can be on the border - if (neighbor.tri.id != Mesh.DUMMY) - { - // then check if two wanted corners are also in this triangle - // take the vertices of the candidate neighbor - neighborvertex_1 = neighbor.Org(); - neighborvertex_2 = neighbor.Dest(); - neighborvertex_3 = neighbor.Apex(); - - // check if it is really a triangle - if ((neighborvertex_1.x == neighborvertex_2.x && neighborvertex_1.y == neighborvertex_2.y) - || (neighborvertex_2.x == neighborvertex_3.x && neighborvertex_2.y == neighborvertex_3.y) - || (neighborvertex_1.x == neighborvertex_3.x && neighborvertex_1.y == neighborvertex_3.y)) - { - //printf("Two vertices are the same!!!!!!!\n"); - } - else - { - // begin searching for the correct neighbor triangle - firstVertexMatched = 0; - if ((Math.Abs(first_x - neighborvertex_1.x) < EPS) && - (Math.Abs(first_y - neighborvertex_1.y) < EPS)) - { - firstVertexMatched = 11; // neighbor's 1st vertex is matched to first vertex + Vertex org = badotri.Org(); + Vertex dest = badotri.Dest(); - } - else if ((Math.Abs(first_x - neighborvertex_2.x) < EPS) && - (Math.Abs(first_y - neighborvertex_2.y) < EPS)) - { - firstVertexMatched = 12; // neighbor's 2nd vertex is matched to first vertex + bool matches = (SameLocation(org, first_x, first_y) && SameLocation(dest, second_x, second_y)) || + (SameLocation(org, second_x, second_y) && SameLocation(dest, first_x, first_y)); - } - else if ((Math.Abs(first_x - neighborvertex_3.x) < EPS) && - (Math.Abs(first_y - neighborvertex_3.y) < EPS)) - { - firstVertexMatched = 13; // neighbor's 3rd vertex is matched to first vertex - - }/*else{ - // none of them matched - } // end of first vertex matching */ + if (!matches) + { + continue; + } - secondVertexMatched = 0; - if ((Math.Abs(second_x - neighborvertex_1.x) < EPS) && - (Math.Abs(second_y - neighborvertex_1.y) < EPS)) - { - secondVertexMatched = 21; // neighbor's 1st vertex is matched to second vertex - } - else if ((Math.Abs(second_x - neighborvertex_2.x) < EPS) && - (Math.Abs(second_y - neighborvertex_2.y) < EPS)) - { - secondVertexMatched = 22; // neighbor's 2nd vertex is matched to second vertex - } - else if ((Math.Abs(second_x - neighborvertex_3.x) < EPS) && - (Math.Abs(second_y - neighborvertex_3.y) < EPS)) - { - secondVertexMatched = 23; // neighbor's 3rd vertex is matched to second vertex - }/*else{ - // none of them matched - } // end of second vertex matching*/ + badotri.Sym(ref neighbor); - } + if (neighbor.tri.id == Mesh.DUMMY) + { + break; + } - }// if neighbor exists or not + Vertex n1 = neighbor.Org(); + Vertex n2 = neighbor.Dest(); + Vertex n3 = neighbor.Apex(); - if (((firstVertexMatched == 11) && (secondVertexMatched == 22 || secondVertexMatched == 23)) - || ((firstVertexMatched == 12) && (secondVertexMatched == 21 || secondVertexMatched == 23)) - || ((firstVertexMatched == 13) && (secondVertexMatched == 21 || secondVertexMatched == 22))) + if ((n1.x == n2.x && n1.y == n2.y) || (n2.x == n3.x && n2.y == n3.y) || (n1.x == n3.x && n1.y == n3.y)) + { + // Degenerate neighbor. break; - }// end of for loop over all orientations + } - switch (firstVertexMatched) - { - case 0: - notFound = true; - break; - case 11: - if (secondVertexMatched == 22) - { - thirdpoint[0] = neighborvertex_3.x; - thirdpoint[1] = neighborvertex_3.y; - } - else if (secondVertexMatched == 23) - { - thirdpoint[0] = neighborvertex_2.x; - thirdpoint[1] = neighborvertex_2.y; - } - else { notFound = true; } - break; - case 12: - if (secondVertexMatched == 21) - { - thirdpoint[0] = neighborvertex_3.x; - thirdpoint[1] = neighborvertex_3.y; - } - else if (secondVertexMatched == 23) - { - thirdpoint[0] = neighborvertex_1.x; - thirdpoint[1] = neighborvertex_1.y; - } - else { notFound = true; } - break; - case 13: - if (secondVertexMatched == 21) - { - thirdpoint[0] = neighborvertex_2.x; - thirdpoint[1] = neighborvertex_2.y; - } - else if (secondVertexMatched == 22) - { - thirdpoint[0] = neighborvertex_1.x; - thirdpoint[1] = neighborvertex_1.y; - } - else { notFound = true; } - break; - default: - if (secondVertexMatched == 0) { notFound = true; } - break; + // The neighbor's origin and destination are the shared edge. + thirdpoint[0] = n3.x; + thirdpoint[1] = n3.y; + + neighotri = neighbor; + return false; } - // pointer of the neighbor triangle + + badotri.orient = 2; + badotri.Sym(ref neighbor); + neighotri = neighbor; - return notFound; + return true; + } + private static bool SameLocation(Vertex v, double x, double y) + { + return Math.Abs(x - v.x) < EPS && Math.Abs(y - v.y) < EPS; } /// @@ -2538,7 +2486,7 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, tempx, tempy; double ux, uy; double alpha; - double[] p1 = new double[3]; + double[] p1 = workGetWedgeIntersectionWithoutMaxAngle_p1; Array.Clear(p1, 0, 3); //double poly_points; int numpolypoints = 0; @@ -2800,10 +2748,10 @@ private bool GetWedgeIntersection(int numpoints, double[] points, ref double[] n double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, tempx, tempy, x_5, y_5, x_6, y_6; double ux, uy; - double[] p1 = new double[3]; - double[] p2 = new double[3]; - double[] p3 = new double[3]; - double[] p4 = new double[3]; + double[] p1 = workGetWedgeIntersection_p1; Array.Clear(p1, 0, 3); + double[] p2 = workGetWedgeIntersection_p2; Array.Clear(p2, 0, 3); + double[] p3 = workGetWedgeIntersection_p3; Array.Clear(p3, 0, 3); + double[] p4 = workGetWedgeIntersection_p4; Array.Clear(p4, 0, 3); //double poly_points; int numpolypoints = 0; @@ -3489,7 +3437,7 @@ private int SplitConvexPolygon(int numvertices, double[] convexPoly, double x1, // state = 2: after the second intersection (with the line) int state = 0; - double[] p = new double[3]; + double[] p = workSplitConvexPolygon_p; Array.Clear(p, 0, 3); int poly1counter = 0; int poly2counter = 0; int numpolys; From 311f6511bd9ec92c1e9f8ffb070b3299f3a1cf53 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 05:02:29 +0000 Subject: [PATCH 11/50] Reuse bad triangle queue entries Behavior-neutral (golden fingerprints unchanged). ALKIS tile, 30 degrees: 73 -> 60 MB allocated. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/Meshing/Data/BadTriQueue.cs | 19 +++++++++++++++++-- src/Triangle/Meshing/QualityMesher.cs | 4 ++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Triangle/Meshing/Data/BadTriQueue.cs b/src/Triangle/Meshing/Data/BadTriQueue.cs index f8e382e..dd00761 100644 --- a/src/Triangle/Meshing/Data/BadTriQueue.cs +++ b/src/Triangle/Meshing/Data/BadTriQueue.cs @@ -27,6 +27,9 @@ class BadTriQueue // Variables that maintain the bad triangle queues. The queues are // ordered from 4095 (highest priority) to 0 (lowest priority). BadTriangle[] queuefront; + + // Released bad triangles for reuse. + readonly System.Collections.Generic.Stack free = new System.Collections.Generic.Stack(); BadTriangle[] queuetail; int[] nextnonemptyq; int firstnonemptyq; @@ -151,8 +154,8 @@ public void Enqueue(BadTriangle badtri) /// public void Enqueue(ref Otri enqtri, double minedge, Vertex apex, Vertex org, Vertex dest) { - // Allocate space for the bad triangle. - BadTriangle newbad = new BadTriangle(); + // Allocate space for the bad triangle (or reuse a released one). + BadTriangle newbad = free.Count > 0 ? free.Pop() : new BadTriangle(); newbad.poortri = enqtri; newbad.key = minedge; @@ -163,6 +166,18 @@ public void Enqueue(ref Otri enqtri, double minedge, Vertex apex, Vertex org, Ve Enqueue(newbad); } + /// + /// Return a dequeued bad triangle, which is no longer used, for reuse. + /// + public void Release(BadTriangle badtri) + { + badtri.poortri = default(Otri); + badtri.org = badtri.dest = badtri.apex = null; + badtri.next = null; + + free.Push(badtri); + } + /// /// Remove a triangle from the front of the queue. /// diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index d995ef2..e3bb9c9 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -1045,6 +1045,10 @@ private void EnforceQuality(CancellationToken cancellationToken) // Record any new bad triangles that result. SplitEncSegs(true); } + else + { + queue.Release(badtri); + } } } From fe1ca2cb41e93087fcb1a2832462206fa7f80bf1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 05:38:25 +0000 Subject: [PATCH 12/50] Check encroachment before inserting a refinement vertex Instead of inserting the vertex, flipping and undoing everything when a subsegment is encroached, the cavity is determined with the same incircle tests and its boundary subsegments are checked in the same order. For large cavities (> 64 triangles) the search stops at the first encroached subsegments. Needle-shaped regions (GEOS TestRelateAA#74, 80,000 points): 79 s -> 2.1 s. Golden fingerprints of 7 scenarios change: inserting and undoing left stale bad-triangle entries in the queue, which could come back to life when a vertex with the same coordinates was inserted later (vertices are compared by coordinates). Without them, the processing order differs slightly; vertex counts differ by 0-3, bad triangle counts and minimum angles are identical. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Characterization/golden.txt | 14 +- .../Robustness/NodingAndRefinementTest.cs | 16 ++ src/Triangle/Meshing/QualityMesher.cs | 196 +++++++++++++++++- 3 files changed, 215 insertions(+), 11 deletions(-) diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt index ae042ef..8722600 100644 --- a/src/Triangle.Tests/Characterization/golden.txt +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -1,20 +1,20 @@ crossing-segments/cdt V=254 T=502 S=384 H=bf81edf07e78350b crossing-segments/conforming V=826 T=1575 S=956 H=d68dce809dfb02b1 -crossing-segments/q20 V=965 T=1868 S=909 H=cd766e07ae7859e0 +crossing-segments/q20 V=966 T=1870 S=910 H=76f061d745864ccf crossing-segments/q20-locked V=660 T=1260 S=671 H=18736ebac0fe9137 -crossing-segments/q20-split1 V=840 T=1674 S=831 H=7648bb604452d0d6 +crossing-segments/q20-split1 V=841 T=1676 S=832 H=81cc34e2794ade16 crossing-segments/q20-split2 V=292 T=578 S=384 H=3d8695cf266810d6 crossing-segments/q25-conforming V=1805 T=3516 S=1476 H=53d733fb7263e4dd crossing-segments/q28-legacy V=2288 T=4481 S=1421 H=231417f572d6dae6 -crossing-segments/q33 V=2765 T=5422 S=1643 H=fd4bab1e0c019495 +crossing-segments/q33 V=2765 T=5422 S=1643 H=2b0ed92398752d20 herne_371800_5710600/cdt V=491 T=976 S=544 H=54a5e03ff0eeac65 herne_371800_5710600/q20 V=46384 T=92744 S=27033 H=01f5e0e243cc3b88 herne_371800_5710600/q20-snap1cm V=4488 T=8952 S=2718 H=29dfa4cc0161165b -herne_371800_5710600/q30-snap1cm V=9347 T=18654 S=4086 H=3f6d2e1acf519aac +herne_371800_5710600/q30-snap1cm V=9348 T=18656 S=4086 H=6a784924faf9b9b3 herne_373600_5709000/cdt V=1784 T=3562 S=2063 H=d7ddd7fbf8711b31 herne_373600_5709000/q20 V=199721 T=399430 S=167413 H=2b346cc7a40d0a74 -herne_373600_5709000/q20-snap1cm V=25058 T=50089 S=16681 H=77eccba3d1a15ed3 -herne_373600_5709000/q30-snap1cm V=53621 T=107196 S=26285 H=2a7f307adbcbc52f +herne_373600_5709000/q20-snap1cm V=25058 T=50089 S=16681 H=aab458ea3d3f4623 +herne_373600_5709000/q30-snap1cm V=53618 T=107190 S=26286 H=4c3901809bc5fd19 herne_381000_5710400/cdt V=327 T=648 S=337 H=585803801bb4cf8b herne_381000_5710400/q20 V=873 T=1719 S=572 H=c2a78415e6c9a816 herne_381000_5710400/q20-snap1cm V=873 T=1719 S=572 H=c2a78415e6c9a816 @@ -42,7 +42,7 @@ points-random/q30 V=7069 T=13679 S=457 H=fff702d196455123 points-random/sweepline V=3000 T=5980 S=0 H=68345fc2ad9d8fb5 points-utm/dwyer V=2000 T=3979 S=0 H=23343a853965d5a8 points-utm/incremental V=2000 T=3979 S=0 H=23343a853965d5a8 -points-utm/q30 V=4907 T=9411 S=401 H=9d7598274860ce32 +points-utm/q30 V=4905 T=9407 S=401 H=48512e2b2abbbeb8 points-utm/sweepline V=2000 T=3979 S=0 H=23343a853965d5a8 regions/q25-variable-area V=463 T=861 S=92 H=94d37520ac45974f square-hole/cdt V=8 T=8 S=8 H=d3cbe572ce5dd341 diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs index 5bf6105..a75a58f 100644 --- a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -216,6 +216,22 @@ public void NeedleTriangles() MeshAssert.IsValid(mesh); } + + [Test] + [Description("Fixed: in needle-shaped regions, refinement inserted circumcenters with huge cavities, found an " + + "encroached segment and undid everything (60,000 points: 78 s, now about 2 s in a release build).")] + public void NeedleRefinementIsNotQuadratic() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(101, 99), new Vertex(101, 1000000), new Vertex(102, 1000000) })); + poly.Add(new Contour(new[] { new Vertex(100, 100), new Vertex(1000000, 110), new Vertex(1000000, 100) })); + poly.Add(TestData.Square(-100000, -100000, 1200000)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new QualityOptions { MinimumAngle = 20, SteinerPoints = 60000 }), LongTimeout); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count, Is.GreaterThan(50000)); + } private static Polygon ParcelWithBuilding(double gap) { // A parcel and a building whose wall runs along the parcel boundary at a distance diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index e3bb9c9..d413653 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -139,6 +139,16 @@ public void AddBadSubseg(BadSubseg badseg) /// first place, which is why I use diametral lenses with Chew's algorithm. /// public int CheckSeg4Encroach(ref Osub testsubseg) + { + return CheckSeg4Encroach(ref testsubseg, null); + } + + /// + /// Check a subsegment for encroachment (see above). If is not + /// null, it is used as the apex of the triangle on the subsegment's side (the vertex + /// that would be inserted there). + /// + private int CheckSeg4Encroach(ref Osub testsubseg, Vertex apex1, bool enqueue = true) { Otri neighbortri = default(Otri); Osub testsym = default(Osub); @@ -160,7 +170,7 @@ public int CheckSeg4Encroach(ref Osub testsubseg) { sides++; // Find a vertex opposite this subsegment. - eapex = neighbortri.Apex(); + eapex = apex1 ?? neighbortri.Apex(); // Check whether the apex is in the diametral lens of the subsegment // (the diametral circle if 'conformdel' is set). A dot product // of two sides of the triangle is used to check whether the angle @@ -210,7 +220,7 @@ public int CheckSeg4Encroach(ref Osub testsubseg) } } - if (encroached > 0 && (behavior.NoBisect == 0 || ((behavior.NoBisect == 1) && (sides == 2))) && + if (enqueue && encroached > 0 && (behavior.NoBisect == 0 || ((behavior.NoBisect == 1) && (sides == 2))) && CanSplit(testsubseg.seg)) { // Add the subsegment to the list of encroached subsegments. @@ -839,7 +849,13 @@ private void SplitTriangle(BadTriangle badtri) // Insert the circumcenter, searching from the edge of the triangle, // and maintain the Delaunay property of the triangulation. Osub tmp = default(Osub); - success = mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); + + // Check for encroached subsegments before modifying the mesh (inserting + // and undoing a vertex with a large cavity is expensive). + bool encroaches = EncroachesBeforeInsertion(newvertex, badotri); + + success = encroaches ? InsertVertexResult.Encroaching + : mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); if (success == InsertVertexResult.Successful) { @@ -872,7 +888,10 @@ private void SplitTriangle(BadTriangle badtri) { // If the newly inserted vertex encroaches upon a subsegment, // delete the new vertex. - mesh.UndoVertex(); + if (!encroaches) + { + mesh.UndoVertex(); + } } else if (success == InsertVertexResult.Violating) { @@ -904,6 +923,175 @@ private void SplitTriangle(BadTriangle badtri) } } + // Work data of EncroachesBeforeInsertion. + private readonly HashSet cavity = new HashSet(); + private readonly Stack cavityStack = new Stack(); + private readonly Dictionary cavityBoundary = new Dictionary(); + private readonly List cavitySubsegs = new List(); + private readonly List cavityEncroached = new List(); + + // Cavity size (number of triangles) from which the search stops at the first encroached + // subsegments. + private const int LargeCavity = 64; + + /// + /// Determine, without modifying the mesh, whether inserting the vertex would encroach + /// upon a subsegment. If so, the encroached subsegments are queued exactly as + /// would do it, and true is returned (the vertex must not + /// be inserted). + /// + /// + /// inserts the vertex, flips edges and checks each + /// subsegment on the boundary of the resulting cavity (counterclockwise around the vertex, + /// starting at the origin of the located triangle). For a large cavity (needle-shaped + /// regions), inserting and undoing the vertex is quadratic in practice. Here, the cavity + /// is found with the same incircle tests, and its boundary subsegments are checked in the + /// same order. If the situation isn't a plain one (vertex not inside a triangle, cavity + /// on both sides of a subsegment, non-simple boundary), false is returned and the regular + /// insertion decides. + /// + /// For large cavities, the search stops as soon as encroached subsegments have been found + /// (they are queued in the order found). Inserting the vertex is futile anyway, and the + /// remaining encroached subsegments are found when the triangle is tried again. + /// + private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) + { + if (!mesh.checksegments) + { + return false; + } + + Otri horiz = default(Otri); + searchtri.Copy(ref horiz); + + if (mesh.locator.PreciseLocate(v, ref horiz, true) != LocateResult.InTriangle) + { + return false; + } + + cavity.Clear(); + cavityStack.Clear(); + cavityBoundary.Clear(); + cavitySubsegs.Clear(); + cavityEncroached.Clear(); + + Otri tri = default(Otri), neighbor = default(Otri); + Osub sub = default(Osub); + + cavity.Add(horiz.tri); + cavityStack.Push(horiz); + + while (cavityStack.Count > 0) + { + tri = cavityStack.Pop(); + + for (tri.orient = 0; tri.orient < 3; tri.orient++) + { + tri.Pivot(ref sub); + + if (sub.seg.hash == Mesh.DUMMY) + { + tri.Sym(ref neighbor); + + if (neighbor.tri.id != Mesh.DUMMY) + { + if (cavity.Contains(neighbor.tri)) + { + continue; + } + + // Same test (and argument order) as in Mesh.InsertVertex. + if (predicates.InCircle(tri.Dest(), v, tri.Org(), neighbor.Apex()) > 0.0) + { + cavity.Add(neighbor.tri); + cavityStack.Push(neighbor); + continue; + } + } + } + + // Boundary edge of the cavity (the cavity is on its left side). + var org = tri.Org(); + + if (cavityBoundary.ContainsKey(org)) + { + return false; + } + + cavityBoundary.Add(org, tri); + + if (sub.seg.hash != Mesh.DUMMY && CheckSeg4Encroach(ref sub, v, false) > 0) + { + cavityEncroached.Add(sub); + } + } + + if (cavity.Count > LargeCavity && cavityEncroached.Count > 0) + { + for (int i = 0; i < cavityEncroached.Count; i++) + { + sub = cavityEncroached[i]; + CheckSeg4Encroach(ref sub, v); + } + + return true; + } + } + + // Walk along the boundary (counterclockwise around v) and collect the subsegments. + var start = horiz.Org(); + var u = start; + int count = 0; + + do + { + if (!cavityBoundary.TryGetValue(u, out tri)) + { + return false; + } + + tri.Pivot(ref sub); + + if (sub.seg.hash != Mesh.DUMMY) + { + // The triangle on the other side must not be part of the cavity. + Osub sym = default(Osub); + sub.Sym(ref sym); + sym.Pivot(ref neighbor); + + if (neighbor.tri.id != Mesh.DUMMY && cavity.Contains(neighbor.tri)) + { + return false; + } + + cavitySubsegs.Add(sub); + } + + u = tri.Dest(); + count++; + } + while (u != start && count <= cavityBoundary.Count); + + if (u != start || count != cavityBoundary.Count) + { + return false; + } + + bool encroached = false; + + for (int i = 0; i < cavitySubsegs.Count; i++) + { + sub = cavitySubsegs[i]; + + if (CheckSeg4Encroach(ref sub, v) > 0) + { + encroached = true; + } + } + + return encroached; + } + /// /// Returns true, if the aCute location can be used to refine the triangle: it must lie /// strictly inside the circumcircle (otherwise inserting it doesn't destroy the triangle) From d292f5127ab561b2d4f009b2031f5a314afe3a10 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 05:58:32 +0000 Subject: [PATCH 13/50] Refine at segments that must not be split; upstream issue tests If the new vertex encroached upon or lay beyond a subsegment which must not be split (SegmentSplitting 1/2, CanSplitSegment), the bad triangle was dropped for good (upstream issue #9: a 10x20 rectangle with maximum area 1.73 gave 8 triangles). Now the vertex is inserted anyway if it encroaches only upon such subsegments, and a too large triangle is split at its centroid if the vertex lies beyond one. Subsegments that can't be split because of the precision limit are excluded. Tests reproducing the bug reports of the upstream issue tracker, overview in the docs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 27 ++ .../Characterization/golden.txt | 20 +- .../Robustness/UpstreamIssuesTest.cs | 296 ++++++++++++++++++ src/Triangle/Meshing/QualityMesher.cs | 161 ++++++++-- 4 files changed, 473 insertions(+), 31 deletions(-) create mode 100644 src/Triangle.Tests/Robustness/UpstreamIssuesTest.cs diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 56d32e3..284f978 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -181,6 +181,8 @@ paralleles Vermaschen mit eigenen Prädikaten. | neu | **aCute: schlechte Dreiecke gingen verloren.** Der aCute-Ort liegt nicht immer im Umkreis des schlechten Dreiecks; dann blieb das Dreieck nach dem Einfügen bestehen, war aber schon aus der Warteschlange entfernt. Folge: `MaximumArea` wurde verletzt (Quadrat, 20°: 9 zu große Dreiecke), und auf ALKIS-Daten blieben viele Dreiecke unter dem Mindestwinkel (Kachel 381000/5710400, 30°: **618 statt 9**, zugleich 20× langsamer). Jetzt wird ein aCute-Ort nur verwendet, wenn er echt im Umkreis und nicht (fast) auf einer Ecke liegt, und ein überlebendes Dreieck wird über den Umkreismittelpunkt geteilt. Fehler auch in Upstream. | `Meshing/QualityMesher.cs` | | neu | **aCute: Endlosverschiebung von Punkten.** aCute verschiebt („relocation“) Punkte, indem es sie löscht und neu einfügt. Mit Flächenvorgaben pro Region wurde derselbe Punkt immer wieder hin und her verschoben. Upstream wirft „The new vertex is at the circumcenter of triangle“; nach den ersten Fixes lief die Verfeinerung bis zum Steiner-Limit und lieferte ein grobes Netz (5 Dreiecke). Jetzt wird jeder Punkt höchstens einmal verschoben. | `NewLocation.cs`, `Meshing/QualityMesher.cs` | | neu | **Noder: Schnittpunkt am Segmentende blockierte das Snapping.** Ein Schnittpunkt nahe einem Segmentende wurde mit dem Endpunkt verschmolzen und das Segment dort „geteilt“. Das änderte nichts, markierte das Segment aber als bereits geteilt, sodass ein fast kollinearer Punkt nicht mehr hineingesnappt wurde. Zwei Segmente mit 0,0002° Zwischenwinkel blieben stehen, und die Qualitätsvermaschung verbrauchte das gesamte Steiner-Budget in diesem Keil (ALKIS Herne mit Nutzung, 1 cm: 203.175 Dreiecke, davon 154.870 unter 20° → 24.355 Dreiecke, 222 unter 20°). Die unnötigen Teilungen verbrauchten außerdem Noding-Iterationen: Gestapelte Quadrate mit 1e-6 Versatz werden jetzt vernetzt statt abgelehnt. | `Meshing/SegmentNoder.cs` | +| neu | **Segmente, die nicht geteilt werden dürfen** (`SegmentSplitting` 1/2, `CanSplitSegment`): Lag der neue Punkt im Umkreis eines solchen Segments oder jenseits davon, wurde das schlechte Dreieck ersatzlos verworfen (Upstream-Issue #9: Rechteck 10×20 mit Maximalfläche 1,73 ergab 8 Dreiecke). Jetzt wird der Punkt trotzdem eingefügt bzw. ein zu großes Dreieck am Schwerpunkt geteilt. Segmente, die nur wegen der Präzisionsgrenze nicht mehr geteilt werden, sind ausgenommen. | `Meshing/QualityMesher.cs` | +| neu | **Beeinträchtigte Segmente vor dem Einfügen prüfen:** Statt einen Punkt einzufügen, Kanten zu flippen und bei einem beeinträchtigten Segment alles zurückzunehmen, wird der Hohlraum vorab mit denselben Tests bestimmt. Nadelförmige Gebiete (GEOS `TestRelateAA#74`, 80.000 Punkte): 79 s → 2,1 s; der GEOS-Korpus läuft jetzt ohne Timeout. | `Meshing/QualityMesher.cs` | | neu | `FastExpansionSumZeroElim` las (wie das C-Original) ein Element hinter dem Ende einer Expansion; in C# eine `IndexOutOfRangeException`, ausgelöst durch unendliche Koordinaten. | `RobustPredicates.cs` | **Ergebnis (Fuzzing, jeder Fall in eigenem Prozess):** @@ -325,6 +327,31 @@ Ausgangswerte (`Triangle.Benchmarks`, `--job short`, Release, Container mit 4 Ke Vorgehen pro Optimierung: Benchmark vorher/nachher (Standard-Job), Charakterisierungstests grün (bei verhaltensneutralen Änderungen unveränderte Fingerabdrücke). +## Upstream-Issues (github.com/wo80/Triangle.NET/issues) + +Alle 48 Issues wurden gesichtet (Stand Oktober 2026). Fehlerberichte mit genug Information sind +in `UpstreamIssuesTest` als Test nachgestellt; Fragen zur Benutzung, Feature-Wünsche und +Diskussionen sind nicht aufgeführt. + +| Issue | Status upstream | Inhalt | Stand im Fork | +|-------|-----------------|--------|---------------| +| #59 | offen | `SweepLine.RightOfHyperbola`: NullReferenceException | Keine Eingabedaten im Bericht. 50 Zufalls-/Degenerationsfälle (Duplikate, Kollinearität, UTM) laufen fehlerfrei; zusätzlich der Flip-Fix von SweepLine (Befund 10). Nicht abschließend bestätigt. | +| #58 | geschlossen (Workaround) | `GetStarPoints` vergrößert Arbeitsarray endlos, Speicherüberlauf | Puffer begrenzt (Upstream-Fix enthalten). | +| #54, #19 | offen / geschlossen | `RobustPredicates.Default` nicht thread-sicher | **Behoben** (thread-lokaler Arbeitsspeicher, Befund 4); Test mit 200 parallelen Triangulierungen. | +| #48 | offen | `VertexCirculator` wirft NullReferenceException für Eingabepunkte | Nicht reproduzierbar: Umlauf und anschließendes Verfeinern funktionieren. | +| #39 | geschlossen | `EnforceQuality` hängt | Steiner-Limit, aCute-Fixes, Endlosschleifen-Schutz; Korpus ohne Hänger. | +| #35 | geschlossen | Example 5 (Regionsflächen mit aCute): „new vertex is at the circumcenter“ | **Behoben** (aCute-Verschiebung, siehe Fixes); Test. | +| #31 | geschlossen | Ungleichmäßige Elementgrößen | Upstream durch aCute behoben; der Fork behebt zusätzlich die verlorenen Dreiecke (Maximalfläche). | +| #18 | geschlossen | `SimpleSmoother` stürzt bei doppeltem Punkt ab | Funktioniert; Test. | +| #14 | geschlossen | `Polygon(int capacity)` ignoriert die Kapazität | Behoben; Test. | +| #13 | geschlossen | „Ran out of precision“ mit maximaler Kantenlänge (`UserTest`) | Funktioniert (Präzisionsgrenze bei der Verfeinerung); Test. | +| #9 | offen | Maximalfläche ohne Segmentteilung: 10×30-Rechteck geht, 10×20 nicht | **Behoben.** Ursache: Liegt der neue Punkt im Umkreis eines Segments, das nicht geteilt werden darf, oder jenseits davon, wurde das Dreieck ersatzlos verworfen (10×20: 8 statt ≥ 116 Dreiecke). Jetzt wird der Punkt trotzdem eingefügt bzw. ein zu großes Dreieck am Schwerpunkt geteilt. Betrifft auch gesperrte Bruchkanten (`CanSplitSegment`). | +| #8 | geschlossen | Bounded Voronoi nach Glättung hängt | Funktioniert (10 Zufallsfälle); Test. | +| #7 | offen | IDs über `GetHashCode` | IDs sind fortlaufende Zähler; `Vertex` nutzt den koordinatenbasierten Hashcode (Befund 9). | +| #5, #1 | offen / geschlossen | „Topological inconsistency after splitting a segment“ | **Behoben** durch Noding (Befunde 1–3); die Daten aus #1 sind als Test nachgestellt. | +| #3 | geschlossen | Glätten mit freistehendem Segment | Funktioniert; Test. | +| #49 | geschlossen | Loch wird nicht vollständig entfernt, wenn Segmente es kreuzen | Bekannte Einschränkung: Löcher werden von einem Startpunkt aus bis zu Segmenten „infiziert“; ein Segment im Loch trennt den Rest ab. Abhilfe: Regionen statt Löcher (siehe Alter-Stand-Bewertung). | + ## Die Testsuite (`src/Triangle.Tests/Robustness`) * **Red Tests** tragen die Kategorie `KnownBug` und dokumentieren jeweils einen Fehler mit diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt index 8722600..b459232 100644 --- a/src/Triangle.Tests/Characterization/golden.txt +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -1,9 +1,9 @@ crossing-segments/cdt V=254 T=502 S=384 H=bf81edf07e78350b crossing-segments/conforming V=826 T=1575 S=956 H=d68dce809dfb02b1 crossing-segments/q20 V=966 T=1870 S=910 H=76f061d745864ccf -crossing-segments/q20-locked V=660 T=1260 S=671 H=18736ebac0fe9137 -crossing-segments/q20-split1 V=841 T=1676 S=832 H=81cc34e2794ade16 -crossing-segments/q20-split2 V=292 T=578 S=384 H=3d8695cf266810d6 +crossing-segments/q20-locked V=718 T=1376 S=683 H=73db4687411d37d1 +crossing-segments/q20-split1 V=843 T=1680 S=832 H=2e87800f1868a585 +crossing-segments/q20-split2 V=348 T=690 S=384 H=7d65f2e742a90bdd crossing-segments/q25-conforming V=1805 T=3516 S=1476 H=53d733fb7263e4dd crossing-segments/q28-legacy V=2288 T=4481 S=1421 H=231417f572d6dae6 crossing-segments/q33 V=2765 T=5422 S=1643 H=2b0ed92398752d20 @@ -22,9 +22,9 @@ herne_381000_5710400/q30-snap1cm V=1622 T=3203 S=784 H=77e26fd7c406612e parcels-mismatch/cdt V=108 T=167 S=152 H=8e88cc31ffcacbba parcels-mismatch/conforming V=200108 T=400049 S=200152 H=6efccf3d5846008d parcels-mismatch/q20 V=200108 T=400108 S=200152 H=5417863646e7c5d0 -parcels-mismatch/q20-locked V=801 T=1482 S=737 H=fdbfd50a504ea2f2 +parcels-mismatch/q20-locked V=1029 T=1934 S=741 H=9fafb866f5fdfff8 parcels-mismatch/q20-split1 V=200108 T=400167 S=200152 H=7b43b1061b86ef49 -parcels-mismatch/q20-split2 V=113 T=177 S=152 H=dcb986ada444adb6 +parcels-mismatch/q20-split2 V=252 T=455 S=152 H=2edd40c0d26777ec parcels-mismatch/q25-conforming V=200108 T=400049 S=200152 H=6efccf3d5846008d parcels-mismatch/q28-legacy V=200108 T=400094 S=200152 H=c852544447ef6ff4 parcels-mismatch/q33 V=200108 T=400094 S=200152 H=fb8c3a0f8067adfa @@ -60,18 +60,18 @@ square/smooth V=91 T=140 S=42 H=5d33718df5e1431a star/cdt V=29 T=52 S=28 H=5bc51ce8a1a2dccd star/conforming V=41 T=64 S=40 H=995ef7419a113eb9 star/q20 V=73 T=132 S=57 H=ab2301bf2fe73b12 -star/q20-locked V=49 T=84 S=36 H=0bc39207f1f5f124 -star/q20-split1 V=54 T=102 S=49 H=932863524c089401 -star/q20-split2 V=33 T=60 S=28 H=46b9bb857ec5a8d1 +star/q20-locked V=61 T=108 S=36 H=cba2b0965478a18f +star/q20-split1 V=62 T=118 S=49 H=674428aa6b61da20 +star/q20-split2 V=53 T=100 S=28 H=ed1b8bb3c07b060e star/q25-conforming V=119 T=220 S=82 H=9c180df1bfdb281f star/q28-legacy V=217 T=402 S=104 H=713f81fc266ce714 star/q33 V=175 T=318 S=95 H=4842c2404cb50c07 utm-breaklines/cdt V=472 T=938 S=164 H=7dd74060ee3f73cf utm-breaklines/conforming V=745 T=1392 S=437 H=469273a785ce5031 utm-breaklines/q20 V=994 T=1911 S=377 H=f2bd7f6462bcee59 -utm-breaklines/q20-locked V=840 T=1602 S=312 H=fd3e4981d9bf9ff0 +utm-breaklines/q20-locked V=855 T=1632 S=312 H=aebdd9f6243551b3 utm-breaklines/q20-split1 V=900 T=1794 S=306 H=6016275b703bca6b -utm-breaklines/q20-split2 V=574 T=1142 S=164 H=e676886a86201859 +utm-breaklines/q20-split2 V=593 T=1180 S=164 H=60668d1cfa86add9 utm-breaklines/q25-conforming V=1440 T=2761 S=548 H=0e9c30ea67a8421a utm-breaklines/q28-legacy V=1973 T=3836 S=530 H=4c9fa8625248c6c7 utm-breaklines/q33 V=2260 T=4391 S=608 H=e424fbc1bb925618 diff --git a/src/Triangle.Tests/Robustness/UpstreamIssuesTest.cs b/src/Triangle.Tests/Robustness/UpstreamIssuesTest.cs new file mode 100644 index 0000000..4904fba --- /dev/null +++ b/src/Triangle.Tests/Robustness/UpstreamIssuesTest.cs @@ -0,0 +1,296 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; +using TriangleNet.Meshing.Iterators; +using TriangleNet.Smoothing; +using TriangleNet.Tests.Characterization; +using TriangleNet.Voronoi; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Reproductions of the bug reports in the upstream issue tracker + /// (https://github.com/wo80/Triangle.NET/issues), as far as the reports contain enough + /// information. + /// + public class UpstreamIssuesTest + { + private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(30); + + [Test] + [Description("#1: 'Topological inconsistency after splitting a segment' on three segments with large coordinates.")] + public void Issue1_SegmentsWithLargeCoordinates([Values(0, 1, 2)] int splitting, [Values(0, 20, 30)] double minAngle) + { + var c = new Vertex(3470.23824070941, 2025.38518075843); + var c2 = new Vertex(3470.23824070941, 2025.3851807584); // almost the same point + var a = new Vertex(3470.24446228851, 2026.74647195611); + var b = new Vertex(3470.23554561524, 2024.79548995642); + var d = new Vertex(3469.65964599373, 2025.84786418632); + + var poly = new Polygon(); + foreach (var v in new[] { a, c, b, c2, d }) poly.Add(v); + poly.Add(new Segment(a, c)); + poly.Add(new Segment(c, b)); + poly.Add(new Segment(c2, d)); + + var quality = minAngle > 0 ? new QualityOptions { MinimumAngle = minAngle, SteinerPoints = 100000 } : null; + // No enclosing contour: mesh the convex hull. + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SegmentSplitting = splitting, Convex = true }, quality), Timeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + } + + [Test] + [Description("#3: smoothing of a domain with a segment that isn't connected to the boundary.")] + public void Issue3_SmoothingWithOrphanSegment() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(100, 0, 1), new Vertex(110, 60, 1), new Vertex(-5, 50, 1) }, 1)); + var a = new Vertex(30, 20, 2); + var b = new Vertex(70, 30, 2); + poly.Add(a); + poly.Add(b); + poly.Add(new Segment(a, b, 2)); + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 25, MaximumArea = 20 }); + + MeshAssert.Terminates(() => new SimpleSmoother().Smooth(mesh, 10), Timeout); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, Area(poly.Points.Take(4).ToList()), 1e-9); + } + + [Test] + [Description("#8: bounded Voronoi diagram of a smoothed conforming Delaunay mesh (faces looped forever).")] + public void Issue8_BoundedVoronoiAfterSmoothing([Range(0, 9)] int seed) + { + var random = new Random(seed); + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(10, 0, 1), new Vertex(10, 10, 1), new Vertex(0, 10, 1) }, 1)); + + for (int i = 0; i < 20; i++) + { + poly.Add(new Vertex(0.5 + 9 * random.NextDouble(), 0.5 + 9 * random.NextDouble(), 2)); + } + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 25, MaximumArea = 1 }); + + new SimpleSmoother().Smooth(mesh, 5); + + var voronoi = MeshAssert.Terminates(() => new BoundedVoronoi(mesh), Timeout); + + Assert.That(voronoi.IsConsistent(), Is.True); + Assert.That(voronoi.Faces.All(f => f.Edge != null), Is.True); + } + + [Test] + [Description("#9: maximum area on a rectangle without segment splitting (10x30 worked, 10x20 didn't).")] + public void Issue9_AreaConstraintOnRectangleWithoutSegmentSplitting([Values(20, 30)] double height) + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(10, 0, 1), new Vertex(10, height, 1), new Vertex(0, height, 1) }, 1)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SegmentSplitting = 2 }, + new QualityOptions { MaximumArea = 1.73 }), Timeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 10 * height, 1e-9); + + // Without segment splitting, the triangles at the boundary can't get smaller than + // the boundary allows; all others must meet the area constraint. + var interior = mesh.Triangles.Where(t => Enumerable.Range(0, 3).All(i => t.GetVertex(i).Label == 0)); + Assert.That(interior.Count(t => MeshInvariants.Area(t) > 1.73 * (1 + 1e-9)), Is.Zero); + Assert.That(mesh.Triangles.Count, Is.GreaterThan(10 * height / 1.73)); + } + + [Test] + [Description("#13: maximum edge length via UserTest ('Ran out of precision').")] + public void Issue13_MaximumEdgeLengthUserTest([Range(0, 4)] int seed) + { + // Survey points along a winding river. + var random = new Random(seed); + var poly = new Polygon(); + + for (int i = 0; i < 400; i++) + { + double s = i * 5.0; + double x = s + 30 * Math.Sin(s / 80); + double y = 200 * Math.Sin(s / 300) + (random.NextDouble() - 0.5) * 40; + poly.Add(new Vertex(500000 + x, 5700000 + y)); + } + + double maxLength = 200; + + bool TooLong(ITriangle t, double area) + { + for (int i = 0; i < 3; i++) + { + Point p = t.GetVertex(i), q = t.GetVertex((i + 1) % 3); + if (Math.Sqrt((p.X - q.X) * (p.X - q.X) + (p.Y - q.Y) * (p.Y - q.Y)) > maxLength) return true; + } + + return false; + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { UserTest = TooLong, SteinerPoints = 100000 }), Timeout); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => TooLong(t, 0)), Is.Zero); + } + + [Test] + [Description("#14: the capacity of Polygon(int) wasn't used.")] + public void Issue14_PolygonCapacity() + { + Assert.That(new Polygon(1000).Points.Capacity, Is.EqualTo(1000)); + } + + [Test] + [Description("#18: SimpleSmoother crashed with a duplicate input vertex.")] + public void Issue18_SmoothingWithDuplicateVertex() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(100, 0, 1), new Vertex(100, 50, 1), new Vertex(0, 50, 1) }, 1)); + poly.Add(new Vertex(60, 10, 2)); + poly.Add(new Vertex(60, 10, 2)); + poly.Add(new Vertex(30, 30, 2)); + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 25, MaximumArea = 50 }); + + MeshAssert.Terminates(() => new SimpleSmoother().Smooth(mesh, 10), Timeout); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 5000, 1e-9); + } + + [Test] + [Description("#35: example 5 (region area constraints with aCute) threw 'The new vertex is at the circumcenter of triangle'.")] + public void Issue35_RegionAreaConstraints() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(10, 0, 1), new Vertex(10, 10, 1), new Vertex(0, 10, 1) }, 1)); + poly.Add(new Contour(new[] { new Vertex(2, 2, 2), new Vertex(5, 2, 2), new Vertex(5, 5, 2), new Vertex(2, 5, 2) }, 2), 1); + poly.Regions.Add(new RegionPointer(3, 3, 1, 0.05)); + poly.Regions.Add(new RegionPointer(8, 8, 2, 0.5)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, VariableArea = true, SteinerPoints = 100000 }), Timeout); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < 25 - 1e-6), Is.Zero); + } + + [Test] + [Description("#48: VertexCirculator threw a NullReferenceException for input vertices.")] + public void Issue48_VertexCirculatorForInputVertices() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(1, 0, 1), new Vertex(1, 1, 1), new Vertex(0, 1, 1) }, 1)); + + var points = new[] { new Vertex(0.4, 0.4), new Vertex(0.9, 0.9) }; + poly.Points.AddRange(points); + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions(), new QualityOptions { MinimumAngle = 25 }); + var circulator = new VertexCirculator(mesh); + + foreach (var v in points) + { + var triangles = circulator.EnumerateTriangles(v).ToList(); + + Assert.That(triangles.Count, Is.GreaterThan(2)); + + foreach (var t in triangles) + { + ((Topology.Triangle)t).Area = 0.002; + } + } + + mesh.Refine(new QualityOptions { MinimumAngle = 25, VariableArea = true }); + + MeshAssert.IsValid(mesh); + } + + [Test] + [Description("#54/#19: RobustPredicates.Default wasn't thread-safe (parallel triangulation with the default configuration).")] + public void Issue54_ParallelTriangulationWithDefaultPredicates() + { + var errors = 0; + + Parallel.For(0, 200, i => + { + var random = new Random(i); + var poly = new Polygon(); + + for (int k = 0; k < 300; k++) + { + // Integer grid: many cocircular points, i.e. exact arithmetic is needed. + poly.Add(new Vertex(random.Next(0, 40), random.Next(0, 40))); + } + + try + { + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions(), new QualityOptions { MinimumAngle = 25 }); + if (!MeshValidator.IsConsistent(mesh)) System.Threading.Interlocked.Increment(ref errors); + } + catch (Exception) + { + System.Threading.Interlocked.Increment(ref errors); + } + }); + + Assert.That(errors, Is.Zero); + } + + [Test] + [Description("#59: SweepLine.RightOfHyperbola: NullReferenceException (no input data in the report; random and degenerate inputs).")] + public void Issue59_SweepLine([Range(0, 49)] int seed) + { + var random = new Random(seed); + var points = new List(); + int n = 50 + random.Next(500); + + for (int i = 0; i < n; i++) + { + switch (seed % 4) + { + case 0: points.Add(new Vertex(random.NextDouble(), random.NextDouble())); break; + case 1: points.Add(new Vertex(random.Next(0, 10), random.Next(0, 10))); break; // duplicates, collinear + case 2: points.Add(new Vertex(random.Next(0, 30), 5)); break; // all collinear + default: points.Add(new Vertex(500000 + random.Next(0, 100) * 0.01, 5700000 + random.Next(0, 100) * 0.01)); break; + } + } + + var mesh = MeshAssert.Terminates(() => new GenericMesher(new SweepLine()).Triangulate(points), Timeout); + + if (mesh.Triangles.Count > 0) + { + MeshAssert.IsValid(mesh); + } + } + + private static double Area(IList ring) + { + double a = 0; + + for (int i = 0; i < ring.Count; i++) + { + var p = ring[i]; + var q = ring[(i + 1) % ring.Count]; + a += p.X * q.Y - q.X * p.Y; + } + + return Math.Abs(a) / 2; + } + } +} diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index d413653..d2c2810 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -760,6 +760,10 @@ private void SplitTriangle(BadTriangle badtri) bool survived = false; bool relocated = false; + int queuedAtStart = badsubsegs.Count; + InsertVertexResult lastResult = InsertVertexResult.Successful; + refusedAtPrecisionLimit = false; + for (int attempt = 0; attempt < 2; attempt++) { bool useAcute = enableAcute && attempt == 0; @@ -852,30 +856,29 @@ private void SplitTriangle(BadTriangle badtri) // Check for encroached subsegments before modifying the mesh (inserting // and undoing a vertex with a large cavity is expensive). + int queued = badsubsegs.Count; bool encroaches = EncroachesBeforeInsertion(newvertex, badotri); - success = encroaches ? InsertVertexResult.Encroaching - : mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); + if (encroaches && badsubsegs.Count == queued && !refusedAtPrecisionLimit) + { + // Only subsegments which must not be split are encroached (segment + // splitting disabled, locked segments). Rejecting the vertex would + // drop the bad triangle for good, so it is inserted anyway: it lies + // inside the domain, only the subsegment can't be split. + encroaches = false; + success = mesh.InsertVertex(newvertex, ref badotri, ref tmp, false, true); + } + else + { + success = encroaches ? InsertVertexResult.Encroaching + : mesh.InsertVertex(newvertex, ref badotri, ref tmp, true, true); + } + + lastResult = success; if (success == InsertVertexResult.Successful) { - newvertex.hash = mesh.hash_vtx++; - newvertex.id = newvertex.hash; - #if USE_ATTRIBS - if (mesh.nextras > 0) - { - Interpolation.InterpolateAttributes(newvertex, newvertex.tri.tri, mesh.nextras); - } - #endif - #if USE_Z - Interpolation.InterpolateZ(newvertex, newvertex.tri.tri); - #endif - mesh.vertices.Add(newvertex.hash, newvertex); - - if (mesh.steinerleft > 0) - { - mesh.steinerleft--; - } + AddInsertedVertex(newvertex); if (relocated) { @@ -910,6 +913,16 @@ private void SplitTriangle(BadTriangle badtri) } } + if (!errorflag && !relocated && lastResult == InsertVertexResult.Violating && !refusedAtPrecisionLimit && + badsubsegs.Count == queuedAtStart && IsAlive(badtri) && IsTooLarge(badtri.poortri)) + { + // The new vertex lies beyond a subsegment which must not be split (segment + // splitting disabled, locked segments), so the triangle would be dropped. If + // it is too large, split it at its centroid instead (the area constraint is + // met eventually; bad angles at such subsegments can't be fixed anyway). + InsertCentroid(badtri.poortri); + } + if (errorflag) { // The triangle is too small to be refined with the finite precision of @@ -923,6 +936,102 @@ private void SplitTriangle(BadTriangle badtri) } } + /// + /// Register a vertex which has been inserted successfully. + /// + private void AddInsertedVertex(Vertex newvertex) + { + newvertex.hash = mesh.hash_vtx++; + newvertex.id = newvertex.hash; +#if USE_ATTRIBS + if (mesh.nextras > 0) + { + Interpolation.InterpolateAttributes(newvertex, newvertex.tri.tri, mesh.nextras); + } +#endif +#if USE_Z + Interpolation.InterpolateZ(newvertex, newvertex.tri.tri); +#endif + mesh.vertices.Add(newvertex.hash, newvertex); + + if (mesh.steinerleft > 0) + { + mesh.steinerleft--; + } + } + + /// + /// Returns true, if the triangle violates the area constraint. + /// + private bool IsTooLarge(Otri tri) + { + Vertex org = tri.Org(), dest = tri.Dest(), apex = tri.Apex(); + + double area = 0.5 * ((dest.x - org.x) * (apex.y - org.y) - (apex.x - org.x) * (dest.y - org.y)); + + return (behavior.fixedArea && area > behavior.MaxArea) || + (behavior.VarArea && tri.tri.area > 0.0 && area > tri.tri.area); + } + + /// + /// Insert a vertex at the centroid of the triangle. + /// + private void InsertCentroid(Otri tri) + { + Vertex org = tri.Org(), dest = tri.Dest(), apex = tri.Apex(); + + var v = new Vertex((org.x + dest.x + apex.x) / 3.0, (org.y + dest.y + apex.y) / 3.0, 0 +#if USE_ATTRIBS + , mesh.nextras +#endif + ); + + v.type = VertexType.FreeVertex; + v.tri.tri = newvertex_tri; + + // The rounded centroid must lie inside the triangle. + if (predicates.CounterClockwise(org, dest, v) <= 0.0 || + predicates.CounterClockwise(dest, apex, v) <= 0.0 || + predicates.CounterClockwise(apex, org, v) <= 0.0) + { + return; + } + + Osub tmp = default(Osub); + InsertVertexResult success; + + int queued = badsubsegs.Count; + + refusedAtPrecisionLimit = false; + + if (EncroachesBeforeInsertion(v, tri)) + { + if (badsubsegs.Count > queued || refusedAtPrecisionLimit) + { + // Encroached subsegments which can be split are split first (the triangle is + // put back in the queue). + return; + } + + success = mesh.InsertVertex(v, ref tri, ref tmp, false, true); + } + else + { + success = mesh.InsertVertex(v, ref tri, ref tmp, true, true); + + if (success == InsertVertexResult.Encroaching) + { + mesh.UndoVertex(); + return; + } + } + + if (success == InsertVertexResult.Successful) + { + AddInsertedVertex(v); + } + } + // Work data of EncroachesBeforeInsertion. private readonly HashSet cavity = new HashSet(); private readonly Stack cavityStack = new Stack(); @@ -1134,10 +1243,20 @@ private static bool IsAlive(BadTriangle badtri) /// internal bool CanSplit(SubSegment seg) { - return !unsplittable.Contains(seg) && - (behavior.CanSplitSegment == null || behavior.CanSplitSegment(seg)); + if (unsplittable.Contains(seg)) + { + refusedAtPrecisionLimit = true; + return false; + } + + return behavior.CanSplitSegment == null || behavior.CanSplitSegment(seg); } + // Set if CanSplit refused a subsegment because of the precision limit (reset by + // SplitTriangle). Only subsegments which must not be split by the user's choice justify + // inserting a vertex that encroaches upon them. + private bool refusedAtPrecisionLimit; + /// /// Check whether inserting the vertex on the edge of the given triangle creates /// only positively oriented triangles (using exact predicates). From 41af60f48bd2b5e1ba0486ad290948e8f90e3e0b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 07:25:10 +0000 Subject: [PATCH 14/50] Fix bugs found in review: IO, predicates range, log, mesh, pool, geometry, DCEL IO: segment endpoints written by list index (IDs of contour polygons were all 0), region areas written, region areas in scientific notation read, inline comments, attribute column of 6-node elements, invariant integer formatting, case-insensitive extensions, FileProcessor with mesh-only formats, consistent node numbering with Jettison, MFEM leaves the caller's stream open. Log is thread-safe. Coordinates beyond 1e70 (where the exact predicates overflow) are rejected. Mesh: unique triangle ids after Renumber (EdgeIterator skipped edges), Renumber(CuthillMcKee) with duplicate vertices, vertices reused from another mesh are reset, Refine of a point set keeps the convex hull and uses the mesh configuration, NumberOfEdges of an empty mesh, an invalid angle option no longer disables all quality constraints. TrianglePool: Contains off-by-one, Sample covers all slots and is bounded, Clear releases all blocks. Geometry: interior point of contours (hole points) with exact inside test and clearance (hole points landed on the hole boundary with UTM coordinates, thin contours threw), Rectangle copy constructor and Intersects, Point.CompareTo null. VertexCirculator: nested enumeration, vertices not in the mesh. DCEL: boundary edges at pinch vertices, Face.Empty no longer references a mesh. Tests from the class-by-class review (Review A, D, F). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Tests/Geomerty/ContourTest.cs | 8 +- src/Triangle.Tests/Review/ReviewATest.cs | 460 ++++++++++ src/Triangle.Tests/Review/ReviewDTest.cs | 833 ++++++++++++++++++ src/Triangle.Tests/Review/ReviewFTest.cs | 737 ++++++++++++++++ src/Triangle/Behavior.cs | 4 +- src/Triangle/Geometry/Contour.cs | 203 ++--- src/Triangle/Geometry/Point.cs | 5 + src/Triangle/Geometry/Rectangle.cs | 9 +- src/Triangle/IO/FileProcessor.cs | 9 +- src/Triangle/IO/MfemMesh.cs | 3 +- src/Triangle/IO/TriangleFormat.cs | 4 +- src/Triangle/IO/TriangleReader.cs | 81 +- src/Triangle/IO/TriangleWriter.cs | 79 +- src/Triangle/Log.cs | 19 +- src/Triangle/Mesh.cs | 41 +- src/Triangle/Meshing/ConstraintMesher.cs | 2 +- .../Meshing/Iterators/VertexCirculator.cs | 23 +- src/Triangle/Topology/DCEL/DcelMesh.cs | 44 +- src/Triangle/Topology/DCEL/HalfEdge.cs | 3 +- src/Triangle/TrianglePool.cs | 40 +- 20 files changed, 2409 insertions(+), 198 deletions(-) create mode 100644 src/Triangle.Tests/Review/ReviewATest.cs create mode 100644 src/Triangle.Tests/Review/ReviewDTest.cs create mode 100644 src/Triangle.Tests/Review/ReviewFTest.cs diff --git a/src/Triangle.Tests/Geomerty/ContourTest.cs b/src/Triangle.Tests/Geomerty/ContourTest.cs index 42c04f7..2018bb2 100644 --- a/src/Triangle.Tests/Geomerty/ContourTest.cs +++ b/src/Triangle.Tests/Geomerty/ContourTest.cs @@ -56,12 +56,18 @@ public void TestFindInteriorPointL() for (int j = 0; j < count; j++) { + // The hole point must not lie on a segment (it may lie on the extension of one). double ccw = p.CounterClockwise(points[i], h, points[j]); + bool inBox = Math.Min(points[i].X, points[j].X) <= h.X && h.X <= Math.Max(points[i].X, points[j].X) && + Math.Min(points[i].Y, points[j].Y) <= h.Y && h.Y <= Math.Max(points[i].Y, points[j].Y); - Assert.That(Math.Abs(ccw), Is.GreaterThan(1e-12)); + Assert.That(ccw != 0.0 || !inBox, Is.True); i = j; } + + // Strictly inside the L-shape. + Assert.That(h.X > 1 && h.Y > 1 && (h.X < 2 && h.Y < 3 || h.X < 3 && h.Y < 2), Is.True); } [Test] diff --git a/src/Triangle.Tests/Review/ReviewATest.cs b/src/Triangle.Tests/Review/ReviewATest.cs new file mode 100644 index 0000000..4fa5558 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewATest.cs @@ -0,0 +1,460 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; +using TriangleNet.Tests.Robustness; +using TriangleNet.Topology; + +namespace TriangleNet.Tests.Review +{ + /// + /// Review of Mesh, TriangleLocator, TrianglePool, TriangleSampler, Behavior, + /// Configuration, MeshValidator and IMesh. + /// + public class ReviewATest + { + #region TrianglePool + + [Test] + [Description("TrianglePool.Contains checks 'i > size' instead of 'i >= size'. For a triangle whose hash equals the pool size (e.g. a triangle of another mesh) it reads an empty pool slot and throws a NullReferenceException instead of returning false.")] + public void PoolContainsTriangleWithHashEqualToSize() + { + var pool = new TrianglePool(); + for (int i = 0; i < 10; i++) pool.Get(); + + var other = new TrianglePool(); + Triangle foreign = null; + for (int i = 0; i < 11; i++) foreign = other.Get(); // hash == 10 + + Assert.That(foreign.hash, Is.EqualTo(pool.Capacity)); + Assert.That(() => pool.Contains(foreign), Throws.Nothing); + Assert.That(pool.Contains(foreign), Is.False); + } + + [Test] + [Description("TrianglePool.Sample draws indices only from [0, Count) where Count is the number of LIVE triangles, but live triangles are spread over [0, count+free). If all slots below Count are free, the loop never finds a live triangle and hangs (also: live triangles at higher slots are never sampled). Fix: draw from the number of used slots (count), and bound the number of attempts.")] + public void PoolSampleWithFreeTrianglesAtLowSlots() + { + var pool = new TrianglePool(); + var tris = new List(); + for (int i = 0; i < 10; i++) tris.Add(pool.Get()); + + // Free slots 1..5: Count == 5, live triangles are in slots 0, 6, 7, 8, 9. + // (If slot 0 were freed too, Sample would loop forever.) + for (int i = 1; i <= 5; i++) pool.Release(tris[i]); + + Assert.That(pool.Count, Is.EqualTo(5)); + + var sample = MeshAssert.Terminates(() => pool.Sample(200, new Random(0)).Concat(pool.Sample(200, new Random(1))).ToList(), + TimeSpan.FromSeconds(3)); + + Assert.That(sample.All(t => t.hash >= 0), Is.True); + Assert.That(sample.Any(t => t.hash >= 6), Is.True, + "Live triangles in slots >= Count are never sampled (all-free low slots make Sample hang)."); + } + + [Test] + [Description("TrianglePool.Clear computes the number of triangles per block as (size - i*BLOCKSIZE) % BLOCKSIZE, which is size % BLOCKSIZE for every full block. Full blocks are not cleared, so the pool keeps references to all old triangles (memory is never released). Fix: Math.Min(BLOCKSIZE, size - i*BLOCKSIZE).")] + public void PoolClearReleasesAllTriangles() + { + var pool = new TrianglePool(); + for (int i = 0; i < 1024 + 5; i++) pool.Get(); + + pool.Clear(); + + var field = typeof(TrianglePool).GetField("pool", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + var blocks = (Triangle[][])field.GetValue(pool); + + int remaining = blocks.Where(b => b != null).Sum(b => b.Count(t => t != null)); + + Assert.That(pool.Count, Is.EqualTo(0)); + Assert.That(remaining, Is.EqualTo(0), "Pool still references triangles after Clear()."); + } + + [Test] + public void PoolEnumerationSkipsReleasedTriangles() + { + var pool = new TrianglePool(); + var tris = new List(); + for (int i = 0; i < 2100; i++) tris.Add(pool.Get()); + for (int i = 0; i < 2100; i += 3) pool.Release(tris[i]); + + var live = pool.ToList(); + + Assert.That(live.Count, Is.EqualTo(pool.Count)); + Assert.That(live.All(t => t.hash >= 0), Is.True); + Assert.That(live.Distinct().Count(), Is.EqualTo(live.Count)); + + // Reuse of released triangles keeps the enumeration consistent. + for (int i = 0; i < 100; i++) pool.Get(); + Assert.That(pool.Count(), Is.EqualTo(pool.Count)); + } + + #endregion + + #region Renumber + + [Test] + [Description("Mesh.Renumber(CuthillMcKee) applies 'node.id = iperm[node.id]' to all vertices, but AdjacencyMatrix gives undead (duplicate) vertices the negative id -i. Any undead vertex after the first live one causes an IndexOutOfRangeException. Fix: skip undead vertices in Mesh.Renumber (and give them an id outside the permutation range).")] + public void RenumberCuthillMcKeeWithDuplicateVertex() + { + var points = new List + { + new Vertex(0, 0), new Vertex(1, 0), new Vertex(1, 1), new Vertex(0, 1), + new Vertex(0.5, 0.5), new Vertex(0.5, 0.5) // duplicate -> undead + }; + + var mesh = (Mesh)new GenericMesher().Triangulate(points); + + Assert.That(mesh.Vertices.Count(v => v.Type == VertexType.UndeadVertex), Is.EqualTo(1)); + Assert.That(() => mesh.Renumber(NodeNumbering.CuthillMcKee), Throws.Nothing); + + var ids = mesh.Vertices.Where(v => v.Type != VertexType.UndeadVertex).Select(v => v.ID).ToList(); + Assert.That(ids.Distinct().Count(), Is.EqualTo(ids.Count)); + Assert.That(ids.All(id => id >= 0 && id < ids.Count), Is.True); + } + + private static Mesh RenumberedThenRefined() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(4, 4, 2), true); + + var mesh = (Mesh)poly.Triangulate(); + + // E.g. to write the mesh or to build a Voronoi diagram. + mesh.Renumber(); + + mesh.Refine(new QualityOptions { MinimumAngle = 25, MaximumArea = 0.5 }); + + return mesh; + } + + [Test] + [Description("Renumber assigns ids 0..n-1 to live triangles only; released triangles keep their old id (== hash), and TrianglePool.Get does not reset the id of a reused triangle. After Renumber + Refine triangle ids are duplicated, so mesh.Edges (EdgeIterator compares ids) skips edges. Fix: set triangle.id = triangle.hash when a triangle is taken from the free stack.")] + public void EdgesAfterRenumberAndRefine() + { + var mesh = RenumberedThenRefined(); + + MeshAssert.IsValid(mesh); + + var edges = mesh.Edges.ToList(); + var distinct = new HashSet<(int, int)>(); + int pairs = 0; + + foreach (var t in mesh.Triangles) + { + for (int i = 0; i < 3; i++) + { + int a = t.GetVertexID((i + 1) % 3), b = t.GetVertexID((i + 2) % 3); + distinct.Add((Math.Min(a, b), Math.Max(a, b))); + } + } + pairs = distinct.Count; + + Assert.That(edges.Count, Is.EqualTo(pairs), "mesh.Edges is missing edges."); + Assert.That(mesh.NumberOfEdges, Is.EqualTo(pairs)); + } + + [Test] + [Description("Same root cause as EdgesAfterRenumberAndRefine: MeshValidator.IsDelaunay tests an edge only if tri.id < neighbor.id, so with duplicated ids after Renumber + Refine some edges are never checked (false negatives).")] + public void TriangleIdsUniqueAfterRenumberAndRefine() + { + var mesh = RenumberedThenRefined(); + + var ids = mesh.Triangles.Select(t => t.ID).ToList(); + + Assert.That(ids.Distinct().Count(), Is.EqualTo(ids.Count), "Duplicate triangle ids."); + } + + [Test] + public void RenumberLinearIsContiguous() + { + var mesh = RenumberedThenRefined(); + + mesh.Renumber(); + + Assert.That(mesh.Vertices.Select(v => v.ID).OrderBy(i => i), Is.EqualTo(Enumerable.Range(0, mesh.Vertices.Count))); + Assert.That(mesh.Triangles.Select(t => t.ID).OrderBy(i => i), Is.EqualTo(Enumerable.Range(0, mesh.Triangles.Count))); + Assert.That(mesh.Edges.Count(), Is.EqualTo(mesh.NumberOfEdges)); + } + + #endregion + + #region Mesh state / API + + [Test] + public void NumberOfEdgesMatchesEdgesWithHolesAndRefinement() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(2, 2, 2), true); + poly.Add(new Contour(new[] { new Vertex(6, 6), new Vertex(9, 6), new Vertex(6, 9) }), true); + + var mesh = (Mesh)poly.Triangulate(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.3 }); + + Assert.That(mesh.Edges.Count(), Is.EqualTo(mesh.NumberOfEdges)); + + mesh.Refine(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.1 }); + + Assert.That(mesh.Edges.Count(), Is.EqualTo(mesh.NumberOfEdges)); + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100 - 4 - 4.5); + } + + [Test] + [Description("For collinear input there are no triangles, but hullsize stays non-zero (RemoveGhosts counts ghost edges), so NumberOfEdges = (3*0 + hullsize)/2 is positive while Edges is empty. Fix: reset hullsize to 0 when the triangulation is empty (or compute NumberOfEdges only from triangles).")] + public void NumberOfEdgesForCollinearInput([Values(0, 1, 2)] int algorithm) + { + var points = new List { new Vertex(0, 0), new Vertex(1, 1), new Vertex(2, 2), new Vertex(3, 3) }; + + ITriangulator t = algorithm == 0 ? new Dwyer() : algorithm == 1 ? new SweepLine() : new Incremental(); + + var mesh = (Mesh)t.Triangulate(points, new Configuration()); + + Assert.That(mesh.Triangles.Count, Is.EqualTo(0)); + Assert.That(mesh.Edges.Count(), Is.EqualTo(0)); + Assert.That(mesh.NumberOfEdges, Is.EqualTo(0)); + } + + [Test] + [Description("A point-set mesh (GenericMesher.Triangulate(points), no ConstraintMesher) has no hull subsegments. Mesh.Refine then turns on checksegments, and circumcenters outside the convex hull are inserted as if on a boundary edge, so the domain grows beyond the convex hull. Triangle (C) encloses the hull with segments (markhull) before refining. Fix: in Refine, mark the hull when the mesh has no segments.")] + public void RefinePointSetMeshKeepsConvexHull() + { + var random = new Random(3); + var points = new List(); + for (int i = 0; i < 30; i++) points.Add(new Vertex(random.NextDouble() * 10, random.NextDouble() * 10)); + + var mesh = (Mesh)new GenericMesher().Triangulate(points); + double area = mesh.Triangles.Sum(t => MeshAssert.Area(t)); + + MeshAssert.Terminates(() => { mesh.Refine(new QualityOptions { MinimumAngle = 30, SteinerPoints = 5000 }); return 0; }); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, area, 1e-9); + } + + [Test] + [Description("Mesh.Refine creates its QualityMesher with 'new Configuration()' if none was set (e.g. meshes from GenericMesher.Triangulate(points), ITriangulator or Converter), so the user's Configuration.Predicates are silently replaced by RobustPredicates.Default. Fix: keep the Configuration passed to the Mesh constructor and use it in Refine.")] + public void RefineUsesConfiguredPredicates() + { + var counting = new CountingPredicates(); + var config = new Configuration(() => counting); + + var random = new Random(1); + var points = new List(); + for (int i = 0; i < 20; i++) points.Add(new Vertex(random.NextDouble(), random.NextDouble())); + + var mesh = (Mesh)new GenericMesher(config).Triangulate(points); + + int before = counting.Circumcenters; + // Legacy refinement computes circumcenters with the QualityMesher's predicates. + mesh.Refine(new QualityOptions { MaximumArea = 0.001, SteinerPoints = 2000, UseLegacyRefinement = true }); + + Assert.That(mesh.Triangles.Count, Is.GreaterThan(100)); + Assert.That(counting.Circumcenters, Is.GreaterThan(before), "Refine did not use the configured predicates."); + } + + [Test] + public void TriangulatePolygonUsesConfiguredPredicates() + { + // Control for RefineUsesConfiguredPredicates: on this path the configured predicates are used. + var counting = new CountingPredicates(); + var config = new Configuration(() => counting); + + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + + var mesh = new GenericMesher(config).Triangulate(poly, + new QualityOptions { MaximumArea = 0.001, SteinerPoints = 2000, UseLegacyRefinement = true }); + + Assert.That(mesh.Triangles.Count, Is.GreaterThan(100)); + Assert.That(counting.Circumcenters, Is.GreaterThan(0)); + } + + private class CountingPredicates : IPredicates + { + private readonly RobustPredicates inner = new RobustPredicates(); + public int Circumcenters; + + public double CounterClockwise(Point a, Point b, Point c) => inner.CounterClockwise(a, b, c); + public double InCircle(Point a, Point b, Point c, Point p) => inner.InCircle(a, b, c, p); + + public Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta) + { + Interlocked.Increment(ref Circumcenters); + return inner.FindCircumcenter(org, dest, apex, ref xi, ref eta); + } + + public Point FindCircumcenter(Point org, Point dest, Point apex, ref double xi, ref double eta, double offconstant) + { + Interlocked.Increment(ref Circumcenters); + return inner.FindCircumcenter(org, dest, apex, ref xi, ref eta, offconstant); + } + } + + [Test] + [Description("Mesh.TransferNodes/MakeVertexMap never reset Vertex.tri. A vertex that was alive in an earlier mesh and is an undead duplicate in a new mesh keeps a handle into the OLD mesh; ConstraintMesher.InsertSegment trusts it (Org() == endpoint) and inserts the segment into the old mesh's triangles. Fix: reset p.tri in TransferNodes (or clear it for all vertices in MakeVertexMap).")] + public void ReusedVertexObjectsAcrossMeshes() + { + var a = new Vertex(0, 0); var b = new Vertex(10, 0); var c = new Vertex(10, 10); var d = new Vertex(0, 10); + var m = new Vertex(5, 5); + + // First mesh: m is a regular vertex. + var poly1 = new Polygon(); + poly1.Add(new Contour(new[] { a, b, c, d })); + poly1.Add(m); + var mesh1 = (Mesh)poly1.Triangulate(); + MeshAssert.IsValid(mesh1); + int mesh1Segments = mesh1.Segments.Count; + + // Second mesh: a duplicate of m comes first, so m becomes undead, + // and m is used as segment endpoint. + var dup = new Vertex(5, 5); + var poly2 = new Polygon(); + poly2.Add(dup); + var a2 = new Vertex(0, 0); var c2 = new Vertex(10, 10); + poly2.Add(new Contour(new[] { a2, new Vertex(10, 0), c2, new Vertex(0, 10) })); + poly2.Add(m); + poly2.Add(new Segment(m, c2)); + poly2.Add(new Segment(a2, m)); + + var mesh2 = (Mesh)poly2.Triangulate(new ConstraintOptions { ResolveIntersections = false }); + + Assert.That(mesh1.Segments.Count, Is.EqualTo(mesh1Segments), "Old mesh was modified."); + MeshAssert.IsValid(mesh1); + MeshAssert.IsValid(mesh2); + Assert.That(mesh2.Segments.Count, Is.EqualTo(6)); + Assert.That(m.Type, Is.EqualTo(VertexType.UndeadVertex)); + + // Every subsegment of mesh2 must be bonded to triangles of mesh2 ... + var tris2 = new HashSet(mesh2.Triangles); + foreach (var seg in mesh2.subsegs.Values) + { + var t0 = seg.triangles[0].tri; + var t1 = seg.triangles[1].tri; + Assert.That((t0.id == Mesh.DUMMY || tris2.Contains(t0)) && (t1.id == Mesh.DUMMY || tris2.Contains(t1)), Is.True, + "Subsegment of the new mesh is bonded to a triangle of another mesh."); + } + + // ... and the old mesh must not reference subsegments it doesn't own. + var segs1 = new HashSet(mesh1.subsegs.Values); + foreach (var t in mesh1.triangles) + { + for (int i = 0; i < 3; i++) + { + var s = t.subsegs[i].seg; + Assert.That(s.hash == Mesh.DUMMY || segs1.Contains(s), Is.True, + "Old mesh references a subsegment of the new mesh."); + } + } + } + + [Test] + public void BoundsMatchVertices() + { + var poly = new Polygon(); + poly.Add(TestData.Square(-3, 2, 5)); + poly.Add(new Vertex(1, 3)); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.5 }); + + var b = mesh.Bounds; + Assert.That(b.Left, Is.EqualTo(-3)); + Assert.That(b.Bottom, Is.EqualTo(2)); + Assert.That(b.Right, Is.EqualTo(2)); + Assert.That(b.Top, Is.EqualTo(7)); + Assert.That(mesh.Vertices.All(v => b.Contains(v)), Is.True); + } + + [Test] + public void InputWithFewerThanThreePointsThrows() + { + var points = new List { new Vertex(0, 0), new Vertex(1, 0) }; + Assert.That(() => new GenericMesher().Triangulate(points), Throws.Exception); + } + + [Test] + public void MeshValidatorDetectsInvertedTriangle() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + var mesh = (Mesh)poly.Triangulate(); + + Assert.That(MeshValidator.IsConsistent(mesh), Is.True); + + // Swap two vertices of one triangle (inverts it). + var t = mesh.triangles.First(); + (t.vertices[0], t.vertices[1]) = (t.vertices[1], t.vertices[0]); + + Assert.That(MeshValidator.IsConsistent(mesh), Is.False); + } + + [Test] + public void LocateFindsVerticesAndEdges() + { + var points = new List(); + for (int i = 0; i < 5; i++) + for (int j = 0; j < 5; j++) + points.Add(new Vertex(i, j)); + + var mesh = (Mesh)new GenericMesher().Triangulate(points); + + foreach (var p in points) + { + Otri tri = default; + tri.tri = mesh.dummytri; + tri.orient = 0; + tri.Sym(); + + Assert.That(mesh.locator.Locate(p, ref tri), Is.EqualTo(LocateResult.OnVertex)); + Assert.That(tri.Org().X == p.X && tri.Org().Y == p.Y, Is.True); + } + + Otri e = default; + e.tri = mesh.dummytri; e.orient = 0; e.Sym(); + Assert.That(mesh.locator.Locate(new Point(2.5, 0), ref e), Is.EqualTo(LocateResult.OnEdge)); + + e.tri = mesh.dummytri; e.orient = 0; e.Sym(); + Assert.That(mesh.locator.Locate(new Point(2.3, 2.6), ref e), Is.EqualTo(LocateResult.InTriangle)); + } + + #endregion + + #region Behavior + + [Test] + public void BehaviorDerivedAngles() + { + var b = new Behavior(); + b.Quality = true; + b.MinAngle = 30; + b.MaxAngle = 140; + + Assert.That(b.goodAngle, Is.EqualTo(Math.Pow(Math.Cos(Math.PI / 6), 2)).Within(1e-15)); + Assert.That(b.maxGoodAngle, Is.EqualTo(Math.Cos(140 * Math.PI / 180)).Within(1e-15)); + Assert.That(b.offconstant, Is.GreaterThan(0)); + } + + [TestCase(0.0, 50.0)] + [TestCase(70.0, 50.0)] + [Description("Behavior.Update() sets quality = true and only clears it for an invalid angle. QualityMesher.Apply sets MinAngle, then MaxAngle: an invalid MinimumAngle is reset to 0 and quality is re-enabled by the MaxAngle setter (area constraint applied), but an invalid MaximumAngle disables quality for good, so MaximumArea is silently ignored. Fix: validate in one place; drop only the invalid angle (or throw).")] + public void InvalidAngleOptionsHandledConsistently(double minAngle, double maxAngle) + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = minAngle, MaximumAngle = maxAngle, MaximumArea = 0.01 }); + + Assert.That(mesh.Triangles.Max(t => MeshAssert.Area(t)), Is.LessThanOrEqualTo(0.01), + "Maximum area constraint ignored because of an invalid angle option."); + } + + #endregion + } +} diff --git a/src/Triangle.Tests/Review/ReviewDTest.cs b/src/Triangle.Tests/Review/ReviewDTest.cs new file mode 100644 index 0000000..912c116 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewDTest.cs @@ -0,0 +1,833 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Iterators; +using TriangleNet.Topology; +using TriangleNet.Topology.DCEL; +using TriangleNet.Tests.Robustness; + +using TVertex = TriangleNet.Geometry.Vertex; +using HVertex = TriangleNet.Topology.DCEL.Vertex; + +namespace TriangleNet.Tests.Review +{ + /// + /// Review D: Geometry, Topology, DCEL and mesh iterators. + /// + public class ReviewDTest + { + #region Helpers + + private static Mesh RandomPointMesh(int n, int seed) + { + var rnd = new Random(seed); + var poly = new Polygon(n); + for (int i = 0; i < n; i++) + { + poly.Add(new TVertex(rnd.NextDouble() * 100, rnd.NextDouble() * 100)); + } + return (Mesh)poly.Triangulate(); + } + + private static Mesh BoxWithHoleMesh(bool quality) + { + var poly = new Polygon(); + poly.Add(new Contour(new[] + { + new TVertex(0, 0), new TVertex(10, 0), new TVertex(10, 10), new TVertex(0, 10) + }, 1)); + poly.Add(new Contour(new[] + { + new TVertex(4, 4), new TVertex(6, 4), new TVertex(6, 6), new TVertex(4, 6) + }, 2), true); + + return quality + ? (Mesh)poly.Triangulate(new QualityOptions() { MinimumAngle = 25, MaximumArea = 2 }) + : (Mesh)poly.Triangulate(); + } + + private static bool StrictlyInside(Point p, IList poly) + { + // Even-odd test plus distance to boundary. + bool inside = false; + int n = poly.Count; + for (int i = 0, j = n - 1; i < n; j = i++) + { + var a = poly[i]; var b = poly[j]; + if ((a.Y > p.Y) != (b.Y > p.Y) && + p.X < (b.X - a.X) * (p.Y - a.Y) / (b.Y - a.Y) + a.X) + { + inside = !inside; + } + if (RobustPredicates.Default.CounterClockwise(a, b, p) == 0.0 && + Math.Min(a.X, b.X) <= p.X && p.X <= Math.Max(a.X, b.X) && + Math.Min(a.Y, b.Y) <= p.Y && p.Y <= Math.Max(a.Y, b.Y)) + { + return false; + } + } + return inside; + } + + #endregion + + #region Point / Vertex + + [Test] + public void PointEqualsAndHashCodeAgreeForSignedZero() + { + var a = new Point(0.0, 0.0); + var b = new Point(-0.0, -0.0); + + Assert.That(a.Equals(b), Is.True); + Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode())); + Assert.That(new HashSet { a }.Contains(b), Is.True); + } + + [Test] + public void PointAndVertexEqualityIsSymmetric() + { + var p = new Point(1, 2); + var v = new TVertex(1, 2); + + Assert.That(p.Equals(v), Is.EqualTo(v.Equals(p))); + Assert.That(p == v, Is.EqualTo(v == p)); + Assert.That(p.GetHashCode(), Is.EqualTo(v.GetHashCode())); + } + + [Test] + [Description("Point.CompareTo(null) throws NullReferenceException; IComparable requires " + + "any instance to compare greater than null (return > 0).")] + public void PointCompareToNullFollowsIComparableContract() + { + var p = new Point(1, 2); + int result = 0; + + Assert.That(() => result = p.CompareTo(null), Throws.Nothing); + Assert.That(result, Is.GreaterThan(0)); + } + + [Test] + public void PointCompareToIsConsistentWithEquals() + { + var rnd = new Random(7); + var pts = Enumerable.Range(0, 200) + .Select(_ => new Point(rnd.Next(5), rnd.Next(5))).ToList(); + + foreach (var a in pts) + { + foreach (var b in pts) + { + Assert.That(a.CompareTo(b) == 0, Is.EqualTo(a.Equals(b))); + Assert.That(Math.Sign(a.CompareTo(b)), Is.EqualTo(-Math.Sign(b.CompareTo(a)))); + } + } + } + + #endregion + + #region Rectangle + + [Test] + [Description("Rectangle(Rectangle other) forwards (Left, Bottom, Right, Top) to the " + + "(x, y, width, height) constructor, so the copy has xmax = Left + Right and ymax = Bottom + Top.")] + public void RectangleCopyConstructorCopiesBounds() + { + var r = new Rectangle(1, 2, 3, 4); // [1,4] x [2,6] + var copy = new Rectangle(r); + + Assert.That(copy.Left, Is.EqualTo(r.Left)); + Assert.That(copy.Bottom, Is.EqualTo(r.Bottom)); + Assert.That(copy.Right, Is.EqualTo(r.Right)); + Assert.That(copy.Top, Is.EqualTo(r.Top)); + } + + [Test] + [Description("Rectangle.Intersects uses strict comparisons, so a degenerate (zero width/height) " + + "rectangle never intersects anything, not even a rectangle that Contains it.")] + public void RectangleContainsImpliesIntersects() + { + var r = new Rectangle(0, 0, 10, 10); + var flat = new Rectangle(2, 0, 6, 0); // horizontal line on the bottom edge of r + + Assert.That(r.Contains(flat), Is.True); + Assert.That(r.Intersects(flat), Is.True, "Contained rectangle must intersect."); + Assert.That(flat.Intersects(flat), Is.True, "Non-empty rectangle must intersect itself."); + } + + [Test] + public void RectangleExpandFromEmpty() + { + var r = new Rectangle(); + Assert.That(r.Contains(0, 0), Is.False); + + r.Expand(new Point(1, 2)); + Assert.That(r.Width, Is.EqualTo(0.0)); + Assert.That(r.Height, Is.EqualTo(0.0)); + Assert.That(r.Contains(1, 2), Is.True); + + var e = new Rectangle(); + e.Expand(new Rectangle()); + r.Expand(e); + Assert.That(r.Left, Is.EqualTo(1.0)); + Assert.That(r.Top, Is.EqualTo(2.0)); + } + + #endregion + + #region Contour / Polygon + + [Test] + public void ContourRemovesClosingDuplicate() + { + var open = new Contour(new[] { new TVertex(0, 0), new TVertex(1, 0), new TVertex(0, 1) }); + var closed = new Contour(new[] { new TVertex(0, 0), new TVertex(1, 0), new TVertex(0, 1), new TVertex(0, 0) }); + + Assert.That(open.Points.Count, Is.EqualTo(3)); + Assert.That(closed.Points.Count, Is.EqualTo(3)); + Assert.That(closed.GetSegments().Count, Is.EqualTo(3)); + } + + [Test] + [Description("Contour.FindInteriorPoint uses an absolute collinearity threshold (eps = 2e-5 on " + + "the orientation determinant). For a thin but valid contour every corner looks collinear, " + + "the perpendicular probe steps far outside, and a bare System.Exception is thrown.")] + public void FindInteriorPointOfThinRectangle() + { + // 10 x 1e-6 rectangle (orientation determinant 1e-5 < eps at every corner). + var contour = new Contour(new[] + { + new TVertex(0, 0), new TVertex(10, 0), new TVertex(10, 1e-6), new TVertex(0, 1e-6) + }); + + Point p = null; + Assert.That(() => p = contour.FindInteriorPoint(), Throws.Nothing); + Assert.That(StrictlyInside(p, contour.Points), Is.True); + } + + [Test] + [Description("Polygon.Add(contour, hole: true) fails with a bare System.Exception for a thin " + + "hole contour because Contour.FindInteriorPoint uses an absolute eps (see FindInteriorPointOfThinRectangle).")] + public void PolygonAddThinHoleContour() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] + { + new TVertex(-1, -1), new TVertex(11, -1), new TVertex(11, 1), new TVertex(-1, 1) + })); + var hole = new Contour(new[] + { + new TVertex(0, 0), new TVertex(10, 0), new TVertex(5, 2e-6) + }); + + Assert.That(() => poly.Add(hole, true), Throws.Nothing); + } + + [Test] + public void FindInteriorPointRandomStarPolygonsUnitScale() + { + var failures = StarPolygonFailures(1.0, out int tested); + Assert.That(failures, Is.Empty, + $"{failures.Count}/{tested} failed: " + string.Join("; ", failures.Take(5))); + } + + [TestCase(1e-3)] + [TestCase(1e5)] + [Description("Contour.FindInteriorPoint is not scale invariant: the collinearity eps (2e-5) and " + + "IntersectionHelper.IsPointOnSegment's eps (1e-12) are absolute values on cross products. At small " + + "scale it throws for valid obtuse triangles, at large scale it returns the midpoint of an edge " + + "(a point on the contour) because the on-segment rejection never fires.")] + public void FindInteriorPointRandomStarPolygonsOtherScales(double scale) + { + var failures = StarPolygonFailures(scale, out int tested); + Assert.That(failures, Is.Empty, + $"{failures.Count}/{tested} failed at scale {scale}: " + string.Join("; ", failures.Take(3))); + } + + private static List StarPolygonFailures(double scale, out int tested) + { + var rnd = new Random(42); + tested = 0; + var failures = new List(); + + for (int k = 0; k < 300; k++) + { + int n = 3 + rnd.Next(20); + var angles = Enumerable.Range(0, n).Select(_ => rnd.NextDouble() * 2 * Math.PI) + .OrderBy(a => a).ToList(); + var pts = angles.Select(a => + { + double r = (0.1 + rnd.NextDouble()) * scale; + return new TVertex(1e3 * scale + r * Math.Cos(a), r * Math.Sin(a)); + }).ToList(); + + // Skip degenerate (nearly collinear) polygons. + double area = 0; + for (int i = 0, j = n - 1; i < n; j = i++) + area += (pts[j].X - 1e3 * scale) * pts[i].Y - (pts[i].X - 1e3 * scale) * pts[j].Y; + if (Math.Abs(area) < 1e-2 * scale * scale) continue; + + foreach (var list in new[] { pts, Enumerable.Reverse(pts).ToList() }) + { + tested++; + var c = new Contour(list); + try + { + var p = c.FindInteriorPoint(); + if (!StrictlyInside(p, c.Points)) + failures.Add($"k={k} n={n}: ({p.X:R}, {p.Y:R}) not inside " + + string.Join(" ", c.Points.Select(q => $"({q.X:R},{q.Y:R})"))); + } + catch (Exception e) + { + failures.Add($"k={k} n={n}: {e.GetType().Name} " + + string.Join(" ", c.Points.Select(q => $"({q.X:R},{q.Y:R})"))); + } + } + } + + return failures; + } + + [Test] + [Description("With projected (UTM-like) coordinates, Polygon.Add(contour, hole: true) can place the " + + "hole seed on the hole's own boundary (FindInteriorPoint returns an edge midpoint because the " + + "absolute eps 1e-12 in IsPointOnSegment never matches), so the hole point is not strictly inside.")] + public void HoleSeedStrictlyInsideForUtmCoordinates() + { + var rnd = new Random(1); + var failures = new List(); + for (int k = 0; k < 200; k++) + { + double x0 = 370000 + rnd.NextDouble() * 1000, y0 = 5710000 + rnd.NextDouble() * 1000; + var tri = Enumerable.Range(0, 3) + .Select(_ => new TVertex(x0 + rnd.NextDouble() * 50, y0 + rnd.NextDouble() * 50)).ToList(); + double det = RobustPredicates.Default.CounterClockwise(tri[0], tri[1], tri[2]); + if (Math.Abs(det) < 100) continue; // area >= 50 m^2 + + var poly = new Polygon(); + poly.Add(new Contour(tri), true); + var h = poly.Holes[0]; + + // Distance of the seed to the closest edge, relative to the inradius scale. + double minDist = double.MaxValue; + for (int i = 0; i < 3; i++) + { + var a = tri[i]; var b = tri[(i + 1) % 3]; + double len = Math.Sqrt((b.X - a.X) * (b.X - a.X) + (b.Y - a.Y) * (b.Y - a.Y)); + double d = Math.Abs(RobustPredicates.Default.CounterClockwise(a, b, h)) / len; + minDist = Math.Min(minDist, d); + } + if (minDist < 1e-6) + failures.Add($"k={k}: seed ({h.X:R},{h.Y:R}) has distance {minDist:G3} to the hole boundary"); + } + Assert.That(failures, Is.Empty, $"{failures.Count} seeds on boundary: " + string.Join("; ", failures.Take(3))); + } + + [Test] + [Description("End-to-end effect of the hole-seed problem: for a triangular hole in UTM-like " + + "coordinates the seed lies (numerically) on the hole boundary; when it rounds to the outside, " + + "the hole virus eats the surrounding domain instead of the hole and the mesh area is wrong.")] + public void TriangularHoleInUtmCoordinatesIsCarvedCorrectly() + { + var rnd = new Random(1); + var failures = new List(); + int tested = 0; + for (int k = 0; k < 200; k++) + { + double x0 = 370000 + rnd.NextDouble() * 1000, y0 = 5710000 + rnd.NextDouble() * 1000; + var tri = Enumerable.Range(0, 3) + .Select(_ => new TVertex(x0 + rnd.NextDouble() * 50, y0 + rnd.NextDouble() * 50)).ToList(); + double det = RobustPredicates.Default.CounterClockwise(tri[0], tri[1], tri[2]); + if (Math.Abs(det) < 100) continue; + tested++; + + var poly = new Polygon(); + poly.Add(new Contour(new[] + { + new TVertex(x0 - 10, y0 - 10), new TVertex(x0 + 60, y0 - 10), + new TVertex(x0 + 60, y0 + 60), new TVertex(x0 - 10, y0 + 60) + })); + poly.Add(new Contour(tri), true); + + var mesh = poly.Triangulate(); + double area = mesh.Triangles.Sum(t => + 0.5 * RobustPredicates.Default.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2))); + double expected = 70 * 70 - 0.5 * Math.Abs(det); + if (Math.Abs(area - expected) > 1e-6 * expected) + failures.Add($"k={k}: area {area:F3} expected {expected:F3}"); + } + Assert.That(failures, Is.Empty, $"{failures.Count}/{tested} wrong: " + string.Join("; ", failures.Take(3))); + } + + [Test] + public void PolygonBoundsAndHoleHandlingWithClockwiseHole() + { + var poly = new Polygon(); + poly.Add(new Contour(new[] + { + new TVertex(0, 0), new TVertex(10, 0), new TVertex(10, 10), new TVertex(0, 10) + })); + // Clockwise, concave hole (L-shape). + poly.Add(new Contour(new[] + { + new TVertex(2, 2), new TVertex(2, 8), new TVertex(4, 8), new TVertex(4, 4), + new TVertex(8, 4), new TVertex(8, 2) + }), true); + + var b = poly.Bounds(); + Assert.That((b.Left, b.Bottom, b.Right, b.Top), Is.EqualTo((0.0, 0.0, 10.0, 10.0))); + + var mesh = poly.Triangulate(); + double area = mesh.Triangles.Sum(t => + 0.5 * RobustPredicates.Default.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2))); + Assert.That(area, Is.EqualTo(100 - (12 + 8)).Within(1e-9)); + } + + #endregion + + #region ITriangle extensions + + [Test] + public void TriangleContainsAndBounds() + { + var mesh = RandomPointMesh(50, 3); + var rnd = new Random(5); + + foreach (var t in mesh.Triangles) + { + var a = t.GetVertex(0); var b = t.GetVertex(1); var c = t.GetVertex(2); + Assert.That(t.Contains(a) && t.Contains(b) && t.Contains(c), Is.True); + var centroid = new Point((a.X + b.X + c.X) / 3, (a.Y + b.Y + c.Y) / 3); + Assert.That(t.Contains(centroid), Is.True); + Assert.That(t.Bounds().Contains(centroid), Is.True); + } + + // Every random point in the convex hull is in exactly one or more (edge) triangles, + // and never in a triangle that does not geometrically contain it. + for (int i = 0; i < 200; i++) + { + var p = new Point(rnd.NextDouble() * 100, rnd.NextDouble() * 100); + foreach (var t in mesh.Triangles) + { + var o = RobustPredicates.Default; + bool inside = o.CounterClockwise(t.GetVertex(0), t.GetVertex(1), p) >= 0 + && o.CounterClockwise(t.GetVertex(1), t.GetVertex(2), p) >= 0 + && o.CounterClockwise(t.GetVertex(2), t.GetVertex(0), p) >= 0; + Assert.That(t.Contains(p), Is.EqualTo(inside)); + } + } + } + + #endregion + + #region Otri / Osub / Triangle + + [Test] + public void OtriNavigationIdentities() + { + var mesh = BoxWithHoleMesh(true); + Otri e = default, x = default, y = default; + + foreach (var t in mesh.triangles) + { + for (int o = 0; o < 3; o++) + { + e.tri = t; e.orient = o; + + // Lnext^3 = id, Lnext∘Lprev = id. + e.Lnext(ref x); x.Lnext(); x.Lnext(); + Assert.That(x.Equals(e), Is.True); + e.Lnext(ref x); x.Lprev(); + Assert.That(x.Equals(e), Is.True); + + // Vertex relations. + e.Lnext(ref x); + Assert.That(x.Org(), Is.SameAs(e.Dest())); + Assert.That(x.Dest(), Is.SameAs(e.Apex())); + + e.Sym(ref x); + if (x.tri.id == Mesh.DUMMY) continue; + + // Sym∘Sym = id, Sym swaps org/dest. + Assert.That(x.Org(), Is.SameAs(e.Dest())); + Assert.That(x.Dest(), Is.SameAs(e.Org())); + x.Sym(ref y); + Assert.That(y.Equals(e), Is.True); + + // Oprev: same origin. + e.Oprev(ref x); + Assert.That(x.Org(), Is.SameAs(e.Org())); + if (x.Lprev_SymExists()) + { + x.Onext(ref y); + Assert.That(y.Equals(e), Is.True, "Onext(Oprev(e)) != e"); + } + + // Dnext: same destination, Dprev inverse. + e.Dnext(ref x); + Assert.That(x.Dest(), Is.SameAs(e.Dest())); + x.Dprev(ref y); + if (y.tri.id != Mesh.DUMMY) + Assert.That(y.Equals(e), Is.True, "Dprev(Dnext(e)) != e"); + + // Rnext/Rprev inverse when both steps stay in the mesh. + e.Rnext(ref x); + if (x.tri.id != Mesh.DUMMY) + { + x.Rprev(ref y); + Assert.That(y.Equals(e), Is.True, "Rprev(Rnext(e)) != e"); + } + } + + for (int o = 0; o < 3; o++) + { + e.tri = t; e.orient = o; + e.Onext(ref x); + if (x.tri.id == Mesh.DUMMY) continue; + Assert.That(x.Org(), Is.SameAs(e.Org())); + x.Oprev(ref y); + Assert.That(y.Equals(e), Is.True, "Oprev(Onext(e)) != e"); + } + } + } + + [Test] + public void TriangleNeighborAndSegmentAccessors() + { + var mesh = BoxWithHoleMesh(false); + mesh.Renumber(); + + int boundaryEdges = 0; + foreach (var t in mesh.Triangles) + { + for (int i = 0; i < 3; i++) + { + var n = t.GetNeighbor(i); + Assert.That(t.GetVertexID(i), Is.EqualTo(t.GetVertex(i).ID)); + if (n == null) + { + boundaryEdges++; + Assert.That(t.GetNeighborID(i), Is.EqualTo(-1)); + // Every boundary edge must be a segment in a PSLG mesh. + Assert.That(t.GetSegment(i), Is.Not.Null); + } + else + { + Assert.That(t.GetNeighborID(i), Is.EqualTo(n.ID)); + // Neighbor relation is symmetric. + Assert.That(Enumerable.Range(0, 3).Any(j => n.GetNeighbor(j) == t), Is.True); + } + + var s = t.GetSegment(i); + if (s != null) + { + // Segment endpoints are the edge opposite vertex i. + var ids = new[] { s.P0, s.P1 }.OrderBy(v => v).ToArray(); + var exp = new[] { t.GetVertexID((i + 1) % 3), t.GetVertexID((i + 2) % 3) } + .OrderBy(v => v).ToArray(); + Assert.That(ids, Is.EqualTo(exp)); + var st = new[] { s.GetTriangle(0), s.GetTriangle(1) }; + Assert.That(st, Does.Contain(t)); + } + } + } + Assert.That(boundaryEdges, Is.EqualTo(8)); + } + + #endregion + + #region EdgeIterator + + [Test] + public void EdgeIteratorEnumeratesEachEdgeOnce([Values(10, 100, 1000)] int n) + { + var mesh = RandomPointMesh(n, n); + var edges = mesh.Edges.ToList(); + + var keys = edges.Select(e => (Math.Min(e.P0, e.P1), Math.Max(e.P0, e.P1))).ToList(); + Assert.That(keys.Distinct().Count(), Is.EqualTo(keys.Count), "Duplicate edges."); + + var expected = new HashSet<(int, int)>(); + foreach (var t in mesh.Triangles) + for (int i = 0; i < 3; i++) + { + int a = t.GetVertexID(i), b = t.GetVertexID((i + 1) % 3); + expected.Add((Math.Min(a, b), Math.Max(a, b))); + } + Assert.That(keys, Is.EquivalentTo(expected)); + + // Euler for a triangulated convex hull: E = V + T - 1. + Assert.That(edges.Count, Is.EqualTo(mesh.Vertices.Count + mesh.Triangles.Count - 1)); + + var segs = EdgeIterator.EnumerateEdges(mesh, false).Count(); + Assert.That(segs, Is.EqualTo(edges.Count)); + } + + [Test] + public void EdgeIteratorLabelsAndHoles() + { + var mesh = BoxWithHoleMesh(true); + var edges = mesh.Edges.ToList(); + var expected = new HashSet<(int, int)>(); + foreach (var t in mesh.Triangles) + for (int i = 0; i < 3; i++) + { + int a = t.GetVertexID(i), b = t.GetVertexID((i + 1) % 3); + expected.Add((Math.Min(a, b), Math.Max(a, b))); + } + Assert.That(edges.Select(e => (Math.Min(e.P0, e.P1), Math.Max(e.P0, e.P1))), Is.EquivalentTo(expected)); + + int segCount = mesh.Segments.Count; + Assert.That(edges.Count(e => e.Label != 0), Is.EqualTo(segCount)); + Assert.That(EdgeIterator.EnumerateEdges(mesh, true).Count(), Is.EqualTo(edges.Count - segCount)); + } + + #endregion + + #region VertexCirculator + + private static Dictionary> NeighborSets(Mesh mesh) + { + var map = new Dictionary>(ReferenceEqualityComparer.Instance); + foreach (var t in mesh.Triangles) + for (int i = 0; i < 3; i++) + { + var a = t.GetVertex(i); + if (!map.TryGetValue(a, out var set)) map[a] = set = new HashSet(ReferenceEqualityComparer.Instance); + set.Add(t.GetVertex((i + 1) % 3)); + set.Add(t.GetVertex((i + 2) % 3)); + } + return map; + } + + [Test] + public void VertexCirculatorMatchesTopology([Values(false, true)] bool hole) + { + var mesh = hole ? BoxWithHoleMesh(true) : RandomPointMesh(200, 11); + var nb = NeighborSets(mesh); + var circ = new VertexCirculator(mesh); + + foreach (var v in mesh.Vertices) + { + var list = circ.EnumerateVertices(v).ToList(); + Assert.That(list.Distinct().Count(), Is.EqualTo(list.Count), "duplicate neighbors"); + Assert.That(list, Is.EquivalentTo(nb[v])); + + var tris = circ.EnumerateTriangles(v).ToList(); + Assert.That(tris.Distinct().Count(), Is.EqualTo(tris.Count)); + Assert.That(tris.Count, Is.EqualTo(mesh.Triangles.Count(t => + t.GetVertex(0) == v || t.GetVertex(1) == v || t.GetVertex(2) == v))); + + // Counter-clockwise order: consecutive neighbors form left turns around v + // (except across the boundary gap). + for (int i = 0; i + 1 < tris.Count; i++) + { + Assert.That(tris[i].GetNeighbor(0) == tris[i + 1] || + tris[i].GetNeighbor(1) == tris[i + 1] || + tris[i].GetNeighbor(2) == tris[i + 1], Is.True, + "consecutive triangles are not adjacent"); + } + } + } + + [Test] + [Description("VertexCirculator shares one cache list between all lazy enumerations; enumerating " + + "the neighbors of a neighbor inside a foreach (2-ring) clears the list being iterated and " + + "throws InvalidOperationException ('Collection was modified').")] + public void VertexCirculatorNestedEnumeration() + { + var mesh = RandomPointMesh(30, 1); + var circ = new VertexCirculator(mesh); + var v = mesh.Vertices.First(); + + var ring2 = new HashSet(); + Assert.That(() => + { + foreach (var n in circ.EnumerateVertices(v)) + foreach (var m in circ.EnumerateVertices(n)) + ring2.Add(m); + }, Throws.Nothing); + } + + [Test] + [Description("VertexCirculator.EnumerateVertices throws NullReferenceException for a vertex " + + "that is not part of the triangulation (e.g. a duplicate input point, VertexType.UndeadVertex), " + + "because vertex.tri.tri is null; it should yield nothing (or throw a meaningful exception).")] + public void VertexCirculatorOnDuplicateVertex() + { + var poly = new Polygon(); + poly.Add(new TVertex(0, 0)); + poly.Add(new TVertex(1, 0)); + poly.Add(new TVertex(0, 1)); + poly.Add(new TVertex(1, 1)); + poly.Add(new TVertex(1, 1)); // duplicate + var mesh = (Mesh)poly.Triangulate(); + + var undead = mesh.Vertices.Single(v => v.Type == VertexType.UndeadVertex); + var circ = new VertexCirculator(mesh); + + Assert.That(() => circ.EnumerateVertices(undead).ToList(), Throws.Nothing); + } + + #endregion + + #region RegionIterator + + [Test] + public void RegionIteratorStopsAtSegments() + { + var poly = new Polygon(); + // Two squares sharing an edge, with a hole in the left one. + poly.Add(new Contour(new[] { new TVertex(0, 0), new TVertex(10, 0), new TVertex(10, 10), new TVertex(0, 10) }, 1)); + poly.Add(new Contour(new[] { new TVertex(10, 0), new TVertex(20, 0), new TVertex(20, 10), new TVertex(10, 10) }, 2)); + poly.Add(new Contour(new[] { new TVertex(4, 4), new TVertex(6, 4), new TVertex(6, 6), new TVertex(4, 6) }, 3), true); + var mesh = (Mesh)poly.Triangulate(new QualityOptions { MaximumArea = 3 }); + + var left = mesh.Triangles.First(t => (t.GetVertex(0).X + t.GetVertex(1).X + t.GetVertex(2).X) / 3 < 10); + var visited = new List(); + new RegionIterator().Process(left, tri => visited.Add(tri)); + + Assert.That(visited.Distinct().Count(), Is.EqualTo(visited.Count)); + var expectedLeft = mesh.Triangles.Where(t => (t.GetVertex(0).X + t.GetVertex(1).X + t.GetVertex(2).X) / 3 < 10).ToList(); + Assert.That(visited, Is.EquivalentTo(expectedLeft)); + Assert.That(mesh.Triangles.All(t => !t.infected), Is.True, "infection flags not cleared"); + + // Boundary label 3 stops only at the hole segments; the shared edge + // (label 1 or 2) is crossed -> whole mesh. + visited.Clear(); + new RegionIterator().Process(left, tri => visited.Add(tri), 3); + Assert.That(visited.Count, Is.EqualTo(mesh.Triangles.Count)); + } + + [Test] + public void RegionIteratorDefaultActionCopiesLabelAndArea() + { + var mesh = BoxWithHoleMesh(true); + var seed = mesh.triangles.First(); + seed.label = 7; + seed.area = 1.5; + new RegionIterator().Process(seed); + Assert.That(mesh.Triangles.All(t => t.Label == 7 && t.Area == 1.5), Is.True); + } + + #endregion + + #region DCEL + + [Test] + public void DcelFromMeshIsConsistentAndEdgesUnique() + { + var mesh = BoxWithHoleMesh(true); + var dcel = Converter.Instance.ToDCEL(mesh); + + Assert.That(dcel.IsConsistent(true, 10), Is.True); + var edges = dcel.Edges.ToList(); + var keys = edges.Select(e => (Math.Min(e.P0, e.P1), Math.Max(e.P0, e.P1))).ToList(); + Assert.That(keys.Distinct().Count(), Is.EqualTo(keys.Count)); + Assert.That(edges.Count, Is.EqualTo(mesh.Edges.Count())); + + foreach (var v in dcel.Vertices) + { + foreach (var he in v.EnumerateEdges()) + Assert.That(he.Origin, Is.SameAs(v)); + } + foreach (var f in dcel.Faces) + Assert.That(f.EnumerateEdges().Count(), Is.EqualTo(3)); + } + + private static DcelMesh OpenDcel(params (int, int, int)[] tris) + { + var dcel = new DcelMesh(); + var coords = new[] { (1.0, 1.0), (0.0, 0.0), (0.0, 2.0), (2.0, 2.0), (2.0, 0.0), (1.0, -1.0) }; + for (int i = 0; i < coords.Length; i++) + dcel.Vertices.Add(new HVertex(coords[i].Item1, coords[i].Item2) { ID = i }); + + var halfEdges = new Dictionary<(int, int), HalfEdge>(); + int fid = 0, eid = 0; + foreach (var (a, b, c) in tris) + { + var face = new Face(null) { ID = fid++ }; + var idx = new[] { a, b, c }; + var hes = new HalfEdge[3]; + for (int i = 0; i < 3; i++) + { + var o = dcel.Vertices[idx[i]]; + hes[i] = new HalfEdge(o, face) { ID = eid++ }; + o.Leaving = hes[i]; + halfEdges[(idx[i], idx[(i + 1) % 3])] = hes[i]; + dcel.HalfEdges.Add(hes[i]); + } + for (int i = 0; i < 3; i++) hes[i].Next = hes[(i + 1) % 3]; + dcel.Faces.Add(face); + } + foreach (var kv in halfEdges) + { + if (halfEdges.TryGetValue((kv.Key.Item2, kv.Key.Item1), out var twin)) + kv.Value.Twin = twin; + } + // Mark unused vertices as deleted so IsConsistent ignores them. + foreach (var v in dcel.Vertices) + if (v.Leaving == null) v.ID = -1; + return dcel; + } + + [Test] + public void DcelResolveBoundaryEdgesSimple() + { + // Two CCW triangles sharing edge 0-2... (1,1),(0,0),(0,2) and (1,1),(0,2),(2,2) + var dcel = OpenDcel((1, 0, 2), (0, 3, 2)); + dcel.ResolveBoundaryEdges(); + + Assert.That(dcel.IsConsistent(true, 10), Is.True); + Assert.That(dcel.HalfEdges.Count, Is.EqualTo(10)); + Assert.That(dcel.Edges.Count(), Is.EqualTo(5)); + } + + [Test] + [Description("DcelMesh.ResolveBoundaryEdges keys boundary half-edges by origin vertex in a " + + "Dictionary; a non-manifold boundary vertex (two triangles touching at a vertex) has two " + + "outgoing boundary edges and map.Add throws ArgumentException.")] + public void DcelResolveBoundaryEdgesPinchVertex() + { + // Bow-tie: triangles (0,1,2) and (0,3,4) touch only at vertex 0 (1,1). + var dcel = OpenDcel((0, 1, 4), (0, 3, 2)); + Assert.That(() => dcel.ResolveBoundaryEdges(), Throws.Nothing); + Assert.That(dcel.IsConsistent(true, 10), Is.True); + } + + [Test] + [Description("Face.Empty is a process-wide static singleton whose 'edge' is set by the first " + + "HalfEdge ever created with it (HalfEdge ctor sets face.edge if null) and never reset, so it " + + "keeps a reference into an unrelated, older DCEL/Voronoi (stale data + memory leak).")] + public void FaceEmptyDoesNotReferenceForeignMesh() + { + var a = Converter.Instance.ToDCEL(RandomPointMesh(20, 1)); + var b = Converter.Instance.ToDCEL(RandomPointMesh(20, 2)); + + var e = Face.Empty.Edge; + Assert.That(e == null || b.HalfEdges.Contains(e), Is.True, + "Face.Empty.Edge points into a DCEL other than the most recent one."); + GC.KeepAlive(a); + } + + #endregion + } + + internal static class OtriTestExtensions + { + /// + /// True if Onext can be applied (the Lprev edge has a real neighbor). + /// + public static bool Lprev_SymExists(this Otri o) + { + Otri x = default, y = default; + o.Lprev(ref x); + x.Sym(ref y); + return y.tri != null && y.tri.id != Mesh.DUMMY; + } + } +} diff --git a/src/Triangle.Tests/Review/ReviewFTest.cs b/src/Triangle.Tests/Review/ReviewFTest.cs new file mode 100644 index 0000000..fed9879 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewFTest.cs @@ -0,0 +1,737 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Numerics; +using System.Threading; +using System.Threading.Tasks; +using TriangleNet.Geometry; +using TriangleNet.IO; +using TriangleNet.Meshing; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Review +{ + /// + /// Review F: IO (Triangle file formats, FileProcessor, MFEM, DebugWriter), RobustPredicates, Log. + /// + public class ReviewFTest + { + private string dir; + + [SetUp] + public void SetUp() + { + dir = Path.Combine(Path.GetTempPath(), "ReviewF_" + Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(dir); + } + + [TearDown] + public void TearDown() + { + try { Directory.Delete(dir, true); } catch { } + } + + #region Helpers + + private string FilePath(string name) => Path.Combine(dir, name); + + private static void WithCulture(string name, Action action) + { + var oldCulture = Thread.CurrentThread.CurrentCulture; + var oldUi = Thread.CurrentThread.CurrentUICulture; + try + { + Thread.CurrentThread.CurrentCulture = new CultureInfo(name); + Thread.CurrentThread.CurrentUICulture = new CultureInfo(name); + action(); + } + finally + { + Thread.CurrentThread.CurrentCulture = oldCulture; + Thread.CurrentThread.CurrentUICulture = oldUi; + } + } + + /// + /// Exact value of a finite double as X * 2^-1074 (X integer). + /// + private static BigInteger Exact(double d) + { + Assert.That(double.IsFinite(d), Is.True); + long bits = BitConverter.DoubleToInt64Bits(d); + bool negative = bits < 0; + int exp = (int)((bits >> 52) & 0x7FF); + long mant = bits & ((1L << 52) - 1); + BigInteger x = exp == 0 ? new BigInteger(mant) : new BigInteger(mant | (1L << 52)) << (exp - 1); + return negative ? -x : x; + } + + private static int ExactOrient(Point a, Point b, Point c) + { + var ax = Exact(a.X); var ay = Exact(a.Y); + var bx = Exact(b.X); var by = Exact(b.Y); + var cx = Exact(c.X); var cy = Exact(c.Y); + var det = (ax - cx) * (by - cy) - (ay - cy) * (bx - cx); + return det.Sign; + } + + private static int ExactInCircle(Point a, Point b, Point c, Point d) + { + var dx = Exact(d.X); var dy = Exact(d.Y); + var adx = Exact(a.X) - dx; var ady = Exact(a.Y) - dy; + var bdx = Exact(b.X) - dx; var bdy = Exact(b.Y) - dy; + var cdx = Exact(c.X) - dx; var cdy = Exact(c.Y) - dy; + var alift = adx * adx + ady * ady; + var blift = bdx * bdx + bdy * bdy; + var clift = cdx * cdx + cdy * cdy; + var det = alift * (bdx * cdy - cdx * bdy) + + blift * (cdx * ady - adx * cdy) + + clift * (adx * bdy - bdx * ady); + return det.Sign; + } + + private static double ToDouble(BigInteger num, BigInteger den) + { + if (num.IsZero) return 0.0; + if (den.Sign < 0) { num = -num; den = -den; } + int shift = 80 - (int)(BigInteger.Abs(num).GetBitLength() - den.GetBitLength()); + var q = shift >= 0 ? (num << shift) / den : num / (den << -shift); + return Math.ScaleB((double)q, -shift); + } + + private static double Ulps(double v, int k) + { + for (int i = 0; i < Math.Abs(k); i++) + { + v = k > 0 ? Math.BitIncrement(v) : Math.BitDecrement(v); + } + return v; + } + + private static Polygon SamplePolygon() + { + // Vertices with explicit IDs (0-based, matching the index the writer emits). + var pts = new[] + { + new Vertex(0.1, 1.0 / 3.0, 1), new Vertex(10.000000000000002, 0.30000000000000004, 2), + new Vertex(10.5, 9.87654321012345678, 3), new Vertex(-1e-17, 10, 4), + new Vertex(4.123456789012345, 5.0000000000000009, 0) + }; + var poly = new Polygon(5, true); + for (int i = 0; i < pts.Length; i++) + { + pts[i].ID = i; + poly.Add(pts[i]); + } + poly.Add(new Segment(pts[0], pts[1], 11)); + poly.Add(new Segment(pts[1], pts[2], 12)); + poly.Add(new Segment(pts[2], pts[3], 13)); + poly.Add(new Segment(pts[3], pts[0], 14)); + poly.Holes.Add(new Point(1.0 / 7.0, 2.0 / 3.0)); + poly.Regions.Add(new RegionPointer(5.5, 5.123456789012345, 7)); + return poly; + } + + private const string SquarePoly = + "4 2 0 0\n0 0 0\n1 1 0\n2 1 1\n3 0 1\n4 0\n0 0 1\n1 1 2\n2 2 3\n3 3 0\n0\n"; + + #endregion + + #region IO: round trips and culture + + [Test] + [Description("Regression: .poly round trip keeps coordinates bit-exact (shortest round-trip formatting), markers, holes and region labels, also under de-DE culture.")] + public void PolyRoundTripIsExactUnderGermanCulture([Values("de-DE", "en-US")] string culture) + { + var poly = SamplePolygon(); + string file = FilePath("sample.poly"); + + WithCulture(culture, () => + { + new TriangleWriter().WritePoly(poly, file); + var read = new TriangleReader().ReadPolyFile(file); + + Assert.That(read.Points.Count, Is.EqualTo(poly.Points.Count)); + for (int i = 0; i < poly.Points.Count; i++) + { + Assert.That(read.Points[i].X, Is.EqualTo(poly.Points[i].X), "x of " + i); + Assert.That(read.Points[i].Y, Is.EqualTo(poly.Points[i].Y), "y of " + i); + Assert.That(read.Points[i].Label, Is.EqualTo(poly.Points[i].Label), "label of " + i); + } + + Assert.That(read.Segments.Count, Is.EqualTo(4)); + for (int i = 0; i < 4; i++) + { + Assert.That(read.Segments[i].GetVertex(0).X, Is.EqualTo(poly.Segments[i].GetVertex(0).X)); + Assert.That(read.Segments[i].GetVertex(1).Y, Is.EqualTo(poly.Segments[i].GetVertex(1).Y)); + Assert.That(read.Segments[i].Label, Is.EqualTo(poly.Segments[i].Label)); + } + + Assert.That(read.Holes.Single().X, Is.EqualTo(1.0 / 7.0)); + Assert.That(read.Holes.Single().Y, Is.EqualTo(2.0 / 3.0)); + Assert.That(read.Regions.Single().Point.Y, Is.EqualTo(5.123456789012345)); + Assert.That(read.Regions.Single().Label, Is.EqualTo(7)); + }); + } + + [Test] + [Description("TriangleWriter.WritePoly(IPolygon) writes vertex indices 0..n-1 but segment endpoints as Vertex.ID. For a polygon built from Contours (IDs never assigned, all 0) every segment is written as '0 0', so the file is corrupt.")] + public void PolyRoundTripWithoutExplicitVertexIds() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + string file = FilePath("contour.poly"); + + new TriangleWriter().WritePoly(poly, file); + var read = new TriangleReader().ReadPolyFile(file); + + Assert.That(read.Segments.Count, Is.EqualTo(4)); + for (int i = 0; i < 4; i++) + { + var a = read.Segments[i].GetVertex(0); + var b = read.Segments[i].GetVertex(1); + Assert.That(a, Is.Not.SameAs(b), $"segment {i} is degenerate (both endpoints index {a.ID})"); + Assert.That(a.X, Is.EqualTo(poly.Segments[i].GetVertex(0).X)); + Assert.That(a.Y, Is.EqualTo(poly.Segments[i].GetVertex(0).Y)); + Assert.That(b.X, Is.EqualTo(poly.Segments[i].GetVertex(1).X)); + Assert.That(b.Y, Is.EqualTo(poly.Segments[i].GetVertex(1).Y)); + } + } + + [Test] + [Description("TriangleWriter.WritePoly (IPolygon and Mesh overloads) writes regions as 'i x y label' and drops the area constraint, so a .poly round trip loses RegionPointer.Area.")] + public void PolyRoundTripKeepsRegionArea() + { + var poly = SamplePolygon(); + poly.Regions.Clear(); + poly.Regions.Add(new RegionPointer(5, 5, 3, 0.25)); + string file = FilePath("area.poly"); + + new TriangleWriter().WritePoly(poly, file); + var read = new TriangleReader().ReadPolyFile(file); + + Assert.That(read.Regions.Single().Label, Is.EqualTo(3)); + Assert.That(read.Regions.Single().Area, Is.EqualTo(0.25)); + } + + [Test] + [Description("TriangleReader.ReadPolyFile parses the region area with NumberStyles.Number, which forbids exponents. '1e-05' (as written by Triangle's C code or .NET for small areas) silently becomes area 0 (no constraint).")] + public void RegionAreaInScientificNotation() + { + string file = FilePath("sci.poly"); + File.WriteAllText(file, SquarePoly + "1\n0 0.5 0.5 1 1e-05\n"); + + var read = new TriangleReader().ReadPolyFile(file); + + Assert.That(read.Regions.Single().Area, Is.EqualTo(1e-05)); + } + + [Test] + [Description("Regression: comments, blank lines, tabs and 1-based indices are handled.")] + public void PolyWithCommentsBlankLinesAndOneBasedIndices() + { + string file = FilePath("onebased.poly"); + File.WriteAllText(file, + "# header comment\n\n4\t2 0 1\n1 0 0 5\n # inside\n2 1 0 6\n\n3 1 1 7\n4 0 1 8\n" + + "4 1\n1 1 2 21\n2 2 3 22\n3 3 4 23\n4 4 1 24\n1\n1 0.25 0.25\n"); + + var read = new TriangleReader().ReadPolyFile(file); + + Assert.That(read.Points.Select(p => p.Label), Is.EqualTo(new[] { 5, 6, 7, 8 })); + Assert.That(read.Segments.Count, Is.EqualTo(4)); + Assert.That(read.Segments[0].GetVertex(0), Is.SameAs(read.Points[0])); + Assert.That(read.Segments[3].GetVertex(1), Is.SameAs(read.Points[0])); + Assert.That(read.Segments.Select(s => s.Label), Is.EqualTo(new[] { 21, 22, 23, 24 })); + Assert.That(read.Holes.Single().X, Is.EqualTo(0.25)); + Assert.That(read.Regions, Is.Empty); + } + + [TestCase("4 2 0 1\n0 0 0 # corner\n1 1 0 1\n2 1 1 1\n3 0 1 1\n0 0\n0\n", TestName = "InlineCommentAfterVertexWithMarkers")] + [TestCase("4 2 0 0\n0 0 0\n1 1 0\n2 1 1\n3 0 1\n1 1\n0 0 1 # bottom edge\n0\n", TestName = "InlineCommentAfterSegmentWithMarkers")] + [Description("TriangleReader only skips whole-line comments. A trailing '# comment' (allowed by Triangle's file format, the C reader stops at '#') is tokenized and int.Parse('#') throws FormatException when the marker column is missing.")] + public void InlineComments(string content) + { + string file = FilePath("inline.poly"); + File.WriteAllText(file, content); + + Polygon read = null; + Assert.DoesNotThrow(() => read = new TriangleReader().ReadPolyFile(file)); + Assert.That(read.Points.Count, Is.EqualTo(4)); + } + + [Test] + [Description("TriangleReader.ReadEleFile ignores the nodes-per-triangle header field and always reads the region attribute from column 4. For 6-node (second order) .ele files it reads the 4th node index as region label.")] + public void SixNodeElementsRegionAttribute() + { + string ele = FilePath("quad.ele"); + File.WriteAllText(ele, "2 6 1\n0 0 1 2 4 5 6 5\n1 0 2 3 6 7 8 7\n"); + + var tris = new TriangleReader().ReadEleFile(ele); + + Assert.That(tris.Select(t => t.GetVertexID(2)), Is.EqualTo(new[] { 2, 3 })); + Assert.That(tris.Select(t => t.Label), Is.EqualTo(new[] { 5, 7 })); + } + + [Test] + [Description("Regression: mesh round trip through TriangleFormat (.poly + .ele) under de-DE keeps vertices, triangles and region labels.")] + public void MeshRoundTripUnderGermanCulture() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10), 1); + poly.Add(TestData.Square(2.5, 2.5, 1.0 / 3.0), 2); + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions(), new QualityOptions { MaximumArea = 3 }); + string file = FilePath("mesh.poly"); + + WithCulture("de-DE", () => + { + new TriangleFormat().Write(mesh, file); + var read = (Mesh)new TriangleFormat().Import(file); + + Assert.That(read.Vertices.Count, Is.EqualTo(mesh.Vertices.Count)); + Assert.That(read.Triangles.Count, Is.EqualTo(mesh.Triangles.Count)); + + var orig = mesh.Vertices.OrderBy(v => v.ID).ToArray(); + var copy = read.Vertices.OrderBy(v => v.ID).ToArray(); + for (int i = 0; i < orig.Length; i++) + { + Assert.That(copy[i].X, Is.EqualTo(orig[i].X)); + Assert.That(copy[i].Y, Is.EqualTo(orig[i].Y)); + } + + Assert.That(read.Triangles.Select(t => t.Label).OrderBy(l => l), + Is.EqualTo(mesh.Triangles.Select(t => t.Label).OrderBy(l => l))); + Assert.That(read.Triangles.Sum(t => MeshAssert.Area(t)), Is.EqualTo(100).Within(1e-9)); + }); + } + + [Test] + [Description("TriangleWriter formats integers (labels/markers) with the current culture. Under cultures whose NegativeSign is U+2212 (e.g. sv-SE, nb-NO with ICU) negative labels are written as '−1', which the reader cannot parse under another culture (FormatException). Fix: format with CultureInfo.InvariantCulture (and parse ints with it).")] + public void NegativeLabelsWrittenUnderSwedishCulture() + { + Assume.That(new CultureInfo("sv-SE").NumberFormat.NegativeSign, Is.EqualTo("−"), "ICU culture data not available"); + + var poly = SamplePolygon(); + poly.Points[0].Label = -1; + ((Segment)poly.Segments[0]).Label = -2; + string file = FilePath("neg.poly"); + + WithCulture("sv-SE", () => new TriangleWriter().WritePoly(poly, file)); + + Polygon read = null; + WithCulture("en-US", () => Assert.DoesNotThrow(() => read = new TriangleReader().ReadPolyFile(file))); + Assert.That(read.Points[0].Label, Is.EqualTo(-1)); + Assert.That(read.Segments[0].Label, Is.EqualTo(-2)); + } + + [Test] + [Description("TriangleFormat.IsSupported lower-cases the extension, but Read/Import compare case-sensitively. FileProcessor.Read(\"x.POLY\") passes the check and then throws NotSupportedException.")] + public void FileProcessorUpperCaseExtension() + { + string file = FilePath("SQUARE.POLY"); + File.WriteAllText(file, SquarePoly); + + Assert.That(FileProcessor.IsSupported(file), Is.True); + + IPolygon read = null; + Assert.DoesNotThrow(() => read = FileProcessor.Read(file)); + Assert.That(read.Points.Count, Is.EqualTo(4)); + } + + private class MeshOnlyFormat : IMeshFormat + { + public bool IsSupported(string file) => file.EndsWith(".reviewf-mesh-only"); + public IMesh Import(string filename) => throw new NotSupportedException(); + public void Write(IMesh mesh, string filename) => throw new NotSupportedException(); + public void Write(IMesh mesh, Stream stream) => throw new NotSupportedException(); + } + + [Test] + [Description("FileProcessor keeps List but iterates 'foreach (IPolygonFormat f in formats)' (and IMeshFormat). After registering a format that implements only IMeshFormat, polygon Read/Write of any non-Triangle file throws InvalidCastException instead of 'not supported'. Fix: use formats.OfType().")] + public void FileProcessorWithMeshOnlyFormat() + { + FileProcessor.Add(new MeshOnlyFormat()); + + var ex = Assert.Catch(() => FileProcessor.Read(FilePath("x.unknown"))); + Assert.That(ex, Is.Not.InstanceOf(), ex.ToString()); + } + + [Test] + [Description("With Behavior.Jettison, TriangleWriter.WriteNodes skips undead (duplicate) vertices and renumbers the written nodes, but .ele/.poly still use the uncompacted Vertex.id, so all elements after the first dropped vertex reference wrong nodes.")] + public void JettisonWritesConsistentIndices() + { + var points = new List + { + new Vertex(0, 0), new Vertex(0, 0) /* duplicate -> undead */, new Vertex(1, 0), + new Vertex(1, 1), new Vertex(0, 1), new Vertex(0.5, 0.4) + }; + var mesh = (Mesh)new GenericMesher().Triangulate(points); + Assume.That(mesh.undeads, Is.GreaterThan(0)); + mesh.behavior.Jettison = true; + + string node = FilePath("j.node"), ele = FilePath("j.ele"); + var writer = new TriangleWriter(); + writer.WriteNodes(mesh, node); + writer.WriteElements(mesh, ele); + + var reader = new TriangleReader(); + var read = reader.ReadNodeFile(node); + var tris = reader.ReadEleFile(ele); + + Assert.That(read.Points.Count, Is.EqualTo(5)); + var meshTris = mesh.Triangles.ToArray(); + for (int i = 0; i < tris.Count; i++) + { + // The writer may start a triangle at another vertex: compare vertex sets. + var actual = new List<(double, double)>(); + var expected = new List<(double, double)>(); + + for (int k = 0; k < 3; k++) + { + int idx = tris[i].GetVertexID(k); + Assert.That(idx, Is.InRange(0, read.Points.Count - 1), $"triangle {i} node {k}"); + actual.Add((read.Points[idx].X, read.Points[idx].Y)); + expected.Add((meshTris[i].GetVertex(k).X, meshTris[i].GetVertex(k).Y)); + } + + Assert.That(actual, Is.EquivalentTo(expected), $"triangle {i}"); + } + } + + [Test] + [Description("Regression: MFEM output is well formed (0-based indices within range, labels shifted by 1, invariant number format under de-DE).")] + public void MfemOutputIsWellFormed() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1.5), 0); + var mesh = poly.Triangulate(new ConstraintOptions(), new QualityOptions { MaximumArea = 0.2 }); + string file = FilePath("m.mesh"); + + WithCulture("de-DE", () => MfemMesh.Write(mesh, file)); + + var lines = File.ReadAllLines(file); + Assert.That(lines[0], Is.EqualTo("MFEM mesh v1.0")); + int e = Array.IndexOf(lines, "elements"); + int b = Array.IndexOf(lines, "boundary"); + int v = Array.IndexOf(lines, "vertices"); + int ne = int.Parse(lines[e + 1]), nb = int.Parse(lines[b + 1]), nv = int.Parse(lines[v + 1]); + Assert.That(ne, Is.EqualTo(mesh.Triangles.Count)); + Assert.That(nb, Is.EqualTo(mesh.Segments.Count)); + Assert.That(nv, Is.EqualTo(mesh.Vertices.Count)); + + var coords = lines.Skip(v + 3).Take(nv) + .Select(l => l.Split(' ').Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray()).ToArray(); + double area = 0; + for (int i = 0; i < ne; i++) + { + var f = lines[e + 2 + i].Split(' ').Select(int.Parse).ToArray(); + Assert.That(f[0], Is.EqualTo(1)); + Assert.That(f[1], Is.EqualTo(2)); + Assert.That(f.Skip(2), Is.All.InRange(0, nv - 1)); + var (p, q, r) = (coords[f[2]], coords[f[3]], coords[f[4]]); + double a2 = (q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0]); + Assert.That(a2, Is.GreaterThan(0), "element orientation must be CCW"); + area += a2 / 2; + } + Assert.That(area, Is.EqualTo(2.25).Within(1e-12)); + for (int i = 0; i < nb; i++) + { + var f = lines[b + 2 + i].Split(' ').Select(int.Parse).ToArray(); + Assert.That(f[1], Is.EqualTo(1)); + Assert.That(f.Skip(2), Is.All.InRange(0, nv - 1)); + } + } + + [Test] + [Description("MfemMesh.Write(IMesh, Stream) wraps the caller's stream in a StreamWriter without leaveOpen, so the caller's stream is disposed after writing (e.g. a MemoryStream can't be read anymore). Fix: new StreamWriter(stream, leaveOpen: true).")] + public void MfemWriteToStreamLeavesStreamOpen() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + var mesh = poly.Triangulate(); + + var stream = new MemoryStream(); + MfemMesh.Write(mesh, stream); + + Assert.That(stream.CanRead, Is.True, "caller's stream was disposed"); + } + + [Test] + [Description("Regression: internal DebugWriter session produces a readable gzip file.")] + public void DebugWriterProducesGzipFile() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 1)); + var mesh = (Mesh)poly.Triangulate(); + string session = FilePath("debug"); + + WithCulture("de-DE", () => + { + DebugWriter.Session.Start(session); + DebugWriter.Session.Write(mesh); + DebugWriter.Session.Finish(); + }); + + using var gz = new GZipStream(File.OpenRead(session + ".mshx"), CompressionMode.Decompress); + var text = new StreamReader(gz).ReadToEnd(); + Assert.That(text, Does.StartWith("#!N1")); + Assert.That(text, Does.Contain("#!M0")); + Assert.That(text, Does.Not.Contain(",")); + } + + #endregion + + #region Log + + [Test] + [Description("Log.Instance stores events in a plain List without synchronization. Concurrent logging (e.g. parallel meshing with Log.Verbose, PolygonValidator, Converter errors) loses entries or throws (IndexOutOfRange/ArgumentException). Fix: lock in Add/Info/Warning/Error/Clear or use a concurrent collection.")] + public void LogIsThreadSafe() + { + var log = Log.Instance; + log.Clear(); + const int threads = 8, perThread = 20000; + Exception error = null; + + try + { + Parallel.For(0, threads, new ParallelOptions { MaxDegreeOfParallelism = threads }, t => + { + for (int i = 0; i < perThread; i++) + { + log.Warning("w", "ReviewF"); + } + }); + } + catch (Exception ex) + { + error = ex; + } + + int count = log.Data.Count; + log.Clear(); + + Assert.That(error, Is.Null, error?.ToString()); + Assert.That(count, Is.EqualTo(threads * perThread), "lost log entries"); + } + + #endregion + + #region RobustPredicates + + [Test] + [Description("Regression: static initialization yields epsilon = 2^-53 and splitter = 2^27 + 1.")] + public void StaticInitialization() + { + var t = typeof(RobustPredicates); + var flags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static; + _ = RobustPredicates.Default; + Assert.That((double)t.GetField("epsilon", flags).GetValue(null), Is.EqualTo(Math.ScaleB(1, -53))); + Assert.That((double)t.GetField("splitter", flags).GetValue(null), Is.EqualTo(Math.ScaleB(1, 27) + 1)); + } + + private static IEnumerable NearlyCollinear(int seed, double scale, double offset) + { + var rnd = new Random(seed); + for (int n = 0; n < 2000; n++) + { + var a = new Point(offset + scale * rnd.NextDouble(), offset + scale * rnd.NextDouble()); + var b = new Point(offset + scale * rnd.NextDouble(), offset + scale * rnd.NextDouble()); + double t = rnd.NextDouble() * 3 - 1; + double cx = a.X + t * (b.X - a.X), cy = a.Y + t * (b.Y - a.Y); + var c = new Point(Ulps(cx, rnd.Next(-2, 3)), Ulps(cy, rnd.Next(-2, 3))); + yield return new[] { a, b, c }; + } + } + + [Test] + [Description("Regression: CounterClockwise sign agrees with exact rational arithmetic on nearly collinear points (several scales, mixed magnitudes) for the Default and a new instance.")] + public void CounterClockwiseMatchesExact( + [Values(1.0, 1e15, 1e-15, 1e100, 1e-100)] double scale, + [Values(0.0, 1.0)] double offsetFactor) + { + var preds = new[] { RobustPredicates.Default, new RobustPredicates() }; + // Mixed magnitudes: tiny differences on a large offset. + double offset = offsetFactor * scale * 1e9; + int nonzero = 0; + foreach (var p in NearlyCollinear(42, scale, offset)) + { + int exact = ExactOrient(p[0], p[1], p[2]); + if (exact != 0) nonzero++; + foreach (var pred in preds) + { + Assert.That(Math.Sign(pred.CounterClockwise(p[0], p[1], p[2])), Is.EqualTo(exact), + $"({p[0].X:R},{p[0].Y:R}) ({p[1].X:R},{p[1].Y:R}) ({p[2].X:R},{p[2].Y:R})"); + } + } + Assert.That(nonzero, Is.GreaterThan(0)); + } + + private static IEnumerable NearlyCocircular(int seed, double scale, double offset) + { + var rnd = new Random(seed); + for (int n = 0; n < 2000; n++) + { + double cx = offset + scale * rnd.NextDouble(), cy = offset + scale * rnd.NextDouble(); + double r = scale * (0.1 + rnd.NextDouble()); + var angles = Enumerable.Range(0, 4).Select(_ => rnd.NextDouble() * 2 * Math.PI).OrderBy(x => x).ToArray(); + var pts = angles.Select(a => new Point(Ulps(cx + r * Math.Cos(a), rnd.Next(-1, 2)), + Ulps(cy + r * Math.Sin(a), rnd.Next(-1, 2)))).ToArray(); + yield return pts; + } + } + + [Test] + [Description("Regression: InCircle sign agrees with exact rational arithmetic on nearly cocircular points (several scales, mixed magnitudes).")] + public void InCircleMatchesExact( + [Values(1.0, 1e15, 1e-15, 1e50, 1e-50)] double scale, + [Values(0.0, 1.0)] double offsetFactor) + { + var pred = new RobustPredicates(); + double offset = offsetFactor * scale * 1e6; + foreach (var p in NearlyCocircular(7, scale, offset)) + { + int exact = ExactInCircle(p[0], p[1], p[2], p[3]); + Assert.That(Math.Sign(pred.InCircle(p[0], p[1], p[2], p[3])), Is.EqualTo(exact), + string.Join(" ", p.Select(q => $"({q.X:R},{q.Y:R})"))); + Assert.That(Math.Sign(pred.NonRegular(p[0], p[1], p[2], p[3])), Is.EqualTo(exact)); + } + + // Exactly cocircular input must give exactly 0. + Assert.That(pred.InCircle(new Point(0, 0), new Point(1, 0), new Point(1, 1), new Point(0, 1)), Is.EqualTo(0.0)); + double s = scale; + Assert.That(pred.InCircle(new Point(offset, offset), new Point(offset + s, offset), + new Point(offset + s, offset + s), new Point(offset, offset + s)), + Is.EqualTo(Math.Sign(ExactInCircle(new Point(offset, offset), new Point(offset + s, offset), + new Point(offset + s, offset + s), new Point(offset, offset + s)))).Or.EqualTo(0.0)); + } + + [Test] + [Explicit("Documented limitation of Shewchuk's predicates: coordinate differences below about 1e-75 underflow (see docs/Robustheitsanalyse.md).")] + [Description("Inherited from Shewchuk's predicates (documented assumption: no underflow): with coordinates around 1e-300 the products underflow to 0 and CounterClockwise returns 0 (collinear) for a clearly non-degenerate right triangle. Inputs should be rejected or rescaled before meshing.")] + public void CounterClockwiseUnderflow() + { + const double s = 1e-300; + var a = new Point(0, 0); + var b = new Point(s, 0); + var c = new Point(0, s); + Assert.That(ExactOrient(a, b, c), Is.EqualTo(1)); + Assert.That(Math.Sign(new RobustPredicates().CounterClockwise(a, b, c)), Is.EqualTo(1)); + } + + [Test] + [Description("Fixed: coordinates beyond Mesh.MaxCoordinate (where the exact predicates overflow) are rejected.")] + public void CoordinatesBeyondPredicateRangeAreRejected([Values(1e71, 1e160)] double s) + { + var poly = new Polygon(); + poly.Add(new Vertex(0, 0)); + poly.Add(new Vertex(s, 0)); + poly.Add(new Vertex(0, s)); + + Assert.Throws(() => poly.Triangulate()); + } + + [Test] + [Description("Regression: the full allowed coordinate range can be meshed (incircle products don't overflow).")] + public void MeshAtMaximumCoordinates() + { + var poly = new Polygon(); + var random = new Random(1); + + for (int i = 0; i < 200; i++) + { + poly.Add(new Vertex((random.NextDouble() * 2 - 1) * Mesh.MaxCoordinate, (random.NextDouble() * 2 - 1) * Mesh.MaxCoordinate)); + } + + var mesh = poly.Triangulate(); + + Robustness.MeshAssert.IsValid(mesh); + } + + [Test] + [Explicit("Documented limitation of Shewchuk's predicates: products overflow for coordinates around 1e160; such input is rejected by Mesh (MaxCoordinate).")] + [Description("Inherited from Shewchuk's predicates (documented assumption: no overflow): with coordinates around 1e160 both partial products overflow to +Infinity, det = Inf - Inf = NaN and the adaptive stage also yields NaN, so the orientation of a clearly CCW triangle is not positive.")] + public void CounterClockwiseOverflow() + { + const double s = 1e160; + var c = new Point(0, 0); + var a = new Point(1.5 * s, s); + var b = new Point(s, 1.5 * s); + Assert.That(ExactOrient(a, b, c), Is.EqualTo(1)); + double det = new RobustPredicates().CounterClockwise(a, b, c); + Assert.That(det, Is.GreaterThan(0.0), "det = " + det); + } + + [Test] + [Description("Regression: tiny but non-underflowing (1e-160) and large non-overflowing coordinates give correct orientation.")] + public void CounterClockwiseLargeRangeWithoutOverflow([Values(1e-160, 1e-140, 1e140, 1e150)] double s) + { + var a = new Point(0, 0); + var b = new Point(s, 0); + var c = new Point(Ulps(s, -1), Ulps(s, 1)); + Assert.That(Math.Sign(new RobustPredicates().CounterClockwise(a, b, c)), Is.EqualTo(ExactOrient(a, b, c))); + } + + [Test] + [Description("Regression: FindCircumcenter (without off-center) agrees with the exact circumcenter to ~1e-10 of the circumradius for random and moderately skinny triangles; xi/eta are consistent.")] + public void FindCircumcenterAccuracy() + { + var pred = new RobustPredicates(); + var rnd = new Random(3); + for (int n = 0; n < 2000; n++) + { + double scale = Math.Pow(10, rnd.Next(-8, 9)); + double off = rnd.Next(2) * 1000 * scale; + var o = new Point(off + scale * rnd.NextDouble(), off + scale * rnd.NextDouble()); + var d = new Point(off + scale * rnd.NextDouble(), off + scale * rnd.NextDouble()); + double h = Math.Pow(10, -rnd.Next(0, 6)); + // apex roughly at distance h*|od| from od. + var mid = new Point((o.X + d.X) / 2, (o.Y + d.Y) / 2); + var a = new Point(mid.X - h * (d.Y - o.Y), mid.Y + h * (d.X - o.X)); + if (ExactOrient(d, a, o) <= 0) continue; + + double xi = 0, eta = 0; + var c = pred.FindCircumcenter(o, d, a, ref xi, ref eta); + var c2 = pred.FindCircumcenter(o, d, a, ref xi, ref eta, 0.0); + + // Exact circumcenter. + var ox = Exact(o.X); var oy = Exact(o.Y); + var xdo = Exact(d.X) - ox; var ydo = Exact(d.Y) - oy; + var xao = Exact(a.X) - ox; var yao = Exact(a.Y) - oy; + var dodist = xdo * xdo + ydo * ydo; var aodist = xao * xao + yao * yao; + var den = 2 * (xdo * yao - xao * ydo); // scaled by 2^-2148, numerators by 2^-3222 + var unit = BigInteger.One << 1074; + double dx = ToDouble(yao * dodist - ydo * aodist, den * unit); + double dy = ToDouble(xdo * aodist - xao * dodist, den * unit); + double r = Math.Sqrt(dx * dx + dy * dy); + + Assert.That(double.IsFinite(c.X) && double.IsFinite(c.Y), Is.True); + double err = Math.Sqrt(Math.Pow(c.X - (o.X + dx), 2) + Math.Pow(c.Y - (o.Y + dy), 2)); + Assert.That(err, Is.LessThanOrEqualTo(1e-10 * r + 4 * Math.Abs(off) * 1.2e-16), $"n={n} scale={scale} h={h}"); + Assert.That(c2.X, Is.EqualTo(c.X)); + Assert.That(c2.Y, Is.EqualTo(c.Y)); + } + } + + [Test] + [Description("Regression: the off-center (offconstant > 0) lies on the bisector of the shortest edge and is never farther from it than the circumcenter.")] + public void FindCircumcenterOffCenter() + { + var pred = new RobustPredicates(); + // Skinny triangle: shortest edge org-dest. + var o = new Point(0, 0); var d = new Point(1, 0); var a = new Point(0.5, 20); + double xi = 0, eta = 0; + var cc = pred.FindCircumcenter(o, d, a, ref xi, ref eta, 0.0); + var off = pred.FindCircumcenter(o, d, a, ref xi, ref eta, 0.5); + + Assert.That(off.X, Is.EqualTo(0.5).Within(1e-15)); + Assert.That(off.Y, Is.EqualTo(0.5).Within(1e-15)); // 0.5*ydo + 0.5*xdo + Assert.That(off.Y, Is.LessThan(cc.Y)); + Assert.That(eta, Is.EqualTo((off.Y) / 20).Within(1e-12)); + } + + #endregion + } +} diff --git a/src/Triangle/Behavior.cs b/src/Triangle/Behavior.cs index 04af78f..1170ee7 100644 --- a/src/Triangle/Behavior.cs +++ b/src/Triangle/Behavior.cs @@ -51,10 +51,11 @@ private void Update() { quality = true; + // An invalid angle is ignored (other quality options such as the maximum area are + // still applied). if (minAngle < 0 || minAngle > 60) { minAngle = 0; - quality = false; Log.Instance.Warning("Invalid quality option (minimum angle).", "Mesh.Behavior"); } @@ -62,7 +63,6 @@ private void Update() if ((maxAngle != 0.0) && (maxAngle < 60 || maxAngle > 180)) { maxAngle = 0; - quality = false; Log.Instance.Warning("Invalid quality option (maximum angle).", "Mesh.Behavior"); } diff --git a/src/Triangle/Geometry/Contour.cs b/src/Triangle/Geometry/Contour.cs index ec9d54c..51a1f09 100644 --- a/src/Triangle/Geometry/Contour.cs +++ b/src/Triangle/Geometry/Contour.cs @@ -85,16 +85,17 @@ public List GetSegments() /// Try to find a point inside the contour. /// /// The number of iterations on each segment (default = 5). - /// Threshold for co-linear points (default = 2e-5). + /// Not used anymore (all directions are tried). /// Point inside the contour - /// Throws if no point could be found. + /// Throws if no point could be found. /// /// For each corner (index i) of the contour, the 3 points with indices i-1, i and i+1 - /// are considered and a search on the line through the corner vertex is started (either - /// on the bisecting line, or, if is less than - /// eps, on the perpendicular line. - /// A given number of points will be tested (limit), while the distance to the contour - /// boundary will be reduced in each iteration (with a factor 1 / 2^i, i = 1 ... limit). + /// are considered and a search on the bisecting line and on the line perpendicular to + /// the neighbors is started, in both directions. A given number of points will be tested + /// (limit), while the distance to the corner is halved in each iteration. A point must be + /// strictly inside (exact predicates) and is accepted, if its distance to the boundary + /// is at least 10% of its distance to the corner; otherwise the point with the largest + /// distance to the boundary is returned. /// public Point FindInteriorPoint(int limit = 5, double eps = 2e-5) { @@ -139,139 +140,143 @@ private void AddPoints(IEnumerable points) private static Point FindPointInPolygon(List contour, int limit, double eps) { - var bounds = new Rectangle(); - bounds.Expand(contour); - + // Candidates are searched near the corners: in the direction of the angle bisector + // and perpendicular to the line through the neighbors (both ways), at decreasing + // distances. A candidate must lie strictly inside (exact predicates) and should keep + // a distance to the boundary that is not tiny compared to the search distance + // (otherwise rounding, or snapping of the contour while meshing, could move it to the + // other side). If no candidate meets that, the one with the largest clearance is used. int length = contour.Count; - var test = new Point(); - - Point a, b, c; // Current corner points. - - double bx, by; - double dx, dy; - double h; + if (length < 3) + { + throw new InvalidOperationException("A contour needs at least three points."); + } var predicates = RobustPredicates.Default; - a = contour[0]; - b = contour[1]; + var test = new Point(); + Point best = null; + double bestClearance = 0.0; + + Point a = contour[length - 1], b, c; for (int i = 0; i < length; i++) { - c = contour[(i + 2) % length]; - - // Corner point. - bx = b.x; - by = b.y; + b = contour[i]; + c = contour[(i + 1) % length]; - // NOTE: if we knew the contour points were in counterclockwise order, we - // could skip concave corners and search only in one direction. - - h = predicates.CounterClockwise(a, b, c); - - if (Math.Abs(h) < eps) + for (int direction = 0; direction < 2; direction++) { - // Points are nearly co-linear. Use perpendicular direction. - dx = (c.y - a.y) / 2; - dy = (a.x - c.x) / 2; - } - else - { - // Direction [midpoint(a-c) -> corner point] - dx = (a.x + c.x) / 2 - bx; - dy = (a.y + c.y) / 2 - by; - } - - // Move around the contour. - a = b; - b = c; - - h = 1.0; + double dx, dy; - for (int j = 0; j < limit; j++) - { - // Search in direction. - test.x = bx + dx * h; - test.y = by + dy * h; - - if (bounds.Contains(test) && IsPointInPolygon(test, contour) && !IsPointOnSegment(test, contour)) + if (direction == 0) + { + // Direction [corner point -> midpoint(a-c)]. + dx = (a.x + c.x) / 2 - b.x; + dy = (a.y + c.y) / 2 - b.y; + } + else { - return test; + // Perpendicular to a-c. + dx = (c.y - a.y) / 2; + dy = (a.x - c.x) / 2; } - // Search in opposite direction (see NOTE above). - test.x = bx - dx * h; - test.y = by - dy * h; + double h = 1.0; - if (bounds.Contains(test) && IsPointInPolygon(test, contour) && !IsPointOnSegment(test, contour)) + for (int j = 0; j <= limit; j++, h /= 2) { - return test; + for (int sign = -1; sign <= 1; sign += 2) + { + test.x = b.x + sign * dx * h; + test.y = b.y + sign * dy * h; + + if (!IsStrictlyInside(test, contour, predicates)) + { + continue; + } + + double clearance = DistanceToBoundary(test, contour); + double offset = h * Math.Sqrt(dx * dx + dy * dy); + + if (clearance >= 0.1 * offset) + { + return new Point(test.x, test.y); + } + + if (clearance > bestClearance) + { + bestClearance = clearance; + best = new Point(test.x, test.y); + } + } } - - h = h / 2; } + + a = b; + } + + if (best == null) + { + throw new InvalidOperationException("Could not find a point inside the contour (degenerate or self-intersecting contour?)."); } - throw new Exception(); + return best; } /// - /// Return true if the given point is inside the polygon, or false if it is not. + /// Exact point in polygon test (winding number). Points on the boundary are not inside. /// - /// The point to check. - /// The polygon (list of contour points). - /// - /// - /// WARNING: If the point is exactly on the edge of the polygon, then the function - /// may return true or false. - /// - /// See http://alienryderflex.com/polygon/ - /// - private static bool IsPointInPolygon(Point point, List poly) + private static bool IsStrictlyInside(Point p, List poly, IPredicates predicates) { - bool inside = false; - - double x = point.x; - double y = point.y; - + int winding = 0; int count = poly.Count; - for (int i = 0, j = count - 1; i < count; i++) + for (int i = 0, j = count - 1; i < count; j = i++) { - if (((poly[i].y < y && poly[j].y >= y) || (poly[j].y < y && poly[i].y >= y)) - && (poly[i].x <= x || poly[j].x <= x)) + Point q0 = poly[j], q1 = poly[i]; + + double orient = predicates.CounterClockwise(q0, q1, p); + + if (orient == 0.0 && + Math.Min(q0.x, q1.x) <= p.x && p.x <= Math.Max(q0.x, q1.x) && + Math.Min(q0.y, q1.y) <= p.y && p.y <= Math.Max(q0.y, q1.y)) { - inside ^= (poly[i].x + (y - poly[i].y) / (poly[j].y - poly[i].y) * (poly[j].x - poly[i].x) < x); + // On the boundary. + return false; } - j = i; + if (q0.y <= p.y) + { + if (q1.y > p.y && orient > 0.0) winding++; + } + else if (q1.y <= p.y && orient < 0.0) + { + winding--; + } } - return inside; + return winding != 0; } - - /// - /// Work around IsPointInPolygon() failing for points on segments. - /// - private static bool IsPointOnSegment(Point test, List contour, double eps = 1e-12) + private static double DistanceToBoundary(Point p, List poly) { - int count = contour.Count; - - int i = count - 1; + double min = double.MaxValue; + int count = poly.Count; - for (int j = 0; j < count; j++) + for (int i = 0, j = count - 1; i < count; j = i++) { - if (IntersectionHelper.IsPointOnSegment(contour[i], contour[j], test, eps)) - { - return true; - } + Point q0 = poly[j], q1 = poly[i]; + + double dx = q1.x - q0.x, dy = q1.y - q0.y, l2 = dx * dx + dy * dy; + double t = l2 == 0.0 ? 0.0 : Math.Max(0.0, Math.Min(1.0, ((p.x - q0.x) * dx + (p.y - q0.y) * dy) / l2)); + double ex = q0.x + t * dx - p.x, ey = q0.y + t * dy - p.y; - i = j; + min = Math.Min(min, ex * ex + ey * ey); } - return false; + return Math.Sqrt(min); } #endregion diff --git a/src/Triangle/Geometry/Point.cs b/src/Triangle/Geometry/Point.cs index beec352..a9d42ce 100644 --- a/src/Triangle/Geometry/Point.cs +++ b/src/Triangle/Geometry/Point.cs @@ -160,6 +160,11 @@ public bool Equals(Point p) /// public int CompareTo(Point other) { + if (other is null) + { + return 1; + } + if (x == other.x && y == other.y) { return 0; diff --git a/src/Triangle/Geometry/Rectangle.cs b/src/Triangle/Geometry/Rectangle.cs index 049baca..6fe4e5d 100644 --- a/src/Triangle/Geometry/Rectangle.cs +++ b/src/Triangle/Geometry/Rectangle.cs @@ -30,8 +30,11 @@ public Rectangle() /// /// public Rectangle(Rectangle other) - : this(other.Left, other.Bottom, other.Right, other.Top) { + xmin = other.xmin; + ymin = other.ymin; + xmax = other.xmax; + ymax = other.ymax; } /// @@ -177,8 +180,8 @@ public bool Contains(Rectangle other) /// Return true, if given rectangle intersects this rectangle. public bool Intersects(Rectangle other) { - return other.Left < xmax && xmin < other.Right - && other.Bottom < ymax && ymin < other.Top; + return other.Left <= xmax && xmin <= other.Right + && other.Bottom <= ymax && ymin <= other.Top; } } } diff --git a/src/Triangle/IO/FileProcessor.cs b/src/Triangle/IO/FileProcessor.cs index 6b80806..5604303 100644 --- a/src/Triangle/IO/FileProcessor.cs +++ b/src/Triangle/IO/FileProcessor.cs @@ -8,6 +8,7 @@ namespace TriangleNet.IO { using System; using System.Collections.Generic; + using System.Linq; using TriangleNet.Geometry; using TriangleNet.Meshing; @@ -51,7 +52,7 @@ public static bool IsSupported(string file) /// An instance of the class. public static IPolygon Read(string filename) { - foreach (IPolygonFormat format in formats) + foreach (var format in formats.OfType()) { if (format != null && format.IsSupported(filename)) { @@ -69,7 +70,7 @@ public static IPolygon Read(string filename) /// The path of the file to save. public static void Write(IPolygon polygon, string filename) { - foreach (IPolygonFormat format in formats) + foreach (var format in formats.OfType()) { if (format != null && format.IsSupported(filename)) { @@ -92,7 +93,7 @@ public static void Write(IPolygon polygon, string filename) /// An instance of the interface. public static IMesh Import(string filename) { - foreach (IMeshFormat format in formats) + foreach (var format in formats.OfType()) { if (format != null && format.IsSupported(filename)) { @@ -110,7 +111,7 @@ public static IMesh Import(string filename) /// The path of the file to save. public static void Write(IMesh mesh, string filename) { - foreach (IMeshFormat format in formats) + foreach (var format in formats.OfType()) { if (format != null && format.IsSupported(filename)) { diff --git a/src/Triangle/IO/MfemMesh.cs b/src/Triangle/IO/MfemMesh.cs index 0eeaa65..d293b97 100644 --- a/src/Triangle/IO/MfemMesh.cs +++ b/src/Triangle/IO/MfemMesh.cs @@ -79,7 +79,8 @@ public static void Write(IMesh mesh, string filename) /// The target stream. public static void Write(IMesh mesh, Stream stream) { - using var sw = new StreamWriter(stream) + // Leave the caller's stream open. + using var sw = new StreamWriter(stream, new System.Text.UTF8Encoding(false), 1024, true) { NewLine = "\n" }; diff --git a/src/Triangle/IO/TriangleFormat.cs b/src/Triangle/IO/TriangleFormat.cs index e9611f7..737b4c4 100644 --- a/src/Triangle/IO/TriangleFormat.cs +++ b/src/Triangle/IO/TriangleFormat.cs @@ -33,7 +33,7 @@ public bool IsSupported(string file) /// public IMesh Import(string filename) { - string ext = Path.GetExtension(filename); + string ext = Path.GetExtension(filename).ToLowerInvariant(); if (ext == ".node" || ext == ".poly" || ext == ".ele") { @@ -69,7 +69,7 @@ public void Write(IMesh mesh, Stream stream) /// public IPolygon Read(string filename) { - string ext = Path.GetExtension(filename); + string ext = Path.GetExtension(filename).ToLowerInvariant(); if (ext == ".node") { diff --git a/src/Triangle/IO/TriangleReader.cs b/src/Triangle/IO/TriangleReader.cs index 245f3b1..476c3a6 100644 --- a/src/Triangle/IO/TriangleReader.cs +++ b/src/Triangle/IO/TriangleReader.cs @@ -33,16 +33,16 @@ private bool TryReadLine(StreamReader reader, out string[] token) return false; } - string line = reader.ReadLine().Trim(); + string line = StripComment(reader.ReadLine()); - while (string.IsNullOrWhiteSpace(line) || line.StartsWith("#")) + while (string.IsNullOrWhiteSpace(line)) { if (reader.EndOfStream) { return false; } - line = reader.ReadLine().Trim(); + line = StripComment(reader.ReadLine()); } token = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); @@ -50,6 +50,16 @@ private bool TryReadLine(StreamReader reader, out string[] token) return true; } + /// + /// Remove a comment (everything after '#', like Triangle does) and surrounding whitespace. + /// + private static string StripComment(string line) + { + int i = line.IndexOf('#'); + + return (i < 0 ? line : line.Substring(0, i)).Trim(); + } + /// /// Read vertex information of the given line. /// @@ -68,7 +78,7 @@ private void ReadVertex(List data, int index, string[] line, int attribu // Read a vertex marker. if (marks > 0 && line.Length > 3 + attributes) { - v.Label = int.Parse(line[3 + attributes]); + v.Label = int.Parse(line[3 + attributes], nfi); } if (attributes > 0) @@ -176,7 +186,7 @@ public Polygon ReadNodeFile(string nodefilename, bool readElements) // Read number of vertices, number of dimensions, number of vertex // attributes, and number of boundary markers. - invertices = int.Parse(line[0]); + invertices = int.Parse(line[0], nfi); if (invertices < 3) { @@ -185,7 +195,7 @@ public Polygon ReadNodeFile(string nodefilename, bool readElements) if (line.Length > 1) { - if (int.Parse(line[1]) != 2) + if (int.Parse(line[1], nfi) != 2) { throw new Exception("Triangle only works with two-dimensional meshes."); } @@ -193,12 +203,12 @@ public Polygon ReadNodeFile(string nodefilename, bool readElements) if (line.Length > 2) { - attributes = int.Parse(line[2]); + attributes = int.Parse(line[2], nfi); } if (line.Length > 3) { - nodemarkers = int.Parse(line[3]); + nodemarkers = int.Parse(line[3], nfi); } data = new Polygon(invertices); @@ -287,11 +297,11 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre // Read number of vertices, number of dimensions, number of vertex // attributes, and number of boundary markers. - invertices = int.Parse(line[0]); + invertices = int.Parse(line[0], nfi); if (line.Length > 1) { - if (int.Parse(line[1]) != 2) + if (int.Parse(line[1], nfi) != 2) { throw new Exception("Triangle only works with two-dimensional meshes."); } @@ -299,12 +309,12 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre if (line.Length > 2) { - attributes = int.Parse(line[2]); + attributes = int.Parse(line[2], nfi); } if (line.Length > 3) { - nodemarkers = int.Parse(line[3]); + nodemarkers = int.Parse(line[3], nfi); } // Read the vertices. @@ -357,12 +367,12 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre throw new Exception("Can't read input file (segments)."); } - int insegments = int.Parse(line[0]); + int insegments = int.Parse(line[0], nfi); int segmentmarkers = 0; if (line.Length > 1) { - segmentmarkers = int.Parse(line[1]); + segmentmarkers = int.Parse(line[1], nfi); } int end1, end2, mark; @@ -380,13 +390,13 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre } // TODO: startIndex ok? - end1 = int.Parse(line[1]) - startIndex; - end2 = int.Parse(line[2]) - startIndex; + end1 = int.Parse(line[1], nfi) - startIndex; + end2 = int.Parse(line[2], nfi) - startIndex; mark = 0; if (segmentmarkers > 0 && line.Length > 3) { - mark = int.Parse(line[3]); + mark = int.Parse(line[3], nfi); } if ((end1 < 0) || (end1 >= invertices)) @@ -419,7 +429,7 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre throw new Exception("Can't read input file (holes)."); } - int holes = int.Parse(line[0]); + int holes = int.Parse(line[0], nfi); if (holes > 0) { for (int i = 0; i < holes; i++) @@ -442,7 +452,7 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre // Read area constraints (optional). if (TryReadLine(reader, out line)) { - int id, regions = int.Parse(line[0]); + int id, regions = int.Parse(line[0], nfi); if (regions > 0) { @@ -458,7 +468,7 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre throw new Exception("Invalid region attributes."); } - if (!int.TryParse(line[3], out id)) + if (!int.TryParse(line[3], NumberStyles.Integer, nfi, out id)) { id = i; } @@ -467,7 +477,7 @@ public Polygon ReadPolyFile(string polyfilename, bool readElements, bool readAre if (line.Length > 4) { - double.TryParse(line[4], NumberStyles.Number, nfi, out area); + double.TryParse(line[4], NumberStyles.Float, nfi, out area); } // Triangle's .poly file format allows region definitions with @@ -534,13 +544,15 @@ private List ReadEleFile(string elefilename, bool readArea) throw new Exception("Can't read input file (elements)."); } - intriangles = int.Parse(line[0]); + intriangles = int.Parse(line[0], nfi); + + // Number of nodes per triangle (3 or 6, only the corners are used). + int nodesPerTriangle = line.Length > 1 ? int.Parse(line[1], nfi) : 3; - // We ignore index 1 (number of nodes per triangle) attributes = 0; if (line.Length > 2) { - attributes = int.Parse(line[2]); + attributes = int.Parse(line[2], nfi); validRegion = true; } @@ -569,15 +581,16 @@ private List ReadEleFile(string elefilename, bool readArea) // TODO: startIndex ok? tri = new InputTriangle( - int.Parse(line[1]) - startIndex, - int.Parse(line[2]) - startIndex, - int.Parse(line[3]) - startIndex); + int.Parse(line[1], nfi) - startIndex, + int.Parse(line[2], nfi) - startIndex, + int.Parse(line[3], nfi) - startIndex); // Read triangle region if (attributes > 0 && validRegion) { int region = 0; - validRegion = int.TryParse(line[4], out region); + validRegion = line.Length > 1 + nodesPerTriangle && + int.TryParse(line[1 + nodesPerTriangle], NumberStyles.Integer, nfi, out region); tri.label = region; } @@ -616,7 +629,7 @@ private double[] ReadAreaFile(string areafilename, int intriangles) throw new Exception("Can't read input file (area)."); } - if (int.Parse(line[0]) != intriangles) + if (int.Parse(line[0], nfi) != intriangles) { Log.Instance.Warning("Number of area constraints doesn't match number of triangles.", "TriangleReader.ReadAreaFile()"); @@ -670,12 +683,12 @@ public List ReadEdgeFile(string edgeFile, int invertices) throw new Exception("Can't read input file (segments)."); } - int inedges = int.Parse(line[0]); + int inedges = int.Parse(line[0], nfi); int edgemarkers = 0; if (line.Length > 1) { - edgemarkers = int.Parse(line[1]); + edgemarkers = int.Parse(line[1], nfi); } if (inedges > 0) @@ -698,13 +711,13 @@ public List ReadEdgeFile(string edgeFile, int invertices) } // TODO: startIndex ok? - end1 = int.Parse(line[1]) - startIndex; - end2 = int.Parse(line[2]) - startIndex; + end1 = int.Parse(line[1], nfi) - startIndex; + end2 = int.Parse(line[2], nfi) - startIndex; mark = 0; if (edgemarkers > 0 && line.Length > 3) { - mark = int.Parse(line[3]); + mark = int.Parse(line[3], nfi); } if ((end1 < 0) || (end1 >= invertices)) diff --git a/src/Triangle/IO/TriangleWriter.cs b/src/Triangle/IO/TriangleWriter.cs index 695eba9..84e4c0a 100644 --- a/src/Triangle/IO/TriangleWriter.cs +++ b/src/Triangle/IO/TriangleWriter.cs @@ -18,6 +18,28 @@ namespace TriangleNet.IO /// public class TriangleWriter { + /// + /// Writes numbers culture-independent (also integers, e.g. negative labels). + /// + private sealed class InvariantStreamWriter : StreamWriter + { + public InvariantStreamWriter(string path) + : base(path) + { + } + + public override System.IFormatProvider FormatProvider => CultureInfo.InvariantCulture; + } + + private sealed class ReferenceComparer : IEqualityComparer + { + public static readonly ReferenceComparer Instance = new ReferenceComparer(); + + public bool Equals(Vertex a, Vertex b) => ReferenceEquals(a, b); + + public int GetHashCode(Vertex v) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(v); + } + private static readonly NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo; /// @@ -38,7 +60,7 @@ public void Write(Mesh mesh, string filename) /// public void WriteNodes(Mesh mesh, string filename) { - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); WriteNodes(writer, mesh); } @@ -113,6 +135,13 @@ private void WriteNodes(StreamWriter writer, IEnumerable nodes, bool mar { if (!jettison || vertex.type != VertexType.UndeadVertex) { + if (jettison) + { + // Undead vertices are skipped: elements and segments must refer to + // the compacted numbering. + vertex.id = index; + } + // Vertex number, x and y coordinates. writer.Write("{0} {1} {2}", index, vertex.x.ToString(nfi), vertex.y.ToString(nfi)); @@ -151,7 +180,7 @@ public void WriteElements(Mesh mesh, string filename) tri.orient = 0; - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); // Number of triangles, vertices per triangle, attributes per triangle. writer.WriteLine("{0} 3 {1}", mesh.triangles.Count, regions ? 1 : 0); @@ -191,7 +220,7 @@ public void WritePoly(IPolygon polygon, string filename) { bool hasMarkers = polygon.HasSegmentMarkers; - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); // TODO: write vertex attributes @@ -203,20 +232,42 @@ public void WritePoly(IPolygon polygon, string filename) // Number of segments, number of boundary markers (zero or one). writer.WriteLine("{0} {1}", polygon.Segments.Count, hasMarkers ? "1" : "0"); + // The nodes are numbered by their position in the list (not by their ID, which + // isn't set for polygons built from contours). + var index = new Dictionary(polygon.Points.Count, ReferenceComparer.Instance); + + for (int i = 0; i < polygon.Points.Count; i++) + { + if (!index.ContainsKey(polygon.Points[i])) + { + index.Add(polygon.Points[i], i); + } + } + + int Index(Vertex v) + { + if (index.TryGetValue(v, out int i)) + { + return i; + } + + throw new System.InvalidOperationException("Segment endpoint is not in the list of polygon points."); + } + int j = 0; foreach (var seg in polygon.Segments) { - var p = seg.GetVertex(0); - var q = seg.GetVertex(1); + int p = Index(seg.GetVertex(0)); + int q = Index(seg.GetVertex(1)); // Segment number, indices of its two endpoints, and possibly a marker. if (hasMarkers) { - writer.WriteLine("{0} {1} {2} {3}", j, p.ID, q.ID, seg.Label); + writer.WriteLine("{0} {1} {2} {3}", j, p, q, seg.Label); } else { - writer.WriteLine("{0} {1} {2}", j, p.ID, q.ID); + writer.WriteLine("{0} {1} {2}", j, p, q); } j++; @@ -237,8 +288,8 @@ public void WritePoly(IPolygon polygon, string filename) writer.WriteLine("{0}", polygon.Regions.Count); foreach (var region in polygon.Regions) { - writer.WriteLine("{0} {1} {2} {3}", j, region.Point.X.ToString(nfi), - region.Point.Y.ToString(nfi), region.Label); + writer.WriteLine("{0} {1} {2} {3} {4}", j, region.Point.X.ToString(nfi), + region.Point.Y.ToString(nfi), region.Label, region.Area.ToString(nfi)); j++; } @@ -270,7 +321,7 @@ public void WritePoly(Mesh mesh, string filename, bool writeNodes) bool useBoundaryMarkers = mesh.behavior.UseBoundaryMarkers; - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); if (writeNodes) { @@ -328,8 +379,8 @@ public void WritePoly(Mesh mesh, string filename, bool writeNodes) writer.WriteLine("{0}", mesh.regions.Count); foreach (var region in mesh.regions) { - writer.WriteLine("{0} {1} {2} {3}", j, region.Point.X.ToString(nfi), - region.Point.Y.ToString(nfi), region.Label); + writer.WriteLine("{0} {1} {2} {3} {4}", j, region.Point.X.ToString(nfi), + region.Point.Y.ToString(nfi), region.Label, region.Area.ToString(nfi)); j++; } @@ -348,7 +399,7 @@ public void WriteEdges(Mesh mesh, string filename) var behavior = mesh.behavior; - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); // Number of edges, number of boundary markers (zero or one). writer.WriteLine("{0} {1}", mesh.NumberOfEdges, behavior.UseBoundaryMarkers ? "1" : "0"); @@ -421,7 +472,7 @@ public void WriteNeighbors(Mesh mesh, string filename) int n1, n2, n3; int i = 0; - using var writer = new StreamWriter(filename); + using var writer = new InvariantStreamWriter(filename); // Number of triangles, three neighbors per triangle. writer.WriteLine("{0} 3", mesh.triangles.Count); diff --git a/src/Triangle/Log.cs b/src/Triangle/Log.cs index 3dee73c..02f359d 100644 --- a/src/Triangle/Log.cs +++ b/src/Triangle/Log.cs @@ -74,7 +74,8 @@ public sealed class Log public static bool Verbose { get; set; } /// - /// Gets all log messages. + /// Gets all log messages. Adding messages is thread-safe; lock on this list while + /// enumerating it if meshing runs in parallel. /// public IList Data { get; } = new List(); @@ -102,7 +103,10 @@ private Log() { } /// public void Add(LogEvent item) { - Data.Add(item); + lock (Data) + { + Data.Add(item); + } } /// @@ -110,7 +114,10 @@ public void Add(LogEvent item) /// public void Clear() { - Data.Clear(); + lock (Data) + { + Data.Clear(); + } } /// @@ -119,7 +126,7 @@ public void Clear() /// The message. public void Info(string message) { - Data.Add(new LogEvent(LogEventLevel.Information, message)); + Add(new LogEvent(LogEventLevel.Information, message)); } /// @@ -129,7 +136,7 @@ public void Info(string message) /// Message details, for example the code location where the error occurred (class, method). public void Warning(string message, string details) { - Data.Add(new LogEvent(LogEventLevel.Warning, message, details)); + Add(new LogEvent(LogEventLevel.Warning, message, details)); } /// @@ -139,7 +146,7 @@ public void Warning(string message, string details) /// Message details, for example the code location where the error occurred (class, method). public void Error(string message, string details) { - Data.Add(new LogEvent(LogEventLevel.Error, message, details)); + Add(new LogEvent(LogEventLevel.Error, message, details)); } } } diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 7cfdaac..9a90ff4 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -116,7 +116,7 @@ public class Mesh : IMesh /// /// Gets the number of mesh edges. /// - public int NumberOfEdges => (3 * triangles.Count + hullsize) / 2; + public int NumberOfEdges => triangles.Count == 0 ? 0 : (3 * triangles.Count + hullsize) / 2; /// /// Indicates whether the input is a PSLG or a point set. @@ -134,6 +134,14 @@ public class Mesh : IMesh internal const int DUMMY = -1; + // The configuration the mesh was created with (used for refinement). + private readonly Configuration config; + + /// + /// Maximum absolute value of input coordinates. + /// + public const double MaxCoordinate = 1e70; + // The triangle that fills "outer space," called 'dummytri', is pointed to // by every triangle and subsegment on a boundary (be it outer or inner) of // the triangulation. Also, 'dummytri' points to one of the triangles on @@ -215,6 +223,8 @@ public Mesh(Configuration config, IList points) predicates = config.Predicates(); + this.config = config; + locator = new TriangleLocator(this, predicates, config.RandomSource()); TransferNodes(points); @@ -237,9 +247,17 @@ public void Refine(QualityOptions quality, bool delaunay = false, CancellationTo Reset(); + if (subsegs.Count == 0 && triangles.Count > 0) + { + // Mesh of a point set: enclose the convex hull with subsegments (like the + // triangulation of a polygon without segments does), otherwise refinement + // inserts vertices outside the hull. + new ConstraintMesher(this, config).MarkHull(); + } + if (qualityMesher == null) { - qualityMesher = new QualityMesher(this, new Configuration()); + qualityMesher = new QualityMesher(this, config); } // Enforce angle and area constraints. @@ -280,10 +298,12 @@ public void Renumber(NodeNumbering num) var rcm = new CuthillMcKee(); var iperm = rcm.Renumber(this); - // Permute the node indices. + // Permute the node indices (undead vertices aren't part of the permutation). + int next = iperm.Length; + foreach (var node in vertices.Values) { - node.id = iperm[node.id]; + node.id = node.type == VertexType.UndeadVertex ? next++ : iperm[node.id]; } } @@ -296,6 +316,8 @@ public void Renumber(NodeNumbering num) { item.id = id++; } + + triangles.SetNextId(id); } #region Misc @@ -401,6 +423,13 @@ private void TransferNodes(IList points) { throw new ArgumentException("Input vertex (ID " + p.id + ") has a NaN or infinite coordinate.", nameof(points)); } + + // The exact predicates evaluate products of up to four coordinate differences + // (incircle test), which overflow beyond about 1e75. + if (Math.Abs(p.x) > MaxCoordinate || Math.Abs(p.y) > MaxCoordinate) + { + throw new ArgumentException("Input vertex (ID " + p.id + ") has a coordinate larger than " + MaxCoordinate + " (exact arithmetic would overflow).", nameof(points)); + } } // Use the user defined ids only if they are pairwise distinct. @@ -408,6 +437,10 @@ private void TransferNodes(IList points) foreach (var p in points) { + // The vertex might have been used in another mesh before. + p.tri = default(Otri); + p.type = VertexType.InputVertex; + if (userId) { p.hash = p.id; diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 578bc4c..4520a89 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -1262,7 +1262,7 @@ private void InsertSegment(Vertex endpoint1, Vertex endpoint2, int newmark) /// /// Cover the convex hull of a triangulation with subsegments. /// - private void MarkHull() + internal void MarkHull() { Otri hulltri = default(Otri); Otri nexttri = default(Otri); diff --git a/src/Triangle/Meshing/Iterators/VertexCirculator.cs b/src/Triangle/Meshing/Iterators/VertexCirculator.cs index 980f02f..44ce28d 100644 --- a/src/Triangle/Meshing/Iterators/VertexCirculator.cs +++ b/src/Triangle/Meshing/Iterators/VertexCirculator.cs @@ -15,8 +15,6 @@ namespace TriangleNet.Meshing.Iterators /// public class VertexCirculator { - private readonly List cache = new List(); - /// /// Initializes a new instance of the class. /// @@ -32,9 +30,7 @@ public VertexCirculator(Mesh mesh) /// public IEnumerable EnumerateVertices(Vertex vertex) { - BuildCache(vertex, true); - - foreach (var item in cache) + foreach (var item in BuildCache(vertex, true)) { yield return item.Dest(); } @@ -47,17 +43,22 @@ public IEnumerable EnumerateVertices(Vertex vertex) /// public IEnumerable EnumerateTriangles(Vertex vertex) { - BuildCache(vertex, false); - - foreach (var item in cache) + foreach (var item in BuildCache(vertex, false)) { yield return item.tri; } } - private void BuildCache(Vertex vertex, bool vertices) + private List BuildCache(Vertex vertex, bool vertices) { - cache.Clear(); + // A new list for each call (enumerations may be nested). + var cache = new List(); + + if (vertex.tri.tri == null || vertex.type == VertexType.UndeadVertex) + { + // Not part of the mesh topology (e.g. a duplicate input vertex). + return cache; + } Otri init = vertex.tri; Otri next = default; @@ -106,6 +107,8 @@ private void BuildCache(Vertex vertex, bool vertices) } } } + + return cache; } } } diff --git a/src/Triangle/Topology/DCEL/DcelMesh.cs b/src/Triangle/Topology/DCEL/DcelMesh.cs index 339cd3c..4507677 100644 --- a/src/Triangle/Topology/DCEL/DcelMesh.cs +++ b/src/Triangle/Topology/DCEL/DcelMesh.cs @@ -218,10 +218,9 @@ public virtual bool IsConsistent(bool closed = true, int depth = 0) /// public void ResolveBoundaryEdges() { - // Maps vertices to leaving boundary edge. - var map = new Dictionary(); + // Create the missing twins (boundary half-edges of the outer face). + var boundary = new List(); - // TODO: parallel? foreach (var edge in edges) { if (edge.twin == null) @@ -229,21 +228,50 @@ public void ResolveBoundaryEdges() var twin = edge.twin = new HalfEdge(edge.next.origin, Face.Empty); twin.twin = edge; - map.Add(twin.origin.id, twin); + boundary.Add(twin); } } int j = edges.Count; - foreach (var edge in map.Values) + foreach (var twin in boundary) { - edge.id = j++; - edge.next = map[edge.twin.origin.id]; + // The boundary half-edge ends at the origin of its twin (vertex a). Its successor + // leaves a along the boundary: rotate around a, starting at the twin, until the + // boundary is reached. Unlike a lookup by vertex, this also works if two boundary + // half-edges leave the same vertex (faces touching at a vertex). + var e = twin.twin; - edges.Add(edge); + while (true) + { + var entering = Previous(e); + + if (entering.twin.face == Face.Empty) + { + twin.next = entering.twin; + break; + } + + e = entering.twin; + } + + twin.id = j++; + edges.Add(twin); } } + private static HalfEdge Previous(HalfEdge edge) + { + var prev = edge; + + while (prev.next != edge) + { + prev = prev.next; + } + + return prev; + } + /// /// Enumerates all edges of the DCEL. /// diff --git a/src/Triangle/Topology/DCEL/HalfEdge.cs b/src/Triangle/Topology/DCEL/HalfEdge.cs index 99afcea..6b87913 100644 --- a/src/Triangle/Topology/DCEL/HalfEdge.cs +++ b/src/Triangle/Topology/DCEL/HalfEdge.cs @@ -96,7 +96,8 @@ public HalfEdge(Vertex origin, Face face) this.face = face; // IMPORTANT: do not remove the (face.edge == null) check! - if (face != null && face.edge == null) + // The shared Face.Empty must not reference an edge of a particular mesh. + if (face != null && face.edge == null && face != Face.Empty) { face.edge = this; } diff --git a/src/Triangle/TrianglePool.cs b/src/Triangle/TrianglePool.cs index 8b7f1ef..3d5943e 100644 --- a/src/Triangle/TrianglePool.cs +++ b/src/Triangle/TrianglePool.cs @@ -51,6 +51,23 @@ public TrianglePool() stack = new Stack(BLOCKSIZE); } + // After the triangles have been renumbered (ids 0 to n-1), new triangles get the + // following ids (their hash could collide with the new ids). -1: ids are hashes. + private int nextId = -1; + + /// + /// Continue the numbering of new triangles after renumbering the triangles. + /// + internal void SetNextId(int id) + { + nextId = id; + } + + private int NextId(Triangle triangle) + { + return nextId < 0 ? triangle.hash : nextId++; + } + /// /// Gets a triangle from the pool. /// @@ -64,12 +81,14 @@ public Triangle Get() triangle = stack.Pop(); triangle.hash = -triangle.hash - 1; + triangle.id = NextId(triangle); + Cleanup(triangle); } else if (count < size) { triangle = pool[count / BLOCKSIZE][count % BLOCKSIZE]; - triangle.id = triangle.hash; + triangle.id = NextId(triangle); Cleanup(triangle); @@ -79,7 +98,7 @@ public Triangle Get() { triangle = new Triangle(); triangle.hash = size; - triangle.id = triangle.hash; + triangle.id = NextId(triangle); int block = size / BLOCKSIZE; @@ -140,19 +159,23 @@ public TrianglePool Restart() /// internal IEnumerable Sample(int k, Random random) { - int i, count = this.Count; + int i, alive = this.Count; - if (k > count) + if (k > alive) { // TODO: handle Sample special case. - k = count; + k = alive; } Triangle t; // TODO: improve sampling code (to ensure no duplicates). - while (k > 0) + // Live triangles are spread over all used slots [0, count), not only the first + // 'alive' ones. Bound the number of attempts (if almost all slots are free). + int attempts = 20 * k + 100; + + while (k > 0 && attempts-- > 0) { i = random.Next(0, count); @@ -203,7 +226,7 @@ public void Clear() var block = pool[i]; // Number of triangles in current block: - int length = (size - i * BLOCKSIZE) % BLOCKSIZE; + int length = Math.Min(BLOCKSIZE, size - i * BLOCKSIZE); for (int j = 0; j < length; j++) { @@ -212,6 +235,7 @@ public void Clear() } size = count = 0; + nextId = -1; } /// @@ -219,7 +243,7 @@ public bool Contains(Triangle item) { int i = item.hash; - if (i < 0 || i > size) + if (i < 0 || i >= size) { return false; } From 311d41776367ab93cb79b61c76aff386c285b273 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 07:42:33 +0000 Subject: [PATCH 15/50] Fix bugs found in review: quality refinement, noding, converter, voronoi, smoothing, tools Quality: MaximumAngle alone is enforced, NewLocation work arrays sized for both wedge methods (IndexOutOfRange after refining with a maximum angle), triangles after vertex deletion are always tested (too large triangles with SegmentSplitting 1/2), VariableArea on point-set meshes, BadTriQueue clamps extreme keys. Noding: unique ids for intersection vertices (user ids were renumbered), non-zero label wins for coinciding pieces, merged vertices keep their label, hole/region points inside collapsed contours are dropped (SnapTolerance larger than a hole emptied the mesh), sweep along the axis with less overlap (long parallel segments were quadratic) with the same pair order. Regions: last region point wins (values from the region, not the seed). Converter: ToDCEL at pinch vertices, ToMesh with arbitrary vertex ids. Voronoi: unique half-edge ids, StandardVoronoi doesn't modify the box, legacy diagrams skip duplicate vertices, SimpleVoronoi bounds include the mesh, BoundedVoronoi documents the conforming requirement. SimpleSmoother: separate pool per run (reusing the smoother corrupted the previous mesh), vertices restored on cancellation, stop criterion after two real iterations. VoronoiFactory resets pooled objects. Tools: Reverse Cuthill-McKee neighbor sorting (1-based leftovers), TriangleQuadTree exact point-in-triangle test, PolygonValidator null points and segment endpoints, relative tolerance in IsPointOnSegment, BoxRay- Intersection without direction. Golden fingerprints of three SegmentSplitting=1 scenarios change (fewer bad triangles). Tests from the review (B, C, E). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Characterization/golden.txt | 6 +- src/Triangle.Tests/Review/ReviewBTest.cs | 363 +++++++ src/Triangle.Tests/Review/ReviewCTest.cs | 333 +++++++ src/Triangle.Tests/Review/ReviewETest.cs | 916 ++++++++++++++++++ src/Triangle.Tests/Tools/CuthillMcKeeTest.cs | 17 +- src/Triangle/Mesh.cs | 9 +- src/Triangle/Meshing/ConstraintMesher.cs | 17 +- src/Triangle/Meshing/Converter.cs | 35 +- src/Triangle/Meshing/Data/BadTriQueue.cs | 5 + src/Triangle/Meshing/QualityMesher.cs | 10 +- src/Triangle/Meshing/SegmentNoder.cs | 150 ++- src/Triangle/NewLocation.cs | 24 +- src/Triangle/Smoothing/SimpleSmoother.cs | 50 +- src/Triangle/Smoothing/VoronoiFactory.cs | 5 + src/Triangle/Tools/CuthillMcKee.cs | 9 +- src/Triangle/Tools/IntersectionHelper.cs | 15 +- src/Triangle/Tools/PolygonValidator.cs | 58 +- src/Triangle/Tools/TriangleQuadTree.cs | 34 +- src/Triangle/Voronoi/BoundedVoronoi.cs | 19 +- .../Voronoi/Legacy/BoundedVoronoiLegacy.cs | 6 + src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs | 9 + src/Triangle/Voronoi/StandardVoronoi.cs | 3 +- 22 files changed, 1944 insertions(+), 149 deletions(-) create mode 100644 src/Triangle.Tests/Review/ReviewBTest.cs create mode 100644 src/Triangle.Tests/Review/ReviewCTest.cs create mode 100644 src/Triangle.Tests/Review/ReviewETest.cs diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt index b459232..b1d101d 100644 --- a/src/Triangle.Tests/Characterization/golden.txt +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -2,7 +2,7 @@ crossing-segments/cdt V=254 T=502 S=384 H=bf81edf07e78350b crossing-segments/conforming V=826 T=1575 S=956 H=d68dce809dfb02b1 crossing-segments/q20 V=966 T=1870 S=910 H=76f061d745864ccf crossing-segments/q20-locked V=718 T=1376 S=683 H=73db4687411d37d1 -crossing-segments/q20-split1 V=843 T=1680 S=832 H=2e87800f1868a585 +crossing-segments/q20-split1 V=883 T=1760 S=842 H=c1f4cbf4d55ca92c crossing-segments/q20-split2 V=348 T=690 S=384 H=7d65f2e742a90bdd crossing-segments/q25-conforming V=1805 T=3516 S=1476 H=53d733fb7263e4dd crossing-segments/q28-legacy V=2288 T=4481 S=1421 H=231417f572d6dae6 @@ -61,7 +61,7 @@ star/cdt V=29 T=52 S=28 H=5bc51ce8a1a2dccd star/conforming V=41 T=64 S=40 H=995ef7419a113eb9 star/q20 V=73 T=132 S=57 H=ab2301bf2fe73b12 star/q20-locked V=61 T=108 S=36 H=cba2b0965478a18f -star/q20-split1 V=62 T=118 S=49 H=674428aa6b61da20 +star/q20-split1 V=65 T=124 S=49 H=ced110f295f6ce3a star/q20-split2 V=53 T=100 S=28 H=ed1b8bb3c07b060e star/q25-conforming V=119 T=220 S=82 H=9c180df1bfdb281f star/q28-legacy V=217 T=402 S=104 H=713f81fc266ce714 @@ -70,7 +70,7 @@ utm-breaklines/cdt V=472 T=938 S=164 H=7dd74060ee3f73cf utm-breaklines/conforming V=745 T=1392 S=437 H=469273a785ce5031 utm-breaklines/q20 V=994 T=1911 S=377 H=f2bd7f6462bcee59 utm-breaklines/q20-locked V=855 T=1632 S=312 H=aebdd9f6243551b3 -utm-breaklines/q20-split1 V=900 T=1794 S=306 H=6016275b703bca6b +utm-breaklines/q20-split1 V=907 T=1808 S=306 H=615f4f7534322a5e utm-breaklines/q20-split2 V=593 T=1180 S=164 H=60668d1cfa86add9 utm-breaklines/q25-conforming V=1440 T=2761 S=548 H=0e9c30ea67a8421a utm-breaklines/q28-legacy V=1973 T=3836 S=530 H=4c9fa8625248c6c7 diff --git a/src/Triangle.Tests/Review/ReviewBTest.cs b/src/Triangle.Tests/Review/ReviewBTest.cs new file mode 100644 index 0000000..a0aad69 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewBTest.cs @@ -0,0 +1,363 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Threading; +using NUnit.Framework; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Data; +using TriangleNet.Tests.Characterization; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Review +{ + public class ReviewBTest + { + private static Polygon Square(double size = 10) + { + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0), new Vertex(size, 0), new Vertex(size, size), new Vertex(0, size) }, 1)); + return poly; + } + + private static Polygon SquareWithRandomPoints(int seed, int n, double size = 10) + { + var poly = Square(size); + var rnd = new Random(seed); + for (int i = 0; i < n; i++) + { + poly.Add(new Vertex(size * (0.05 + 0.9 * rnd.NextDouble()), size * (0.05 + 0.9 * rnd.NextDouble()))); + } + return poly; + } + + private static double MaximumAngle(ITriangle t) + { + var a = t.GetVertex(0); var b = t.GetVertex(1); var c = t.GetVertex(2); + double A(Point p, Point q, Point r) + { + double ux = q.X - p.X, uy = q.Y - p.Y, vx = r.X - p.X, vy = r.Y - p.Y; + return Math.Abs(Math.Atan2(ux * vy - uy * vx, ux * vx + uy * vy)) * 180 / Math.PI; + } + return Math.Max(A(a, b, c), Math.Max(A(b, c, a), A(c, a, b))); + } + + [Test] + [Description("NewLocation shares petalx/wedges work arrays between the 'without max angle' (32 doubles per star point) and the max angle " + + "wedge intersection (40 per point), but only resizes on 2*numpoints > petalx.Length. Refining a mesh again with MaximumAngle " + + "after a refinement without it reuses the too small wedges array: IndexOutOfRangeException.")] + public void RefineAgainWithMaximumAngle_DoesNotThrow() + { + var mesh = (Mesh)SquareWithRandomPoints(17, 30).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 33, MaximumArea = 0.05 }); + + Assert.DoesNotThrow(() => mesh.Refine(new QualityOptions { MinimumAngle = 33, MaximumAngle = 100, MaximumArea = 0.02 })); + MeshAssert.IsValid(mesh); + } + + /// + /// Control for : the same refinement with + /// a fresh mesher works. + /// + [Test] + public void RefineWithMaximumAngle_FreshMesher_Works() + { + var mesh = (Mesh)SquareWithRandomPoints(17, 30).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 33, MaximumAngle = 100, MaximumArea = 0.02 }); + + MeshAssert.IsValid(mesh); + } + + [Test] + [Description("QualityMesher.EnforceQuality only runs the bad triangle loop if MinAngle > 0, an area constraint or UserTest is set. " + + "A MaximumAngle constraint alone is silently ignored (fix: add behavior.MaxAngle > 0 to the condition).")] + public void MaximumAngleAlone_IsEnforced([Values(false, true)] bool legacy) + { + var mesh = SquareWithRandomPoints(1, 40).Triangulate(new ConstraintOptions(), + new QualityOptions { MaximumAngle = 100, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + double max = mesh.Triangles.Max(MaximumAngle); + Assert.That(max, Is.LessThanOrEqualTo(100 + 1e-6)); + } + + [Test] + public void MaximumAngleWithMinimumAngle_IsEnforced([Values(false, true)] bool legacy, [Values(20, 30)] double minAngle) + { + var mesh = MeshAssert.Terminates(() => SquareWithRandomPoints(1, 40).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = minAngle, MaximumAngle = 100, UseLegacyRefinement = legacy })); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MaximumAngle(t) > 100 + 1e-6), Is.Zero, "max angle"); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < minAngle - 1e-6), Is.Zero, "min angle"); + } + + [Test] + public void NoBisect_AreaConstraintIsRespected([Values(1, 2)] int splitting, [Values(false, true)] bool legacy, [Values(0, 20, 30)] double minAngle) + { + var poly = SquareWithRandomPoints(3, 20); + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SegmentSplitting = splitting }, + new QualityOptions { MinimumAngle = minAngle, MaximumArea = 0.1, UseLegacyRefinement = legacy })); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.1 * (1 + 1e-9)), Is.Zero); + } + + [TestCase(0.0)] + [TestCase(1e-310)] + [TestCase(double.Epsilon)] + [TestCase(double.PositiveInfinity)] + [Description("BadTriQueue.Enqueue computes 1/key for keys < 1. For key 0 or a subnormal key (squared shortest edge < 2.2e-308) " + + "1/key is infinite, the exponent loop yields 2048 and the queue index 4096 (IndexOutOfRange); key = +inf yields index -1. " + + "Fix: clamp the queue number to 0..4095 (or treat non-finite lengths explicitly).")] + public void BadTriQueue_ExtremeKeys(double key) + { + var queue = new BadTriQueue(); + Assert.DoesNotThrow(() => queue.Enqueue(new BadTriangle { key = key })); + Assert.That(queue.Dequeue(), Is.Not.Null); + } + + [TestCase(double.MaxValue)] + [TestCase(double.NaN)] + [TestCase(-1.0)] + public void BadTriQueue_OtherUnusualKeys(double key) + { + var queue = new BadTriQueue(); + Assert.DoesNotThrow(() => queue.Enqueue(new BadTriangle { key = key })); + Assert.That(queue.Dequeue(), Is.Not.Null); + } + + [Test] + public void BadTriQueue_PriorityOrder() + { + var queue = new BadTriQueue(); + double[] keys = { 1e10, 1e-200, 1.0, 0.25, 4.0, 1e300, 1e-300 }; + foreach (var k in keys) queue.Enqueue(new BadTriangle { key = k }); + + var order = Enumerable.Range(0, keys.Length).Select(_ => queue.Dequeue().key).ToArray(); + Assert.That(order, Is.EqualTo(keys.OrderBy(k => k).ToArray())); + Assert.That(queue.Dequeue(), Is.Null); + } + + [Test] + public void SteinerPointLimitIsRespected([Values(1, 2, 5, 17, 50)] int limit, [Values(false, true)] bool legacy) + { + var poly = SquareWithRandomPoints(5, 20); + poly.Add(new Segment(poly.Points[0], poly.Points[2])); + var mesh = poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 30, MaximumArea = 0.01, SteinerPoints = limit, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count, Is.LessThanOrEqualTo(24 + limit)); + } + + [Test] + public void CancelledToken_Throws() + { + var mesh = (Mesh)SquareWithRandomPoints(5, 20).Triangulate(); + var cts = new CancellationTokenSource(); + cts.Cancel(); + Assert.Throws(() => mesh.Refine(new QualityOptions { MinimumAngle = 30, MaximumArea = 0.01 }, false, cts.Token)); + } + + [Test] + public void HighDegreeInputVertex_Fan([Values(300, 600)] int n, [Values(false, true)] bool legacy) + { + var poly = new Polygon(); + var center = new Vertex(0, 0); + poly.Add(center); + var ring = new Vertex[n]; + for (int i = 0; i < n; i++) + { + double a = 2 * Math.PI * i / n; + ring[i] = new Vertex(10 * Math.Cos(a), 10 * Math.Sin(a)); + } + poly.Add(new Contour(ring, 1)); + for (int i = 0; i < n; i += 1) + { + poly.Add(new Segment(center, ring[i])); + } + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, MaximumArea = 1, UseLegacyRefinement = legacy }), TimeSpan.FromSeconds(30)); + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 1 + 1e-9), Is.Zero); + } + + [Test] + public void ConformingDelaunayWithQuality_IsDelaunay([Values(false, true)] bool legacy) + { + var poly = SquareWithRandomPoints(7, 15); + poly.Add(new Segment(poly.Points[0], poly.Points[2])); + poly.Add(new Segment(new Vertex(1, 9), new Vertex(9.5, 1.5)), true); + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 25, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + Assert.That(MeshValidator.IsDelaunay(mesh), Is.True); + } + + [Test] + public void HighMinimumAngle_Terminates([Values(33.8, 34.5, 40)] double minAngle, [Values(false, true)] bool legacy) + { + var mesh = MeshAssert.Terminates(() => SquareWithRandomPoints(1, 30).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = minAngle, UseLegacyRefinement = legacy, SteinerPoints = 200000 })); + MeshAssert.IsValid(mesh); + } + + [Test] + [Description("Behavior.Update() sets Quality = false for an out-of-range MaximumAngle (< 60 or > 180). QualityMesher.Apply sets " + + "MaxAngle after Quality = true, so the whole refinement is skipped and the MaximumArea/MinimumAngle constraints are silently " + + "ignored (only a log warning). An invalid MinimumAngle does not have this effect because the MaxAngle setter re-enables Quality.")] + public void InvalidMaximumAngle_DoesNotDisableOtherConstraints() + { + var mesh = Square().Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 20, MaximumAngle = 50, MaximumArea = 0.5 }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.5), Is.Zero); + } + + /// + /// Control: an invalid minimum angle doesn't disable the area constraint. + /// + [Test] + public void InvalidMinimumAngle_AreaConstraintStillApplied() + { + var mesh = Square().Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 70, MaximumArea = 0.5 }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.5), Is.Zero); + } + + [Test] + [Description("QualityMesher.Apply resets VarArea to false if behavior.Poly is false (input without segments, '// TODO: remove'). " + + "Per-triangle area constraints set by the user on a triangulated point set are silently ignored by Refine(VariableArea = true).")] + public void VariableArea_PointSetMesh_IsApplied() + { + // Random points (decimal grids produce hull points that are collinear in decimal but + // ~1e-16 off in binary; hull edges then can't be split at their midpoint, which is a + // precision limit and not what this test is about). + var random = new Random(3); + var points = Enumerable.Range(0, 30).Select(i => new Vertex(10 * random.NextDouble(), 10 * random.NextDouble())).ToList(); + var mesh = (Mesh)new GenericMesher().Triangulate(points); + + foreach (var t in mesh.Triangles) t.Area = 0.5; + + mesh.Refine(new QualityOptions { VariableArea = true }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.5 * (1 + 1e-9)), Is.Zero); + } + + [Test] + public void RefineAfterSmoothing([Values(false, true)] bool legacy) + { + var mesh = (Mesh)SquareWithRandomPoints(9, 20).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, MaximumArea = 0.5, UseLegacyRefinement = legacy }); + + new TriangleNet.Smoothing.SimpleSmoother().Smooth(mesh, 5); + MeshAssert.IsValid(mesh); + + mesh.Refine(new QualityOptions { MinimumAngle = 28, MaximumArea = 0.1, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.1 * (1 + 1e-9)), Is.Zero); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < 28 - 1e-6), Is.Zero); + } + + [Test] + public void RefineTwice_SameOptions_IsStable([Values(false, true)] bool legacy) + { + var q = new QualityOptions { MinimumAngle = 30, MaximumArea = 0.2, UseLegacyRefinement = legacy }; + var mesh = (Mesh)SquareWithRandomPoints(11, 20).Triangulate(new ConstraintOptions(), q); + int n = mesh.Vertices.Count; + mesh.Refine(q); + MeshAssert.IsValid(mesh); + Assert.That(mesh.Vertices.Count, Is.EqualTo(n)); + } + + private static Polygon SquareWithInternalSegments(int seed) + { + var poly = SquareWithRandomPoints(seed, 10); + var rnd = new Random(seed + 1000); + for (int k = 0; k < 3; k++) + { + poly.Add(new Segment(new Vertex(1 + 8 * rnd.NextDouble(), 1 + 8 * rnd.NextDouble()), + new Vertex(1 + 8 * rnd.NextDouble(), 1 + 8 * rnd.NextDouble())), true); + } + return poly; + } + + [TestCase(1, false, 20, 0, 5)] + [TestCase(1, true, 20, 0, 17)] + [TestCase(2, false, 30, 120, 0)] + [TestCase(1, false, 20, 120, 0)] + [Description("Mesh.DeleteVertex only re-tests the retriangulated cavity if NoBisect == 0 (TriangulatePolygon(.., triflaws: NoBisect == 0) " + + "and 'if (NoBisect == 0) TestTriangle'). With SegmentSplitting 1/2, free vertices deleted by SplitEncSegs (Chew) or by aCute " + + "relocation leave new triangles that are never queued: too large (and bad) triangles remain. Fix: always test them.")] + public void SegmentSplitting_DeletedVertexCavityIsTested(int splitting, bool legacy, double minAngle, double maxAngle, int seed) + { + var poly = SquareWithInternalSegments(seed); + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { SegmentSplitting = splitting }, + new QualityOptions { MinimumAngle = minAngle, MaximumAngle = maxAngle, MaximumArea = 0.05, UseLegacyRefinement = legacy })); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.05 * (1 + 1e-9)), Is.Zero); + } + + /// + /// Control for : with segment splitting enabled + /// all constraints are met. + /// + [Test] + public void InternalSegments_MaximumAngle_AllConstraintsMet([Values(0, 3, 4)] int seed, [Values(false, true)] bool legacy) + { + var poly = SquareWithInternalSegments(seed); + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, MaximumAngle = 120, MaximumArea = 0.05, UseLegacyRefinement = legacy })); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.05 * (1 + 1e-9)), Is.Zero, "area"); + Assert.That(mesh.Triangles.Count(t => MaximumAngle(t) > 120 + 1e-6), Is.Zero, "max angle"); + } + + [Test] + public void UserTest_AreaCriterion([Values(false, true)] bool legacy) + { + var mesh = SquareWithRandomPoints(2, 10).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 20, UserTest = (t, area) => area > 0.1, UseLegacyRefinement = legacy }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.Area(t) > 0.1 * (1 + 1e-9)), Is.Zero); + } + + [Test] + public void MaximumAngle_WithHole([Values(false, true)] bool legacy) + { + var poly = Square(); + poly.Add(new Contour(new[] { new Vertex(3, 3), new Vertex(7, 4), new Vertex(6, 7), new Vertex(4, 6) }, 2), new Point(5, 5)); + + var mesh = MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 25, MaximumAngle = 110, MaximumArea = 0.5, UseLegacyRefinement = legacy })); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100 - 9); + Assert.That(mesh.Triangles.Count(t => MaximumAngle(t) > 110 + 1e-6), Is.Zero); + } + + /// + /// Legacy refinement (circumcenters/off-centers) with MaximumAngle below ~95 degrees doesn't + /// terminate within 10 s on this input (aCute does). Not a port bug: Ruppert/Chew refinement has + /// no max angle guarantee and SteinerPoints is unlimited by default. Kept as documentation. + /// + [Test, Explicit("Limitation: does not terminate (legacy refinement has no max angle guarantee).")] + public void Legacy_MaximumAngle90_Terminates() + { + var poly = SquareWithInternalSegments(3); + MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 20, MaximumAngle = 90, UseLegacyRefinement = true })); + } + } +} diff --git a/src/Triangle.Tests/Review/ReviewCTest.cs b/src/Triangle.Tests/Review/ReviewCTest.cs new file mode 100644 index 0000000..7fa7257 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewCTest.cs @@ -0,0 +1,333 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.IO; +using TriangleNet.Meshing; +using TriangleNet.Meshing.Algorithm; +using TriangleNet.Tests.Robustness; + +namespace TriangleNet.Tests.Review +{ + /// + /// Review of ConstraintMesher, SegmentNoder, GenericMesher, Converter and the triangulators. + /// + public class ReviewCTest + { + #region Confirmed bugs + + [Test] + [Description("Severity: medium. SegmentNoder creates intersection vertices with ID 0. With two or more " + + "intersections the IDs are no longer pairwise distinct, so Mesh.TransferNodes silently renumbers ALL " + + "vertices and the user-defined IDs are lost (only because of the default noding).")] + public void NodingPreservesUserVertexIds() + { + var poly = new Polygon(); + int id = 1; + var square = new[] { new Vertex(0, 0), new Vertex(10, 0), new Vertex(10, 10), new Vertex(0, 10) }; + foreach (var v in square) v.ID = id++; + poly.Add(new Contour(square)); + + // Three segments with three crossings. + foreach (var (x1, y1, x2, y2) in new[] { (1.0, 1.0, 9.0, 9.0), (1.0, 9.0, 9.0, 1.0), (1.0, 7.0, 9.0, 7.0) }) + { + poly.Add(new Segment(new Vertex(x1, y1) { ID = id++ }, new Vertex(x2, y2) { ID = id++ }), true); + } + + // Reference: without noding the IDs are kept. + var reference = poly.Triangulate(new ConstraintOptions { ResolveIntersections = false }); + Assert.That(reference.Vertices.First(v => v.X == 10 && v.Y == 10).ID, Is.EqualTo(3)); + + var mesh = poly.Triangulate(); + + Assert.That(mesh.Vertices.First(v => v.X == 10 && v.Y == 10).ID, Is.EqualTo(3), + "User-defined vertex IDs were renumbered."); + } + + [Test] + [Description("Severity: low-medium. When split segments coincide, SegmentNoder.Split keeps the first piece and " + + "drops the others including their label. The mesher (InsertSubseg) lets a non-zero label replace label 0, " + + "so the result depends on noding: label 7 without noding, label 0 with noding (matters for CanSplitSegment).")] + public void NodingKeepsNonZeroLabelOfDuplicateSegment() + { + Polygon Input() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Segment(new Vertex(1, 5), new Vertex(9, 5), 0), true); + poly.Add(new Segment(new Vertex(1, 5), new Vertex(9, 5), 7), true); + poly.Add(new Segment(new Vertex(5, 1), new Vertex(5, 9), 3), true); + return poly; + } + + int[] Labels(IMesh mesh) => mesh.Segments + .Where(s => s.GetVertex(0).Y == 5 && s.GetVertex(1).Y == 5).Select(s => s.Label).ToArray(); + + var reference = Labels(Input().Triangulate(new ConstraintOptions { ResolveIntersections = false })); + Assert.That(reference, Is.All.EqualTo(7)); + + Assert.That(Labels(Input().Triangulate()), Is.All.EqualTo(7)); + } + + [Test] + [Description("Severity: medium. If SnapTolerance is larger than a hole, the noder collapses the hole contour " + + "but keeps the hole point. The hole point then infects the whole surrounding domain and the mesh is " + + "empty (area 0 instead of ~100), although SnapTolerance promises geometry changes of at most the tolerance.")] + public void SnapToleranceCollapsingHoleKeepsDomain() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(5, 5, 0.01), true); + + var mesh = poly.Triangulate(new ConstraintOptions { SnapTolerance = 0.1 }); + + Assert.That(mesh.Triangles.Sum(MeshAssert.Area), Is.GreaterThan(99.0)); + } + + [Test] + [Description("Severity: medium. Converter.ToDCEL maps each boundary vertex to ONE outgoing boundary half-edge " + + "(Dictionary.Add). At a non-manifold boundary vertex (hole touching the outer boundary, two parts touching " + + "at a vertex) it throws ArgumentException 'same key'.")] + public void ToDcelWithHoleTouchingBoundary() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Contour(new[] { new Vertex(5, 0), new Vertex(7, 3), new Vertex(3, 3) }), true); + + var mesh = (Mesh)poly.Triangulate(); + MeshAssert.IsValid(mesh); + + var dcel = Converter.Instance.ToDCEL(mesh); + + Assert.That(dcel.IsConsistent(), Is.True); + } + + [Test] + [Description("Severity: low-medium (performance). SegmentNoder.FindCrossings sweeps along x only, without an " + + "active set ordered by y: every segment is compared with all segments overlapping its x-range. For long " + + "segments sharing an x-range (parallel stripes) noding is O(n^2): 20,000 stripes take ~5 s, the mesher ~0.4 s.")] + public void NodingParallelStripesIsNotQuadratic() + { + const int n = 20000; + + var poly = new Polygon(); + + for (int i = 0; i < n; i++) + { + poly.Add(new Segment(new Vertex(0, i), new Vertex(1000, i)), true); + } + + var sw = Stopwatch.StartNew(); + poly.Triangulate(new ConstraintOptions { ResolveIntersections = false }); + long meshing = sw.ElapsedMilliseconds; + + sw.Restart(); + SegmentNoder.Node(poly, RobustPredicates.Default); + long noding = sw.ElapsedMilliseconds; + + Assert.That(noding, Is.LessThan(Math.Max(1000, 3 * meshing)), + $"Noding took {noding} ms, meshing (without noding) {meshing} ms."); + } + + [Test] + [Description("Severity: medium. Converter.ToMesh looks up mesh.vertices (keyed by vertex hash) and the vertex " + + "array with the triangle/segment vertex ids. If the input vertices have distinct user IDs that aren't " + + "0..n-1 (e.g. database IDs), Mesh uses them as hashes and ToMesh throws KeyNotFoundException.")] + public void ToMeshWithDistinctUserIds() + { + var poly = new Polygon(); + var pts = new[] { new Vertex(0, 0), new Vertex(1, 0), new Vertex(1, 1), new Vertex(0, 1) }; + for (int i = 0; i < 4; i++) pts[i].ID = 100 + i; + poly.Points.AddRange(pts); + poly.Segments.Add(new Segment(pts[0], pts[1], 3)); + + var triangles = new ITriangle[] { new InputTriangle(0, 1, 2), new InputTriangle(0, 2, 3) }; + + Mesh mesh = null; + Assert.DoesNotThrow(() => mesh = Converter.Instance.ToMesh(poly, triangles)); + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count, Is.EqualTo(2)); + } + + [Test] + [Description("Severity: low. Two region pointers in the same area: RegionIterator.Process spreads the label/area " + + "of the seed triangle, which the first region already overwrote in the second region's seed triangle. " + + "So the FIRST region wins, while in Triangle (C) the last one wins (regionplague uses the region list values).")] + public void OverlappingRegionPointersLastOneWins() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Regions.Add(new RegionPointer(2, 2, 1, 0.5)); + poly.Regions.Add(new RegionPointer(8, 8, 2, 2.0)); + + var mesh = poly.Triangulate(); + + Assert.That(mesh.Triangles.Select(t => t.Label).Distinct(), Is.EqualTo(new[] { 2 })); + Assert.That(mesh.Triangles.Select(t => t.Area).Distinct(), Is.EqualTo(new[] { 2.0 })); + } + + [Test] + [Description("Severity: low. SegmentNoder.MergeVertices replaces a vertex by a nearby one (snapping) without " + + "transferring its label, so a vertex marker (here 9) disappears from the mesh.")] + public void SnapMergedVertexKeepsLabel() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(new Segment(new Vertex(1, 5), new Vertex(5, 5, 0)), true); + poly.Add(new Segment(new Vertex(5 + 1e-3, 5, 9), new Vertex(9, 5)), true); + + var mesh = poly.Triangulate(new ConstraintOptions { SnapTolerance = 0.01 }); + + var merged = mesh.Vertices.Where(v => Math.Abs(v.X - 5) < 0.01 && v.Y == 5).ToList(); + Assert.That(merged.Count, Is.EqualTo(1)); + Assert.That(merged[0].Label, Is.EqualTo(9)); + } + + #endregion + + #region Regression tests (suspicions refuted) + + static List DelaunayErrors(IMesh mesh) + { + var errors = new List(); + + foreach (var t in mesh.Triangles) + { + var a = t.GetVertex(0); var b = t.GetVertex(1); var c = t.GetVertex(2); + + if (RobustPredicates.Default.CounterClockwise(a, b, c) <= 0) errors.Add("inverted " + t.ID); + + for (int i = 0; i < 3; i++) + { + var n = t.GetNeighbor(i); + if (n == null) continue; + + for (int j = 0; j < 3; j++) + { + var v = n.GetVertex(j); + if (v == a || v == b || v == c) continue; + if (RobustPredicates.Default.InCircle(a, b, c, v) > 0) errors.Add($"non-Delaunay {t.ID}/{n.ID}"); + } + } + } + + return errors; + } + + static IEnumerable PointSets() + { + var r = new Random(1); + yield return new TestCaseData((object)Enumerable.Range(0, 200).Select(_ => (r.NextDouble(), r.NextDouble())).ToArray()).SetName("{m}(random)"); + yield return new TestCaseData((object)(from i in Enumerable.Range(0, 12) from j in Enumerable.Range(0, 9) select ((double)i, (double)j)).ToArray()).SetName("{m}(grid)"); + yield return new TestCaseData((object)(from i in Enumerable.Range(0, 3) from j in Enumerable.Range(0, 30) select (i * 10.0, (double)j)).ToArray()).SetName("{m}(vertical-lines)"); + yield return new TestCaseData((object)(from i in Enumerable.Range(0, 3) from j in Enumerable.Range(0, 30) select ((double)j, i * 10.0)).ToArray()).SetName("{m}(horizontal-lines)"); + yield return new TestCaseData((object)Enumerable.Range(0, 50).Select(i => ((double)i, 0.0)).Append((25.0, 1.0)).ToArray()).SetName("{m}(collinear+1)"); + yield return new TestCaseData((object)Enumerable.Range(0, 50).Select(i => ((double)i, 2.0 * i)).Append((25.0, 0.0)).ToArray()).SetName("{m}(diagonal+1)"); + yield return new TestCaseData((object)Enumerable.Range(0, 60).Select(i => ((double)(i % 7), (double)((i * 3) % 5))).ToArray()).SetName("{m}(duplicates)"); + yield return new TestCaseData((object)Enumerable.Range(0, 64).Select(i => (Math.Cos(i * Math.PI / 32), Math.Sin(i * Math.PI / 32))).Append((0.0, 0.0)).ToArray()).SetName("{m}(circle)"); + yield return new TestCaseData((object)Enumerable.Range(0, 100).Select(i => (i * 1000.0, (i % 2) * 1e-3)).ToArray()).SetName("{m}(thin)"); + yield return new TestCaseData((object)Enumerable.Range(0, 200).Select(_ => (380000 + r.NextDouble() * 10, 5710000 + r.NextDouble() * 10)).ToArray()).SetName("{m}(utm)"); + yield return new TestCaseData((object)Enumerable.Range(0, 100).Select(i => ((double)i, -1e-6 * (i - 50) * (i - 50))).ToArray()).SetName("{m}(flat-arc)"); + } + + [TestCaseSource(nameof(PointSets))] + public void AllTriangulatorsAgree((double, double)[] points) + { + var results = new List<(int, int, int)>(); + + foreach (var alg in new ITriangulator[] { new Dwyer(), new Dwyer { UseDwyer = false }, new SweepLine(), new Incremental() }) + { + var mesh = (Mesh)alg.Triangulate(points.Select(p => new Vertex(p.Item1, p.Item2)).ToList(), new Configuration()); + + MeshAssert.IsValid(mesh); + Assert.That(DelaunayErrors(mesh), Is.Empty, alg.GetType().Name); + + results.Add((mesh.Triangles.Count, mesh.hullsize, mesh.undeads)); + } + + Assert.That(results.Distinct().Count(), Is.EqualTo(1), string.Join(" ", results)); + } + + [TestCase(new double[] { 0, 0, 1, 1, 2, 2, 3, 3, 5, 5 }, 0)] + [TestCase(new double[] { 0, 0, 0, 1, 0, 2, 0, 3 }, 0)] + [TestCase(new double[] { 0, 0, 1, 0, 0, 0, 1, 0 }, 0)] + [TestCase(new double[] { 0, 0, 1, 0, 1, 0, 0, 1, 0, 0 }, 1)] + public void DegenerateInputAllTriangulators(double[] c, int triangles) + { + foreach (var alg in new ITriangulator[] { new Dwyer(), new Dwyer { UseDwyer = false }, new SweepLine(), new Incremental() }) + { + var pts = new List(); + for (int i = 0; i < c.Length; i += 2) pts.Add(new Vertex(c[i], c[i + 1])); + + var mesh = alg.Triangulate(pts, new Configuration()); + + Assert.That(mesh.Triangles.Count, Is.EqualTo(triangles), alg.GetType().Name); + } + } + + [Test] + public void StructuredMeshIsCorrect() + { + var mesh = (Mesh)GenericMesher.StructuredMesh(new Rectangle(-3, 2, 4, 3), 4, 3); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count, Is.EqualTo(24)); + Assert.That(mesh.Vertices.Count, Is.EqualTo(20)); + Assert.That(mesh.Segments.Count, Is.EqualTo(14)); + Assert.That(mesh.Segments.Select(s => s.Label), Is.All.EqualTo(1)); + Assert.That(mesh.Vertices.Count(v => v.Label == 1), Is.EqualTo(14)); + MeshAssert.HasArea(mesh, 12.0); + Assert.That(DelaunayErrors(mesh), Is.Empty); + + Assert.That(Converter.Instance.ToDCEL(mesh).IsConsistent(), Is.True); + + mesh.Refine(new QualityOptions { MaximumArea = 0.1, MinimumAngle = 25 }); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 12.0); + } + + [Test] + public void ZeroLengthSegmentsWithCrossings() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + var v = new Vertex(3, 3); + poly.Add(new Segment(v, v, 4), true); + poly.Add(new Segment(new Vertex(5, 5), new Vertex(5, 5), 4), true); + poly.Add(new Segment(new Vertex(1, 1), new Vertex(9, 9)), true); + poly.Add(new Segment(new Vertex(1, 9), new Vertex(9, 1)), true); + poly.Add(new Segment(new Vertex(2, 2), new Vertex(2, 2 + 1e-14)), true); + + var mesh = poly.Triangulate(); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 100.0); + } + + [Test] + public void HoleInHoleAndHolesOutsideDomain() + { + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + poly.Add(TestData.Square(2, 2, 6), new Point(3, 3)); // hole, area 36 + poly.Add(TestData.Square(4, 4, 2), new Point(5, 5)); // hole inside the hole + poly.Holes.Add(new Point(20, 20)); // outside the bounds + poly.Regions.Add(new RegionPointer(4.5, 5.5, 3)); // region inside a hole + poly.Regions.Add(new RegionPointer(1, 1, 5)); + + foreach (var alg in new ITriangulator[] { new Dwyer(), new SweepLine(), new Incremental() }) + { + var mesh = new GenericMesher(alg).Triangulate(poly, new ConstraintOptions(), new QualityOptions { MinimumAngle = 20 }); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 64.0); + Assert.That(mesh.Triangles.Select(t => t.Label), Is.All.EqualTo(5)); + } + } + + #endregion + } +} diff --git a/src/Triangle.Tests/Review/ReviewETest.cs b/src/Triangle.Tests/Review/ReviewETest.cs new file mode 100644 index 0000000..5ed1242 --- /dev/null +++ b/src/Triangle.Tests/Review/ReviewETest.cs @@ -0,0 +1,916 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Smoothing; +using TriangleNet.Tests.Robustness; +using TriangleNet.Tools; +using TriangleNet.Topology.DCEL; +using TriangleNet.Voronoi; +using TriangleNet.Voronoi.Legacy; + +using Vertex = TriangleNet.Geometry.Vertex; + +namespace TriangleNet.Tests.Review +{ + /// + /// Review of Voronoi, Smoothing and Tools (review E). + /// + public class ReviewETest + { + #region Helpers + + private static Polygon Square(double size, int label = 1) + { + var poly = new Polygon(); + poly.Add(new Contour(new[] + { + new Vertex(0, 0, label), new Vertex(size, 0, label), + new Vertex(size, size, label), new Vertex(0, size, label) + }, label)); + return poly; + } + + private static Polygon SquareWithHole() + { + var poly = Square(10); + poly.Add(new Contour(new[] + { + new Vertex(4, 4, 2), new Vertex(6, 4, 2), new Vertex(6, 6, 2), new Vertex(4, 6, 2) + }, 2), true); + return poly; + } + + private static Mesh QualityMesh(Polygon poly, double maxArea = 1.0) + { + return (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 25, MaximumArea = maxArea }); + } + + private static double MeshArea(IMesh mesh) => mesh.Triangles.Sum(t => MeshAssert.Area(t)); + + private static List CellPolygon(Face face, int maxEdges = 1000) + { + var list = new List(); + var start = face.Edge; + var e = start; + int k = 0; + do + { + list.Add(e.Origin); + e = e.Next; + if (++k > maxEdges) throw new InvalidOperationException("Cell not closed."); + } + while (e != start); + return list; + } + + private static double PolygonArea(List p) + { + double a = 0; + for (int i = 0, j = p.Count - 1; i < p.Count; j = i++) + { + a += (p[j].X * p[i].Y - p[i].X * p[j].Y); + } + return a / 2; + } + + private static (double x, double y) Centroid(IEnumerable pts) + { + var l = pts.ToList(); + return (l.Average(p => p.X), l.Average(p => p.Y)); + } + + #endregion + + #region BoundedVoronoi + + [Test] + [Description("BoundedVoronoi assigns duplicate half-edge ids: HandleCase1/HandleCase2 set ids from edges.Count AFTER adding (h1.id = Count, h2.id = Count+1, he.id = Count), and ResolveBoundaryEdges starts again at edges.Count.")] + public void BoundedVoronoi_HalfEdgeIdsAreUnique() + { + var mesh = QualityMesh(Square(10)); + + var voronoi = new BoundedVoronoi(mesh); + + var ids = voronoi.HalfEdges.Select(e => e.ID).ToList(); + + Assert.That(ids.Distinct().Count(), Is.EqualTo(ids.Count), "Duplicate half-edge ids."); + } + + [Test] + public void BoundedVoronoi_FaceEnumerateEdgesMatchesNextChain([Range(0, 9)] int seed) + { + var mesh = (Mesh)RandomDomain(seed, true).Triangulate(new ConstraintOptions { ConformingDelaunay = true }, + new QualityOptions { MinimumAngle = 20 }); + + var voronoi = new BoundedVoronoi(mesh); + + foreach (var face in voronoi.Faces) + { + Assert.That(face.EnumerateEdges().Count(), Is.EqualTo(CellPolygon(face).Count), $"Face {face.ID}"); + } + } + + [Test] + [Description("Smoothing.VoronoiFactory (object pool used by SimpleSmoother) never sets Face.label from the generator and does not reset Face.bounded / DCEL Vertex.label when reusing pooled objects, so diagrams built with it differ from DefaultVoronoiFactory (low impact: SimpleSmoother only reads generator.label).")] + public void VoronoiFactory_PooledObjectsAreReset() + { + var meshA = QualityMesh(Helper.SplitRectangle(-1, 1, 1, -1, 3), 0.05); + var meshB = QualityMesh(Square(10), 1.0); + + var factory = new VoronoiFactory(); + + new BoundedVoronoi(meshA, factory, RobustPredicates.Default); + factory.Reset(); + var pooled = new BoundedVoronoi(meshB, factory, RobustPredicates.Default); + + var fresh = new BoundedVoronoi(meshB); + + Assert.That(pooled.Faces.Select(f => (f.Label, f.Bounded)), Is.EqualTo(fresh.Faces.Select(f => (f.Label, f.Bounded)))); + Assert.That(pooled.Vertices.Select(v => v.Label), Is.EqualTo(fresh.Vertices.Select(v => v.Label))); + } + + [Test] + public void BoundedVoronoi_EdgesEnumeratesEachEdgeOnce() + { + var mesh = QualityMesh(Square(10)); + + var voronoi = new BoundedVoronoi(mesh); + + var expected = new HashSet<(int, int)>(); + foreach (var e in voronoi.HalfEdges) + { + int a = e.Origin.ID, b = e.Twin.Origin.ID; + expected.Add((Math.Min(a, b), Math.Max(a, b))); + } + + var edges = voronoi.Edges.Select(e => (Math.Min(e.P0, e.P1), Math.Max(e.P0, e.P1))).ToList(); + + Assert.That(edges.Count, Is.EqualTo(expected.Count)); + Assert.That(new HashSet<(int, int)>(edges).SetEquals(expected)); + } + + [Test] + public void BoundedVoronoi_CellsCoverConvexDomain() + { + var mesh = QualityMesh(Square(10)); + + var voronoi = new BoundedVoronoi(mesh); + + Assert.That(voronoi.IsConsistent(), Is.True); + + double sum = 0; + foreach (var face in voronoi.Faces) + { + var cell = CellPolygon(face); + double a = PolygonArea(cell); + Assert.That(a, Is.GreaterThan(0), $"Cell {face.ID} has non-positive area."); + sum += a; + + foreach (var p in cell) + { + Assert.That(p.X, Is.InRange(-1e-9, 10 + 1e-9)); + Assert.That(p.Y, Is.InRange(-1e-9, 10 + 1e-9)); + } + } + + Assert.That(sum, Is.EqualTo(100.0).Within(1e-8)); + } + + [Test] + public void BoundedVoronoi_CellsCoverDomainWithHole() + { + var mesh = QualityMesh(SquareWithHole()); + + var voronoi = new BoundedVoronoi(mesh); + + Assert.That(voronoi.IsConsistent(), Is.True); + + double sum = voronoi.Faces.Sum(f => PolygonArea(CellPolygon(f))); + + Assert.That(sum, Is.EqualTo(MeshArea(mesh)).Within(1e-8)); + Assert.That(sum, Is.EqualTo(96.0).Within(1e-8)); + } + + [Test] + public void BoundedVoronoi_ConstrainedDelaunayWithObtuseBoundaryTriangle() + { + // Triangle (0,0),(10,0),(5,1) is obtuse at (5,1): its circumcenter lies + // outside the domain (HandleCase2). + var poly = Square(10); + poly.Add(new Vertex(5, 1, 0)); + poly.Add(new Vertex(5, 9, 0)); + + var mesh = (Mesh)poly.Triangulate(); + + var voronoi = new BoundedVoronoi(mesh); + + Assert.That(voronoi.IsConsistent(), Is.True); + + double sum = voronoi.Faces.Sum(f => PolygonArea(CellPolygon(f))); + + Assert.That(sum, Is.EqualTo(100.0).Within(1e-8)); + } + + private static Polygon RandomDomain(int seed, bool lshape) + { + var random = new Random(seed); + var poly = new Polygon(); + + if (lshape) + { + poly.Add(new Contour(new[] + { + new Vertex(0, 0, 1), new Vertex(10, 0, 1), new Vertex(10, 4, 1), + new Vertex(4, 4, 1), new Vertex(4, 10, 1), new Vertex(0, 10, 1) + }, 1)); + } + else + { + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(8, 0, 1), new Vertex(8, 8, 1), new Vertex(0, 8, 1) }, 1)); + } + + int k = 0; + while (k < 25) + { + double x = random.NextDouble() * 10, y = random.NextDouble() * 10; + if (lshape && x > 4 && y > 4) continue; + if (!lshape && (x > 7.99 || y > 7.99)) continue; + if (x < 0.01 || y < 0.01) continue; + poly.Add(new Vertex(x, y, 0)); + k++; + } + + return poly; + } + + private static void AssertCellsPartitionDomain(BoundedVoronoi voronoi, double area, Rectangle bounds) + { + Assert.That(voronoi.IsConsistent(), Is.True); + + double sum = 0; + + foreach (var face in voronoi.Faces) + { + var cell = CellPolygon(face); + double a = PolygonArea(cell); + + Assert.That(a, Is.GreaterThan(0), $"Cell {face.ID} has non-positive area {a}."); + + foreach (var p in cell) + { + Assert.That(bounds.Contains(p), Is.True, $"Cell {face.ID} has vertex ({p.X}, {p.Y}) outside the domain."); + } + + sum += a; + } + + Assert.That(sum, Is.EqualTo(area).Within(1e-8)); + } + + [Test] + public void BoundedVoronoi_RandomConformingDelaunay([Range(0, 9)] int seed, [Values(false, true)] bool lshape) + { + var poly = RandomDomain(seed, lshape); + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }); + + var voronoi = MeshAssert.Terminates(() => new BoundedVoronoi(mesh)); + + var bounds = new Rectangle(-1e-9, -1e-9, (lshape ? 10 : 8) + 2e-9, (lshape ? 10 : 8) + 2e-9); + + AssertCellsPartitionDomain(voronoi, lshape ? 64.0 : 64.0, bounds); + } + + [Test] + [Explicit("Documented limitation: BoundedVoronoi requires a conforming Delaunay mesh (see class remarks).")] + [Description("BoundedVoronoi on a constrained (non-conforming) Delaunay triangulation: HandleCase2 only clips a circumcenter that lies just beyond its own boundary edge. Circumcenters further outside are kept, so cells get vertices far outside the domain (e.g. (28.9, 4.0) for an 8x8 square) and negative (self-overlapping) area.")] + public void BoundedVoronoi_ConstrainedDelaunayCellsInsideDomain() + { + var poly = RandomDomain(0, false); + + var mesh = (Mesh)poly.Triangulate(); + + var voronoi = new BoundedVoronoi(mesh); + + AssertCellsPartitionDomain(voronoi, 64.0, new Rectangle(-1e-9, -1e-9, 8 + 2e-9, 8 + 2e-9)); + } + + #endregion + + #region StandardVoronoi + + [Test] + public void StandardVoronoi_FewPoints() + { + var poly = new Polygon(); + poly.Add(new Vertex(0, 0)); + poly.Add(new Vertex(1, 0)); + poly.Add(new Vertex(0, 1)); + + var mesh = (Mesh)poly.Triangulate(); + + var voronoi = new StandardVoronoi(mesh); + + Assert.That(voronoi.Faces.Count, Is.EqualTo(3)); + Assert.That(voronoi.Vertices.Count, Is.EqualTo(4)); + Assert.That(voronoi.IsConsistent(false), Is.True); + Assert.That(voronoi.Faces.All(f => !f.Bounded), Is.True); + } + + [Test] + public void StandardVoronoi_RaysEndOnBoundingBox() + { + var random = new Random(3); + var poly = new Polygon(); + for (int i = 0; i < 30; i++) + { + poly.Add(new Vertex(random.NextDouble() * 10, random.NextDouble() * 10)); + } + + var mesh = (Mesh)poly.Triangulate(); + + var box = new Rectangle(-100, -100, 200, 200); + + var voronoi = new StandardVoronoi(mesh, box); + + // All circumcenters of a 10x10 point set with reasonable distribution lie + // in the large box, so every infinite vertex must be on the box boundary. + int n = mesh.Triangles.Count; + foreach (var v in voronoi.Vertices.Where(v => v.ID >= n)) + { + bool onBox = Math.Abs(v.X + 100) < 1e-9 || Math.Abs(v.X - 100) < 1e-9 || + Math.Abs(v.Y + 100) < 1e-9 || Math.Abs(v.Y - 100) < 1e-9; + Assert.That(onBox, Is.True, $"Ray end ({v.X}, {v.Y}) not on box."); + } + } + + [Test] + [Description("StandardVoronoi(mesh, box) calls box.Expand(mesh.bounds) on the caller's Rectangle instance, silently modifying the argument.")] + public void StandardVoronoi_DoesNotModifyBoxArgument() + { + var mesh = QualityMesh(Square(10)); + + var box = new Rectangle(2, 2, 3, 3); + + new StandardVoronoi(mesh, box); + + Assert.That((box.Left, box.Bottom, box.Right, box.Top), Is.EqualTo((2.0, 2.0, 5.0, 5.0))); + } + + #endregion + + #region Legacy Voronoi + + private static Mesh MeshWithDuplicate() + { + var poly = Square(10); + poly.Add(new Vertex(3, 3, 0)); + poly.Add(new Vertex(7, 6, 0)); + poly.Add(new Vertex(3, 3, 0)); // duplicate + + var mesh = (Mesh)poly.Triangulate(new ConstraintOptions { ConformingDelaunay = true }); + + Assert.That(mesh.Vertices.Count(v => v.Type == VertexType.UndeadVertex), Is.EqualTo(1)); + + return mesh; + } + + [Test] + public void StandardVoronoi_WithDuplicateVertex() + { + var mesh = MeshWithDuplicate(); + + var voronoi = new StandardVoronoi(mesh); + + Assert.That(voronoi.Faces.Count, Is.EqualTo(mesh.Vertices.Count - 1)); + } + + [Test] + [Description("SimpleVoronoi (legacy) creates a region for undead (duplicate) vertices and walks their stale vertex.tri, which throws or produces garbage; VoronoiBase skips undead vertices.")] + public void SimpleVoronoi_WithDuplicateVertex() + { + var mesh = MeshWithDuplicate(); + + SimpleVoronoi voronoi = null; + + Assert.DoesNotThrow(() => voronoi = new SimpleVoronoi(mesh)); + + Assert.That(voronoi.Regions.Count, Is.EqualTo(mesh.Vertices.Count - 1)); + } + + [Test] + [Description("BoundedVoronoiLegacy constructs a cell for undead (duplicate) vertices, whose vertex.tri is stale, and throws.")] + public void BoundedVoronoiLegacy_WithDuplicateVertex() + { + var mesh = MeshWithDuplicate(); + +#pragma warning disable CS0618 + Assert.DoesNotThrow(() => new BoundedVoronoiLegacy(mesh)); +#pragma warning restore CS0618 + } + + [Test] + [Description("SimpleVoronoi uses the bounding box of the circumcenters (enlarged by 10%) to clip rays. With a single triangle the box degenerates to a point and all rays get length zero.")] + public void SimpleVoronoi_SingleTriangleRaysHaveLength() + { + var poly = new Polygon(); + poly.Add(new Vertex(0, 0)); + poly.Add(new Vertex(1, 0)); + poly.Add(new Vertex(0, 1)); + + var mesh = (Mesh)poly.Triangulate(); + + var voronoi = new SimpleVoronoi(mesh); + + var c = voronoi.Points[0]; + + for (int i = 1; i < voronoi.Points.Length; i++) + { + var p = voronoi.Points[i]; + Assert.That(p, Is.Not.Null); + Assert.That(Math.Abs(p.X - c.X) + Math.Abs(p.Y - c.Y), Is.GreaterThan(0.0), + "Ray endpoint coincides with the circumcenter."); + } + } + + #endregion + + #region SimpleSmoother + + [Test] + [Description("SimpleSmoother copies its internal TrianglePool into the smoothed mesh (CopyTo). Reusing the smoother instance restarts that pool and destroys the triangles of the previously smoothed mesh.")] + public void SimpleSmoother_ReuseDoesNotCorruptPreviousMesh() + { + var mesh1 = QualityMesh(Square(10)); + var mesh2 = QualityMesh(Square(5), 0.5); + + var smoother = new SimpleSmoother(); + + smoother.Smooth(mesh1, 5); + + int count = mesh1.Triangles.Count; + double area = MeshArea(mesh1); + + MeshAssert.IsValid(mesh1); + + smoother.Smooth(mesh2, 5); + + Assert.That(mesh1.Triangles.Count, Is.EqualTo(count), "Triangles of first mesh changed."); + Assert.That(MeshArea(mesh1), Is.EqualTo(area).Within(1e-9)); + MeshAssert.IsValid(mesh1); + } + + private class CancelOnResetFactory : IVoronoiFactory + { + private readonly IVoronoiFactory inner = new DefaultVoronoiFactory(); + private readonly CancellationTokenSource cts; + + public CancelOnResetFactory(CancellationTokenSource cts) => this.cts = cts; + + public void Initialize(int vertexCount, int edgeCount, int faceCount) => inner.Initialize(vertexCount, edgeCount, faceCount); + public void Reset() => cts.Cancel(); + public TriangleNet.Topology.DCEL.Vertex CreateVertex(double x, double y) => inner.CreateVertex(x, y); + public HalfEdge CreateHalfEdge(TriangleNet.Topology.DCEL.Vertex origin, Face face) => inner.CreateHalfEdge(origin, face); + public Face CreateFace(Vertex vertex) => inner.CreateFace(vertex); + } + + [Test] + [Description("SimpleSmoother moves the Vertex objects of the input mesh in place (Step on the input mesh, and Rebuild reuses the vertex objects), but only replaces the topology at the end. A cancellation (or exception) leaves the input mesh with moved vertices and stale topology.")] + public void SimpleSmoother_CancellationLeavesInputMeshUnchanged() + { + var mesh = QualityMesh(Square(10)); + + var before = mesh.Vertices.ToDictionary(v => v, v => (v.X, v.Y), ReferenceEqualityComparer.Instance); + + var cts = new CancellationTokenSource(); + var smoother = new SimpleSmoother(new CancelOnResetFactory(cts)); + + Assert.Throws(() => smoother.Smooth(mesh, 10, 1e-6, cts.Token)); + + int moved = mesh.Vertices.Count(v => before[v] != (v.X, v.Y)); + + Assert.That(moved, Is.EqualTo(0), "Input mesh vertices were moved although smoothing was cancelled."); + } + + private static Polygon ScaledSquareWithPoints(double s) + { + var poly = Square(10 * s); + var random = new Random(1); + for (int i = 0; i < 15; i++) + { + poly.Add(new Vertex((1 + 8 * random.NextDouble()) * s, (1 + 8 * random.NextDouble()) * s, 0)); + } + return poly; + } + + private static double FirstStepMaxMove(double s) + { + var mesh = (Mesh)ScaledSquareWithPoints(s).Triangulate(new ConstraintOptions { ConformingDelaunay = true }); + var before = mesh.Vertices.Where(v => v.Label == 0).Select(v => (v, v.X, v.Y)).ToList(); + new SimpleSmoother().Smooth(mesh, 1); + return before.Max(t => Math.Sqrt((t.v.X - t.X) * (t.v.X - t.X) + (t.v.Y - t.Y) * (t.v.Y - t.Y))); + } + + [Test] + [Description("SimpleSmoother.Smooth initializes currMax = 1, so after the first iteration the convergence test compares the first movement against the arbitrary constant 1 (absolute units). If the first maximum movement is ~1 the smoother stops after one iteration; the result depends on the coordinate scale.")] + public void SimpleSmoother_IterationCountIsScaleInvariant() + { + // Determine the scale at which the first step moves a vertex by exactly 1. + double m = FirstStepMaxMove(1.0); + double s = 1.0 / m; + + Assert.That(FirstStepMaxMove(s), Is.EqualTo(1.0).Within(1e-3)); + + var mesh1 = (Mesh)ScaledSquareWithPoints(1.0).Triangulate(new ConstraintOptions { ConformingDelaunay = true }); + var mesh2 = (Mesh)ScaledSquareWithPoints(s).Triangulate(new ConstraintOptions { ConformingDelaunay = true }); + + int n1 = new SimpleSmoother().Smooth(mesh1, 20, 0.01); + int n2 = new SimpleSmoother().Smooth(mesh2, 20, 0.01); + + Assert.That(n1, Is.GreaterThan(1)); + Assert.That(n2, Is.EqualTo(n1), "Iteration count depends on coordinate scale."); + } + + [Test] + public void SimpleSmoother_PreservesHoleSegmentsAndRegions() + { + var poly = SquareWithHole(); + poly.Add(new Segment(new Vertex(1, 1, 3), new Vertex(3, 1, 3), 3), true); + poly.Regions.Add(new RegionPointer(8, 8, 7)); + + var mesh = QualityMesh(poly); + + var smoother = new SimpleSmoother(); + Assert.That(smoother.Smooth(mesh, 10), Is.GreaterThan(0)); + + MeshAssert.IsValid(mesh); + MeshAssert.HasArea(mesh, 96.0, 1e-9); + MeshAssert.ContainsSegments(mesh, poly.Segments); + Assert.That(mesh.Triangles.All(t => t.Label == 7), Is.True, "Region label lost."); + } + + #endregion + + #region CuthillMcKee / AdjacencyMatrix + + [Test] + [Description("CuthillMcKee.Rcm does not order newly numbered neighbors by increasing degree: it reads deg[node - 1] (1-based leftover of the Burkardt port, nodes are 0-based) and the insertion sort loop 'while (fnbr < l)' never compares with the first neighbor (SPARSPAK: L >= FNBR). FindRoot has the same off-by-one (pcol[node - 1]).")] + public void CuthillMcKee_NeighborsOrderedByDegree() + { + var poly = Square(10); + var mesh = QualityMesh(poly, 0.5); + + var matrix = new AdjacencyMatrix(mesh); + int n = matrix.ColumnCount; + + var pcol = matrix.ColumnPointers; + var irow = matrix.RowIndices; + + List Neighbors(int i) => Enumerable.Range(pcol[i], pcol[i + 1] - pcol[i]).Select(j => irow[j]).Where(j => j != i).ToList(); + + var perm_inv = new CuthillMcKee().Renumber(matrix); + + // Cuthill-McKee order (old node ids, new number ascending) is the reverse of RCM. + var rcm = new int[n]; + for (int i = 0; i < n; i++) rcm[perm_inv[i]] = i; + var cm = rcm.Reverse().ToArray(); + + var placed = new bool[n]; + placed[cm[0]] = true; + int next = 1; + + int violations = 0; + + for (int i = 0; i < n; i++) + { + var node = cm[i]; + var block = Neighbors(node).Where(j => !placed[j]).ToList(); + + for (int k = 0; k < block.Count; k++) + { + int v = cm[next + k]; + Assert.That(block, Does.Contain(v), "Not a breadth-first ordering."); + if (k > 0 && Neighbors(cm[next + k - 1]).Count > Neighbors(v).Count) violations++; + } + + foreach (var v in block) placed[v] = true; + next += block.Count; + } + + Assert.That(violations, Is.EqualTo(0), "Neighbors not sorted by increasing degree."); + } + + [Test] + [Description("CuthillMcKee.Rcm reads deg[nbr - 1]; with an adjacency matrix whose row indices are not sorted, node 0 can appear at a non-first neighbor position and deg[-1] throws IndexOutOfRangeException.")] + public void CuthillMcKee_UnsortedAdjacencyMatrix() + { + // Star graph: center 1 connected to 0, 2, 3, 4 (plus diagonal entries). + // Row of node 1 is deliberately unsorted: 0 is not the first unnumbered neighbor. + var rows = new[] + { + new[] { 0, 1 }, + new[] { 1, 3, 4, 0, 2 }, + new[] { 2, 1 }, + new[] { 3, 1 }, + new[] { 4, 1 }, + }; + + var pcol = new int[rows.Length + 1]; + for (int i = 0; i < rows.Length; i++) pcol[i + 1] = pcol[i] + rows[i].Length; + var irow = rows.SelectMany(r => r).ToArray(); + + var matrix = new AdjacencyMatrix(pcol, irow); + + int[] perm = null; + Assert.DoesNotThrow(() => perm = new CuthillMcKee().Renumber(matrix)); + Assert.That(perm.OrderBy(i => i), Is.EqualTo(Enumerable.Range(0, 5))); + } + + [Test] + public void CuthillMcKee_DisconnectedMesh() + { + // Two squares separated by a hole region: the mesh has two components. + var poly = new Polygon(); + poly.Add(new Contour(new[] { new Vertex(0, 0, 1), new Vertex(3, 0, 1), new Vertex(3, 1, 1), new Vertex(0, 1, 1) }, 1)); + poly.Add(new Contour(new[] { new Vertex(5, 0, 1), new Vertex(8, 0, 1), new Vertex(8, 1, 1), new Vertex(5, 1, 1) }, 1)); + + var mesh = (Mesh)poly.Triangulate(new QualityOptions { MaximumArea = 0.1 }); + + var matrix = new AdjacencyMatrix(mesh); + var perm = new CuthillMcKee().Renumber(matrix); + + Assert.That(perm.OrderBy(i => i), Is.EqualTo(Enumerable.Range(0, matrix.ColumnCount))); + + mesh.Renumber(NodeNumbering.CuthillMcKee); + MeshAssert.IsValid(mesh); + } + + #endregion + + #region TriangleQuadTree + + [Test] + [Description("TriangleQuadTree.IsPointInTriangle uses inexact barycentric coordinates (divisions). A point on (or within rounding distance of) an interior edge can be rejected by both adjacent triangles, so Query returns null for a point inside the mesh.")] + public void TriangleQuadTree_QueryOnInteriorEdges() + { + var random = new Random(7); + var poly = new Polygon(); + for (int i = 0; i < 200; i++) + { + poly.Add(new Vertex(random.NextDouble(), random.NextDouble())); + } + + var mesh = (Mesh)poly.Triangulate(); + + mesh.Renumber(); + var verts = mesh.Vertices.ToDictionary(v => v.ID); + + var tree = new TriangleQuadTree(mesh); + + int misses = 0, total = 0; + + foreach (var e in mesh.Edges) + { + var p = verts[e.P0]; + var q = verts[e.P1]; + + if (e.Label != 0) continue; // interior edges only (hull edges have label 1) + + for (int k = 1; k < 10; k++) + { + double t = k / 10.0; + double x = p.X + t * (q.X - p.X); + double y = p.Y + t * (q.Y - p.Y); + + total++; + + if (tree.Query(x, y) == null && ContainedExactly(mesh, x, y)) misses++; + } + } + + Assert.That(total, Is.GreaterThan(500)); + Assert.That(misses, Is.EqualTo(0), $"{misses} of {total} points on interior edges not found."); + } + + private static bool ContainedExactly(Mesh mesh, double x, double y) + { + var p = new Point(x, y); + var pred = RobustPredicates.Default; + return mesh.Triangles.Any(t => + pred.CounterClockwise(t.GetVertex(0), t.GetVertex(1), p) >= 0 && + pred.CounterClockwise(t.GetVertex(1), t.GetVertex(2), p) >= 0 && + pred.CounterClockwise(t.GetVertex(2), t.GetVertex(0), p) >= 0); + } + + [Test] + public void TriangleQuadTree_QueryVerticesAndOutside() + { + var mesh = QualityMesh(Square(10), 0.5); + + var tree = new TriangleQuadTree(mesh); + + foreach (var v in mesh.Vertices) + { + var tri = tree.Query(v.X, v.Y); + Assert.That(tri, Is.Not.Null, $"Vertex ({v.X}, {v.Y}) not found."); + Assert.That(Enumerable.Range(0, 3).Any(i => tri.GetVertex(i) == v), Is.True); + } + + Assert.That(tree.Query(-1, 5), Is.Null); + Assert.That(tree.Query(5, 10.5), Is.Null); + Assert.That(tree.Query(4.3, 6.1), Is.Not.Null); + } + + #endregion + + #region PolygonValidator + + [Test] + [Description("PolygonValidator.IsConsistent counts a null point as an error but then dereferences points[0].id / points[1].id and throws NullReferenceException instead of returning false.")] + public void PolygonValidator_NullPoint() + { + var poly = new Polygon(); + poly.Points.Add(null); + poly.Points.Add(new Vertex(1, 0)); + poly.Points.Add(new Vertex(0, 1)); + + bool result = true; + Assert.DoesNotThrow(() => result = PolygonValidator.IsConsistent(poly)); + Assert.That(result, Is.False); + } + + [Test] + [Description("PolygonValidator.IsConsistent only checks segment endpoint ids when all point ids are equal (then the check is trivially satisfied); with distinct ids, a segment endpoint id outside [0, count) is not detected.")] + public void PolygonValidator_SegmentEndpointNotInPointList() + { + var poly = new Polygon(); + var p = new[] { new Vertex(0, 0) { ID = 0 }, new Vertex(1, 0) { ID = 1 }, new Vertex(0, 1) { ID = 2 } }; + poly.Points.AddRange(p); + + var foreign = new Vertex(5, 5) { ID = 17 }; + poly.Add(new Segment(p[0], foreign), false); + + Assert.That(PolygonValidator.IsConsistent(poly), Is.False); + } + + [Test] + public void PolygonValidator_DetectsDuplicates() + { + var poly = new Polygon(); + for (int i = 0; i < 50; i++) poly.Add(new Vertex(i % 7, i / 7)); + Assert.That(PolygonValidator.HasDuplicateVertices(poly), Is.False); + + poly.Add(new Vertex(3, 2)); + Assert.That(PolygonValidator.HasDuplicateVertices(poly), Is.True); + } + + #endregion + + #region IntersectionHelper + + [Test] + [Description("IntersectionHelper.IsPointOnSegment uses an absolute threshold on the cross product (not scaled by segment length): for small segments, points far away (relative to the segment length) are reported as on the segment.")] + public void IsPointOnSegment_SmallScale() + { + var a = new Point(0, 0); + var b = new Point(1e-6, 0); + + // Distance to the segment equals the segment length. + var test = new Point(5e-7, 1e-6); + + Assert.That(IntersectionHelper.IsPointOnSegment(a, b, test), Is.False); + } + + [Test] + public void IntersectSegments_HandComputed() + { + var c = new Point(); + IntersectionHelper.IntersectSegments(new Point(0, 0), new Point(4, 4), new Point(0, 4), new Point(4, 0), ref c); + Assert.That(c.X, Is.EqualTo(2).Within(1e-12)); + Assert.That(c.Y, Is.EqualTo(2).Within(1e-12)); + } + + [Test] + public void LiangBarsky_ClipsAndRejects() + { + var rect = new Rectangle(0, 0, 10, 10); + Point c0 = new Point(), c1 = new Point(); + + Assert.That(IntersectionHelper.LiangBarsky(rect, new Point(-5, 5), new Point(15, 5), ref c0, ref c1), Is.True); + Assert.That((c0.X, c0.Y, c1.X, c1.Y), Is.EqualTo((0.0, 5.0, 10.0, 5.0))); + + // Vertical line outside. + Assert.That(IntersectionHelper.LiangBarsky(rect, new Point(11, 0), new Point(11, 10), ref c0, ref c1), Is.False); + } + + [Test] + [Description("IntersectionHelper.BoxRayIntersection with a zero direction vector returns true and sets the intersection to (0, 0), which is unrelated to the box or the start point.")] + public void BoxRayIntersection_ZeroDirection() + { + var rect = new Rectangle(10, 10, 10, 10); + var c = new Point(); + + bool ok = IntersectionHelper.BoxRayIntersection(rect, new Point(15, 15), 0, 0, ref c); + + Assert.That(!ok || rect.Contains(c), Is.True, $"Returned ({c.X}, {c.Y}) outside the box."); + } + + #endregion + + #region QualityMeasure / Statistic / Interpolation / VertexSorter + + private static Mesh RightTriangle345() + { + var poly = new Polygon(); + poly.Add(new Vertex(0, 0)); + poly.Add(new Vertex(4, 0)); + poly.Add(new Vertex(0, 3)); + return (Mesh)poly.Triangulate(); + } + + [Test] + public void QualityMeasure_HandComputed345() + { + var mesh = RightTriangle345(); + var q = new QualityMeasure(); + q.Update(mesh); + + double minAngle = Math.Asin(3.0 / 5.0); + + Assert.That(q.AreaTotal, Is.EqualTo(6.0).Within(1e-12)); + Assert.That(q.Alpha.Minimum, Is.EqualTo(minAngle * 3 / Math.PI).Within(1e-12)); + Assert.That(q.Eta.Minimum, Is.EqualTo(4 * Math.Sqrt(3) * 6 / (9 + 16 + 25)).Within(1e-12)); + // (b+c-a)(c+a-b)(a+b-c)/(abc) with a=3, b=4, c=5 + Assert.That(q.Q.Minimum, Is.EqualTo(6.0 * 4.0 * 2.0 / 60.0).Within(1e-12)); + } + + [Test] + public void Statistic_HandComputed345() + { + var mesh = RightTriangle345(); + var s = new Statistic(); + s.Update(mesh, 10); + + Assert.That(s.SmallestAngle, Is.EqualTo(Math.Asin(3.0 / 5.0) * 180 / Math.PI).Within(1e-9)); + Assert.That(s.LargestAngle, Is.EqualTo(90.0).Within(1e-9)); + Assert.That(s.ShortestEdge, Is.EqualTo(3.0).Within(1e-12)); + Assert.That(s.LongestEdge, Is.EqualTo(5.0).Within(1e-12)); + Assert.That(s.SmallestArea, Is.EqualTo(6.0).Within(1e-12)); + Assert.That(s.ShortestAltitude, Is.EqualTo(2.4).Within(1e-12)); + Assert.That(s.LargestAspectRatio, Is.EqualTo(5.0 / 2.4).Within(1e-12)); + + Assert.That(s.AngleHistogram.Sum(), Is.EqualTo(3)); + Assert.That(s.MinAngleHistogram.Sum(), Is.EqualTo(1)); + Assert.That(s.MaxAngleHistogram.Sum(), Is.EqualTo(1)); + // 36.87 deg -> bin 12 (36-39), 53.13 -> bin 17 (51-54), 90 -> bin 30 (90-93) or 29. + Assert.That(s.MinAngleHistogram[12], Is.EqualTo(1)); + Assert.That(s.AngleHistogram[12], Is.EqualTo(1)); + Assert.That(s.AngleHistogram[17], Is.EqualTo(1)); + } + + [Test] + public void Interpolation_ReproducesLinearFunction() + { + var poly = new Polygon(); + var random = new Random(5); + for (int i = 0; i < 30; i++) poly.Add(new Vertex(random.NextDouble() * 10, random.NextDouble() * 10)); + var mesh = (Mesh)poly.Triangulate(); + mesh.Renumber(); + + double F(double x, double y) => 2 * x - 3 * y + 1; + + var data = new double[mesh.Vertices.Count]; + foreach (var v in mesh.Vertices) data[v.ID] = F(v.X, v.Y); + + foreach (var t in mesh.Triangles) + { + var a = t.GetVertex(0); var b = t.GetVertex(1); var c = t.GetVertex(2); + var p = new Point(0.2 * a.X + 0.3 * b.X + 0.5 * c.X, 0.2 * a.Y + 0.3 * b.Y + 0.5 * c.Y); + Assert.That(Interpolation.InterpolatePoint(t, p, data), Is.EqualTo(F(p.X, p.Y)).Within(1e-9)); + } + } + + [Test] + public void VertexSorter_SortWithManyDuplicates() + { + var random = new Random(11); + var array = Enumerable.Range(0, 2000).Select(i => new Vertex(random.Next(5), random.Next(3))).ToArray(); + + VertexSorter.Sort(array); + + for (int i = 1; i < array.Length; i++) + { + var p = array[i - 1]; + var q = array[i]; + Assert.That(p.X < q.X || (p.X == q.X && p.Y <= q.Y), Is.True, $"Not sorted at {i}."); + } + } + + #endregion + } +} diff --git a/src/Triangle.Tests/Tools/CuthillMcKeeTest.cs b/src/Triangle.Tests/Tools/CuthillMcKeeTest.cs index 482243d..6bc37bb 100644 --- a/src/Triangle.Tests/Tools/CuthillMcKeeTest.cs +++ b/src/Triangle.Tests/Tools/CuthillMcKeeTest.cs @@ -33,17 +33,12 @@ public void TestCuthillMcKee() var pmatrix = new AdjacencyMatrix(mesh, false); - Assert.That(new int[] { 0, 3, 7, 11, 15, 21, 24 }, Is.EqualTo(pmatrix.ColumnPointers).AsCollection); - Assert.That(new int[] { - 0, 2, 4, - 1, 2, 3, 4, - 0, 1, 2, 4, - 1, 3, 4, 5, - 0, 1, 2, 3, 4, 5, - 3, 4, 5 }, Is.EqualTo(pmatrix.RowIndices).AsCollection); - - // For structured meshes we cannot expect an improved bandwidth. - Assert.That(pmatrix.Bandwidth(), Is.EqualTo(9)); + // The structured mesh is already numbered optimally: RCM keeps the numbering (the + // old result, with bandwidth 9 instead of 7, was caused by 1-based index leftovers + // in the neighbor sorting). + Assert.That(p, Is.EqualTo(new int[] { 0, 1, 2, 3, 4, 5 }).AsCollection); + Assert.That(new int[] { 0, 4, 7, 11, 17, 21, 24 }, Is.EqualTo(pmatrix.ColumnPointers).AsCollection); + Assert.That(pmatrix.Bandwidth(), Is.EqualTo(7)); } } } \ No newline at end of file diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 9a90ff4..92a3067 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -1621,7 +1621,9 @@ internal void DeleteVertex(ref Otri deltri) // the resulting triangles. deltri.Onext(ref firstedge); deltri.Oprev(ref lastedge); - TriangulatePolygon(firstedge, lastedge, edgecount, false, behavior.NoBisect == 0); + // The new triangles are always tested for quality (the original code skipped + // that if segment splitting was restricted, leaving e.g. too large triangles). + TriangulatePolygon(firstedge, lastedge, edgecount, false, true); } // Splice out two triangles. deltri.Lprev(ref deltriright); @@ -1645,10 +1647,7 @@ internal void DeleteVertex(ref Otri deltri) // Set the new origin of 'deltri' and check its quality. neworg = lefttri.Org(); deltri.SetOrg(neworg); - if (behavior.NoBisect == 0) - { - qualityMesher.TestTriangle(ref deltri); - } + qualityMesher.TestTriangle(ref deltri); // Delete the two spliced-out triangles. TriangleDealloc(lefttri.tri); diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 4520a89..198fe87 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -190,8 +190,6 @@ private void CarveHoles() // Record the triangle for processing after the // holes have been carved. regionTris[i] = searchtri.tri; - regionTris[i].label = region.Label; - regionTris[i].area = region.Area; } } } @@ -218,8 +216,19 @@ private void CarveHoles() // It may have been eaten by the virus. if (!Otri.IsDead(regionTris[i])) { - // Apply one region's attribute and/or area constraint. - iterator.Process(regionTris[i]); + // Apply one region's attribute and/or area constraint. The values + // are taken from the region (not from the seed triangle, which an + // earlier region in the same area may have overwritten), so for + // several region points in one area the last one wins (as in Triangle). + var region = mesh.regions[i]; + int label = region.Label; + double area = region.Area; + + iterator.Process(regionTris[i], tri => + { + tri.label = label; + tri.area = area; + }); } } } diff --git a/src/Triangle/Meshing/Converter.cs b/src/Triangle/Meshing/Converter.cs index 131acbf..d4be96d 100644 --- a/src/Triangle/Meshing/Converter.cs +++ b/src/Triangle/Meshing/Converter.cs @@ -54,6 +54,13 @@ public Mesh ToMesh(Polygon polygon, ITriangle[] triangles, Configuration config int elements = triangles == null ? 0 : triangles.Length; int segments = polygon.Segments.Count; + // The triangle corners are indices into the list of points, and the reconstruction + // uses vertex ids as indices: number the vertices by their position. + for (int i = 0; i < polygon.Points.Count; i++) + { + polygon.Points[i].id = i; + } + var mesh = new Mesh(config ?? new Configuration(), polygon.Points); mesh.regions.AddRange(polygon.Regions); @@ -405,8 +412,8 @@ public DcelMesh ToDCEL(Mesh mesh) // Count half-edges (edge ids). int k = 0; - // Maps a vertex to its leaving boundary edge. - var boundary = new Dictionary(); + // Boundary half-edges (on the outer face). + var boundary = new List(); foreach (var t in mesh.triangles) { @@ -441,7 +448,7 @@ public DcelMesh ToDCEL(Mesh mesh) } else { - boundary.Add(dest.id, twin); + boundary.Add(twin); } // Set leaving edges. @@ -481,10 +488,26 @@ public DcelMesh ToDCEL(Mesh mesh) } } - // Resolve boundary edges. - foreach (var e in boundary.Values) + // Resolve boundary edges: the successor leaves the end vertex along the boundary. + // Rotate around that vertex until the boundary is reached (a lookup by vertex fails + // if two boundary edges leave the same vertex, e.g. at a hole touching the boundary). + foreach (var e in boundary) { - e.next = boundary[e.twin.origin.id]; + var current = e.twin; + + while (true) + { + // Previous edge in the (triangular) face: it enters the end vertex of e. + var entering = current.next.next; + + if (entering.twin.face == Face.Empty) + { + e.next = entering.twin; + break; + } + + current = entering.twin; + } } dcel.Vertices.AddRange(vertices); diff --git a/src/Triangle/Meshing/Data/BadTriQueue.cs b/src/Triangle/Meshing/Data/BadTriQueue.cs index dd00761..1fea883 100644 --- a/src/Triangle/Meshing/Data/BadTriQueue.cs +++ b/src/Triangle/Meshing/Data/BadTriQueue.cs @@ -7,6 +7,7 @@ namespace TriangleNet.Meshing.Data { + using System; using TriangleNet.Geometry; using TriangleNet.Topology; @@ -106,6 +107,10 @@ public void Enqueue(BadTriangle badtri) queuenumber = 2048 + exponent; } + // Keys of 0, subnormal or infinite (edges shorter than about 1e-154 or longer than + // 1e154) are outside the computed range. + queuenumber = Math.Max(0, Math.Min(4095, queuenumber)); + // Are we inserting into an empty queue? if (queuefront[queuenumber] == null) { diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index d2c2810..8706a57 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -81,14 +81,6 @@ public void Apply(QualityOptions quality, bool delaunay = false, CancellationTok enableAcute = !quality.UseLegacyRefinement; } - // TODO: remove - if (!behavior.Poly) - { - // Be careful not to allocate space for element area constraints that - // will never be assigned any value (other than the default -1.0). - behavior.VarArea = false; - } - // Ensure that no vertex can be mistaken for a triangular bounding // box vertex in insertvertex(). mesh.infvertex1 = null; @@ -1327,7 +1319,7 @@ private void EnforceQuality(CancellationToken cancellationToken) // triangulation should be (conforming) Delaunay. // Next, we worry about enforcing triangle quality. - if ((behavior.MinAngle > 0.0) || behavior.VarArea || behavior.fixedArea || behavior.UserTest != null) + if ((behavior.MinAngle > 0.0) || (behavior.MaxAngle > 0.0) || behavior.VarArea || behavior.fixedArea || behavior.UserTest != null) { // TODO: Reset queue? (Or is it always empty at this point) diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index eb43af9..40d2d1a 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -133,6 +133,9 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol var segments = new List(polygon.Segments.Count); + // Segments which collapsed to a point. + var vanished = new List<(Vertex, Vertex)>(); + foreach (var s in polygon.Segments) { var a = s.GetVertex(0); @@ -152,6 +155,10 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol { segments.Add(new Segment(ma, mb, s.Label)); } + else + { + vanished.Add((a, b)); + } } bool changed = merged.Count > 0; @@ -200,11 +207,25 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol HasSegmentMarkers = polygon.HasSegmentMarkers }; + // New vertices get IDs above the user's IDs (otherwise user IDs are no longer + // unique and the mesh renumbers all vertices). + int id = polygon.Points.Count == 0 ? 0 : polygon.Points.Max(p => p.id); + + foreach (var v in newPoints) + { + v.id = ++id; + } + noded.Points.AddRange(polygon.Points.Where(p => !merged.ContainsKey(p))); noded.Points.AddRange(newPoints); noded.Segments.AddRange(segments); - noded.Holes.AddRange(polygon.Holes); - noded.Regions.AddRange(polygon.Regions); + + // A hole or region point inside a contour which collapsed (smaller than the + // tolerance) would now lie in the surrounding region: drop it. + bool Collapsed(Point p) => vanished.Any(e => DistanceToSegment(p, e.Item1, e.Item2) <= tolerance); + + noded.Holes.AddRange(polygon.Holes.Where(h => !Collapsed(h))); + noded.Regions.AddRange(polygon.Regions.Where(r => !Collapsed(r.Point))); result = noded; } @@ -232,6 +253,12 @@ private static Dictionary MergeVertices(IEnumerable poin { // Exact duplicates are kept (handled by the triangulator). merged[v] = target; + + // Keep the label of the merged vertex. + if (target.label == 0 && v.label != 0) + { + target.label = v.label; + } } } @@ -255,6 +282,12 @@ private static double GetScale(IPolygon polygon) /// /// Find all pairs of segments that cross in their interiors (sweep along x-axis). /// + /// + /// If the segments overlap less along the y-axis (e.g. many long horizontal segments, + /// which makes the x-sweep quadratic), the sweep runs along the y-axis. The pairs are + /// returned in the order of the x-sweep in any case (the order matters for merging + /// intersection points). + /// private static List<(int, int)> FindCrossings(List segments, IPredicates predicates) { int n = segments.Count; @@ -262,14 +295,75 @@ private static double GetScale(IPolygon polygon) var order = new int[n]; var xmin = new double[n]; + double extentX = 0.0, extentY = 0.0; + for (int i = 0; i < n; i++) { + var a = segments[i].GetVertex(0); + var b = segments[i].GetVertex(1); + order[i] = i; - xmin[i] = Math.Min(segments[i].GetVertex(0).x, segments[i].GetVertex(1).x); + xmin[i] = Math.Min(a.x, b.x); + + extentX += Math.Abs(b.x - a.x); + extentY += Math.Abs(b.y - a.y); } Array.Sort((double[])xmin.Clone(), order); + if (extentY >= extentX) + { + return Sweep(segments, order, xmin, true, predicates); + } + + var yorder = new int[n]; + var ymin = new double[n]; + + for (int i = 0; i < n; i++) + { + yorder[i] = i; + ymin[i] = Math.Min(segments[i].GetVertex(0).y, segments[i].GetVertex(1).y); + } + + Array.Sort((double[])ymin.Clone(), yorder); + + var crossings = Sweep(segments, yorder, ymin, false, predicates); + + // Order of the x-sweep: by rank in the x-order of the first, then of the second segment. + var rank = new int[n]; + + for (int k = 0; k < n; k++) + { + rank[order[k]] = k; + } + + for (int i = 0; i < crossings.Count; i++) + { + var (p, q) = crossings[i]; + + if (rank[p] > rank[q]) + { + crossings[i] = (q, p); + } + } + + crossings.Sort((u, v) => + { + int c = rank[u.Item1].CompareTo(rank[v.Item1]); + return c != 0 ? c : rank[u.Item2].CompareTo(rank[v.Item2]); + }); + + return crossings; + } + + /// + /// Sweep along the x-axis (or y-axis) with the segments sorted by their minimum coordinate. + /// + private static List<(int, int)> Sweep(List segments, int[] order, double[] min, + bool alongX, IPredicates predicates) + { + int n = segments.Count; + var crossings = new List<(int, int)>(); for (int k = 0; k < n; k++) @@ -278,17 +372,20 @@ private static double GetScale(IPolygon polygon) var a = s.GetVertex(0); var b = s.GetVertex(1); - double xmax = Math.Max(a.x, b.x); - double ymin = Math.Min(a.y, b.y); - double ymax = Math.Max(a.y, b.y); + double max = alongX ? Math.Max(a.x, b.x) : Math.Max(a.y, b.y); + double lo = alongX ? Math.Min(a.y, b.y) : Math.Min(a.x, b.x); + double hi = alongX ? Math.Max(a.y, b.y) : Math.Max(a.x, b.x); - for (int m = k + 1; m < n && xmin[order[m]] <= xmax; m++) + for (int m = k + 1; m < n && min[order[m]] <= max; m++) { var t = segments[order[m]]; var c = t.GetVertex(0); var d = t.GetVertex(1); - if (Math.Max(c.y, d.y) < ymin || Math.Min(c.y, d.y) > ymax) + double tlo = alongX ? Math.Min(c.y, d.y) : Math.Min(c.x, d.x); + double thi = alongX ? Math.Max(c.y, d.y) : Math.Max(c.x, d.x); + + if (thi < lo || tlo > hi) { continue; } @@ -431,21 +528,41 @@ private static List Split(List segments, Dictionary(new EdgeComparer()); + // For new segments the Segment is stored (null for unchanged input segments). + var existing = new Dictionary<(Vertex, Vertex), (int Label, Segment Created)>(new EdgeComparer()); for (int i = 0; i < segments.Count; i++) { if (!splits.ContainsKey(i)) { - existing.Add((segments[i].GetVertex(0), segments[i].GetVertex(1))); + existing[(segments[i].GetVertex(0), segments[i].GetVertex(1))] = (segments[i].Label, null); } } void AddNew(Vertex a, Vertex b, int label) { - if (existing.Add((a, b))) + if (!existing.TryGetValue((a, b), out var entry)) { - result.Add(new Segment(a, b, label)); + var segment = new Segment(a, b, label); + existing.Add((a, b), (label, segment)); + result.Add(segment); + } + else if (entry.Label == 0 && label != 0) + { + // Coinciding pieces: a non-zero label wins (as in the mesher). + if (entry.Created != null) + { + entry.Created.Label = label; + existing[(a, b)] = (label, entry.Created); + } + else + { + // Unchanged input segment with label 0: add the piece, the mesher merges + // duplicate segments and keeps the non-zero label. + var segment = new Segment(a, b, label); + existing[(a, b)] = (label, segment); + result.Add(segment); + } } } @@ -523,6 +640,15 @@ private static Vertex GetOrCreateVertex(double x, double y, int label, return v; } + private static double DistanceToSegment(Point p, Vertex a, Vertex b) + { + double dx = b.x - a.x, dy = b.y - a.y, l2 = dx * dx + dy * dy; + double t = l2 == 0.0 ? 0.0 : Math.Max(0.0, Math.Min(1.0, ((p.x - a.x) * dx + (p.y - a.y) * dy) / l2)); + double ex = a.x + t * dx - p.x, ey = a.y + t * dy - p.y; + + return Math.Sqrt(ex * ex + ey * ey); + } + private static bool SameLocation(Vertex a, Vertex b) { return a.x == b.x && a.y == b.y; diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 5f8273e..f17ff36 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -2474,12 +2474,14 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, //double p[5]; // Resize work arrays - if (2 * numpoints > petalx.Length) + // The work arrays are shared with the other wedge intersection method, which + // needs a different size of 'wedges': check both. + if (2 * numpoints > petalx.Length || 2 * numpoints * 16 + 36 > wedges.Length) { - petalx = new double[2 * numpoints]; - petaly = new double[2 * numpoints]; - petalr = new double[2 * numpoints]; - wedges = new double[2 * numpoints * 16 + 36]; + petalx = new double[Math.Max(2 * numpoints, petalx.Length)]; + petaly = new double[Math.Max(2 * numpoints, petaly.Length)]; + petalr = new double[Math.Max(2 * numpoints, petalr.Length)]; + wedges = new double[Math.Max(2 * numpoints * 16 + 36, wedges.Length)]; } double xmid, ymid, dist, x3, y3; @@ -2736,12 +2738,14 @@ private bool GetWedgeIntersection(int numpoints, double[] points, ref double[] n //double p[5]; // Resize work arrays - if (2 * numpoints > petalx.Length) + // The work arrays are shared with the other wedge intersection method, which + // needs a different size of 'wedges': check both. + if (2 * numpoints > petalx.Length || 2 * numpoints * 20 + 40 > wedges.Length) { - petalx = new double[2 * numpoints]; - petaly = new double[2 * numpoints]; - petalr = new double[2 * numpoints]; - wedges = new double[2 * numpoints * 20 + 40]; + petalx = new double[Math.Max(2 * numpoints, petalx.Length)]; + petaly = new double[Math.Max(2 * numpoints, petaly.Length)]; + petalr = new double[Math.Max(2 * numpoints, petalr.Length)]; + wedges = new double[Math.Max(2 * numpoints * 20 + 40, wedges.Length)]; } double xmid, ymid, dist, x3, y3; diff --git a/src/Triangle/Smoothing/SimpleSmoother.cs b/src/Triangle/Smoothing/SimpleSmoother.cs index 9351295..0a25ea9 100644 --- a/src/Triangle/Smoothing/SimpleSmoother.cs +++ b/src/Triangle/Smoothing/SimpleSmoother.cs @@ -5,6 +5,7 @@ // ----------------------------------------------------------------------- using System; +using System.Linq; using System.Threading; namespace TriangleNet.Smoothing @@ -46,9 +47,11 @@ public SimpleSmoother(IVoronoiFactory factory) this.factory = factory; pool = new TrianglePool(); + // Each triangulation needs its own pool: the final mesh is handed to the caller and + // must not be overwritten when the smoother is used again. config = new Configuration( () => RobustPredicates.Default, - () => pool.Restart()); + () => new TrianglePool()); options = new ConstraintOptions() { ConformingDelaunay = true }; } @@ -103,26 +106,49 @@ public int Smooth(IMesh mesh, int limit = 10, double tol = .01, CancellationToke prevMax = double.PositiveInfinity, currMax = 1d; + // The vertices of the input mesh are moved: remember their positions, so the mesh + // stays unchanged if smoothing is cancelled or fails. + var original = smoothedMesh.vertices.Values.Select(v => (v, v.x, v.y, v.type, v.tri)).ToList(); + // Take a few smoothing rounds (Lloyd's algorithm). The stop // criteria are the maximum number of iterations and the convergence - // criterion. + // criterion (which needs two real iterations, currMax = 1 is only a + // placeholder and must not be compared). int i = 0; - while (i < limit && Math.Abs(currMax - prevMax) > tol * currMax) + + try { - // throw an OperationCanceledException if cancellation is requested - cancellationToken.ThrowIfCancellationRequested(); + while (i < limit && (i < 2 || Math.Abs(currMax - prevMax) > tol * currMax)) + { + // throw an OperationCanceledException if cancellation is requested + cancellationToken.ThrowIfCancellationRequested(); + + prevMax = currMax; + currMax = Step(smoothedMesh, factory, predicates); + + // Actually, we only want to rebuild, if the mesh is no longer + // Delaunay. Flipping edges could be the right choice instead + // of re-triangulating... + smoothedMesh = (Mesh)mesher.Triangulate(Rebuild(smoothedMesh), options); - prevMax = currMax; - currMax = Step(smoothedMesh, factory, predicates); + factory.Reset(); - // Actually, we only want to rebuild, if the mesh is no longer - // Delaunay. Flipping edges could be the right choice instead - // of re-triangulating... - smoothedMesh = (Mesh)mesher.Triangulate(Rebuild(smoothedMesh), options); + i++; + } + } + catch + { + foreach (var (v, x, y, type, tri) in original) + { + v.x = x; + v.y = y; + v.type = type; + v.tri = tri; + } factory.Reset(); - i++; + throw; } smoothedMesh.CopyTo((Mesh)mesh); diff --git a/src/Triangle/Smoothing/VoronoiFactory.cs b/src/Triangle/Smoothing/VoronoiFactory.cs index cefef56..46e8352 100644 --- a/src/Triangle/Smoothing/VoronoiFactory.cs +++ b/src/Triangle/Smoothing/VoronoiFactory.cs @@ -65,6 +65,8 @@ public Vertex CreateVertex(double x, double y) vertex.x = x; vertex.y = y; vertex.leaving = null; + vertex.label = 0; + vertex.id = 0; return vertex; } @@ -108,9 +110,12 @@ public Face CreateFace(Geometry.Vertex vertex) if (faces.TryGet(out face)) { + // Same state as a new face. face.id = vertex.id; face.generator = vertex; face.edge = null; + face.bounded = true; + face.label = vertex.label; return face; } diff --git a/src/Triangle/Tools/CuthillMcKee.cs b/src/Triangle/Tools/CuthillMcKee.cs index 2a61854..3d5a17f 100644 --- a/src/Triangle/Tools/CuthillMcKee.cs +++ b/src/Triangle/Tools/CuthillMcKee.cs @@ -244,11 +244,12 @@ void Rcm(int root, int[] mask, int[] perm, int offset, ref int iccsze) k = k + 1; nbr = perm[offset + k - 1]; - while (fnbr < l) + // Indices are 0-based here (the original code was 1-based). + while (fnbr <= l) { lperm = perm[offset + l - 1]; - if (deg[lperm - 1] <= deg[nbr - 1]) + if (deg[lperm] <= deg[nbr]) { break; } @@ -355,8 +356,8 @@ void FindRoot(ref int root, int[] mask, ref int level_num, int[] level_row, { node = level[offset + j - 1]; ndeg = 0; - kstrt = pcol[node - 1]; - kstop = pcol[node] - 1; + kstrt = pcol[node]; + kstop = pcol[node + 1] - 1; for (k = kstrt; k <= kstop; k++) { diff --git a/src/Triangle/Tools/IntersectionHelper.cs b/src/Triangle/Tools/IntersectionHelper.cs index 0310481..3969748 100644 --- a/src/Triangle/Tools/IntersectionHelper.cs +++ b/src/Triangle/Tools/IntersectionHelper.cs @@ -20,15 +20,18 @@ public static class IntersectionHelper /// The segment start point. /// The segment end point. /// The point to test. - /// Threshold to test collinearity (default = 1e-12). + /// Threshold to test collinearity, relative to the squared segment length (default = 1e-12). /// public static bool IsPointOnSegment(Point a, Point b, Point test, double eps = 1e-12) { // The cross product. double cross = (test.Y - a.Y) * (b.X - a.X) - (test.X - a.X) * (b.Y - a.Y); - // Check if points are collinear. - if (Math.Abs(cross) > eps) return false; + // Check if points are collinear (relative to the segment length: the cross product + // is the distance to the line times the length). + double length2 = (b.X - a.X) * (b.X - a.X) + (b.Y - a.Y) * (b.Y - a.Y); + + if (Math.Abs(cross) > eps * length2) return false; // The dot product (projection of test point onto segment). double dot = (test.X - a.X) * (b.X - a.X) + (test.Y - a.Y) * (b.Y - a.Y); @@ -185,6 +188,12 @@ public static Point BoxRayIntersection(Rectangle rect, Point p, double dx, doubl /// Returns false, if startpoint is outside the box. public static bool BoxRayIntersection(Rectangle rect, Point p, double dx, double dy, ref Point c) { + if (dx == 0.0 && dy == 0.0) + { + // No direction. + return false; + } + double x = p.X; double y = p.Y; diff --git a/src/Triangle/Tools/PolygonValidator.cs b/src/Triangle/Tools/PolygonValidator.cs index 944ec8e..7d3f142 100644 --- a/src/Triangle/Tools/PolygonValidator.cs +++ b/src/Triangle/Tools/PolygonValidator.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Tools { using System; using System.Collections.Generic; + using System.Linq; using TriangleNet.Geometry; /// @@ -56,6 +57,15 @@ public static bool IsConsistent(IPolygon poly) i++; } + if (points.Contains(null)) + { + // The checks below need all points. + return false; + } + + // Segment endpoints must be polygon points (the mesh uses the point list). + var pointSet = new HashSet(points, ReferenceComparer.Instance); + i = 0; foreach (var seg in poly.Segments) @@ -79,14 +89,18 @@ public static bool IsConsistent(IPolygon poly) "PolygonValidator.IsConsistent()"); } + if (!pointSet.Contains(p) || !pointSet.Contains(q)) + { + horrors++; + logger.Warning(string.Format("Segment {0} has an endpoint which is not in the list of points.", i), + "PolygonValidator.IsConsistent()"); + } + i++; } - if (points[0].id == points[1].id) - { - horrors += CheckVertexIDs(poly, count); - } - else + // User defined ids (not all equal) must be unique. + if (points.Any(v => v.id != points[0].id)) { horrors += CheckDuplicateIDs(poly); } @@ -244,39 +258,13 @@ private static double CrossProductLength(Point a, Point b, Point c) return (a.x - b.x) * (c.y - b.y) - (a.y - b.y) * (c.x - b.x); } - private static int CheckVertexIDs(IPolygon poly, int count) + private sealed class ReferenceComparer : IEqualityComparer { - var logger = Log.Instance; - - int horrors = 0; - - int i = 0; + public static readonly ReferenceComparer Instance = new ReferenceComparer(); - Vertex p, q; - - foreach (var seg in poly.Segments) - { - p = seg.GetVertex(0); - q = seg.GetVertex(1); - - if (p.id < 0 || p.id >= count) - { - horrors++; - logger.Warning(string.Format("Segment {0} has invalid start point.", i), - "PolygonValidator.IsConsistent()"); - } - - if (q.id < 0 || q.id >= count) - { - horrors++; - logger.Warning(string.Format("Segment {0} has invalid endpoint.", i), - "PolygonValidator.IsConsistent()"); - } - - i++; - } + public bool Equals(Vertex a, Vertex b) => ReferenceEquals(a, b); - return horrors; + public int GetHashCode(Vertex v) => System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(v); } private static int CheckDuplicateIDs(IPolygon poly) diff --git a/src/Triangle/Tools/TriangleQuadTree.cs b/src/Triangle/Tools/TriangleQuadTree.cs index 8c14f31..b191d21 100644 --- a/src/Triangle/Tools/TriangleQuadTree.cs +++ b/src/Triangle/Tools/TriangleQuadTree.cs @@ -84,35 +84,15 @@ public ITriangle Query(double x, double y) /// True, if point is inside or on the edge of this triangle. internal static bool IsPointInTriangle(Point p, Point t0, Point t1, Point t2) { - // TODO: no need to create new Point instances here - Point d0 = new Point(t1.x - t0.x, t1.y - t0.y); - Point d1 = new Point(t2.x - t0.x, t2.y - t0.y); - Point d2 = new Point(p.x - t0.x, p.y - t0.y); + // Exact orientation tests (the former barycentric test divided and missed points on + // interior edges). Works for both orientations of the triangle. + var predicates = RobustPredicates.Default; - // crossproduct of (0, 0, 1) and d0 - Point c0 = new Point(-d0.y, d0.x); + double o0 = predicates.CounterClockwise(t0, t1, p); + double o1 = predicates.CounterClockwise(t1, t2, p); + double o2 = predicates.CounterClockwise(t2, t0, p); - // crossproduct of (0, 0, 1) and d1 - Point c1 = new Point(-d1.y, d1.x); - - // Linear combination d2 = s * d0 + v * d1. - // - // Multiply both sides of the equation with c0 and c1 - // and solve for s and v respectively - // - // s = d2 * c1 / d0 * c1 - // v = d2 * c0 / d1 * c0 - - double s = DotProduct(d2, c1) / DotProduct(d0, c1); - double v = DotProduct(d2, c0) / DotProduct(d1, c0); - - if (s >= 0 && v >= 0 && ((s + v) <= 1)) - { - // Point is inside or on the edge of this triangle. - return true; - } - - return false; + return (o0 >= 0 && o1 >= 0 && o2 >= 0) || (o0 <= 0 && o1 <= 0 && o2 <= 0); } internal static double DotProduct(Point p, Point q) diff --git a/src/Triangle/Voronoi/BoundedVoronoi.cs b/src/Triangle/Voronoi/BoundedVoronoi.cs index 3e87ab8..c742dda 100644 --- a/src/Triangle/Voronoi/BoundedVoronoi.cs +++ b/src/Triangle/Voronoi/BoundedVoronoi.cs @@ -15,6 +15,12 @@ namespace TriangleNet.Voronoi /// /// Computing the bounded Voronoi diagram of a constrained and conforming Delaunay triangulation. /// + /// + /// The mesh must be conforming Delaunay (): + /// only then the circumcenters of all triangles lie inside the domain or just beyond their + /// own boundary edge. For a constrained (non-conforming) triangulation, cells may extend + /// beyond the domain and overlap. + /// public class BoundedVoronoi : VoronoiBase { int offset; @@ -105,14 +111,13 @@ private void HandleCase1(HalfEdge edge, TVertex v1, TVertex v2) // Let the face edge point to the edge leaving at generator. edge.face.edge = h2; + // Ids are the indices in the list. + h1.id = edges.Count; + h2.id = edges.Count + 1; + edges.Add(h1); edges.Add(h2); - int count = edges.Count; - - h1.id = count; - h2.id = count + 1; - gen.id = offset++; vertices.Add(gen); } @@ -169,10 +174,10 @@ private void HandleCase2(HalfEdge edge, TVertex v1, TVertex v2) // Let the face edge point to the edge leaving at generator. edge.face.edge = he; - edges.Add(he); - he.id = edges.Count; + edges.Add(he); + gen.id = offset++; vertices.Add(gen); } diff --git a/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs b/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs index c574bcb..5d9353e 100644 --- a/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs +++ b/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs @@ -98,6 +98,12 @@ private void Generate() foreach (var v in mesh.vertices.Values) { + // Duplicate input vertices aren't part of the mesh. + if (v.type == VertexType.UndeadVertex) + { + continue; + } + // TODO: Need a reliable way to check if a vertex is on a segment if (v.type == VertexType.FreeVertex || v.label == 0) { diff --git a/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs b/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs index 68a3d24..fefd4a7 100644 --- a/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs +++ b/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs @@ -100,6 +100,12 @@ private void Generate() // Add all Voronoi regions to the map. foreach (var vertex in mesh.vertices.Values) { + // Duplicate input vertices aren't part of the mesh. + if (vertex.type == VertexType.UndeadVertex) + { + continue; + } + regions.Add(vertex.id, new VoronoiRegion(vertex)); } @@ -132,6 +138,9 @@ private void ComputeCircumCenters() bounds.Expand(pt); } + // Include the mesh (the circumcenters alone may coincide, e.g. a single triangle). + bounds.Expand(mesh.bounds); + double ds = Math.Max(bounds.Width, bounds.Height); bounds.Resize(ds / 10, ds / 10); } diff --git a/src/Triangle/Voronoi/StandardVoronoi.cs b/src/Triangle/Voronoi/StandardVoronoi.cs index 3469ff2..ba32ef8 100644 --- a/src/Triangle/Voronoi/StandardVoronoi.cs +++ b/src/Triangle/Voronoi/StandardVoronoi.cs @@ -43,7 +43,8 @@ public StandardVoronoi(Mesh mesh, Rectangle box) public StandardVoronoi(Mesh mesh, Rectangle box, IVoronoiFactory factory, IPredicates predicates) : base(mesh, factory, predicates, true) { - // We assume the box to be at least as large as the mesh. + // We assume the box to be at least as large as the mesh (don't modify the argument). + box = new Rectangle(box); box.Expand(mesh.bounds); // We explicitly told the base constructor to call the Generate method, so From 59d669605dd1b6de41d18653a7c71317ce88aa81 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 07:50:19 +0000 Subject: [PATCH 16/50] Docs: class-by-class review results Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 284f978..b2fe98f 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -197,7 +197,7 @@ paralleles Vermaschen mit eigenen Prädikaten. | 200 Segmente auf 50er-Raster, 20° | – | 50/50 | | Nachbarflächen mit Abweichung 1e-12, 25°, **ohne** Steiner-Limit | terminiert nicht | ~30 ms | -Die Testsuite hat jetzt 404 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre +Die Testsuite hat jetzt 752 Tests, alle grün. Die früheren `KnownBug`-Tests sind reguläre Regressionstests geworden. ### Externer Korpus: GEOS-Robustheitstests @@ -327,6 +327,26 @@ Ausgangswerte (`Triangle.Benchmarks`, `--job short`, Release, Container mit 4 Ke Vorgehen pro Optimierung: Benchmark vorher/nachher (Standard-Job), Charakterisierungstests grün (bei verhaltensneutralen Änderungen unveränderte Fingerabdrücke). +## Klassenweises Review (`src/Triangle.Tests/Review`) + +Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit +einem Test geprüft (Review A–F, 269 Testfälle). 60 Fehler bestätigten sich, alle sind +behoben, die Tests sind jetzt Regressionstests; 3 weitere Befunde sind dokumentierte Grenzen. Widerlegte Vermutungen sind als +Regressionstests erhalten. + +| Bereich | Wichtigste Befunde (alle behoben) | +|---------|-----------------------------------| +| A Mesh, Pool, Behavior | Doppelte Dreiecks-IDs nach `Renumber` + `Refine` (`mesh.Edges` ließ Kanten aus); `Refine` eines Punktnetzes vergrößerte das Gebiet (Hülle nicht markiert) und ignorierte die Konfiguration; Vertex-Objekte aus einem anderen Netz verbanden zwei Netze; ungültiger Winkel schaltete alle Qualitätsvorgaben ab; `TrianglePool.Contains/Sample/Clear` | +| B Qualitätsverfeinerung | `MaximumAngle` allein wirkungslos; `IndexOutOfRange` beim Verfeinern mit Maximalwinkel (geteilte Arbeitsarrays); nach dem Löschen von Punkten wurden Dreiecke bei eingeschränkter Segmentteilung nicht geprüft (zu große Dreiecke); `VariableArea` bei Punktnetzen ignoriert; Warteschlange bei extremen Kantenlängen | +| C Noding, Constraints, Converter | Schnittpunkte bekamen ID 0 (Benutzer-IDs wurden neu vergeben); Snap-Toleranz größer als ein Loch leerte das ganze Netz; Labels bei deckungsgleichen Teilstücken und verschmolzenen Punkten; mehrere Regionspunkte in einem Gebiet; `ToDCEL` bei Löchern, die den Rand berühren; `ToMesh` mit beliebigen IDs; Noding langer paralleler Segmente quadratisch (20.000 Linien: 4,7 s) | +| D Geometrie, Topologie | **Lochpunkt landete bei UTM-Koordinaten auf dem Lochrand** (13 von 154 zufälligen dreieckigen Löchern: Netz um das Loch herum gelöscht, ohne Fehlermeldung); dünne Konturen ohne Innenpunkt (Exception); `Rectangle`-Kopierkonstruktor, `Intersects`; `VertexCirculator` verschachtelt bzw. für doppelte Punkte; DCEL an Berührpunkten | +| E Voronoi, Glätten, Tools | Wiederverwendeter `SimpleSmoother` zerstörte das zuvor geglättete Netz; Abbruch hinterließ halb verschobene Punkte; Abbruchkriterium skalenabhängig; Reverse Cuthill-McKee sortierte Nachbarn falsch (Bandbreite 9 statt 7); `TriangleQuadTree` fand Punkte auf inneren Kanten nicht; `PolygonValidator`; Legacy-Voronoi mit doppelten Punkten | +| F IO, Prädikate, Log | **`.poly` schreiben: alle Segmente als „0 0“** bei Polygonen aus Konturen; Regionsflächen gingen beim Schreiben verloren bzw. wurden in Exponentialschreibweise nicht gelesen; Kommentare am Zeilenende; 6-Knoten-Elemente; kulturabhängige Ganzzahlen; `Jettison`-Nummerierung; Log nicht thread-sicher; Koordinaten > 1e70 (Überlauf der exakten Arithmetik) werden jetzt abgewiesen | + +Dokumentierte Grenzen (keine Fehler): Die exakten Prädikate setzen voraus, dass Koordinaten- +differenzen nicht unter etwa 1e-75 liegen (Unterlauf, wie im C-Original). `BoundedVoronoi` +setzt ein Conforming-Delaunay-Netz voraus. + ## Upstream-Issues (github.com/wo80/Triangle.NET/issues) Alle 48 Issues wurden gesichtet (Stand Oktober 2026). Fehlerberichte mit genug Information sind From 1117f3df4ae41dfc234687c9486ba279daed97e5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 09:04:39 +0000 Subject: [PATCH 17/50] Add grid snap rounding, wedge merging and terrain simplification - ConstraintOptions.GridSize: snap rounding of the input to the output grid (SegmentNoder.SnapRound, iterated snap rounding with hot pixels), Steiner points rounded to the grid during refinement (no aCute relocation, no angle refinement of triangles below two grid cells, shell rule with grid tolerance), remaining vertices moved by GridSnapper.SnapVertices where no triangle flips. Rounding the output no longer flips triangles. - ConstraintOptions.WedgeTolerance: merge segments running along another segment at a small angle (thin wedges) without raising the snap tolerance. - Tools.TerrainSimplifier: greedy insertion TIN simplification with a vertical error bound (and break lines), incremental with a max-heap. - Corpus harness: grid, wedge tolerance and flipped-by-rounding statistics. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Tests/Corpus/CorpusCheck.cs | 25 +- src/Triangle.Tests/Corpus/CorpusTest.cs | 12 +- .../Robustness/GridSnapRoundingTest.cs | 223 +++++ .../Robustness/TerrainSimplifierTest.cs | 182 ++++ .../Robustness/WedgeMergeTest.cs | 115 +++ src/Triangle/Mesh.cs | 2 +- src/Triangle/Meshing/ConstraintOptions.cs | 27 + src/Triangle/Meshing/GenericMesher.cs | 21 +- src/Triangle/Meshing/GridSnapper.cs | 174 ++++ src/Triangle/Meshing/QualityMesher.cs | 46 +- src/Triangle/Meshing/SegmentNoder.cs | 373 +++++++- src/Triangle/NewLocation.cs | 17 + src/Triangle/Tools/TerrainSimplifier.cs | 833 ++++++++++++++++++ 13 files changed, 2035 insertions(+), 15 deletions(-) create mode 100644 src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs create mode 100644 src/Triangle.Tests/Robustness/TerrainSimplifierTest.cs create mode 100644 src/Triangle.Tests/Robustness/WedgeMergeTest.cs create mode 100644 src/Triangle/Meshing/GridSnapper.cs create mode 100644 src/Triangle/Tools/TerrainSimplifier.cs diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index 9f6e6b2..21d9c63 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -15,7 +15,8 @@ public static class CorpusCheck /// /// Returns "OK ..." or a description of the failure. /// - public static string Run(CorpusCase c, double minAngle, int steinerPoints, double snapTolerance = 0.0) + public static string Run(CorpusCase c, double minAngle, int steinerPoints, double snapTolerance = 0.0, + double gridSize = 0.0, double outputGrid = 0.0, double wedgeTolerance = 0.0) { var poly = new Polygon(); var map = new Dictionary<(double, double), Vertex>(); @@ -57,6 +58,12 @@ Vertex V((double, double) p) double w = Math.Max(Math.Max(b.Width, b.Height) * 0.1, mag * 1e-6 + 1e-6); var f = new[] { (b.Left - w, b.Bottom - w), (b.Right + w, b.Bottom - w), (b.Right + w, b.Top + w), (b.Left - w, b.Top + w) }; + if (gridSize > 0.0) + { + // The frame is snapped to the grid, too. + f = f.Select(p => (GridSnapper.Round(p.Item1, gridSize), GridSnapper.Round(p.Item2, gridSize))).ToArray(); + } + for (int i = 0; i < 4; i++) { poly.Add(new Segment(V(f[i]), V(f[(i + 1) % 4]))); @@ -71,7 +78,7 @@ Vertex V((double, double) p) try { var quality = minAngle > 0 ? new QualityOptions { MinimumAngle = minAngle, SteinerPoints = steinerPoints } : null; - mesh = (Mesh)poly.Triangulate(new ConstraintOptions { SnapTolerance = snapTolerance }, quality); + mesh = (Mesh)poly.Triangulate(new ConstraintOptions { SnapTolerance = snapTolerance, GridSize = gridSize, WedgeTolerance = wedgeTolerance }, quality); } catch (ArgumentException) when (poly.Points.Any(p => !IsFinite(p.X) || !IsFinite(p.Y))) { @@ -110,7 +117,7 @@ Vertex V((double, double) p) // Every input segment must be covered by mesh subsegments (within the snap tolerance). SegmentNoder.Node(poly, predicates, out double noderTolerance, minTolerance: snapTolerance); - double tol = Math.Max(scale * 1e-11, 4 * noderTolerance); + double tol = Math.Max(Math.Max(scale * 1e-11, 4 * noderTolerance), Math.Max(gridSize, wedgeTolerance)); var subsegs = mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(); int missing = poly.Segments.Count(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tol)); @@ -125,7 +132,17 @@ Vertex V((double, double) p) int bad = minAngle > 0 ? mesh.Triangles.Count(t => MinimumAngle(t) < minAngle - 0.01) : 0; bool limit = minAngle > 0 && mesh.Vertices.Count - poly.Points.Count >= steinerPoints; - return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)}"; + // Triangles which are flat or inverted after rounding the coordinates to the output grid. + double og = gridSize > 0.0 ? gridSize : outputGrid; + int flip = 0; + + if (og > 0.0) + { + Vertex R(Vertex v) => new Vertex(GridSnapper.Round(v.X, og), GridSnapper.Round(v.Y, og)); + flip = mesh.Triangles.Count(t => predicates.CounterClockwise(R(t.GetVertex(0)), R(t.GetVertex(1)), R(t.GetVertex(2))) <= 0.0); + } + + return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)} flip={flip}"; } private static double MinimumAngle(Topology.Triangle t) diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index cf203e9..caa1101 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -26,6 +26,10 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) + /// TRIANGLE_CORPUS_GRID output grid (ConstraintOptions.GridSize, default 0) + /// TRIANGLE_CORPUS_WEDGE wedge tolerance (ConstraintOptions.WedgeTolerance, default 0) + /// TRIANGLE_CORPUS_ROUND count triangles flipped by rounding to this grid (default 0 = off, + /// the output grid if set) /// TRIANGLE_CORPUS_ANGLES comma separated minimum angles (default 0,20; 0 = no quality) /// /// Run: dotnet test --filter TestCategory=Corpus @@ -114,7 +118,7 @@ public static int RunCase(string[] args) double snap = args.Length > 3 ? double.Parse(args[3], CultureInfo.InvariantCulture) : SnapTolerance(); - Console.WriteLine("RESULT " + CorpusCheck.Run(c, minAngle, SteinerPoints, snap)); + Console.WriteLine("RESULT " + CorpusCheck.Run(c, minAngle, SteinerPoints, snap, Grid("TRIANGLE_CORPUS_GRID"), Grid("TRIANGLE_CORPUS_ROUND"), Grid("TRIANGLE_CORPUS_WEDGE"))); return 0; } @@ -168,7 +172,8 @@ private static void RunCases(IEnumerable cases) TestContext.Out.WriteLine($" min angle {g.Key}: total {stats.Sum(r => r.Stats["ms"]) / 1000:F1} s, " + $"{stats.Sum(r => r.Stats["triangles"])} triangles, Steiner limit reached x {stats.Count(r => r.Stats["limit"] > 0)}, " + - $"bad triangles {stats.Sum(r => r.Stats["bad"])} ({100.0 * stats.Sum(r => r.Stats["bad"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %) in {stats.Count(r => r.Stats["bad"] > 0)} cases"); + $"bad triangles {stats.Sum(r => r.Stats["bad"])} ({100.0 * stats.Sum(r => r.Stats["bad"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %) in {stats.Count(r => r.Stats["bad"] > 0)} cases, " + + $"flipped by rounding {stats.Sum(r => r.Stats["flip"])} in {stats.Count(r => r.Stats["flip"] > 0)} cases"); foreach (var r in stats.OrderByDescending(r => r.Stats["ms"]).Take(5)) { @@ -200,6 +205,9 @@ private static double[] Angles() => private static double SnapTolerance() => double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_SNAP"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 0.0; + private static double Grid(string variable) => + double.TryParse(Environment.GetEnvironmentVariable(variable), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 0.0; + private static double TileSize() => double.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_TILE"), NumberStyles.Float, CultureInfo.InvariantCulture, out var s) ? s : 200.0; diff --git a/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs b/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs new file mode 100644 index 0000000..78ba1dd --- /dev/null +++ b/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs @@ -0,0 +1,223 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Snap rounding to an output grid (e.g. centimeters): all vertices of the mesh lie on the + /// grid, so rounding the coordinates when writing the mesh doesn't flip triangles. + /// + public class GridSnapRoundingTest + { + private const double Grid = 0.01; + + private static bool OnGrid(Point p, double g) => + p.X == GridSnapper.Round(p.X, g) && p.Y == GridSnapper.Round(p.Y, g); + + [Test] + public void RoundGivesNearestDoubleOfDecimalGrid() + { + // Same values as rounding to decimal places, as done when writing the output. + var random = new Random(1); + + for (int i = 0; i < 10000; i++) + { + double x = 300000 + 100000 * random.NextDouble(); + + Assert.That(GridSnapper.Round(x, 0.01), Is.EqualTo(Math.Round(x, 2))); + Assert.That(GridSnapper.Round(x, 0.001), Is.EqualTo(Math.Round(x, 3))); + } + + Assert.That(GridSnapper.Round(7.3, 0.5), Is.EqualTo(7.5)); + Assert.That(GridSnapper.Round(-7.3, 2.0), Is.EqualTo(-8.0)); + } + + [Test] + public void SnapRoundingPutsAllVerticesOnTheGrid() + { + var poly = RandomSegments(1, 40, 10.0); + + var noded = SegmentNoder.SnapRound(poly, new RobustPredicates(), Grid); + + Assert.That(noded.Points.All(p => OnGrid(p, Grid)), Is.True); + Assert.That(noded.Segments.All(s => OnGrid(s.GetVertex(0), Grid) && OnGrid(s.GetVertex(1), Grid)), Is.True); + } + + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + public void SnapRoundingResultIsProperlyNoded(int seed) + { + var poly = RandomSegments(seed, 60, 1.0); + + var noded = SegmentNoder.SnapRound(poly, new RobustPredicates(), Grid); + + AssertProperlyNoded(noded, Grid); + } + + [Test] + public void SnapRoundingMergesNearlyCoincidentBoundaries() + { + // Two adjacent parcels whose common boundary differs by a few millimeters. + var poly = TestData.AdjacentPolygonsWithMismatchedBoundary(0.003); + + var noded = SegmentNoder.SnapRound(poly, new RobustPredicates(), Grid); + + AssertProperlyNoded(noded, Grid); + + var mesh = (Mesh)new GenericMesher().Triangulate(noded, new ConstraintOptions { GridSize = Grid }, + new QualityOptions { MinimumAngle = 30 }); + + MeshAssert.IsValid(mesh); + + // No sliver between the boundaries: the mesh is small. + Assert.That(mesh.Triangles.Count, Is.LessThan(200)); + } + + [TestCase(1, 25.0)] + [TestCase(2, 30.0)] + [TestCase(3, 33.0)] + public void QualityMeshVerticesAreOnTheGrid(int seed, double angle) + { + var poly = RandomSegments(seed, 30, 10.0); + + var mesh = (Mesh)MeshAssert.Terminates(() => new GenericMesher().Triangulate(poly, + new ConstraintOptions { GridSize = Grid }, new QualityOptions { MinimumAngle = angle })); + + MeshAssert.IsValid(mesh); + + Assert.That(mesh.Vertices.All(v => OnGrid(v, Grid)), Is.True); + + var predicates = new RobustPredicates(); + + Assert.That(mesh.Triangles.All(t => predicates.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2)) > 0), Is.True); + } + + [Test] + public void RoundingAfterMeshingWithoutGridCanFlipTriangles_WithGridItCannot() + { + // Nearly coincident lines with millimeter offsets: rounding the output of a mesh + // computed in full precision to centimeters creates flat or inverted triangles. + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10), false); + + for (int i = 0; i < 8; i++) + { + double y = 2 + i * 0.7; + poly.Add(new Segment(new Vertex(0.5, y), new Vertex(9.5, y + 0.004 * (i + 1))), true); + poly.Add(new Segment(new Vertex(0.5, y + 0.003), new Vertex(9.5, y + 0.002)), true); + } + + var options = new QualityOptions { MinimumAngle = 30 }; + + var plain = (Mesh)new GenericMesher().Triangulate(poly, options); + Assert.That(CountFlippedAfterRounding(plain, Grid), Is.GreaterThan(0), "test case isn't critical"); + + var grid = (Mesh)new GenericMesher().Triangulate(poly, new ConstraintOptions { GridSize = Grid }, options); + MeshAssert.IsValid(grid); + Assert.That(CountFlippedAfterRounding(grid, Grid), Is.EqualTo(0)); + } + + [Test] + public void SnapVerticesKeepsTrianglesValid() + { + // Random points: snapping a point to the grid must not invert a triangle. + var random = new Random(5); + var points = Enumerable.Range(0, 2000).Select(_ => new Vertex(random.NextDouble(), random.NextDouble())).ToList(); + + var mesh = (Mesh)new GenericMesher().Triangulate(points); + + int unsnapped = GridSnapper.SnapVertices(mesh, 0.01); + + MeshAssert.IsValid(mesh); + + var predicates = new RobustPredicates(); + Assert.That(mesh.Triangles.All(t => predicates.CounterClockwise(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2)) > 0), Is.True); + Assert.That(mesh.Vertices.Count(v => !OnGrid(v, 0.01)), Is.EqualTo(unsnapped)); + } + + [Test] + public void LockedSegmentsKeepTheirVertices() + { + // Locked segments (break lines) on the grid are not changed by grid rounding. + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10), false); + poly.Add(new Segment(new Vertex(1, 1), new Vertex(9, 8.97), 7), true); + + var mesh = (Mesh)new GenericMesher().Triangulate(poly, + new ConstraintOptions { GridSize = Grid, CanSplitSegment = s => s.Label != 7 }, + new QualityOptions { MinimumAngle = 30 }); + + MeshAssert.IsValid(mesh); + + var locked = mesh.Segments.Where(s => s.Label == 7).ToList(); + Assert.That(locked.Count, Is.EqualTo(1)); + Assert.That(locked[0].GetVertex(0).X + locked[0].GetVertex(1).X, Is.EqualTo(10.0)); + } + + internal static int CountFlippedAfterRounding(Mesh mesh, double g) + { + var predicates = new RobustPredicates(); + Vertex R(Vertex v) => new Vertex(GridSnapper.Round(v.X, g), GridSnapper.Round(v.Y, g)); + + return mesh.Triangles.Count(t => predicates.CounterClockwise(R(t.GetVertex(0)), R(t.GetVertex(1)), R(t.GetVertex(2))) <= 0); + } + + private static void AssertProperlyNoded(IPolygon poly, double g) + { + var predicates = new RobustPredicates(); + var segments = poly.Segments; + + for (int i = 0; i < segments.Count; i++) + { + var a = segments[i].GetVertex(0); + var b = segments[i].GetVertex(1); + + Assert.That(a.X != b.X || a.Y != b.Y, Is.True, "degenerate segment"); + + for (int j = i + 1; j < segments.Count; j++) + { + var c = segments[j].GetVertex(0); + var d = segments[j].GetVertex(1); + + double o1 = predicates.CounterClockwise(a, b, c), o2 = predicates.CounterClockwise(a, b, d); + double o3 = predicates.CounterClockwise(c, d, a), o4 = predicates.CounterClockwise(c, d, b); + + bool cross = o1 * o2 < 0 && o3 * o4 < 0; + Assert.That(cross, Is.False, $"segments {i} and {j} cross"); + } + + // No vertex lies in the interior of a segment. + foreach (var p in poly.Points) + { + if (p.X == a.X && p.Y == a.Y || p.X == b.X && p.Y == b.Y) continue; + + bool between = Math.Min(a.X, b.X) <= p.X && p.X <= Math.Max(a.X, b.X) && + Math.Min(a.Y, b.Y) <= p.Y && p.Y <= Math.Max(a.Y, b.Y); + + Assert.That(between && predicates.CounterClockwise(a, b, p) == 0, Is.False, "vertex on segment"); + } + } + } + + private static Polygon RandomSegments(int seed, int count, double size) + { + var random = new Random(seed); + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, size), false); + + for (int i = 0; i < count; i++) + { + poly.Add(new Segment( + new Vertex(size * random.NextDouble(), size * random.NextDouble()), + new Vertex(size * random.NextDouble(), size * random.NextDouble())), true); + } + + return poly; + } + } +} diff --git a/src/Triangle.Tests/Robustness/TerrainSimplifierTest.cs b/src/Triangle.Tests/Robustness/TerrainSimplifierTest.cs new file mode 100644 index 0000000..7c716b9 --- /dev/null +++ b/src/Triangle.Tests/Robustness/TerrainSimplifierTest.cs @@ -0,0 +1,182 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tools; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// TIN simplification (greedy insertion): select a subset of terrain points such that the + /// triangulation of the subset approximates all points within a vertical error bound. + /// + public class TerrainSimplifierTest + { + private static (List, List) Grid(int n, Func f) + { + var points = new List(); + var heights = new List(); + + for (int i = 0; i < n; i++) + { + for (int j = 0; j < n; j++) + { + points.Add(new Vertex(i, j)); + heights.Add(f(i, j)); + } + } + + return (points, heights); + } + + private static double Hills(double x, double y) => + 3 * Math.Sin(x / 9.0) * Math.Cos(y / 7.0) + 0.02 * x + Math.Exp(-((x - 40) * (x - 40) + (y - 30) * (y - 30)) / 50.0); + + /// + /// Maximum vertical error of all points with respect to the (constrained) Delaunay + /// triangulation of the selected points (brute force point location). + /// + private static double MaxError(List points, List heights, IList selected, IPolygon constraints = null) + { + var poly = new Polygon(); + var z = new Dictionary<(double, double), double>(); + + foreach (int i in selected) + { + poly.Add(new Vertex(points[i].X, points[i].Y)); + z[(points[i].X, points[i].Y)] = heights[i]; + } + + if (constraints != null) + { + foreach (var s in constraints.Segments) + { + poly.Add(new Segment(new Vertex(s.GetVertex(0).X, s.GetVertex(0).Y), new Vertex(s.GetVertex(1).X, s.GetVertex(1).Y)), false); + } + } + + var mesh = (Mesh)new GenericMesher().Triangulate(poly, new ConstraintOptions { Convex = true }); + var triangles = mesh.Triangles.ToList(); + + double max = 0; + + for (int k = 0; k < points.Count; k++) + { + var p = points[k]; + double best = double.MaxValue; + + foreach (var t in triangles) + { + var a = t.GetVertex(0); var b = t.GetVertex(1); var c = t.GetVertex(2); + double det = (b.X - a.X) * (c.Y - a.Y) - (c.X - a.X) * (b.Y - a.Y); + double l1 = ((b.X - p.X) * (c.Y - p.Y) - (c.X - p.X) * (b.Y - p.Y)) / det; + double l2 = ((c.X - p.X) * (a.Y - p.Y) - (a.X - p.X) * (c.Y - p.Y)) / det; + double l3 = 1 - l1 - l2; + + if (l1 >= -1e-12 && l2 >= -1e-12 && l3 >= -1e-12) + { + double h = l1 * z[(a.X, a.Y)] + l2 * z[(b.X, b.Y)] + l3 * z[(c.X, c.Y)]; + best = Math.Abs(h - heights[k]); + break; + } + } + + Assert.That(best, Is.Not.EqualTo(double.MaxValue), $"point {k} not covered"); + max = Math.Max(max, best); + } + + return max; + } + + [Test] + public void PlaneNeedsOnlyTheCorners() + { + var (points, heights) = Grid(30, (x, y) => 2 * x - 0.5 * y + 100); + + var selected = TerrainSimplifier.Select(points, heights, 0.01); + + Assert.That(selected.Count, Is.EqualTo(4)); + } + + [TestCase(0.5)] + [TestCase(0.1)] + [TestCase(0.02)] + public void ErrorBoundHolds(double maxError) + { + var (points, heights) = Grid(60, Hills); + + var selected = TerrainSimplifier.Select(points, heights, maxError); + + Assert.That(selected.Distinct().Count(), Is.EqualTo(selected.Count)); + Assert.That(MaxError(points, heights, selected), Is.LessThanOrEqualTo(maxError * (1 + 1e-9))); + // The test surface is strongly curved: at 0.02, about half of the points are needed. + Assert.That(selected.Count, Is.LessThan(points.Count * 0.6)); + } + + [Test] + public void SmallerErrorSelectsMorePoints() + { + var (points, heights) = Grid(60, Hills); + + int coarse = TerrainSimplifier.Select(points, heights, 0.2).Count; + int fine = TerrainSimplifier.Select(points, heights, 0.02).Count; + + Assert.That(fine, Is.GreaterThan(coarse)); + } + + [Test] + public void BreakLinesAreRespected() + { + // A ridge along a break line: the selection is computed for the constrained + // triangulation, and the break line vertices are part of the selection. + var (points, heights) = Grid(40, (x, y) => -Math.Abs(x - y) * 0.5); + + var constraints = new Polygon(); + var a = new Vertex(0, 0); + var b = new Vertex(39, 39); + constraints.Add(new Segment(a, b), true); + + var selected = TerrainSimplifier.Select(points, heights, 0.01, constraints); + + Assert.That(selected.Contains(0), Is.True); + Assert.That(selected.Contains(points.Count - 1), Is.True); + Assert.That(MaxError(points, heights, selected, constraints), Is.LessThanOrEqualTo(0.01 * (1 + 1e-9))); + + // The surface is planar on both sides of the ridge: only the corners are needed. + Assert.That(selected.Count, Is.EqualTo(4)); + } + + [Test] + public void DegenerateInputReturnsAllPoints() + { + var points = new List { new Vertex(0, 0), new Vertex(1, 1), new Vertex(2, 2) }; + var heights = new List { 0, 1, 5 }; + + Assert.That(TerrainSimplifier.Select(points, heights, 0.1), Is.EquivalentTo(new[] { 0, 1, 2 })); + } + + [Test] + public void ArgumentsAreValidated() + { + var (points, heights) = Grid(5, (x, y) => 0); + + Assert.Throws(() => TerrainSimplifier.Select(points, heights.Take(3).ToList(), 0.1)); + Assert.Throws(() => TerrainSimplifier.Select(points, heights, -1)); + } + + [Test] + public void LargeGridIsFast() + { + var (points, heights) = Grid(400, Hills); + + var watch = System.Diagnostics.Stopwatch.StartNew(); + var selected = TerrainSimplifier.Select(points, heights, 0.05); + watch.Stop(); + + Assert.That(selected.Count, Is.LessThan(points.Count / 4)); + Assert.That(watch.Elapsed.TotalSeconds, Is.LessThan(60)); + } + } +} diff --git a/src/Triangle.Tests/Robustness/WedgeMergeTest.cs b/src/Triangle.Tests/Robustness/WedgeMergeTest.cs new file mode 100644 index 0000000..2fa469f --- /dev/null +++ b/src/Triangle.Tests/Robustness/WedgeMergeTest.cs @@ -0,0 +1,115 @@ +using NUnit.Framework; +using System; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Merging of nearly coincident lines: a segment which runs along another segment at a + /// distance below the wedge tolerance (e.g. a building wall digitized slightly off the + /// parcel boundary) forms a thin wedge, which refinement can't fix (tiny input angle). + /// + public class WedgeMergeTest + { + private static Polygon Wedge(double offset) + { + // Parcel boundary (0,0)-(20,0) and a wall starting on it, ending 'offset' above it. + var poly = new Polygon(); + poly.Add(TestData.Square(0, -10, 20), false); + poly.Add(new Segment(new Vertex(5, 0), new Vertex(15, offset)), true); + poly.Add(new Segment(new Vertex(15, offset), new Vertex(15, 5)), true); + poly.Add(new Segment(new Vertex(0, 0), new Vertex(20, 0)), true); + + return poly; + } + + private static int BadTriangles(IMesh mesh, double angle) => + mesh.Triangles.Count(t => Characterization.MeshInvariants.MinimumAngle(t) < angle - 0.01); + + [Test] + public void ThinWedgeIsMerged() + { + var poly = Wedge(0.025); + + var options = new ConstraintOptions { SnapTolerance = 0.01, WedgeTolerance = 0.03 }; + var mesh = new GenericMesher().Triangulate(poly, options, new QualityOptions { MinimumAngle = 30 }); + + MeshAssert.IsValid(mesh); + + // The wall now runs along the boundary: no small input angle remains. + Assert.That(BadTriangles(mesh, 30), Is.EqualTo(0)); + Assert.That(mesh.Vertices.Any(v => v.X == 15 && v.Y == 0.025), Is.True); + } + + [Test] + public void WithoutWedgeToleranceTheWedgeRemains() + { + var poly = Wedge(0.025); + + var mesh = new GenericMesher().Triangulate(poly, new ConstraintOptions { SnapTolerance = 0.01 }, + new QualityOptions { MinimumAngle = 30 }); + + MeshAssert.IsValid(mesh); + + Assert.That(BadTriangles(mesh, 30), Is.GreaterThan(0), "test case isn't critical"); + } + + [Test] + public void WideAnglesAreNotMerged() + { + // A short segment at a large angle within the wedge tolerance is a small feature, + // not a nearly coincident line: it is kept. + var poly = new Polygon(); + poly.Add(TestData.Square(0, -10, 20), false); + poly.Add(new Segment(new Vertex(0, 0), new Vertex(20, 0)), true); + poly.Add(new Segment(new Vertex(5, 0), new Vertex(5.02, 0.025)), true); + poly.Add(new Segment(new Vertex(5.02, 0.025), new Vertex(8, 5)), true); + + var noded = SegmentNoder.Node(poly, new RobustPredicates(), out _, minTolerance: 0.01, wedgeTolerance: 0.03); + + // No segment was bent through (5.02, 0.025). + Assert.That(noded.Segments.Count(s => s.GetVertex(0).X == 5.02 || s.GetVertex(1).X == 5.02), Is.EqualTo(2)); + } + + [Test] + public void FarSegmentsAreNotMerged() + { + var poly = Wedge(0.05); + + var noded = SegmentNoder.Node(poly, new RobustPredicates(), out _, minTolerance: 0.01, wedgeTolerance: 0.03); + + // The boundary isn't bent through the end of the wall. + Assert.That(noded.Segments.Count(s => s.GetVertex(0).Y == 0.05 || s.GetVertex(1).Y == 0.05), Is.EqualTo(2)); + } + + [Test] + public void WedgeChainsAreMerged() + { + // A polyline drifting slowly away from the boundary (all vertices within the + // wedge tolerance) is merged completely. + var poly = new Polygon(); + poly.Add(TestData.Square(0, -10, 20), false); + poly.Add(new Segment(new Vertex(0, 0), new Vertex(20, 0)), true); + + Vertex prev = new Vertex(2, 0); + + for (int i = 1; i <= 8; i++) + { + var v = new Vertex(2 + 2 * i, 0.003 * i); + poly.Add(new Segment(prev, v), true); + prev = v; + } + + poly.Add(new Segment(prev, new Vertex(18, 6)), true); + + var mesh = new GenericMesher().Triangulate(poly, new ConstraintOptions { SnapTolerance = 0.01, WedgeTolerance = 0.03 }, + new QualityOptions { MinimumAngle = 30 }); + + MeshAssert.IsValid(mesh); + + Assert.That(BadTriangles(mesh, 30), Is.EqualTo(0)); + } + } +} diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 92a3067..916b5a6 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -24,7 +24,7 @@ public class Mesh : IMesh { #region Variables - private readonly IPredicates predicates; + internal readonly IPredicates predicates; private readonly Log logger = Log.Instance; diff --git a/src/Triangle/Meshing/ConstraintOptions.cs b/src/Triangle/Meshing/ConstraintOptions.cs index 25f4cc4..b77fa4b 100644 --- a/src/Triangle/Meshing/ConstraintOptions.cs +++ b/src/Triangle/Meshing/ConstraintOptions.cs @@ -60,6 +60,33 @@ public class ConstraintOptions /// public double SnapTolerance { get; set; } + /// + /// Gets or sets the distance up to which nearly coincident segments are merged + /// (default = 0, off). + /// + /// + /// A segment which starts at another segment and runs along it at a small angle (less + /// than ), e.g. a wall digitized slightly off + /// a parcel boundary, forms a thin wedge with a tiny input angle which refinement can't + /// fix. If the other end of the segment is closer than the wedge tolerance to the + /// segment it runs along, the two are merged. Unlike a larger , + /// this doesn't affect vertices which are close to a segment in other configurations. + /// + public double WedgeTolerance { get; set; } + + /// + /// Gets or sets the size of the grid all vertices of the mesh are rounded to + /// (default = 0, no rounding). + /// + /// + /// Set this to the precision of the output (e.g. 0.01 if coordinates in meters are + /// written with two decimal places). Rounding the coordinates of a mesh afterwards can + /// flip or flatten triangles near nearly coincident lines. With a grid, the input is + /// snap rounded (see ) and the Steiner points are + /// moved to the grid where this doesn't flip a triangle (see ). + /// + public double GridSize { get; set; } + /// /// Gets or sets a filter deciding whether a segment may be split during mesh /// refinement (in addition to ). If null (default), diff --git a/src/Triangle/Meshing/GenericMesher.cs b/src/Triangle/Meshing/GenericMesher.cs index 5d35050..a0d8d8e 100644 --- a/src/Triangle/Meshing/GenericMesher.cs +++ b/src/Triangle/Meshing/GenericMesher.cs @@ -114,10 +114,21 @@ public IMesh Triangulate(IPolygon polygon, QualityOptions quality, CancellationT /// The mesh. public IMesh Triangulate(IPolygon polygon, ConstraintOptions options, QualityOptions quality, CancellationToken cancellationToken = default) { + double grid = options?.GridSize ?? 0.0; + if (options?.ResolveIntersections ?? true) { // Split intersecting segments in advance. - polygon = SegmentNoder.Node(polygon, config.Predicates(), minTolerance: options?.SnapTolerance ?? 0.0); + if (grid <= 0.0 || options.SnapTolerance > 0.0 || options.WedgeTolerance > 0.0) + { + polygon = SegmentNoder.Node(polygon, config.Predicates(), out _, minTolerance: options?.SnapTolerance ?? 0.0, + wedgeTolerance: options?.WedgeTolerance ?? 0.0); + } + + if (grid > 0.0) + { + polygon = SegmentNoder.SnapRound(polygon, config.Predicates(), grid); + } } var mesh = (Mesh)triangulator.Triangulate(polygon.Points, config); @@ -127,12 +138,20 @@ public IMesh Triangulate(IPolygon polygon, ConstraintOptions options, QualityOpt mesh.SetQualityMesher(qmesher); + qmesher.GridSize = grid; + // Insert segments. cmesher.Apply(polygon, options); // Refine mesh. qmesher.Apply(quality, options?.ConformingDelaunay ?? false, cancellationToken); + if (grid > 0.0) + { + // Move the Steiner points to the grid. + GridSnapper.SnapVertices(mesh, grid); + } + return mesh; } diff --git a/src/Triangle/Meshing/GridSnapper.cs b/src/Triangle/Meshing/GridSnapper.cs new file mode 100644 index 0000000..7642e0b --- /dev/null +++ b/src/Triangle/Meshing/GridSnapper.cs @@ -0,0 +1,174 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET Copyright (c) 2012-2022 Christian Woltering +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Meshing +{ + using System; + using System.Collections.Generic; + using TriangleNet.Geometry; + using TriangleNet.Topology; + + /// + /// Rounding of mesh vertices to a grid (e.g. the precision of the output format). + /// + /// + /// Rounding the coordinates of a mesh when writing it (e.g. to centimeters) can flip or + /// flatten triangles near nearly coincident lines. Use + /// (snap rounding of the input with and rounding of + /// the Steiner points with ) to get a mesh with all vertices on + /// the grid instead. + /// + public static class GridSnapper + { + /// + /// Round a coordinate to the grid. + /// + /// The coordinate. + /// The grid size. + /// The nearest grid coordinate. + /// + /// For decimal grids (0.1, 0.01, ...) the result is the same as rounding to decimal + /// places (), i.e. the double nearest to the + /// decimal value, which isn't always the case for Math.Round(x / g) * g. + /// + public static double Round(double x, double gridSize) + { + double k = 1.0 / gridSize; + double n = Math.Round(k); + + if (gridSize < 1.0 && Math.Abs(k - n) <= 1e-9 * k) + { + return Math.Round(x * n) / n; + } + + return Math.Round(x / gridSize) * gridSize; + } + + /// + /// Move all vertices of the mesh to the nearest grid point, if this doesn't flip or + /// flatten a triangle (otherwise try the other corners of the grid cell). + /// + /// The mesh. + /// The grid size. + /// The number of vertices which couldn't be moved to the grid. + /// + /// Vertices on segments are moved, too (the segments bend slightly). The mesh may no + /// longer be exactly (constrained) Delaunay, and the angles change slightly. + /// + public static int SnapVertices(IMesh mesh, double gridSize) + { + var m = (Mesh)mesh; + + if (!(gridSize > 0.0) || double.IsInfinity(gridSize)) + { + throw new ArgumentException("Grid size must be positive.", nameof(gridSize)); + } + + var predicates = m.predicates; + + // The triangles around each vertex. + var star = new Dictionary>(); + + foreach (var t in m.triangles) + { + for (int i = 0; i < 3; i++) + { + var v = t.vertices[i]; + + if (!star.TryGetValue(v.hash, out var list)) + { + list = new List(6); + star.Add(v.hash, list); + } + + list.Add(t); + } + } + + int failed = 0; + + foreach (var v in m.vertices.Values) + { + if (v.type == VertexType.UndeadVertex) + { + continue; + } + + double rx = Round(v.x, gridSize); + double ry = Round(v.y, gridSize); + + if (rx == v.x && ry == v.y) + { + continue; + } + + if (!star.TryGetValue(v.hash, out var triangles)) + { + // Not part of the mesh. + continue; + } + + if (!TryMove(v, rx, ry, triangles, predicates) && !TryCellCorners(v, rx, ry, gridSize, triangles, predicates)) + { + failed++; + } + } + + return failed; + } + + private static bool TryCellCorners(Vertex v, double rx, double ry, double gridSize, + List triangles, IPredicates predicates) + { + // The other corners of the grid cell containing the vertex, nearest first. + double ox = Round(v.x < rx ? rx - gridSize : rx + gridSize, gridSize); + double oy = Round(v.y < ry ? ry - gridSize : ry + gridSize, gridSize); + + var candidates = new[] { (ox, ry), (rx, oy), (ox, oy) }; + + Array.Sort(candidates, (p, q) => Distance2(v, p).CompareTo(Distance2(v, q))); + + foreach (var (x, y) in candidates) + { + if (TryMove(v, x, y, triangles, predicates)) + { + return true; + } + } + + return false; + } + + private static double Distance2(Vertex v, (double x, double y) p) + { + double dx = p.x - v.x, dy = p.y - v.y; + return dx * dx + dy * dy; + } + + private static bool TryMove(Vertex v, double x, double y, List triangles, IPredicates predicates) + { + double x0 = v.x, y0 = v.y; + + v.x = x; + v.y = y; + + // If all triangles of the star stay positively oriented, the new location lies in + // the kernel of the star polygon, so it can't coincide with another vertex. + foreach (var t in triangles) + { + if (predicates.CounterClockwise(t.vertices[0], t.vertices[1], t.vertices[2]) <= 0.0) + { + v.x = x0; + v.y = y0; + + return false; + } + } + + return true; + } + } +} diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 8706a57..c6c43a5 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -373,6 +373,14 @@ public void TestTriangle(ref Otri testtri) } // Check whether the angle is smaller than permitted. + if (gridSize > 0.0 && minedge < 4.0 * gridSize * gridSize) + { + // Triangles with edges shorter than two grid cells can't be improved by + // Steiner points on the grid (rounding them changes the angles too much, and + // refinement would cascade down to the grid all around small input angles). + return; + } + if ((angle > behavior.goodAngle) || (maxangle < behavior.maxGoodAngle && behavior.MaxAngle != 0.0)) { // Use the rules of Miller, Pav, and Walkington to decide that certain @@ -430,8 +438,10 @@ public void TestTriangle(ref Otri testtri) dist2 = ((base2.x - joinvertex.x) * (base2.x - joinvertex.x) + (base2.y - joinvertex.y) * (base2.y - joinvertex.y)); // If the two distances are equal, don't split the triangle. - if ((dist1 < 1.001 * dist2) && (dist1 > 0.999 * dist2)) + if (((dist1 < 1.001 * dist2) && (dist1 > 0.999 * dist2)) || + (gridSize > 0.0 && Math.Abs(Math.Sqrt(dist1) - Math.Sqrt(dist2)) <= 2.0 * gridSize)) { + // With a grid, the vertices on the shells are rounded. // Return now to avoid enqueueing the bad triangle. return; } @@ -642,7 +652,15 @@ private void SplitEncSegs(bool triflaws) #if USE_Z newvertex.z = eorg.z + split * (edest.z - eorg.z); #endif - if (!Behavior.NoExact) + if (GridSize > 0.0) + { + // Split vertices on the output grid (the subsegments bend slightly). + // Subsegments shorter than the grid can't be split: the rounded + // location coincides with an endpoint or isn't a valid split (below). + newvertex.x = GridSnapper.Round(newvertex.x, GridSize); + newvertex.y = GridSnapper.Round(newvertex.y, GridSize); + } + else if (!Behavior.NoExact) { // Roundoff in the above calculation may yield a 'newvertex' // that is not precisely collinear with 'eorg' and 'edest'. @@ -794,6 +812,14 @@ private void SplitTriangle(BadTriangle badtri) newloc = predicates.FindCircumcenter(borg, bdest, bapex, ref xi, ref eta, behavior.offconstant); } + if (GridSize > 0.0) + { + // Steiner points on the output grid. If the triangle is smaller than + // the grid, the rounded location may coincide with one of its vertices + // (the triangle can't be refined then, see below). + newloc = new Point(GridSnapper.Round(newloc.x, GridSize), GridSnapper.Round(newloc.y, GridSize)); + } + // Check whether the new vertex lies on a triangle vertex. if (((newloc.x == borg.x) && (newloc.y == borg.y)) || ((newloc.x == bdest.x) && (newloc.y == bdest.y)) || @@ -824,9 +850,9 @@ private void SplitTriangle(BadTriangle badtri) // circumcenter lies outside the org-dest edge, and eta is // negative. Roundoff error might prevent eta from being // negative when it should be, so I test eta against xi.) - if (useAcute) + if (useAcute || GridSize > 0.0) { - // The aCute location isn't necessarily the circumcenter and might + // The aCute location (or the rounded location) isn't necessarily the circumcenter and might // lie outside the triangle, so xi and eta can't be used. Point // location requires the new vertex to lie to the left of the edge. for (int i = 0; i < 2 && predicates.CounterClockwise(badotri.Org(), badotri.Dest(), newloc) <= 0.0; i++) @@ -1244,6 +1270,18 @@ internal bool CanSplit(SubSegment seg) return behavior.CanSplitSegment == null || behavior.CanSplitSegment(seg); } + /// + /// Size of the grid Steiner points are rounded to (0 = no rounding). + /// + internal double GridSize + { + get { return gridSize; } + set { gridSize = value; newLocation.GridSize = value; } + } + + private double gridSize; + + // Set if CanSplit refused a subsegment because of the precision limit (reset by // SplitTriangle). Only subsegments which must not be split by the user's choice justify // inserting a vertex that encroaches upon them. diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index 40d2d1a..09bf5d1 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -60,6 +60,12 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte return Node(polygon, predicates, out _, maxIterations, minTolerance); } + /// + /// Maximum angle (in degrees) of a wedge between two segments which is merged + /// (see the wedgeTolerance parameter of ). + /// + public const double MaxWedgeAngle = 10.0; + /// /// Split all segments of the polygon at their intersections and at vertices lying /// (almost) on the segments. @@ -71,6 +77,12 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte /// Minimum absolute snap tolerance (0 = automatic). Use this to /// merge features below the precision of the data, e.g. 0.01 for coordinates in meters /// which are only accurate to a centimeter. + /// Distance up to which nearly coincident segments are + /// merged (0 = off): a vertex v is inserted into a segment (a, b), if its distance to the + /// segment is at most the wedge tolerance, and v is connected to a or b by a segment which + /// forms an angle of less than with (a, b). Such thin wedges + /// (e.g. a wall digitized slightly off a parcel boundary) have tiny input angles which + /// refinement can't fix. /// The input polygon, if nothing had to be changed, otherwise a new polygon. /// /// If noding doesn't converge (e.g. for many nearly coincident segments, where rounded @@ -78,7 +90,8 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, int maxIte /// tolerance (up to ), like the snapping noder of GEOS. /// /// Noding doesn't converge. - public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double tolerance, int maxIterations = 10, double minTolerance = 0.0) + public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double tolerance, int maxIterations = 10, + double minTolerance = 0.0, double wedgeTolerance = 0.0) { tolerance = 0.0; @@ -109,7 +122,7 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double { tolerance = t; - if (TryNode(polygon, predicates, tolerance, maxIterations, maxNewPoints, out var result)) + if (TryNode(polygon, predicates, tolerance, wedgeTolerance, maxIterations, maxNewPoints, out var result)) { return result; } @@ -119,7 +132,273 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double "Consider cleaning the input (e.g. snapping it to a grid)."); } - private static bool TryNode(IPolygon polygon, IPredicates predicates, double tolerance, + /// + /// Snap rounding: round all vertices to the grid and split all segments at their + /// intersections (rounded to the grid) and at vertices whose grid cell (hot pixel) + /// they pass through. + /// + /// The input polygon (won't be modified). + /// The predicates used to detect crossings. + /// The grid size, e.g. 0.01 for coordinates in meters which + /// are written with two decimal places. + /// Maximum number of noding iterations. + /// The noded polygon with all vertices on the grid. + /// + /// Since the rounded intersection points don't lie exactly on the segments, the + /// segments are bent slightly (by at most half a grid cell). Afterwards, no two segments + /// cross and every vertex has a distance of at least half a grid cell to every segment + /// not ending in it (iterated snap rounding, Hobby 1999, Halperin and Packer 2002). + /// + /// If snap rounding doesn't converge, the result of + /// with the grid size as minimum tolerance is returned (not all vertices are on the grid then). + /// + public static IPolygon SnapRound(IPolygon polygon, IPredicates predicates, double gridSize, int maxIterations = 20) + { + if (!(gridSize > 0.0) || double.IsInfinity(gridSize)) + { + throw new ArgumentException("Grid size must be positive.", nameof(gridSize)); + } + + if (!polygon.Points.All(IsFinite)) + { + return polygon; + } + + int maxNewPoints = 50 * (polygon.Points.Count + polygon.Segments.Count) + 1000; + + // Vertices by their (rounded) location. + var index = new Dictionary<(double, double), Vertex>(); + var vertices = new List(); + + // Input vertices which were moved or merged. + var replaced = new Dictionary(new ReferenceComparer()); + + var points = new List(polygon.Points.Count); + var newPoints = new List(); + + Vertex Find(double x, double y, out (double, double) key) + { + key = (GridSnapper.Round(x, gridSize), GridSnapper.Round(y, gridSize)); + return index.TryGetValue(key, out var v) ? v : null; + } + + Vertex Snap(Vertex p) + { + if (replaced.TryGetValue(p, out var r)) + { + return r; + } + + var v = Find(p.x, p.y, out var key); + + if (v == null) + { + if (key.Item1 == p.x && key.Item2 == p.y) + { + v = p; + } + else + { + v = new Vertex(key.Item1, key.Item2, p.label) { id = p.id }; +#if USE_ATTRIBS + v.attributes = p.attributes; +#endif + replaced[p] = v; + } + + index.Add(key, v); + vertices.Add(v); + points.Add(v); + } + else if (!ReferenceEquals(v, p)) + { + replaced[p] = v; + + if (v.label == 0 && p.label != 0) + { + v.label = p.label; + } + } + + return v; + } + + foreach (var p in polygon.Points) + { + Snap(p); + } + + var segments = new List(polygon.Segments.Count); + var vanished = new List<(Vertex, Vertex)>(); + + foreach (var s in polygon.Segments) + { + var a = s.GetVertex(0); + var b = s.GetVertex(1); + var ra = Snap(a); + var rb = Snap(b); + + if (SameLocation(ra, rb)) + { + vanished.Add((a, b)); + } + else if (ReferenceEquals(ra, a) && ReferenceEquals(rb, b)) + { + segments.Add(s); + } + else + { + segments.Add(new Segment(ra, rb, s.Label)); + } + } + + bool changed = replaced.Count > 0 || vanished.Count > 0; + bool converged = false; + + var retired = new HashSet<(Vertex, Vertex)>(new EdgeComparer()); + + double half = 0.5 * gridSize; + + for (int iteration = 0; iteration < maxIterations && newPoints.Count <= maxNewPoints; iteration++) + { + var splits = new Dictionary>(); + + foreach (var (i, j) in FindCrossings(segments, predicates)) + { + var a = segments[i].GetVertex(0); + var b = segments[i].GetVertex(1); + var c = segments[j].GetVertex(0); + var d = segments[j].GetVertex(1); + + double abx = b.x - a.x, aby = b.y - a.y; + double cdx = d.x - c.x, cdy = d.y - c.y; + + double denom = abx * cdy - aby * cdx; + + if (denom == 0.0) + { + continue; + } + + double ts = Math.Max(0.0, Math.Min(1.0, ((c.x - a.x) * cdy - (c.y - a.y) * cdx) / denom)); + + var v = Find(a.x + ts * abx, a.y + ts * aby, out var key); + + if (v == null) + { + v = new Vertex(key.Item1, key.Item2, segments[i].Label); + index.Add(key, v); + vertices.Add(v); + newPoints.Add(v); + } + + if (!SameLocation(v, a) && !SameLocation(v, b)) + { + AddSplit(splits, i, Parameter(a, b, v), v); + } + + if (!SameLocation(v, c) && !SameLocation(v, d)) + { + AddSplit(splits, j, Parameter(c, d, v), v); + } + } + + if (splits.Count == 0) + { + AddHotPixels(segments, vertices, half, retired, splits); + } + + if (splits.Count == 0) + { + converged = true; + break; + } + + foreach (var i in splits.Keys) + { + retired.Add((segments[i].GetVertex(0), segments[i].GetVertex(1))); + } + + segments = Split(segments, splits); + changed = true; + } + + if (!converged) + { + return Node(polygon, predicates, minTolerance: gridSize); + } + + if (!changed) + { + return polygon; + } + + var noded = new Polygon(points.Count + newPoints.Count) + { + HasPointMarkers = polygon.HasPointMarkers, + HasSegmentMarkers = polygon.HasSegmentMarkers + }; + + int id = polygon.Points.Count == 0 ? 0 : polygon.Points.Max(p => p.id); + + foreach (var v in newPoints) + { + v.id = ++id; + } + + noded.Points.AddRange(points); + noded.Points.AddRange(newPoints); + noded.Segments.AddRange(segments); + + bool Collapsed(Point p) => vanished.Any(e => DistanceToSegment(p, e.Item1, e.Item2) <= gridSize); + + noded.Holes.AddRange(polygon.Holes.Where(h => !Collapsed(h))); + noded.Regions.AddRange(polygon.Regions.Where(r => !Collapsed(r.Point))); + + return noded; + } + + /// + /// Find vertices whose grid cell (square of size 2 * half centered at the vertex) is + /// intersected by a segment not ending in the vertex. + /// + private static void AddHotPixels(List segments, ICollection vertices, + double half, HashSet<(Vertex, Vertex)> retired, Dictionary> splits) + { + var grid = new VertexGrid(vertices); + + for (int i = 0; i < segments.Count; i++) + { + var a = segments[i].GetVertex(0); + var b = segments[i].GetVertex(1); + + double dx = b.x - a.x, dy = b.y - a.y; + + // A square with center v and half size h intersects the line through a and b, + // if the distance of v to the line, measured along the axes, is at most h. + double reach = half * (Math.Abs(dx) + Math.Abs(dy)); + + foreach (var v in grid.Query( + Math.Min(a.x, b.x) - half, Math.Min(a.y, b.y) - half, + Math.Max(a.x, b.x) + half, Math.Max(a.y, b.y) + half)) + { + if (SameLocation(v, a) || SameLocation(v, b)) + { + continue; + } + + double t = Parameter(a, b, v); + + if (t > 0.0 && t < 1.0 && Math.Abs(dx * (v.y - a.y) - dy * (v.x - a.x)) <= reach && + !retired.Contains((a, v)) && !retired.Contains((v, b))) + { + AddSplit(splits, i, t, v); + } + } + } + } + + private static bool TryNode(IPolygon polygon, IPredicates predicates, double tolerance, double wedgeTolerance, int maxIterations, int maxNewPoints, out IPolygon result) { result = polygon; @@ -179,6 +458,11 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol AddNearbyVertices(segments, vertices.All, tolerance, retired, splits); } + if (splits.Count == 0 && wedgeTolerance > tolerance) + { + AddWedgeVertices(segments, vertices.All, tolerance, wedgeTolerance, retired, splits); + } + if (splits.Count == 0) { converged = true; @@ -522,6 +806,89 @@ private static void AddNearbyVertices(List segments, ICollection + /// Find vertices closer than the wedge tolerance to a segment (a, b), which are connected + /// to a or b by a segment forming a small angle with (a, b). + /// + private static void AddWedgeVertices(List segments, ICollection vertices, + double tolerance, double wedgeTolerance, HashSet<(Vertex, Vertex)> retired, + Dictionary> splits) + { + var neighbors = new Dictionary>(new ReferenceComparer()); + + void Connect(Vertex p, Vertex q) + { + if (!neighbors.TryGetValue(p, out var list)) + { + list = new List(4); + neighbors.Add(p, list); + } + + list.Add(q); + } + + foreach (var s in segments) + { + Connect(s.GetVertex(0), s.GetVertex(1)); + Connect(s.GetVertex(1), s.GetVertex(0)); + } + + double cosMax = Math.Cos(MaxWedgeAngle * Math.PI / 180.0); + + // Is v connected to the apex by a segment forming a small angle with (apex, other)? + bool IsWedge(Vertex v, Vertex apex, Vertex other) + { + if (!neighbors.TryGetValue(v, out var list) || !list.Any(w => SameLocation(w, apex))) + { + return false; + } + + double ux = v.x - apex.x, uy = v.y - apex.y; + double vx = other.x - apex.x, vy = other.y - apex.y; + + double dot = ux * vx + uy * vy; + + return dot > 0.0 && dot * dot >= cosMax * cosMax * (ux * ux + uy * uy) * (vx * vx + vy * vy); + } + + var grid = new VertexGrid(vertices); + + for (int i = 0; i < segments.Count; i++) + { + var a = segments[i].GetVertex(0); + var b = segments[i].GetVertex(1); + + double dx = b.x - a.x, dy = b.y - a.y; + double length = Math.Sqrt(dx * dx + dy * dy); + + if (length == 0.0) + { + continue; + } + + foreach (var v in grid.Query( + Math.Min(a.x, b.x) - wedgeTolerance, Math.Min(a.y, b.y) - wedgeTolerance, + Math.Max(a.x, b.x) + wedgeTolerance, Math.Max(a.y, b.y) + wedgeTolerance)) + { + if (SameLocation(v, a) || SameLocation(v, b) || + Distance(v, a) <= tolerance || Distance(v, b) <= tolerance) + { + continue; + } + + double distance = Math.Abs(dx * (v.y - a.y) - dy * (v.x - a.x)) / length; + double t = ((v.x - a.x) * dx + (v.y - a.y) * dy) / (length * length); + + if (distance <= wedgeTolerance && t > 0.0 && t < 1.0 && + (IsWedge(v, a, b) || IsWedge(v, b, a)) && + !retired.Contains((a, v)) && !retired.Contains((v, b))) + { + AddSplit(splits, i, t, v); + } + } + } + } + private static List Split(List segments, Dictionary> splits) { var result = new List(segments.Count + 2 * splits.Count); diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index f17ff36..b7f9599 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -67,6 +67,21 @@ internal void MarkRelocated(Vertex v) relocatedVertices.Add(v); } + /// + /// Size of the grid Steiner points are rounded to (0 = no rounding). + /// + internal double GridSize { get; set; } + + /// + /// With a grid, vertices aren't relocated: the rounded position may coincide with the + /// old one, or inserting it may fail (the deleted vertex is lost then), so the same + /// vertex would be deleted and reinserted forever. + /// + private int CheckGridRelocation(int relocated) + { + return GridSize > 0.0 ? 0 : relocated; + } + // Work arrays for wegde intersection double[] petalx = new double[20]; double[] petaly = new double[20]; @@ -429,6 +444,7 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t //- RELOCATION (LOCAL SMOOTHING) -// // check for possible relocation of one of triangle's points relocated = DoSmoothing(delotri, torg, tdest, tapex, ref newloc); + relocated = CheckGridRelocation(relocated); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { @@ -1131,6 +1147,7 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, // RELOCATION (LOCAL SMOOTHING) // check for possible relocation of one of triangle's points relocated = DoSmoothing(delotri, torg, tdest, tapex, ref newloc); + relocated = CheckGridRelocation(relocated); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { diff --git a/src/Triangle/Tools/TerrainSimplifier.cs b/src/Triangle/Tools/TerrainSimplifier.cs new file mode 100644 index 0000000..3ac3266 --- /dev/null +++ b/src/Triangle/Tools/TerrainSimplifier.cs @@ -0,0 +1,833 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET Copyright (c) 2012-2022 Christian Woltering +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Tools +{ + using System; + using System.Collections.Generic; + using System.Linq; + using TriangleNet.Geometry; + using TriangleNet.Meshing; + using TriangleNet.Topology; + + /// + /// Simplification of terrain models (TIN): select a subset of the points of a dense + /// terrain model (e.g. a 1 m grid) such that the triangulation of the subset approximates + /// all points within a given vertical error. + /// + /// + /// Greedy insertion (Garland and Heckbert, "Fast polygonal approximation of terrains and + /// height fields", 1995): starting with the corners of the convex hull (and the vertices of + /// the break lines), the point with the largest error in each triangle is added, until all + /// errors are within the bound. Points are selected where the terrain is curved, flat areas + /// get large triangles. + /// + /// The selected points (together with the break lines) can then be meshed with quality + /// constraints. Heights of Steiner points should be interpolated from the dense model. + /// + public static class TerrainSimplifier + { + + /// + /// Select a subset of the points. + /// + /// The terrain points. + /// The heights of the points. + /// The maximum vertical error. + /// Optional break lines (segments). The error is computed + /// for the constrained triangulation, and points at segment vertices are always + /// selected. + /// The indices of the selected points (sorted). + public static List Select(IList points, IList heights, double maxError, + IPolygon constraints = null) + { + if (points.Count != heights.Count) + { + throw new ArgumentException("The number of heights doesn't match the number of points.", nameof(heights)); + } + + if (!(maxError >= 0.0) || double.IsInfinity(maxError)) + { + throw new ArgumentException("The maximum error must be non-negative.", nameof(maxError)); + } + + int n = points.Count; + + // Height of each location (the first point wins for duplicates). + var index = new Dictionary<(double, double), int>(n); + + for (int i = 0; i < n; i++) + { + var key = (points[i].x, points[i].y); + + if (!index.ContainsKey(key)) + { + index.Add(key, i); + } + } + + var predicates = RobustPredicates.Default; + + var selected = new HashSet(ConvexHullCorners(points, predicates)); + + if (selected.Count < 3) + { + // All points collinear: nothing to simplify. + return Enumerable.Range(0, n).ToList(); + } + + // Locations of constraint vertices without a point (interpolated lazily). + var extra = new Dictionary<(double, double), double>(); + Func dense = null; + + double Height(double x, double y) + { + if (index.TryGetValue((x, y), out int i)) + { + return heights[i]; + } + + if (!extra.TryGetValue((x, y), out double h)) + { + dense = dense ?? CreateInterpolation(points, heights); + h = dense(x, y); + extra.Add((x, y), h); + } + + return h; + } + + if (constraints != null) + { + foreach (var s in constraints.Segments) + { + for (int k = 0; k < 2; k++) + { + var v = s.GetVertex(k); + + if (index.TryGetValue((v.x, v.y), out int i)) + { + selected.Add(i); + } + } + } + } + + // Points in spatial order, which makes point location by walking fast. + var order = SpatialOrder(points); + + var rank = new int[n]; + + for (int k = 0; k < n; k++) + { + rank[order[k]] = k; + } + + // The unselected points in each triangle of the mesh. After inserting points, only + // the points in triangles which changed are located again. + var buckets = new Dictionary(); + var isSelected = new bool[n]; + + foreach (int i in selected) + { + isSelected[i] = true; + } + + var pending = order.Where(i => !isSelected[i]).ToList(); + + // Heights of the mesh vertices by their hash (NaN = not known yet). + var z = new List(); + + double Z(Vertex v) + { + while (z.Count <= v.hash) + { + z.Add(double.NaN); + } + + double h = z[v.hash]; + + if (double.IsNaN(h)) + { + z[v.hash] = h = Height(v.x, v.y); + } + + return h; + } + + var mesh = Triangulate(points, selected, constraints); + + var tri = default(Otri); + + var changed = new HashSet(); + var created = new List(); + var queue = new BucketQueue(); + + // Set if the mesh was built from scratch (no insertions since). + bool fresh = true; + + // Set after the first check with a triangulation built from scratch: the few + // remaining points are inserted at once (each check is expensive). + bool polishing = false; + + while (true) + { + tri.tri = mesh.triangles.First(); + tri.orient = 0; + + foreach (int i in pending) + { + var p = points[i]; + + var result = Locate(mesh, p, ref tri); + + if (result == LocateResult.Outside || tri.tri.id == Mesh.DUMMY) + { + // On the boundary (or outside due to snapping of the break lines). + tri.Sym(); + + if (tri.tri.id == Mesh.DUMMY) + { + tri.tri = mesh.triangles.First(); + continue; + } + } + + double error; + + if (result == LocateResult.OnVertex) + { + // Duplicate location: error with respect to the vertex height. + var v = tri.Org(); + error = Math.Abs(Z(v) - heights[i]); + } + else + { + error = Math.Abs(Interpolate(tri.tri, p.x, p.y, Z) - heights[i]); + } + + if (!buckets.TryGetValue(tri.tri, out var bucket)) + { + bucket = new Bucket(tri.tri); + buckets.Add(tri.tri, bucket); + created.Add(bucket); + } + + bucket.Points.Add(i); + + if (error > bucket.Error) + { + bucket.Error = error; + bucket.Worst = i; + } + } + + pending.Clear(); + + foreach (var bucket in created) + { + if (bucket.Error > maxError) + { + queue.Push(bucket); + } + } + + created.Clear(); + + double max = queue.Count > 0 ? queue.Peek().Error : 0.0; + + if (max <= maxError) + { + if (fresh) + { + break; + } + + // The Delaunay triangulation of grid points isn't unique (cocircular + // points), so the triangulation of the selected points built from scratch + // may differ from the incremental one: check all points again. + // Points in triangles which exist in both triangulations keep their errors. + mesh = Triangulate(points, selected, constraints); + z.Clear(); + fresh = true; + polishing = true; + + var unchanged = new Dictionary(buckets.Count); + + foreach (var bucket in buckets.Values) + { + unchanged[bucket.Key] = bucket; + } + + buckets.Clear(); + + foreach (var t in mesh.triangles) + { + var key = new TriangleKey(t); + + if (unchanged.TryGetValue(key, out var bucket)) + { + unchanged.Remove(key); + bucket.Triangle = t; + buckets.Add(t, bucket); + } + } + + foreach (var bucket in unchanged.Values) + { + queue.Remove(bucket); + pending.AddRange(bucket.Points.Where(i => !isSelected[i])); + } + + pending.Sort((i, j) => rank[i].CompareTo(rank[j])); + continue; + } + + fresh = false; + + // Insert the worst points first (closer to the result of strictly greedy + // insertion, which selects fewer points than inserting all at once). + double limit = polishing ? maxError : Math.Max(maxError, 0.5 * max); + + var insert = new List<(Triangle, int)>(); + + while (queue.Count > 0 && queue.Peek().Error >= limit) + { + var bucket = queue.Pop(); + insert.Add((bucket.Triangle, bucket.Worst)); + } + + insert.Sort((u, v) => rank[u.Item2].CompareTo(rank[v.Item2])); + + // Triangles changed by the insertions (all of them are in the star of a new + // vertex right after its insertion). + changed.Clear(); + + foreach (var (t, i) in insert) + { + selected.Add(i); + isSelected[i] = true; + + // The bucket triangle is the starting point of the search. + changed.Add(t); + tri.tri = t; + tri.orient = 0; + + if (Insert(mesh, points[i], ref tri)) + { + AddStar(tri, changed); + } + } + + // Points of triangles which changed are located again. + foreach (var t in changed) + { + if (buckets.TryGetValue(t, out var bucket) && + (Otri.IsDead(t) || isSelected[bucket.Worst] || !bucket.Key.Equals(new TriangleKey(t)))) + { + buckets.Remove(t); + queue.Remove(bucket); + pending.AddRange(bucket.Points.Where(i => !isSelected[i])); + } + } + + pending.Sort((i, j) => rank[i].CompareTo(rank[j])); + } + + var list = selected.ToList(); + list.Sort(); + + return list; + } + + private class Bucket + { + public Bucket(Triangle t) + { + Triangle = t; + Key = new TriangleKey(t); + } + + public Triangle Triangle; + public readonly TriangleKey Key; + + // Position in the queue (-1 = not queued). + public int Position = -1; + public readonly List Points = new List(); + public int Worst = -1; + public double Error = -1.0; + } + + /// + /// Max-heap of buckets by their worst error. + /// + private class BucketQueue + { + readonly List heap = new List(); + + public int Count => heap.Count; + + public Bucket Peek() => heap[0]; + + public void Clear() + { + foreach (var b in heap) + { + b.Position = -1; + } + + heap.Clear(); + } + + public void Push(Bucket b) + { + b.Position = heap.Count; + heap.Add(b); + Up(b.Position); + } + + public Bucket Pop() + { + var top = heap[0]; + RemoveAt(0); + return top; + } + + public void Remove(Bucket b) + { + if (b.Position >= 0) + { + RemoveAt(b.Position); + } + } + + private void RemoveAt(int i) + { + var b = heap[i]; + int last = heap.Count - 1; + + if (i != last) + { + Move(heap[last], i); + heap.RemoveAt(last); + Down(i); + Up(i); + } + else + { + heap.RemoveAt(last); + } + + b.Position = -1; + } + + private void Move(Bucket b, int i) + { + heap[i] = b; + b.Position = i; + } + + private void Up(int i) + { + var b = heap[i]; + + while (i > 0) + { + int parent = (i - 1) / 2; + + if (heap[parent].Error >= b.Error) + { + break; + } + + Move(heap[parent], i); + i = parent; + } + + Move(b, i); + } + + private void Down(int i) + { + if (i >= heap.Count) + { + return; + } + + var b = heap[i]; + int n = heap.Count; + + while (true) + { + int child = 2 * i + 1; + + if (child >= n) + { + break; + } + + if (child + 1 < n && heap[child + 1].Error > heap[child].Error) + { + child++; + } + + if (heap[child].Error <= b.Error) + { + break; + } + + Move(heap[child], i); + i = child; + } + + Move(b, i); + } + } + + /// + /// Identifies a triangle by the locations of its vertices (independent of the mesh). + /// + private readonly struct TriangleKey : IEquatable + { + readonly double x0, y0, x1, y1, x2, y2; + + public TriangleKey(Triangle t) + { + // Rotate the (counterclockwise) vertices such that the smallest comes first. + var a = t.vertices[0]; + var b = t.vertices[1]; + var c = t.vertices[2]; + + if (Less(b, a) && Less(b, c)) + { + (a, b, c) = (b, c, a); + } + else if (Less(c, a) && Less(c, b)) + { + (a, b, c) = (c, a, b); + } + + x0 = a.x; y0 = a.y; x1 = b.x; y1 = b.y; x2 = c.x; y2 = c.y; + } + + private static bool Less(Vertex p, Vertex q) => p.x < q.x || (p.x == q.x && p.y < q.y); + + public bool Equals(TriangleKey o) => + x0 == o.x0 && y0 == o.y0 && x1 == o.x1 && y1 == o.y1 && x2 == o.x2 && y2 == o.y2; + + public override bool Equals(object obj) => obj is TriangleKey o && Equals(o); + + public override int GetHashCode() + { + int hash = x0.GetHashCode(); + hash = hash * 31 + y0.GetHashCode(); + hash = hash * 31 + x1.GetHashCode(); + hash = hash * 31 + y1.GetHashCode(); + hash = hash * 31 + x2.GetHashCode(); + return hash * 31 + y2.GetHashCode(); + } + } + + /// + /// Point location by walking from the given triangle (fast for points in spatial order). + /// + private static LocateResult Locate(Mesh mesh, Point p, ref Otri tri) + { + var org = tri.Org(); + var dest = tri.Dest(); + + if (org.x == p.x && org.y == p.y) + { + return LocateResult.OnVertex; + } + + if (dest.x == p.x && dest.y == p.y) + { + tri.Lnext(); + return LocateResult.OnVertex; + } + + double ahead = mesh.predicates.CounterClockwise(org, dest, p); + + if (ahead < 0.0) + { + tri.Sym(); + + if (tri.tri.id == Mesh.DUMMY) + { + tri.Sym(); + return mesh.locator.Locate(p, ref tri); + } + } + else if (ahead == 0.0 && + ((org.x < p.x) == (p.x < dest.x)) && ((org.y < p.y) == (p.y < dest.y))) + { + return LocateResult.OnEdge; + } + + return mesh.locator.PreciseLocate(p, ref tri, false); + } + + /// + /// Insert a point into the (constrained) Delaunay triangulation. + /// + /// True, if the point was inserted ('tri' has the new vertex as origin then). + private static bool Insert(Mesh mesh, Vertex p, ref Otri tri) + { + var v = new Vertex(p.x, p.y) { type = VertexType.FreeVertex }; + + var result = Locate(mesh, v, ref tri); + + if (result == LocateResult.OnVertex) + { + return false; + } + + if (tri.tri.id == Mesh.DUMMY) + { + tri.Sym(); + } + + var seg = default(Osub); + + if (result == LocateResult.OnEdge) + { + tri.Pivot(ref seg); + + if (seg.seg.hash == Mesh.DUMMY) + { + seg = default(Osub); + } + else + { + // On a break line: split it. + v.type = VertexType.SegmentVertex; + } + } + + if (mesh.InsertVertex(v, ref tri, ref seg, false, false) == InsertVertexResult.Successful) + { + v.hash = mesh.hash_vtx++; + v.id = v.hash; + mesh.vertices.Add(v.hash, v); + + return true; + } + + return false; + } + + /// + /// Add the triangles around the origin of the given triangle. + /// + private static void AddStar(Otri start, HashSet star) + { + var t = start; + + // Counterclockwise until back at the start or at the boundary. + do + { + star.Add(t.tri); + t.Onext(); + } + while (t.tri.id != Mesh.DUMMY && t.tri != start.tri); + + if (t.tri.id == Mesh.DUMMY) + { + // Boundary vertex: the other direction. + t = start; + + while (true) + { + t.Oprev(); + + if (t.tri.id == Mesh.DUMMY) + { + break; + } + + star.Add(t.tri); + } + } + } + + private static Mesh Triangulate(IList points, HashSet selected, IPolygon constraints) + { + var poly = new Polygon(selected.Count); + + foreach (int i in selected) + { + poly.Add(new Vertex(points[i].x, points[i].y)); + } + + if (constraints != null) + { + var copies = new Dictionary(); + + Vertex Copy(Vertex v) + { + if (!copies.TryGetValue(v, out var c)) + { + c = new Vertex(v.x, v.y); + copies.Add(v, c); + } + + return c; + } + + foreach (var s in constraints.Segments) + { + poly.Add(new Segment(Copy(s.GetVertex(0)), Copy(s.GetVertex(1))), true); + } + } + + // Keep the convex hull (otherwise triangles outside the break lines are removed). + return (Mesh)new GenericMesher().Triangulate(poly, new ConstraintOptions { Convex = true }); + } + + /// + /// Linear interpolation in the triangle. + /// + private static double Interpolate(Triangle t, double x, double y, Func height) + { + return Interpolate(t.vertices[0], t.vertices[1], t.vertices[2], x, y, height); + } + + private static double Interpolate(Vertex a, Vertex b, Vertex c, double x, double y, Func height) + { + double det = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y); + + double l1 = ((b.x - x) * (c.y - y) - (c.x - x) * (b.y - y)) / det; + double l2 = ((c.x - x) * (a.y - y) - (a.x - x) * (c.y - y)) / det; + double l3 = 1.0 - l1 - l2; + + return l1 * height(a) + l2 * height(b) + l3 * height(c); + } + + /// + /// Interpolation in the Delaunay triangulation of all points (for break line vertices + /// which aren't terrain points). + /// + private static Func CreateInterpolation(IList points, IList heights) + { + var copies = new List(points.Count); + var z = new Dictionary<(double, double), double>(points.Count); + + for (int i = 0; i < points.Count; i++) + { + copies.Add(new Vertex(points[i].x, points[i].y)); + + if (!z.ContainsKey((points[i].x, points[i].y))) + { + z.Add((points[i].x, points[i].y), heights[i]); + } + } + + var mesh = (Mesh)new GenericMesher().Triangulate(copies); + + return (x, y) => + { + var tri = default(Otri); + tri.tri = mesh.triangles.First(); + + var result = mesh.locator.Locate(new Point(x, y), ref tri); + + if (result == LocateResult.Outside || tri.tri.id == Mesh.DUMMY) + { + tri.Sym(); + } + + if (tri.tri.id == Mesh.DUMMY) + { + // Outside of the terrain model: use the nearest point. + var v = copies.OrderBy(p => (p.x - x) * (p.x - x) + (p.y - y) * (p.y - y)).First(); + return z[(v.x, v.y)]; + } + + return Interpolate(tri.tri, x, y, v => z[(v.x, v.y)]); + }; + } + + /// + /// Indices of the corners of the convex hull (monotone chain, collinear points removed). + /// + private static List ConvexHullCorners(IList points, IPredicates predicates) + { + var sorted = Enumerable.Range(0, points.Count) + .OrderBy(i => points[i].x).ThenBy(i => points[i].y).ToList(); + + var hull = new List(); + + // Lower and upper hull. + for (int pass = 0; pass < 2; pass++) + { + int start = hull.Count; + + foreach (int i in sorted) + { + while (hull.Count >= start + 2 && + predicates.CounterClockwise(points[hull[hull.Count - 2]], points[hull[hull.Count - 1]], points[i]) <= 0.0) + { + hull.RemoveAt(hull.Count - 1); + } + + hull.Add(i); + } + + // The last point is the first point of the other chain. + hull.RemoveAt(hull.Count - 1); + + sorted.Reverse(); + } + + // Remove duplicates (degenerate input). + return hull.GroupBy(i => (points[i].x, points[i].y)).Select(g => g.First()).ToList(); + } + + /// + /// Order the points along a Z-order curve. + /// + private static int[] SpatialOrder(IList points) + { + var bounds = new Rectangle(); + + foreach (var p in points) + { + bounds.Expand(p); + } + + double size = Math.Max(bounds.Width, bounds.Height); + double scale = size > 0.0 ? 65535.0 / size : 0.0; + + var keys = new ulong[points.Count]; + var order = new int[points.Count]; + + for (int i = 0; i < points.Count; i++) + { + uint x = (uint)((points[i].x - bounds.Left) * scale); + uint y = (uint)((points[i].y - bounds.Bottom) * scale); + + keys[i] = Interleave(x) | (Interleave(y) << 1); + order[i] = i; + } + + Array.Sort(keys, order); + + return order; + } + + private static ulong Interleave(uint v) + { + ulong x = v; + x = (x | (x << 16)) & 0x0000FFFF0000FFFFUL; + x = (x | (x << 8)) & 0x00FF00FF00FF00FFUL; + x = (x | (x << 4)) & 0x0F0F0F0F0F0F0F0FUL; + x = (x | (x << 2)) & 0x3333333333333333UL; + x = (x | (x << 1)) & 0x5555555555555555UL; + return x; + } + } +} From f8ef5045a6aa97852de357f245922bee9effd9f3 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 09:39:35 +0000 Subject: [PATCH 18/50] Grid mode: project splits onto input segment; bound wedge merging - Split vertices are projected onto the input segment before rounding to the grid, so deviations don't add up over splitting levels. - Wedge merging checks the distance to the original input segment, so chains of wedges can't drag a segment further than the tolerance. - Corpus harness: bad triangles after rounding to the output grid. - Docs: grid, wedge and terrain simplification results on ALKIS/DGM1 Herne. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 83 +++++++++++++++++++ src/Triangle.Tests/Corpus/CorpusCheck.cs | 41 +++++++-- src/Triangle.Tests/Corpus/CorpusTest.cs | 3 +- .../Robustness/WedgeMergeTest.cs | 47 +++++++++++ src/Triangle/Meshing/QualityMesher.cs | 66 +++++++++++++-- src/Triangle/Meshing/SegmentNoder.cs | 33 ++++++-- 6 files changed, 250 insertions(+), 23 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index b2fe98f..daf1749 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -12,6 +12,12 @@ Eingaben und Gleitkomma-Grenzfällen. > sank der Anteil schlechter Dreiecke von 8,7 % auf 1,1 %. Siehe > [Ergebnisse mit echten Daten](#ergebnisse-mit-echten-daten-alkis-und-dgm1-herne-opengeodatanrwde) > und [Absicherung für Performance-Arbeit](#absicherung-für-performance-arbeit-srctriangletestscharacterization). +> +> **Dritte Runde (Raster, Keile, Gelände):** Die 1,1 % gelten für die ungerundeten Koordinaten. +> Nach dem Runden auf cm sind es 6–10 %, und rund 1 % der Dreiecke kippt. Neu sind Snap-Rounding +> auf das Ausgaberaster (`GridSize`), das Zusammenführen dünner Keile (`WedgeTolerance`) und eine +> TIN-Vereinfachung für DGM-Raster (`TerrainSimplifier`), siehe +> [Raster, Keile und Geländevereinfachung](#raster-keile-und-geländevereinfachung). ## Kurzfazit @@ -327,6 +333,83 @@ Ausgangswerte (`Triangle.Benchmarks`, `--job short`, Release, Container mit 4 Ke Vorgehen pro Optimierung: Benchmark vorher/nachher (Standard-Job), Charakterisierungstests grün (bei verhaltensneutralen Änderungen unveränderte Fingerabdrücke). +## Raster, Keile und Geländevereinfachung + +Testgetrieben entwickelt (Tests zuerst rot: `GridSnapRoundingTest`, `WedgeMergeTest`, +`TerrainSimplifierTest`). + +**Raster (`ConstraintOptions.GridSize`, z. B. 0,01).** Wer die Koordinaten des Netzes beim +Schreiben auf cm rundet, verschiebt jeden Punkt um bis zu 7 mm. An fast deckungsgleichen Linien +sind die Dreiecke schmaler, dort kippen sie. Mit Raster liegen alle Punkte schon im Netz auf dem +Raster, Runden ändert also nichts mehr: + +* Eingabe: Snap-Rounding (`SegmentNoder.SnapRound`, iteriertes Snap-Rounding nach Hobby bzw. + Halperin/Packer). Punkte und Schnittpunkte werden gerundet, Segmente, die durch die Rasterzelle + eines Punktes laufen, werden durch ihn geführt. Danach kreuzt sich nichts, und kein Punkt liegt + näher als eine halbe Zelle an einem fremden Segment. +* Verfeinerung: Steiner-Punkte werden gerundet. Teilungspunkte auf Segmenten werden vorher auf das + Eingabesegment projiziert, sonst summieren sich die Abweichungen über die Teilungsstufen. + aCute-Relocation ist im Rastermodus aus (sie lief im Kreis). Dreiecke mit Kanten unter zwei + Rasterzellen werden nicht mehr wegen des Winkels verfeinert, sonst kaskadiert die Verfeinerung + an kleinen Eingabewinkeln bis auf das Raster (Zufallsdaten: 360.000 statt 1.500 Punkte). +* Zum Schluss verschiebt `GridSnapper.SnapVertices` übrige Punkte nur, wenn kein Dreieck kippt. + Die Rundung liefert für Dezimalraster dieselben Werte wie `Math.Round(x, n)`. + +**Keile (`ConstraintOptions.WedgeTolerance`, z. B. 0,03).** Eine Linie, die von einer anderen +unter weniger als 10° abgeht und deren anderes Ende näher als die Toleranz an ihr liegt, wird mit +ihr zusammengeführt (Gebäudewand knapp neben der Flurstücksgrenze). Andere Punkte in derselben +Entfernung bleiben unberührt, anders als bei einer größeren Snap-Toleranz. Ein Segment bewegt sich +dabei höchstens um die Toleranz, auch bei Ketten von Keilen (geprüft gegen das Eingabesegment). + +Ergebnis, ALKIS Herne (Flurstücke + Gebäude + Nutzung, 201 Kacheln, Snap 1 cm), gemessen **nach +dem Runden auf cm**: + +| Variante | schlechte Dreiecke 20° / 30° | gekippte Dreiecke 20° / 30° | Dreiecke 30° | +|----------|-----------------------------|-----------------------------|--------------| +| bisher | 6,13 % / 9,55 % | 33.858 / 92.501 (in 133 / 148 Kacheln) | 7,18 Mio. | +| Raster 1 cm | 6,78 % / 7,19 % | 0 / 0 | 5,88 Mio. | +| Keil 3 cm | 3,72 % / 6,44 % | 5.208 / 13.166 | 6,21 Mio. | +| **Raster 1 cm + Keil 3 cm** | **5,28 % / 6,02 %** | **0 / 0** | 5,80 Mio. | + +Ohne Rundung gemessen hätte „bisher“ 1,10 % / 0,98 %. Das ist aber nicht das Netz, das beim +Nutzer ankommt. Der Fallback-Adapter im alten Repo nutzt jetzt Raster (Rundungsgenauigkeit) und +Keil-Toleranz (dreifache Snap-Toleranz) als Standard. + +Grenze: Auch mit Raster bleiben gut 5 % schlechte Dreiecke. Sie liegen in Keilen, die schmaler als +zwei Rasterzellen sind. Dort lässt sich mit Punkten auf dem Raster kein guter Winkel erreichen, +und gerundete Teilungspunkte neben sehr dünnen Dreiecken sind oft ungültig. Größere Toleranzen +helfen, sind aber eine Datenentscheidung. + +**TIN-Vereinfachung (`Tools.TerrainSimplifier.Select`).** Wählt aus einem dichten DGM die Punkte +aus, deren Triangulierung alle Punkte mit einem vertikalen Fehler unter der Schranke +wiedergibt: Greedy Insertion nach Garland/Heckbert, wahlweise mit Bruchkanten. Pro Runde wird in +jedem Dreieck der schlechteste Punkt eingefügt, sofern sein Fehler mindestens halb so groß ist +wie der größte Fehler. Das spart gegenüber „alle auf einmal“ etwa 14 % Punkte. Eingefügt wird +inkrementell, und nur Punkte in geänderten Dreiecken werden neu lokalisiert (Max-Heap). Da die +Delaunay-Triangulation von Rasterpunkten nicht eindeutig ist (kozirkulär), wird zum Schluss gegen +eine neu aufgebaute Triangulierung geprüft und bei Bedarf nachgebessert. + +| DGM1 Herne, 1 Mio. Punkte | ausgewählt | Laufzeit | danach Qualitätsnetz 30° | +|---------------------------|------------|----------|--------------------------| +| Fehler ≤ 20 cm | 34.900 (3,5 %) | 8 s | 74.600 Punkte, 1 s | +| Fehler ≤ 10 cm | 104.300 (10,4 %) | 17 s | 183.000 Punkte, 2 s | +| Fehler ≤ 5 cm | 268.000 (26,8 %) | 57 s | 393.000 Punkte, 4 s | + +Datenabhängige Triangulierung (Kantenflips nach Geländeform) wurde bewusst nicht umgesetzt: Sie +erzeugt schmale Dreiecke und widerspricht damit dem Ziel der Qualitätsvermaschung. + +**Haben die Bugfixes die schwierigen Fälle verbessert?** Die Fixes des klassenweisen Reviews +ändern an den Korpuszahlen nichts (GEOS und Herne bitgleich). Die Verbesserungen stammen aus den +vorherigen Runden: + +| Fall | vorher | jetzt | +|------|--------|-------| +| GEOS, 2156 Fälle | 1 Fehler | 0 Fehler | +| GEOS `TestRelateAA.xml#74` (Nadel) | 88 s | 2,7 s | +| GEOS Isochronen am Steiner-Limit (20° / 30°) | 13 / 20 | 13 / 20 (unverändert, echte Feinstrukturen) | +| Herne Nutzung, Snap 1 cm (ungerundet) | 8,70 % / 10,74 %, 1–2 Kacheln am Limit | 1,10 % / 0,98 %, kein Limit | +| Herne Nutzung ohne Snap | lief nicht durch | läuft durch, aber 110 von 201 Kacheln am Limit, 78 % schlecht: Snap ist nötig | + ## Klassenweises Review (`src/Triangle.Tests/Review`) Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index 21d9c63..381cb28 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -117,11 +117,19 @@ Vertex V((double, double) p) // Every input segment must be covered by mesh subsegments (within the snap tolerance). SegmentNoder.Node(poly, predicates, out double noderTolerance, minTolerance: snapTolerance); - double tol = Math.Max(Math.Max(scale * 1e-11, 4 * noderTolerance), Math.Max(gridSize, wedgeTolerance)); + double tol = Math.Max(Math.Max(scale * 1e-11, 4 * noderTolerance), gridSize + wedgeTolerance); var subsegs = mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(); int missing = poly.Segments.Count(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tol)); + if (missing > 0 && Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_DEBUG") == "1") + { + foreach (var m in poly.Segments.Where(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tol))) + { + Console.WriteLine($"missing {m.GetVertex(0).X:R} {m.GetVertex(0).Y:R} -> {m.GetVertex(1).X:R} {m.GetVertex(1).Y:R} tol={tol}"); + } + } + if (missing > 0) { return $"SEGMENTS_MISSING {missing}"; @@ -134,24 +142,45 @@ Vertex V((double, double) p) // Triangles which are flat or inverted after rounding the coordinates to the output grid. double og = gridSize > 0.0 ? gridSize : outputGrid; - int flip = 0; + int flip = 0, badRounded = bad; if (og > 0.0) { Vertex R(Vertex v) => new Vertex(GridSnapper.Round(v.X, og), GridSnapper.Round(v.Y, og)); - flip = mesh.Triangles.Count(t => predicates.CounterClockwise(R(t.GetVertex(0)), R(t.GetVertex(1)), R(t.GetVertex(2))) <= 0.0); + + flip = 0; + badRounded = 0; + + foreach (var t in mesh.Triangles) + { + Vertex p = R(t.GetVertex(0)), q = R(t.GetVertex(1)), r = R(t.GetVertex(2)); + + if (predicates.CounterClockwise(p, q, r) <= 0.0) + { + flip++; + badRounded++; + } + else if (minAngle > 0 && MinimumAngle(p, q, r) < minAngle - 0.01) + { + badRounded++; + } + } } - return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)} flip={flip}"; + return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)} flip={flip} badr={badRounded}"; } - private static double MinimumAngle(Topology.Triangle t) + private static double MinimumAngle(Topology.Triangle t) => + MinimumAngle(t.GetVertex(0), t.GetVertex(1), t.GetVertex(2)); + + private static double MinimumAngle(Point p, Point q, Point r) { double min = 180; + var v = new[] { p, q, r }; for (int i = 0; i < 3; i++) { - Point a = t.GetVertex(i), b = t.GetVertex((i + 1) % 3), c = t.GetVertex((i + 2) % 3); + Point a = v[i], b = v[(i + 1) % 3], c = v[(i + 2) % 3]; double ux = b.X - a.X, uy = b.Y - a.Y, vx = c.X - a.X, vy = c.Y - a.Y; double angle = Math.Atan2(Math.Abs(ux * vy - uy * vx), ux * vx + uy * vy) * 180 / Math.PI; min = Math.Min(min, angle); diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index caa1101..f87dfae 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -173,7 +173,8 @@ private static void RunCases(IEnumerable cases) TestContext.Out.WriteLine($" min angle {g.Key}: total {stats.Sum(r => r.Stats["ms"]) / 1000:F1} s, " + $"{stats.Sum(r => r.Stats["triangles"])} triangles, Steiner limit reached x {stats.Count(r => r.Stats["limit"] > 0)}, " + $"bad triangles {stats.Sum(r => r.Stats["bad"])} ({100.0 * stats.Sum(r => r.Stats["bad"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %) in {stats.Count(r => r.Stats["bad"] > 0)} cases, " + - $"flipped by rounding {stats.Sum(r => r.Stats["flip"])} in {stats.Count(r => r.Stats["flip"] > 0)} cases"); + $"flipped by rounding {stats.Sum(r => r.Stats["flip"])} in {stats.Count(r => r.Stats["flip"] > 0)} cases, " + + $"bad after rounding {stats.Sum(r => r.Stats["badr"])} ({100.0 * stats.Sum(r => r.Stats["badr"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %)"); foreach (var r in stats.OrderByDescending(r => r.Stats["ms"]).Take(5)) { diff --git a/src/Triangle.Tests/Robustness/WedgeMergeTest.cs b/src/Triangle.Tests/Robustness/WedgeMergeTest.cs index 2fa469f..fd46cda 100644 --- a/src/Triangle.Tests/Robustness/WedgeMergeTest.cs +++ b/src/Triangle.Tests/Robustness/WedgeMergeTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System; +using System.Collections.Generic; using System.Linq; using TriangleNet.Geometry; using TriangleNet.Meshing; @@ -111,5 +112,51 @@ public void WedgeChainsAreMerged() Assert.That(BadTriangles(mesh, 30), Is.EqualTo(0)); } + + [Test] + public void MergingMovesSegmentsAtMostTheWedgeTolerance() + { + // A polyline drifting away from the boundary beyond the wedge tolerance: merging + // vertex by vertex must not drag the boundary along further than the tolerance. + var poly = new Polygon(); + poly.Add(TestData.Square(0, -10, 20), false); + poly.Add(new Segment(new Vertex(0, 0), new Vertex(20, 0)), true); + + Vertex prev = new Vertex(2, 0); + + for (int i = 1; i <= 8; i++) + { + var v = new Vertex(2 + 2 * i, 0.0075 * i); + poly.Add(new Segment(prev, v), true); + prev = v; + } + + var noded = SegmentNoder.Node(poly, new RobustPredicates(), out _, minTolerance: 0.01, wedgeTolerance: 0.03); + + // The boundary from (0,0) to (20,0) still exists as a chain of segments through + // vertices within the tolerance (merging didn't drag it towards the polyline). + var reached = new HashSet<(double, double)> { (0, 0) }; + bool grown = true; + + while (grown) + { + grown = false; + + foreach (var s in noded.Segments) + { + var p = (s.GetVertex(0).X, s.GetVertex(0).Y); + var q = (s.GetVertex(1).X, s.GetVertex(1).Y); + + if (Math.Abs(p.Item2) > 0.03 + 1e-12 || Math.Abs(q.Item2) > 0.03 + 1e-12) continue; + + if (reached.Contains(p) && reached.Add(q) || reached.Contains(q) && reached.Add(p)) + { + grown = true; + } + } + } + + Assert.That(reached.Contains((20, 0)), Is.True); + } } } diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index c6c43a5..6334194 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -652,15 +652,7 @@ private void SplitEncSegs(bool triflaws) #if USE_Z newvertex.z = eorg.z + split * (edest.z - eorg.z); #endif - if (GridSize > 0.0) - { - // Split vertices on the output grid (the subsegments bend slightly). - // Subsegments shorter than the grid can't be split: the rounded - // location coincides with an endpoint or isn't a valid split (below). - newvertex.x = GridSnapper.Round(newvertex.x, GridSize); - newvertex.y = GridSnapper.Round(newvertex.y, GridSize); - } - else if (!Behavior.NoExact) + if (!Behavior.NoExact) { // Roundoff in the above calculation may yield a 'newvertex' // that is not precisely collinear with 'eorg' and 'edest'. @@ -680,6 +672,16 @@ private void SplitEncSegs(bool triflaws) } } + if (GridSize > 0.0 && !MoveToGrid(ref enctri, newvertex, eorg, edest, + currentenc.SegOrg(), currentenc.SegDest())) + { + // No grid point is a valid split: the subsegment can't be split. + mesh.vertices.Remove(newvertex.hash); + unsplittable.Add(currentenc.seg); + seg.org = null; + continue; + } + // Check whether the new vertex lies on an endpoint, or whether inserting it // would create flat or inverted triangles. In both cases, the segment is too // small to be split with the finite precision of floating point arithmetic. @@ -1287,6 +1289,52 @@ internal double GridSize // inserting a vertex that encroaches upon them. private bool refusedAtPrecisionLimit; + /// + /// Move a split vertex to the grid (the subsegments bend slightly). + /// + /// The triangle of the subsegment (for ). + /// The split vertex. + /// The origin of the subsegment. + /// The destination of the subsegment. + /// The origin of the input segment. + /// The destination of the input segment. + /// False, if the rounded location isn't a valid split (the subsegment is + /// too short, or next to very thin triangles). + /// + /// The subsegment's endpoints are already rounded, so the vertex is projected onto + /// the input segment before rounding. Otherwise the deviation from the input segment + /// would add up with each level of splitting. + /// + private bool MoveToGrid(ref Otri tri, Vertex v, Vertex org, Vertex dest, Vertex segorg, Vertex segdest) + { + double x = v.x, y = v.y; + double px = x, py = y; + + double dx = segdest.x - segorg.x, dy = segdest.y - segorg.y; + double l2 = dx * dx + dy * dy; + + if (l2 > 0.0) + { + double t = ((x - segorg.x) * dx + (y - segorg.y) * dy) / l2; + + px = segorg.x + t * dx; + py = segorg.y + t * dy; + } + + v.x = GridSnapper.Round(px, gridSize); + v.y = GridSnapper.Round(py, gridSize); + + if ((v.x != org.x || v.y != org.y) && (v.x != dest.x || v.y != dest.y) && IsValidSplit(ref tri, v)) + { + return true; + } + + v.x = x; + v.y = y; + + return false; + } + /// /// Check whether inserting the vertex on the edge of the given triangle creates /// only positively oriented triangles (using exact predicates). diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index 09bf5d1..692c273 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -447,6 +447,10 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol // with distances close to the tolerance, snapping could otherwise go back and forth. var retired = new HashSet<(Vertex, Vertex)>(new EdgeComparer()); + // The input segment each piece lies on (merging wedges must not move a segment by + // more than the wedge tolerance, also not by merging a chain of wedges). + var origin = wedgeTolerance > tolerance ? new Dictionary() : null; + for (int iteration = 0; iteration < maxIterations && newPoints.Count <= maxNewPoints; iteration++) { var splits = new Dictionary>(); @@ -460,7 +464,7 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol if (splits.Count == 0 && wedgeTolerance > tolerance) { - AddWedgeVertices(segments, vertices.All, tolerance, wedgeTolerance, retired, splits); + AddWedgeVertices(segments, vertices.All, tolerance, wedgeTolerance, retired, splits, origin); } if (splits.Count == 0) @@ -474,7 +478,7 @@ private static bool TryNode(IPolygon polygon, IPredicates predicates, double tol retired.Add((segments[i].GetVertex(0), segments[i].GetVertex(1))); } - segments = Split(segments, splits); + segments = Split(segments, splits, origin); changed = true; } @@ -812,7 +816,7 @@ private static void AddNearbyVertices(List segments, ICollection private static void AddWedgeVertices(List segments, ICollection vertices, double tolerance, double wedgeTolerance, HashSet<(Vertex, Vertex)> retired, - Dictionary> splits) + Dictionary> splits, Dictionary origin) { var neighbors = new Dictionary>(new ReferenceComparer()); @@ -858,6 +862,8 @@ bool IsWedge(Vertex v, Vertex apex, Vertex other) var a = segments[i].GetVertex(0); var b = segments[i].GetVertex(1); + var (oa, ob) = origin.TryGetValue(segments[i], out var o) ? o : (a, b); + double dx = b.x - a.x, dy = b.y - a.y; double length = Math.Sqrt(dx * dx + dy * dy); @@ -880,6 +886,7 @@ bool IsWedge(Vertex v, Vertex apex, Vertex other) double t = ((v.x - a.x) * dx + (v.y - a.y) * dy) / (length * length); if (distance <= wedgeTolerance && t > 0.0 && t < 1.0 && + DistanceToSegment(v, oa, ob) <= wedgeTolerance && (IsWedge(v, a, b) || IsWedge(v, b, a)) && !retired.Contains((a, v)) && !retired.Contains((v, b))) { @@ -889,7 +896,8 @@ bool IsWedge(Vertex v, Vertex apex, Vertex other) } } - private static List Split(List segments, Dictionary> splits) + private static List Split(List segments, Dictionary> splits, + Dictionary origin = null) { var result = new List(segments.Count + 2 * splits.Count); @@ -898,6 +906,15 @@ private static List Split(List segments, Dictionary(new EdgeComparer()); + // Pieces inherit the input segment they lie on. + void AddOrigin(ISegment piece, ISegment parent) + { + if (origin != null) + { + origin[piece] = origin.TryGetValue(parent, out var o) ? o : (parent.GetVertex(0), parent.GetVertex(1)); + } + } + for (int i = 0; i < segments.Count; i++) { if (!splits.ContainsKey(i)) @@ -906,13 +923,14 @@ private static List Split(List segments, Dictionary Date: Sat, 24 Oct 2026 10:16:10 +0000 Subject: [PATCH 19/50] Grid mode: don't drop triangles near grid-unsplittable subsegments With a grid, subsegments where no grid point is a valid split are common. Triangles whose circumcenter encroached upon such a subsegment were dropped for good, leaving large bad triangles (edges up to 40 m). The vertex is now inserted anyway, as for locked segments (the grid floor prevents a cascade). ALKIS Herne, grid 1 cm + wedge 3 cm: bad triangles after rounding 5.3 % / 6.0 % -> 2.2 % / 2.2 % at 20 / 30 degrees. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Robustness/GridSnapRoundingTest.cs | 35 +++++++++++++++++++ src/Triangle/Meshing/QualityMesher.cs | 8 +++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs b/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs index 78ba1dd..be7fa9f 100644 --- a/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs +++ b/src/Triangle.Tests/Robustness/GridSnapRoundingTest.cs @@ -159,6 +159,41 @@ public void LockedSegmentsKeepTheirVertices() Assert.That(locked[0].GetVertex(0).X + locked[0].GetVertex(1).X, Is.EqualTo(10.0)); } + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + public void NoLargeBadTrianglesRemain(int seed) + { + // Subsegments where no grid point is a valid split must not stop the refinement of + // large triangles nearby (their circumcenter encroaches upon the subsegment). + var poly = RandomSegments(seed, 30, 10.0); + + var mesh = (Mesh)MeshAssert.Terminates(() => new GenericMesher().Triangulate(poly, + new ConstraintOptions { GridSize = Grid }, new QualityOptions { MinimumAngle = 30 })); + + MeshAssert.IsValid(mesh); + + var segments = new HashSet<(int, int)>(mesh.Segments.Select(s => (Math.Min(s.P0, s.P1), Math.Max(s.P0, s.P1)))); + + bool OnSegment(ITriangle t) => Enumerable.Range(0, 3).Any(i => + { + int a = t.GetVertexID(i), b = t.GetVertexID((i + 1) % 3); + return segments.Contains((Math.Min(a, b), Math.Max(a, b))); + }); + + double Shortest(ITriangle t) => Enumerable.Range(0, 3).Min(i => + { + var a = t.GetVertex(i); + var b = t.GetVertex((i + 1) % 3); + return Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y)); + }); + + int large = mesh.Triangles.Count(t => Characterization.MeshInvariants.MinimumAngle(t) < 29.99 && + Shortest(t) > 20 * Grid && !OnSegment(t)); + + Assert.That(large, Is.EqualTo(0)); + } + internal static int CountFlippedAfterRounding(Mesh mesh, double g) { var predicates = new RobustPredicates(); diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 6334194..679ebc5 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -879,12 +879,14 @@ private void SplitTriangle(BadTriangle badtri) int queued = badsubsegs.Count; bool encroaches = EncroachesBeforeInsertion(newvertex, badotri); - if (encroaches && badsubsegs.Count == queued && !refusedAtPrecisionLimit) + if (encroaches && badsubsegs.Count == queued && (!refusedAtPrecisionLimit || gridSize > 0.0)) { // Only subsegments which must not be split are encroached (segment - // splitting disabled, locked segments). Rejecting the vertex would + // splitting disabled, locked segments, or with a grid subsegments + // where no grid point is a valid split). Rejecting the vertex would // drop the bad triangle for good, so it is inserted anyway: it lies - // inside the domain, only the subsegment can't be split. + // inside the domain, only the subsegment can't be split. (At the + // precision limit without a grid, this would refine forever.) encroaches = false; success = mesh.InsertVertex(newvertex, ref badotri, ref tmp, false, true); } From 0b4fa3d4aa89a0b92f0c0ad915b2a6b567d1c649 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 10:24:23 +0000 Subject: [PATCH 20/50] TerrainSimplifier: error bound for any Delaunay triangulation - Cocircular points (grid data) make the Delaunay triangulation ambiguous; errors are now evaluated over all triangles of each cocircular cluster, and triangles whose cluster may have changed are re-evaluated. The final check against a triangulation built from scratch finds no violations, so it runs once (DGM1, 5 cm: 57 s -> 28 s). - Fix: points added to an existing bucket could raise its error without queueing it (bound violated in rare cases). - Errors equal to the bound up to roundoff are accepted. - Docs: grid mode results after the insert-anyway fix. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 41 +++-- src/Triangle/Tools/TerrainSimplifier.cs | 224 ++++++++++++++++++++++-- 2 files changed, 241 insertions(+), 24 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index daf1749..8dabd80 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -14,7 +14,8 @@ Eingaben und Gleitkomma-Grenzfällen. > und [Absicherung für Performance-Arbeit](#absicherung-für-performance-arbeit-srctriangletestscharacterization). > > **Dritte Runde (Raster, Keile, Gelände):** Die 1,1 % gelten für die ungerundeten Koordinaten. -> Nach dem Runden auf cm sind es 6–10 %, und rund 1 % der Dreiecke kippt. Neu sind Snap-Rounding +> Nach dem Runden auf cm sind es 6–10 %, und rund 1 % der Dreiecke kippt. Mit Raster und +> Keil-Toleranz sind es 2,2 % ohne gekippte Dreiecke. Neu sind Snap-Rounding > auf das Ausgaberaster (`GridSize`), das Zusammenführen dünner Keile (`WedgeTolerance`) und eine > TIN-Vereinfachung für DGM-Raster (`TerrainSimplifier`), siehe > [Raster, Keile und Geländevereinfachung](#raster-keile-und-geländevereinfachung). @@ -367,33 +368,47 @@ dem Runden auf cm**: | Variante | schlechte Dreiecke 20° / 30° | gekippte Dreiecke 20° / 30° | Dreiecke 30° | |----------|-----------------------------|-----------------------------|--------------| | bisher | 6,13 % / 9,55 % | 33.858 / 92.501 (in 133 / 148 Kacheln) | 7,18 Mio. | -| Raster 1 cm | 6,78 % / 7,19 % | 0 / 0 | 5,88 Mio. | +| Raster 1 cm | 2,91 % / 2,73 % | 0 / 0 | 6,83 Mio. | | Keil 3 cm | 3,72 % / 6,44 % | 5.208 / 13.166 | 6,21 Mio. | -| **Raster 1 cm + Keil 3 cm** | **5,28 % / 6,02 %** | **0 / 0** | 5,80 Mio. | +| **Raster 1 cm + Keil 3 cm** | **2,22 % / 2,22 %** | **0 / 0** | 6,59 Mio. | Ohne Rundung gemessen hätte „bisher“ 1,10 % / 0,98 %. Das ist aber nicht das Netz, das beim Nutzer ankommt. Der Fallback-Adapter im alten Repo nutzt jetzt Raster (Rundungsgenauigkeit) und Keil-Toleranz (dreifache Snap-Toleranz) als Standard. -Grenze: Auch mit Raster bleiben gut 5 % schlechte Dreiecke. Sie liegen in Keilen, die schmaler als -zwei Rasterzellen sind. Dort lässt sich mit Punkten auf dem Raster kein guter Winkel erreichen, -und gerundete Teilungspunkte neben sehr dünnen Dreiecken sind oft ungültig. Größere Toleranzen -helfen, sind aber eine Datenentscheidung. +Die wichtigste Korrektur im Rastermodus: Teilsegmente, bei denen kein Rasterpunkt eine gültige +Teilung ergibt, sind häufig (neben sehr dünnen Dreiecken). Dreiecke, deren Umkreismittelpunkt ein +solches Teilsegment bedrängte, wurden bisher dauerhaft verworfen. So blieben schlechte Dreiecke +mit bis zu 40 m Kantenlänge stehen. Jetzt wird der Punkt trotzdem eingefügt, wie bei gesperrten +Kanten (die Raster-Untergrenze verhindert eine Kaskade). Damit sank der Anteil von 5,3 % / 6,0 % +auf 2,2 % / 2,2 %; die Laufzeit stieg um etwa ein Drittel (15 % mehr Dreiecke). + +Die übrigen schlechten Dreiecke liegen an Segmenten im Bereich 2–5 cm und in echten +Eingabekeilen. Dort lässt sich mit Punkten auf einem cm-Raster kein guter Winkel erreichen. +Größere Toleranzen helfen, sind aber eine Datenentscheidung. Ausprobiert und verworfen: den +Abschnitt eines langen Keils zusammenführen, auf dem die Linien näher als die Toleranz liegen. Die +Keilspitze wandert dabei nur, der kleine Winkel bleibt; auf den Herne-Kacheln war das neutral bis +leicht schlechter. **TIN-Vereinfachung (`Tools.TerrainSimplifier.Select`).** Wählt aus einem dichten DGM die Punkte aus, deren Triangulierung alle Punkte mit einem vertikalen Fehler unter der Schranke wiedergibt: Greedy Insertion nach Garland/Heckbert, wahlweise mit Bruchkanten. Pro Runde wird in jedem Dreieck der schlechteste Punkt eingefügt, sofern sein Fehler mindestens halb so groß ist wie der größte Fehler. Das spart gegenüber „alle auf einmal“ etwa 14 % Punkte. Eingefügt wird -inkrementell, und nur Punkte in geänderten Dreiecken werden neu lokalisiert (Max-Heap). Da die -Delaunay-Triangulation von Rasterpunkten nicht eindeutig ist (kozirkulär), wird zum Schluss gegen -eine neu aufgebaute Triangulierung geprüft und bei Bedarf nachgebessert. +inkrementell, und nur Punkte in geänderten Dreiecken werden neu lokalisiert (Max-Heap). + +Die Delaunay-Triangulation von Rasterpunkten ist nicht eindeutig (kozirkuläre Punkte), eine neu +aufgebaute Triangulierung kann also andere Diagonalen wählen – in flachen Bereichen mit wenigen +Punkten mit Fehlern über 2 m. Deshalb wird der Fehler für jede kozirkuläre Gruppe über alle +Dreiecke aus ihren Punkten bewertet (jedes davon kommt in irgendeiner Delaunay-Triangulierung +vor). Die Schranke gilt damit für jede Delaunay-Triangulierung der Auswahl; eine abschließende +Prüfung gegen eine neu aufgebaute Triangulierung bestätigt das. | DGM1 Herne, 1 Mio. Punkte | ausgewählt | Laufzeit | danach Qualitätsnetz 30° | |---------------------------|------------|----------|--------------------------| -| Fehler ≤ 20 cm | 34.900 (3,5 %) | 8 s | 74.600 Punkte, 1 s | -| Fehler ≤ 10 cm | 104.300 (10,4 %) | 17 s | 183.000 Punkte, 2 s | -| Fehler ≤ 5 cm | 268.000 (26,8 %) | 57 s | 393.000 Punkte, 4 s | +| Fehler ≤ 20 cm | 35.700 (3,6 %) | 11 s | ca. 75.000 Punkte, 1 s | +| Fehler ≤ 10 cm | 106.100 (10,6 %) | 16 s | ca. 183.000 Punkte, 2 s | +| Fehler ≤ 5 cm | 268.400 (26,8 %) | 28 s | ca. 393.000 Punkte, 4 s | Datenabhängige Triangulierung (Kantenflips nach Geländeform) wurde bewusst nicht umgesetzt: Sie erzeugt schmale Dreiecke und widerspricht damit dem Ziel der Qualitätsvermaschung. diff --git a/src/Triangle/Tools/TerrainSimplifier.cs b/src/Triangle/Tools/TerrainSimplifier.cs index 3ac3266..cfb46d3 100644 --- a/src/Triangle/Tools/TerrainSimplifier.cs +++ b/src/Triangle/Tools/TerrainSimplifier.cs @@ -163,7 +163,14 @@ double Z(Vertex v) var tri = default(Otri); var changed = new HashSet(); - var created = new List(); + + // Cocircular vertices around a triangle (cache for one pass). + var clusters = new Dictionary(); + var touched = new HashSet(); + + // Errors equal to the maximum (up to roundoff, which depends on the order of the + // triangle's vertices) are fine. + double bound = maxError * (1.0 + 1e-10); var queue = new BucketQueue(); // Set if the mesh was built from scratch (no insertions since). @@ -206,14 +213,13 @@ double Z(Vertex v) } else { - error = Math.Abs(Interpolate(tri.tri, p.x, p.y, Z) - heights[i]); + error = Error(mesh, tri.tri, p, heights[i], Z, clusters); } if (!buckets.TryGetValue(tri.tri, out var bucket)) { bucket = new Bucket(tri.tri); buckets.Add(tri.tri, bucket); - created.Add(bucket); } bucket.Points.Add(i); @@ -222,24 +228,28 @@ double Z(Vertex v) { bucket.Error = error; bucket.Worst = i; + + // Also existing buckets (unchanged triangles) may get a larger error. + touched.Add(bucket); } } pending.Clear(); + clusters.Clear(); - foreach (var bucket in created) + foreach (var bucket in touched) { - if (bucket.Error > maxError) + if (bucket.Error > bound) { - queue.Push(bucket); + queue.Update(bucket); } } - created.Clear(); + touched.Clear(); double max = queue.Count > 0 ? queue.Peek().Error : 0.0; - if (max <= maxError) + if (max <= bound) { if (fresh) { @@ -290,7 +300,7 @@ double Z(Vertex v) // Insert the worst points first (closer to the result of strictly greedy // insertion, which selects fewer points than inserting all at once). - double limit = polishing ? maxError : Math.Max(maxError, 0.5 * max); + double limit = polishing ? bound : Math.Max(bound, 0.5 * max); var insert = new List<(Triangle, int)>(); @@ -322,11 +332,44 @@ double Z(Vertex v) } } + // The cocircular neighbors of a triangle (see Error()) may have changed, too. + var ring = new List(); + var edge = default(Otri); + var sym = default(Otri); + + foreach (var t in changed) + { + edge.tri = t; + + for (edge.orient = 0; edge.orient < 3; edge.orient++) + { + edge.Sym(ref sym); + + if (sym.tri.id != Mesh.DUMMY) + { + ring.Add(sym.tri); + } + } + } + + changed.UnionWith(ring); + + // ... and all triangles cocircular with them. + foreach (var t in changed.ToList()) + { + var cluster = CocircularTriangles(mesh, t); + + if (cluster != null) + { + changed.UnionWith(cluster); + } + } + // Points of triangles which changed are located again. foreach (var t in changed) { - if (buckets.TryGetValue(t, out var bucket) && - (Otri.IsDead(t) || isSelected[bucket.Worst] || !bucket.Key.Equals(new TriangleKey(t)))) + // Also unchanged triangles: their cocircular neighbors may have changed. + if (buckets.TryGetValue(t, out var bucket)) { buckets.Remove(t); queue.Remove(bucket); @@ -382,6 +425,21 @@ public void Clear() heap.Clear(); } + /// + /// Add the bucket, or move it up after its error increased. + /// + public void Update(Bucket b) + { + if (b.Position < 0) + { + Push(b); + } + else + { + Up(b.Position); + } + } + public void Push(Bucket b) { b.Position = heap.Count; @@ -688,6 +746,150 @@ Vertex Copy(Vertex v) return (Mesh)new GenericMesher().Triangulate(poly, new ConstraintOptions { Convex = true }); } + /// + /// Vertical error of the point in the given triangle. + /// + /// + /// If neighbors are cocircular (e.g. grid points), the Delaunay triangulation isn't + /// unique: any triangle formed by three of the cocircular vertices may be part of it + /// (their convex hull is a convex polygon). The error is the maximum over all of them + /// containing the point, so the bound holds for any Delaunay triangulation of the + /// selected points. + /// + private static double Error(Mesh mesh, Triangle t, Point p, double height, Func z, + Dictionary clusters) + { + double error = Math.Abs(Interpolate(t, p.x, p.y, z) - height); + + if (!clusters.TryGetValue(t, out var cluster)) + { + cluster = Cocircular(mesh, t); + clusters.Add(t, cluster); + } + + if (cluster == null) + { + return error; + } + + int n = cluster.Length; + + for (int i = 0; i < n; i++) + { + for (int j = i + 1; j < n; j++) + { + for (int k = j + 1; k < n; k++) + { + Vertex a = cluster[i], b = cluster[j], c = cluster[k]; + + double det = (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y); + + if (det == 0.0) + { + continue; + } + + double l1 = ((b.x - p.x) * (c.y - p.y) - (c.x - p.x) * (b.y - p.y)) / det; + double l2 = ((c.x - p.x) * (a.y - p.y) - (a.x - p.x) * (c.y - p.y)) / det; + double l3 = 1.0 - l1 - l2; + + const double eps = -1e-12; + + if (l1 >= eps && l2 >= eps && l3 >= eps) + { + double h = l1 * z(a) + l2 * z(b) + l3 * z(c); + error = Math.Max(error, Math.Abs(h - height)); + } + } + } + } + + return error; + } + + /// + /// The vertices of all triangles connected to the given triangle by cocircular, + /// unconstrained edges (null if there are none). + /// + private static Vertex[] Cocircular(Mesh mesh, Triangle start) + { + var triangles = CocircularTriangles(mesh, start); + + if (triangles == null || triangles.Count > MaxCluster) + { + // Large clusters (many points on a circle) are rare: left to the final check. + return null; + } + + var vertices = new HashSet(); + + foreach (var t in triangles) + { + vertices.Add(t.vertices[0]); + vertices.Add(t.vertices[1]); + vertices.Add(t.vertices[2]); + } + + var result = new Vertex[vertices.Count]; + vertices.CopyTo(result); + + return result; + } + + /// + /// All triangles connected to the given triangle by cocircular, unconstrained edges + /// (null if there are none). + /// + private static List CocircularTriangles(Mesh mesh, Triangle start) + { + List triangles = null; + var stack = new Stack(); + var visited = new HashSet { start }; + + stack.Push(start); + + var edge = default(Otri); + var sym = default(Otri); + var seg = default(Osub); + + while (stack.Count > 0) + { + edge.tri = stack.Pop(); + + for (edge.orient = 0; edge.orient < 3; edge.orient++) + { + edge.Sym(ref sym); + + if (sym.tri.id == Mesh.DUMMY || visited.Contains(sym.tri)) + { + continue; + } + + edge.Pivot(ref seg); + + if (seg.seg.hash != Mesh.DUMMY) + { + // Break lines aren't flipped. + continue; + } + + if (mesh.predicates.InCircle(edge.Org(), edge.Dest(), edge.Apex(), sym.Apex()) == 0.0) + { + visited.Add(sym.tri); + stack.Push(sym.tri); + + triangles = triangles ?? new List { start }; + triangles.Add(sym.tri); + } + } + } + + return triangles; + } + + // Maximum number of triangles of a cocircular cluster handled in Error(). + private const int MaxCluster = 16; + /// /// Linear interpolation in the triangle. /// From 28f28f620a0e91ca15fb4b405f370fcaf4d003e9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 10:42:28 +0000 Subject: [PATCH 21/50] Corpus: classify bad triangles; docs: what remains is grid-limited Bad triangles are classified as at a small input angle, below the grid floor, in a narrow strip (another segment closer than 5 cm), at a segment or interior. ALKIS Herne, grid 1 cm + wedge 3 cm: at most 0.19 % / 0.30 % of all triangles are possibly avoidable; most lie in 2-5 cm strips. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 20 +++- src/Triangle.Tests/Corpus/CorpusCheck.cs | 135 ++++++++++++++++++++++- src/Triangle.Tests/Corpus/CorpusTest.cs | 3 +- 3 files changed, 155 insertions(+), 3 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 8dabd80..9646419 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -383,7 +383,25 @@ mit bis zu 40 m Kantenlänge stehen. Jetzt wird der Punkt trotzdem eingefügt, w Kanten (die Raster-Untergrenze verhindert eine Kaskade). Damit sank der Anteil von 5,3 % / 6,0 % auf 2,2 % / 2,2 %; die Laufzeit stieg um etwa ein Drittel (15 % mehr Dreiecke). -Die übrigen schlechten Dreiecke liegen an Segmenten im Bereich 2–5 cm und in echten +Wo die übrigen schlechten Dreiecke liegen (alle 201 Kacheln, Raster 1 cm + Keil 3 cm; Korpus-Kennzahlen +`ba`/`bf`/`bn`/`bs`/`bi`): + +| Klasse | 20° | 30° | vermeidbar? | +|--------|-----|-----|-------------| +| an einem kleinen Eingabewinkel (zwei Segmente < Mindestwinkel) | 4.892 | 6.517 | nein | +| kürzeste Kante unter zwei Rasterzellen | 16.099 | 30.436 | nein (Raster) | +| schmaler Streifen: anderes Segment näher als 5 cm | 39.124 | 89.070 | kaum (Raster) | +| an einem Segment, sonst nichts in der Nähe | 5.172 | 14.565 | vielleicht | +| im Inneren | 514 | 5.337 | vielleicht | +| **zusammen** | 65.801 (2,22 %) | 145.925 (2,22 %) | | + +Vermeidbar wären höchstens die letzten beiden Klassen: 0,19 % bzw. 0,30 % aller Dreiecke. Der +große Rest liegt in Streifen zwischen fast parallelen Linien, die sich nicht treffen (z. B. +Gebäudewand 2–5 cm neben der Grenze): Bei 3 cm Breite verschiebt das cm-Raster die Punkte um bis +zu ein Sechstel der Kantenlänge, ein Mindestwinkel von 30° ist dort kaum zu halten. Abhilfe wäre +nur, solche Streifen zusammenzulegen, also Linien um mehrere cm zu verschieben (Datenentscheidung). + +Die übrigen schlechten Dreiecke liegen damit an Segmenten im Bereich 2–5 cm und in echten Eingabekeilen. Dort lässt sich mit Punkten auf einem cm-Raster kein guter Winkel erreichen. Größere Toleranzen helfen, sind aber eine Datenentscheidung. Ausprobiert und verworfen: den Abschnitt eines langen Keils zusammenführen, auf dem die Linien näher als die Toleranz liegen. Die diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index 381cb28..ecd2187 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -167,7 +167,140 @@ Vertex V((double, double) p) } } - return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)} flip={flip} badr={badRounded}"; + var (classAngle, classFloor, classStrip, classSegment, classInterior) = Classify(mesh, minAngle, gridSize); + + return $"OK triangles={mesh.Triangles.Count} ms={watch.ElapsedMilliseconds} bad={bad} limit={(limit ? 1 : 0)} flip={flip} badr={badRounded}" + + $" ba={classAngle} bf={classFloor} bn={classStrip} bs={classSegment} bi={classInterior}"; + } + + /// + /// Classify the bad triangles: at a small input angle (a vertex where two segments form an + /// angle below the minimum angle), below the grid floor (shortest edge less than two grid + /// cells), in a narrow strip between a segment and another segment closer than 5 cm, + /// touching a segment, or in the interior. + /// + private static (int, int, int, int, int) Classify(Mesh mesh, double minAngle, double gridSize) + { + if (minAngle <= 0) + { + return (0, 0, 0, 0, 0); + } + + const double strip = 0.05; + + // Directions of the segments at each vertex, and the segment edges. + var directions = new Dictionary>(); + var segments = new HashSet<(int, int)>(); + + foreach (var s in mesh.Segments) + { + Vertex a = s.GetVertex(0), b = s.GetVertex(1); + + void Add(Vertex p, Vertex q) + { + if (!directions.TryGetValue(p.ID, out var list)) + { + directions[p.ID] = list = new List(); + } + + list.Add(Math.Atan2(q.Y - p.Y, q.X - p.X)); + } + + Add(a, b); + Add(b, a); + segments.Add((Math.Min(a.ID, b.ID), Math.Max(a.ID, b.ID))); + } + + var smallAngle = new HashSet(); + + foreach (var item in directions) + { + var d = item.Value; + + if (d.Count < 2) continue; + + d.Sort(); + + for (int i = 0; i < d.Count; i++) + { + double gap = (i + 1 < d.Count ? d[i + 1] - d[i] : d[0] + 2 * Math.PI - d[i]) * 180 / Math.PI; + + if (gap < minAngle - 0.01) + { + smallAngle.Add(item.Key); + break; + } + } + } + + int angle = 0, floor = 0, narrow = 0, segment = 0, interior = 0; + + var segmentList = mesh.Segments.ToList(); + + // Is a segment other than (p, q) (and its collinear continuations) closer than the + // strip width to the point? + bool InStrip(Point c, Vertex p, Vertex q) + { + double ux = q.X - p.X, uy = q.Y - p.Y; + + foreach (var s in segmentList) + { + Vertex a = s.GetVertex(0), b = s.GetVertex(1); + + if (Math.Max(Math.Min(a.X, b.X) - c.X, c.X - Math.Max(a.X, b.X)) > strip || + Math.Max(Math.Min(a.Y, b.Y) - c.Y, c.Y - Math.Max(a.Y, b.Y)) > strip) + { + continue; + } + + if (a.ID == p.ID || a.ID == q.ID || b.ID == p.ID || b.ID == q.ID) + { + double vx = b.X - a.X, vy = b.Y - a.Y; + double sin = Math.Abs(ux * vy - uy * vx) / Math.Sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); + + if (sin < 0.2 || (a.ID == p.ID || a.ID == q.ID) && (b.ID == p.ID || b.ID == q.ID)) continue; + } + + double dx = b.X - a.X, dy = b.Y - a.Y, l2 = dx * dx + dy * dy; + double t = l2 == 0 ? 0 : Math.Max(0, Math.Min(1, ((c.X - a.X) * dx + (c.Y - a.Y) * dy) / l2)); + double ex = a.X + t * dx - c.X, ey = a.Y + t * dy - c.Y; + + if (ex * ex + ey * ey < strip * strip) return true; + } + + return false; + } + + foreach (var t in mesh.Triangles) + { + if (MinimumAngle(t) >= minAngle - 0.01) continue; + + double shortest = double.MaxValue; + Vertex sp = null, sq = null; + + for (int i = 0; i < 3; i++) + { + Vertex p = t.GetVertex(i), q = t.GetVertex((i + 1) % 3); + shortest = Math.Min(shortest, Math.Sqrt((p.X - q.X) * (p.X - q.X) + (p.Y - q.Y) * (p.Y - q.Y))); + + if (segments.Contains((Math.Min(p.ID, q.ID), Math.Max(p.ID, q.ID)))) + { + sp = p; + sq = q; + } + } + + var centroid = new Point((t.GetVertex(0).X + t.GetVertex(1).X + t.GetVertex(2).X) / 3, + (t.GetVertex(0).Y + t.GetVertex(1).Y + t.GetVertex(2).Y) / 3); + + if (Enumerable.Range(0, 3).Any(i => smallAngle.Contains(t.GetVertexID(i)))) angle++; + else if (gridSize > 0 && shortest < 2 * gridSize) floor++; + else if (sp != null && InStrip(centroid, sp, sq)) narrow++; + else if (sp != null) segment++; + else interior++; + } + + return (angle, floor, narrow, segment, interior); } private static double MinimumAngle(Topology.Triangle t) => diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index f87dfae..3b29946 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -174,7 +174,8 @@ private static void RunCases(IEnumerable cases) $"{stats.Sum(r => r.Stats["triangles"])} triangles, Steiner limit reached x {stats.Count(r => r.Stats["limit"] > 0)}, " + $"bad triangles {stats.Sum(r => r.Stats["bad"])} ({100.0 * stats.Sum(r => r.Stats["bad"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %) in {stats.Count(r => r.Stats["bad"] > 0)} cases, " + $"flipped by rounding {stats.Sum(r => r.Stats["flip"])} in {stats.Count(r => r.Stats["flip"] > 0)} cases, " + - $"bad after rounding {stats.Sum(r => r.Stats["badr"])} ({100.0 * stats.Sum(r => r.Stats["badr"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %)"); + $"bad after rounding {stats.Sum(r => r.Stats["badr"])} ({100.0 * stats.Sum(r => r.Stats["badr"]) / Math.Max(1, stats.Sum(r => r.Stats["triangles"])):F2} %), " + + $"bad by class: small input angle {stats.Sum(r => r.Stats["ba"])}, grid floor {stats.Sum(r => r.Stats["bf"])}, narrow strip {stats.Sum(r => r.Stats["bn"])}, at segment {stats.Sum(r => r.Stats["bs"])}, interior {stats.Sum(r => r.Stats["bi"])}"); foreach (var r in stats.OrderByDescending(r => r.Stats["ms"]).Take(5)) { From 9e3dc6aa5937b35e8bfac174971f4c63aabe3666 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 10:56:27 +0000 Subject: [PATCH 22/50] Benchmarks: grid and wedge scenarios on ALKIS tiles Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Benchmarks/MeshingBenchmark.cs | 4 +++- .../Characterization/MeshCases.cs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Triangle.Benchmarks/MeshingBenchmark.cs b/src/Triangle.Benchmarks/MeshingBenchmark.cs index 5817fbf..0286f8e 100644 --- a/src/Triangle.Benchmarks/MeshingBenchmark.cs +++ b/src/Triangle.Benchmarks/MeshingBenchmark.cs @@ -30,6 +30,8 @@ public class MeshingBenchmark "herne_371800_5710600/q20-snap1cm", "herne_373600_5709000/q20-snap1cm", "herne_373600_5709000/q30-snap1cm", + "herne_371800_5710600/q20-grid1cm-wedge3cm", + "herne_373600_5709000/q30-grid1cm-wedge3cm", }; private MeshCases.Case scenario; @@ -51,7 +53,7 @@ public IEnumerable Scenarios() [GlobalSetup] public void Setup() { - scenario = MeshCases.All().First(c => c.Name == Scenario); + scenario = MeshCases.All().Concat(MeshCases.GridCases()).First(c => c.Name == Scenario); } [Benchmark] diff --git a/src/Triangle.Tests/Characterization/MeshCases.cs b/src/Triangle.Tests/Characterization/MeshCases.cs index c2631d1..1a58dfd 100644 --- a/src/Triangle.Tests/Characterization/MeshCases.cs +++ b/src/Triangle.Tests/Characterization/MeshCases.cs @@ -142,6 +142,23 @@ public static IEnumerable All() } } + /// + /// Scenarios for benchmarks only: with an output grid the mesh isn't exactly Delaunay, + /// so the invariant checks don't apply. + /// + public static IEnumerable GridCases() + { + foreach (var tile in new[] { "herne_371800_5710600", "herne_373600_5709000" }) + { + IPolygon Tile() => LoadTile(tile); + + var options = new ConstraintOptions { SnapTolerance = 0.01, GridSize = 0.01, WedgeTolerance = 0.03 }; + + yield return Quality(tile + "/q20-grid1cm-wedge3cm", Tile, options, 20); + yield return Quality(tile + "/q30-grid1cm-wedge3cm", Tile, options, 30); + } + } + private static Case Points(string name, Func input, Func algorithm) { return new Case From cb3eb62596ca5b8c327e61df614c221ee5d14775 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 10:59:25 +0000 Subject: [PATCH 23/50] Grid mode: skip relocation search, snap only vertices off the grid The aCute relocation was computed and then discarded in grid mode (24 % of the time). SnapVertices builds vertex stars only for vertices off the grid. ALKIS tile, q30, grid 1 cm + wedge 3 cm: 1155 -> 846 ms, same mesh size. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/Meshing/GridSnapper.cs | 42 ++++++++++++++++++----------- src/Triangle/NewLocation.cs | 19 +++++-------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/Triangle/Meshing/GridSnapper.cs b/src/Triangle/Meshing/GridSnapper.cs index 7642e0b..f9c9407 100644 --- a/src/Triangle/Meshing/GridSnapper.cs +++ b/src/Triangle/Meshing/GridSnapper.cs @@ -69,8 +69,25 @@ public static int SnapVertices(IMesh mesh, double gridSize) var predicates = m.predicates; - // The triangles around each vertex. - var star = new Dictionary>(); + // Vertices off the grid (usually few: Steiner points are already on the grid). + var off = new Dictionary(); + + foreach (var v in m.vertices.Values) + { + if (v.type != VertexType.UndeadVertex && + (Round(v.x, gridSize) != v.x || Round(v.y, gridSize) != v.y)) + { + off.Add(v.hash, v); + } + } + + if (off.Count == 0) + { + return 0; + } + + // The triangles around each of these vertices. + var star = new Dictionary>(off.Count); foreach (var t in m.triangles) { @@ -78,6 +95,11 @@ public static int SnapVertices(IMesh mesh, double gridSize) { var v = t.vertices[i]; + if (!off.ContainsKey(v.hash)) + { + continue; + } + if (!star.TryGetValue(v.hash, out var list)) { list = new List(6); @@ -90,27 +112,17 @@ public static int SnapVertices(IMesh mesh, double gridSize) int failed = 0; - foreach (var v in m.vertices.Values) + foreach (var v in off.Values) { - if (v.type == VertexType.UndeadVertex) + if (!star.TryGetValue(v.hash, out var triangles)) { + // Not part of the mesh. continue; } double rx = Round(v.x, gridSize); double ry = Round(v.y, gridSize); - if (rx == v.x && ry == v.y) - { - continue; - } - - if (!star.TryGetValue(v.hash, out var triangles)) - { - // Not part of the mesh. - continue; - } - if (!TryMove(v, rx, ry, triangles, predicates) && !TryCellCorners(v, rx, ry, gridSize, triangles, predicates)) { failed++; diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index b7f9599..96d654b 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -70,17 +70,12 @@ internal void MarkRelocated(Vertex v) /// /// Size of the grid Steiner points are rounded to (0 = no rounding). /// - internal double GridSize { get; set; } - - /// + /// /// With a grid, vertices aren't relocated: the rounded position may coincide with the /// old one, or inserting it may fail (the deleted vertex is lost then), so the same /// vertex would be deleted and reinserted forever. - /// - private int CheckGridRelocation(int relocated) - { - return GridSize > 0.0 ? 0 : relocated; - } + /// + internal double GridSize { get; set; } // Work arrays for wegde intersection double[] petalx = new double[20]; @@ -443,8 +438,8 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t } //- RELOCATION (LOCAL SMOOTHING) -// // check for possible relocation of one of triangle's points - relocated = DoSmoothing(delotri, torg, tdest, tapex, ref newloc); - relocated = CheckGridRelocation(relocated); + // With a grid, vertices aren't relocated (see GridSize). + relocated = GridSize > 0.0 ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { @@ -1146,8 +1141,8 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, } // RELOCATION (LOCAL SMOOTHING) // check for possible relocation of one of triangle's points - relocated = DoSmoothing(delotri, torg, tdest, tapex, ref newloc); - relocated = CheckGridRelocation(relocated); + // With a grid, vertices aren't relocated (see GridSize). + relocated = GridSize > 0.0 ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { From 211ee5f1767233b342f0dd78682479deec24ade2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 11:14:06 +0000 Subject: [PATCH 24/50] Reduce allocations: inline triangle fields, predicate workspaces - Triangle stores its vertices, neighbors and subsegments as fields with ref-returning accessors (same syntax as the arrays before). A triangle is now one heap object instead of four; the garbage collection time of a quality mesh is dominated by the number of live objects. - The temporary arrays of InCircleAdapt and CounterClockwiseAdapt (about 40 per call) moved to the thread-local workspace. - aCute wedge intersection: rotations computed once per call. Behavior unchanged (golden fingerprints identical). ALKIS tile, q30: snap 1 cm -5 %, grid 1 cm + wedge 3 cm -13 % (GC pauses 266 -> 166 ms, allocations 84 -> 56 MB). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/NewLocation.cs | 31 +++++++--- src/Triangle/RobustPredicates.cs | 82 +++++++++++++++++++++----- src/Triangle/Topology/Triangle.cs | 96 +++++++++++++++++++++++++++---- 3 files changed, 175 insertions(+), 34 deletions(-) diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 96d654b..bafd180 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -42,6 +42,8 @@ class NewLocation readonly double[] workDoSmoothing_possibilities = new double[6]; readonly double[] workGetStarPoints_returnPoint = new double[2]; readonly double[] workGetWedgeIntersectionWithoutMaxAngle_p1 = new double[3]; + readonly double[] workGetWedgeIntersectionWithoutMaxAngle_cos = new double[4]; + readonly double[] workGetWedgeIntersectionWithoutMaxAngle_sin = new double[4]; readonly double[] workGetWedgeIntersection_p1 = new double[3]; readonly double[] workGetWedgeIntersection_p2 = new double[3]; readonly double[] workGetWedgeIntersection_p3 = new double[3]; @@ -2520,6 +2522,17 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, // minimum angle alpha = behavior.MinAngle * Math.PI / 180.0; + + // The same rotations for every edge (computed once, the results are identical). + double cosA = Math.Cos(alpha), sinA = Math.Sin(alpha); + var cosJ = workGetWedgeIntersectionWithoutMaxAngle_cos; + var sinJ = workGetWedgeIntersectionWithoutMaxAngle_sin; + + for (j = 1; j < 4; j++) + { + cosJ[j] = Math.Cos((Math.PI / 3.0 - alpha) * j); + sinJ[j] = Math.Sin((Math.PI / 3.0 - alpha) * j); + } // initialize the constants if (behavior.goodAngle == 1.0) { @@ -2529,7 +2542,7 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, else { petalcenterconstant = 0.5 / Math.Tan(alpha); - petalradiusconstant = 0.5 / Math.Sin(alpha); + petalradiusconstant = 0.5 / sinA; } for (i = 0; i < numpoints * 2; i = i + 2) @@ -2578,8 +2591,8 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, ux = x1 - x0; uy = y1 - y0; // rotate the vector around p = (x0,y0) in ccw by alpha degrees - x_1 = x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha) + x0 - x0 * Math.Cos(alpha) + y0 * Math.Sin(alpha); - y_1 = x1 * Math.Sin(alpha) + y1 * Math.Cos(alpha) + y0 - x0 * Math.Sin(alpha) - y0 * Math.Cos(alpha); + x_1 = x1 * cosA - y1 * sinA + x0 - x0 * cosA + y0 * sinA; + y_1 = x1 * sinA + y1 * cosA + y0 - x0 * sinA - y0 * cosA; // add these to wedges list as lines in order wedges[i * 16] = x0; wedges[i * 16 + 1] = y0; wedges[i * 16 + 2] = x_1; wedges[i * 16 + 3] = y_1; @@ -2589,8 +2602,8 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, ux = x0 - x1; uy = y0 - y1; // rotate the vector around q = (x1,y1) in cw by alpha degrees - x_2 = x0 * Math.Cos(alpha) + y0 * Math.Sin(alpha) + x1 - x1 * Math.Cos(alpha) - y1 * Math.Sin(alpha); - y_2 = -x0 * Math.Sin(alpha) + y0 * Math.Cos(alpha) + y1 + x1 * Math.Sin(alpha) - y1 * Math.Cos(alpha); + x_2 = x0 * cosA + y0 * sinA + x1 - x1 * cosA - y1 * sinA; + y_2 = -x0 * sinA + y0 * cosA + y1 + x1 * sinA - y1 * cosA; // add these to wedges list as lines in order wedges[i * 16 + 4] = x_2; wedges[i * 16 + 5] = y_2; wedges[i * 16 + 6] = x1; wedges[i * 16 + 7] = y1; @@ -2603,8 +2616,8 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, for (j = 1; j < 4; j++) { // rotate the vector around (petalx,petaly) in cw by (60 - alpha)*j degrees - x_3 = x3 * Math.Cos((Math.PI / 3.0 - alpha) * j) + y3 * Math.Sin((Math.PI / 3.0 - alpha) * j) + petalx[i / 2] - petalx[i / 2] * Math.Cos((Math.PI / 3.0 - alpha) * j) - petaly[i / 2] * Math.Sin((Math.PI / 3.0 - alpha) * j); - y_3 = -x3 * Math.Sin((Math.PI / 3.0 - alpha) * j) + y3 * Math.Cos((Math.PI / 3.0 - alpha) * j) + petaly[i / 2] + petalx[i / 2] * Math.Sin((Math.PI / 3.0 - alpha) * j) - petaly[i / 2] * Math.Cos((Math.PI / 3.0 - alpha) * j); + x_3 = x3 * cosJ[j] + y3 * sinJ[j] + petalx[i / 2] - petalx[i / 2] * cosJ[j] - petaly[i / 2] * sinJ[j]; + y_3 = -x3 * sinJ[j] + y3 * cosJ[j] + petaly[i / 2] + petalx[i / 2] * sinJ[j] - petaly[i / 2] * cosJ[j]; // add these to wedges list as lines in order wedges[i * 16 + 8 + 4 * (j - 1)] = x_3; wedges[i * 16 + 9 + 4 * (j - 1)] = y_3; wedges[i * 16 + 10 + 4 * (j - 1)] = tempx; wedges[i * 16 + 11 + 4 * (j - 1)] = tempy; @@ -2615,8 +2628,8 @@ private bool GetWedgeIntersectionWithoutMaxAngle(int numpoints, for (j = 1; j < 4; j++) { // rotate the vector around (petalx,petaly) in ccw by (60 - alpha)*j degrees - x_4 = x3 * Math.Cos((Math.PI / 3.0 - alpha) * j) - y3 * Math.Sin((Math.PI / 3.0 - alpha) * j) + petalx[i / 2] - petalx[i / 2] * Math.Cos((Math.PI / 3.0 - alpha) * j) + petaly[i / 2] * Math.Sin((Math.PI / 3.0 - alpha) * j); - y_4 = x3 * Math.Sin((Math.PI / 3.0 - alpha) * j) + y3 * Math.Cos((Math.PI / 3.0 - alpha) * j) + petaly[i / 2] - petalx[i / 2] * Math.Sin((Math.PI / 3.0 - alpha) * j) - petaly[i / 2] * Math.Cos((Math.PI / 3.0 - alpha) * j); + x_4 = x3 * cosJ[j] - y3 * sinJ[j] + petalx[i / 2] - petalx[i / 2] * cosJ[j] + petaly[i / 2] * sinJ[j]; + y_4 = x3 * sinJ[j] + y3 * cosJ[j] + petaly[i / 2] - petalx[i / 2] * sinJ[j] - petaly[i / 2] * cosJ[j]; // add these to wedges list as lines in order wedges[i * 16 + 20 + 4 * (j - 1)] = tempx; wedges[i * 16 + 21 + 4 * (j - 1)] = tempy; diff --git a/src/Triangle/RobustPredicates.cs b/src/Triangle/RobustPredicates.cs index 24dd1a8..eac9431 100644 --- a/src/Triangle/RobustPredicates.cs +++ b/src/Triangle/RobustPredicates.cs @@ -641,8 +641,9 @@ private double CounterClockwiseAdapt(Point pa, Point pb, Point pc, double detsum double det, errbound; // Edited to work around index out of range exceptions (changed array length from 4 to 5). // See unsafe indexing in FastExpansionSumZeroElim. - double[] B = new double[5], u = new double[5]; - double[] C1 = new double[8], C2 = new double[12], D = new double[16]; + var w = Workspace.Current; + double[] B = w.ccwB, u = w.ccwU; + double[] C1 = w.ccwC1, C2 = w.ccwC2, D = w.ccwD; double B3; int C1length, C2length, Dlength; @@ -746,7 +747,7 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm double bdxcdy1, cdxbdy1, cdxady1, adxcdy1, adxbdy1, bdxady1; double bdxcdy0, cdxbdy0, cdxady0, adxcdy0, adxbdy0, bdxady0; - double[] bc = new double[4], ca = new double[4], ab = new double[4]; + double[] bc = w.bc, ca = w.ca, ab = w.ab; double bc3, ca3, ab3; int axbclen, axxbclen, aybclen, ayybclen, alen; int bxcalen, bxxcalen, bycalen, byycalen, blen; @@ -758,32 +759,32 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm double adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; double adxadx1, adyady1, bdxbdx1, bdybdy1, cdxcdx1, cdycdy1; double adxadx0, adyady0, bdxbdx0, bdybdy0, cdxcdx0, cdycdy0; - double[] aa = new double[4], bb = new double[4], cc = new double[4]; + double[] aa = w.aa, bb = w.bb, cc = w.cc; double aa3, bb3, cc3; double ti1, tj1; double ti0, tj0; // Edited to work around index out of range exceptions (changed array length from 4 to 5). // See unsafe indexing in FastExpansionSumZeroElim. - double[] u = new double[5], v = new double[5]; + double[] u = w.u, v = w.v; double u3, v3; int temp8len, temp16alen, temp16blen, temp16clen; int temp32alen, temp32blen, temp48len, temp64len; - double[] axtbb = new double[8], axtcc = new double[8], aytbb = new double[8], aytcc = new double[8]; + double[] axtbb = w.axtbb, axtcc = w.axtcc, aytbb = w.aytbb, aytcc = w.aytcc; int axtbblen, axtcclen, aytbblen, aytcclen; - double[] bxtaa = new double[8], bxtcc = new double[8], bytaa = new double[8], bytcc = new double[8]; + double[] bxtaa = w.bxtaa, bxtcc = w.bxtcc, bytaa = w.bytaa, bytcc = w.bytcc; int bxtaalen, bxtcclen, bytaalen, bytcclen; - double[] cxtaa = new double[8], cxtbb = new double[8], cytaa = new double[8], cytbb = new double[8]; + double[] cxtaa = w.cxtaa, cxtbb = w.cxtbb, cytaa = w.cytaa, cytbb = w.cytbb; int cxtaalen, cxtbblen, cytaalen, cytbblen; - double[] axtbc = new double[8], aytbc = new double[8], bxtca = new double[8], bytca = new double[8], cxtab = new double[8], cytab = new double[8]; + double[] axtbc = w.axtbc, aytbc = w.aytbc, bxtca = w.bxtca, bytca = w.bytca, cxtab = w.cxtab, cytab = w.cytab; int axtbclen = 0, aytbclen = 0, bxtcalen = 0, bytcalen = 0, cxtablen = 0, cytablen = 0; - double[] axtbct = new double[16], aytbct = new double[16], bxtcat = new double[16], bytcat = new double[16], cxtabt = new double[16], cytabt = new double[16]; + double[] axtbct = w.axtbct, aytbct = w.aytbct, bxtcat = w.bxtcat, bytcat = w.bytcat, cxtabt = w.cxtabt, cytabt = w.cytabt; int axtbctlen, aytbctlen, bxtcatlen, bytcatlen, cxtabtlen, cytabtlen; - double[] axtbctt = new double[8], aytbctt = new double[8], bxtcatt = new double[8]; - double[] bytcatt = new double[8], cxtabtt = new double[8], cytabtt = new double[8]; + double[] axtbctt = w.axtbctt, aytbctt = w.aytbctt, bxtcatt = w.bxtcatt; + double[] bytcatt = w.bytcatt, cxtabtt = w.cxtabtt, cytabtt = w.cytabtt; int axtbcttlen, aytbcttlen, bxtcattlen, bytcattlen, cxtabttlen, cytabttlen; - double[] abt = new double[8], bct = new double[8], cat = new double[8]; + double[] abt = w.abt, bct = w.bct, cat = w.cat; int abtlen, bctlen, catlen; - double[] abtt = new double[4], bctt = new double[4], catt = new double[4]; + double[] abtt = w.abtt, bctt = w.bctt, catt = w.catt; int abttlen, bcttlen, cattlen; double abtt3, bctt3, catt3; double negate; @@ -1252,7 +1253,7 @@ private double InCircleAdapt(Point pa, Point pb, Point pc, Point pd, double perm #region Workspace /// - /// Workspace of the InCircleAdapt method. The workspace is thread-local, so a + /// Workspace of the adaptive predicates. The workspace is thread-local, so a /// single instance can be used from multiple threads. /// private sealed class Workspace @@ -1270,6 +1271,57 @@ private sealed class Workspace public readonly double[] temp8 = new double[8], temp16a = new double[16], temp16b = new double[16], temp16c = new double[16]; public readonly double[] temp32a = new double[32], temp32b = new double[32], temp48 = new double[48], temp64 = new double[64]; + + // Formerly local arrays of InCircleAdapt (allocated on every call; like in the + // original C code, they are always written before they are read). + public readonly double[] bc = new double[4]; + public readonly double[] ca = new double[4]; + public readonly double[] ab = new double[4]; + public readonly double[] aa = new double[4]; + public readonly double[] bb = new double[4]; + public readonly double[] cc = new double[4]; + public readonly double[] u = new double[5]; + public readonly double[] v = new double[5]; + public readonly double[] axtbb = new double[8]; + public readonly double[] axtcc = new double[8]; + public readonly double[] aytbb = new double[8]; + public readonly double[] aytcc = new double[8]; + public readonly double[] bxtaa = new double[8]; + public readonly double[] bxtcc = new double[8]; + public readonly double[] bytaa = new double[8]; + public readonly double[] bytcc = new double[8]; + public readonly double[] cxtaa = new double[8]; + public readonly double[] cxtbb = new double[8]; + public readonly double[] cytaa = new double[8]; + public readonly double[] cytbb = new double[8]; + public readonly double[] axtbc = new double[8]; + public readonly double[] aytbc = new double[8]; + public readonly double[] bxtca = new double[8]; + public readonly double[] bytca = new double[8]; + public readonly double[] cxtab = new double[8]; + public readonly double[] cytab = new double[8]; + public readonly double[] axtbct = new double[16]; + public readonly double[] aytbct = new double[16]; + public readonly double[] bxtcat = new double[16]; + public readonly double[] bytcat = new double[16]; + public readonly double[] cxtabt = new double[16]; + public readonly double[] cytabt = new double[16]; + public readonly double[] axtbctt = new double[8]; + public readonly double[] aytbctt = new double[8]; + public readonly double[] bxtcatt = new double[8]; + public readonly double[] bytcatt = new double[8]; + public readonly double[] cxtabtt = new double[8]; + public readonly double[] cytabtt = new double[8]; + public readonly double[] abt = new double[8]; + public readonly double[] bct = new double[8]; + public readonly double[] cat = new double[8]; + public readonly double[] abtt = new double[4]; + public readonly double[] bctt = new double[4]; + public readonly double[] catt = new double[4]; + + // Formerly local arrays of CounterClockwiseAdapt. + public readonly double[] ccwB = new double[5], ccwU = new double[5]; + public readonly double[] ccwC1 = new double[8], ccwC2 = new double[12], ccwD = new double[16]; } #endregion diff --git a/src/Triangle/Topology/Triangle.cs b/src/Triangle/Topology/Triangle.cs index 9d4c82d..2b64b87 100644 --- a/src/Triangle/Topology/Triangle.cs +++ b/src/Triangle/Topology/Triangle.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Topology { using System; + using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -21,9 +22,27 @@ public class Triangle : ITriangle // The ID is only used for mesh output. internal int id; - internal Otri[] neighbors; - internal Vertex[] vertices; - internal Osub[] subsegs; + // The vertices, adjoining triangles and subsegments are stored inline (as arrays, a + // triangle consisted of four objects on the heap, which made up more than half of all + // allocations of a quality mesh and a large part of the garbage collection time). + private Vertex vertex0, vertex1, vertex2; + private Otri neighbor0, neighbor1, neighbor2; + private Osub subseg0, subseg1, subseg2; + + /// + /// The three vertices (indexed like an array). + /// + internal VertexList vertices => new VertexList(this); + + /// + /// The three adjoining triangles (indexed like an array). + /// + internal NeighborList neighbors => new NeighborList(this); + + /// + /// The three adjoining subsegments (indexed like an array). + /// + internal SubsegList subsegs => new SubsegList(this); internal int label; internal double area; internal bool infected; @@ -33,16 +52,73 @@ public class Triangle : ITriangle /// public Triangle() { - // Three NULL vertices. - vertices = new Vertex[3]; + // The vertices, adjoining subsegments and triangles are null (default). + } - // Initialize the three adjoining subsegments to be the omnipresent subsegment. - subsegs = new Osub[3]; + internal readonly struct VertexList + { + private readonly Triangle t; + + public VertexList(Triangle t) { this.t = t; } + + public ref Vertex this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref t.vertex0; + case 1: return ref t.vertex1; + case 2: return ref t.vertex2; + default: throw new IndexOutOfRangeException(); + } + } + } + } - // Initialize the three adjoining triangles to be "outer space". - neighbors = new Otri[3]; + internal readonly struct NeighborList + { + private readonly Triangle t; + + public NeighborList(Triangle t) { this.t = t; } + + public ref Otri this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref t.neighbor0; + case 1: return ref t.neighbor1; + case 2: return ref t.neighbor2; + default: throw new IndexOutOfRangeException(); + } + } + } + } - // area = -1.0; + internal readonly struct SubsegList + { + private readonly Triangle t; + + public SubsegList(Triangle t) { this.t = t; } + + public ref Osub this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref t.subseg0; + case 1: return ref t.subseg1; + case 2: return ref t.subseg2; + default: throw new IndexOutOfRangeException(); + } + } + } } #region Public properties From fa298f0ed9a0ce43b9a5bdc0428d346aea3a14c7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 11:18:14 +0000 Subject: [PATCH 25/50] SubSegment: inline fields instead of arrays (like Triangle) Fewer heap objects per subsegment; about 5 % fewer allocations, no measurable time difference on the ALKIS tiles. Behavior unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/Topology/SubSegment.cs | 96 +++++++++++++++++++++++++---- 1 file changed, 84 insertions(+), 12 deletions(-) diff --git a/src/Triangle/Topology/SubSegment.cs b/src/Triangle/Topology/SubSegment.cs index d12752e..1af2895 100644 --- a/src/Triangle/Topology/SubSegment.cs +++ b/src/Triangle/Topology/SubSegment.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Topology { using System; + using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -18,28 +19,99 @@ public class SubSegment : ISegment // Hash for dictionary. Will be set by mesh instance. internal int hash; - internal Osub[] subsegs; - internal Vertex[] vertices; - internal Otri[] triangles; + // Stored inline instead of arrays (fewer objects on the heap, see Triangle). + private Osub subseg0, subseg1; + private Vertex vertex0, vertex1, vertex2, vertex3; + private Otri triangle0, triangle1; internal int boundary; + /// + /// The two adjoining subsegments (indexed like an array). + /// + internal SubsegList subsegs => new SubsegList(this); + + /// + /// The endpoints (0, 1) and the endpoints of the input segment (2, 3). + /// + internal VertexList vertices => new VertexList(this); + + /// + /// The two adjoining triangles (indexed like an array). + /// + internal TriangleList triangles => new TriangleList(this); + /// /// Initializes a new instance of the class. /// public SubSegment() { - // Four NULL vertices. - vertices = new Vertex[4]; + // The vertices, adjoining subsegments and triangles are null (default), the + // boundary marker is zero. + } - // Set the boundary marker to zero. - boundary = 0; + internal readonly struct SubsegList + { + private readonly SubSegment s; + + public SubsegList(SubSegment s) { this.s = s; } + + public ref Osub this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref s.subseg0; + case 1: return ref s.subseg1; + default: throw new IndexOutOfRangeException(); + } + } + } + } - // Initialize the two adjoining subsegments to be the omnipresent - // subsegment. - subsegs = new Osub[2]; + internal readonly struct VertexList + { + private readonly SubSegment s; + + public VertexList(SubSegment s) { this.s = s; } + + public ref Vertex this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref s.vertex0; + case 1: return ref s.vertex1; + case 2: return ref s.vertex2; + case 3: return ref s.vertex3; + default: throw new IndexOutOfRangeException(); + } + } + } + } - // Initialize the two adjoining triangles to be "outer space." - triangles = new Otri[2]; + internal readonly struct TriangleList + { + private readonly SubSegment s; + + public TriangleList(SubSegment s) { this.s = s; } + + public ref Otri this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get + { + switch (index) + { + case 0: return ref s.triangle0; + case 1: return ref s.triangle1; + default: throw new IndexOutOfRangeException(); + } + } + } } #region Public properties From 3188939591a3f6993db8d4ecfffc2472f2e0f01e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 11:40:25 +0000 Subject: [PATCH 26/50] Use InlineArray for triangle and subsegment fields on .NET 8+ The library now also targets net8.0. There, the vertices, neighbors and subsegments of triangles and subsegments are [InlineArray] buffers (array indexing, no separate heap objects). netstandard2.0 keeps plain arrays. This replaces the ref-returning accessors, which were slower than arrays for small, CPU-bound meshes. CounterClockwiseAdapt keeps its local arrays (it is called very often for collinear input). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/RobustPredicates.cs | 11 +-- src/Triangle/Topology/InlineBuffers.cs | 33 ++++++++ src/Triangle/Topology/SubSegment.cs | 93 +++-------------------- src/Triangle/Topology/Triangle.cs | 100 +++---------------------- src/Triangle/Triangle.csproj | 2 +- 5 files changed, 59 insertions(+), 180 deletions(-) create mode 100644 src/Triangle/Topology/InlineBuffers.cs diff --git a/src/Triangle/RobustPredicates.cs b/src/Triangle/RobustPredicates.cs index eac9431..b8e01d1 100644 --- a/src/Triangle/RobustPredicates.cs +++ b/src/Triangle/RobustPredicates.cs @@ -641,9 +641,10 @@ private double CounterClockwiseAdapt(Point pa, Point pb, Point pc, double detsum double det, errbound; // Edited to work around index out of range exceptions (changed array length from 4 to 5). // See unsafe indexing in FastExpansionSumZeroElim. - var w = Workspace.Current; - double[] B = w.ccwB, u = w.ccwU; - double[] C1 = w.ccwC1, C2 = w.ccwC2, D = w.ccwD; + // Local arrays: this is called very often for collinear input, where the access to + // the thread-local workspace costs more than allocating the small arrays. + double[] B = new double[5], u = new double[5]; + double[] C1 = new double[8], C2 = new double[12], D = new double[16]; double B3; int C1length, C2length, Dlength; @@ -1318,10 +1319,6 @@ private sealed class Workspace public readonly double[] abtt = new double[4]; public readonly double[] bctt = new double[4]; public readonly double[] catt = new double[4]; - - // Formerly local arrays of CounterClockwiseAdapt. - public readonly double[] ccwB = new double[5], ccwU = new double[5]; - public readonly double[] ccwC1 = new double[8], ccwC2 = new double[12], ccwD = new double[16]; } #endregion diff --git a/src/Triangle/Topology/InlineBuffers.cs b/src/Triangle/Topology/InlineBuffers.cs new file mode 100644 index 0000000..aa4f22e --- /dev/null +++ b/src/Triangle/Topology/InlineBuffers.cs @@ -0,0 +1,33 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET Copyright (c) 2012-2022 Christian Woltering +// +// ----------------------------------------------------------------------- + +#if NET8_0_OR_GREATER +namespace TriangleNet.Topology +{ + using System.Runtime.CompilerServices; + + // Fixed size arrays stored inline in the triangle and subsegment objects (no separate + // objects on the heap). Indexed like arrays. + + [InlineArray(2)] + internal struct Buffer2 + { + private T element; + } + + [InlineArray(3)] + internal struct Buffer3 + { + private T element; + } + + [InlineArray(4)] + internal struct Buffer4 + { + private T element; + } +} +#endif diff --git a/src/Triangle/Topology/SubSegment.cs b/src/Triangle/Topology/SubSegment.cs index 1af2895..359cde0 100644 --- a/src/Triangle/Topology/SubSegment.cs +++ b/src/Triangle/Topology/SubSegment.cs @@ -8,7 +8,6 @@ namespace TriangleNet.Topology { using System; - using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -19,27 +18,18 @@ public class SubSegment : ISegment // Hash for dictionary. Will be set by mesh instance. internal int hash; +#if NET8_0_OR_GREATER // Stored inline instead of arrays (fewer objects on the heap, see Triangle). - private Osub subseg0, subseg1; - private Vertex vertex0, vertex1, vertex2, vertex3; - private Otri triangle0, triangle1; + internal Buffer2 subsegs; + internal Buffer4 vertices; + internal Buffer2 triangles; +#else + internal Osub[] subsegs = new Osub[2]; + internal Vertex[] vertices = new Vertex[4]; + internal Otri[] triangles = new Otri[2]; +#endif internal int boundary; - /// - /// The two adjoining subsegments (indexed like an array). - /// - internal SubsegList subsegs => new SubsegList(this); - - /// - /// The endpoints (0, 1) and the endpoints of the input segment (2, 3). - /// - internal VertexList vertices => new VertexList(this); - - /// - /// The two adjoining triangles (indexed like an array). - /// - internal TriangleList triangles => new TriangleList(this); - /// /// Initializes a new instance of the class. /// @@ -49,71 +39,6 @@ public SubSegment() // boundary marker is zero. } - internal readonly struct SubsegList - { - private readonly SubSegment s; - - public SubsegList(SubSegment s) { this.s = s; } - - public ref Osub this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref s.subseg0; - case 1: return ref s.subseg1; - default: throw new IndexOutOfRangeException(); - } - } - } - } - - internal readonly struct VertexList - { - private readonly SubSegment s; - - public VertexList(SubSegment s) { this.s = s; } - - public ref Vertex this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref s.vertex0; - case 1: return ref s.vertex1; - case 2: return ref s.vertex2; - case 3: return ref s.vertex3; - default: throw new IndexOutOfRangeException(); - } - } - } - } - - internal readonly struct TriangleList - { - private readonly SubSegment s; - - public TriangleList(SubSegment s) { this.s = s; } - - public ref Otri this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref s.triangle0; - case 1: return ref s.triangle1; - default: throw new IndexOutOfRangeException(); - } - } - } - } - #region Public properties /// diff --git a/src/Triangle/Topology/Triangle.cs b/src/Triangle/Topology/Triangle.cs index 2b64b87..2768076 100644 --- a/src/Triangle/Topology/Triangle.cs +++ b/src/Triangle/Topology/Triangle.cs @@ -8,7 +8,6 @@ namespace TriangleNet.Topology { using System; - using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -22,27 +21,18 @@ public class Triangle : ITriangle // The ID is only used for mesh output. internal int id; - // The vertices, adjoining triangles and subsegments are stored inline (as arrays, a - // triangle consisted of four objects on the heap, which made up more than half of all - // allocations of a quality mesh and a large part of the garbage collection time). - private Vertex vertex0, vertex1, vertex2; - private Otri neighbor0, neighbor1, neighbor2; - private Osub subseg0, subseg1, subseg2; - - /// - /// The three vertices (indexed like an array). - /// - internal VertexList vertices => new VertexList(this); - - /// - /// The three adjoining triangles (indexed like an array). - /// - internal NeighborList neighbors => new NeighborList(this); - - /// - /// The three adjoining subsegments (indexed like an array). - /// - internal SubsegList subsegs => new SubsegList(this); +#if NET8_0_OR_GREATER + // The vertices, adjoining triangles and subsegments are stored inline. With arrays, a + // triangle consists of four objects on the heap, which make up more than half of all + // allocations of a quality mesh and a large part of the garbage collection time. + internal Buffer3 vertices; + internal Buffer3 neighbors; + internal Buffer3 subsegs; +#else + internal Vertex[] vertices = new Vertex[3]; + internal Otri[] neighbors = new Otri[3]; + internal Osub[] subsegs = new Osub[3]; +#endif internal int label; internal double area; internal bool infected; @@ -55,72 +45,6 @@ public Triangle() // The vertices, adjoining subsegments and triangles are null (default). } - internal readonly struct VertexList - { - private readonly Triangle t; - - public VertexList(Triangle t) { this.t = t; } - - public ref Vertex this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref t.vertex0; - case 1: return ref t.vertex1; - case 2: return ref t.vertex2; - default: throw new IndexOutOfRangeException(); - } - } - } - } - - internal readonly struct NeighborList - { - private readonly Triangle t; - - public NeighborList(Triangle t) { this.t = t; } - - public ref Otri this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref t.neighbor0; - case 1: return ref t.neighbor1; - case 2: return ref t.neighbor2; - default: throw new IndexOutOfRangeException(); - } - } - } - } - - internal readonly struct SubsegList - { - private readonly Triangle t; - - public SubsegList(Triangle t) { this.t = t; } - - public ref Osub this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - switch (index) - { - case 0: return ref t.subseg0; - case 1: return ref t.subseg1; - case 2: return ref t.subseg2; - default: throw new IndexOutOfRangeException(); - } - } - } - } - #region Public properties /// diff --git a/src/Triangle/Triangle.csproj b/src/Triangle/Triangle.csproj index 7c1fb3f..aed2c6e 100644 --- a/src/Triangle/Triangle.csproj +++ b/src/Triangle/Triangle.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0;net8.0 TriangleNet Triangle AnyCPU;x64 From 6bb8b7d0856f5ead31b375afdbe6cd0b59ebac8f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 03:23:31 +0000 Subject: [PATCH 27/50] aCute star walk: stop at two triangles sharing two edges Taken from the SoftSmile-Inc fork: with invalid topology the walk around a vertex went back and forth between two triangles until the work array was full. Never triggers in valid meshes (a free vertex has at least three incident triangles). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/NewLocation.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index bafd180..78e3faa 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -2336,6 +2336,7 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r, break; } tempotri = badotri; + Otri previous = tempotri; // add first point as the end of first edge points[numvertices] = second_x; numvertices++; @@ -2349,6 +2350,18 @@ private int GetStarPoints(Otri badotri, Vertex p, Vertex q, Vertex r, // find the neighbor's third point where it is incident to given edge if (!GetNeighborsVertex(tempotri, first_x, first_y, second_x, second_y, ref returnPoint, ref neighotri)) { + // Two triangles sharing two edges (invalid topology) would be visited back + // and forth. A free vertex has at least three triangles around it, so in a + // valid mesh the walk never returns to the previous triangle. (From the + // SoftSmile-Inc fork of Triangle.NET.) + if (neighotri.tri == previous.tri) + { + numvertices = 0; + break; + } + + previous = tempotri; + // go to next triangle tempotri = neighotri; // now the second point is the neighbor's third vertex From a1c2e15ddcca241a0054e3d980f029a491279755 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 03:43:33 +0000 Subject: [PATCH 28/50] Tests with standard CDT benchmark data - 1000 hard orient2d and 1000 hard incircle cases (Nanevski et al.) with the expected sign: all correct. - Ruppert's maple leaf (Canadian flag) at 0/20/30/33 degrees. - Synthetic edge cases: grids (cocircular, deterministic, Delaunay with all three triangulators, also at UTM coordinates), grid with diagonal constraints and quality, concentric circles with and without hole (constraints separate inside and outside), spiky stars with tip angles down to 1e-15 rad at three scales. - Corpus readers for Natural Earth coastlines (LineStrings) and the test inputs of artem-ogre/CDT (TRIANGLE_NATURAL_EARTH, TRIANGLE_CDT_INPUTS). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Tests/Corpus/CorpusReaders.cs | 52 + src/Triangle.Tests/Corpus/CorpusTest.cs | 39 + .../Robustness/BenchmarkDatasetsTest.cs | 374 ++++++ src/Triangle.Tests/Robustness/Data/README.md | 12 + .../Robustness/Data/incircle.txt | 1000 +++++++++++++++++ .../Robustness/Data/maple-leaf.txt | 53 + .../Robustness/Data/orient2d.txt | 1000 +++++++++++++++++ src/Triangle.Tests/Triangle.Tests.csproj | 1 + 8 files changed, 2531 insertions(+) create mode 100644 src/Triangle.Tests/Robustness/BenchmarkDatasetsTest.cs create mode 100644 src/Triangle.Tests/Robustness/Data/README.md create mode 100644 src/Triangle.Tests/Robustness/Data/incircle.txt create mode 100644 src/Triangle.Tests/Robustness/Data/maple-leaf.txt create mode 100644 src/Triangle.Tests/Robustness/Data/orient2d.txt diff --git a/src/Triangle.Tests/Corpus/CorpusReaders.cs b/src/Triangle.Tests/Corpus/CorpusReaders.cs index 7e7521b..5532116 100644 --- a/src/Triangle.Tests/Corpus/CorpusReaders.cs +++ b/src/Triangle.Tests/Corpus/CorpusReaders.cs @@ -102,6 +102,15 @@ public static void AddWkt(CorpusCase c, string wkt) { foreach (var polygon in coordinates.EnumerateArray()) AddPolygon(rings, polygon); } + else if (type == "LineString") + { + // Polylines (e.g. coastlines) are returned like rings. + rings.Add(coordinates.EnumerateArray().Select(p => (p[0].GetDouble(), p[1].GetDouble())).ToList()); + } + else if (type == "MultiLineString") + { + AddPolygon(rings, coordinates); + } } return rings; @@ -115,6 +124,49 @@ private static void AddPolygon(List> rings, JsonEleme } } + /// + /// Read the test inputs of the CDT library (https://github.com/artem-ogre/CDT, + /// CDT/tests/inputs): number of vertices and edges, the vertex coordinates, the edges + /// as pairs of vertex indices. + /// + public static IEnumerable ReadCdtInputs(string directory) + { + foreach (var path in Directory.GetFiles(directory, "*.txt").OrderBy(p => p, StringComparer.Ordinal)) + { + var tokens = File.ReadAllText(path).Split(new[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + + if (tokens.Length < 2 || !int.TryParse(tokens[0], out int nv) || !int.TryParse(tokens[1], out int ne) || + tokens.Length < 2 + 2 * nv + 2 * ne) + { + continue; + } + + var c = new CorpusCase { Name = "cdt/" + Path.GetFileName(path) }; + var points = new List<(double X, double Y)>(nv); + + for (int i = 0; i < nv; i++) + { + points.Add((double.Parse(tokens[2 + 2 * i], CultureInfo.InvariantCulture), + double.Parse(tokens[3 + 2 * i], CultureInfo.InvariantCulture))); + } + + c.Points.AddRange(points); + + for (int e = 0; e < ne; e++) + { + int a = int.Parse(tokens[2 + 2 * nv + 2 * e], CultureInfo.InvariantCulture); + int b = int.Parse(tokens[3 + 2 * nv + 2 * e], CultureInfo.InvariantCulture); + + if (a >= 0 && a < nv && b >= 0 && b < nv) + { + c.Lines.Add(new List<(double X, double Y)> { points[a], points[b] }); + } + } + + yield return c; + } + } + /// /// Read points of an xyz file (e.g. DGM1 NRW, optionally gzip compressed) inside the given window. /// diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index 3b29946..d484248 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -23,6 +23,10 @@ namespace TriangleNet.Tests.Corpus /// https://www.opengeodata.nrw.de (Liegenschaftskataster) or the /// open data portals of NRW cities /// TRIANGLE_NRW_DGM DGM1 xyz(.gz) tile from https://www.opengeodata.nrw.de (dgm1_xyz) + /// TRIANGLE_NATURAL_EARTH directory with ne_*_coastline.geojson (Natural Earth, public domain, + /// https://github.com/nvkelso/natural-earth-vector/tree/master/geojson) + /// TRIANGLE_CDT_INPUTS directory CDT/tests/inputs of https://github.com/artem-ogre/CDT + /// (edge cases: hanging and overlapping constraints, points on edges, ...) /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) @@ -54,6 +58,41 @@ public void GeosXmlTestSuite() RunCases(CorpusReaders.ReadGeosXml(directory)); } + [Test] + public void NaturalEarthCoastlines() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_NATURAL_EARTH"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_NATURAL_EARTH not set."); + } + + // Each file as a whole (ne_10m: about 410,000 vertices and constraints). + var cases = Directory.GetFiles(directory, "ne_*_coastline.geojson").OrderBy(p => p, StringComparer.Ordinal) + .Select(path => + { + var c = new CorpusCase { Name = Path.GetFileName(path) }; + c.Lines.AddRange(CorpusReaders.ReadGeoJsonRings(path)); + return c; + }).ToList(); + + RunCases(cases); + } + + [Test] + public void CdtLibraryInputs() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_CDT_INPUTS"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_CDT_INPUTS not set."); + } + + RunCases(CorpusReaders.ReadCdtInputs(directory)); + } + [Test] public void NrwParcels() { diff --git a/src/Triangle.Tests/Robustness/BenchmarkDatasetsTest.cs b/src/Triangle.Tests/Robustness/BenchmarkDatasetsTest.cs new file mode 100644 index 0000000..549a118 --- /dev/null +++ b/src/Triangle.Tests/Robustness/BenchmarkDatasetsTest.cs @@ -0,0 +1,374 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tests.Characterization; +using TriangleNet.Tests.Corpus; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Standard benchmarks for (constrained) Delaunay triangulation: hard predicate cases, + /// Ruppert's maple leaf, and synthetic edge cases (grid, concentric circles, spiky star). + /// Larger external data (Natural Earth coastlines, the test inputs of artem-ogre/CDT) are + /// in . + /// + public class BenchmarkDatasetsTest + { + private static readonly string DataDirectory = + Path.Combine(Path.GetDirectoryName(typeof(BenchmarkDatasetsTest).Assembly.Location), "Robustness", "Data"); + + #region Predicates + + private static IEnumerable<(int Index, double[] C, int Sign)> Fixtures(string name, int n) + { + foreach (var line in File.ReadLines(Path.Combine(DataDirectory, name))) + { + var t = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); + + if (t.Length != n + 2) continue; + + var c = t.Skip(1).Take(n).Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); + + yield return (int.Parse(t[0], CultureInfo.InvariantCulture), c, int.Parse(t[n + 1], CultureInfo.InvariantCulture)); + } + } + + [Test] + public void Orient2dHardCases() + { + var predicates = new RobustPredicates(); + var fixtures = Fixtures("orient2d.txt", 6).ToList(); + + Assert.That(fixtures.Count, Is.EqualTo(1000)); + + var wrong = fixtures.Where(f => Math.Sign(predicates.CounterClockwise( + new Point(f.C[0], f.C[1]), new Point(f.C[2], f.C[3]), new Point(f.C[4], f.C[5]))) != f.Sign) + .Select(f => f.Index).ToList(); + + Assert.That(wrong, Is.Empty); + } + + [Test] + public void InCircleHardCases() + { + var predicates = new RobustPredicates(); + var fixtures = Fixtures("incircle.txt", 8).ToList(); + + Assert.That(fixtures.Count, Is.EqualTo(1000)); + + var wrong = fixtures.Where(f => Math.Sign(predicates.InCircle( + new Point(f.C[0], f.C[1]), new Point(f.C[2], f.C[3]), new Point(f.C[4], f.C[5]), new Point(f.C[6], f.C[7]))) != f.Sign) + .Select(f => f.Index).ToList(); + + Assert.That(wrong, Is.Empty); + } + + #endregion + + #region Maple leaf + + private static Polygon MapleLeaf() + { + var c = CorpusCase.Load(Path.Combine(DataDirectory, "maple-leaf.txt")); + var poly = new Polygon(); + var map = new Dictionary<(double, double), Vertex>(); + + Vertex V((double, double) p) + { + if (!map.TryGetValue(p, out var v)) + { + map[p] = v = new Vertex(p.Item1, p.Item2); + poly.Add(v); + } + + return v; + } + + foreach (var line in c.Lines) + { + for (int i = 0; i + 1 < line.Count; i++) + { + poly.Add(new Segment(V(line[i]), V(line[i + 1]))); + } + } + + return poly; + } + + [TestCase(0)] + [TestCase(20)] + [TestCase(30)] + [TestCase(33)] + public void MapleLeaf(double angle) + { + var poly = MapleLeaf(); + + var mesh = (Mesh)MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + angle > 0 ? new QualityOptions { MinimumAngle = angle } : null)); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + + if (angle > 0) + { + // Bad triangles only at small input angles (the leaf has sharp notches). + int bad = mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < angle - 0.01); + Assert.That(bad, Is.LessThanOrEqualTo(Math.Max(10, mesh.Triangles.Count / 100)), $"{bad} of {mesh.Triangles.Count} triangles"); + } + } + + #endregion + + #region Grid + + private static List Grid(int n, double spacing = 1.0, double x0 = 0, double y0 = 0) + { + var points = new List(); + + for (int i = 0; i < n; i++) + { + for (int j = 0; j < n; j++) + { + points.Add(new Vertex(x0 + i * spacing, y0 + j * spacing)); + } + } + + return points; + } + + [TestCase(10, 1.0, 0, 0)] + [TestCase(10, 0.1, 0, 0)] + [TestCase(10, 1.0, 372000, 5710000)] + [TestCase(100, 1.0, 372000, 5710000)] + public void GridIsDeterministicAndDelaunay(int n, double spacing, double x0, double y0) + { + // All squares are cocircular: the diagonals are arbitrary but must be chosen + // consistently (same result for the same input, valid in any order). + var first = (Mesh)new GenericMesher().Triangulate(Grid(n, spacing, x0, y0)); + var second = (Mesh)new GenericMesher().Triangulate(Grid(n, spacing, x0, y0)); + + MeshAssert.IsValid(first); + Assert.That(MeshInvariants.Fingerprint(first), Is.EqualTo(MeshInvariants.Fingerprint(second))); + Assert.That(first.Triangles.Count, Is.EqualTo(2 * (n - 1) * (n - 1))); + + var random = new Random(n); + var shuffled = Grid(n, spacing, x0, y0).OrderBy(_ => random.Next()).ToList(); + + foreach (var algorithm in new ITriangulator[] { new TriangleNet.Meshing.Algorithm.Dwyer(), + new TriangleNet.Meshing.Algorithm.Incremental(), new TriangleNet.Meshing.Algorithm.SweepLine() }) + { + var mesh = (Mesh)algorithm.Triangulate(shuffled, new Configuration()); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Count, Is.EqualTo(2 * (n - 1) * (n - 1)), algorithm.GetType().Name); + Assert.That(MeshValidator.IsDelaunay(mesh), Is.True, algorithm.GetType().Name); + } + } + + [Test] + public void GridWithConstraintsAndQuality() + { + // Diagonal constraints through cocircular grid points. + var poly = new Polygon(); + poly.Points.AddRange(Grid(10)); + poly.Add(new Segment(new Vertex(0, 0), new Vertex(9, 9)), true); + poly.Add(new Segment(new Vertex(0, 9), new Vertex(9, 0)), true); + + var mesh = (Mesh)MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { Convex = true }, + new QualityOptions { MinimumAngle = 30 })); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + MeshAssert.HasArea(mesh, 81); + Assert.That(mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < 29.99), Is.EqualTo(0)); + } + + #endregion + + #region Concentric circles + + private static Polygon ConcentricCircles(int inner, int outer, bool hole, double r1 = 1.0, double r2 = 2.0) + { + var poly = new Polygon(); + + for (int i = 0; i < outer; i++) + { + double a = 2 * Math.PI * i / outer; + poly.Add(new Vertex(r2 * Math.Cos(a), r2 * Math.Sin(a))); + } + + var ring = Enumerable.Range(0, inner) + .Select(i => 2 * Math.PI * i / inner) + .Select(a => new Vertex(r1 * Math.Cos(a), r1 * Math.Sin(a))).ToList(); + + poly.Add(new Contour(ring), hole); + + return poly; + } + + private static double PolygonArea(IList ring) + { + double sum = 0; + + for (int i = 0, j = ring.Count - 1; i < ring.Count; j = i++) + { + sum += ring[j].X * ring[i].Y - ring[i].X * ring[j].Y; + } + + return 0.5 * Math.Abs(sum); + } + + [TestCase(16, 32)] + [TestCase(64, 64)] + [TestCase(200, 37)] + public void ConcentricCirclesWithHole(int inner, int outer) + { + var poly = ConcentricCircles(inner, outer, hole: true); + + foreach (var quality in new QualityOptions[] { null, new QualityOptions { MinimumAngle = 30 } }) + { + var mesh = (Mesh)MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { Convex = true }, quality)); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + + // No triangle inside the inner circle (the hole), the annulus is meshed completely. + var outerRing = poly.Points.Take(outer).ToList(); + var innerRing = poly.Points.Skip(outer).ToList(); + + Assert.That(mesh.Triangles.Any(t => Centroid(t).Length() < 1 - 1e-9 && InsidePolygon(innerRing, Centroid(t))), Is.False); + MeshAssert.HasArea(mesh, PolygonArea(outerRing) - PolygonArea(innerRing)); + } + } + + [TestCase(16, 32)] + [TestCase(200, 37)] + public void ConcentricCirclesWithoutHoleSeparateInsideAndOutside(int inner, int outer) + { + var poly = ConcentricCircles(inner, outer, hole: false); + + var mesh = (Mesh)MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions { Convex = true }, + new QualityOptions { MinimumAngle = 25 })); + + MeshAssert.IsValid(mesh); + MeshAssert.ContainsSegments(mesh, poly.Segments); + + // No triangle crosses the inner circle: none has a vertex strictly inside and one + // strictly outside (vertices on the circle belong to both sides). + var innerRing = poly.Points.Skip(outer).ToList(); + + foreach (var t in mesh.Triangles) + { + var vertices = Enumerable.Range(0, 3).Select(i => t.GetVertex(i)).ToList(); + + bool strictlyInside = vertices.Any(v => !OnBoundary(innerRing, v) && InsidePolygon(innerRing, v)); + bool strictlyOutside = vertices.Any(v => !OnBoundary(innerRing, v) && !InsidePolygon(innerRing, v)); + + Assert.That(strictlyInside && strictlyOutside, Is.False, $"triangle {t.ID} crosses the circle"); + } + } + + private static Point Centroid(ITriangle t) => new Point( + (t.GetVertex(0).X + t.GetVertex(1).X + t.GetVertex(2).X) / 3, + (t.GetVertex(0).Y + t.GetVertex(1).Y + t.GetVertex(2).Y) / 3); + + private static bool InsidePolygon(IList ring, Point p) + { + bool inside = false; + + for (int i = 0, j = ring.Count - 1; i < ring.Count; j = i++) + { + if ((ring[i].Y > p.Y) != (ring[j].Y > p.Y) && + p.X < (ring[j].X - ring[i].X) * (p.Y - ring[i].Y) / (ring[j].Y - ring[i].Y) + ring[i].X) + { + inside = !inside; + } + } + + return inside; + } + + private static bool OnBoundary(IList ring, Point p) + { + for (int i = 0, j = ring.Count - 1; i < ring.Count; j = i++) + { + if (RobustPredicates.Default.CounterClockwise(ring[j], ring[i], p) == 0 && + Math.Min(ring[i].X, ring[j].X) <= p.X && p.X <= Math.Max(ring[i].X, ring[j].X) && + Math.Min(ring[i].Y, ring[j].Y) <= p.Y && p.Y <= Math.Max(ring[i].Y, ring[j].Y)) + { + return true; + } + } + + return false; + } + + #endregion + + #region Spiky star + + private static Polygon Star(int spikes, double tipAngle, double scale = 1.0, double x0 = 0, double y0 = 0) + { + // Spikes of length 'scale' around a core of radius 0.2 * scale. Each spike has the + // given tip angle (radians), so for tiny angles its two base vertices nearly coincide. + const double core = 0.2; + double delta = Math.Asin(Math.Min(1.0, (1 - core) * Math.Tan(0.5 * tipAngle) / core)); + + var contour = new List(); + + Vertex V(double radius, double angle) => + new Vertex(x0 + scale * radius * Math.Cos(angle), y0 + scale * radius * Math.Sin(angle)); + + for (int i = 0; i < spikes; i++) + { + double a = 2 * Math.PI * i / spikes; + + contour.Add(V(core, a - delta)); + contour.Add(V(1.0, a)); + contour.Add(V(core, a + delta)); + } + + var poly = new Polygon(); + poly.Add(new Contour(contour)); + + return poly; + } + + [TestCase(5, 1e-3)] + [TestCase(5, 1e-6)] + [TestCase(5, 1e-9)] + [TestCase(12, 1e-12)] + [TestCase(7, 1e-15)] + public void SpikyStar(int spikes, double tipAngle) + { + foreach (var (scale, x0, y0) in new[] { (1.0, 0.0, 0.0), (100.0, 372000.0, 5710000.0), (1e-6, 0.0, 0.0) }) + { + var poly = Star(spikes, tipAngle, scale, x0, y0); + var ring = poly.Points.ToList(); + + // The base vertices of a spike may be closer than the precision of the + // coordinates allows (merged then, the spike becomes a segment). + var cdt = (Mesh)MeshAssert.Terminates(() => poly.Triangulate()); + MeshAssert.IsValid(cdt); + MeshAssert.HasArea(cdt, PolygonArea(ring), 1e-6); + + var quality = (Mesh)MeshAssert.Terminates(() => poly.Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 30, SteinerPoints = 20000 })); + MeshAssert.IsValid(quality); + MeshAssert.HasArea(quality, PolygonArea(ring), 1e-6); + } + } + + #endregion + } + + internal static class PointExtensions + { + public static double Length(this Point p) => Math.Sqrt(p.X * p.X + p.Y * p.Y); + } +} diff --git a/src/Triangle.Tests/Robustness/Data/README.md b/src/Triangle.Tests/Robustness/Data/README.md new file mode 100644 index 0000000..3d75baf --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/README.md @@ -0,0 +1,12 @@ +# Test data + +* `orient2d.txt`, `incircle.txt`: 1000 near-degenerate cases each with the expected sign + (index, coordinates, sign). From *Automatic Generation of Staged Geometric Predicates* + (Nanevski, Blelloch, Harper, ICFP 2001), + https://www.cs.cmu.edu/afs/cs/project/pscico/pscico/src/arithmetic/compiler1/test/, + via `test/fixtures` of https://github.com/mourner/robust-predicates (public domain, + Unlicense) and https://github.com/artem-ogre/CDT (`incircle` is `insphere.2d` there). +* `maple-leaf.txt`: maple leaf of the Canadian flag (Ruppert's classic refinement example), + from `Examples/canadian_flag_raw_data.txt` of + https://github.com/Samson-Mano/2DTriangle_Mesh_Generator (MIT License, Copyright (c) 2023 + Mano). Converted to the corpus format (`L` = polyline). diff --git a/src/Triangle.Tests/Robustness/Data/incircle.txt b/src/Triangle.Tests/Robustness/Data/incircle.txt new file mode 100644 index 0000000..08d35fc --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/incircle.txt @@ -0,0 +1,1000 @@ +1 1.4961614016396960e+12 1.3318242171938891e+01 7.6400648583370128e+01 -8.4624203955526605e+20 -9.7267316824929993e+19 -3.9786345166040070e+25 8.5518808516459799e+27 -7.1304963429789423e+33 1 +2 5.3719065302356640e+32 -2.5347462895382042e+09 -3.2320080256493230e+28 -7.0491295475057450e+03 -6.8902150136125088e+06 -2.2756820423879327e+11 7.8213531273971216e+16 4.0918854118598287e+05 1 +3 -3.0174266862446611e+17 2.8960665483660479e+04 4.4484367798766268e+29 2.2180528833652939e+28 -2.6170993871069467e+05 -1.0945358513792351e+04 3.9602653300726183e+20 1.3484076773268453e+03 1 +4 1.3156801618834456e+17 1.4741628654609657e+25 2.4648049422065914e+10 2.8916655435939677e+23 -1.5869270805359201e-03 -4.4397191566378944e+17 1.4120891447719849e+10 -8.7951610704529375e+13 1 +5 -5.3261461492120296e+07 5.8037128896158516e-02 3.1489522914416782e+23 -1.0151896120411152e+23 3.6024417330116944e-04 3.9591569287271597e+12 -5.0808331380276608e+24 -1.2525993522692469e+25 -1 +6 5.2685873362592753e+21 -9.3702003441581705e+28 -3.2885067239067850e+15 1.5775879992616045e+29 -1.7037762905011953e+28 -5.0490503584326418e+20 8.1047819190345346e+29 1.8338316220285582e-04 1 +7 -2.1803935586702738e+25 4.7932045456624233e+24 -8.5431760978014500e+14 1.6416647266939648e+12 2.1171088242334023e+09 2.5318803316116232e+33 2.3244831872388044e+21 6.7694705979774080e+30 1 +8 1.9622394058108155e+04 3.6020998493502179e-04 -5.9563408005056519e+11 -5.7033141523096798e-02 -2.5268048500708491e+19 -4.9082442030147166e-02 3.2947079252817697e+26 -2.4160329549375672e+18 1 +9 6.1740121863446562e+12 5.4613896346145868e+08 -7.6189186127142029e-04 1.7325415566116972e+16 1.9766882836009194e+31 1.7040782752074660e+18 5.9232466323606897e+22 1.0137803923519623e-03 -1 +10 -7.5922728104924238e-04 -5.7198419919812950e+14 3.5214292116508896e+21 1.4561461137896329e+11 3.7012852768023707e+07 2.9725726647960533e+00 -4.8008710123127464e+25 2.9035808316536648e+04 -1 +11 -4.3531973309506762e+08 3.1641614858204021e+09 1.4959158720414041e+00 3.2221508225836679e-03 -2.4300937668706796e+16 2.8427316714141101e+29 -1.7947774192106602e+19 -9.6633998985023936e+01 -1 +12 1.7544282312441907e+09 -1.6381852387618426e+25 1.6288133704568727e+02 -3.6336139558233643e-02 -2.6791247858395129e+29 -1.5222430437130349e+32 -2.2770673203021448e+21 -1.9922927681157283e+27 1 +13 7.4717947054323084e+31 1.7808684806907993e+32 -1.0459268553010823e+27 2.2845925900648746e-02 2.3259874234421215e+30 -7.8756024034312905e+24 -2.5881131597045046e+00 -6.0632246340440051e+05 1 +14 -1.2866310297969819e+32 -2.0866536998545304e+22 -2.0733326051206544e+14 -5.1490888530104126e+10 -2.1955311292625469e+32 4.4233207695140266e+08 -1.3888082973524135e+23 -6.4397976857319394e+23 -1 +15 -3.2135023636077930e+11 -4.6355270417884185e+34 -8.4849974839611220e+30 -1.4743882108457007e+22 -3.1589658585941698e+30 6.4773691820529500e+19 -3.0094072311163435e+32 -9.6648282120603399e+04 1 +16 1.4044994636892540e+29 -4.7776286788197928e+24 -7.5413026420650482e+00 6.3590628910673112e+07 -1.1862196862486435e+27 -1.5733279423267087e+28 2.4187768133345606e+17 1.9594216058716285e+32 -1 +17 -3.2439766416214772e+33 -4.2056966011877938e+14 6.2563133750416230e+17 -1.0611028323720903e+26 -4.2828437170015210e+11 1.7986975617607590e+02 6.4411420794020580e+15 -8.4382966270272908e-01 -1 +18 -5.7312282707342422e+08 3.2122080981987720e+15 9.9939852835490112e+17 2.7542146518589466e-01 2.3575567519991142e+08 1.0944907493679889e+05 7.8505261492865694e+33 5.5816560349662381e+21 1 +19 1.5722762847051551e+31 -5.4468526727973175e+20 -1.6606582445150359e+21 -5.5091117343386315e+25 1.3039827154148022e+32 -1.1271229605541565e+23 6.6186557670702881e+10 3.0196196138944038e+02 -1 +20 -5.2096764119596473e+20 2.0860442976611709e-03 1.7524363664092760e+15 -3.7696920220153049e+07 1.3656984859546518e+05 -1.1351935174325351e+06 -1.6729859489569325e+14 -2.0239017890154155e+01 1 +21 2.6161244463338734e-01 -6.3317190036045726e+31 -1.6771198755137243e+09 2.9021312221812448e+27 1.0007888724938493e+03 4.5495518919584462e+20 -4.1289682029000688e+19 5.4646962897050333e+08 -1 +22 3.8317940605233618e+21 4.7900108958319969e+24 2.2496796420344461e+33 2.0597657122578348e+18 -1.4157067016042304e+16 1.2200588019122578e+27 4.7225722843345240e+30 -1.3569252334354327e+09 1 +23 -1.4789154958701525e+28 -2.7759263109745711e+07 -4.8144353992849667e+27 1.2205194897106289e+18 -4.7690270207505076e-03 -1.0799826445693886e+28 -3.5951607278920985e+15 -3.4724453911654373e+23 1 +24 3.5990455437187390e+15 -6.8375634576270276e+11 1.1736946193184044e+00 -6.1671982501475623e+25 8.6549471045329584e+31 -2.8149943320610810e+25 7.2768694144522228e-01 6.5356179839492310e+06 -1 +25 1.3148761486453700e+22 -2.9776181126570545e-04 -1.1989608042768683e+29 -8.7094205928583887e+11 1.0758825430227386e+30 5.7493486612157799e+27 -9.0034811208469873e+03 1.4641112113901776e+16 -1 +26 -4.7915461918555066e+27 1.5538603250277992e+24 2.4362912509688736e+23 -7.0274418609237850e+14 4.2928299194574393e-01 -4.8756408405061904e+02 -1.2780679392743271e+05 -2.3878669185881958e+17 1 +27 -4.8965611274882333e+28 -1.5776636308750323e+01 -2.0563674035191055e+15 3.8082354871044810e-03 5.5405411451567517e+04 9.4254653769902834e+03 2.1285936578455944e+18 -7.7344960441708679e+09 -1 +28 -1.0602000690890682e+32 -1.5616364828529591e+01 -1.6360546499664990e+31 -4.6609043113142428e+23 -2.2301305491130719e+13 -4.8041099061276243e+34 -1.7197145672115657e+04 -4.3270648434905907e+17 1 +29 -3.2679051664573961e+31 6.4598040417294248e+12 -6.8927356184424786e+30 8.8719217189228766e+02 -1.4254868751956294e+17 -6.4878856734239375e+34 -1.4720241807884394e+24 2.2997211312906881e+34 1 +30 1.0538775197017539e-01 1.7965133993244024e+16 -4.4261645126551543e+12 1.4077195473841712e+03 1.6145934384456114e+05 7.5336135450723007e+21 8.8920297512938646e+02 -1.2164084989998301e+00 1 +31 -1.6064075675776949e+09 -5.6459564472191071e+10 -1.0182828396799837e+02 6.7268253275786150e+15 -1.4180140696922041e+21 3.3910768534247385e+04 7.8637241321219482e+12 1.4190596421669102e+33 -1 +32 -5.9294110966175583e+10 5.3626727339877546e+08 -1.0227433359556212e-02 -3.6339288756449718e+09 -5.1302632992030950e+14 -2.8296163149977157e+04 -1.9773087354834495e+27 5.2396084203190369e+10 1 +33 -1.5349053786045342e+23 3.1297459056289426e+30 -6.2733380566449761e+06 -1.2679175560247507e-03 -1.1578768466001247e+02 1.3752877808012168e-01 -3.5456536220397771e+24 -2.3419466428674909e+00 -1 +34 2.5711332724362364e+04 -7.8302271783762086e+28 -3.5337890227442285e+17 5.5735190706553568e+16 5.6352050366138423e+31 5.2600183715064774e+09 1.1439898207394141e+12 4.4849044099699691e-04 -1 +35 1.6278466619732873e+09 1.9156750795540493e+03 -5.3409701803800032e+26 -1.2274131251923090e+16 -6.3973160715925565e+04 -6.4568351857395591e+25 1.2586626014951394e+12 1.2250413325849036e-01 -1 +36 4.9735389003735087e-02 -7.7304905058540696e+32 -7.6366429173350295e+20 -1.6194996667805340e+22 2.8909730211282770e+33 -1.1169603050049417e+24 -2.3278529053583791e+22 1.4666637346459541e+13 1 +37 1.5815415250205704e+19 -4.5057482953834219e+05 2.9977261021995510e+01 6.2907093223939812e+10 -5.6160236776482250e+15 -8.7984416498676437e+03 -4.8295272566090903e+30 -3.4549187374965457e+29 -1 +38 -1.1861506429114074e+22 1.4769503839436710e+25 -9.6298011458375535e-04 -1.7313876680770449e-02 -1.4412642001507118e+20 3.4892907927547797e+24 1.3785553457384664e+27 1.8093215462124315e+30 -1 +39 -2.7147642831991786e+08 4.0093630406871024e+30 5.1151943461432747e-01 3.4658494936315100e+25 4.1062699217486217e+19 -4.6598719230117064e+16 6.1509912980525079e+28 2.7581240719370803e-01 1 +40 -1.8237140025593656e+29 -1.3439352041233529e+31 -1.6287575940850454e+12 -1.9243939141825717e+21 2.1564009452771416e+12 1.0716458511762697e+14 -2.0045538131685345e+28 -4.6285941170641595e+31 -1 +41 1.0835501730538522e+17 -2.6238691316196131e+04 2.5191989642678236e+03 9.6949088920192013e+28 3.7338235729238167e-02 1.9485801945141296e+10 -2.4987767954692094e+13 2.9794470856388909e+05 -1 +42 1.9751433728859254e+26 9.0542548864245252e-04 2.7476597935488982e+21 4.3964930613910091e-01 1.1572061053232637e+06 2.3557052131695511e+33 -5.5987242844004720e+07 -8.1663539486490073e+20 1 +43 5.4207083312587751e+19 -8.5770175753741036e+18 -2.3058107819070690e+05 1.1069973706808710e+33 2.2916587387885068e-01 -9.1845369977868750e+12 -5.3024062143997002e+10 -1.3617316563890813e+32 -1 +44 -6.4276057096702082e+29 -5.2210968637432463e+19 -1.1772749936657451e+20 7.9186644631028805e+30 -4.6997654672911144e+14 -1.0701416340493153e-02 2.2576108255306458e+18 1.4971763430802660e+32 1 +45 -3.3019865607812698e+10 5.0880806443061706e-02 1.5599880256735787e+01 -3.4150089476705983e+20 1.7259317668403927e+29 -1.7457913404986307e+00 -1.3529007951322142e+34 2.0654540657875037e+09 -1 +46 2.3470101291229498e+17 -1.6047229836975323e+01 -1.2537420944277817e+11 2.7312803687393510e+17 8.6553924731172301e+18 7.6908733291182448e+32 -1.8348545365597420e+28 -5.0244145268007714e+23 1 +47 6.8014500005062842e+28 5.8737459222164249e+08 2.8563760575682878e+08 3.8654855596756922e+13 3.4258919481683397e+08 1.8254864564930918e+17 8.0786288135313886e+31 -9.0535688054463844e+21 1 +48 8.4965803289364602e-04 -2.6934976131753808e+32 1.0349762950399333e-01 2.7160201415645855e+30 -9.7649274557134529e+31 1.1113092952241650e+26 -9.7721776171115504e-01 2.4637382543349078e+33 -1 +49 7.6694472151093592e+04 4.4046228195460939e+27 -4.2214553034141942e+18 1.9011749642724883e+12 6.0858708343131629e+20 -6.0164884995939945e+00 -6.6137454973258859e+13 -1.1789578405507033e+05 -1 +50 1.4553820060129023e+13 1.6393144787898215e+01 -1.1075903643470548e-03 -3.4228618987072917e+29 2.1014301602769523e+00 -2.7647425063786249e+09 6.6843985835014206e+33 5.0375808477961573e+02 1 +51 1.3036327127234758e+17 1.0556244095031116e+16 -1.8279249852218887e+29 7.1336548272127792e-02 -1.8734533610724999e+00 -8.1469116357256520e+18 -5.5027349756946186e+19 9.8841475332616168e+25 1 +52 2.8104901552012001e+18 -2.5398848760184703e+14 5.8268925893777014e+26 -6.1089445560300018e+26 -2.7110893156781350e+02 -2.0973571379845392e+24 4.6966358135043192e+16 3.7942649811885934e+24 1 +53 6.2808837755560819e+23 2.7834876148443354e+34 -1.3106487380249396e+08 -3.1179073536408799e+27 -3.9370621426934704e+16 8.1354712140016658e+25 -1.2261608045371220e+19 -2.6200295716558849e-02 1 +54 4.3377029423989043e+18 6.9668544333829105e-04 5.9053565496697790e+19 9.6827934142705198e+27 1.1525226199688626e+21 -4.2723997309345328e+13 2.4088920714213048e+18 6.9699934994828642e+24 -1 +55 -1.4122549293382772e+27 -5.3173798853465684e+00 -8.7612641509760309e+26 -2.0105379806477704e-02 3.9380429271544518e-02 4.7467292862340291e+04 1.7863887705879554e+19 4.6308290039904449e+10 1 +56 3.6877568036030285e+17 -2.6552901465058550e+07 3.1147537752294835e-03 3.8794191192702958e+00 7.9050253091637561e+11 -6.8022747755700867e+10 -3.5360624365289420e+34 1.4604956673082223e+09 -1 +57 -4.1093223069908910e+25 6.8049411493812500e+13 -1.0214397098126107e+20 -2.2359067188164983e+25 6.5530595037148262e+10 -2.4205669964098246e+02 -4.1310445979389444e-04 -3.5499905829952543e+26 -1 +58 -2.4283261773289045e+25 -2.8676017991184793e+13 -7.9044214993225804e+25 3.1455383428153334e+18 5.4777128896972775e+07 1.8229796647374215e+21 7.2459548256305802e-03 -2.8878698751998512e+13 1 +59 -7.3117522536098375e+13 1.7744004091392459e+14 1.6751556033993721e+28 2.7348402161727631e+14 2.6266680649816209e+01 2.0480034538362950e+07 5.2378444734638278e+22 1.7939742330110972e+23 -1 +60 -2.8260816112557855e+19 -1.9431396371020766e+20 2.8993797656352441e+06 8.2372221073127909e+30 -7.6074108136313690e+23 1.6180475483915996e+20 -6.6488166127957115e+09 5.4639932058511043e+08 1 +61 -1.1721165733341397e-03 -2.0854909576268838e+14 2.7301558111827329e-01 3.6641777362961607e+27 -1.2880329643313178e+31 2.2517511558354777e+20 1.9534049584976557e+08 -9.4040950508943155e+17 -1 +62 -2.2424539362591969e+19 4.5267852134191379e+07 9.3679681455006008e+09 1.4088270788948749e+11 -1.4331160919372114e+24 1.6605267732585800e+14 -1.8231242655606925e+22 1.2155062452901101e+12 1 +63 -3.3298443713923889e+10 -3.6828661241339432e+28 2.9382158449665376e+01 -3.2105666790572158e+06 -7.1559232268148032e+16 1.6749499904861500e+14 -3.2900624487127945e+27 -1.2113008415801755e+26 -1 +64 -1.5761635027224411e+10 -8.6573526803479719e+04 6.8398297887340176e+12 -2.0961488941457977e+34 1.0712689405477077e+32 -1.1910644483052486e+27 -1.9184474158339948e+11 -1.2905400811470620e+28 1 +65 6.9438267533407764e+12 5.9423794161034721e+01 6.3022589724000361e+20 1.0777401901482095e+27 2.5404072852064266e+14 -1.9936502364660585e+18 -2.0738492172110171e+33 4.0789798681002915e+08 1 +66 -3.8448991854349273e+01 -1.2346059467843953e+29 -4.2551054024610871e+21 -9.4004052365655289e+10 1.3034719163657340e+34 6.1592052607715620e+26 -1.9253891413949900e+31 -1.2635911295360408e+01 1 +67 9.7282049255615543e+05 -4.9329978308411263e-04 7.5593724639406351e+31 1.3666719604983426e+22 8.4501997861890569e+07 -1.3384603448702672e+06 -4.4046866819554769e+14 -1.5818562552348894e+03 1 +68 1.0706247728503862e+04 -1.7461451009381350e+26 3.7349397119125453e+32 7.8098238155973942e+21 -8.3889318620490414e+00 9.2430877429895438e+06 6.5850257093861542e+09 5.7749538403378056e-03 1 +69 -4.0110447363098478e-01 4.3924703626621646e+04 1.5196201464272640e+23 1.9463763789284510e+15 1.2371195633862212e+25 -2.0796602038048000e+15 -1.2025302780953925e-01 3.5007385417260605e+18 1 +70 6.4911261040316334e+22 1.1637597469004763e+00 -5.6537090099799982e+18 -3.6623147979105986e-01 4.7298873831958936e+24 1.3384214813008242e+09 -1.2477269312124477e+04 5.4844993201498692e+30 -1 +71 -2.8783470919998008e+16 5.4170696894779480e+15 -2.6984221589283920e+15 5.5129683058661394e+03 1.0619359832948243e+05 -1.6200603502361050e+10 -6.2330025523989846e+05 7.1192543807719863e+04 1 +72 8.9915907552940251e+00 5.1433460746674951e+11 -2.7258051752969158e+29 9.2816954949773048e-04 6.2379587890318899e+03 4.2175927624576758e+13 -7.7569064704795754e+34 -5.1290003058604316e+03 1 +73 -2.5132639342711456e+26 -1.1864547228277621e+20 -5.8960331289061458e+27 1.4649471489585596e+11 1.5418459241077370e+17 -8.5605048877339450e-04 1.9405992574264718e+23 -2.6122543307991225e+32 1 +74 -1.7289051929177091e+21 4.7732335376155909e-04 3.1203012585512898e+01 -1.1134005036406377e+01 -1.5805806225560008e+15 4.6706785986219589e+10 1.0573929314845367e+02 -2.2213401102134050e+01 1 +75 9.4329364147046931e+01 -2.3674096671762996e+34 -8.8196680934065208e+21 2.3570734114286411e+05 -4.0562883088727618e+20 3.8984983620238354e-04 -2.2615695384112936e+21 -1.2627604317061311e+08 -1 +76 1.0133188379755980e+02 6.3314701191967826e+18 7.9053334209656344e-03 7.3549059464259248e+23 4.1931666314284695e+27 7.0184580973524065e+24 -7.4183166994948920e+15 -4.0200542620884542e+09 1 +77 2.2968864859828837e+06 4.7764944868771090e+29 7.1825965024417249e-01 1.6640132860629855e+32 3.5619592293618761e+26 5.7428972975919210e+19 9.1845829279918050e+00 -2.9807389733360491e+34 1 +78 -8.7862418963723377e-03 -4.4291529752716317e-05 -1.0005856341896947e+07 3.7999582922474098e+08 -2.5514197196252168e+16 -1.2093988807124446e+17 7.1180048091153819e-04 9.6698273623481995e+10 -1 +79 7.7517516807422901e+23 3.6515782751360240e+16 -1.8479831856010235e+26 -3.3729228403562988e+12 -4.5980250942423423e+04 1.6521396261342409e+31 -3.5090478550541531e+13 2.0196828929194678e+04 -1 +80 -2.7582450258663535e+20 -1.5665233713925605e+12 -6.4113135476914577e+09 -5.4815809339511226e+33 -1.4266646792388784e+32 3.7330384339885876e+11 -1.8405185385725265e+06 6.7189014827983795e+17 1 +81 -7.0636295120013431e-02 4.7846820869589573e+08 -9.7754442282175709e+23 -1.0226951011482975e+04 -1.6659577681002596e-03 -5.6326148102984977e+25 -1.0027014332215504e+10 1.8390298317732592e+09 -1 +82 4.3722867450890303e+07 -1.1760457756018599e+00 1.4414467186260471e+23 6.4792647274182836e+23 4.2183288715977405e+01 1.2020631640971428e+08 -5.8571297896741500e+14 -2.2628501037606669e+24 -1 +83 9.6705330608164036e+02 -3.3899845241577864e+08 -1.3830209564518361e+32 4.6565588354888860e+15 3.2392849860672492e+18 6.4848143852166367e+12 2.0436202189598616e+23 1.5927735396634643e-03 1 +84 -1.6550590076554794e-01 -6.4464773830433200e+14 9.0131162466515891e+20 -2.1381702124504869e-03 -3.0843142163418224e+29 -8.7502522852360969e+05 7.6478799388599097e-03 5.4458632494267487e+11 1 +85 3.2037909215050321e+22 -1.3128412606150508e+06 -1.2147718025506201e+08 7.0771617986461865e+02 -1.3179972383383944e-02 4.1101892471455912e+00 -1.7044252916248877e+02 1.0230530827732164e+13 1 +86 -7.8037666775912730e+04 3.7660441958000335e+20 -1.1447039101093257e+27 7.7030749181844483e-04 2.6140018563166589e+11 -1.0570804127599472e+24 3.0064074145919776e+03 2.6290597721549984e+00 1 +87 -1.8635942199927726e+04 -7.6884727647621910e+23 8.6695633551231660e+24 1.4482948924432834e+23 3.3339892427308172e+33 -5.3350827580129379e-02 4.6683229422040533e+00 -1.3516399848825539e+19 1 +88 5.7138286232665337e+01 7.6474042195365968e+04 -1.1450789159979955e+30 -5.6399486633617781e+13 -1.7538632456798736e+17 3.8418208775447414e+25 -5.2519705575629381e+27 1.9731344128441719e+27 -1 +89 -1.6242406138125120e+10 -8.1707378931001702e+04 -4.1198431041788507e+29 3.6915595622666295e+30 3.5785566344082222e+25 -1.5277744609923997e+04 -9.9823758050790161e+01 5.6060925978162643e+06 -1 +90 -4.8259158583780788e+01 -2.1406081294901334e+14 7.5861996392236892e+26 -2.4202994776127827e+30 2.5624416847351193e+07 9.1481646208189216e-02 -1.0221279667348988e+14 -4.2030330014475083e+12 -1 +91 -2.6799990961743108e+27 1.8398864499447401e-01 -8.4985557878429346e+11 4.6543266722420685e+02 -8.3909901361418527e+21 2.1403363932995598e+29 -5.1474072608637274e+17 -1.4300242227853592e+04 1 +92 -6.8159224819908505e-04 -3.3260585834621935e+22 -3.2057246533974939e+11 -1.7959677157342355e+02 -2.6255013398567753e+22 2.2271652476958326e+22 1.3178413172192007e-04 -4.6747838957317500e+14 1 +93 -3.5439210566540735e-01 -1.0895911698499596e+26 -1.0605156893510059e-01 -1.8809493614822430e+15 2.8502367960439071e+31 4.0329443716150125e+13 7.2569593346002166e+19 -1.2465644083863149e+28 1 +94 -4.8780929516409657e+00 -2.2347142978370562e+07 -1.7595506526175022e+00 -5.2302126103845226e+21 -1.7611960158132231e+12 -8.7060747076925240e+32 -1.1957757681127989e+09 -2.0334823257359594e+30 -1 +95 3.7537243825662109e+12 -8.9450647564699500e+14 -1.1525534640350998e+27 2.5338005504854011e+22 -1.7677442410080342e+16 -8.3198171599427030e+02 -9.9227602516177782e-01 -4.5301904221036845e+21 -1 +96 3.3480056788882884e+27 -1.0920080162929022e+15 1.2702442707989911e+11 -2.7703794977747521e+02 6.0178344558361768e+32 -4.1909427007040938e+14 -2.3359231852541948e+06 -9.2340618319812241e+09 1 +97 2.1104904785276160e+11 -3.1311261138067493e+01 -6.5498625311811177e+26 -4.6209657737969142e+24 1.2882453856143347e+32 -5.8629568694946878e-02 -3.6478995047710840e+11 3.7633389560048447e+00 -1 +98 5.0564409519420659e+33 8.4836124989487150e+14 -2.3023963931983211e+32 2.2141669797221452e+22 -3.3843399903768099e+23 2.6313443621180356e+06 5.8351025667660405e+25 -5.4444116601960019e-04 1 +99 1.7127641084688950e+25 9.1574194735128510e+20 7.3417874726187885e+07 1.1233078827711252e+22 7.1198183593005384e+19 -2.0296327650240924e+04 -9.5459450131632206e-03 -9.4599700386904576e+17 -1 +100 -4.4408439856694851e-04 2.6802742198083725e+09 -9.0471719832074020e+25 6.1542140441946808e-04 -8.1548563938038161e+26 6.8665665178053036e+09 -5.0381177132082858e+33 1.9711000808371475e+10 1 +101 -5.2092579271709380e+20 -2.3521102114697240e+16 -5.0672637019056580e+11 -1.4536402250154568e+22 7.0655327439217913e+08 3.3963368776746215e+06 8.5576184433526176e+16 -2.0754188292015196e+27 -1 +102 3.5281572763690235e+01 1.1146656605618250e+11 -8.2452986947646542e+09 -1.6392182736291102e+02 2.8756322337277842e+12 3.7044687638852162e+14 1.8735767485808069e+05 1.3939100846881010e+32 1 +103 3.7786695302728119e+25 8.0417624557891977e+03 -3.4731251059301974e+24 1.1045140329121338e+10 -1.4284375538481903e+01 2.3234080249243949e+32 -4.2661583328200336e+33 -2.7960529830477186e+28 1 +104 -7.3454903513900649e+25 3.0929365726253995e+24 1.3181002080065928e+09 5.1753684118018008e+01 8.4110301218879204e+02 -5.4284789435879197e+23 -4.0594535229056686e-03 5.0221854795268503e+34 1 +105 2.0623311364210442e+31 -2.6636844075529222e+28 -1.7219869704386838e+32 7.9848011905903957e+04 3.4011761949180714e+06 -5.3491400486561667e+32 -8.4599082770585678e+31 1.8254946774787601e+02 1 +106 4.7496019853701143e+25 1.4126616591577881e+13 -4.9867361350507155e+04 -5.4341352929316827e+01 -3.5457357387423176e+18 -1.5829431086267533e+09 8.3704937182118398e+12 -1.1419120932820980e+15 1 +107 2.8711571295440250e+00 -9.2017389915456281e+13 1.5067724674783518e+24 3.6339187933796084e+03 -9.4191265561882620e-03 1.8979392491792479e-02 -5.1828557163336111e+04 -1.3024169670396447e+08 -1 +108 3.0142362840221268e+31 1.9320066243860079e+25 -1.3206541373655015e+33 1.0128356625729361e+33 1.9371305418924510e+15 9.7288123232879043e+06 8.0530556458205312e+27 -1.2314391856938265e+33 -1 +109 5.7549809304694630e+00 -1.4649439063111182e-04 8.1838145325972637e+03 7.3434897002202088e+03 9.8095041644173804e+18 3.7538582313081606e+03 -5.5851620234630199e+26 4.0093428599650320e+19 1 +110 -7.3850585015003906e+12 -1.2010547900713012e+14 3.7201270957372634e+28 2.6587411343776417e+08 3.6296154075475287e+29 -4.1427136981000814e+30 -1.2249568649806205e+17 1.8849534412116033e+08 1 +111 -3.4033222094967640e+31 3.7922992615491671e+00 5.3938668532557640e+04 -2.2433156982969853e+18 -8.0165234560925514e+06 -8.6826809707371682e+21 -6.5644503838618926e+05 9.1912576942018995e+29 1 +112 -5.8838342065811043e+20 -1.5564071706673121e+25 9.2190867287463526e+17 -1.8510538551145194e+09 -1.6951128197266125e+31 -4.7453000651587178e+20 4.3554161991220337e+20 -1.4803971588240691e+32 -1 +113 1.5548015321201026e+07 1.0589740387554155e+26 9.1053810261272734e+12 -3.1792307574835232e+16 2.2486646644523987e+10 2.8646441854659656e+22 1.0047586814912599e+08 3.7667647766863056e+23 -1 +114 -1.5687089095945206e+10 -2.4977063453622500e+12 1.9655390312277133e+22 -9.1653363329973120e+16 5.8158029544823125e+07 -1.4897938299990840e+21 -8.1520266185896588e+32 8.5426499422784561e+12 1 +115 -5.3099952910085814e+06 1.1046181467820443e+18 3.0064603588485915e+27 -5.8152105994202827e+01 -2.4256738166194844e+14 -3.0632562860273864e+28 -1.7930706543210083e+03 -7.7906805907549271e+21 -1 +116 1.3317922472801729e+26 -5.3565875814167346e+28 -6.5594951896704700e+15 -2.9594659539690547e+26 2.5917354729513464e-02 -2.3194233963205328e+16 -3.4565389653275198e+24 -3.2672914417894996e+21 1 +117 1.1942852351967378e+11 3.5007965079190555e+27 -2.0487836524645655e+02 3.1221851056415078e+04 9.0522901160889269e+03 4.8264474943028005e-02 4.2628689422932726e+08 4.0261634300500388e+31 -1 +118 6.0474170445693449e+26 1.2559779063540687e+19 -1.4579943408205483e+20 2.8187328979129398e+17 -1.9509618803205804e+11 9.1029153721828439e+24 3.8333330566160885e+03 1.4364992572572330e+16 -1 +119 -1.6816810665100132e+16 1.1762640590971913e+00 5.5658863567941153e+03 -7.2876693728394471e+06 -1.4886212623007691e+30 3.2425879858575102e+25 1.5622357978948733e+08 -3.4045948959510498e+10 -1 +120 -4.9030428458812496e+16 2.1019584159729942e+27 1.2272282843394178e+08 6.1710812852551507e+27 8.4819696271897852e+23 4.1150306523396099e+25 -1.1035098165886791e+30 -1.6949070514739307e+11 1 +121 1.1514848891412948e-02 -1.1477739050769648e+02 -7.0741794021211197e+18 -5.7933952691335823e+18 1.9246819130712666e+07 9.9324362371190278e+33 1.9579798026392509e+33 1.7002809403481603e+07 1 +122 -2.2510321961978010e+24 5.1085552923589806e+18 2.3861684166475952e+11 -1.0886959366802038e+17 2.8037898357753910e+22 -7.9223517300473405e+30 5.2417679390420318e+01 2.0721194487454604e+34 1 +123 7.0633156884489956e-02 -6.6639529234822486e+06 -3.7852587465151946e+24 4.4062790141946966e-03 -9.8707341888333879e+33 9.8593092849313507e+02 -3.6609183033523003e+01 3.7452990372154573e+17 -1 +124 -2.3758143829742730e+22 -2.6281906402644462e+14 -6.0811376554140632e+04 -3.3543495588038006e+29 3.1224810685926277e+19 1.2342884843642258e+27 1.3610714079192437e+32 9.8909758240380943e+03 1 +125 -1.7258887836457163e+02 -1.0250833340945772e+26 -8.7341253759714443e-01 -1.8197649065191989e+23 1.4183219525943132e+03 -5.2014252953315795e+33 -5.9060137326083067e+26 -2.3181243312356578e+13 1 +126 -5.9823997797870895e+01 2.4046129128595442e+08 -2.1048248361645150e-01 1.9329667472984409e+25 1.5592598896157865e+27 -6.5470033695217854e+32 3.0830883909797272e+34 6.2640778753664612e+22 -1 +127 -3.5187101247361540e+15 -9.0875814499039348e+31 -5.6997556708995732e+12 1.2611473505705063e+12 3.2663736014456018e-02 -9.0997749806766472e+09 -5.7280451014442232e+23 3.1563244374394022e+29 1 +128 1.6870868928739063e-01 -4.8499635863731077e+18 2.4154998982923988e+10 8.1384527959410638e+21 -1.4778055102736823e+22 -5.5039424252176163e+04 -1.7229565923343580e+28 9.0507765142624451e-03 -1 +129 -3.5412955084395075e+14 -1.6085231247902913e+34 -4.2140018383067313e+22 4.0633250879571312e+06 -7.9245296259038917e+20 2.2866348940646837e+30 -4.8301464524979598e+23 1.7368782325144984e+01 1 +130 5.9378192084087499e-03 1.1281528768085705e+18 -5.3847594517834350e+14 -1.7834233709850441e+33 -3.8924276625391594e+10 -5.7166938062473036e+30 1.7846225053181491e+05 -1.8206160051407397e+11 -1 +131 8.0366805144684701e+31 -2.2058564604956832e-03 -8.0818671013694031e+10 -5.0373192388380788e+30 -6.1112226203349121e+10 -6.8656243782145270e+02 7.2481212244659962e+19 -8.0635141474985120e+11 -1 +132 4.4103521386195779e+07 -2.4186610405649446e+33 -1.9174211717835102e+25 -4.2946656201177314e+27 9.2555557514332129e+11 -4.8557596441623829e-02 8.6325535820113146e+01 -2.7023934942292302e+23 -1 +133 -1.4055259259384349e+07 -9.3284761511606713e-06 -1.7069588602982430e+29 -4.5991223370443323e-04 -8.3570830951902425e+31 4.8901267436241328e-04 1.0374683636327293e+13 -6.4843444784992099e-02 1 +134 1.8384714898492290e+26 -5.9645767852838699e+19 -2.4175136969610944e+16 1.4840964320292833e+26 -4.9229291834234702e+05 -3.8727483666656903e+30 2.5183021356576906e+17 2.4799938741680213e+04 1 +135 -8.8169275260708696e-03 -3.3026912172632372e+30 2.2057352282906309e+14 -3.4037666906089434e+00 2.0877077604393579e+20 3.7635146352021686e+21 5.1657827075002353e+26 5.8396202748519770e+20 -1 +136 -4.1744023604159367e+26 3.2330453814989999e+21 -7.3103006213922858e+07 3.3485844049503622e+27 -2.7338128872549234e+14 2.5839716510275265e+33 -5.8458385637320347e+25 3.6187932977467904e+17 -1 +137 -1.4096468089873102e+28 1.3863337565143636e+28 -2.6986180636659488e+23 -3.0377536216909388e+16 -8.3702375307524734e+21 1.2175127537771450e+14 7.2306738258577417e+33 -9.3945116110015456e+06 -1 +138 -1.4601846109412441e+06 -2.6736881605035706e+27 -2.2225215095331074e+21 5.1724192300307540e+25 -7.2104066706372070e+08 5.7375844879242613e+28 -2.9512349228562014e+30 -5.0069733506557423e+23 1 +139 -4.9730513899091846e+02 7.5180808207131581e+20 -5.6789604337194550e+00 -6.8890445238583828e+13 -1.4181473727278773e+00 1.1217738770896688e+09 3.3225647115545110e+30 1.7097910523083744e+33 -1 +140 -9.7800600159189344e-01 2.4045449302856251e+34 -1.5640336857621487e+03 -6.5514823731749043e+12 2.2981482248812867e+21 5.8029546394912090e+23 -1.3352005284937341e+14 -3.1925529848841255e-01 1 +141 -1.4518072894960783e+09 5.2599852019643081e-03 1.2535889732416886e+31 -1.7017166867890696e+28 4.3443188120744840e+25 9.0661776709423709e+08 -5.9223558454319684e+31 2.9785799463490548e+03 -1 +142 -6.0018260264896146e+24 -2.7605203243865119e+20 -5.5631210107649709e+31 -4.4405175320396416e+10 -3.8005404167437235e+32 1.0432599406845297e+11 -1.9870931663658479e+22 -1.4083872655793261e+06 -1 +143 -2.7994872751039016e+04 3.0554189266897902e+04 1.7634820456197388e+15 -4.9604894726312614e+02 -7.2021891646498786e+33 -1.1757869233536221e+03 5.2375417763438097e+27 -1.5553978896110562e-02 1 +144 -3.5270117720769123e-01 -1.6688733277319032e+16 -3.4334571889390084e+27 -1.4795666821433586e+08 -1.0202370564215949e+29 7.8858464794223967e+09 5.1926914999571614e+07 2.1205359255809851e+11 -1 +145 -1.6042905444902511e-01 5.7375357400682027e+31 7.5272803073028600e+33 3.1689208765087023e+07 -7.5722043930527040e-05 -1.7758321947836706e+01 -1.8688344122473909e+29 2.3975821046589747e-03 1 +146 -5.8399125431605135e+03 1.4915021687256410e+22 3.1912006574519590e+04 6.5162534936890317e+17 4.4541284280446521e+26 -9.3053055277901520e+15 -3.4091607054841993e+06 1.3174167687560771e+02 -1 +147 3.3204119165010573e+23 4.3446398605945139e+18 4.6394600484446773e+00 1.8622425485838625e+15 2.4234641960280713e+28 -4.3422416948225326e+01 3.5127362365534819e+32 -3.6325309400702786e+03 -1 +148 1.2993903584395931e+06 -1.0637563129980901e+26 1.6834241159225100e+34 -4.0995547350990385e+22 8.0797964613942271e+06 4.8104386703244720e+15 -1.4516198967977421e+32 5.1496775155334781e+13 -1 +149 6.4050950949227600e+14 -1.9218314009981921e+25 -2.3710232677263219e+13 -4.4691415147589154e+01 -9.4682995382014036e+23 -1.1737715311532007e+28 -2.5060199842264510e+25 -1.9481558145913279e+08 1 +150 2.6576924608034801e+18 -2.1288194627836956e+26 2.4048028948788677e+29 1.4984806343864217e+32 -2.4180979239247916e-04 8.8967668166603088e+07 3.5343306956955748e+03 2.9165723752883517e-03 1 +151 -6.6806634094585700e+15 5.0743859148847114e+04 -2.4084401142019956e+33 -2.0533311941287158e+18 7.0805778266344422e+13 1.8398836731388430e+12 8.2931906369301121e+30 2.5073795027511180e+04 1 +152 3.0940774958975270e+07 5.4168784900790979e+02 1.0258077100028487e+23 -6.0789508769678535e+09 -9.8953875145964469e+27 -1.0061607612548794e+10 1.8195281622064442e+25 -5.3067370383129294e+20 -1 +153 7.1337190506448434e-01 -3.5392855594776943e+12 -8.1199870624511156e+13 -1.5315402775131154e-01 4.0654136218686810e+17 6.4116476588577578e-03 1.5905830665136143e-02 2.7066021717444304e+00 -1 +154 2.1955236410123782e-03 2.2859614291066352e+16 -5.1818137803318357e+08 -4.8325674705458611e+10 -2.4441382668025318e+28 6.3995629937597357e-04 -1.0051512159340932e+16 6.1622639317676783e+07 -1 +155 -2.5442692883055029e+26 -2.6127932098667561e+03 -3.9616298633904163e+11 -1.3735256189244878e+16 5.7004913281098884e+06 1.0983993923473070e+04 -5.6330066347433068e-03 2.9147147010631437e+28 -1 +156 6.6452927182162102e+02 -3.8922762837445339e+03 -1.9793026591435234e+34 -2.6498265892978928e+31 -4.1305618171385241e+27 -3.3360012021494016e+07 -4.5316370394121031e+02 4.7710375840767502e+10 1 +157 -9.5221062289264569e+02 2.9334123902170655e+18 1.5769792472616287e+26 -3.7612819692624973e+17 -8.1852968411799951e+11 3.3415937740184831e+14 -3.2682096144142151e+06 -7.8850288785452899e+34 1 +158 -5.3411284092172681e+14 -5.2307876012615539e+17 -1.4379693168714722e+32 -1.1842461690418158e+29 5.6060967332351097e+32 1.1974934868994974e+30 -4.8727289260777713e+27 9.5009908592240701e+31 -1 +159 -1.5876920072625127e-02 -1.7748925561101918e+34 1.9227932260655308e-04 6.9931014473788700e+03 -2.9447341832225435e-03 5.5464102146586488e+32 -7.5423538889272036e+06 -5.4698795655351976e+19 1 +160 4.3064419034667160e+15 -3.2586733461363054e-01 -1.2469289598035173e+08 1.2626570241342191e+31 5.5456400492796584e+26 1.4249165599007429e+22 4.3525835902893644e+29 -4.0877071795644030e+07 1 +161 1.8431327994078820e+24 -3.2700399056278885e+10 -2.0463680954143742e+31 1.7137704148166163e+17 -1.5753533907542222e-03 -3.3722502286907000e+14 1.8650169684842890e+00 -1.4449923741810407e+01 1 +162 2.8550671723441681e+10 -4.7981570469531746e+19 3.3778833632806636e+27 1.0473103721266120e+15 2.1174107859637713e+08 -4.1890793397455215e+06 -1.9629540031363494e+24 -3.3702836618284761e+19 -1 +163 -7.2070782028716650e+14 -1.4396448523929466e+20 -8.1686342366353413e+29 -9.9130586653459119e+04 -1.2078885198611341e+07 2.7101905976224738e+14 2.1971265127322897e+02 4.0147154210002880e+16 -1 +164 -2.8517601422883627e+19 -1.2644616456617388e+30 4.0140815155879342e+29 -4.1161145035874257e+33 6.6198747187696603e+25 -2.9814350500691861e+23 2.3163137030336957e+03 -1.0839279910072865e+13 -1 +165 2.8656625940721888e+16 -4.9203667484208421e+31 1.7255590564940817e+01 4.1610816046972356e+26 3.7040340583438501e+02 2.7894700782717760e+16 -3.9082841922729932e+12 5.9922995569552032e+26 -1 +166 -3.6269420187567968e+29 -4.1558086929750338e+14 -6.4237057990366252e+20 6.6943285178940743e+06 -1.6890001297783341e-02 2.7647408510890502e+17 -4.0930371446945579e-04 2.2937516195186864e+34 -1 +167 6.1361764672254338e+14 3.2128074626851758e+11 -2.0341367248772907e+26 -1.0921626109309939e+08 -1.9397879481608429e+05 -7.5716634539682838e+28 2.7519250132995861e+05 5.7737438128409795e+06 1 +168 6.4271629706563331e+00 3.0898613984559599e-02 -1.3301158405990476e+23 -2.9582679341575950e+15 -4.2173218510633311e+22 -2.9831831114460650e+25 2.5511386265884155e+08 1.1051449040030626e+29 -1 +169 7.2686597054277501e+27 -8.1029030260869865e+02 8.5242883661170249e-02 -1.4604963319675283e+20 -2.1557280742849312e+29 3.5486684009157549e+12 2.3200263969938488e+14 3.4685582242777850e+05 -1 +170 2.7401300514429452e+28 -3.1291867694265139e+17 2.5706840642376703e+00 4.1677217899173175e+14 -1.0389578001276582e+19 -4.8568178736006336e+17 4.0006105322473958e+07 5.0427586421652000e+13 1 +171 -2.6777046768731932e+27 3.3047510303561050e+14 -1.0164744028939324e+34 -2.6453443449091540e+28 2.8916822283256333e+05 2.7525963172494138e-04 4.4176636585467826e+00 -8.0072221731827908e+23 1 +172 1.6355101045792926e+13 -1.2433317216248808e+04 1.0550689438993977e+33 1.3975874681203520e+17 1.7320925707074965e+13 2.5219990742957873e+02 1.4111344776235777e+23 3.7310918374106789e+05 1 +173 3.8945447377711655e-02 -3.5378894821108044e+22 5.4758670549043312e+09 1.0694614641631944e+24 7.9183049549975891e+10 -1.2480506517961113e+02 1.0948500830768022e-01 2.3693379641240430e+08 -1 +174 1.3729131485997198e+23 1.5451545848491734e-02 -4.0097649450396341e+27 -8.8327554354200780e+05 2.3159792486954460e+09 6.0243424260299245e+05 3.4283739666507705e+31 2.5716534384227152e-01 1 +175 -9.4621462921953680e+03 -1.1681119435542336e+17 2.3768002628134682e+17 -7.9151640795519084e+23 -5.5673051297172161e+19 -2.1720388927928684e+02 1.4140714783263723e+21 -2.1360649288138081e+06 1 +176 -2.0360164810056442e+03 -1.2488846177118174e+30 9.1905207188694219e+13 -1.5012598904657738e+14 -6.6884524262193280e+16 1.0312747348423235e+23 -1.6400477107099145e+30 7.3221643879003450e+05 1 +177 2.1528299311633209e-01 2.4395749069308701e+02 -1.4516219464039866e+34 -3.9658281561605574e+27 2.1071080565729410e+31 -8.4587070058154140e+15 1.7153886759849542e+31 3.0292265748275608e+07 1 +178 -2.3541505356857882e+05 5.8352792671028689e+27 -4.9758962554222164e-01 9.7080344748131589e+24 -5.6012142616974095e+04 -1.4723551948469139e+03 1.0725576404607905e+15 1.5148080740526817e+26 1 +179 -8.8808519378038270e+15 -1.4525859710509219e+12 3.2954396172554756e+04 -1.9681567938106760e+18 3.6787715621033891e+28 -1.1005322596470532e+26 1.4662220261635333e+23 4.3229632466070670e+28 -1 +180 -2.6973008467432767e+31 5.3253641220087334e+12 -2.6776049439405680e+08 1.0049067432462366e+09 8.9071708717356738e+31 9.6795069549575000e+11 -9.2189151963701172e+09 -3.0605958483998458e+27 -1 +181 -4.6693937280697036e+08 2.5835618264035460e+00 -1.6499339863408977e+30 4.0689535066750073e+06 -1.1982111754686523e+19 1.6163507681202780e+25 -3.9622107778282965e+11 -4.8507139956784046e+23 1 +182 -1.2720454579319452e+04 -6.1507338813667530e-04 2.5017129519974147e+30 -1.6651354553774266e+16 9.1653575538331970e-04 6.8500341640363172e-03 9.5941510253903708e+00 9.2624729983747960e+15 -1 +183 -6.9500517830685418e+00 -3.0541767570998245e+03 -1.7214315322729586e+23 -5.7007999819690611e-03 5.2873582458612660e+05 -8.4769888179767378e+19 -2.2971632120187750e+15 -1.6668607696649604e+30 -1 +184 1.7046349607996369e+01 1.7457270845438348e+01 3.0958248286990937e+01 2.8637501632970482e-03 -8.4878052917968059e-04 4.5675871415916070e+15 -6.2059688967000066e+27 -8.9724819496732102e+22 -1 +185 -1.1828241890807484e+21 -1.5749598453955946e+07 1.2806332840895683e+20 1.0808862009381302e+27 -1.1842979028543529e+18 1.7068695927988844e+16 -1.3410172774927196e+16 2.5539464486579454e+03 1 +186 4.4868977739064606e+27 8.4985133747862924e-04 -1.8193194253081243e+12 2.2915273985672320e+03 5.5536907259413290e+08 -1.2719812833915595e+15 8.3835708294960307e+02 -2.0018191963015301e+24 -1 +187 4.9502390547039155e+33 -5.5314261730954156e+13 -2.0396643701486759e+34 -1.4736695417117682e+11 -4.5580103352923183e+25 -8.6761759052135078e+12 7.7570893339021489e+26 -6.7573578932418021e+00 1 +188 2.0402792184265472e+11 -6.7581584580972635e+28 -2.3292559828787243e-01 2.8039808350955136e+16 -1.1194864756040173e+30 -2.0348595958971433e+05 -1.7322843289026568e+16 -7.4082141359855821e+18 1 +189 4.2116844042730737e+11 9.9907119595660745e+28 -1.7157783266569587e+02 -4.1598616967131722e+08 -1.9167676783909706e+20 -2.9177568460448954e+31 -9.8547234379227057e+20 1.8452534914435840e+11 -1 +190 -1.9068143813989498e+05 2.7804411687325516e+13 1.7407533534188408e+12 -1.2041190279005395e+20 6.2629482635271927e+00 3.4005285665147355e+26 1.4612543842665456e+32 2.4876617686176204e+21 1 +191 2.5455537651218613e+33 7.9033317177100912e+14 3.4741138647424086e+03 8.0660146038181413e-01 1.1731722181281550e+21 3.2576991579778576e+00 -1.2215330942259892e+05 -9.2447544552854203e+27 -1 +192 -6.0565515683287559e-03 3.7472206072483942e+11 -4.5967208953089720e+18 -2.6173103748588078e+05 4.5254833414552442e+33 -5.9582669975133848e+09 1.5806138415778885e+06 -8.8469682799191176e+25 1 +193 -1.2145231262513010e+05 8.2238260253270359e+13 -7.5795610200162581e+28 -9.6302107678772220e+22 -6.9999672029206067e-03 1.2283187507999446e+30 -6.8149862485241998e-03 2.7402744120068963e+30 1 +194 -4.9506999200561391e+13 -2.6645102285373148e+08 1.0276030680445665e+05 1.8851731001080463e+00 -3.8978342923627518e+31 1.0956232320498326e+20 -5.5322315871433777e+11 -1.7640302434328981e+24 -1 +195 -9.4723528960712855e-01 1.4923129798990960e+21 4.5401178903094870e+19 2.3965299053776211e+25 -5.2982857718366336e+02 -8.6427101160389800e+14 -9.1157813508287525e+14 -6.2909759301991797e+11 1 +196 1.9181066631488913e+19 7.0677965163409664e+16 6.1623417387508266e+13 2.2921452566545940e+05 -3.6130375152479260e+29 -3.6355933858623525e+29 -1.2871482046641250e+13 -1.2472500836983772e+22 1 +197 3.2321577266240677e+10 1.9906745338962706e+19 8.5691105329519329e+22 -1.1256675996626969e+33 1.5836419348890709e+10 8.7897343812321509e+00 -1.6168411397945779e+29 -2.7545608535766052e+16 1 +198 1.2340270138981726e+07 2.4287934310346700e+14 1.6704594280411317e+25 9.0709554832317672e+13 -2.1153269583325691e+04 1.2321341998717716e+26 1.3141604683301872e+08 -1.0580082532717304e+06 -1 +199 -3.6278790835768309e+28 1.4968576543238067e+27 -3.3353308976213280e+04 4.8041194736991634e+23 7.8413246117172586e+31 2.2955753215853879e+34 -5.6347722683191457e+21 1.4502857368980503e-03 -1 +200 -2.5122651295386928e+24 -3.4910691727826593e+05 -1.2187425647312277e+28 -9.9629045407801190e+30 -1.8127629304625562e+27 -1.7407698511693665e+15 -8.3913053687673784e+05 8.0397882765968973e+31 1 +201 1.2150160356999208e+02 8.4012168239537623e+23 1.3119585775925656e+23 -2.6415824455736703e-01 -9.5003241810294312e+33 3.5072602268559148e+13 -1.8193404217957100e+34 -2.0191309404716813e-02 1 +202 -1.0154763355812421e+08 -6.4135985297267784e+00 8.4536645383236103e-02 -3.1862248579168246e+27 -7.6889604758325731e+03 1.9937352394083264e-03 -1.2594315513337826e+05 -3.7074978551482369e+28 -1 +203 -1.1452695549510519e+34 -3.0793431646226909e+03 1.4548624928866178e+02 3.4760205516622708e+25 -1.4541814643396219e+29 -4.2082908737528839e+09 4.1609486610529595e+04 4.0246798582963526e-04 1 +204 7.5787359956097872e+16 -5.8350115304120709e-02 -4.4917752873297623e+23 3.8693315731586897e-01 -1.2921419815549299e-03 -1.0580040703935915e-02 4.8058878933908898e+04 -3.1196546242959691e+20 -1 +205 1.6753043016450996e+09 -1.5531407568066582e+12 -1.2514437328765133e+34 -2.7323833148361084e+10 -3.1619438436159929e+29 1.4505853612459605e+15 9.2807435334776416e+20 1.1550927301613751e+22 1 +206 1.1538696075363448e+03 -4.5054610708979057e+18 6.1498176596552618e+21 1.7109361189408312e+24 1.0369378126673107e+30 -4.6106339456264834e+01 7.2029210087709381e+26 -7.6982180076051216e+09 -1 +207 1.8522116740577907e+30 -6.1378486757798500e-03 -1.5182247261968637e+09 -1.4687811836159254e-01 -5.0166929204197203e+13 -1.0613428358231380e+04 -8.3795467109856794e+17 7.5347537648659577e+34 -1 +208 7.0787994308436388e+30 -3.0473512308706017e+22 -3.3066745578027534e+08 -9.3326855517160873e+10 6.6574395621063926e+18 -1.6252872929253133e+33 1.0462619083526720e+34 -1.6109112757870623e+08 -1 +209 -9.0751212500641494e+33 -4.7472327240938866e+23 7.1914405991539969e+28 1.0550733785497794e+14 -8.2253411752614769e+27 9.1223713405738473e+07 1.0141372736884063e+04 -3.8387124872460760e+15 1 +210 1.3406533238274843e+07 6.6833676358516140e+22 -9.9461369027006470e+10 7.4675339401498272e-02 -1.1003369508959680e+15 -7.5494932136325002e+08 -3.0025803449880220e-02 -1.6327088629111949e+23 1 +211 1.3122750410646739e+05 1.2013371047580440e-01 -4.1468505505965177e+32 -1.0711867460139592e-03 2.7712648851832674e+23 -4.0516527230077870e+15 -1.2671205411224440e+20 -1.3730328646564219e-02 1 +212 -8.5887423487460497e+05 2.2271514880090826e-02 -1.1832017234918236e+20 7.6195571530869991e+07 -1.4901522637563979e+34 -4.6118349653653141e+01 2.4015289579947610e+22 -5.4262916257461494e+19 1 +213 -2.0743265981115039e-01 6.2325863327508932e+05 7.0688201270098325e+00 2.7771942874248708e+20 1.7505567264355535e+00 -8.8947113527733998e+22 -9.6706036813857523e-05 1.3476839556372156e+11 -1 +214 -2.2029018024624845e+18 -3.4770743068447255e+07 -5.9098493984305955e-01 -2.9414068933048815e+30 2.5056294493049050e+14 -2.2922947731233284e+25 4.5438233082643087e+18 5.5655589038520732e+29 -1 +215 5.5197339768002822e+12 2.3330607360128369e+11 6.7755759598051371e-04 3.9534930053642941e+09 -1.3093644130864404e-02 1.2929790343052502e+17 9.4283992763691676e-03 3.3942417222407856e+10 -1 +216 -6.0690001892795157e+21 -8.1329540330776641e+12 4.5283204354225216e-03 -1.4627424398871864e+21 -2.9765573913726241e+25 2.3041587932511606e+09 -2.8239943080866992e+11 1.0031877108006625e+04 1 +217 2.7700340454769616e+01 -4.9958109771342754e+07 -5.4638821110348880e-02 4.1899825988727626e+23 -4.8518028613794332e+27 -1.3282187977431947e-02 -3.0898917834843442e-03 3.1215957517778796e+23 1 +218 -2.5463655864285924e-03 -1.9953386327893929e+09 -7.7875473964883316e+08 2.2341275881551300e+10 5.7751420694550026e-02 -2.6261644991802807e-03 -2.9432665033550078e+22 -1.4935977142076904e+10 1 +219 -3.9309126835681321e+18 2.0114969757743424e+30 -6.4076226013073196e+09 1.7699254534364180e+21 -6.6992547889955789e-01 -5.0724449455412144e+16 1.7359543624704856e+08 -7.7879965212414675e+22 -1 +220 2.7512971035194442e-02 -2.3796689296563658e-01 -8.8571418062846095e+18 -5.9658878308790120e-01 -3.7876072011896982e+28 -5.0617898990336460e+08 1.0240876086294392e+34 2.1386686054448456e+07 1 +221 5.4496232193159360e+15 -5.2883477645618200e+16 2.3772245480599319e+20 -8.7854759919527123e+02 1.7287315043619064e+24 -2.2682896318340354e-01 -3.9518171699926061e+24 4.2471124166082294e+05 1 +222 9.0316425051059866e+02 -4.9465861343006878e+27 -2.7292175981792552e+34 3.7238598122950141e+04 -2.9194740102848672e+12 -5.1152139286631211e+30 -1.4241301583586511e+32 -2.9116771587637916e+07 1 +223 3.9048638864288563e+00 -2.8375870256029737e-03 2.1423586595297755e+19 3.3312967690925344e+22 3.9366216706968456e+21 -5.2077556102957605e+32 -4.3315367926880414e+31 -3.4992980554934376e-02 1 +224 -8.2759743441407305e+31 1.0259402225985620e-01 3.9187747223958038e+10 8.5202714041048286e+28 2.0462345897525315e+18 6.3077552283533677e+24 -5.4737685747492291e-04 -3.8096539469827707e+18 1 +225 -1.3268063537648014e+24 -3.0996196589081641e+18 -1.8724781720546991e+02 -1.6853564872524357e+13 -2.1411000265572499e+33 2.4746874185365760e-02 2.8565904684498560e+11 1.7700949797979754e+20 1 +226 1.5386118990192199e+00 5.2428957126800080e+16 1.2095765923154557e+25 1.6918918827319367e+03 -7.3507347276956559e+34 3.8617251499849250e+13 7.2669576951333088e+25 2.3476534888188863e+09 1 +227 -3.0387823424465780e+04 -8.1656668264037010e+30 -6.1649078115506780e+18 -9.8306481959554511e+33 -1.1742235393269600e+21 1.4733317012723221e+04 2.4336010934799760e+16 6.4616331970448868e+10 1 +228 -4.1740590652413440e+17 3.5711675897780645e+24 4.1848035507784283e-04 -7.6359796284717021e-02 3.5282340934650393e+21 7.7133283696113266e+24 8.5575918712705120e+15 -1.4356941860187943e+22 -1 +229 -5.7872948911966397e+32 5.8903515710291378e+32 -1.4388808842141890e+15 -6.4345655485352274e+26 2.2154804685684544e+05 2.2622800310260621e-02 -7.3858830257767349e+07 -1.1229956177740658e+34 -1 +230 2.7646151500420897e+25 -1.6217000603515335e+32 1.3641533659483528e+31 -8.5121147777558092e+26 -2.5901175594133417e+18 3.9001298366480431e+14 -4.8533200777372698e-01 1.8421406876381352e-01 1 +231 1.5703387477832737e+19 7.0309153810610212e+02 1.6611348986987819e-03 9.3324765310124000e+24 -1.3980120412848117e+06 2.8923151280233288e+16 2.9436527125787072e+16 6.0620731995394155e+31 -1 +232 -4.0960961545454089e-02 5.0951486891397100e+15 -3.0554671844828879e+25 -1.5051033865380909e-02 -1.3795990311330784e+22 2.5444465844220760e+26 -2.0643894311962123e+00 4.2121933860383927e+31 1 +233 2.8345602704638943e+07 -2.0750808895483237e+11 7.1664564356913162e+10 -6.9383935552111250e+12 -8.5836828250067251e+17 1.8911762084881835e+09 3.7458890692369731e+12 -6.7411491420734941e+12 1 +234 5.5294828992982500e+13 -9.0730650145609703e+09 9.2797020569274064e+03 8.7568856084754759e+32 3.6668337744526630e-03 9.3625454931379011e+00 9.1533794943358470e+05 6.1123904567205375e+29 1 +235 2.9350162188885878e+20 9.6055870738200877e-03 7.7642776195618819e+31 9.9891104541843849e+20 -5.8384015751457114e+17 4.4318884604400345e+01 9.1054427799600110e+23 -9.7296177444216758e-01 -1 +236 1.7376443402608652e+09 5.6992353812688990e+09 -1.2154203805452012e+32 2.8631793643177114e+07 -1.2977475976315051e+07 -5.9640592248503848e+22 -2.3734330827933506e+14 -1.8557783229981976e+24 -1 +237 3.2029982114831698e+32 9.3864080306162805e+11 -6.7174104398972232e+25 -2.6166742051706215e+22 -1.2301783914368576e+06 -4.9894927696152613e-01 1.3041796826157049e+27 6.5246175397117874e+10 -1 +238 -8.0224535125120117e+10 -4.6158187814620796e+01 -1.4699102422225780e+00 -4.0458694240669206e+02 -2.1600503623191040e+17 -7.4190985601082930e+03 -1.8396054635467219e+19 -1.0585294895248543e+22 -1 +239 7.8746944204295619e+33 -8.1017895299287561e+20 2.9936358991313988e+04 -7.6269553694313349e+19 3.3514808390642330e+05 -7.1110071888104951e+25 3.3806240857066955e+15 -3.8727953272518780e+00 1 +240 2.9074193355394407e-01 5.5236246625878180e+13 4.7603560501072824e+07 -1.6350376699885225e+14 -2.2499101932645794e+06 1.2517429534967630e+03 1.4027524145501593e+04 8.8295326482659482e+02 -1 +241 -3.2851294707739815e+10 -6.3179462910723200e-04 5.8276455856621033e+05 7.4247521765981834e+32 4.7893083187565526e+33 -2.2893104676483799e+21 6.3000690622838993e+03 5.3942136900144533e-01 -1 +242 -2.2585886523861928e+23 3.2761628227940346e+03 -1.7664110720027997e+20 -1.5592542466096631e+12 -1.7132965061999286e+28 1.1925579874661034e+28 4.2209857181806945e+18 -7.2166234823993518e+03 -1 +243 1.3156143088981584e+29 2.3548111895054645e-02 4.1606829278079790e+33 -8.8824143002810929e+28 3.6159120196322000e+14 -1.3639295668160019e+33 6.6538139720238209e+09 2.5856113857562073e+11 1 +244 7.9995728480553579e+24 6.2027539187181500e+15 -5.4142402350255219e+10 -6.1588679947671751e+29 -1.1701720361568080e+33 1.2930898300194661e+28 -1.1694830309918802e+06 2.8548660523084595e+17 -1 +245 6.2416863126764755e+09 -3.0556279077504114e+24 -4.6503507169326445e+33 -1.1607755553702314e+27 1.0472327794750229e+17 -7.2096380043638752e+25 1.0497698003044298e+09 1.5296306425928509e-02 -1 +246 1.7017375030789776e+00 1.0502957191074584e-04 -6.1842593928213703e+33 -2.1763410598694257e+07 4.4929104300527708e+29 3.5395692373780749e+34 -7.3164564648484898e+08 -4.8006684663168475e+05 -1 +247 -1.1031978755872492e+28 -4.0577408482794916e+11 -6.4894842916155520e+15 6.3196159959710472e+22 -1.4087950271604511e+30 -7.4395509211701970e+05 3.1001385116744599e+29 -4.0148258120168175e+21 -1 +248 -1.1055659210303293e+11 9.0659426241087904e+21 4.9023383775419778e+23 6.0883412073971680e+05 -2.0453141894314305e+06 -1.4449057682441712e+34 -2.3669981019231349e+25 1.5818375693556108e+20 -1 +249 3.4693253687086421e+23 -1.2322575366006669e+08 -8.7827116686555743e+05 -3.0229532015124150e+15 2.2540223732902185e+22 2.1934846541588440e+16 1.5775349210551369e+14 -1.8540018284906500e+24 -1 +250 -1.0782998069585313e+23 5.7236030049663071e+00 -2.0982556961726884e+32 -2.4795351600110867e+11 -1.3592819338025568e+09 -1.8590084552697744e+12 -2.8485844428451677e+26 3.6689863490492660e+15 1 +251 4.6821899125320855e+24 6.0531278146303851e+30 1.1247032466639471e+08 -2.2241241971886672e-04 1.1704595002366201e+12 -7.5466939777346967e+30 -4.3585803696845508e+24 -2.0813492706195308e+12 -1 +252 -1.0608133915753881e+30 -2.4946478931603709e+05 1.6475770573629941e+25 2.0127773873990112e+10 1.4177040864241719e+06 -1.1355073639053268e+26 1.7026840807978721e+29 4.5341961365028343e+04 1 +253 -9.5824889798229218e-01 -1.6315511659374108e+16 -4.5419976688611525e+20 3.7349702756626595e+30 4.7009354891621252e-02 6.4065249195185958e-01 -3.8092288962173120e+15 5.1525907931500912e+07 -1 +254 6.0521180784861760e+15 1.9553768766225332e-03 -1.2798060591188580e+01 -2.4810223051413815e+05 5.2476450956581694e+33 2.4097441248433209e-02 2.8584903262382423e-02 -1.7926924492168130e+01 -1 +255 -6.5915541928358268e+32 -9.2735501217019475e+14 3.9746931780470943e+08 6.3915994761939943e+19 -3.0506486423410468e+20 -9.7086170073631847e+08 -2.1380025380358432e+16 7.6897423930287669e-03 1 +256 -1.2517685190157482e+31 -2.2657591545476285e+06 -2.9288291232281460e+02 -9.7788664398254643e+17 3.5490363280374278e+22 1.5104529651760824e+01 -6.4629959245332655e+31 -6.9282469856380854e+19 -1 +257 3.2022750476733862e+17 -2.1970461126740083e+03 1.2721141437883341e-03 2.7408588637228832e+00 4.5609251708146570e+18 1.0863618067186009e+04 6.2182116079091401e+00 -3.4548561347423910e+34 1 +258 -4.1890967893140124e+33 1.1010539679087450e+15 -3.4907515023982825e+02 1.3162719900631055e+02 7.1400815238297367e+21 -1.0627483050042851e+19 1.3276053309597941e+13 6.6086447666744787e+20 1 +259 1.4731047380870790e-02 -1.0797247002473923e+20 -4.3872902010687062e+29 7.4217576076138982e+23 -2.4772797608935860e+32 9.1858401087219904e-04 4.5543264846865714e+00 -3.0741014765897260e+09 -1 +260 3.3696952031135608e+28 9.9646479163334443e+19 -4.1346572007894269e+04 1.1812101947918840e+07 -1.4189914293808364e+04 6.5787032091164633e+01 7.6069707729447718e-03 2.1770651622859077e+02 1 +261 -1.8837791363343098e+13 -1.0199246887106736e+02 6.2790002221376137e+10 1.9750191239020409e+04 1.2334643639849625e+09 -1.2881524866901470e+29 2.0743039678183004e+02 2.3130200939218338e+10 1 +262 4.3828020029176696e+23 5.2547710237545761e-04 2.1508861890947695e+26 -7.6276606410973867e+12 -1.2568510157394640e+31 9.3369801898829062e+13 2.0119281609333644e+14 -1.1240463098610235e+02 -1 +263 -1.0298914442590366e+30 -4.4006378916944374e+27 2.7721447879806571e-03 -4.4020295313408231e+26 4.4441837670677598e+12 -1.9058889861647211e+13 1.7676376416162157e+19 4.5597872238506204e-04 -1 +264 4.6885685796277548e+33 -4.2207679054759524e+00 -9.5603000719046397e+20 3.6389762373264986e+19 -9.5474479541882100e+22 -8.3761879730874249e+33 -5.2937603838155448e+07 6.4388452370471663e+31 -1 +265 1.0253430925551131e+14 1.5231644202224024e+34 -8.2495526663368830e+04 2.2725085488784947e+02 -4.9307779481146435e+33 1.9620899293881628e+23 -9.5456784593441376e+16 -1.5387590202362389e+10 -1 +266 7.0742898648170014e+25 -6.8932722396846477e+25 -3.8586812516634500e+15 7.0983773842483409e+32 2.4957837388322284e+14 3.1181330683270633e+07 -3.5714982582804670e+33 1.1635122712401926e+21 -1 +267 6.1878698692107719e+02 6.0974841222886800e+14 2.9467679874881235e+33 -3.5100433968912793e+12 2.5935910575060266e+03 -9.1741010957900586e+05 1.7647247015508820e+19 -1.7444343516629162e+13 -1 +268 -1.2799997601142642e+28 -3.6112100735752979e+12 8.2408484892295792e+28 -3.8858042231487208e+16 -1.2446305775395031e+23 1.4970713303574641e+24 3.2631117847226958e+32 3.6011760824669213e+31 -1 +269 -5.3461389013870898e+12 -4.7400057903550259e+00 4.6371014231331018e+27 3.9881726639360048e+16 1.9303485092503864e+31 -4.4505402880200584e+10 -1.3695996498614422e+31 -4.3250474067552452e+31 -1 +270 5.7627067578494774e+22 -1.0172727222268077e+03 3.4236046493314477e+22 -1.4763593906848618e+29 2.1403216033376401e+33 7.6874587113198624e+09 -2.9263872460507791e+29 2.7891024409137629e-05 -1 +271 -8.0850881518514646e+29 -3.2766033028282777e+00 -1.6664021678305785e+26 -5.2390149819227199e+28 -8.2669596755104848e+00 -5.1271417036532822e+31 -6.6645196208569315e+31 -6.0307444727376903e+27 1 +272 -3.0809565717257560e+15 -9.0956183469994305e+20 -2.2744754673424245e+19 -3.4646462171205788e+10 -1.8806279921123380e+15 5.0735286751139950e-03 -6.4506222419779592e+21 2.6525555432182674e+24 1 +273 -7.1789483907750576e+12 4.4373026540894170e+15 1.9612996042908472e+29 -7.9072134987613068e+09 -2.0489570501011925e-02 2.8626415380773368e+19 1.6651726670211078e+27 6.9049966239219312e+16 1 +274 5.0757815285457730e+22 -5.4160241216839105e+25 -1.5420230911645033e+24 -4.4605868469905160e+07 -6.8435246343124412e-01 -2.5299391905413696e+10 2.2810011302878660e+15 -2.5115171737740044e+29 1 +275 4.7624079816608082e+20 -1.8609802422650944e+01 -2.0212828092167816e+16 1.4840046932602989e+07 3.5210834311045070e+21 7.4857950485257715e+25 -5.5489993626136589e+20 -5.8488529128968509e-03 1 +276 -9.6182766202620000e+14 4.0414333782239442e+22 2.1591156583918809e+29 -1.6580414460350705e+00 -4.0949719324308576e+16 1.6538079887085848e+09 3.4953542662378501e-01 -7.8443114456681201e+12 -1 +277 1.0260356673482928e+27 -3.2392660614673871e+08 9.3915314254496221e+24 -2.6392256567226736e+23 -9.1392110227822593e+22 1.9761143894165554e+09 1.2681997358783406e+18 -1.4564134936444748e+22 1 +278 -6.7001150647477512e+09 5.0643807749219744e+14 -2.1723416745377818e+23 -1.9827988311384475e+08 -2.6182738206605963e+28 -6.8623583619544126e-01 -1.3282720559226827e+28 4.7690736322957655e+32 -1 +279 -5.3250949648998510e+15 7.5792776257647107e+21 2.2504692844197705e+11 -4.2291696220180281e+24 -2.4458850025741873e+31 4.0007832685033671e+32 5.6389328152859040e+16 4.2352842578265786e+33 1 +280 3.5239607654949054e+01 -1.0543410927519694e+07 2.2393621007010418e+21 -1.6327994852637137e+13 -1.0738695630238474e+18 6.9660491279196387e+11 -1.0650467031021008e+26 4.3663140527845618e+32 -1 +281 -7.1376184250466368e-01 -3.0127253175217505e+04 4.0227451080853268e+02 1.6306673577016784e+16 -9.2398797353157846e+01 -3.3557125850362836e+32 5.6981704282166970e+02 -4.2199676657056198e-03 -1 +282 -5.8840328820336123e-02 -1.7194536912732633e+02 3.7058189050796330e+08 -1.2080820789742563e+27 2.0379715564435860e+28 7.2123937117732169e+00 -7.7305866602594122e+00 9.8436396388665317e+33 -1 +283 -8.0027885995318671e+05 -5.4101890639910305e-02 5.6163608400981789e+09 -2.5996853108006695e+23 1.8118883514817322e+34 2.2821362867365025e+14 7.8331336486120095e+28 3.6154196459493582e-01 1 +284 5.6635866763640674e+11 5.9501696160141804e+18 2.2015192094253033e+10 2.9488020302463750e+12 4.9406554747810562e+26 4.7357897038295838e+23 -1.4893917466624181e+31 1.3761508213891772e+34 -1 +285 1.4616507417012748e+01 2.7721595737697397e+23 -8.8205872812611584e-04 8.9309312857585352e+11 -1.0823930769762973e+30 -7.7767001496164672e+28 2.5147388581481032e+00 2.4927379590642812e+29 1 +286 -2.9639744221838944e+04 -8.9457827956084725e+14 -6.6311911089539276e+10 -1.1108875736609378e-01 -1.7785672882222105e+05 -3.0607104508701917e+24 -1.0044309365678322e+08 1.0236367617373707e-02 -1 +287 -5.3206022179012597e+08 -6.0359003228311558e+09 2.3264592555189417e+20 1.2656236031200858e+23 -1.1855400585651620e+34 5.4847516267210176e+02 9.0709690928341300e+15 1.0940074981299980e+24 1 +288 -9.6888930211294107e+06 -1.0371646846485832e+34 -1.4540060757989094e+14 5.3841705243349875e-03 3.9540151655665816e+28 -1.7554858843784107e+01 -3.1017347401230626e+34 -1.0889175540015911e+19 1 +289 -4.8014288961929843e+07 -5.4024127539792375e+13 -1.9986354780197925e+14 -1.8785263242984854e+22 -5.6319706998826074e+12 -1.1893827983584925e+23 -6.2923062336780319e+10 3.7325603646404747e+29 -1 +290 -7.7610028787847270e+15 1.0657175866809723e+13 2.4906053127119102e+21 1.3625011939218571e+07 -4.0058401217248924e+06 -8.1801535886654401e+03 -4.4185016790501287e+23 -1.4679848818758979e+20 1 +291 1.7007125883392309e+13 -1.8053863807477659e+22 -9.2735902983054348e+27 -1.3693066932577582e+05 -1.1563811566804033e+06 8.0544058893724717e+05 -1.1831067783497511e+19 -8.0448330027094167e+30 1 +292 2.1315939607683188e+23 6.0410734514988237e+17 5.5672935099815225e+14 1.9746947014812896e+09 -2.7092855129612534e+31 9.7052961144204083e+17 7.6653743857851223e+30 -7.1218247486655859e+11 1 +293 -4.1436671135018999e-01 1.0087836436354082e+03 2.0347924030954961e-01 -1.2749103526112027e+04 -1.6624191805790093e+09 2.4280780463716879e+26 -5.3408901064665699e+01 -1.3581464309299803e+08 -1 +294 -2.6894547582857489e+27 -3.1405986211071535e+30 2.9581764808330000e+13 4.3407388838256111e+02 3.2062858479930895e+18 -1.0851138424183174e+24 9.3820712554065039e+11 1.0402315401835677e+30 1 +295 -2.6329842351094667e+32 -6.6730634288596899e+28 -5.9311203603963693e+32 6.8796314731081826e-03 -5.0338301233553935e+22 1.4425445643485107e+09 -3.6437523763889233e+11 -5.1140552279097529e-03 1 +296 9.6683278958592998e+17 -4.4857479589693551e+05 2.2707266594209995e+27 -6.2966759694496643e+10 -6.3407178836068198e+17 -1.8352476645831644e+01 8.0075698952543220e+15 1.6340979014782241e+07 1 +297 4.9226954630701035e+10 -4.9542692039119721e+22 8.6482231891326320e+15 -2.2888216833437488e+21 3.1310564185318137e+06 1.3020770479833158e+14 -3.4366923395920310e+01 -3.9999140723969276e+21 1 +298 -2.4516113683473122e+02 5.9424398584805944e+24 -7.4171193694778950e+15 9.9793881489110227e+24 -2.5445326869031810e+03 -2.5714326297848263e+09 -1.6525252180310580e-03 -5.1322180255051141e+13 -1 +299 9.2987410024815944e+31 -3.1108369761022132e+21 -1.0357029278101904e+31 4.8550650762927532e+07 -1.0938006388726250e+12 -9.3494561004186478e+30 1.4389730615712020e-03 1.9989612148992587e+11 1 +300 -3.6246728096198668e+06 -3.7023019508359010e+00 7.0170257223045640e+05 4.5823083949903526e+02 5.9894275643705566e+10 5.2176736301239938e+13 -1.2014235527721368e+20 -1.3099696684893506e+14 -1 +301 -6.2759483546145713e+28 -1.7132894797058463e+25 -1.7124775287132110e+27 -3.4593047377834005e+22 1.0271939976667052e-01 -2.7909184059976414e+22 -1.2815527596285733e+14 1.8156595540602395e+31 1 +302 -7.5302701693524234e+18 1.3663835443925819e+09 4.3400885394640570e+26 -1.2669736914449916e+29 -7.3158692216987066e+31 -3.2479994070080430e+19 -1.6170761692116541e+19 4.1645001403715493e+26 1 +303 8.8086469293188006e-03 -1.6940163936726212e-02 9.0081607926865388e+05 -1.4194716769223038e+26 -5.2619430402716804e+08 1.2287565350868084e+05 -9.6247136109569615e+29 -6.1904649273527377e-03 1 +304 -7.2977777929823625e+19 3.1932771798038884e-03 -6.5806125340203529e+31 -7.1115388932373740e+28 7.7069262450920641e+06 2.3325718659633983e+24 -9.3648513862583548e+27 -4.8465932462105626e+05 -1 +305 8.1559277986117632e+16 1.5334312162923091e+30 5.0417929547178443e+29 -4.2474940704060288e+16 -4.4973579384899609e+11 7.6913274418140378e+30 -6.5442720169093025e+20 -5.6762099633766758e+12 -1 +306 2.4440252259898820e+01 -4.0233578313107507e+11 6.4697929425033670e+15 -2.5760476514228320e+29 4.4538072558306120e+15 3.5646679017206217e+04 -1.4027534363807751e+11 1.6362213465528467e+19 -1 +307 2.7719201999694719e+09 1.1111026546222458e+20 5.4661272938545807e-03 -3.2888022529063756e+29 5.0847638620683792e+16 7.0585528865527720e+20 -2.5910947550302039e+11 -2.4408750265796024e+10 1 +308 1.1773875695733998e+18 2.1801547122172612e+08 8.5740971759075037e+32 7.0376944853330676e+27 6.1080193278241829e+23 -6.1664778222039871e+09 -1.3902330725985740e-01 -9.0212355735920020e+15 1 +309 -1.3043400405990625e+18 3.2119118424419612e+23 7.6951496662500352e+16 9.1956353218744202e+09 3.6158956639928980e+31 4.7618794076517537e+24 1.9209967108823359e+06 -7.0140007956510985e+01 -1 +310 -5.2133225916653738e+20 1.2834124112251756e+16 7.4913021747030739e+21 3.1694344879072867e+32 4.5978669560743928e+07 1.2165448889965069e-02 4.8933662870619006e+07 -9.8998963867406928e+23 1 +311 3.7399234781581400e+14 -3.0701363616399428e+21 1.0322372291854398e+06 -1.1174748929189120e+15 -2.5556127165897422e+12 3.6844337427466516e+25 -1.1467337721391535e+08 2.1401090720326587e+12 -1 +312 -2.2823189483922887e+13 1.6728396172086088e-01 2.7010333551594313e+03 -2.0107795951088689e+31 8.1911839702823556e+02 -3.3947967257456810e+02 1.2444210584034733e+14 -2.0709789698211726e+01 -1 +313 -1.4706997860301619e+14 -2.8509062480671226e+01 1.1301552095898870e+29 7.5780644434587157e+02 3.0457150022733789e+12 8.3883579398999331e+01 -6.0718238907348665e-01 2.4142694766604161e-03 1 +314 -1.4441858020569042e+27 3.5476559450165494e+26 -4.2383686357495348e-01 -2.3652294644178440e+01 3.8798310730787451e+32 -2.5444515158227147e+25 9.8620749963612278e+31 3.6510332971874619e+24 1 +315 -1.3737677627857162e+06 -1.1093181097671742e+20 -4.8734285461766350e+29 -3.0281666654694740e+15 2.8883086010674217e+18 1.5033021682104302e-02 -2.5580318339604177e+07 -2.2694956004862728e+04 -1 +316 -3.2309134502360844e+22 -2.2206125752277485e+21 -3.4242956417311588e+21 -1.4581308499069844e+12 2.8966617919294678e+24 1.6736045525885606e+02 5.1995687553963825e-02 -8.8380049059617377e+03 -1 +317 -5.0591539512799158e+29 4.1636749945048916e+27 8.5428523163234955e+10 -2.8390669743042798e+29 2.0233727592276310e+17 -3.6493687566194889e+22 -2.5827371888629806e+18 -2.9239911090880000e+17 -1 +318 -2.6058221164229952e+31 -2.9116331234741974e+01 9.1743545155030810e+17 2.9607742170243893e+21 -2.7283027861545769e-03 -6.7519556954938218e-03 1.9732578501203645e+05 7.5834597969775816e+04 1 +319 -7.9302363570873573e+07 -4.7314511912081213e+34 -4.2476985037469460e+30 -1.9224661674200401e+06 -9.7255188394573021e+19 -6.4783064365118563e+08 -6.7261394839663149e+19 -4.1583506414323151e+10 1 +320 -1.6233544130241915e+27 1.8712971725479578e-03 -1.1586406759998004e+05 -5.0913224026080301e+04 -2.2678214541960110e+30 8.8275588400916256e+23 -4.0330877461021994e+06 -7.1433858636473840e+15 -1 +321 -1.5107596392600396e+02 1.6785871626813269e+28 -1.1068652555135318e-03 -6.8285996346363972e+03 1.6284029181311630e+10 -1.5766337976981075e+20 -4.5067835282240045e+24 1.9775360203256682e+02 -1 +322 -1.0062422141936404e+12 -6.4064098245437000e+13 1.2171597661515940e+06 3.6302791779635940e+27 -2.5533380652943860e+15 1.7917548344430228e+14 -2.8163544420230342e+17 2.0020316782688674e-01 -1 +323 -1.0053361721581712e+26 -6.6084891277343729e+02 -2.9481794317317562e+33 -2.0925618348400337e+10 4.4525091252631121e+01 1.9040693674447218e-01 -2.0991778398146686e+29 3.2573851373662569e+32 -1 +324 2.8924686237370734e+29 1.3562820639494833e+07 -3.0001286339709063e+03 -2.5502211398885224e+05 1.0012650448184336e+16 -1.5118611740683553e+09 -8.3252851438063534e+18 1.0602082397096234e+20 1 +325 -2.3580105510208547e+01 1.2108570851120947e+04 1.0432442236172489e-03 4.9732683949429352e+10 -7.2709496317345850e+14 1.7778313330807949e+22 -8.7836961199127921e-04 7.5816749564566844e+13 1 +326 -4.5778233782039131e+00 -3.8163816019494134e+03 -1.3503170199578766e+10 -3.2277723458393039e+25 8.0111607075487940e+28 -5.9732404544353337e+19 -3.3114304533073714e+30 3.9239153886224274e+28 -1 +327 7.9903308647100811e+27 -1.3660512541671347e+17 -1.4732735892167904e+21 1.9159368053547497e+31 -9.6938365163020006e+22 6.8321653457744281e+29 1.4703040720152518e+32 3.5207258655282618e+17 1 +328 -8.0543408688285644e+31 -5.3637603105858398e+03 9.5863560661360904e-03 -3.5797375670263776e+31 -1.7178032273280137e+21 -6.5013934120389898e+18 4.8754387421094272e+16 4.5694834050424675e-04 -1 +329 1.2995296031523004e+07 -1.6044680200566666e+20 2.1464281712582385e+18 -8.2942881256474517e+06 -1.2001153521346935e+29 -7.1483797157521220e+23 3.6400091101329301e+30 -1.2144928367053322e+23 -1 +330 1.3259145345760137e+12 -8.0505138424349898e-01 -1.2553710094390113e+20 1.2905287388304205e+04 3.5380809114135632e+28 3.5166946923147964e+00 -3.3468575745310081e-01 2.7321647514279363e+18 -1 +331 -6.2657879467356540e+31 5.1798912851722806e-04 -1.4383556625011597e+12 9.5983682131439330e-01 5.1574345118756547e+01 7.0032205100441770e+15 2.4717740040401034e+30 -7.8784590947254551e+27 -1 +332 9.6774545638021916e+07 1.1025732274545412e-01 -1.3524389269691577e+21 -2.8861585546918943e+20 -1.7665982041313960e+25 -2.9951557784939963e+08 1.2061818522663716e+30 1.7452076017826892e+29 1 +333 3.1294364609445976e+10 3.7182538995630866e+19 1.9729333428883947e+01 8.0322066522326807e+11 5.2663690882016205e+10 -3.6856758278797486e+01 4.4574743858398737e+24 1.6526039268492395e+05 -1 +334 1.8614304803173535e+27 1.1945287644372616e+10 -7.0101162588990666e+06 2.0830245901256913e+32 2.1506902994110857e+04 -2.0048989997399803e+06 3.1540406403230882e+31 -7.2829537635730484e+13 -1 +335 -3.2234400866214258e+34 -1.0410536009911986e+04 1.6569767342862362e+10 1.8146105345283298e+28 6.9766045621526500e+03 -1.6255126119222316e-01 5.7987711834361200e+23 -4.4186915679497280e+27 1 +336 -5.2815939690273794e+04 6.6209766492118359e+08 1.4642997950553429e+29 4.8504720948534501e+19 1.0825384314314192e+01 4.8640811122987904e+06 -1.6613401537552280e-02 -3.8511936945034563e+01 1 +337 2.1692135382494998e+15 1.3196316014235986e-03 -4.3863166578188519e+27 -3.3006760835501036e+25 3.8790829036193974e-01 2.0461279815747103e+18 -1.5508156717821765e+11 -2.3348102470798076e+22 -1 +338 -1.7124756722523662e+14 -4.2525155255346545e+30 8.7629945346926171e+32 1.2968489067898910e+08 6.4851161721913516e+12 -5.7061052445960859e+13 -2.9200721822489297e+19 1.9171916193778038e+01 -1 +339 1.1776773212472707e+07 5.1781680383461361e-04 -2.4434158234037398e+27 -5.7958411289574076e+30 1.1659136558739367e+09 3.7759214374624263e-03 2.7284338538931128e+11 -1.3511948692288569e+32 -1 +340 1.8256670408755074e+28 9.0606376571876603e+33 -2.9277991629073517e+11 -1.1137832642059717e+21 1.5640208941652637e+05 4.3828687993995752e+05 -3.2214621068932736e+08 -4.8763527849420299e+01 1 +341 -5.5014752603408917e+27 1.2152900804962830e+19 -3.8766798917115045e+25 -3.4654257222285066e+19 9.4420687377621212e+14 2.3653786611308450e-03 -1.7822868600863934e+09 6.0203542663072143e+05 1 +342 -4.6567957436765544e+07 -2.1211719214048858e+09 -1.0210021109024531e+18 -5.6975682285657520e+11 4.8966721015290058e+08 7.4210500788266189e+17 -1.7324905004499049e+05 -6.2694229368474693e+10 1 +343 -2.0321603533672845e+23 -8.8082876251697851e+27 -5.1334180870380402e+07 2.0769309955241997e+32 -3.1583337419166083e+09 -3.3471842832390390e+19 4.2801698313355022e-02 -4.4534013022993633e+13 -1 +344 5.2310451113260061e+08 3.6815296234325754e+17 1.4983071268011468e+30 1.9835812999864517e+20 1.1040304481022200e+15 2.1976504921705254e+27 -8.6058381231155315e+19 1.4632313906148010e+34 -1 +345 4.2517784410479053e+18 -1.2147920120397072e+29 -1.6171702373986594e+13 -4.4054252852981361e+28 7.1203789895853290e+31 -3.4954903967461810e+01 1.3896400492024541e+30 -4.9627290094134830e+15 -1 +346 3.2514166390697660e+21 -6.5353291860434652e-04 -1.0382257072047304e+16 -1.7065571501073900e+03 2.8272042028384584e+18 2.8034842628078321e+33 3.1493293879230042e+09 -4.6685389891495250e+13 1 +347 3.4728085527803990e+29 3.4002740283147703e-01 2.5577926315386835e-03 -7.2064041039638062e+23 -2.1570446449142798e+28 2.3743933506653953e+13 1.4539999903969054e-02 -1.8797046730788144e+25 1 +348 1.1665180190406320e+20 3.0465702604966831e+23 1.9197865824674739e+02 5.3602947359233783e+33 1.0518607530866255e+15 1.4483205717465574e-02 5.8311964843838080e+17 6.9220257546657516e+13 -1 +349 5.6528641631324789e-02 -2.1353688046501079e+08 6.4697750236521439e+04 -1.1955869426354562e+34 -5.6403740548624369e+27 -9.8195588929565723e+11 9.3453672759692663e+20 2.1328234503508944e-03 1 +350 4.2294120115358148e+28 -5.0567222810277224e+19 3.1735391403161311e+03 -3.6004986348745762e+24 -2.8971772758202241e+19 -9.8655859073925825e+19 2.7841101122297760e+15 -1.4644699859234726e+26 1 +351 2.0893744671718800e+17 5.1023445880380144e-02 3.1470353851200916e+16 4.0528347311245972e+11 1.0123906838814668e+05 -6.1053597373660363e+07 -1.7626297403324936e+28 -2.0848184725487384e+25 -1 +352 -9.4582828382416920e+15 1.1269571618159868e+07 3.9431577137546642e+31 -5.5828030466032640e+15 -2.8347633024500902e+25 1.8696995415221476e-01 5.0131138184272995e+29 -3.3824311813776177e+01 1 +353 2.5605599601229536e+16 -1.0713250871201484e+05 -1.6008406546577219e+27 1.6790864388397069e+34 5.6770685485583685e+32 5.2473815285306880e+15 1.9999768183014134e+18 -2.1360308943993950e+15 -1 +354 1.9836483506762122e+23 -6.7673157847341833e+11 1.0837803588960328e+32 -8.3051284725498315e+11 -2.9951734987766850e+14 9.6130696935353564e+28 -8.3410025211545780e+21 3.7627683769299170e+12 -1 +355 -4.4629793564123760e+15 -9.8018992157851102e+01 -2.1648990216372480e+15 -5.2167270221934618e+20 5.3215956493415760e+32 -5.0892555305778481e+10 -1.8132438988473011e+17 -9.6403818502639788e+03 -1 +356 -2.3589469113934028e+12 1.1481957648177051e+01 1.3991278779969264e+19 -3.8278173654604843e+10 2.7948935869177580e+27 9.4514346599640512e+16 -6.0694166036946699e+06 -5.9967425811560006e+21 -1 +357 2.8643922941472847e+26 1.5004828486342435e+06 -2.4713926088306029e+23 8.4808990947203194e+30 1.9923553309588165e+23 4.0468852783462228e+02 3.7892076367759302e+02 5.2933518489227627e-01 -1 +358 -1.3841815585439305e+20 -2.2906958431519281e+13 -3.1085780011212841e+29 1.1627789873004848e-02 1.1460513786281220e+02 -1.8143654422180042e+01 -1.2784085924951344e+13 -4.1079044734577547e-03 -1 +359 -8.3416939485994601e-03 6.8728925071092578e+11 4.0068638219373580e+15 1.1399207599105564e+28 -2.6419139110848376e+23 1.9168201884629807e+10 4.8795856494820006e+29 -1.2232150796578800e+16 -1 +360 -1.8838367359359400e+14 7.1290338783415785e-02 5.7298259861171198e+31 -4.1639620352118111e+08 3.7380947445192115e+17 1.1759786976152259e+21 5.3583871093991453e+20 -6.6954558960042110e+21 1 +361 1.0333294902790528e+06 -3.5002497184388487e+33 3.0947581237204654e+18 1.7931435736767084e+33 -8.0813914447858560e-04 -6.9564590952221118e-04 3.5915233971245980e+03 -1.6497014423481684e+32 1 +362 -1.7536237034200091e+30 -7.4124209557953476e+10 2.2846166450051014e+03 1.9677356035394171e+34 -1.9155584893672358e+17 3.7396644286947248e+03 -6.2860869879321901e+04 1.9693483823317677e+26 -1 +363 -2.8259460197895122e+24 1.4234759791652488e+27 2.4558270694029355e+30 1.9226677205020769e+14 -1.2557341781518778e+25 1.2075010487474964e+05 -4.2658142029461350e+29 -1.6544388898377628e+09 1 +364 -9.4777734439504830e+33 -1.1462947263543897e+30 -2.9015277263265730e+01 -2.4135693420837981e+02 -1.5268644036978353e+18 -5.6975688583142909e+32 -5.3669800047825312e+16 -5.1191846462353755e+23 -1 +365 -2.6380062107761772e+24 -5.4591892043632594e+28 -4.1502999202637512e+11 -3.7196160508741659e+03 6.0763429774539986e-05 7.0852754016407661e+21 -5.5690735113600107e-02 8.8823799642341859e+24 -1 +366 3.0283118081350945e+23 2.3740443289632191e+33 -7.0098206736674905e+05 5.3058060438151664e+16 -1.2299520405326491e+22 1.2376652473558102e-01 2.3085548357325347e+00 -1.3515422424965479e-02 1 +367 -8.5905618884480154e+17 7.3367141713587642e+06 -1.7988223204008556e+34 7.7716763462114754e+28 -8.3765385923822123e+01 2.3700822717957931e+02 -3.6242728927984520e+23 -3.2672173861880711e+22 1 +368 2.0583484264040530e+18 -1.1234395210592657e+07 1.9342519226807904e+33 -9.6439651508023486e+11 1.8130582282254007e+27 5.6816777270016049e+04 -2.0169144286027689e+11 1.2104363801975155e+15 -1 +369 -1.8022926422718541e+17 -3.0397622606517455e+29 -4.8436266213093714e+31 3.8874919212007960e+15 1.1576671459817115e+05 2.2814417480992244e+00 -4.4971403497631860e+02 -1.1818073491556269e+34 1 +370 1.1948042783819375e+28 1.0796573361556521e+30 -1.1845703521732699e+02 2.6557777042184825e+15 -5.3894653771796933e+04 -6.6034152504579897e+03 -3.1700360314988532e-03 -5.8366286352107281e+21 -1 +371 -1.4555326714194244e+19 4.3666515687308360e+22 1.5175251594699339e+03 1.8984514752743311e+11 1.1225359268374335e+00 -2.5962183157347383e+00 -6.2352918530246521e+10 -3.4381354423206211e+28 1 +372 -6.3537672322658416e+29 -2.0367428098892304e+27 1.6008707141512831e-03 5.1888509268121538e+05 8.4974030789081473e+04 2.0441459071239468e+30 2.8463516841764290e+33 -2.2450426914603540e+11 -1 +373 -1.4781832459079786e+29 1.6296407225208289e+06 -1.9443567484210769e+34 4.4723387513258308e+02 -4.0084517392107031e+11 -6.8580641843855381e+09 -5.0466946147119600e+00 -1.9854368516366692e+15 1 +374 -4.3620121162302399e+08 -5.8568453697838058e+29 -1.9907603208206639e+07 -1.1657540785161978e+17 6.6935395090336304e+09 -3.7624544714947480e+33 -1.2760637384911144e+27 -2.2683099974308475e+15 1 +375 -5.3294535209257728e+16 -7.1315214643751096e+02 1.5804110348678835e-01 4.4089137486363733e+11 -1.0810135321451876e+20 -9.3967086605397109e+12 -5.9705837834814776e+32 -8.0787805969088711e+12 -1 +376 -9.5168866799965486e+30 1.8186596080081409e+11 -3.0010776664655179e+31 1.5874964453887273e+31 -3.1243473454291684e+03 1.2599076238285305e+34 5.4408052298372288e+09 8.9920991693876540e+15 -1 +377 -6.7986365722670660e+15 -1.1342140230740428e+07 -1.8938898839497976e+06 8.7788301581523674e+33 -1.8166099152485020e+28 1.5463063868202955e+31 -1.7940423175959804e+34 2.5744679966521704e+30 -1 +378 6.4152468715369537e+01 1.7389084862650639e+28 -3.5591957999957477e+26 -2.1444003028144474e+26 -4.0464198542941944e+01 5.5428386204087520e+22 -2.6240452847325099e+21 -2.4076211008713307e+20 -1 +379 3.9094082086887470e+18 6.4553760067701958e+04 -2.0942679074145341e+24 -8.4683039736056409e+05 -3.3051207424264128e+17 1.7698178198478830e+08 -3.8066364857095563e+00 -1.3831004110310467e+18 -1 +380 4.4133972322847381e+23 4.1088424830866118e+32 2.8702661527713155e-02 -2.5131770642299172e+30 7.6189663934329417e+02 3.8855236862426950e+15 3.9401972457448844e+24 -3.2093410910618452e+19 -1 +381 5.0487426646226253e+06 3.9602767908769056e+22 4.3497542409642151e+10 6.8730252080808163e+07 8.0203366002267849e+08 -3.7022305542209788e+21 -8.2995719771087086e+06 -1.9663708062266916e-03 -1 +382 -1.6835739848367876e+25 -4.7768946634525098e+12 -8.7199667242497406e+13 -1.3644981480801619e+17 -2.8063821370997510e+22 6.2510102534760910e+25 1.5229181827872150e+23 9.7355434367687619e+29 -1 +383 2.1436293190701600e+14 -4.5207672631310920e+24 -8.4003740071126950e+08 2.4741491805079963e+00 3.6086538324710403e+30 4.5602158277130461e+08 -4.1488569043859660e+15 -5.0809756386482438e+13 1 +384 1.9872470288343184e+21 7.3281757657664547e+09 -3.6115312272380771e+26 9.2372507016967201e+08 -2.8488235925769206e+21 -3.1215250956368912e+05 -3.0932105876935612e+34 2.5564744351245224e+16 -1 +385 6.3310508495018067e+24 -9.7923538655533697e+32 -6.7515458014167392e+16 -4.3678518894252996e+05 2.4647016333225447e-01 1.0811429204510315e+05 -1.5945955285412256e+12 -1.2562252344725003e+09 -1 +386 8.2024479007896337e-03 1.8657472081007593e+12 1.7312019711606360e+30 2.0877669343197231e+14 7.1609271583612637e+26 -2.4634571644327161e+03 -2.7439898156599533e+23 -1.4495007321680183e+19 1 +387 -1.7363434792667745e-03 1.1142960201815191e+04 -6.3719454750423809e+31 4.7943899615145790e+02 1.3425780666080924e+16 -5.1586496256484400e+16 -8.8389650458661189e-03 1.5084609518793999e+12 -1 +388 7.5573408001848419e-01 -1.0614027311347880e+09 2.1202032135914184e-01 7.6429037353323552e+33 -5.1022680533786438e+13 1.0922570822084301e+33 2.0172074067423488e+27 -1.3931416715999399e+29 1 +389 1.3323009681190492e+03 4.9200691303994602e+08 -6.4842822631908552e+04 -6.3628796265834453e+12 -8.4078507243973466e+17 9.7622869721683200e+14 5.0189715969849550e+14 2.9988701236759240e+29 1 +390 -2.0995511026472461e+12 -2.5045323655155683e+08 5.1741660345204265e+27 1.5640037750680076e-02 -4.3862897650174784e+31 -1.3328648975734228e+33 8.6602397701816770e+31 -5.8665166537145101e+07 1 +391 -1.4887410781210808e+03 1.0913752277178762e+27 -5.7760549848637002e+21 -2.7203921781102792e+20 1.2166689636825504e+24 -2.4277706389025926e-02 2.0574992005533353e+18 -3.9583676183786243e+06 1 +392 -5.9930790821322986e+34 1.0804546822328278e+11 -7.1207717640530241e+08 8.4136622049390329e+24 6.9198836822753452e+19 2.8112258298197503e+01 1.3956933675024734e+28 -6.4406898376432571e+02 1 +393 4.8168166164441064e+11 3.4199712965481833e+05 -7.0118965819554529e+19 1.2220973784936323e+33 2.8431531084866304e+21 -2.4288706140398221e+30 2.7094405476022046e+11 -1.0080199125980036e+16 1 +394 -6.1359023236492253e+28 -2.5551430580163897e+31 -7.1375752114231954e+22 -3.6603249880986724e+28 -2.7720570325447326e+26 -7.5394559600390005e+08 -4.2715840788963580e+27 -4.0084579763174139e-01 1 +395 -8.8828864956535680e+16 9.5650107518569008e+05 -2.8590023404002942e+07 2.0283652501323013e+09 -5.5816513837183748e-03 9.7870244052396665e+29 -3.3257339500463766e+30 5.4755592901101005e+22 -1 +396 -2.3705748451786448e+02 5.6623282706106592e+16 -3.8570376248029579e+32 9.0558205128629368e+00 7.1966801189693174e+31 -2.3803756708716563e+01 -4.1447540932657407e+00 -8.1731070037934738e+33 1 +397 2.6551938452334847e+14 -6.1917418317690719e+13 7.8226006949524900e+31 6.0946235579750939e+22 1.0270285933516820e+15 -5.9369803998039497e+03 1.2027981651496190e+19 4.0755285189174772e+34 -1 +398 3.0865097004577154e+04 -1.7267542244366615e+19 2.9052257134576349e+23 -3.5472045632239089e-04 -1.6870942442699909e+07 2.6762329863333521e+11 1.3685653111973404e+26 3.8612357411031667e+01 -1 +399 1.1905442520006955e+07 -5.7080452187768523e+25 -4.0322397635822815e+10 7.2920658481873846e-02 -1.8980874355912201e+10 1.1556000444454311e+28 6.8454518088389069e+10 4.4165705168504086e+29 1 +400 -1.7158056464168247e+31 -3.7295051226447194e+24 -8.5215299173554199e+10 -3.7857308356730888e+16 1.9932260283870689e+18 2.0249814233215056e+31 4.7149269138584954e+04 -3.8865462747783189e+09 1 +401 -2.4437100921776362e+14 -7.7818824921209774e+09 2.2480051887580967e+08 -9.6357423669665124e+20 1.8607476828134861e+30 -2.1567595919791155e+12 -1.1870768315544901e+33 -1.0853869285043506e+11 -1 +402 -1.0091552063324259e+03 3.3153054694802682e-06 -3.9365738448724766e+09 -3.7921595577794885e+33 7.6912510140632648e+09 4.7453561905684709e+19 1.3579196908641612e+33 -1.0544141637392815e+25 1 +403 -2.3022494611732215e+06 -3.5371474484446092e+25 1.1697212899542434e+30 3.3809062097558144e+17 -5.2299934856140790e-02 -3.0417636584907072e+05 -3.4247880011287173e+34 4.4701525071919143e+24 -1 +404 -1.6665822425426220e+31 -1.0558656803918010e+23 1.8581058565637148e+31 6.6714043192581534e+06 7.1087877166147813e+27 2.8172298574037553e+33 -4.7061288719468079e+09 -2.2040423828299560e+15 1 +405 1.1234629366605981e+28 -2.1626132809204190e+28 -1.6862309196355174e+17 -6.0567936976029544e+23 -1.2561101045308578e+08 8.7170271519911034e+02 -5.7486076421910871e+32 1.8710800077904006e+28 1 +406 -2.1073105849220371e+17 4.7607868760498515e+17 1.4746659220114536e+27 7.4908638600449219e+09 -4.1382000485301484e+18 8.8961045122392350e+23 -9.3879470861123184e+02 -1.7640420299456752e+05 1 +407 7.7377346348681075e+28 -3.2615440072866790e+07 -1.5371870956998080e+16 -1.3070841785866799e+31 -8.2869316254155114e+28 -5.1191349154409149e-02 -3.3260003766789307e+10 5.1115218571431363e+18 -1 +408 -3.0711278867287664e+16 -1.5229727576731648e+34 9.7575817380113770e+11 2.0554305000968207e-02 -2.8270505538245028e+25 -2.1030788609205142e-01 2.1025299430504623e+08 -3.0435073225147993e+05 1 +409 2.0155694962363825e+15 -1.0787258954271871e+26 1.2162897885120229e+30 2.2624140658582858e+05 7.2740126115387738e+27 -2.0265197639887672e+30 -9.8644629079926858e+01 1.2243636922995422e+32 1 +410 -1.5407830986598901e+02 -5.5879789353183641e-02 -3.8477709906177500e+12 -1.0310862644459972e+15 -2.1351831505547085e+09 -3.7145876173386227e+24 4.7403035294463501e+10 2.0438174212392126e-03 1 +411 6.6780603191826860e+27 -6.9320978047059501e+19 -4.1764702824516542e-01 -8.0380778847201799e+22 -1.6942328303130761e+25 -1.9629404197516188e+05 -4.9715833634868890e+17 5.1865131827702426e+05 -1 +412 2.1029171528948090e+11 -1.4419716248636532e+21 1.7278199025188677e+26 7.0152696577741314e+27 -3.0943174693287183e+00 -1.4157788753715699e-04 2.3786628149369871e+05 -2.6405524258171880e+15 1 +413 -7.4283657028912441e+20 -1.2872191117454467e+25 3.5829134883922005e+08 -8.1489267814394584e+00 1.2369376901837912e+16 -1.5307480084180458e+10 1.5832134422687473e+03 -5.0799426030706917e+05 -1 +414 2.7235404397964330e+03 3.7634976108725297e+01 3.4728246268564890e-02 -2.9043646953245350e+34 -1.1888200836482538e-04 1.1079454142401215e+23 1.0158505939534676e+08 9.5972009844729910e+03 1 +415 -2.8672381565567267e+25 3.1355887592016000e+14 3.5698844750316154e+23 -5.2697565783851128e+05 1.6259858911818031e+21 -1.0016383837900622e+26 -1.8863621762205721e-01 -5.4210922086577148e+11 -1 +416 3.1400735264237904e+16 2.3368212843892665e+05 -3.9911672187744879e+19 -1.8327777360033926e+12 -5.6750767377947225e+23 5.7468958154358630e+17 -6.5820895432095649e+03 1.0244420771991838e+30 1 +417 -1.3858881436460410e-01 1.4715221722802694e+01 9.3891412560330348e+21 3.5933444957632913e+19 8.2058049820268099e+34 4.3740925232582023e+13 -9.2085583088509827e+02 -2.4089262109871955e-02 -1 +418 -2.1282080416324867e+00 3.7255911492174470e+15 -1.5296545738343647e+22 5.0365057452093971e+08 -1.3820140864878253e+11 1.4677697135130133e+23 2.7492926606242101e+00 -5.8540109320915094e+27 1 +419 -1.9795679044893906e+00 3.6146201236380198e+17 -1.3214392962464708e+10 -3.4113500379443500e+28 -5.0503701259991640e-04 7.1426425725140736e+30 3.5603881996450175e+20 1.8837017871157099e+07 1 +420 -8.0004482241337448e+10 1.5762726269493321e+34 -1.1088095351961222e+00 -1.0113839659589465e+05 1.7488083202174697e+06 2.3876108679661155e+02 4.3937599459487854e+10 -1.3466204404025779e+25 -1 +421 3.7830363782188886e+20 -7.7222424601692300e+26 -2.9581487270807400e+14 6.0709667744940701e+00 1.2491174873951159e+29 -8.7495119417530719e+13 -4.3153533159382362e+05 -4.5955061980984617e+31 1 +422 8.5253229716679993e+09 -2.4349596914646463e+32 8.7366614784593380e+15 3.5698781384068979e+30 1.0814652466365936e+10 -1.0628077432695031e+14 -1.0143862185404958e+17 4.7216648945255174e+03 -1 +423 4.0898431110198064e+16 5.6399923276609823e-02 -8.2364960828075342e+26 -8.3498631471502874e+05 8.0896934311220419e+08 -2.4528368145774603e+07 1.5663865643615134e+29 -1.4857607272162705e+13 -1 +424 -5.3791158983041882e+11 -1.2887900391391754e+09 2.4693952731087987e+30 -1.6237239993936431e+12 8.3767589006474609e+11 3.1353872268286123e+29 3.9391087390624189e+18 -8.5630273395583406e-03 1 +425 7.5925486816358796e+31 2.5738531932830584e+16 2.4673806445985067e+30 6.0395467440544223e+24 1.1589691445391421e+26 1.3425740182305580e+22 6.4354400129200150e+22 -1.6421662138321675e+00 1 +426 -4.1411995030544014e-04 -2.5930486055645059e+21 -2.0562274370892811e+27 1.1836144468266063e+00 -6.5575301716942064e-03 3.2985753826243002e+07 1.3294592749544056e+10 6.0597431131342784e+26 1 +427 -2.5923465336604004e+20 -2.0251915003015856e+21 -4.1313459231739552e+22 -1.1355059770547131e+06 -2.4485707935558909e+26 2.2093402230408669e+27 6.7711696739724750e+14 -5.0123273402699660e+25 1 +428 7.8414745564338955e+03 -1.6928599715769421e+26 8.6532347744559825e+20 -3.1863062692277719e+27 1.0714651543034373e-02 -7.5549313354162583e+22 5.7833103600801739e-03 -4.6002692242524672e+16 -1 +429 -2.4827648737355127e+09 -1.5587719360929661e+32 6.4265113527249434e+12 9.0177838330185608e+10 2.4077719923262801e+29 1.7545890309467021e+17 3.4249354792941100e+15 -2.9789523171085781e-04 -1 +430 2.4562128965456133e+28 -2.6557856804892700e+22 7.3996523842338030e+20 -3.3595820113640137e+12 1.9566856910929397e+08 -4.5520944034426678e+30 5.4867301802538246e+27 -2.2397836301388113e+32 -1 +431 -5.9462584448313522e+09 2.3979873579564726e+04 3.3153445239503863e+13 -4.1480766123302621e+22 5.1965421216809372e+32 -1.5175671789385325e-01 1.0508628006635717e+24 -2.2956224641819179e+08 1 +432 7.1023505039552506e+28 -2.9203183312568182e+20 -1.2102387227812424e+07 2.7177406050295817e-02 7.3443228613697523e+06 2.5726838054029460e+33 2.6401651146926648e+04 9.1282782139370820e+24 -1 +433 1.9688408978211769e+10 -3.4071669693740773e+01 1.1182718226799808e+27 3.1137554947283067e+18 -2.0577241705402816e-02 -3.5131724245249536e+17 1.0733929291210293e+19 -2.9700353376076527e+09 -1 +434 -1.1297236594510801e+21 7.7418519119008973e+07 -3.3361459760748798e+30 -2.1027568716223560e-01 -7.5617559040768223e-02 3.8421807674757843e+10 -4.0887147053695775e+26 -2.2064539411236965e+06 -1 +435 6.3994586903336290e+02 -3.6514820940330848e+06 -3.4456416330013027e+23 7.3046149632922000e+14 -1.8936032845452801e+03 8.6049382866382412e+14 5.3840506753266126e-01 2.3934057764079523e+25 1 +436 7.9004307220342541e+27 -8.1484894629077438e+20 -1.5235940826876828e+16 9.0422880693189628e+21 -1.4978306105207469e+01 1.3660907761330416e+09 8.8801150234170336e+02 2.1131207652370665e+07 -1 +437 -6.8838620592118794e+04 1.3992423821346875e+30 -4.0146588772845018e+00 1.5156407669871619e+27 -5.7592431656120300e+08 9.7453749461715456e+17 5.9316886311829422e+13 1.2106723943357101e+04 1 +438 -1.8113288436710563e+03 -4.6198693756675518e-01 1.0465201841567815e+32 -3.4607423684666344e+01 -6.0977332836180519e+24 1.6345574848926879e+25 -2.3443044627859206e+19 -1.2420276173535706e+11 -1 +439 1.5445822073769857e-03 2.8893724698967224e+10 2.8229719279664941e+05 -3.2912133003558464e+16 2.5152982809587480e+15 3.1550187599351088e+32 -1.9936194945540311e+09 -1.0405455500488281e+14 -1 +440 -1.6564125211524175e+31 2.2308987531789256e+01 -2.1301588209120167e-01 -1.4037224230904439e-02 -5.3139014703561969e+33 -1.5369889671049545e+30 2.9235321659974004e+06 1.4591131641595382e+22 1 +441 -8.1732254581035850e+15 2.0763431706238479e+18 -5.1163443711667480e+10 -3.9561067749533296e-01 -4.0007389737515204e+27 -1.3482416755699085e+32 1.8503029297002904e+32 -2.7061459949885630e-01 1 +442 6.4623620729958617e+01 3.4399106124611051e+22 2.2590338612695412e+14 -1.4446739374526082e+03 -1.0878129198859550e+07 8.7349990500638985e-01 3.6341436507843088e+32 4.1756096919035866e+00 1 +443 3.9445228951670594e+24 -1.2383573566877664e+16 -1.3087258489973222e+14 2.0189356591799847e+14 -2.4839863254666626e+08 -8.3340427794156446e+09 -5.6398924638346847e+21 -1.8655224039696777e+05 -1 +444 9.9814861589963226e+21 8.1630423908674965e+28 1.1115192225837617e+21 -7.4658007559238219e+08 4.4486116467467980e+15 -1.0390623707218592e+08 -1.4969066921026968e+12 5.2274267488884225e+29 1 +445 3.8869520999437555e+31 9.2344209267959055e+24 -2.9025290799536878e+21 5.5653657514195049e+12 -3.0008032371983089e+28 2.8752050150269329e-03 3.8992179395832878e+08 -1.8579086933516180e+00 1 +446 -1.6047796070292982e+18 1.3830765425651299e+20 -2.4705561013594206e+33 9.7539186295039332e+22 6.6406297869374339e+02 5.0603129199475973e+01 -2.9539209067793532e+29 2.6033115057353636e+04 1 +447 8.5435157780643298e-03 7.6642507375361013e+08 1.9910187039090288e-01 5.9264588995005205e+00 -2.1134178415464731e+01 -3.0162411988711332e+18 -7.4680473107552035e+26 -1.3700367773426911e+33 1 +448 -1.3286394365437952e+16 3.0727786909502561e+31 -7.0776738279025950e+24 -9.2250939021497848e+31 6.1561009357363135e+06 -8.0611660670927144e+24 -9.0919020877505946e+25 4.8584411130781302e+02 1 +449 -7.2013787070747266e+12 -4.4407968076649500e+13 -3.2209137461732686e+31 2.4044593929602489e+29 -1.9899115230960090e+17 -1.0609653064896609e+27 -1.9477141472997419e+28 -3.7552475081041484e+21 1 +450 4.8862282045369083e+27 1.0631372275675946e+08 -9.6926892536715092e-01 5.4850678230223417e-02 2.0694173072892607e+30 5.4360364796654321e+11 -4.0901194487285118e+09 -1.3194185727718970e+04 1 +451 -3.8818406190605747e+34 1.8840769311360452e+07 -4.1446915826421432e+32 4.9917187327286001e+01 2.4123988873466097e+18 1.6004398649391655e+10 3.4135442967418960e+12 -7.6820065429126321e+25 -1 +452 3.3222083433617106e+25 -4.5699279788218364e+07 9.8811659853275003e+25 5.1755906621977620e+18 4.4568990473928458e+18 4.1814069258274738e+11 -1.6354406057803275e+06 1.5298951726926760e+19 1 +453 9.9769019371032953e+19 3.8492425278542422e-03 -4.9109497859843031e+23 -1.5450678028319075e+14 -4.6625400455036564e+29 -5.1572878197020799e+01 1.1293601765984904e-02 5.2607349055600525e+17 -1 +454 -3.1632935030615066e+28 2.3919317228138993e+32 1.5858247840098892e+01 4.0206890545976984e+16 8.8062804092140980e-03 1.8919701766958513e+21 3.8589389459932630e+20 1.9678246188289550e+14 -1 +455 2.2533482864543559e+23 -1.2032103387182984e-01 -6.7125220083028639e-03 -5.1314497892873716e+25 -5.5122053162607372e+03 -1.5767270644934930e-01 1.8904499131888258e+01 5.1629310137099130e+17 1 +456 -3.2493194402401026e+19 -5.9074683099712517e+10 -6.3605537427547354e+01 -6.0819654612403247e+03 -3.0863683202179384e+09 -4.5278308916835375e-01 1.5679933780330520e+01 5.0986464766017694e-03 -1 +457 3.2971035678304415e+03 -8.8159698934395794e+02 -1.2421897519262147e+30 4.4891464052532701e+05 1.6261358472463872e+16 4.0537842096262239e-03 2.4925454460196649e+24 2.7521902900660173e+17 -1 +458 9.4732881043555400e+33 2.0715300783492487e+04 5.6536306908182372e+26 -2.0758336068037525e+02 6.8951850975409968e+16 -1.2838878911239172e+11 -1.8426289518779844e+13 -1.0203715367698808e+16 1 +459 1.0828572525983433e+19 -5.1106653482693427e+17 -3.6321875745773044e+21 2.1959969507406664e+13 2.6267022644646521e+11 -4.4365174940831997e+31 -8.1874828632392616e+09 1.8126657247305984e+13 -1 +460 -2.1727342060469556e+14 -4.8473385666058972e+30 1.4470863923853174e+21 2.3378053882203875e+13 -1.0126710190377235e+07 -2.4878207147309688e+21 -8.2383623772154104e+23 -2.2646666418959866e+09 -1 +461 -7.0565213774652224e+09 -2.3099455584109304e+16 3.1434586345066869e+04 -3.5880269355460048e-01 -2.0491073190177874e+04 2.6392721150396032e+16 -1.3015595767059907e+07 -2.2475894798243300e+18 -1 +462 -2.1577120670411449e+32 2.5801537414315391e+01 -2.6763094206342156e+14 -1.0862096482260924e+25 9.0963861236044337e-03 1.4448253022850589e+33 -1.0668573825792433e+04 -1.4536697036743253e+31 -1 +463 5.6176032040478950e+22 -7.1639338355559353e+22 6.1611403619133039e-04 1.3988844265841731e+14 -5.9682598912464977e+25 1.4139200714340496e+20 -9.2501773982422961e+23 1.6654839319557754e+20 1 +464 3.8383105835752140e-01 -1.8201943555075239e+34 7.6098628521045407e+33 -3.2122696289775848e+08 -1.8598761465292835e+08 -4.7467265866781953e-03 2.3946344135892723e+03 1.5493688134451000e-01 1 +465 -5.7509363813946522e+18 4.0655120976010791e+05 5.9681527068809763e+23 1.4547737940416698e+17 1.4697216991209235e+17 -1.6386619896787536e+22 8.2752003259637109e+12 8.5530655797165449e+12 -1 +466 1.0157678285238209e+09 1.2599791485818668e+05 2.6257773712304290e+06 7.2249537969202201e+20 1.1531613354856094e+28 4.8310809019956196e+00 5.2010898341717783e+25 2.5995600264725184e+16 -1 +467 2.5910710578430631e+00 9.7539284698691865e+25 3.5833106443851471e+09 3.9823743859109893e+06 6.6942339898217791e+19 -1.0909080638738295e+19 3.7595957862611939e-03 6.6220054061884817e+25 1 +468 -8.1621531547674703e+34 -7.7043195831352599e+27 1.4903540046255838e+26 -4.5838080702533392e+28 4.1129009276617742e+06 -2.8077657982208534e+14 -1.4955725798124664e+32 5.3507534810018677e+11 1 +469 1.1970752714705476e+24 6.7166828920741061e+31 3.2556693614334745e+09 3.8824606925052702e+33 2.7867956837423370e+10 -3.9508216476092513e+26 4.2190245296519905e+15 4.4478090913632976e+25 1 +470 -2.6697176406211943e+12 2.6620288706275328e+16 -7.6502427306524561e+11 4.0203516007058267e+29 6.5384623375376205e+10 -7.7856459187201272e+00 -3.5917249358470226e+03 -4.0115132715978172e+10 1 +471 -8.7899543187347422e+02 -7.3129429730247539e+12 9.9124728371248935e+33 2.8306696346010491e+20 1.5319244987223306e+12 1.4750990504013806e+34 9.7212698941880546e-02 -1.2686367693883163e+21 -1 +472 1.5853864740886893e+31 -1.7632381633237008e+27 5.1663842899175637e+04 -1.4493668143672539e+02 3.1180262378074675e+18 4.3425459806464227e+02 -5.6142886004669879e-01 -2.9167088267724795e+09 -1 +473 -1.2211986049089427e+17 -5.3204782733681152e+17 -1.2727328454319555e+19 2.6553441934071136e+17 -8.0566290281389937e+31 -6.9550003946216713e+25 1.6873428323611562e+12 4.9517606542933606e+19 -1 +474 -6.4765027940456060e+15 2.4837047420853699e+10 -7.8305952225575852e+05 -2.0479058274892013e+04 4.1987984342775058e+31 1.3544680057585692e+11 2.6147906662544027e+07 6.0891647214930811e+11 1 +475 5.3875320414867066e+06 7.1282964459151328e+12 -4.1818923723137500e+11 6.6309664057266722e+06 -7.9309659347435856e+09 -4.9740427614865023e+19 -1.0064426365394325e+12 7.4535452950978406e+13 -1 +476 -2.5015530994085952e+21 1.3294755917549277e+12 -6.3080359820539156e-04 2.0404906510003521e+12 -3.2805632509252252e+25 -1.7952771788552777e+11 -3.1747844786081658e-01 -4.8396864005077491e+30 -1 +477 -4.1500081048064560e-02 2.1545624845856935e+01 1.8117878602596194e+00 -2.0411283687005153e+08 -9.3794609285386862e+24 -2.6613096402276502e+31 1.1541289152872845e-01 -1.6679606770037110e+21 -1 +478 -1.1799716023469329e+33 -3.0889845799682895e+04 1.6420934296299936e+17 1.0970470901195840e+01 -1.4037775456158752e-02 -1.9529110091758012e+21 1.3991650868644616e+24 -1.2473740058806255e+22 1 +479 -1.8535013816991127e+29 1.2015440591713662e+21 4.1828699637677900e+01 -4.3283378490543382e+03 -1.7750375597484968e+16 1.9544858938863004e+32 -4.2572680116684557e+17 -3.5821233985801262e+26 -1 +480 -1.7963020906759603e+06 -2.6250200422668219e+25 1.6770952114691962e+30 -1.3820933019875281e+13 -3.3260181718459965e+18 8.8087765364854530e+28 -3.6800114387488584e+16 1.6248630183313300e+14 1 +481 1.5193180902590750e+14 -4.9740511612698529e+06 3.6577043934918896e-03 -2.0110623670707114e+09 1.5535948118970740e-03 1.4495958659408016e+09 1.1557118533289521e+18 3.5480117791941711e+28 1 +482 -6.6340489961525396e+27 1.0459048964769561e+14 1.0158920418213332e+16 -1.4593630387484306e+16 -3.0995946225596600e+26 2.4175244013863678e+14 -9.6648887638554798e+23 1.0341896810276497e+11 -1 +483 -6.1325660181521559e+08 1.7138358700935153e+34 8.8811554142824653e+18 -1.0975079767509191e+24 -2.9542970681365170e+25 8.9856472183332639e+27 4.9878545950100729e+24 -1.3612041337491816e+10 -1 +484 -2.1019902939020060e+06 -1.1889998392431875e+17 -1.6011849382899478e+24 1.4299653145862890e-02 1.0836797577567383e+21 -4.8216668387583986e+07 1.3209292235616874e+34 8.4686470801089732e+33 1 +485 6.2327416328693214e+30 -8.6118382563754959e+27 7.0993841141882684e+25 -8.8355989193681467e+08 3.1248350000773067e+22 2.4556579088228038e+17 3.7236583700821262e+14 3.8210517805676369e+33 -1 +486 5.2645453447743821e+31 -5.4840228403874040e+06 -8.7524267225333458e+23 -4.7721058620256811e+07 7.8499619020113418e+18 -5.3183123629939500e+13 -3.1022797160638496e+05 -1.0323559400704757e+34 -1 +487 4.1572182162246723e+20 -1.0291278862607428e+10 3.7706673307655128e+24 4.4239029377470668e+28 -2.2978668088320504e+27 -9.2971039980516436e+32 -3.0211655132083974e+17 6.5759263372125017e+21 1 +488 3.6639332161279459e-02 2.7538761061513454e+07 -3.8410904778014201e-03 5.5329377000950075e+14 1.2156423320958776e+28 -2.6175092748541786e+00 -1.0785051549937484e+24 -4.7310014988712896e+26 1 +489 -3.7664289882195352e+28 -3.5689825896223947e+03 9.0706465904795097e-01 6.1269255081339213e+23 5.6483155067841974e+24 2.1078986049760269e+14 -1.8896930912743481e+00 1.0065496340533169e+06 -1 +490 -1.1808003131477085e+23 8.0518559970195588e-04 -1.2724564737017010e+02 -1.4767540356293853e+02 -2.6104837499540419e+14 7.2289162862338820e+15 -4.2180172321694885e+10 -6.9493338986491616e+32 -1 +491 1.3442978170036386e+22 -2.1799388578755229e+33 4.4143380678150038e+01 -1.4447944857614903e+26 -1.7384980522381354e+03 -1.5525729307251778e+01 4.7232093129155012e+32 8.4851585902798958e+09 -1 +492 -9.7511300418251694e+29 1.2877643673399704e+27 -1.9162497304685847e-01 1.4630937139461304e+11 5.0778976431830050e+33 3.1501989814671591e+07 1.1811077703616116e+06 -2.1958016359098082e+09 -1 +493 -9.7058843708887407e+24 -2.3953928974785975e+25 8.1438816506596053e+33 2.1929153100869074e+30 1.6525001316622570e+07 -4.3701530019016422e+21 -1.5785217956055934e-04 1.0719643244997607e+12 -1 +494 1.1673928288835388e+10 -1.3408035262283478e+16 2.0822749313014901e+02 -6.1604953028500185e+05 -1.1567923094155498e+17 8.9746546149464881e-03 -4.8861954478293066e+11 3.4723292610251060e+15 -1 +495 -2.2909078201779987e+34 6.0827425303689781e+29 -1.4430498739762475e+23 1.3640045486140211e+03 -2.8791932807189781e+10 7.2658380806999121e+04 -7.7849920866363263e+05 -2.2820064664818956e+31 -1 +496 4.9147510293837502e+32 -1.4461996481544526e+33 7.2578164074436317e+28 3.1997805207505971e+03 -3.8378328827106400e+15 -1.0606536618070876e+26 -1.7366169180963418e+09 1.2022848423914155e+34 -1 +497 -8.8556622752525898e+12 -9.3980221204873760e+16 2.4414247606455270e+23 1.8242779899592385e+07 -4.0828021531157403e+25 1.6518174661533336e+22 -7.7381288712347310e+26 -5.1821552338677330e+30 -1 +498 2.1249634773650543e+23 -2.2420782508525570e+15 1.7832147646224905e+29 8.0056691456750080e+15 2.7077721192798780e+15 6.8654486682500231e+00 -3.9106409238192454e+28 -2.4576920424431041e-02 -1 +499 -5.8394342988343396e+01 3.0492920776810378e-01 -1.5969602250326220e+15 -1.9421532858967913e+31 5.4309046443449775e+14 -8.7666430636075469e+12 -1.1719748324372104e+29 -6.3568440494662539e+13 1 +500 1.8932152028624346e+24 -2.1895168357551483e+01 -1.2003829421211475e+12 -2.5136861558611795e+15 -6.4620083986150687e+19 -8.7487382927211090e+10 2.8595429078451814e+17 -2.5627796855044626e+29 1 +501 -1.4600644497094670e+26 3.0141846895559424e+17 4.1435397483152146e+19 -5.8517348070234251e+19 -9.3748545993684373e-02 -1.5284663260367465e+13 1.6213890566505326e+25 -6.1036337668776042e+01 -1 +502 -1.2934289351476448e+01 1.9225967852791149e+17 -1.4087644503463145e+13 -2.0398603648734634e+31 3.0284626153914359e+33 -7.7966931117104891e+33 1.1230127545278031e+21 -1.4838222815358892e+27 1 +503 7.9252750917458993e+25 1.0353350139888534e+32 2.7595065537131104e+10 1.3890375771690388e+09 -3.9363844060009467e+18 6.2185992588366795e-02 -8.5850482350272734e+23 -1.9675678422758220e+00 1 +504 1.9799508256205750e+14 -1.0644873909117932e+18 -3.3201245925609906e+19 -5.8825540650498397e+01 1.0337994192548627e+08 2.0033260879995899e+34 6.4360606353601850e+25 1.6960844919249367e+18 -1 +505 -2.5337655055558243e+17 4.7421410650707484e+25 1.0784506053243490e+07 6.9188739601397852e-04 -2.8768029700910500e+13 -1.2400714113739808e+31 -1.6514307627882944e+16 -3.9688171861754790e+15 -1 +506 3.0528281999476060e+19 6.0207005009978921e+18 -1.3732694563628545e+04 -2.4725690425885009e+05 1.3491273419358645e+25 2.0165318484312809e+00 -2.7561181789974864e+22 -2.4385201980190758e+32 -1 +507 -1.6861833814326434e+02 -6.2374302531942070e+28 4.7844565491424770e+09 9.6342001497472210e+09 -3.6954553000749446e+26 -1.3883975347161014e+05 -1.4024144141730382e+34 -6.6450815873479248e+11 -1 +508 2.1074217989933747e+25 -1.4664822248403276e+19 -3.4404604208455206e+17 8.4896515305735720e-01 3.2024589849630041e+00 -3.1239282457506723e-01 1.1655257027632816e+30 -2.1155298543824220e+18 1 +509 1.1952146991485290e+04 -2.1894165153011573e+02 -2.1480134290013762e+19 -2.6393657651415559e-01 7.3131654911401248e-04 2.4457003605643635e+21 -1.7454571087915421e+04 -6.9381033736951462e+31 1 +510 2.6952169793318538e+05 4.6167763082981555e+17 -3.6110453506928542e-02 -2.1332213489898095e+15 -1.8856300545838192e+00 -4.5616698521039854e-04 -4.6536543051030499e-01 -5.1560039006883845e+22 1 +511 3.3832325952694389e+34 3.6225171628344789e+07 -1.0007206282622668e+20 -1.3341848057355568e+32 1.8801816044419253e+08 4.4907746202848751e+00 5.1588334850821594e+10 -3.9403281149142700e+15 -1 +512 9.5775857952737818e+23 -2.0466733224128341e+14 -5.5651284815422530e-03 -4.4801808013864351e+20 -1.5138407094799309e+09 -5.3189475796043639e-01 1.0937579052181785e+28 -3.0436842870542573e+17 1 +513 -2.4440114615380972e+00 3.6644345103107731e+21 -4.3550829440697037e+17 6.0186993414239731e+27 -3.1734759368541967e+34 1.0065807853986226e+19 1.6389757069831900e+14 -6.8408371616999774e+32 -1 +514 1.2402776730386744e+04 -4.1881001412235804e+01 -6.4507980538577510e+15 2.0674195499653954e+30 1.2789547604629679e+00 -3.0906899918767391e+28 3.7407156638324341e+10 1.2292328123353827e+11 -1 +515 1.3217049364778636e+16 5.0100580324606080e+33 -1.5891024429833167e+09 1.4061182361966834e+34 -2.7088787704235810e+22 5.7959407583740018e+06 -1.4761994059591195e+08 -3.6096049229090027e+10 -1 +516 -3.4773350313326120e+15 8.0185598024389946e+25 -2.3325946025314184e+02 1.4897093375169489e+23 1.5298650358385515e+02 1.1399331498266618e+27 -1.2777453805431819e-03 6.6464967030931860e+06 -1 +517 2.1496302718114478e+01 5.7532799162406500e+14 -1.0073660134152318e+34 1.4252315691685603e+12 3.9765350779850489e+08 -4.2780127033936082e+30 2.1922043708468166e+00 -1.2868404911699124e+07 1 +518 -1.5455244578168344e+13 1.1229641457295287e+22 -5.0864983655818694e+04 1.2464466689239883e+10 1.0879468796299330e+19 -4.1995090906696000e+17 2.1449168848548715e+09 2.6928003005019629e+21 1 +519 9.8302191952540650e+14 -1.5091113775588243e+21 1.9478888557206102e+17 3.8378941045842913e-02 3.3658040356945768e+34 -9.6737998619489401e+23 8.3890759974355609e+22 -2.2386898349163138e+26 -1 +520 5.8204411305017139e+01 9.8000959097892969e+28 3.3548370067703194e+18 -3.3885948573107567e+10 9.6678847791476992e+17 1.9664907921188203e+12 2.8979448060627977e+32 -5.8240707164383930e+15 1 +521 5.1256656734448742e+26 2.6577873658087480e+18 9.3090984959680512e+00 -2.0084039422607330e-01 -2.3680585121980323e+23 3.2086665652059805e+28 7.8549084050986240e+30 5.3575879619952431e+01 1 +522 -2.9914777652582994e+04 7.1278237655144906e+27 -1.7167351746755670e+05 5.7332393881045454e+29 1.7633429937956009e+10 -2.0991902940112841e+05 3.2128787372142238e+00 -8.7545670654477683e+23 1 +523 -1.8712981049544029e+09 -2.2544064192664505e+30 -2.2273063224169359e+01 2.0686631364267395e+32 -3.2439182357098509e+28 8.4647597215673102e+01 -5.6199042165119912e+12 -2.0982663656749848e+08 1 +524 1.1154632940323393e+02 7.4393540362133414e+17 3.3599761880105122e+10 -1.2396702777121780e+14 5.7151426355480626e+07 2.2888263957159969e+13 4.1774916211890252e+06 1.4987427786610258e+01 1 +525 3.6074940453702964e+00 1.6485301372386998e+19 -2.4154688865356851e+17 2.1928496019953046e+21 5.5652072463048534e+09 -2.5837964321905289e+10 4.4256339110489995e+30 5.9539789267087461e+28 -1 +526 7.1337944760968664e+16 -1.9623676068572367e+23 -1.7863124337438222e+07 7.5348365958098606e-01 -2.1926715410280431e+00 2.7606741343315364e+00 -3.5546266051167508e+31 8.8525695267677580e+15 1 +527 1.0699838663449425e+09 8.7370370494722150e+18 -2.4216094355315610e+17 1.1152947135230498e+28 3.5485351651336279e+24 4.1000114748857759e+18 -2.9844221291447592e+00 -1.9728570439176378e+29 1 +528 2.2657754823529327e+10 1.7148246987358511e+26 -1.6244041637202437e+34 2.1665600327089919e+01 1.2041937249597179e+21 -3.3266559551892387e+10 -9.0404765753924982e+25 -4.8101232984105683e+26 1 +529 -5.9574186224236393e+09 -2.1037931241843510e+08 4.9673913515327456e+01 4.1706035820469437e+10 4.9000942458295466e-03 -1.5564704170228573e+07 7.6112184150212059e+00 -6.2967641113935953e+00 -1 +530 -5.4057885489667368e-01 2.3923028209889832e-03 1.9012055033448982e+31 -4.3465884351477742e+21 -2.4027653286597643e+09 -1.7600155060652023e+33 1.7570719252641070e-01 4.8018658709041476e-04 -1 +531 -9.9410951313221914e+04 -1.4273986143464094e+19 -1.2933265919626530e+25 -7.8186481277542666e+12 5.4826518100966545e-03 6.5251257306013195e+21 -2.4657194863416914e+12 4.9988249417565427e+33 1 +532 -1.8927497902893630e+05 -7.5497480328389481e+34 1.1651090095272801e+18 -6.4960371580736520e+31 -6.3190076730583812e+13 2.2362887772567975e+24 6.1490196760890245e+09 1.5726720056410183e+10 -1 +533 1.7453942617214426e+17 -4.7707748246317351e+01 -4.1629008724113660e+20 -5.0789350118695177e+02 5.1285735115955353e+08 3.4600118769408221e+11 1.4528238353772953e+04 -5.1277898417965355e+09 -1 +534 5.1826581772333063e-04 9.8140219141466810e+02 1.6710714046810811e+22 6.3236639076883721e+08 5.4666236408929989e+07 1.5029408712333243e+32 -1.5004856589076841e+18 4.1845928972381706e+26 1 +535 -7.9920793339527818e+32 -9.5070110709844280e-01 -1.0846130429346384e+28 -1.4121523203098008e+17 -1.6093064711305449e-01 3.5374258530260587e+27 2.4733300307178407e+25 -4.1891136847556635e+32 -1 +536 5.6638867939584770e+01 2.1182026592977824e+33 1.0276231601756196e+08 1.4677663459220744e-02 -2.1915451213829605e+27 -2.6931790935703237e+00 9.0080014974716905e+03 -1.7977507516836806e+03 1 +537 5.1011673802993140e+20 2.2778875742837348e+23 2.0829802820879388e+00 -2.4100624853478004e+26 -1.4347539693213849e+31 9.3973381703507042e+08 -2.8461393032998149e+29 7.5523287072206493e+00 -1 +538 -3.0389755096139878e+23 6.8559389765582251e+23 -1.4253001879682396e+16 -2.1362149166042775e+07 -1.1342041969477298e+30 -1.1817577059860735e+00 1.3360048497769418e+24 1.8417956714915396e+12 1 +539 4.5192850982395784e+32 4.0021608320238184e-04 2.8289814679031470e+11 8.3902815129122320e+15 -3.2043267809670950e-01 -9.8406722315407649e+05 -3.4833423235993687e+22 3.5391473779591578e+17 -1 +540 -6.6337048740644303e+30 1.1068222320369242e+32 6.5224249091427549e+32 -1.3646575310465491e+11 8.8392449648275906e-01 2.1484594055719560e+02 -2.0447997255635016e+20 4.3132728882830444e+04 1 +541 4.3598253354824012e+21 -7.9191389046240338e+14 -6.3266882318024312e-04 -1.0055175597719092e+23 4.6326214987733610e+29 1.2068340302575365e+28 -6.6637401795099773e+09 8.7120332382140823e+03 -1 +542 -1.9939768583194268e+02 -2.5804797039009448e+28 -5.2824785818656166e+17 7.6546114537313450e+06 -1.0588303626244354e-04 7.4365194576451993e+08 -5.3535993202089370e+17 -5.7703381842350576e-01 1 +543 -6.1746177931151944e+26 3.3201913314384301e+13 -2.0300016179614155e+09 -3.9237296758920815e+25 -3.8582582538560054e+12 2.2929293048047676e+09 -2.5216548597696911e-03 2.0919416113411582e+12 -1 +544 1.6031164818391652e+23 6.3935939529425907e+08 8.9250619054679348e+00 1.8545012463874141e+01 9.1666653521563173e+27 -1.0202472833853959e+08 -9.6080216942112773e-02 -3.4819396828879188e+33 1 +545 5.0114154134736503e-04 1.6594302493683985e+06 -3.0070837875175948e+04 8.5682051338615105e+07 -2.0850878267944170e-04 -6.1017525920471962e+17 -9.2186413690965050e+14 -4.0074976548539609e+13 1 +546 2.2217188692293460e+15 2.8016656521453351e+07 -1.4815736014978326e+27 5.2805204106396423e+10 -5.9089672880497193e+18 2.7621325188480782e+29 1.5748747005226251e+32 2.4154960653340395e+13 1 +547 -4.5610776822691954e+32 -3.0820737382618332e+08 1.6432679792371428e+21 -8.8526399879276685e+20 -5.9019790598233203e+02 -1.2202351029990942e+22 -4.2567392036938399e+25 5.7164113102863057e+19 -1 +548 7.0158962806551979e+04 -2.1945493626326544e+34 -8.0929581277362125e+13 3.1578253649684542e+20 -2.5033267962941493e+28 8.2838091178447238e+24 -1.4979625550294727e+22 5.3117440297551130e+29 -1 +549 7.1862176072788836e+30 2.1692413768029139e+31 2.7102286493966752e+28 -5.7747064189384930e+15 4.4937275079305911e+08 -3.7621694227358185e+07 -1.3646080312798630e+17 -3.7795937940237723e-01 1 +550 1.4962721957679305e+26 -6.7173505071192568e+16 -1.9152696820872571e+07 -4.6240598285915031e+13 5.8918071888188400e+09 5.8306589251159159e+29 -1.8492926153127343e+01 -6.7313681629120884e+23 1 +551 -1.3456055425588228e+06 1.4553506869604395e+23 -3.1249486905323004e-03 -4.2883793980328341e+27 5.0780556180002306e-03 -2.4951305110110845e+33 2.5620346979653606e+17 -2.4231929479399038e+29 1 +552 1.8138709439959939e+12 3.1819172601575775e+10 -2.2907740221156998e+31 5.4551588484299561e+10 -4.2102379613156404e+09 2.8035752019745367e+13 6.3815973874524176e+16 -5.1690999185275439e+21 -1 +553 -5.6100099924076879e+24 3.0773389936184452e+25 1.6778650848365101e+10 -1.5511083768852621e-01 -5.4234881941055253e+04 8.5359699728251290e+17 -2.6909121239606844e+04 1.0133369081883890e+22 -1 +554 3.3509217724561858e+33 -2.3507975494903255e+19 -4.0734204183372363e+07 -4.3232467803157572e+33 -1.6426162621795747e+14 8.0338273548510752e-02 1.0481098028068959e+33 -9.6318605105622540e-02 -1 +555 -4.2076499304691771e-04 -1.6882717035083894e+12 -5.3511132601013788e+14 -1.2413521415265860e+15 9.1176361135513606e+28 1.1338241289397014e+23 4.8467538738071945e+19 -2.4928003418014497e+06 1 +556 -5.6272096740490106e+14 4.5085223602204770e+26 -5.6691894130725173e-02 3.7368836155189565e+22 -8.6015578509756800e+14 1.8744142402255929e+20 -1.1810651789925961e+20 -5.0414336216140117e+23 -1 +557 1.5803922597586091e+29 4.6011694034437980e+18 4.3978219558035889e+25 -3.8990106939289341e+09 3.4662700837085901e+18 9.3152806223489881e+07 -6.2159687527717057e+28 -6.7235024330065582e+10 1 +558 3.8284549946889284e+29 -1.7224551753037322e+13 4.7396130488819074e-03 1.1621062843403796e+20 1.5310810813495072e+26 -1.0292322941593071e+06 -3.6958439972654309e+11 2.1205252973155475e+22 1 +559 2.6766052718825481e+25 -5.2009275521798439e+28 -7.0688279221915340e+08 9.8653197131076308e+02 -1.1428571619743526e+24 8.4971533399897974e+11 2.4559046932383560e+33 -1.0681501498903339e+05 -1 +560 -1.9599582853587790e+25 2.0962921669627931e+14 -1.0488138861210732e+11 -5.8620699207486106e+18 -1.3982956914520089e+32 -3.7907177444082918e+04 -1.2743623154920521e+06 -1.3754500773636871e+06 1 +561 8.6750988556144127e-04 -1.3452265562601032e+09 -5.4046722181262960e+15 -1.0071937214421860e+00 3.7790992358604553e+06 2.8272515138599900e-03 4.5855203150358126e-03 6.5256406458105936e+22 1 +562 -2.7116090657492874e+11 5.5959776140644879e+33 -1.5546847167960058e+23 1.3737173273588650e+28 6.5928431408258646e+19 2.0849667919493875e+01 -1.3573093597235219e+17 3.7079020870595917e+07 -1 +563 2.9234007257962832e+04 -1.4918602047140659e+12 2.1874236821147821e+02 -2.3516000203385471e+11 3.6582700043139482e+17 6.5980037854607650e+15 1.7717641427242936e+04 -5.0781727795470240e+34 1 +564 -2.8049878257773537e+05 3.6896391590730220e+15 1.0349483851661067e+24 -4.4558896877897318e+18 3.9959481337827328e+23 7.3527462713191826e+06 -9.4871915274109050e+14 -6.8203638500328418e+02 1 +565 1.0735681763455304e+03 -8.0295658875754598e+04 -4.7684927101757480e+15 -1.9632760444449301e+21 -1.9764938498991975e+32 5.0590308528058805e+07 1.3704169095026065e+22 -3.5577453652417642e+28 1 +566 -2.4202683054240563e+19 -1.4532076017614351e+01 -1.9787303826930225e+19 4.1806648428358829e+28 -8.8329483686051840e+16 -1.1052704106700004e+25 1.8018830892710246e+07 4.4904963763491797e+11 -1 +567 7.5043289544982381e+03 7.9823486858090660e-03 -7.8982221285054954e+28 1.1114962108032592e+05 7.5765157454964676e+09 -6.2379178385991473e+06 3.0347121494253165e-01 -1.3313217105937485e+17 1 +568 -7.2664572095511288e+14 2.5234106020275398e+24 8.8367069189056726e+11 4.2280600478601062e+29 8.9124488630221347e+29 5.7324339673066832e+33 -8.6086649932820115e+25 1.7513189448800963e+03 1 +569 7.1864831832707324e-02 7.7246337158390000e+12 -8.0687683858028442e+18 3.4065240396379395e+22 -6.8702453451802634e+04 -7.5267611695391474e+19 3.7007621399998792e+18 -8.2729812428232544e+11 -1 +570 -7.2046756702836683e+22 9.9834267215412176e+00 1.1121928256368776e+32 -9.2892851030283985e+09 -9.7968732625351064e+06 -4.7271485464703174e-03 2.2682340011643069e+06 -4.6914220121122188e+12 1 +571 -2.7799893124307289e+00 9.3316320716628979e+01 6.7027822869023002e+25 -2.1888163043115265e+21 6.0078548130083235e+05 -8.0753321782326129e+03 4.3017415915317387e+22 -3.6315874767221261e+25 1 +572 2.4856340220388142e+24 -2.9241358146596598e+18 -7.0120037241987543e-01 -1.5451789277288489e+11 4.2454257193813138e-03 2.4944102106720306e+28 1.8620906793529663e+22 -4.4017318184554823e+32 1 +573 8.0774222046307088e+21 2.6442482542077950e+14 7.5921637355351806e+07 -1.6257984810452810e+23 -5.4082853710517000e+15 5.9387086918152688e+13 4.4073313797562641e+03 1.3842397556334925e+17 1 +574 2.2828364657915625e+15 5.1574534075785978e+00 -2.9821623172899050e+29 -5.0997468048417451e+12 -1.1897882699116670e+15 4.3686472847315588e-01 1.6997991449905600e+07 -4.7166178202121364e+24 -1 +575 -2.6780180231897463e+29 -3.6240756734546488e+14 3.6210819054246605e+23 -1.3915121864530982e+17 -4.5627718072732771e+05 2.2543152927458486e+08 -1.5840714702358624e-03 3.1820558093044309e+28 -1 +576 2.7696485053038191e+29 -1.3169498899760368e+00 -7.5484577035447448e-02 1.2307500720224803e+20 -6.9779857825873856e+04 4.5608561122759600e+14 -4.8724278973429536e-01 4.9313741676659193e+20 -1 +577 3.1206112819745976e+31 1.6983316015183407e+34 -4.1747444877275656e+05 2.4357008269283225e+14 7.9864077019781692e-03 -3.6376506427600850e+02 -3.9686145223222010e+15 3.0743778503558423e+27 1 +578 -4.7328217097730702e+05 -6.3253043712469125e+13 -1.3603179381186656e+01 -1.1939818372460498e+13 -2.4847276689852972e+05 1.3591996042582285e+07 -8.8146173216484827e+21 9.3028709017306602e+08 -1 +579 7.9074562292763062e+31 1.1706964321044128e+16 4.1772268490566719e+14 -2.0489395959853400e+16 -5.8599879970198535e-03 -1.3647049108770661e+03 4.5888979243527728e+16 6.8051124829631362e+02 -1 +580 -1.2756014400604406e+18 7.2088324734484808e+18 -1.6520061406581794e+04 -5.1915149514249275e+32 4.9860212068049335e+11 -1.5486011441793960e+15 -2.4103259958200232e+34 3.5051648829785948e+19 -1 +581 -7.0194553284747986e+10 -4.4613206712316598e+22 1.5290111838651835e+33 -4.8822778047178463e+02 2.1236359065295461e+13 6.1922743762231366e+03 -5.9607007297661411e+19 7.9232397749969005e+02 -1 +582 -5.3371947488333024e+27 1.3876591953003543e+18 -1.4781884564992902e+17 -2.9374602732518772e+10 -2.1719274852993805e+05 -2.3175633783307885e+31 2.9842881490093022e-03 -1.3255326293238943e+24 -1 +583 3.0368681742601765e+19 5.1580325642290290e+15 1.2488277080698975e+15 -1.7793925516523464e+26 -1.1028009169764115e+00 -1.2973949751459738e+23 9.0662630484338536e+00 1.4624111352803268e+25 1 +584 -7.4529978444634238e+05 -3.2595312177539600e+15 -5.1305018228052513e+30 -7.9297606597653939e+04 -1.8041853581767405e+15 -1.8818277704652156e-01 3.3457122634506935e+20 1.0001529174840380e+03 1 +585 -7.2023218971777749e+02 -1.6667866547232300e+12 1.7317932783456372e+27 -3.8121153103672810e+01 7.5919148357081553e+06 2.4559239908193836e+25 1.6961356765411173e-01 -3.7024975919349700e+07 1 +586 2.6688429271919443e+29 6.3198475156723941e+19 1.0275263263711724e+19 -1.0952786090879258e+00 -8.0805745549156612e+21 -6.8479325225855440e+32 -1.4875997856691608e-02 -4.7014159938166232e-03 -1 +587 -1.0968436906149659e+21 -4.9783875855106218e+06 -3.0130443256327045e+21 -3.5390850222008655e+25 3.3297534438511456e+21 5.6216056049924500e+13 1.1076202494266795e+11 -7.0030976542489359e+33 -1 +588 6.9678749240544094e+22 8.1342212346377645e+31 1.8425084777287859e+18 9.6513294524199111e+01 4.2133698634124181e+00 -1.1889553129755477e+21 5.0954509993083340e+28 2.0462934491911731e+14 1 +589 2.5792990503740387e+09 -2.2453400759232778e+02 -1.2123442776441138e+22 1.0983899131527608e+15 -6.6417590323255286e+30 -1.5891952493305289e+03 3.7415380690814523e+33 2.2478090832267477e+20 -1 +590 9.2372897130448635e-04 7.2003381315652001e-04 2.3989362260511052e+03 -1.1323721607008917e+01 -3.2190239296837209e+20 7.9803014702285351e+06 3.9821886046394414e+12 3.5815509691189092e+12 1 +591 7.6920253346951594e+20 -4.2996075911335100e+02 4.8262854650433379e+32 2.1709464240518180e+18 1.9223132427467274e-02 -5.8119442485155300e+15 1.0307724920555367e+34 9.5531070433649021e+25 1 +592 -1.4279058655037105e+08 -5.7073200159810650e+14 2.6720742472286671e+08 -1.3334730625281006e+07 -7.1987740661809314e+11 -5.4249270244024306e-01 1.2315857425688643e+28 -3.7945547849553229e-02 -1 +593 6.2050137335891759e+03 5.5844291680954300e+31 2.5810191859462513e+18 3.7612902189870023e+25 3.5104519415294495e+10 -4.0884338112039771e+06 -8.9472778358330530e+15 4.5737732266140319e+18 -1 +594 1.6431843023352855e+13 -2.7753357285579100e+19 6.2791649350069900e+04 7.2914902435692004e+05 7.0586567766567241e-03 4.6473436662387922e+06 -1.7227636346193035e+19 -1.4147737521791656e+33 -1 +595 2.0557964679555488e+08 -7.9849374119552863e+00 -8.8228785825748789e+24 1.2845117851747325e-02 -2.3046600081646276e+08 -6.5614592291032772e+33 -1.6882537325102629e+19 4.9587215836277743e+25 -1 +596 -1.2962780873586647e+19 2.3270179114767248e+16 1.4428873109863725e+03 -9.1260793155071215e+22 1.4614277952936279e+11 -2.7372122067929010e+19 -3.7683375665693524e+11 -1.7339616207544897e-01 -1 +597 2.8437670497910112e+16 2.7609773335779068e+23 -1.9732030766655063e+24 -1.1050314674360051e+06 1.7572500903029399e+09 -1.1787447561878703e+20 3.0189976557388818e+03 -2.5661341830020359e+13 1 +598 9.6967412284399757e+00 -1.5956045662664108e+07 -1.1564413642156709e+05 6.9118437709278667e+30 6.8428012935335490e+32 -1.3855177194028770e+31 1.2928472940245457e+20 6.9061440597598953e+06 -1 +599 -3.8958246856919494e+14 7.7319172926778028e+03 -1.9352136143479309e+33 -7.2960465041273223e+12 -1.1365881400596345e+05 7.2535591021357228e-04 5.7793031736613447e+12 -3.4960421812997913e+08 1 +600 1.0098287618156171e+03 1.0990939244894458e+11 -4.0966223245773727e+20 -1.5269686252792826e+02 -1.9151811658843737e+21 -1.0101902464619096e+34 -1.1225644587549232e+15 -6.3086602582589895e+07 1 +601 -3.6883915743957950e+14 9.2143578319313844e+13 5.1140634939306586e+17 -8.6190242380273220e+15 -2.0598531987521773e+31 1.3656830586995442e+32 1.2521768846743617e+13 -9.7506442297350347e+07 -1 +602 -3.8761515425053678e+24 -5.4190542280244621e+31 -1.4060900543658935e+22 -1.8353435326279181e+27 -3.5887994634527935e+01 1.8272182155515736e+23 3.4716041939514771e+11 1.0464112457973633e+09 -1 +603 4.1304155298597988e+30 1.5040375201841022e+02 3.8381282726132889e+09 8.9865471837314779e+29 -6.7704860302056562e+12 -2.3910962000247106e+05 -2.6913278078740666e+04 -3.1392762707251562e+13 -1 +604 -6.3115591456008726e+05 -6.2830425959370502e+32 -2.1769648371243186e+05 1.0244686288875149e+17 -2.2228828586732674e+33 -1.1665742265794182e+17 -8.4901006044654776e+24 -7.2056989494541813e+02 1 +605 4.8917824390420313e+33 -5.4975345473541807e+01 -3.9105339844275150e+09 -9.1883529461384335e+20 -2.1754347408333601e+29 2.3993302743065651e+17 1.0702208434433058e-01 1.3748059491922868e+02 -1 +606 -2.9253521795453118e+01 -2.6867045315275562e-03 1.0873856033101787e+22 1.5368566000278647e+09 3.5435041001319019e+11 -1.1765200087218720e+15 -1.1645840157440560e+25 -2.4787404190744209e+08 1 +607 1.0972745887578038e+19 -6.1423591728065688e+13 -4.3517309206318028e-01 4.5288222971864120e+18 -1.1343065654247325e+15 -1.6999093902216858e+05 5.8754047296300210e+27 1.8387526128559418e+09 -1 +608 1.9179604835777750e+15 1.5837055516870038e+00 -2.5795952358385370e+17 1.0059171054180967e-01 -3.4244584395157607e+28 -4.6880079038740849e-02 -2.1893918046940061e+23 -1.5942076085313073e-01 -1 +609 -3.8579885439297764e+30 -1.9329564420135480e+16 -1.9661634740230414e+02 3.5297118266907346e-03 1.2338870003961943e+23 -3.9060865539820471e+09 2.9159954055762125e+13 1.3731280401485174e+10 1 +610 -9.1596865640919920e+27 1.2504832929114406e+17 2.7567029056799494e+31 -3.4156590453367669e+05 3.3733232820727440e+25 1.1332013165095001e+04 -2.0035635084110681e+30 5.2808223828583322e+32 -1 +611 1.1367730236231568e-03 6.8823779998743224e+19 -5.3132407958837125e-01 5.5880764013682295e+19 -7.3856283935870078e+20 2.2314406532482319e+29 9.3302302627210568e+18 8.2642201351642268e+25 1 +612 -5.2211179345104814e+18 3.7544999980140556e+25 -5.4508428634101334e+09 -3.7026785119511383e+10 -3.8808341513508389e+26 -2.0494174943544940e-04 3.8577442887082007e+23 -1.0227651628500213e+17 1 +613 -1.3829342567953554e+23 1.0692855973394219e-02 1.6270647272228791e+04 -1.8584414307474785e+15 -1.8067755851096113e+19 -1.4052940156311395e+03 -1.2759389097666309e+29 -3.7293360134536084e+06 -1 +614 2.0585979393744709e+33 -3.1240047608099356e-03 -1.5884995329600023e+19 -2.4264744789905042e+27 -7.1822462542010779e-04 2.4503154667005816e+04 -6.1146527435672806e+03 4.8328157791200127e+24 1 +615 -6.4431597118137843e+03 -1.4093853660715689e-03 3.5584449527469731e+05 2.0803248068106958e+33 -2.1273935672310376e+16 -9.2394241184851610e+17 2.3431422611643157e+29 -3.7096439442922417e+28 -1 +616 5.5584295415477696e+04 7.0344621363816623e+02 2.0098706427205757e+12 -9.5065162446990767e+29 1.9046209055663310e-03 -1.2003876037704678e+01 4.5090271314482452e+18 3.1018172372565167e+21 1 +617 1.2355497425448114e+31 -1.9118311239803709e+03 8.0758846728187880e+15 1.0530621362318250e+28 2.3874315742444242e+02 -1.2577120619497504e+29 6.9430845780521944e-01 -3.6596466674208676e+20 1 +618 6.8042500081428298e+03 9.4534570381844505e+25 1.6089528027472873e-03 -8.7869777769587252e+00 6.6573660730797911e+26 -3.7129946841916137e+34 1.6230544235172965e+25 5.4011178931515300e+23 1 +619 8.0290225162478018e+08 8.7357659562035227e+08 -2.8699254038660758e+33 -1.1167829254435946e+06 -1.8848856265921777e+28 2.5066772156623072e+30 8.0985012054732786e+06 5.8312197150752994e+32 1 +620 3.7709738006100258e+02 1.1711176372422039e-01 9.2606468970605683e+33 -6.2879506252731346e+01 3.5078480351811012e+13 4.6746580015332139e+08 1.6005700897225538e+33 1.1105447573936226e+26 1 +621 1.9316781490782031e+11 2.3889650405573825e+03 1.7488238019275072e+34 -5.7508212386268343e+28 7.5005679861669535e+34 -1.5413435672421103e+01 -2.7814495322223822e+30 -1.6623192896470892e-01 -1 +622 -1.5863918735262806e+16 8.5639093057618286e+11 6.9474446190371213e+17 -2.1613579551847310e+29 -8.3836006275191216e+26 3.0870457994618189e+18 -9.4533135987599172e+13 7.7314569718732843e+20 1 +623 5.5683714339308343e+29 1.4983412860193589e+32 2.3048139740988564e-04 -6.2653021161818438e+12 -6.3064536727636792e+01 3.8709697153578233e+01 -3.8231787721141846e+12 2.6130286633546610e-03 1 +624 -2.9076002654274497e+06 -2.9073452776514530e+08 -9.7856934269637913e+06 -5.0747876503459593e+33 2.1254111328927422e+12 -5.3350173995008230e+07 5.4433419381936556e+27 -2.8601588159339734e+21 1 +625 -1.1755400657996970e-01 -2.3010701863101870e+06 -2.6090872393827097e-02 -6.4167069459204602e+08 2.4549633834940127e-01 -1.1728500911301499e-03 -3.6478522383756469e+21 2.7862724725683207e+22 -1 +626 1.8027630760922139e+03 3.7254765304943733e+00 -6.1989896748467506e+10 -6.0753806899769325e+06 -3.4225108994145264e+00 -2.7435584964976238e+14 1.4609861737937611e-03 -1.3048000457296519e+09 1 +627 -2.0942965600860650e+14 1.8947153615072413e+04 -1.7097700058986713e+22 -2.6214064087596667e+04 -2.9330466713769603e+23 1.0955727315743288e+10 -4.7037415603653033e+04 -1.9243822237026640e+16 1 +628 -4.7958591630141062e+21 2.4717424345693994e+24 1.0627262296823959e+06 2.0109051715391941e+28 -9.6702974983235091e+07 -7.3918663120205566e+10 4.5388072687596851e+33 9.7805477434958400e+15 1 +629 7.8166218572755668e+01 -2.9823112383793754e+32 -1.2465692320359362e+16 -4.2454312489244766e+09 7.2120115674094557e+31 1.6552771252354922e+19 -1.2194875425020564e+34 -1.4487137165985574e+25 1 +630 2.4162383882341718e+00 -7.8324830594728546e+09 8.4387929357892970e+15 -1.5641729270987701e+03 1.4539112682355420e+29 4.4988181032522336e+16 -2.2848715146058638e+21 2.1159157677486079e-02 1 +631 3.6942050525147429e+33 4.6600867385656666e+24 -1.6730457569650758e+31 -8.2393905977677690e+15 -2.5320233787727966e+09 -6.8045882811452666e+12 -4.9159944132494479e+27 -7.4660882519840461e+17 -1 +632 3.6077548384081149e+08 -3.8644585095016825e-03 3.7294111215569488e+31 5.4242298655799837e+19 7.2915640087017015e+24 -1.1413246904869375e+12 -3.8872073418724185e+12 6.7824487450385816e+29 -1 +633 -3.1289774247179508e+08 1.8917364774172305e+00 -1.1078150516384769e+28 -7.5166449717104104e+34 2.0481563139166917e+27 2.5858200993040098e+13 4.1533055202291349e+33 1.8835002903826374e+10 -1 +634 -1.9787075199606416e+23 -5.2453993205484367e+03 2.5000988772877306e+23 -7.7246110684828153e+00 1.7408538717654477e+19 3.1058780152074653e-03 5.9264772673206420e+15 -5.2841481259115076e+08 1 +635 1.3517281045743319e+22 -3.9809032624707622e+31 3.2737827119565334e+20 -4.3707504848206867e+29 4.4481533123726521e+01 3.2717594956204425e+34 1.2243058151128322e+11 -1.2882535417714610e+02 1 +636 -1.5115086483025002e+10 -2.4630772755980741e+27 1.1848684482249938e+13 -3.5574241961002402e+12 4.5346774320907663e+29 6.4716704236476637e+27 3.9354432342987103e+01 1.2312439640358062e+09 1 +637 -8.2602491799255627e+11 3.9776161291096980e+15 2.0343351380810051e+18 8.0269096931122156e+13 5.9649211297915326e+02 -5.5015449472684308e-01 4.9644688277072516e+31 -2.1079772400073320e+13 1 +638 3.3615045805034001e+00 -4.7391365449149453e+02 -1.7640044456914472e+03 -2.6273747440670616e+29 1.3145250449729107e+20 -1.4234867497998781e+13 -1.1951921826878424e+22 -2.4944134297611475e-01 1 +639 4.3755653083632751e+02 -5.0294413769564977e+30 2.8380616185549155e+02 4.0181203712741059e+08 -1.0350663583695041e+27 1.0969115473283096e+11 2.2852736223046112e+10 2.7863829017463516e+13 -1 +640 -1.1307645755396590e+18 1.0295977645210658e+12 -6.1130719895358987e+33 -2.6421551165571246e+18 -2.6959273634451922e+31 -9.0985967492390409e+02 -1.3918528695809635e+24 5.0338357071841538e+07 -1 +641 4.7552675208847053e+26 -3.0867436790319140e+30 -1.4755465209004590e+11 1.5127496695164768e+02 -8.1665495686299050e+15 9.9873658221302771e+33 -7.2878963494543850e+08 4.4009270959449891e+00 -1 +642 -1.6542666575650845e+17 7.7919018557469151e+05 -6.5661179966689360e+01 7.8560350837553064e+33 -2.2062100021708517e+04 -3.5545171584045799e-05 -3.0103332237937360e+21 9.2569726641020422e-01 1 +643 7.3882141184753640e+24 -2.2960643208954399e+06 1.6946037162857919e+30 2.6713101371566388e+20 -7.0438911644516773e+09 -2.1026002752513229e+26 8.2900230284152672e-03 -2.1446436419693434e+13 1 +644 7.5774932699748111e+04 -3.1078420035147905e+07 -1.9309214965498715e+04 -2.4427700285030533e+34 5.9254944338523783e+03 4.8406862233796180e+32 -2.7078125642617784e+22 3.8270991745696505e+15 -1 +645 -7.7088009857860620e+22 5.1634671423491028e+10 -2.4535347028598216e+02 -1.0366947354558605e+17 2.3044838971596691e+32 1.8748582478079378e+24 3.9759164025090482e+24 -2.1080974393652893e+10 1 +646 1.0792113254529237e+19 2.7789806925838457e+20 -2.7237564269973148e+26 2.5517173011977382e+17 -1.3058565546182226e+17 1.4815977822281390e+18 -2.7802111229137944e+16 4.7572940442774898e+34 -1 +647 -2.1034086806964114e+30 -7.6013965464385097e+27 4.6192009509193929e+04 1.0900803650557172e+26 -3.4076508071785562e+28 1.3675005645183439e+05 -6.0288389659086233e+03 -2.4958384606468823e+07 1 +648 4.3789576273244700e+23 -5.1872653791148853e+26 2.8093780538242925e+14 -1.2189193538400269e+10 4.5197689110077026e+32 -8.9213765041500466e+00 9.1025445428720986e-03 1.5903363413739128e+24 -1 +649 2.5463780527563012e+25 -1.9447871293563743e+00 2.2446843515895560e+07 2.1941550623811556e+16 4.1925613532927191e+33 -3.6357407117010581e+01 4.7201173681575656e+14 -1.1872599884700790e+15 1 +650 1.0267423723773928e+14 1.0741875685759058e+09 -2.5692949457991384e+06 1.7333980152095261e+10 -3.6514667595234096e+02 6.3061582103666229e+10 4.1133667685570679e+10 -2.6016346260114311e+01 -1 +651 -1.4444622593174862e+14 -4.4285751182864676e+05 -1.7468267452262246e+25 1.2897469268352774e+17 -7.1252318129764135e-04 2.0199993553762861e+03 1.6526576842507962e+15 -5.1795029483536260e-04 1 +652 4.2607649816252210e+32 2.2973524652701540e+33 9.9459456975855058e+00 -2.3796905483206196e+09 2.9424338936842882e+23 8.6312797492865173e+10 8.9629701158520994e+30 -6.1073548901630670e+07 -1 +653 4.8903421771063656e+06 3.9823495377516028e+03 8.4462381686728393e+19 -5.4717621038740442e+17 2.3599146091479138e+28 -1.5677778799563014e+27 -1.4236193540173536e+05 -7.1810085027032523e+21 -1 +654 4.3283359047282437e-05 -6.5823961205866455e+11 6.1895464004623291e+10 -3.3531754177386219e+13 3.2620442185337705e+22 9.7148888207208042e+09 -9.7502397639447022e+06 1.3747914009306803e+06 1 +655 6.8377602881193053e-03 -2.1237173914460552e+18 -2.0322821604119123e-01 -1.1421982782730796e-02 -2.5713638582076752e+33 -1.1214192480136473e+22 1.5962199967802415e+04 7.9721951874956072e+27 -1 +656 -1.7652455085135764e+34 -1.7202814200437973e+13 1.1851126529611092e+22 -7.0665669418929857e+24 4.3213720471542445e+27 -4.8264426255043654e+03 1.0535806616288413e+24 5.9621247460342018e+32 1 +657 -2.5964769470412679e+07 -2.1039116191162124e-01 7.1682863563180343e+27 -2.2207018574736656e+10 -9.4836751652892269e+02 -1.5058399763859993e+12 2.9677008547563770e-03 1.9747408276801601e+32 1 +658 -1.0725596388893290e+09 -1.7246421868472736e+05 -2.7388239179658596e+06 1.0712370945189638e-01 -1.5378581078603888e+17 -2.9309439837278723e+31 1.7509179599565400e+16 -1.8490386608912895e+34 1 +659 -5.8577223351047197e+21 7.2438049975763774e+05 -7.0500108107147597e-01 -2.3556210706224565e+01 2.9172296273324819e+24 6.7579483713044799e+19 8.4518771739509402e+17 5.2716091423741123e+06 -1 +660 -2.6252036570376924e+31 1.1188700198811877e+14 -5.0885705566066303e+19 6.9309462934664538e+20 4.1596785040441094e+12 -9.0673250545729399e+26 3.5249462372983241e+08 -9.3277265511404114e+11 1 +661 1.5473541521914963e+30 6.3407313386359880e+15 5.0253537914701720e+00 -4.4309169198167170e-01 -5.3681164764888102e+25 7.3464971427346053e+34 1.8675749337446172e+12 1.0660547531143051e+09 -1 +662 -2.9308111792251723e+22 7.3231871385843054e+25 -7.8992242093512220e+15 1.9903793883597433e+23 7.1044580245670764e+27 2.4080560366220445e+21 6.3245244877244058e-04 1.7602871591450766e+07 -1 +663 1.6721895895314602e+17 2.7513799815569622e+23 1.5261260960200691e+32 -1.6100798594132438e+09 3.5485813079443962e-01 4.3034994018216864e+16 1.9862846326738938e+14 2.2149470851835534e+20 -1 +664 -1.2416488659391158e+24 9.6365704332943148e+21 1.0932925802424347e+10 2.7186388861940585e+30 9.9396681614852899e+19 3.0675458309302914e+25 -1.3292965680111311e-02 1.4077473572165686e+26 -1 +665 -1.1589872479397094e+26 -1.3075946078114177e+30 1.2735556654562565e+00 -2.2160780824640068e-03 -5.7912636733989952e+16 9.9048415157463614e+02 -1.8465320123071748e+15 6.9416033633643725e+18 -1 +666 1.0997012255630615e+08 2.4928267366894606e+23 1.4907146508728227e+23 2.6264687001401100e+01 2.0412089968284436e-01 2.6478628316434070e+11 -1.0510243784753784e+03 2.0855434600850694e+33 1 +667 1.2768699552469607e+02 1.4521132738398880e+15 -1.3370244877637348e+10 2.6689799536739330e+22 3.5943158909811169e+14 1.2717092297040979e+04 5.4382836830768366e+20 1.3003053131761053e+11 -1 +668 -1.0937632227786576e+07 -1.3635675259580607e+13 -5.6487380282233002e+32 3.0165437098748442e+27 -2.7552089637528493e-01 9.1351947001204968e+11 6.0671042894525856e+07 9.0733328205190432e+08 1 +669 4.0027651882929346e+11 1.1828903071403705e+27 -5.6276854981418728e+21 5.9375974985958572e+04 3.2425855131613008e+13 7.2151703549230959e+00 4.6209999468825515e+06 -3.3725548927006359e+22 -1 +670 3.3189510547130331e+29 -1.4605189553541656e+13 6.4893389342474659e+20 -5.1352183199718479e+02 -7.8074105608308668e+09 6.7760904371888488e+19 1.9825087946845574e+32 -6.0035725408783439e+22 1 +671 -6.8996599502320708e-03 5.0526185838801521e+21 -8.6697463043802967e+25 -1.3121978842541643e+02 -1.8160069700679037e+17 -9.0579640123459470e+01 -1.2208598133981055e+23 -8.0960425847935203e+03 1 +672 3.2147913980598715e+06 6.2338979104005128e+16 4.9343624800384065e-04 -2.7435417744114642e+26 -1.0236775651656117e+05 -1.5003382963064539e-03 1.6291673134143567e+09 -1.1866356537359262e+16 -1 +673 -2.6613720751973295e+26 -1.7462885460186685e-02 5.5846600713239450e+17 7.9618776550522408e-02 -1.8019558558263470e+15 -1.7970386270576933e+23 -6.0116465868073756e+27 -7.2157129049109772e+00 1 +674 -3.7320183430990952e+25 1.8891288386232733e+02 7.6472598327522324e+12 2.9353716011931038e+08 3.2192788599530919e-01 7.8758758567202787e+23 2.2452542928364746e+04 1.4115238223472783e+01 1 +675 -1.7297601758314466e+29 1.1688047287755790e+05 1.0526053395530917e+29 -2.7568551947113867e-03 -5.8273772074988571e+01 -1.7424230703045074e+00 1.1373212792930599e+08 4.4134165584077141e+13 -1 +676 -5.0678429980218665e+11 2.7772126474048634e+14 -1.9988936847928716e+02 3.9615854088784238e+27 -9.2549210988303050e+22 2.0583523315875730e+01 -2.5205907345832634e+08 1.1963984433606593e+33 -1 +677 -1.8714262811372470e-03 -2.5493220268573253e+02 4.0509887632833551e+29 3.7794038465344883e+17 -3.2940685193730819e+22 9.6100260924309919e+02 2.7426638088831878e+03 4.7553217109716082e+00 1 +678 -3.7645157680217365e+15 -3.6513589544072739e+33 1.0143677213575223e+32 9.5600208808538832e+02 -1.1957923736536745e+25 1.4712815712741162e-04 -3.1306850328825499e+02 3.2199156350776525e+06 1 +679 -3.7888216864239654e-02 5.8719977781162793e+32 -3.2992014977685196e+30 9.4422822989970885e+25 2.2378402893188316e+34 7.4005810330864899e+10 -2.5411841317618298e+31 5.7936081299039521e+29 -1 +680 1.0875560712392953e+03 -1.2468912561442018e+22 1.1506806630089195e-01 -5.2353236430536606e+14 3.8380628484000087e+21 -2.3198088375095067e+32 6.7187236845863679e+22 -2.3172426394759229e+05 -1 +681 5.4758000530468731e+00 -6.9304372494531457e+24 1.5529714175920378e+02 -4.0511182364375884e+01 -9.7102238752035386e+20 -4.7127955073619418e+21 -5.5122318893715703e+12 -4.8277975677354476e+18 1 +682 -4.2677134584426801e+25 -1.3004712565373085e+08 1.1475540219902733e+07 -1.9637837077862761e+30 -6.3072183400438217e+10 1.1792438740417420e+14 2.7084953773742906e+34 -1.2145165467614072e+03 -1 +683 -2.1032328504877056e+04 -4.4082731802061340e+23 2.8643851777809699e+24 -1.2328959014480499e+23 1.7963103758936807e+00 -2.2173957726693773e+06 -4.8336099970544879e+01 -9.2853987836807590e+01 -1 +684 6.1676453613695692e-01 -1.6904527848147259e+09 -3.4523322641468879e+19 -2.4631337335985356e+32 4.0884635516200997e+06 -7.0804806368400697e-02 -1.6849222599895608e-01 2.1524980528386176e+05 -1 +685 -2.0538683745769494e+23 -1.4948122551500039e-03 -6.4895551803143613e+33 -9.6058301659608934e+21 2.2910621990922875e+18 7.1700360247090453e+20 -1.3752164852370777e+09 -3.8348980545542749e-03 1 +686 1.4054357210254036e+06 -1.3208330499077617e+01 -6.1456326775596211e+12 9.3004706109893476e-02 -5.2918546692394234e+23 -3.3467734490970832e+02 5.3030947848120225e+12 7.2098192048146606e+29 -1 +687 1.0003525845644089e+12 -7.9907586135788411e+06 8.7786712287771650e+33 -3.1772768021675622e+17 -5.3170774932376773e+19 2.5885297755907333e+11 1.6155332533973148e+08 -6.2163149051741420e+03 1 +688 -5.0116045516215239e-04 -1.9164311700439323e+06 -5.3689507483203233e+03 8.7733247617747110e+26 -1.3480267975322558e+27 -4.4596370468183434e+08 -7.5011800393326162e+18 -2.7662348368722349e+17 1 +689 7.6657647251457422e+12 1.3341637167546801e+21 -5.7835822766123810e+32 5.6496381963371151e+19 2.2239155013441600e+14 -7.8326150651339406e+31 -9.9070773828112832e+17 1.7330749200003908e+00 1 +690 7.3684753495624744e+31 -2.9633260591510936e+29 -1.0194891340291951e-01 1.1298780498033342e-02 1.4541130253600184e+32 -1.4959557783284036e+28 9.4889410563298125e+12 -8.4529451374156240e+12 1 +691 -1.7112192164148918e+13 -4.8462012791461577e+19 2.5875090110519793e+23 -2.3360287119943265e+11 -2.2724140787649457e+24 -1.2978166101084379e+05 -3.9552179343872182e-03 -2.8799875753058336e+26 -1 +692 7.7813694571495063e+01 -8.3839091366924782e+04 2.4129478663141906e+29 -9.5119099244340003e+30 4.9915981358808422e+09 -3.0679796002619239e+25 1.0546084172397551e+26 -8.1828592015452760e+26 -1 +693 4.9481765036460388e+14 3.2261513625343391e-01 -1.6156804027499188e+11 -6.4285121612012859e+13 6.4310440917662197e+12 -3.2945940359714341e+03 -1.8675676555061065e+29 -3.5221138468358298e+17 1 +694 -7.1129394600614905e+04 -7.7701881682867242e+04 -2.9477954861621228e+25 -5.5382408921550312e+12 4.8417843053423271e+10 -5.9458402560573292e+09 -1.2451737161288965e+20 -2.9290368391415150e+03 1 +695 -5.6117613989622509e+30 1.2143429111632416e+06 3.0937852639158038e+01 -9.1147978868726030e+07 -7.4430656965586432e+17 -1.2397993354142745e+03 -2.0504513130712579e+23 2.0798722035281272e+26 -1 +696 1.6991540838928096e+22 1.3591246855813054e+17 1.6617037080548620e+15 1.2960140633739833e+07 -2.0298705217119500e+13 -1.6817310955806110e+15 7.0333897245240749e+30 1.4424264009324661e+07 -1 +697 3.4532434617107720e+15 2.3068215011524766e+13 9.5579787255012236e+20 -2.1283607797096481e+32 2.9659206201399092e+21 4.6086094613714501e-01 -4.3641023036110435e+10 7.8359133296964744e+20 -1 +698 -4.0529742579032151e+21 2.9776292841187685e+20 -6.0143059961295447e+21 -1.2114423634163564e+22 4.4531317250666615e+29 1.1209802486722247e+21 -3.5881923557226642e+03 -1.3588346220001149e+29 -1 +699 -6.6554451624650164e+13 6.0602907218282041e+01 -1.0467952927126183e+08 1.0179700152551942e+30 -2.3096487966267642e+32 -1.1087366945709692e+21 -1.4394977368617543e+01 -2.1178092193356647e+21 -1 +700 -2.1253525937757204e+18 2.5273207729130680e+18 3.5246516178344944e-01 1.4489942607285377e+27 -2.4732216033025107e+28 -3.7560157804769463e+10 4.9184247421971411e+33 -6.5328990906419832e-02 -1 +701 -6.0904229102662288e+00 2.5977858989243313e+10 -1.5078915235618553e+09 5.9889561266612075e-04 -7.7510269048267219e+02 3.9890377516103506e+14 -6.6572199270917406e+24 3.6910922850342199e+31 1 +702 -1.1757360197613944e+33 1.5737762470851529e+34 -2.5715363584905911e+11 -5.1240759696253240e+07 3.8546104515588377e+02 5.1050332694173961e-01 -1.1693948677230054e+01 -3.7777529204839576e+22 -1 +703 -2.0996809954607812e+23 4.6988208822569647e+26 2.6678142506441170e+10 -5.6155016478007715e+12 -3.9017700298646494e+33 9.8304403969809440e-04 1.8874045964589808e+16 -2.7476468514441948e+09 1 +704 8.9604653992244390e-03 -3.7695932957978320e+11 1.3479184814475234e+28 -3.2773142010262016e+17 -2.4902171297903515e+03 -1.7795705575856535e+13 7.8446313208613647e+21 2.4092529604459713e+10 -1 +705 1.0391488187181816e+33 -1.1753200513695447e+04 1.5748841405816447e+07 -5.2175284778692070e+00 -2.0232141422525642e+22 8.0629961695915000e+00 1.7313447278306240e+12 -7.0678913657513935e+19 1 +706 7.9828148495923804e+25 -2.0067379162745426e+18 6.4681866354496837e+07 3.9616004662792778e+08 3.6812098533550507e+10 6.3295454799661404e-03 -7.1640973701020447e+10 1.4166524283829793e-03 -1 +707 5.4909496794713783e+08 -1.1774765423698109e+10 2.7115543405419312e+03 -9.3014905668725401e+20 1.2247746225827105e+09 -3.3862007844440848e+07 -6.0190456520438592e+17 1.8700765142277236e+00 -1 +708 1.5076578774590489e+03 -3.1416194372546724e+20 -1.4009255389953614e+04 -2.6510070541342638e+14 -2.6809876839087332e-01 -2.7391288319607726e-01 1.9446689213855089e+31 -3.7640148505807519e+07 1 +709 -3.9564897409719740e+15 -2.8538293617198599e+12 -8.5870476079916763e+08 -5.8589740270636040e+15 7.6993259873045997e+20 -9.3069441475639227e+30 2.4932025182403040e+15 1.4789904380634192e+23 1 +710 -3.8191025209382587e+01 3.7479900878269320e-03 -8.7394814193033476e+23 7.8433535673054067e+00 -8.2208872522042577e+02 -1.3346714900819027e+08 2.1970516130991811e+01 -8.9289308326944675e+09 -1 +711 -1.4668187311578569e-02 -9.0011992045934784e+16 2.9957687739745060e+15 5.4402724974723021e+23 -9.2034979934883719e+13 1.2838717127747813e+23 6.9901423454047425e-03 -1.8473644713057833e+30 -1 +712 4.1915793172403900e+21 1.9530888966953061e+09 -2.4483090375797852e+10 -2.2107627963070725e+23 -1.9025327795515785e+09 -1.4643020084741162e+14 -3.1368257278588729e-01 -1.6470298963281235e+12 1 +713 -1.6165819249826777e+05 -1.5665582578303626e+23 -1.6642350275589156e+21 2.1169716457930705e-04 -4.4836192249940178e+30 7.9596246968433344e+16 -1.4821212177638148e+26 -9.6232301977439969e+13 1 +714 -1.9357559470287788e+14 2.5311948285229516e+08 -2.7241231446326221e+18 5.9233785444572978e+23 1.5230713807265117e+28 6.9973983728363667e+00 -3.2969578213044522e+28 2.7172227048472406e+00 1 +715 1.5393551892919980e+27 1.9149162008437460e+24 3.2304907556927842e+33 9.9266358123952230e+17 9.0945373840632954e+25 -3.5238423260914653e+33 -1.7825472265745301e+30 -1.2249488210647586e-02 1 +716 -4.4708121432814236e+33 -3.9035892866255709e+22 1.2901180087043315e+28 -1.3143176186243981e+14 4.7185355124955368e+03 -2.2077827940386428e+24 -1.0711878169852942e+28 -1.1552257357840478e+27 1 +717 -6.6349346021704861e+01 -1.0157098100806418e+05 4.1950355359806469e+18 4.9232376169556570e+04 -5.3314846402807720e+15 1.7173231608674710e+09 1.4055197271620306e+34 -7.5638193823766274e+26 -1 +718 6.5272666622335255e+19 -1.6503385087700890e+20 1.3641087136265476e+25 6.6456897220948552e+16 -8.1820798706124390e+15 -1.6796430143356678e+09 -4.7713437640503962e+18 5.5633616569718062e+14 -1 +719 1.1671232081364914e+30 3.6828187316668186e+09 1.2947968583974581e-02 1.0468546111256739e-01 5.2356472534372549e+19 -2.7567498111815311e+01 -5.3766663171543621e+21 -6.8849154113061295e+09 -1 +720 -4.5629692155226085e+34 -1.4501033822140750e+26 -8.2046899856068894e+07 -6.9506793153798433e-03 4.6958558245141248e+03 2.4941890544264810e+15 -4.8397445186679717e+04 -2.3808436426070164e+13 -1 +721 1.2316505620046138e+11 9.1683047938306547e+13 -5.7886106394723259e+26 1.4663690708666296e+18 6.3003910012271561e+23 -1.6482528562052917e+33 -9.4741780216601687e+29 3.4388702248768865e-01 -1 +722 -3.7621490056613917e-04 7.6232424228320383e-01 1.6706478230663209e+19 3.9846710211018527e-01 -5.2522626699338380e+22 7.5531564796474325e+24 -4.7465801038450678e+01 -1.2111386954123351e+24 -1 +723 2.3770860844445340e+06 -1.5779857301391030e+04 1.8818414213049508e+29 1.2640345901924656e+13 -2.7481602110369202e+20 3.3945256333648778e+01 -1.5957978878935450e+04 -7.4870696106535941e+05 -1 +724 -1.9071682937935509e+26 -1.5989589900318347e+01 9.9795856934903138e+14 1.0268172366330340e+24 -1.8796210269192591e+07 3.4885943390977021e+12 -7.3494442191179688e+10 -4.1677510487081402e+33 1 +725 -3.2723585372597847e+24 -1.0650077491810039e+12 -1.0260490987731357e-03 3.0325353421077281e+06 -9.6116247257291025e+14 2.2263049354148001e+02 -3.6991912768109199e+18 8.8983881908982330e+21 -1 +726 -2.0707661757847423e+25 2.0823701446377434e+05 -1.5428911661069820e+07 3.9111284583399630e+08 -2.8014307696024265e+26 -1.4147935296405922e+20 -3.4571459094151482e+17 2.2243435790346190e-02 -1 +727 5.7220486609031568e+25 -1.0940780041324423e+01 2.4081169656915663e-01 5.5653980030029830e+25 8.1992502794407077e+25 8.7142352178497117e+02 3.3257345885488818e+11 1.7479319899637398e+22 1 +728 2.5556063522243616e+05 2.3789356167947037e+10 6.3884851218071030e+15 1.0370795576003687e+25 6.2829729413395197e-01 -2.5585932244908780e+15 -1.2420648054887312e+15 2.1303329568103997e+25 1 +729 3.7649584422146986e+25 -1.1138122858356673e+31 -5.8764966370988823e+05 9.3451722637878179e+30 -2.7872289796424109e+30 4.7908069365723515e+21 -4.8107981486937382e+33 5.5527145482934486e+26 -1 +730 5.5655912958153516e+11 6.6162910273519607e+26 -2.9554773734185871e+31 -1.1213982219946906e+29 -1.8609200161805425e+25 -4.3336259380910314e+29 -8.9428271473475973e-01 -3.4696882531739041e+07 1 +731 -2.1543117337157788e+18 3.4044836389757508e+16 2.0028739778857397e+11 -3.8935757610396528e+09 -3.8552308256652689e+19 2.8748801622012416e+16 1.9426034116160440e+16 -1.3088693552342509e+20 -1 +732 1.2754270834548869e-03 7.0151678922983600e+14 -1.3546124502698410e+09 3.9619243262105566e+11 1.3598629408477750e+14 5.7118640765594444e+19 -2.4772689537581695e+31 -5.0461383467063081e+08 -1 +733 2.2160957591233080e+02 -2.1349511599906986e-03 -1.3951233258962259e+05 -9.8599381450918620e+04 -5.3603139787320517e+29 1.9252145881420860e-04 -2.5706913956446669e+00 7.7619286225594825e+14 -1 +734 1.3879093661547981e+07 -4.5199644865301921e+05 4.6278087635443364e+33 1.2507235107714680e+29 -8.6761034905344231e-02 6.2917809406365041e+02 -3.0107583122059470e+05 -1.3584724187325463e+07 -1 +735 -5.8332245599695209e+26 1.9427055859796906e+13 -2.6348211433270417e+07 -2.2408482421508327e-04 7.5006542551507744e+16 4.3418957648523018e+30 2.1312838649933738e+03 1.1238994592243837e-01 -1 +736 -2.0620010749559849e-04 -2.4234902644225974e-02 2.1381537923979506e+14 3.0961042255235186e+34 6.0075298489435196e+10 3.7729271111462803e+30 -2.7090451402157971e+21 -8.3047219405192020e+19 -1 +737 8.9603125988524789e+22 -5.8254996228668008e+24 4.4601297153400565e+31 2.3662983683655310e+09 1.6817426647210573e+06 9.7455919679397526e+30 -3.2448221903888016e+09 -6.6242569254096106e+03 1 +738 -1.5800374594531265e+33 -6.9442730187477203e+25 5.6337848776616802e+09 2.2220156974336925e+14 -4.0182800077867942e-01 1.8012956688912388e+07 -2.4508036298642692e+05 6.9616060322387739e+02 -1 +739 -1.7712931738047159e+28 9.8238007057316366e+28 2.9169154889324529e+32 -3.9287666740235052e+34 1.0868887381162953e+22 4.3664951403701092e+34 1.3928123560984756e+22 -6.1939061031749123e+24 1 +740 4.4460761214156095e+15 -3.1837089294431507e+01 -4.6059693662645323e-04 -2.9903318118403121e+28 2.8455566871069553e+21 2.2487089624404691e+23 7.6625916695380642e+27 8.5332405145200767e+01 1 +741 -3.7765639597728109e+17 1.3684489166427485e+20 4.0081474177095747e+09 1.0682662711845102e+23 2.5887454448607134e+19 -1.0547934365900275e+08 -1.0651303220523423e+25 -3.0813086505519344e+27 1 +742 -8.9086538167746232e+20 7.3006612435114590e+19 -2.1005129261974062e-03 6.4441567753388553e+22 -4.0716894581590665e+27 -3.3832506683672363e+11 -3.8932923726545191e+29 -4.3947427164900541e+25 -1 +743 -2.5084009114874739e+33 -3.1337668450010003e+00 -6.4422238791127029e+00 -7.6205231677725296e+10 2.0474372496749268e+20 6.2410091985942466e-03 5.8975363385231674e+00 -1.0771899082754172e+11 -1 +744 -6.6193418810190192e+34 -2.1581061137423512e+00 -1.8356954105358803e+00 -5.3475519768132642e+06 -3.1039223007079409e+24 -1.3126650665385583e+11 -3.6448177258226066e+09 -2.4815324437451575e+26 1 +745 3.1893050534442008e+22 -7.8181321123317479e-02 2.6049977583543560e+33 -1.0729671182579330e+14 4.8297200960862239e+04 1.2269154642861010e+15 -3.2755923256944023e+34 1.5253129786541682e+00 -1 +746 -5.4036483419400890e+26 1.4665504851121176e-03 5.4825641456438017e+08 -2.2741349234417575e+21 -9.4106359512868945e+12 1.4326342555852756e+07 -3.4477527010570225e+18 -3.0187278427204770e+08 1 +747 1.0545349282170044e+15 1.3329811412312762e+29 5.3578602299025806e+02 -9.5958468345953088e+02 1.0190645690640139e+32 -6.5733224635846016e+13 -2.5273569829614776e+18 8.7560928013122444e+20 -1 +748 -4.3534690181824286e+05 -3.5959235198430108e+16 3.2338716668187740e+15 3.3582831875019404e+32 -2.2428562163430254e+12 5.7322461933148189e-03 6.0448584764578984e+04 6.5161975770835340e+15 1 +749 -7.0042192202026208e+11 1.8371477809156170e+19 5.4082714405157065e+29 4.5654196410500163e+02 -5.0124046426281434e+24 -6.1042644358785410e+00 1.2409869628713761e+18 2.3500907279970515e-01 -1 +750 1.7478056852410937e+03 2.2512836431858009e+10 3.4112001112330677e+27 -6.2534832788253879e+28 1.7368607319418714e+16 1.1218487233261445e+30 2.2385044732648851e+29 1.1265695090668855e+28 1 +751 4.1755330793510885e+09 -3.8474412583753466e+28 -4.7837317615889233e+08 9.7953636176015060e+10 1.0171950201051892e+01 2.7920628983575292e+16 4.0118136861625848e+04 5.1392843443945956e+33 1 +752 6.6482625418725171e+18 -4.2762820936132796e-04 -1.3110766093252679e+32 3.8921122820720293e+03 5.7624499903523463e-01 6.4172993406397090e+12 2.4632718376962362e+27 -8.9877235799047168e+18 1 +753 -3.2729397577256201e+00 5.5840781597188329e+26 -5.5934434701850809e+07 -3.3205143359162221e+00 1.4863740599950736e+17 4.6054415952412273e+03 -3.2717582634821739e+31 1.0704264058797143e-01 -1 +754 -8.6634075106878853e+08 2.2017174564960144e+21 -4.1189084167746328e+07 1.8607522834613632e+30 6.2980714630869852e+32 5.1626529491657937e+08 2.6642106559631671e+05 2.4490721209376766e+13 1 +755 7.7296032862601536e+34 2.2578586962482110e+06 5.7638164896081822e+19 4.8390376396991248e+33 -3.7664337490232717e+26 -1.4846950777637740e+32 -6.1319076675824036e-02 -3.7356618015094230e+23 1 +756 4.3822684733485746e+08 3.7175986016682162e+21 -1.4429381983944223e+18 6.3625520177942475e+14 9.4048413432826028e+24 -3.7672027826930383e-03 3.0134297284399094e+06 -6.5438214163351883e+27 -1 +757 -1.6386011563495103e+12 -9.9792136141281200e+15 -4.0032711877814463e+03 -1.0820550677634600e+14 -4.8543203707375577e+29 -1.2961011118271912e+11 -1.0171580054856706e+06 1.0799408383684638e+32 -1 +758 -7.5074122455839470e-03 -1.5589787385539878e+07 5.2928498392667592e+08 1.8704207855379943e-03 4.0604524083839491e+28 -2.8534707709980269e+32 1.4837102489559495e+23 -1.6602007112219453e+13 -1 +759 1.5595828258817778e+06 3.9011550636309435e-02 -4.2606174981985705e+30 3.9070963376080518e+28 -4.1601690570298510e+15 -7.7361715222226337e+01 1.1920678266194227e+02 3.2995134320864754e+34 -1 +760 -7.3136283672801152e+16 -4.8824111436188803e+26 2.4316266892726200e+14 -1.0335159834911430e+34 7.9766580401990250e+26 -7.7421681361336564e+26 -1.9774220873559673e+27 -2.3356277686321475e+30 1 +761 -3.2154136433760565e+22 -3.2312074706032228e+08 6.2964736907327851e+32 -1.7246130640740580e+15 6.3229282327441654e+18 3.8281997362761273e+09 5.4572225317933432e-03 2.1089328648671262e+11 -1 +762 -9.9254014807872000e+14 3.2306468744703809e+04 -8.8952681075014467e+27 -1.5865488072830872e+16 -6.3759893384911315e+19 6.8087476410958500e+13 1.6590017546652256e+00 -1.1679702145508165e+05 1 +763 -2.2308618085491477e+05 -1.0821595669483569e-02 -5.7128162200502319e+09 7.4111098264867172e+09 1.6619985296694458e+03 4.3548769876629796e+25 -3.6474919623186010e+17 1.3337812946130405e+11 1 +764 -3.7280299713909926e+03 3.6354404593114881e+05 1.1060779882039705e+13 -7.9956174045803750e+21 -3.2915601181245759e+26 8.2343324953773091e-04 -1.9876878945043194e+14 8.5050132171566206e-02 -1 +765 2.9791379362950432e+26 2.6577550563906757e+06 8.7393715791479924e+22 -7.6965431539474837e+06 -3.0198169138088710e+19 8.4813138504326840e+18 6.6996018128785383e+19 2.5395526506718260e+15 1 +766 2.5605054427948918e+13 5.6822234662041602e+11 1.4721232434448487e+08 8.4931443258425391e+13 1.5199209838766073e+20 3.6130512341157935e-03 1.2932417312671527e+23 4.6521235457100110e+11 1 +767 -1.5282096420527960e+15 1.2442061586776649e+10 5.1969244478203213e+08 2.8391398589418349e+34 -2.0680151121468043e+21 -2.1779313449793750e+08 -6.6967179400895606e+05 8.6604211049324851e+06 -1 +768 2.6747689755320996e+12 -9.0352235003616306e+27 -5.0685678998984168e+22 1.2335113429493980e-01 1.9926423384904275e+12 -8.5754387860256768e+18 -2.1567223038430092e+28 -1.5818936006791703e+34 1 +769 2.8691051791673077e+33 3.0047577538422645e+26 3.2740807240380594e+06 -3.4909782887261831e+32 5.2822078456389437e+18 -1.3659739538704626e+20 -8.2076476545337950e+19 -1.3134920725044198e+07 1 +770 2.0223347247572100e+22 -1.9141019532460917e+19 1.8803041374247833e+20 -1.7002603405080459e+04 4.4410117373864670e+32 -3.6397512914094454e+27 1.7239913870500611e+25 -7.4455101276591634e-04 -1 +771 1.3421539473204938e+13 4.8995102032291493e-01 -4.3565512390196199e+20 8.2786943032792620e+06 -1.0200749901025831e+27 -3.2819291242473158e+28 3.7457722506057954e+20 -9.5362283535580517e-01 -1 +772 -2.0531692319287253e+26 -5.8397844359205791e-04 6.1904607725856961e+21 2.2111548436245050e+02 -3.6529897541738772e+06 -2.7513230394348817e+01 -7.8063551792986694e+11 1.1015644996648116e+21 -1 +773 1.3596853761458773e+22 1.6184268820243756e+28 -6.0190265856232897e-02 -4.0303580806621475e-01 -4.2855953432653852e+31 -2.3998150195084689e+20 1.6247438852134106e+17 1.5560111901609357e+03 1 +774 -8.4976101006394522e-01 7.5141507224941525e+26 -2.2369145470265342e+22 4.0510454848993036e+24 -1.7267399122796678e+15 -1.7888837923347406e+27 9.5234798619252988e+20 -1.8958542472795916e+03 1 +775 3.1954386261255965e+24 2.4006865622877477e+13 1.5536218056675104e+25 2.8086581084897204e+25 2.1780339192896591e+33 7.0002457979178534e+23 -2.9159523973810483e+17 2.0519850028299968e+09 1 +776 -1.9428176858515367e+07 7.3174719147400721e+26 -1.7903702480670128e-01 5.8640361283614368e+16 5.4194609678997202e+33 9.6770867404139027e-01 1.1806784312584308e+25 3.2260716703760824e+18 1 +777 -9.3947981702928338e+23 -2.2985302093736318e+08 -9.9836475587932275e+14 8.9488372868575445e+19 4.7750768318365610e+15 -1.0100960963977516e+10 -2.5198391573901529e+09 -4.8362118719133830e+17 -1 +778 1.9379761649778633e+23 -1.0849356212992065e+08 -3.8207205524768653e+00 2.3240755336648020e+25 -3.0441501671306313e+33 5.9711879528218939e+04 1.1484811122619245e+31 -1.8723036613228010e+33 -1 +779 -4.4691550087622864e+10 3.4006263977738146e+33 -2.6036900203714371e+08 -2.5260119475971103e+22 -9.6387881228621984e+16 -6.3399026332691275e+26 2.7833278990461670e+23 -6.2135477055023415e-04 1 +780 -8.1755133034927452e+33 -3.2036109188940500e+14 1.5303035011027734e+02 -5.5365500784306422e+20 4.4034632716457769e+18 -6.2448467460889257e+06 8.1994286176438665e+08 -1.2928350881470818e-01 1 +781 8.7771241711173675e-03 3.9093964267217342e-03 -1.7847209223286798e+06 1.3272918276535537e-03 -6.4855190315524767e+34 3.0858515178747852e+11 6.6495089648221813e+07 -2.1583876384567865e+11 1 +782 5.6143631195943713e+07 3.9954667521624997e+03 3.7839799643112055e+27 2.4291222681012031e+20 2.3007871293824473e+13 1.3865567561570207e+32 8.0405475348205063e+33 9.3613400533629805e+12 -1 +783 7.3003353971615106e+07 -5.7220489816536286e+23 -7.0054134448637329e+10 1.6356833563082383e+30 -8.4385994910400287e+18 -2.3094376982175061e+02 -2.0619400545001361e+23 -3.1680698371425887e+27 -1 +784 -1.5396024233472848e+26 -1.6528660548326776e+34 -4.6756904284430557e+33 -4.4519958062556768e+23 -6.3681738118317030e+17 4.4498462660070199e+03 -6.6924090827498600e+16 5.3282699276594449e+03 1 +785 2.5750259105531401e-02 2.4163880170283895e+34 3.6879436970786401e+05 -1.7469779567935844e+18 -2.9455626873953857e+10 -2.5047556540562023e+32 8.1269166177056445e+11 -9.1336267965906469e+13 1 +786 -5.0863449000235605e+08 -5.9754685769322163e+23 8.6242937968920505e-04 -2.4170473114001981e+22 -5.4433362365358491e+28 4.5447440809731415e+02 7.7855890305410529e-04 2.3049569052843232e+16 -1 +787 8.0434844852842314e+21 9.4353666268545074e+31 2.4440563950276074e+12 3.8073737020239937e+00 4.5036588082432718e+02 1.4844066518334591e+19 3.3439805793002588e+31 -1.5684275098078879e+27 -1 +788 3.2957991654683113e+10 2.3827964467661646e+21 3.0946079156097408e+18 -4.9951580948625437e+20 9.6079741326998841e-03 -6.8407300579993564e+31 1.1017128896180366e+28 2.2969064423645519e-02 1 +789 2.3398354415214559e+25 9.5577413722927100e+05 2.6369003874431527e+22 -1.8222890667039770e+04 3.1590830138555382e+33 9.7327148619134462e-04 -1.5571507428905680e+34 -6.1428848380142681e+07 -1 +790 -1.6205074846331469e+04 -2.5428687376983230e+22 1.3686272035928920e+31 1.0855960397701551e+24 2.7097386414441116e+27 -1.6625208368886574e+13 5.8329039555578444e-02 -1.4621172970609289e+03 -1 +791 1.1666199528531499e+02 3.9029765359888547e-03 2.3744535717748078e+21 -3.3285198273686112e+16 1.0475261631292998e+25 3.2438436454586306e-01 -2.6113475587711906e+19 1.4769440857314358e-03 -1 +792 6.3263114761560133e+31 -4.6919011100541032e+27 1.0363396460926293e+05 -5.0159945181676860e-04 1.0861523321307905e+15 -2.5645916302763509e+24 8.5284478923804134e+17 3.2934574448011072e+16 1 +793 -3.4462824930564850e-02 -1.2794593172838691e+14 -3.1944547919263758e+04 3.9062122094157773e+12 1.3474934677024573e+19 2.4392688764213308e+05 5.9065333438123226e+08 -3.5240181938568119e+24 1 +794 8.0601365063156541e+22 2.1790271247393513e+00 2.4544930295469825e+01 7.0616613513789471e-03 1.3472848864503426e+30 5.8860612343657548e+27 -1.7619331023299108e+21 -3.9351859167310254e+32 1 +795 -1.8151408482642612e+16 4.8982057512427092e+24 -1.2235022265426685e+10 9.6605685369582708e-03 -1.7313219648457284e+31 4.2892442320040955e+10 5.3782329829832452e+02 -8.9788027889730948e-01 1 +796 1.2251982924792833e+25 -4.2895554908519501e+10 -1.7683739342809632e+28 2.1181185129079204e+03 5.5364630452506010e+32 9.3387735182707764e+31 -6.0238661809693694e+22 6.8656304300566809e+05 -1 +797 -4.0886764552669874e-02 2.2946741998975986e+10 1.8871236863860456e+25 1.4292920100444266e-04 -3.0671739987384694e+28 -1.1784065615379172e+11 -1.7215267183687849e+18 -7.8026155782797852e+00 -1 +798 3.0312215163717813e+31 2.1672782702488830e+15 -7.2082934639791804e-02 1.5151756486174543e+01 1.2269695993129361e-02 3.3174201905404640e+23 -2.3751118381656808e+00 1.0920013535268047e+12 -1 +799 -1.3677770302166655e+21 -4.4799906894011688e+09 3.1277121310232545e+15 -5.3820718637827415e+26 -2.3484646023938171e+28 6.6786381209663377e+03 2.7764430501126932e+18 -7.5396820406922400e+14 1 +800 1.8776344654648150e+33 1.5164185365251134e+04 -2.3451679328372673e+10 -2.2150488573650782e+34 -2.0631380739312205e+15 -2.3717145234536264e+18 -5.0357270701271069e+32 8.1393482600358714e+21 1 +801 2.3509942571832580e+03 -7.4403641741183552e+24 5.2471217505448700e+14 -1.6547664295343625e+11 4.8426364935786809e+21 1.9617013942484347e+28 8.8892182848058311e+26 -7.7981695603270508e+12 -1 +802 -1.2358651746348698e+02 2.4511553637959122e+32 1.9146563659847891e+32 -8.3556487099871186e+20 1.3748324024674580e+07 6.9087187712879607e+25 -2.2654620419884864e+16 3.4698545483377858e+22 1 +803 -3.4634456254803885e+34 -4.4314246308940949e+23 2.5506787221088794e+11 -1.2157219940109461e+30 -2.1252155294394154e+25 4.4823147162277991e+01 2.6139460568900806e+17 -2.9685730450353883e+06 -1 +804 1.6978267577415619e+02 -1.1696647799380502e+24 -4.2711112966267273e+13 1.2084837930614915e+05 7.9425694202762570e+03 -1.0078655884006040e+15 2.0519093171370987e+03 -5.1828984598213938e+03 1 +805 -1.9356980792892845e+21 -6.9715157711517838e+02 -2.0394507158471630e+15 -1.3172688674907241e+30 -1.4950198645472318e+07 2.9923184003974596e+22 1.5795973230939981e+34 -6.2760722106472771e-03 -1 +806 -4.6790959950266740e+34 7.8694069267750443e+30 4.0519067813647148e+12 5.3276872272720367e+26 2.3945564248635394e+04 1.6179623907627010e+10 -1.4444775988226218e+32 1.7469144791504287e+06 -1 +807 2.2386988608759259e+22 -1.6158394734103203e+09 4.4380758739865062e+13 1.1004390834024315e+09 -3.0002596402210240e+15 -1.1507605971772634e+05 -1.3894086976812611e+30 2.2087673479171980e+15 -1 +808 1.2451190203232146e-01 2.6950266674552822e+18 4.9482425470959964e-03 1.3304209128489092e-02 4.1258173048733341e+04 2.3183430395463143e+00 6.5392802813769446e+11 1.3673146659673288e+20 -1 +809 -2.9665714911278334e+24 4.7692525627280727e+32 -1.4522430431427142e+19 8.5574875390315954e+19 7.7880724793057889e+03 -2.5727878464560400e+16 2.6597178405231236e+32 -5.1362195035254672e+02 1 +810 2.4220802307726105e+25 -1.2601694758606085e+23 1.9597218789062058e+34 4.1931898918283615e+09 6.4336518595187325e-03 1.2270092694908108e+16 4.6884202134791657e+07 6.6484153018933150e+19 1 +811 6.4365827228425102e+26 -1.8355992137627987e+17 -3.3185350643844362e-03 1.6925219168213832e+26 -1.9334182687427266e+34 -2.4606434144395232e+08 -3.3921371752411365e+20 5.4026803319125154e+20 1 +812 2.4805738839281079e+11 7.2451791072288909e+25 2.4605010488069803e-01 -4.6402755623760220e+27 4.2468247546517209e+27 5.7149848392129485e-03 3.9266084583790466e+11 5.5225751521062031e+06 1 +813 4.0345916309157522e+29 -1.8728025541502858e+29 -3.7095759130233657e+28 1.0520324525346723e+30 -3.7879161043061588e+27 -5.3239738234320650e+18 2.0838969588434551e+26 -1.2124868398201308e+18 1 +814 -9.1215370881264448e+16 -1.8567375311367460e+34 9.4905253815770554e+27 -5.4367049377298808e+03 4.2127111287253940e+24 -1.1398695645031496e+24 -7.7370633197048083e+06 -9.9501223477448192e-02 -1 +815 -5.4681199587572358e+28 1.1678253572775243e-01 -1.5283836793263295e-01 -1.0274519432564745e+01 1.1785560433277918e+24 1.0071222023030816e+07 -4.4623327212039373e+17 -4.9407254519498875e+33 -1 +816 -1.0124133183154957e+09 -2.1584664197840443e+25 8.4994578368323936e-01 -1.9635065436759096e+00 6.3056366135856444e+29 -4.3365550618156352e+16 2.9764985821356443e+28 -3.8102823965546479e+06 -1 +817 -3.8567659810733606e+14 6.7188342109023079e+25 -2.0739525689876597e+14 3.4131444587887509e+31 -1.2406471829995790e+33 -9.5259785350251477e+03 -1.3374919026735640e+15 8.5096477747450672e+13 -1 +818 1.4539544338776379e+20 4.4201429277094523e+29 3.6122843505559135e+00 -2.0318287050709794e+22 -9.3329495857143172e+01 -4.3336917260138289e+03 1.1792924808234913e+23 -1.7266153090405747e+34 1 +819 4.2084274568666083e+08 5.3402893536299029e-03 4.5930347263272293e+21 -4.9494450612768483e+25 4.0903624733797804e+21 -6.7577005665010254e+10 1.0654215905652968e+00 -1.1247291119582876e+32 -1 +820 -9.3011794848845696e+16 -4.4254163133004605e+15 6.1216568712337291e+32 -3.4837034373309919e+27 -2.2284125689243325e+01 4.3365092423998489e+24 -2.9079179119439621e+09 4.7350951104291094e+13 1 +821 -1.7744391987970997e+07 -3.9504451375771470e+15 -8.5647000063814229e+28 -1.0466400777190796e+24 2.8783234280665842e+19 4.0865812354588792e+07 1.6238527352212859e+00 9.4570896063620128e+24 -1 +822 4.4328113484238407e+22 -1.6151696024169127e+13 -4.3942729208932974e-01 1.5930792007548418e+24 2.0171642192538644e+26 -5.1050493949228019e+17 -2.2192886490981726e+33 -8.5962354873484650e+09 1 +823 -3.8895837492702029e-01 1.0326977142998120e-01 -6.7054098607535269e+24 2.5905207866146931e+00 -1.4857649238870607e+01 -8.7903531216645767e+27 1.0167006128719316e+11 -1.7844782520791218e-04 -1 +824 2.8561598909142522e+17 3.5345416036546359e+33 7.0395688173196476e+33 -1.7015900329311939e+25 -1.9185570906758382e+20 -2.7192029705329611e+27 -3.9915318067802972e+18 -1.8023457597817987e+00 -1 +825 2.1094275430932241e+21 5.3257137256688639e+34 2.0174558983948272e+30 -9.4954360143928525e+17 5.0118575471436117e+01 -3.7060656173846378e+23 3.0897508853059776e+02 -4.3776067976955080e+15 -1 +826 -1.4084642120037699e+29 -1.2220056131448697e+24 -3.1867164045379528e+24 2.6859429593114014e+11 1.0891135969693967e+34 3.7834223208869661e+28 -2.5884769777300164e+34 1.6082079136912536e+05 1 +827 4.0290085979834656e+10 -1.2163939443912016e+07 5.3978011549953680e+16 2.9654083500553696e+23 2.1386400994565243e+10 -5.4391639120210688e+13 -1.1724976786393173e+14 3.5858667738382259e+17 1 +828 -6.1807467567911572e+12 7.1692581003036570e+17 4.7130603001422060e-06 -7.3244881109446845e-03 -5.5938908017939939e+03 -1.1142338841123338e+05 -4.4351126685293025e+29 -4.1150106134909052e+25 1 +829 -1.1635110329150959e+26 -4.0231714613046488e+22 -1.8346603601445990e+24 -5.3768226663449473e+21 -1.1007538563756958e+15 -2.6943632061511516e+19 1.0039830429030890e+10 5.3353383595570058e+29 -1 +830 -6.4448628480583936e+11 -5.5136437843995620e+15 -2.6433763472373850e+33 -7.4805089338617677e+17 -6.9887133728790690e+15 5.0263771655675180e+22 -5.1135532412677769e+25 8.1017370910731519e+31 1 +831 -3.7850527986102263e+21 1.0268484054177095e-02 -2.8852406943296430e+01 -8.0674275206793298e+24 1.6530670202126430e+16 -9.4407236464007850e+23 -7.2093647484035320e+29 -5.2236679402171600e+10 -1 +832 1.0981869613526095e+32 4.6098364930396035e+12 -2.9164823129079460e+16 -1.6179305331403186e+19 4.8099846714766618e+22 6.7091918566883510e+02 3.0938633944326096e+16 1.2454139671136597e+00 1 +833 -9.3921545127004503e+33 5.1270352602789927e+01 -7.7396320822202561e+03 -9.3277610121967433e+31 -4.1303003108811632e+07 1.0898755506316496e+24 5.8106862818574415e+21 2.8037248079317134e-01 1 +834 -9.3956325867884653e+22 1.0260645510097407e+28 -1.6776232673459046e+27 -1.2467248794557827e+14 -6.4608492702146339e+08 -1.1604317865300013e+33 2.5111626154743957e+27 1.3779781841619540e+26 1 +835 2.0282552523571677e+00 -3.3195741204427891e+12 -3.8818785456088832e+28 1.7493948428633630e+16 3.5003478101805408e+16 7.5014149537829645e+06 -6.0018396816579938e+08 -4.3940604352272041e+18 1 +836 5.5328635913214656e+17 2.7624412212627487e+09 -1.4592103683963264e+30 3.8376735696694850e+23 -9.8108702371275052e+05 6.9337182507684246e+31 3.4052153145057791e+03 -6.0160354258722475e-04 -1 +837 -1.8057642191392505e-02 -5.1173354425062669e+14 -3.4363283791873238e+33 3.6758423534779761e-01 1.2218615266615320e+07 1.8526669645007744e+34 5.6722036845363106e+30 -2.7962419115807298e+23 1 +838 -3.6941062546648471e+04 3.7501906287921185e+19 -1.9856272339996044e+05 1.0924976285440119e+33 -9.0469997327999857e+18 -1.9446763098626315e+02 2.4194723095830639e-01 4.8254138786665705e+31 1 +839 3.0869731873410270e+26 -7.6223321858934106e+11 9.6735226163831512e+31 3.8422583498591465e+12 1.0082298760624774e+03 -1.6432882586266659e+17 -1.6043687481557966e+22 -6.5860193389917807e+00 1 +840 -7.3880706611539453e+12 6.4630217161292267e+08 -5.8164791850940615e+07 -3.2186235610280489e+28 -4.5384795653217980e+15 3.6247400549360563e+17 7.4967472117431046e+21 -2.6379748055847573e+26 -1 +841 -2.9752310915272764e+28 -6.0654582707552879e+02 -2.9447616776484238e+00 -1.8944794050108960e-02 -4.4272294986050162e+20 5.9975900248518840e+15 3.8532850585039536e+10 -3.7300629820044390e-01 -1 +842 1.1802524991211111e+24 -3.3401058682838989e+10 8.4206564167706799e-01 -9.6622450681962528e+28 -7.4625705519879107e+20 -4.2868368153708329e+22 -7.2012629178625061e+25 -1.2542094744139076e+23 1 +843 1.4302482922893933e+17 -1.9529450133670492e+16 3.8603570259831132e+18 3.7275469767940096e+27 -1.7456333162809370e+17 4.9044881410587898e-01 3.3086039979266250e+12 -2.0033286346343644e+28 -1 +844 5.4120684265832648e+24 -8.4673428798993469e+10 -4.5590601001640312e+02 -6.5431425658044130e+15 -1.2663266437735192e+16 1.2621396298310364e+26 -2.2780772326849255e-01 -4.0702479248788699e+34 1 +845 -5.3287370027506665e+11 -1.6176473427246023e+24 8.9149498313339626e-02 3.2282893414018443e+04 9.7352683617156600e+01 1.6323408040772878e+27 2.3043048375768105e+18 1.6504353433974414e+13 -1 +846 -2.1893909764186584e+12 4.3480362758904639e+11 5.6962597558796886e+23 1.6693516190357909e+14 -1.8080653092074075e+09 3.9888102504607232e+00 -6.7355317594120760e+15 -1.1665716599103816e+18 1 +847 -5.3103457928994802e+33 9.4841736612033496e+30 3.1967699401849130e+25 -4.7370279053903249e+25 -3.4314253690225859e+22 2.3008123960029909e+19 2.2506160746656904e+25 9.4604964065483475e+09 -1 +848 -2.2123089386667338e-01 1.0207452753799920e+17 -1.9847695032946882e+04 8.8937294930746351e+21 2.7775513424254947e+33 5.1854887071004177e-02 -2.4330267846749595e+05 -9.7471691869393296e+22 1 +849 5.3623997531858420e+15 7.4836611998374690e+02 3.3276282372283390e+00 2.4419731813636648e+01 5.5876761665048707e+02 9.1241919695052246e+12 -3.3063001656064975e+15 -1.0636793199349187e+26 1 +850 1.8517813127572674e+02 2.6564644259810215e+31 -2.1054446979704224e+12 6.1469725088611123e+31 9.2749810238213744e+04 6.3187003371442643e+00 -5.2890511144606319e-04 3.8241975113585234e+29 1 +851 6.7528995028932800e+27 3.8641235721388543e+03 -3.1806100581176858e+17 1.5759105189462392e+29 2.3287979004182630e+17 1.7057072718721860e+15 -1.1261772788358822e+02 -4.7619006916190853e+09 -1 +852 -1.3271849216133832e+13 4.9657307346359484e-04 2.2609204040951465e+02 9.7827611189456917e+01 -3.7606336524762660e+06 2.3961582224589483e+03 4.5773431920386086e+17 1.5295145122696407e-01 -1 +853 -1.3900430208189263e+01 -2.8424484400387467e+26 -5.1286558099639050e+26 1.9095779158593792e+20 1.4803619787290710e+01 -2.6030884140688845e+28 1.7689629068602319e-01 5.9812638398723140e+07 -1 +854 6.5320922649012989e+23 -6.7749014628706314e+20 -2.0624603560252020e+06 3.4812205369825218e+25 -1.6887494490290288e+05 2.3524027885398436e+08 1.4246577115501005e+00 1.1594319319165554e-02 -1 +855 4.1016089940390565e+31 -2.9720504429434390e+04 -5.0599914816239514e+23 -6.1547713806478683e+01 -1.8854920316886309e+31 -4.9480510168281664e+26 -8.3561509125158880e+06 -9.6440507191589475e-02 1 +856 2.3427691805124985e+19 9.2852944352654321e-01 2.7830605702236328e+10 1.5455499154605437e+06 -6.6152315959667351e+02 -1.3255859620035627e+33 1.5301001069885864e+26 1.1898458468186788e+33 -1 +857 2.0453140900656275e+17 6.6684220829903315e+29 8.5289329938066160e+15 -1.6101242619671661e+04 2.1958339338646127e+20 -1.1012262013822339e+30 4.3345635757315957e+19 1.7589687860326525e+26 1 +858 1.1518684719509832e+24 2.0313622480069018e+18 -4.1203760609734957e+01 4.5364984112203969e+14 -2.2730754406975590e+20 1.8018367401329759e+21 8.9318388091587153e-02 1.4668960311473855e+06 1 +859 -1.0102512427153324e+33 2.5035899969197488e+21 2.0590707299134991e+29 -3.5753597100449585e+10 -4.3915479809127658e+20 -7.9810320211382723e+18 -7.1870820327845453e+13 4.2047464965252425e+14 -1 +860 -4.1210658471024953e+13 -2.4635038314100508e+12 1.1525828481472822e+21 4.9370505428708084e+29 3.7112919372364487e+06 1.2188165506971080e+33 -4.4586271468222964e+00 6.9394735554502250e+20 -1 +861 -1.4374697715559790e+26 8.5006322826596915e+24 -1.5902883677614194e-02 4.6188709393051770e+00 2.3418193247043579e+11 3.2499928458401702e+07 -1.3259008874341199e-01 9.1374162081247601e+29 -1 +862 7.8868102038172368e+30 -2.2720081456416498e+27 -6.0582042172973235e+32 -2.6376079225198463e+25 3.9757266685711239e+06 -1.9570564745425800e+04 -4.6482887945863638e-02 2.1053586492187456e+14 1 +863 -1.7699728155014374e+10 -5.3345611827670240e+15 5.6815204075656354e+00 2.5296467120014304e+34 7.5988460292041385e-04 6.5972074283172778e+11 -3.8682750891862439e+11 1.8045991196636031e+25 -1 +864 -8.0103361240387012e+31 1.8637579434206927e+30 -8.2017630716028240e+15 1.1409852645044246e-04 1.3482304169204918e+25 9.7114042766647370e+04 4.0175648732344642e+04 5.9810026064541003e+33 -1 +865 -1.6277445599699328e+16 -1.5248083457116521e-02 -1.7064572598903631e-03 2.5887626953405770e+27 -1.2781709645452585e+02 -2.5919550959438216e+03 1.0620954147188213e+29 1.5482284412589858e+23 1 +866 -9.8810650979040749e+05 2.0300876680252419e+05 -6.0286700146987059e+18 -3.9629157224433525e+15 -6.2787427504814154e+29 4.9938883268473570e+15 -1.7097438594914713e+13 1.0736376484141722e+29 -1 +867 2.7073078248494320e+16 -1.9536823102862434e+12 3.5591987166604458e-04 -1.6990711158317082e+00 2.4866189879112881e+12 4.2498063023310051e-01 3.2999672476339882e+21 -7.1723100398404597e+01 1 +868 -4.0772041671582854e+17 1.2415841867179798e+17 1.2291319692520099e+27 -1.4788396773989540e+10 1.0306301692415793e+33 5.1583631927033580e+18 -2.5706131292632882e+01 -2.0225730289226155e+09 -1 +869 -5.9245733922601151e-01 5.4213876417489280e+16 4.1591437830365030e+03 -1.3190705001095570e+33 1.4681589457973746e+30 4.2053693951275500e+19 -3.4236339136376064e+16 -1.3301478527436070e+34 -1 +870 -5.4175409896731330e+05 -3.1635150613750350e+06 1.8115653775289900e+34 1.7640699529301188e+24 4.1341211411005506e+20 -2.2589124650864887e+27 1.4516683134948255e+24 -2.4945380737040935e+29 1 +871 -3.1663430371145714e+04 1.2506171893470480e+08 2.5531882548665563e-02 -1.1026575628351297e+30 -4.1293017898433840e+16 2.9497681655100433e+34 1.3376833346834976e+16 3.3342017463512715e+13 1 +872 -2.4728195006257661e+27 -3.4442547347618056e+34 2.7799707561874119e+34 -4.9272141695163021e+17 3.9507720606552029e+09 2.4584109134660306e+00 4.3416364129205898e+24 -1.9149527386328166e+19 1 +873 -1.0476989598756966e+17 -2.5981574233612645e+07 -8.4844954059783460e+32 1.3214334237481897e+18 -9.0110042381028088e+29 2.1656596983658075e+06 -1.6954481479901799e+33 1.7865175042906198e+32 1 +874 1.0495773835079661e+18 -2.1946752736640150e+14 -3.5633173233990854e+17 -1.4584169627006373e+32 -1.4988761933163159e+14 -1.9362622287297663e+06 -2.7503387533546163e+17 -7.9170978522149181e-04 -1 +875 2.0557759701873447e+12 -1.5616092124269008e+13 2.9968723461697130e+19 -3.2726834925743774e+10 -3.4678901222632870e+21 -6.3473119706063660e+32 1.0737247639711878e-01 2.0423375335028334e+29 1 +876 4.1312614193882645e+15 7.5589075710153847e+03 4.8416487798430899e-05 1.8035093187641592e+09 -1.7404660051474416e+03 -1.7369316026797053e-03 -1.0858236794126980e-02 -8.1193187447882410e-04 1 +877 1.2691766339567998e+01 -3.4854858199764528e+30 2.7735884592057555e+34 -2.2318464460483778e+00 -4.7464805889761513e-02 2.4059751829787139e+33 2.6615653902456969e+25 -5.1481747776438644e+28 1 +878 -1.4451385628145628e+20 3.5053368951397791e+18 3.8268077722368878e+04 2.2941324780729790e+09 -4.5055392694346995e+17 -1.0511800282679014e+05 1.1386171622393127e+10 1.1613781052130268e-01 1 +879 2.7267372785485054e+02 -6.1491543145363353e+22 3.1499829224468070e+19 -7.2550192748751926e+09 -1.1673131662564853e+07 6.5098575729093854e+32 6.8450279288829280e+15 4.3532397013888335e+12 1 +880 2.8737570684686326e+27 -2.4648220063247854e+29 3.8266357150767760e+00 8.6351232439815332e+18 1.5555224089975386e+09 9.7053841650881055e+12 -2.1431605527720963e+10 2.9379081922814250e+04 -1 +881 2.2105045516615067e+24 1.1945456454603296e+26 8.8178123544302868e+22 9.7823617262829858e+11 -3.8900814901035321e+11 5.8276790057551692e+23 -1.1357773386400581e+14 5.2504253797825183e+30 1 +882 7.4622135017986014e+05 -2.0211536730382586e+08 -4.1592418556437310e+24 1.8250809349109321e+06 -2.8730681743341571e+20 3.2830105478726652e+07 1.4609588561862373e+08 4.4343034599679492e+12 1 +883 -2.4360849378655888e+07 4.3100419858839404e+11 -5.3257009078277361e+25 -4.7030002549497463e-02 -1.0506390518192919e+18 3.7651791568595320e+07 3.4383212896206881e+19 5.3647307832364510e+15 1 +884 3.3790939469160330e+03 -2.1107747065691347e+20 6.9436747422219536e+16 -2.2928925470924940e+09 -9.2443220979954627e+28 -7.7290567874657720e+15 -2.7397413073180244e+32 3.0152346361575963e+31 -1 +885 -3.9530345471341773e+18 -9.7694509480078328e+08 1.8815029704247024e+23 -7.9509335987006942e+33 -3.1525487840675770e+29 1.2441720995703401e-01 -1.4542122742757997e+22 2.2505325847086989e+05 -1 +886 -8.0320240820704581e+04 7.4912833814492848e+16 2.2381105916871232e+17 -1.0352572495165819e+05 -7.4372805966175266e+24 3.7147245990708063e+05 1.4870942653656163e+30 -1.4494889393325670e+22 1 +887 -2.1075498904790251e+29 -9.1627720054820726e+21 3.3228774450825781e+13 -5.8856197488226853e+06 2.8206328680990904e+18 -4.7600546954548972e+18 -3.6749630109898038e+27 2.0795523701931871e+05 -1 +888 2.4712482327985107e+11 -1.0765893940551766e-01 -2.3452021873695757e+17 -6.3555708557419321e-02 6.5649473857736178e+25 -5.8700377815107450e+22 1.9899096181127782e+18 4.5808432580639326e+19 -1 +889 1.3600296577398856e+14 -1.3062824924497923e+04 -6.1894600857524991e+27 5.7661409138850459e+31 -4.7357576745590272e+17 4.9637083560958828e+13 -1.6263196329787313e+31 1.1815928547866037e+01 -1 +890 6.3514006100918157e+19 2.7211018112627678e+09 -4.6463079513341332e-02 -8.4830105103525120e+15 -1.9194262387750427e+11 5.0235567598220780e+06 8.4491620366637177e+20 2.5690602978459379e+29 1 +891 -4.1223194150350471e+33 2.1411180554853080e+26 -3.2200199919665395e+05 6.5376849481592779e+09 1.6307965486695111e+11 -1.3897244085232896e+17 -1.4437616454820886e+03 2.1093140154891458e+09 1 +892 -7.4810436287439863e+12 4.2535126367206021e+02 -1.9908609127589012e+34 -2.4639531823402970e+24 3.5184084088247363e+05 1.5306528583695737e-02 -4.4645287049980418e+01 -1.5240796980913459e+17 1 +893 -9.4729007023442654e+30 2.7238707698296259e+17 -3.4249924568072038e+02 -2.8982297141326560e+29 4.1601993075356032e+17 -1.2989188838221972e+29 -7.9601778184727347e+08 -2.0381504819640318e+24 -1 +894 -8.1016478612971009e+33 1.7870167920637676e+26 4.3624936226611438e+14 3.6918393604674877e+34 -8.0978611503648537e+05 1.1792770595259408e+06 -1.6491798827252351e+27 2.0148199437807845e+19 -1 +895 1.8471379856982821e+01 -2.8564651705665769e+14 -4.2126357155046490e-01 1.1186398876994388e+19 4.1757456603578147e+33 6.7212311566850961e+21 2.0491604021590087e+04 -1.3566436169399243e+23 1 +896 -1.0795125586515031e+12 -2.4514648130038043e-02 -1.6543219378445086e+25 -1.7022037375217075e+12 -9.3709245082908989e+32 1.5542439622704851e+28 -2.6294125520548828e+29 4.1027124907574825e+15 1 +897 1.1660479724619035e+26 -7.1602466631986502e+24 -5.6066832722056012e+22 -3.4307456008526356e+19 -1.4213459209491558e+21 -4.9509718138093001e+27 1.1513178447093422e+32 -1.0911345563026587e+10 -1 +898 -5.1363777094730249e+26 6.9531322974477253e+21 -5.0424290759786976e+24 7.9278813816090394e+06 -5.9562741847980730e-02 4.8978868254294413e+23 -4.4042332934638915e+30 -6.6412685255396834e+25 -1 +899 7.4824851742645429e-02 8.9537196813981573e+03 -4.1209705131893308e+00 9.5021017729618973e+10 -2.1342894016427600e+23 -4.9860808414493757e+05 2.5095987627320102e+02 -2.0544832741526050e+15 -1 +900 1.1969538599570396e+27 1.2245695745205335e+03 -2.0104276855682372e+16 9.9161853215559688e+25 2.4325171372574501e+07 6.5948084320403225e-05 1.4412006554215055e+13 -4.7107212520834143e+24 -1 +901 3.3185401353789198e+08 7.4864145208549593e+05 -1.6455666086173622e+01 2.3291988114173828e+27 -3.6390303422267102e+13 -6.3058732331218552e-03 -1.6378468723193503e+22 -5.6209024436088446e-03 -1 +902 1.1235647596024556e+02 2.4115473402648015e+23 -3.2420680382417069e+26 -7.4960746378426522e+27 -3.1407652454981636e+06 8.0033490776027946e+09 -1.5425353233055415e+31 -4.8221360281433624e-02 -1 +903 -6.1270186202543497e+28 1.0866848363773833e+00 -4.7893341446042762e+22 -5.1194052624944151e+26 1.9735494755644027e+04 1.0028137486378069e+28 -3.7447588236785032e+03 -2.8836734198086438e+33 -1 +904 6.3688058630655214e+19 9.0737527028839889e+25 -8.1973374070519072e+12 -1.8953649798910474e+32 2.8528974935835609e+24 -3.2926994728767864e+21 -5.0554827063948044e+10 -2.7527149546815871e-02 1 +905 1.6633558880052214e+21 -1.4910719964771080e+27 3.2470982198333392e+16 -4.5089102321090390e+20 3.9396342824785004e+09 1.0078378093538912e+14 6.5828637263099896e+05 -2.8613823113061428e+07 1 +906 -2.7430066321234697e+20 -1.7591265711960668e+13 1.9972489463390703e+21 2.8949094067095870e+24 3.1464679142774800e+20 -5.3457036930812749e+17 4.5067638838568671e+00 2.7822895388540800e+01 -1 +907 -2.7168225062080615e+04 2.0883334459923800e-01 4.0548100380319840e+15 2.3125637779425552e+29 1.3111834205265834e+29 -4.8854012389399661e-04 5.9327547028856806e+17 3.7237137243412304e+32 1 +908 -7.5112383002291783e-03 -3.0791919662642578e+11 4.5519097081952964e-01 1.1538692868680609e+24 8.4155187649584960e+15 -6.0739484214111515e+20 7.1585172236171560e+16 5.6175199894258085e+00 -1 +909 5.0670942607006821e+28 -1.9717346623590670e+09 -8.2695917252157317e+24 -2.3929091857005188e+32 5.3527832156741173e-04 2.9709621381178101e+10 8.3998711303168652e+11 -3.8826159467819184e+26 -1 +910 1.4095191511412960e+07 -4.5334742194306100e-04 -5.4609260361685301e+30 2.5207896312699251e+30 2.1807331570872910e+27 -2.8803140255563192e+33 1.9721175639683866e+27 1.7362296390347083e+06 -1 +911 -2.5195841922460460e+01 -2.5514743820977410e+03 1.1965069537120758e+29 5.6587875036578470e+22 1.6077599094317120e+34 -7.1965027372277752e+23 -8.9996170091845102e+02 8.1518553399600320e+16 1 +912 -2.8433780848720006e+32 -4.8457889495211769e+10 -6.8929815474070800e+14 -2.0464918303522387e+24 -4.9161236118200250e+14 -5.2155381193160632e+16 2.3745288977881745e+30 4.8478807099539571e+19 -1 +913 -1.9447279736767014e+04 2.4031311714292412e+16 8.3558062833419421e+30 -3.5052600988438988e+10 5.1404275232642100e+14 -2.1443673295714077e+21 8.0431669931204557e+31 6.3696972239077930e+11 1 +914 -1.3698306659897482e+13 -1.9225105813990270e-02 4.5398064100141739e+10 3.4267595844784349e+07 -1.7807074903335948e+07 -4.0014123871087268e+21 -3.9549639278833461e+03 -1.3446995849463425e+20 -1 +915 3.1304804028298686e+19 -5.5870192345599219e+26 -6.8636891845681710e+21 5.5996474219416079e+01 4.3650388399964315e+25 -6.1925627785988710e+15 -2.4255600131872269e+32 -2.0853718841843972e+24 1 +916 -1.5078226603595480e+15 8.5398075401421357e+06 -2.8007651917953873e+09 -8.3651073358348571e+06 -2.2598068531698132e+00 -5.9834863121598003e+00 -2.2131221400451577e+04 3.2831172907036567e+30 -1 +917 -3.9449734806993888e+00 6.8151941834080977e+12 -3.5343758889608164e+09 5.8046975609541823e+02 -1.7351873862526170e+06 4.0264753471865026e+30 2.9133887312181748e+00 1.4219312800517352e+31 1 +918 -1.1253032829487152e+05 -2.4862708149443793e-01 1.4487038186769751e+26 -2.5559115511500306e+04 3.1175647842388809e+07 -2.3419240051655119e-02 2.5353153548874252e+03 -1.5440297470361961e+32 1 +919 2.4599293997126868e+08 -5.6841346528857924e+30 3.0443289403301636e+10 7.5542880126089265e+04 7.6929205025337954e-02 1.2539051680334715e+01 8.5379136456905614e+33 -2.6774645828559174e+10 -1 +920 -1.3915578876731344e+17 -3.4589198350005682e+11 4.0561015177856374e-01 1.1304044083977278e+21 2.9430232761238561e+23 3.1583471098806490e+17 1.0760793064705302e+21 -4.6437871606663626e+05 -1 +921 -1.6833167959683269e+04 3.1917204668573824e+16 8.6695994027455318e+30 -4.5177398063254176e+20 2.5318803774866915e+26 -1.5826299598283824e+08 -1.9799500446416159e+18 -9.1380968968690130e+22 1 +922 -1.9044809133190165e+23 3.6749322305834913e+28 5.2273853058038284e+00 1.3236446227416762e+34 2.4478102370798774e+05 1.8878595518999739e+00 -6.1457253047879422e+08 -3.3216005056152020e+15 1 +923 -6.2255443091290935e+34 -2.0553025613201904e+09 -4.0503914423965917e+28 5.1095355018116448e+00 -1.4601752773363472e+02 1.0429512624404148e+13 -2.3043504294440884e+24 -4.4017648904784417e+08 -1 +924 -1.2675731756242450e+25 -1.5718727445537947e+30 1.7944335306411534e+22 -1.4339736633635848e+22 -2.5298671439231110e+08 1.5262278082202785e+25 2.2933647105682613e+13 -6.0792156866062648e+01 1 +925 -5.4854665699677506e+29 4.1778590533372534e-01 -4.9637222722205456e+33 5.7715958495158520e+09 1.2905531673226395e+34 2.6754446488491622e+23 -4.0266581006115430e+19 -3.0142002093937017e+33 1 +926 -3.9885312805537139e+17 1.6128069063936369e+10 -1.1197437460170200e+04 5.1765215340627569e+18 2.7535521509945166e-03 2.3400305130983577e+09 1.1275593190344286e+33 9.8038684342914433e+31 1 +927 8.4575302220538303e+07 5.5054419824269955e-03 -1.1308521390641206e-01 4.4867406096537498e+18 6.3554396445502520e+15 4.0649448581929703e+28 -2.2556725772236328e+10 5.9432125027798259e-02 1 +928 -8.7624665876639160e+11 2.5935023967384384e+16 -5.1459958106419039e+21 -5.3048754463436730e+30 1.0095276805982301e+20 -1.2419136926008082e+02 -6.4974910551773667e+02 8.8090289166162596e+32 -1 +929 1.9431660628958255e+07 -3.0541274020742105e+24 -1.8852052060901031e+27 -5.9057162662286157e+17 4.5109393270883619e-02 3.2911985745850775e+14 2.9478223595501675e-04 1.1614067925849654e+24 1 +930 1.3172942244478314e+16 8.7961228533076709e+20 -3.3734889203095907e+30 6.4385075114145884e-01 3.4744862723234946e+03 -1.0628570086314322e+13 -5.0068783330673225e+07 9.1455149474518844e+13 1 +931 -4.1334019334928136e+32 1.2503541534259600e+16 4.1086312490701023e+06 8.3515804192007663e+23 6.0785897380348456e+02 2.0116585335440342e+12 -4.3834595271360205e+27 -1.1711563758338104e+32 1 +932 1.8440717541481015e+04 -1.2124842380123858e+33 -4.5135354025578708e+05 -2.1094623781766786e+29 1.0584050043593342e-02 4.0689224358724869e+10 3.6737205453129427e+03 -4.8168923904866097e+02 -1 +933 5.8451974138962260e+23 -1.7220237002428771e+21 2.8973979824393463e+08 -2.5747229046811326e+05 3.6661026925178656e+30 -2.6914456058246444e+31 1.3971601184335903e+10 5.8276473434364759e+20 -1 +934 1.4350856013457874e+21 -4.4747210266763547e+23 -4.5147145626095223e+08 2.0331560782912480e+15 -4.8764898663832777e+23 -1.0519644192184320e+30 5.5767844020687345e+21 6.2489403738775042e+00 -1 +935 -1.4385562473663193e+33 -4.0603022682567575e+21 -6.3038784278893457e+12 1.8192190776236486e+24 7.1215106169050726e+18 2.3005003229894620e+20 -9.2306591833189527e-04 -5.8559987109147438e+13 -1 +936 2.1137678392031059e+07 -3.6570096865923767e+11 -7.4783565179970049e+27 6.9302054840846825e+08 3.7987314586959050e+24 -5.8973973645946601e+19 2.9685808483215187e+27 -8.5942168429448677e+30 1 +937 -6.2011668252066936e+27 -4.6244632785402962e-01 -1.0928293268124078e+11 -1.8915435903056783e-02 2.8054013763335347e+07 3.0980661221621631e+04 3.3246469109072332e+03 7.2780228359120155e+26 1 +938 -1.2558713794216138e+14 -6.9034031357499599e+09 -1.4947779907969531e+07 7.8828245027353500e+13 -2.7579129425786300e+14 -2.1053800406577683e+17 6.2448858893690210e+15 4.9792713561361538e+01 -1 +939 1.9543178200981679e+09 7.1457607559965877e+05 3.5120323968348160e+16 7.8244429717244832e+28 8.5234607916324500e+14 -7.1234403161412400e+15 1.4331955640433799e+06 3.0541677753755145e+00 1 +940 1.1187753074161197e+17 2.4016094352331510e+02 8.2220816957233634e+26 -3.2936737230716784e+29 1.2089168800665452e+24 8.8094262979312400e+14 -2.3733181305522022e+14 2.3831815890143248e+19 -1 +941 -6.4971097385957629e+31 1.4691525152515254e+16 -5.1147613505585792e+17 2.9305431810212440e+02 1.4165081808581149e+11 -7.3982928847090568e-03 6.4444012581740052e+18 5.7151663750795454e+32 1 +942 -1.4266610818315486e+22 9.3317645176698258e+22 -8.2558833308557461e+12 -7.4048009783775513e+10 4.7825531025714615e-02 2.3196743154501090e-01 2.8091827607291489e+03 2.4453847467025542e+22 1 +943 -2.9659783465606304e+16 2.7280598354742786e+11 -3.2963148986496075e+14 3.9177135156004397e+01 1.2867386141322054e+19 1.3531628130982189e+09 4.4788500295507721e+31 3.5819861760193260e+18 -1 +944 4.2300508723410938e+11 1.7907910417764459e+11 -1.6095375108479930e+17 2.2295796551033335e+23 1.3440610028630292e+09 3.2152234290361655e+15 -3.0828348841033097e+19 -1.7944136016393749e+34 -1 +945 1.0073776416164756e-01 2.0682022534994958e+30 4.4805593648328082e+25 -2.9589336065554785e-03 7.4197567540256424e+09 -2.0758705232807596e+16 -5.1120663757634610e+15 1.1419188397723571e+33 1 +946 4.3911537444135337e+05 -4.4368613260414550e+19 -3.5045655710115931e-01 -4.1843157228623664e+16 7.8087205905681811e-01 -6.9448721334459868e+29 2.0495500982497887e+00 2.6104972361416463e+25 -1 +947 4.9243720757155552e+27 -1.2828704746597681e+09 -4.2988376905285910e+05 2.0689859063897267e+07 -1.4716031503553735e+04 -4.2895920059197376e+26 -6.1067290990748439e+32 -1.9993149266084459e-01 -1 +948 4.8368858778774365e+03 4.0989582825548185e+25 1.4274280401927466e+12 -6.7155122488483713e+01 2.7118403894866943e+09 1.6352292612947486e+30 2.8495796169620827e+23 4.4437848801826513e+31 1 +949 1.0705208291134134e+07 4.9750444987087270e+01 -1.2532746901828692e+23 1.9899840595208680e+16 -4.8979175514320433e+06 2.3251571137386996e-02 9.1605896442511234e+09 2.4808626710981104e+16 1 +950 7.8556679264445411e+03 9.1336442430944152e+27 -6.1584211088719368e+10 5.6105426686065675e+03 -1.0435161282574006e+02 8.5947168850135246e+20 -1.9389067008120159e+10 3.7287487342092987e+10 -1 +951 -1.7076746421221927e+30 1.1597718592328058e+10 3.9217980016031899e+12 6.7487215043667250e+13 -3.4708590720577019e+27 -2.3151973872213787e+08 4.5398491076910752e+04 -1.4678289770692154e+34 1 +952 -1.7726535898727835e+24 -3.7841156991693497e+07 -1.3745113606813151e+25 3.4255197843877704e+18 1.8640613114982092e+21 -4.0812986603378109e+13 1.1050347440172306e+20 7.0404619084768656e+13 -1 +953 -1.3985577772605983e+21 -8.0751924239972261e-01 -1.3702332532732800e+17 2.6565140960540104e+25 5.3540530709170019e+32 2.4399246667487904e+23 -1.0187375754371545e+21 2.5192027467635612e+00 -1 +954 2.2421474939625674e-01 2.0003171934193915e+15 5.3223542677239717e+00 -4.1026575636654450e+06 6.9529982234349577e+00 5.1609999136677638e-02 -1.4240810062264679e+06 3.7927518182976173e+28 -1 +955 -5.5418707725112100e+15 7.5915119953477583e+28 4.6103738634141672e+30 4.9760849355836841e+11 2.2382097337818404e+28 8.0668773786745407e+05 -7.2706704314358384e-04 -4.7057170749796955e+26 1 +956 -4.6208524927100977e+28 6.0497194980075024e+06 -1.7184308384019960e+18 -1.9190043870901081e+02 -3.2221637230377188e+13 2.2044308654894820e+21 -7.4546751922415674e+08 -1.5009987135101752e-01 -1 +957 3.2291068405904150e+02 -4.1605797961451330e+01 -5.6158460323048785e+25 3.4865594428584625e+10 1.4577548925980922e+21 3.5978375782596125e+34 7.9515871047572025e+14 -1.9679058712071584e+32 1 +958 -1.9003692921844598e+32 4.5884325498804380e+05 -2.6825118286064176e+00 1.4204685683905858e+19 9.6874637241607598e+18 4.1737800125332102e+06 4.5043513716024085e+28 2.6365956465920013e+32 1 +959 4.4520799019930139e+21 -2.3765260404759420e+30 1.5970703363537484e+03 -2.0094038994590720e+16 -1.2179700563721411e+14 -4.7674472816367859e+10 7.5809838267825637e+28 1.2652018822999858e+03 -1 +960 1.0933997705950350e+31 -2.3918130671952672e+16 -1.9932417401865289e+07 -8.8429702172639250e+13 -3.7963322908750580e+22 2.2845812945711600e+33 2.4618730817621798e+17 -2.2201065862157344e+26 1 +961 -3.6839557791502085e+06 8.5780711887443033e+00 9.5439265193309512e+18 1.7316950447638143e+33 1.9730097368682484e+31 2.2290151097843927e-01 1.3015687958771709e+05 8.5861544175615680e+15 -1 +962 1.3667216027585050e+28 -3.7074128897780894e+34 8.3459840368277843e+21 1.0017234482796208e+29 2.5713770503850442e+17 3.7159034139513672e+34 3.2743207082429246e-03 9.8830586170625196e+32 -1 +963 -1.5947609049850778e+14 -1.4243872330333740e+18 -8.0608654874676454e+08 4.5087008177325194e-01 2.9560673208890125e+24 9.6336561342097723e+28 -3.6503586898760815e+31 -5.2588437272248255e+27 1 +964 6.1195679593570557e+10 -8.2489643984907553e-03 2.2659914641184696e+10 -8.7881422393452411e+00 -9.5288267326061634e+24 3.0353618781151929e+32 6.4679861125923480e+01 1.5598799763626893e+19 -1 +965 3.3083128761447105e+00 -1.9317842245883257e+27 -2.5910995706153192e+16 5.1036614440226618e+17 3.2729138565842025e-01 3.1684610474344405e+26 1.0080761406645333e+21 -2.5027514654019279e+32 1 +966 -1.4588825323811461e+03 2.1213282167214854e+27 -1.0716943693572051e+12 -3.6610425628263566e+22 4.5144622067763505e+20 -4.3217256779976276e+23 1.1554924365052645e+22 1.2522111170681936e+04 1 +967 1.9904722575036190e+15 -3.2483269575369707e+32 5.5839695040327818e+01 1.1891281287972898e+24 6.8207093044007050e-01 -3.6962268296872492e+02 1.2566807905179447e+00 -8.4452024775620239e+24 1 +968 3.5486738781254856e+16 2.2218848189543489e+30 -7.2579221220059523e+21 1.5546144629067631e+14 1.1718041894258192e+33 3.6558924871797468e+32 2.6781346289797557e+03 1.3477752878012186e+01 1 +969 1.8598529515072443e-01 -2.1300795632758707e+24 1.9512647857709796e-03 -5.4911472289762169e+04 -5.3317130211696606e+11 4.4192081677089710e+01 2.0902686933250161e+30 -2.0613902953226056e+07 -1 +970 -2.7013579943010118e+03 -1.1390366029073000e-03 -1.1565188975257276e+24 8.6117575732630707e+10 -2.4099502817778805e+25 -2.5982583260337549e+17 -2.3800538381235339e+02 -3.2488270338078438e+12 1 +971 -1.8510892341882847e+24 -1.0258581515540153e+24 9.9970078070034964e+29 -6.0539982173503291e+22 -7.6749511832726292e+18 3.4032773862688541e+03 -1.4455949153070405e+03 1.6301952217741414e+17 1 +972 -2.3077606685570262e+30 -1.2784388501975182e+13 -8.8330668408380091e+07 -7.6699420147038471e+31 -7.8971916832636832e+05 -2.0285075831815737e+20 -2.5174399146746996e+20 -7.7213595495876939e+33 -1 +973 -3.2509152528208810e+15 2.0417137480788712e+15 -8.4908540034389901e+19 1.8060661342050972e+10 -7.2801331893858936e+04 -3.6026593120261943e+00 -1.7544212535175064e+06 -7.0976597365035059e+25 -1 +974 -7.8789888560532723e+04 -2.1146151668545215e+30 2.6799286177391018e+19 7.1645674160519608e+18 -4.0279572227299977e+06 1.5148552055289112e+27 -8.1916191852594635e+24 5.8250289755763725e+29 1 +975 -8.1954711721288704e+17 -2.4239201138045523e+07 -1.7393408480253094e+00 -4.8659494529488116e+11 2.6348068737094194e+12 1.0379353576303202e-01 8.1627439111529640e+01 1.5087788376548224e+03 1 +976 6.4269650008245839e+32 3.0992793762538867e+17 1.4285281492638489e+00 -6.2054525050776482e+08 7.5425220114915601e+25 2.5065040593883088e+06 5.3615877341141100e+26 5.0829172404729948e+21 1 +977 1.3036031048710788e+05 3.7341335979175186e+06 3.8561265536751986e+08 -1.5139341400998602e-01 -8.9415646940081150e+15 -4.1183517948654778e+17 -2.1137823825002839e-03 -5.3910187368130580e-01 -1 +978 -4.4082745190034379e+24 -1.8516640859914273e+06 -7.1813814807335102e+20 -5.2325524080595815e+34 -2.3544571578381957e+32 1.0447066594847582e+06 2.0843543838123746e+24 -1.8082430413384216e+33 -1 +979 1.4259255951917092e+16 -1.5493119636338524e+03 6.2480498816334784e+16 -5.2998813484053971e+02 2.4150360125413058e-02 -7.7929081305102827e+03 1.3956914972916720e+15 1.5601373010430638e+33 1 +980 -1.1012189840267153e-03 -1.3639882101241759e+26 -1.9756119859148095e+29 -8.5053587855841517e+07 -3.0023221185695669e+24 2.5934329692808997e+11 4.5139207230273264e+20 -2.2657090682705682e+11 1 +981 1.3857395078721976e+16 2.9502902187644913e+21 -1.3040503441164751e+34 1.1473151047928918e+33 -2.2149271170527736e+24 -5.8735290808001992e+01 -1.0280954410988123e+21 -4.3010576304957512e+18 -1 +982 -7.8263073928383322e+34 1.4501430537124607e+33 -1.0745943507240051e+22 2.8605423693432841e+25 2.0246214868287279e+24 -1.8248255295819988e+18 -3.1489727706267700e+10 6.5828298227062225e+07 -1 +983 -2.0535099449023535e+05 1.6749024215038414e+10 -6.0106274029852600e+10 -7.8129161459757036e+18 1.4240120317457786e+17 1.7875843009937788e+16 1.9555909357145015e+26 8.5994170771415560e+15 -1 +984 -3.3961247614286304e+06 8.9218580932229396e+24 3.5155479473404822e+11 7.7461008808632491e+25 3.3738301555452750e+27 2.4690766078986707e+09 -1.4644426339542273e+11 2.1904998706062768e+07 1 +985 -5.8657073853199175e+06 9.2980958666648000e+13 -9.4728007291108415e+27 3.8472001840490905e-03 -2.2555642665983162e-04 1.2537556467658744e+01 -1.0426076818984835e+33 -3.2928705250401379e+01 -1 +986 -5.6847961207883051e+06 7.0928070334307662e+00 -1.2098811841221560e+15 4.5083452269684852e+13 -6.0732126136994010e+17 -4.2367062503933175e+14 -4.5630802715097517e+31 6.8838247008719405e+26 -1 +987 -7.9627903572304750e+13 -1.7629104074740961e+30 1.5273079769996201e-01 -3.9729515283712662e+03 2.4641193830609946e+24 -1.3186371848941020e+23 1.0298940819441466e+25 -3.7885263800037346e+23 1 +988 9.7833580731774218e+03 -1.7313526541084992e+24 -1.3916241220431314e+09 2.0303861428752640e-01 3.6843042144408367e+33 3.1119718821501912e+31 -3.2343862521882072e+07 -4.9921032148840977e+13 -1 +989 7.3877913471733500e+13 -3.7245670466321589e+22 1.9074740968772525e+23 -3.9800294430500136e+29 -9.2760253072121600e+05 -6.5369794746853852e+22 -2.5831479432431371e+06 -4.2566830052014939e+07 1 +990 1.1108576584402442e+17 -5.8648899852463915e+19 3.5916091852251580e+25 1.0811584039559473e+27 -2.9621587891424065e+26 6.3339768620022636e+10 5.1459555729696106e+29 -1.7044915694545760e+27 -1 +991 -4.3265866195690708e-03 6.6897505472715470e-03 -1.0153440402039079e+27 -7.9825148238325515e+05 2.4206498043396343e+23 5.1830175133518270e+28 -2.1185465386992430e+24 -9.2702004086819706e+09 -1 +992 2.2511453522756774e+05 4.7538728443902400e+01 4.8661163614037420e+01 -6.1350169317728627e+24 -9.3992228106791890e+08 2.4113593255635807e+34 -7.2729560259197628e+33 -6.7905069009261524e+03 -1 +993 3.6111053209313680e+16 4.0018638122218843e+04 3.0186079981104209e+22 1.9307249148548923e+25 9.0405139777881489e+19 -2.0296597142729576e+31 2.5120477118529182e+20 3.0469196407738912e+26 1 +994 -3.2037403896380147e+02 3.3502661277230160e+26 -1.3459102986018716e+14 -6.4678135497479984e+25 2.8095720310697681e+23 3.0814780056796252e+01 6.1222652445318050e+15 -7.6318390351193613e+33 -1 +995 8.5343229731657318e+26 2.3016456982476567e+25 -3.6067261699355270e+15 -2.5067573030684650e+33 8.6101629580322519e+07 -2.7839762858272240e+31 -1.0585429035837988e+12 4.7884687230163755e+09 1 +996 4.3878285057966440e+05 -2.6748778069163702e+31 2.0804468403150193e+19 -4.3950296686624433e+05 -9.6228032889230728e+08 -1.0979690388371980e+25 -2.9114581418901211e+12 -1.7910514984797460e+28 1 +997 1.0807510623439615e+05 -7.4413988130831086e+01 1.1839692407392094e+23 -9.4429315841492400e+15 4.0582796652321377e+12 3.0491504053160895e+11 2.5695066651227405e+11 -2.1145709354737936e-03 1 +998 -1.2105608738630093e+21 2.5580925597659961e+13 4.9706937520712199e+33 3.7050368957633829e+08 9.0348703328287439e+11 8.9316282454475276e+21 -2.1583673709230244e+08 -8.3930431937727578e+29 1 +999 -4.6617303292183075e+10 -5.6589821904802294e+23 -5.0586549477789049e+01 6.7649427129117714e+10 3.4015374851305774e+02 1.0241314173929287e+24 1.1540271821284533e+05 -5.1632721662570099e+23 -1 +1000 1.8321848801361679e+25 -1.3604857377934077e+03 3.7550271193083845e+27 -2.3644455224600293e+12 1.3368497400663492e+30 -3.1656360093177360e+05 5.0982484068622656e+16 -1.2656111551260202e-02 -1 diff --git a/src/Triangle.Tests/Robustness/Data/maple-leaf.txt b/src/Triangle.Tests/Robustness/Data/maple-leaf.txt new file mode 100644 index 0000000..f842e25 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/maple-leaf.txt @@ -0,0 +1,53 @@ +# maple leaf (Canadian flag) +L 9.411160522513711E-07,-13.519999900664274 -0.7398863499341937,-13.519999900664274 +L -0.7398863499341937,-13.519999900664274 -0.42587061257415276,-7.528222623618156 +L -0.42587061257415276,-7.528222623618156 -0.7398863499341937,-7.159716997405436 +L -0.7398863499341937,-7.159716997405436 -1.265853936263007,-6.99891264387112 +L -1.265853936263007,-6.99891264387112 -7.243963230648103,-8.160939608621398 +L -7.243963230648103,-8.160939608621398 -6.501668029487604,-6.005157063979679 +L -6.501668029487604,-6.005157063979679 -6.501668029487604,-5.4764481414332025 +L -6.501668029487604,-5.4764481414332025 -12.539344635897143,-0.2279759040440321 +L -12.539344635897143,-0.2279759040440321 -11.013723846894692,0.4512743538036753 +L -11.013723846894692,0.4512743538036753 -12.367217917546977,4.616901951597235 +L -12.367217917546977,4.616901951597235 -8.72538101478353,3.909000608883257 +L -8.72538101478353,3.909000608883257 -7.8652978789811865,6.149593529315376 +L -7.8652978789811865,6.149593529315376 -4.782665318949124,2.8438747741225714 +L -4.782665318949124,2.8438747741225714 -4.2471345979749335,2.6801465249591736 +L -4.2471345979749335,2.6801465249591736 -4.033292903517113,2.8438747741225714 +L -4.033292903517113,2.8438747741225714 -3.836114817149586,3.214712877097545 +L -3.836114817149586,3.214712877097545 -5.345553647016665,10.316064749041654 +L -5.345553647016665,10.316064749041654 -2.9639837641868456,8.941064343063584 +L -2.9639837641868456,8.941064343063584 -2.5839837556743728,8.941064343063584 +L -2.5839837556743728,8.941064343063584 -2.313382850950707,9.193403416552757 +L -2.313382850950707,9.193403416552757 9.411160522513711E-07,13.530003151093538 +L -15.999999070309688,-16.000000050121304 -31.99999824507451,-16.000000050121304 +L -31.99999824507451,-16.000000050121304 -31.99999824507451,16.000000050121308 +L -31.99999824507451,16.000000050121308 -15.999999070309688,16.000000050121308 +L -15.999999070309688,16.000000050121308 -15.999999070309688,-16.000000050121304 +L 9.411160522513711E-07,-13.519999900664274 0.7398881854240255,-13.519999900664274 +L 0.7398881854240255,-13.519999900664274 0.4258725604057894,-7.528222623618156 +L 0.4258725604057894,-7.528222623618156 0.7398881854240255,-7.159716997405436 +L 0.7398881854240255,-7.159716997405436 1.2658555955386102,-6.99891264387112 +L 1.2658555955386102,-6.99891264387112 7.243965221903481,-8.160939608621398 +L 7.243965221903481,-8.160939608621398 6.5016686127185475,-6.005157063979679 +L 6.5016686127185475,-6.005157063979679 6.5016686127185475,-5.4764481414332025 +L 6.5016686127185475,-5.4764481414332025 12.539345652092816,-0.2279759040440321 +L 12.539345652092816,-0.2279759040440321 11.013726362988894,0.4512743538036753 +L 11.013726362988894,0.4512743538036753 12.367219978544647,4.616901951597235 +L 12.367219978544647,4.616901951597235 8.72538330648945,3.909000608883257 +L 8.72538330648945,3.909000608883257 7.865300374742185,6.149593529315376 +L 7.865300374742185,6.149593529315376 4.782667893346472,2.8438747741225714 +L 4.782667893346472,2.8438747741225714 4.247135624808317,2.6801465249591736 +L 4.247135624808317,2.6801465249591736 4.033294542270379,2.8438747741225714 +L 4.033294542270379,2.8438747741225714 3.836115949085224,3.214712877097545 +L 3.836115949085224,3.214712877097545 5.345555517715786,10.316064749041654 +L 5.345555517715786,10.316064749041654 2.963985844892547,8.941064343063584 +L 2.963985844892547,8.941064343063584 2.583985230174504,8.941064343063584 +L 2.583985230174504,8.941064343063584 2.31338398924093,9.193403416552757 +L 2.31338398924093,9.193403416552757 9.411160522513711E-07,13.530003151093538 +L 16.000000092102205,-16.000000050121304 31.999998245074547,-16.000000050121304 +L 31.999998245074547,-16.000000050121304 31.999998245074547,16.000000050121308 +L 31.999998245074547,16.000000050121308 16.000000092102205,16.000000050121308 +L 16.000000092102205,16.000000050121308 16.000000092102205,-16.000000050121304 +L -15.999999070309688,16.000000050121308 16.000000092102205,16.000000050121308 +L -15.999999070309688,-16.000000050121304 16.000000092102205,-16.000000050121304 diff --git a/src/Triangle.Tests/Robustness/Data/orient2d.txt b/src/Triangle.Tests/Robustness/Data/orient2d.txt new file mode 100644 index 0000000..cbf6be1 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/orient2d.txt @@ -0,0 +1,1000 @@ +1 1.4961614016396960e+12 -2.5541490932981474e+21 7.6400648583370128e+01 1.3318242171938891e+01 -9.7267316824929993e+19 -8.4624203955526605e+20 1 +2 -6.8902150136125088e+06 -7.0491295475057450e+03 7.8213531273971216e+16 -2.2756820423879327e+11 -1.7140592168677645e+09 4.0918854118598287e+05 1 +3 -3.2695859635782457e+04 1.3484076773268453e+03 2.8960665483660479e+04 2.5780054545604253e+04 2.2180528833652939e+28 1.3156801618834456e+17 -1 +4 2.8916655435939677e+23 -5.3261461492120296e+07 -4.4397191566378944e+17 3.1489522914416782e+23 -8.7951610704529375e+13 3.6024417330116944e-04 1 +5 -1.2525993522692469e+25 -1.7037762905011953e+28 1.1632720582572828e-01 8.1047819190345346e+29 5.2685873362592753e+21 -5.8728275136852593e+04 -1 +6 -2.1803935586702738e+25 1.0643328232578197e+09 -8.5431760978014500e+14 4.7932045456624233e+24 2.1171088242334023e+09 1.6416647266939648e+12 -1 +7 -2.5268048500708491e+19 -5.7033141523096798e-02 3.2947079252817697e+26 -4.9082442030147166e-02 2.1371942918250064e-02 -2.4160329549375672e+18 -1 +8 -3.2831616281537759e+08 1.0137803923519623e-03 5.4613896346145868e+08 8.1042581368612492e+08 1.7325415566116972e+16 -7.5922728104924238e-04 -1 +9 1.4561461137896329e+11 -4.3531973309506762e+08 2.9725726647960533e+00 1.4959158720414041e+00 2.9035808316536648e+04 -2.4300937668706796e+16 1 +10 -9.6633998985023936e+01 -2.6791247858395129e+29 -1.4290677293548254e+02 -2.2770673203021448e+21 1.7544282312441907e+09 -3.9768908828523358e+30 -1 +11 7.4717947054323084e+31 -1.6456720815443866e+18 -1.0459268553010823e+27 1.7808684806907993e+32 2.3259874234421215e+30 2.2845925900648746e-02 1 +12 -2.1955311292625469e+32 -5.1490888530104126e+10 -1.3888082973524135e+23 4.4233207695140266e+08 1.0207386752495583e+32 -6.4397976857319394e+23 -1 +13 5.4101172567220736e+08 -9.6648282120603399e+04 -4.6355270417884185e+34 -4.4629595589349997e-04 -1.4743882108457007e+22 1.4044994636892540e+29 -1 +14 6.3590628910673112e+07 -3.2439766416214772e+33 -1.5733279423267087e+28 6.2563133750416230e+17 1.9594216058716285e+32 -4.2828437170015210e+11 -1 +15 -8.4382966270272908e-01 2.3575567519991142e+08 4.4765290238874485e+20 7.8505261492865694e+33 -5.7312282707342422e+08 5.5789022941860040e+01 1 +16 1.5722762847051551e+31 8.8897460193998337e+07 -1.6606582445150359e+21 -5.4468526727973175e+20 1.3039827154148022e+32 -5.5091117343386315e+25 1 +17 1.3656984859546518e+05 -3.7696920220153049e+07 -1.6729859489569325e+14 -1.1351935174325351e+06 3.5023045366118747e+25 -2.0239017890154155e+01 -1 +18 -6.5146468842178650e+14 5.4646962897050333e+08 -6.3317190036045726e+31 -4.3954744064858734e+13 2.9021312221812448e+27 3.8317940605233618e+21 -1 +19 2.0597657122578348e+18 -1.4789154958701525e+28 1.2200588019122578e+27 -4.8144353992849667e+27 -1.3569252334354327e+09 -4.7690270207505076e-03 1 +20 -3.4724453911654373e+23 8.6549471045329584e+31 2.0713369682307812e+11 7.2768694144522228e-01 3.5990455437187390e+15 1.3109443767655400e+33 1 +21 1.3148761486453700e+22 1.5857389067884142e+33 -1.1989608042768683e+29 -2.9776181126570545e-04 1.0758825430227386e+30 -8.7094205928583887e+11 1 +22 4.2928299194574393e-01 -7.0274418609237850e+14 -1.2780679392743271e+05 -4.8756408405061904e+02 1.9765853248683317e+30 -2.3878669185881958e+17 -1 +23 -6.3052568655661889e+03 -7.7344960441708679e+09 -1.5776636308750323e+01 -6.7940552832286693e+06 3.8082354871044810e-03 -1.0602000690890682e+32 -1 +24 -4.6609043113142428e+23 -3.2679051664573961e+31 -4.8041099061276243e+34 -6.8927356184424786e+30 -4.3270648434905907e+17 -1.4254868751956294e+17 -1 +25 2.2997211312906881e+34 1.6145934384456114e+05 -2.3906545898625154e+01 8.8920297512938646e+02 1.0538775197017539e-01 8.7831206061402099e+02 1 +26 -1.6064075675776949e+09 3.6146529419414664e+32 -1.0182828396799837e+02 -5.6459564472191071e+10 -1.4180140696922041e+21 6.7268253275786150e+15 -1 +27 -5.1302632992030950e+14 -3.6339288756449718e+09 -1.9773087354834495e+27 -2.8296163149977157e+04 3.9697516697619415e+18 5.2396084203190369e+10 -1 +28 -8.1456694190920125e+03 -2.3419466428674909e+00 3.1297459056289426e+30 5.5020198587926443e+03 -1.2679175560247507e-03 2.5711332724362364e+04 1 +29 5.5735190706553568e+16 1.6278466619732873e+09 5.2600183715064774e+09 -5.3409701803800032e+26 4.4849044099699691e-04 -6.3973160715925565e+04 -1 +30 1.2250413325849036e-01 2.8909730211282770e+33 -6.0722504709001150e+19 -2.3278529053583791e+22 4.9735389003735087e-02 3.7567492904518840e+18 1 +31 1.5815415250205704e+19 6.0974086828864670e+10 2.9977261021995510e+01 -4.5057482953834219e+05 -5.6160236776482250e+15 6.2907093223939812e+10 -1 +32 -1.4412642001507118e+20 -1.7313876680770449e-02 1.3785553457384664e+27 3.4892907927547797e+24 1.5092033434802103e+09 1.8093215462124315e+30 1 +33 2.0043699976069685e+06 2.7581240719370803e-01 4.0093630406871024e+30 -9.2856348588783147e-04 3.4658494936315100e+25 -1.8237140025593656e+29 -1 +34 -1.9243939141825717e+21 1.0835501730538522e+17 1.0716458511762697e+14 2.5191989642678236e+03 -4.6285941170641595e+31 3.7338235729238167e-02 -1 +35 2.9794470856388909e+05 1.1572061053232637e+06 -3.5894510900180407e+07 -5.5987242844004720e+07 1.9751433728859254e+26 -5.9954386406412333e+01 1 +36 5.4207083312587751e+19 -5.0393717891643901e+04 -2.3058107819070690e+05 -8.5770175753741036e+18 2.2916587387885068e-01 1.1069973706808710e+33 -1 +37 -4.6997654672911144e+14 7.9186644631028805e+30 2.2576108255306458e+18 -1.0701416340493153e-02 -9.3200590141082561e+04 1.4971763430802660e+32 1 +38 -3.9928777622364635e+30 2.0654540657875037e+09 5.0880806443061706e-02 1.2797782921298340e+11 -3.4150089476705983e+20 2.3470101291229498e+17 1 +39 2.7312803687393510e+17 6.8014500005062842e+28 7.6908733291182448e+32 2.8563760575682878e+08 -5.0244145268007714e+23 3.4258919481683397e+08 -1 +40 -9.0535688054463844e+21 -9.7649274557134529e+31 1.3886846148930245e+26 -9.7721776171115504e-01 8.4965803289364602e-04 -1.2794227480663639e+26 1 +41 7.6694472151093592e+04 5.2023015194575244e+11 -4.2214553034141942e+18 4.4046228195460939e+27 6.0858708343131629e+20 1.9011749642724883e+12 -1 +42 2.1014301602769523e+00 -3.4228618987072917e+29 6.6843985835014206e+33 -2.7647425063786249e+09 -4.9080992234924255e+10 5.0375808477961573e+02 1 +43 5.9580277885092527e+30 9.8841475332616168e+25 1.0556244095031116e+16 -1.5520494276720600e+32 7.1336548272127792e-02 2.8104901552012001e+18 -1 +44 -6.1089445560300018e+26 6.2808837755560819e+23 -2.0973571379845392e+24 -1.3106487380249396e+08 3.7942649811885934e+24 -3.9370621426934704e+16 1 +45 -2.6200295716558849e-02 1.1525226199688626e+21 -6.2088270295672543e+07 2.4088920714213048e+18 4.3377029423989043e+18 1.4664029563488000e+18 1 +46 -1.4122549293382772e+27 2.3701473138661869e+05 -8.7612641509760309e+26 -5.3173798853465684e+00 3.9380429271544518e-02 -2.0105379806477704e-02 1 +47 7.9050253091637561e+11 3.8794191192702958e+00 -3.5360624365289420e+34 -6.8022747755700867e+10 -1.3536145324844119e+25 1.4604956673082223e+09 -1 +48 -3.3760478754190570e+06 -3.5499905829952543e+26 6.8049411493812500e+13 3.0174185516562232e+29 -2.2359067188164983e+25 -2.4283261773289045e+25 1 +49 3.1455383428153334e+18 -7.3117522536098375e+13 1.8229796647374215e+21 1.6751556033993721e+28 -2.8878698751998512e+13 2.6266680649816209e+01 1 +50 1.7939742330110972e+23 -7.6074108136313690e+23 1.4840256996473176e+09 -6.6488166127957115e+09 -2.8260816112557855e+19 -1.1945098473831406e+14 1 +51 -1.1721165733341397e-03 1.5046997929402697e+22 2.7301558111827329e-01 -2.0854909576268838e+14 -1.2880329643313178e+31 3.6641777362961607e+27 -1 +52 -1.4331160919372114e+24 1.4088270788948749e+11 -1.8231242655606925e+22 1.6605267732585800e+14 -3.7249938437605460e+25 1.2155062452901101e+12 1 +53 -1.7464287680241897e+00 -1.2113008415801755e+26 -3.6828661241339432e+28 1.7559476841129330e+22 -3.2105666790572158e+06 -1.5761635027224411e+10 -1 +54 -2.0961488941457977e+34 6.9438267533407764e+12 -1.1910644483052486e+27 6.3022589724000361e+20 -1.2905400811470620e+28 2.5404072852064266e+14 -1 +55 4.0789798681002915e+08 1.3034719163657340e+34 -5.4432892308095799e+25 -1.9253891413949900e+31 -3.8448991854349273e+01 -5.4483361607446564e+22 1 +56 9.7282049255615543e+05 -1.4709981102017870e+15 7.5593724639406351e+31 -4.9329978308411263e-04 8.4501997861890569e+07 1.3666719604983426e+22 1 +57 -8.3889318620490414e+00 7.8098238155973942e+21 6.5850257093861542e+09 9.2430877429895438e+06 -6.3042691886981083e+06 5.7749538403378056e-03 -1 +58 -4.3682435085038893e+23 3.5007385417260605e+18 4.3924703626621646e+04 2.2195934489976357e+19 1.9463763789284510e+15 6.4911261040316334e+22 1 +59 -3.6623147979105986e-01 -2.8783470919998008e+16 1.3384214813008242e+09 -2.6984221589283920e+15 5.4844993201498692e+30 1.0619359832948243e+05 -1 +60 7.1192543807719863e+04 6.2379587890318899e+03 -3.4896371814872646e+19 -7.7569064704795754e+34 8.9915907552940251e+00 2.3639968568171042e+01 -1 +61 -2.5132639342711456e+26 -2.0003187645349433e+20 -5.8960331289061458e+27 -1.1864547228277621e+20 1.5418459241077370e+17 1.4649471489585596e+11 -1 +62 -1.5805806225560008e+15 -1.1134005036406377e+01 1.0573929314845367e+02 4.6706785986219589e+10 1.2464981909933834e+10 -2.2213401102134050e+01 -1 +63 1.7754622925591026e+10 -1.2627604317061311e+08 -2.3674096671762996e+34 2.0073911823133261e+23 2.3570734114286411e+05 1.0133188379755980e+02 -1 +64 7.3549059464259248e+23 2.2968864859828837e+06 7.0184580973524065e+24 7.1825965024417249e-01 -4.0200542620884542e+09 3.5619592293618761e+26 1 +65 -2.9807389733360491e+34 -2.5514197196252168e+16 2.1891444537899709e+33 7.1180048091153819e-04 -8.7862418963723377e-03 5.2055675260571396e+05 1 +66 7.7517516807422901e+23 -3.4068030105817172e+13 -1.8479831856010235e+26 3.6515782751360240e+16 -4.5980250942423423e+04 -3.3729228403562988e+12 1 +67 -1.4266646792388784e+32 -5.4815809339511226e+33 -1.8405185385725265e+06 3.7330384339885876e+11 5.1866830048183148e+32 6.7189014827983795e+17 -1 +68 -4.3652613382520340e+03 1.8390298317732592e+09 4.7846820869589573e+08 -8.3489490689643555e+10 -1.0226951011482975e+04 4.3722867450890303e+07 -1 +69 6.4792647274182836e+23 9.6705330608164036e+02 1.2020631640971428e+08 -1.3830209564518361e+32 -2.2628501037606669e+24 3.2392849860672492e+18 -1 +70 1.5927735396634643e-03 -3.0843142163418224e+29 -1.3942605757805470e+04 7.6478799388599097e-03 -1.6550590076554794e-01 4.8126178933567656e+12 -1 +71 3.2037909215050321e+22 4.1606053868689892e+30 -1.2147718025506201e+08 -1.3128412606150508e+06 -1.3179972383383944e-02 7.0771617986461865e+02 1 +72 2.6140018563166589e+11 7.7030749181844483e-04 3.0064074145919776e+03 -1.0570804127599472e+24 -5.5880837094263458e+10 2.6290597721549984e+00 -1 +73 -5.1666075062844319e-02 -1.3516399848825539e+19 -7.6884727647621910e+23 9.2033552453686730e+27 1.4482948924432834e+23 5.7138286232665337e+01 -1 +74 -5.6399486633617781e+13 -1.6242406138125120e+10 3.8418208775447414e+25 -4.1198431041788507e+29 1.9731344128441719e+27 3.5785566344082222e+25 1 +75 5.6060925978162643e+06 2.5624416847351193e+07 -1.1868602058995095e+12 -1.0221279667348988e+14 -4.8259158583780788e+01 3.9979748657422924e+08 -1 +76 -2.6799990961743108e+27 1.7913664716121462e+12 -8.4985557878429346e+11 1.8398864499447401e-01 -8.3909901361418527e+21 4.6543266722420685e+02 -1 +77 -2.6255013398567753e+22 -1.7959677157342355e+02 1.3178413172192007e-04 2.2271652476958326e+22 6.1149615253859447e+03 -4.6747838957317500e+14 -1 +78 9.0590480227850260e+15 -1.2465644083863149e+28 -1.0895911698499596e+26 -1.7944920620969708e+33 -1.8809493614822430e+15 -4.8780929516409657e+00 -1 +79 -5.2302126103845226e+21 3.7537243825662109e+12 -8.7060747076925240e+32 -1.1525534640350998e+27 -2.0334823257359594e+30 -1.7677442410080342e+16 -1 +80 -4.5301904221036845e+21 6.0178344558361768e+32 -5.6465287641569580e+10 -2.3359231852541948e+06 3.3480056788882884e+27 1.1908758018076189e+12 1 +81 2.1104904785276160e+11 -1.0322135026338702e+15 -6.5498625311811177e+26 -3.1311261138067493e+01 1.2882453856143347e+32 -4.6209657737969142e+24 1 +82 -3.3843399903768099e+23 2.2141669797221452e+22 5.8351025667660405e+25 2.6313443621180356e+06 2.6742815171667526e+17 -5.4444116601960019e-04 -1 +83 -5.5687168963257730e+31 -9.4599700386904576e+17 9.1574194735128510e+20 2.4947950595326813e+11 1.1233078827711252e+22 -4.4408439856694851e-04 -1 +84 6.1542140441946808e-04 -5.2092579271709380e+20 6.8665665178053036e+09 -5.0672637019056580e+11 1.9711000808371475e+10 7.0655327439217913e+08 -1 +85 -2.0754188292015196e+27 2.8756322337277842e+12 -8.5870471452195310e+15 1.8735767485808069e+05 3.5281572763690235e+01 -1.4253897719532776e+08 -1 +86 3.7786695302728119e+25 8.5736615838237305e-03 -3.4731251059301974e+24 8.0417624557891977e+03 -1.4284375538481903e+01 1.1045140329121338e+10 -1 +87 8.4110301218879204e+02 5.1753684118018008e+01 -4.0594535229056686e-03 -5.4284789435879197e+23 9.7315348090774127e+19 5.0221854795268503e+34 1 +88 1.2595902777372376e+25 1.8254946774787601e+02 -2.6636844075529222e+28 -3.4005809323228290e+31 7.9848011905903957e+04 4.7496019853701143e+25 -1 +89 -5.4341352929316827e+01 2.8711571295440250e+00 -1.5829431086267533e+09 1.5067724674783518e+24 -1.1419120932820980e+15 -9.4191265561882620e-03 1 +90 -1.3024169670396447e+08 1.9371305418924510e+15 4.5847941487458573e+32 8.0530556458205312e+27 3.0142362840221268e+31 -7.2172771386127652e+03 -1 +91 5.7549809304694630e+00 3.2345081578558000e+13 8.1838145325972637e+03 -1.4649439063111182e-04 9.8095041644173804e+18 7.3434897002202088e+03 1 +92 3.6296154075475287e+29 2.6587411343776417e+08 -1.2249568649806205e+17 -4.1427136981000814e+30 -2.9010699271549894e+21 1.8849534412116033e+08 -1 +93 -6.2860944805265531e+07 9.1912576942018995e+29 3.7922992615491671e+00 5.1028408462830588e+07 -2.2433156982969853e+18 -5.8838342065811043e+20 -1 +94 -1.8510538551145194e+09 1.5548015321201026e+07 -4.7453000651587178e+20 9.1053810261272734e+12 -1.4803971588240691e+32 2.2486646644523987e+10 1 +95 3.7667647766863056e+23 5.8158029544823125e+07 -5.8737891257069539e+04 -8.1520266185896588e+32 -1.5687089095945206e+10 -1.3907992540985730e+09 -1 +96 -5.3099952910085814e+06 1.5040231805470156e+27 3.0064603588485915e+27 1.1046181467820443e+18 -2.4256738166194844e+14 -5.8152105994202827e+01 -1 +97 2.5917354729513464e-02 -2.9594659539690547e+26 -3.4565389653275198e+24 -2.3194233963205328e+16 -1.6629504966212153e+12 -3.2672914417894996e+21 -1 +98 4.7674145518219954e-03 4.0261634300500388e+31 3.5007965079190555e+27 1.1896135046087714e+26 3.1221851056415078e+04 6.0474170445693449e+26 -1 +99 2.8187328979129398e+17 -1.6816810665100132e+16 9.1029153721828439e+24 5.5658863567941153e+03 1.4364992572572330e+16 -1.4886212623007691e+30 -1 +100 -3.4045948959510498e+10 8.4819696271897852e+23 1.7557262450350812e+00 -1.1035098165886791e+30 -4.9030428458812496e+16 -1.0941840970342222e+31 -1 +101 1.1514848891412948e-02 4.3614536205576968e+08 -7.0741794021211197e+18 -1.1477739050769648e+02 1.9246819130712666e+07 -5.7933952691335823e+18 1 +102 2.8037898357753910e+22 -1.0886959366802038e+17 5.2417679390420318e+01 -7.9223517300473405e+30 -3.5101567695994936e+02 2.0721194487454604e+34 -1 +103 1.1379632891456850e+27 3.7452990372154573e+17 -6.6639529234822486e+06 1.2270851130961144e+26 4.4062790141946966e-03 -2.3758143829742730e+22 1 +104 -3.3543495588038006e+29 -1.7258887836457163e+02 1.2342884843642258e+27 -8.7341253759714443e-01 9.8909758240380943e+03 1.4183219525943132e+03 1 +105 -2.3181243312356578e+13 1.5592598896157865e+27 2.8813023605523932e+30 3.0830883909797272e+34 -5.9823997797870895e+01 8.8155131334075918e+01 -1 +106 -3.5187101247361540e+15 -4.3176234602908928e+27 -5.6997556708995732e+12 -9.0875814499039348e+31 3.2663736014456018e-02 1.2611473505705063e+12 1 +107 -1.4778055102736823e+22 8.1384527959410638e+21 -1.7229565923343580e+28 -5.5039424252176163e+04 -3.3902451659308158e+31 9.0507765142624451e-03 -1 +108 -4.6766025400308155e+00 1.7368782325144984e+01 -1.6085231247902913e+34 -4.5370284445262207e+31 4.0633250879571312e+06 5.9378192084087499e-03 1 +109 -1.7834233709850441e+33 8.0366805144684701e+31 -5.7166938062473036e+30 -8.0818671013694031e+10 -1.8206160051407397e+11 -6.1112226203349121e+10 1 +110 -8.0635141474985120e+11 9.2555557514332129e+11 3.6931622328669739e+09 8.6325535820113146e+01 4.4103521386195779e+07 2.1961250541559235e+19 1 +111 -1.4055259259384349e+07 -6.1696868056377424e+16 -1.7069588602982430e+29 -9.3284761511606713e-06 -8.3570830951902425e+31 -4.5991223370443323e-04 1 +112 -4.9229291834234702e+05 1.4840964320292833e+26 2.5183021356576906e+17 -3.8727483666656903e+30 -6.1975277043455904e+16 2.4799938741680213e+04 -1 +113 4.6837191524255019e+02 5.8396202748519770e+20 -3.3026912172632372e+30 1.6935781879564800e+16 -3.4037666906089434e+00 -4.1744023604159367e+26 1 +114 3.3485844049503622e+27 -1.4096468089873102e+28 2.5839716510275265e+33 -2.6986180636659488e+23 3.6187932977467904e+17 -8.3702375307524734e+21 1 +115 -9.3945116110015456e+06 -7.2104066706372070e+08 2.9511974105895934e+32 -2.9512349228562014e+30 -1.4601846109412441e+06 -1.0242559519229116e+22 -1 +116 -4.9730513899091846e+02 1.0287770166115662e+10 -5.6789604337194550e+00 7.5180808207131581e+20 -1.4181473727278773e+00 -6.8890445238583828e+13 -1 +117 2.2981482248812867e+21 -6.5514823731749043e+12 -1.3352005284937341e+14 5.8029546394912090e+23 4.7740980473889608e+31 -3.1925529848841255e-01 -1 +118 1.1406751936061845e+25 2.9785799463490548e+03 5.2599852019643081e-03 6.0467972416876491e+33 -1.7017166867890696e+28 -6.0018260264896146e+24 1 +119 -4.4405175320396416e+10 -2.7994872751039016e+04 1.0432599406845297e+11 1.7634820456197388e+15 -1.4083872655793261e+06 -7.2021891646498786e+33 -1 +120 -1.5553978896110562e-02 -1.0202370564215949e+29 -1.3321124598514163e+08 5.1926914999571614e+07 -3.5270117720769123e-01 1.2277024134333604e+02 -1 +121 -1.6042905444902511e-01 -5.0413714958316372e+29 7.5272803073028600e+33 5.7375357400682027e+31 -7.5722043930527040e-05 3.1689208765087023e+07 1 +122 4.4541284280446521e+26 6.5162534936890317e+17 -3.4091607054841993e+06 -9.3053055277901520e+15 -3.5051375971456686e-04 1.3174167687560771e+02 -1 +123 1.5395063305244636e+00 -3.6325309400702786e+03 4.3446398605945139e+18 -1.8284027169327013e+34 1.8622425485838625e+15 1.2993903584395931e+06 1 +124 -4.0995547350990385e+22 6.4050950949227600e+14 4.8104386703244720e+15 -2.3710232677263219e+13 5.1496775155334781e+13 -9.4682995382014036e+23 -1 +125 -1.9481558145913279e+08 -2.4180979239247916e-04 -8.9296631210264401e+04 3.5343306956955748e+03 2.6576924608034801e+18 -2.2808704594210476e+26 -1 +126 -6.6806634094585700e+15 -2.0793210906655517e-03 -2.4084401142019956e+33 5.0743859148847114e+04 7.0805778266344422e+13 -2.0533311941287158e+18 1 +127 -9.8953875145964469e+27 -6.0789508769678535e+09 1.8195281622064442e+25 -1.0061607612548794e+10 3.4884476613847283e+05 -5.3067370383129294e+20 -1 +128 1.1163731355737301e+15 2.7066021717444304e+00 -3.5392855594776943e+12 -1.7994774010599717e+07 -1.5315402775131154e-01 2.1955236410123782e-03 -1 +129 -4.8325674705458611e+10 -2.5442692883055029e+26 6.3995629937597357e-04 -3.9616298633904163e+11 6.1622639317676783e+07 5.7004913281098884e+06 -1 +130 2.9147147010631437e+28 -4.1305618171385241e+27 8.3363788808488238e+24 -4.5316370394121031e+02 6.6452927182162102e+02 -1.5882473859291761e-03 1 +131 -9.5221062289264569e+02 -2.5506803507113162e-02 1.5769792472616287e+26 2.9334123902170655e+18 -8.1852968411799951e+11 -3.7612819692624973e+17 -1 +132 5.6060967332351097e+32 -1.1842461690418158e+29 -4.8727289260777713e+27 1.1974934868994974e+30 -1.7109100545687281e+34 9.5009908592240701e+31 -1 +133 4.8555422966691816e+12 -5.4698795655351976e+19 -1.7748925561101918e+34 -4.7891650937404795e-01 6.9931014473788700e+03 4.3064419034667160e+15 -1 +134 1.2626570241342191e+31 1.8431327994078820e+24 1.4249165599007429e+22 -2.0463680954143742e+31 -4.0877071795644030e+07 -1.5753533907542222e-03 -1 +135 -1.4449923741810407e+01 2.1174107859637713e+08 -4.8769303350475990e+10 -1.9629540031363494e+24 2.8550671723441681e+10 -4.0296868238902595e+22 1 +136 -7.2070782028716650e+14 -8.7121715014944997e+19 -8.1686342366353413e+29 -1.4396448523929466e+20 -1.2078885198611341e+07 -9.9130586653459119e+04 -1 +137 6.6198747187696603e+25 -4.1161145035874257e+33 2.3163137030336957e+03 -2.9814350500691861e+23 1.0200704723159734e+30 -1.0839279910072865e+13 -1 +138 1.0221326241135458e+00 5.9922995569552032e+26 -4.9203667484208421e+31 2.1915633006226887e+25 4.1610816046972356e+26 -3.6269420187567968e+29 1 +139 6.6943285178940743e+06 6.1361764672254338e+14 2.7647408510890502e+17 -2.0341367248772907e+26 2.2937516195186864e+34 -1.9397879481608429e+05 1 +140 5.7737438128409795e+06 -4.2173218510633311e+22 3.8673748102122384e+31 2.5511386265884155e+08 6.4271629706563331e+00 -4.8179532743447110e+27 -1 +141 7.2686597054277501e+27 -4.6478026722792469e+33 8.5242883661170249e-02 -8.1029030260869865e+02 -2.1557280742849312e+29 -1.4604963319675283e+20 1 +142 -1.0389578001276582e+19 4.1677217899173175e+14 4.0006105322473958e+07 -4.8568178736006336e+17 3.5730491123002342e+34 5.0427586421652000e+13 1 +143 2.0117867686451456e+16 -8.0072221731827908e+23 3.3047510303561050e+14 1.2372377029949648e-01 -2.6453443449091540e+28 1.6355101045792926e+13 1 +144 1.3975874681203520e+17 3.8945447377711655e-02 2.5219990742957873e+02 5.4758670549043312e+09 3.7310918374106789e+05 7.9183049549975891e+10 -1 +145 2.3693379641240430e+08 2.3159792486954460e+09 -4.7471613793408766e+05 3.4283739666507705e+31 1.3729131485997198e+23 -1.9017925803514576e+16 -1 +146 -9.4621462921953680e+03 2.4291828232539202e+27 2.3768002628134682e+17 -1.1681119435542336e+17 -5.5673051297172161e+19 -7.9151640795519084e+23 -1 +147 -6.6884524262193280e+16 -1.5012598904657738e+14 -1.6400477107099145e+30 1.0312747348423235e+23 7.6403644922084628e+18 7.3221643879003450e+05 -1 +148 2.0891740183091668e+29 3.0292265748275608e+07 2.4395749069308701e+02 -9.6031822454623892e+26 -3.9658281561605574e+27 -2.3541505356857882e+05 -1 +149 9.7080344748131589e+24 -8.8808519378038270e+15 -1.4723551948469139e+03 3.2954396172554756e+04 1.5148080740526817e+26 3.6787715621033891e+28 -1 +150 4.3229632466070670e+28 8.9071708717356738e+31 6.1524759017292333e+19 -9.2189151963701172e+09 -2.6973008467432767e+31 3.6006463865961331e+34 -1 +151 -4.6693937280697036e+08 9.5627497091789974e-03 -1.6499339863408977e+30 2.5835618264035460e+00 -1.1982111754686523e+19 4.0689535066750073e+06 -1 +152 9.1653575538331970e-04 -1.6651354553774266e+16 9.5941510253903708e+00 6.8500341640363172e-03 1.8926969706753971e+27 9.2624729983747960e+15 -1 +153 -4.4212047069437672e+16 -1.6668607696649604e+30 -3.0541767570998245e+03 -2.8730654171949103e+11 -5.7007999819690611e-03 1.7046349607996369e+01 -1 +154 2.8637501632970482e-03 -1.1828241890807484e+21 4.5675871415916070e+15 1.2806332840895683e+20 -8.9724819496732102e+22 -1.1842979028543529e+18 1 +155 2.5539464486579454e+03 5.5536907259413290e+08 3.2217468917365298e+07 8.3835708294960307e+02 4.4868977739064606e+27 -1.4450238180780869e+12 1 +156 4.9502390547039155e+33 2.3915883963389363e+31 -2.0396643701486759e+34 -5.5314261730954156e+13 -4.5580103352923183e+25 -1.4736695417117682e+11 1 +157 -1.1194864756040173e+30 2.8039808350955136e+16 -1.7322843289026568e+16 -2.0348595958971433e+05 -3.7576034515235668e-01 -7.4082141359855821e+18 -1 +158 -9.3268526211069989e+08 1.8452534914435840e+11 9.9907119595660745e+28 -3.9916131487223201e+31 -4.1598616967131722e+08 -1.9068143813989498e+05 1 +159 -1.2041190279005395e+20 2.5455537651218613e+33 3.4005285665147355e+26 3.4741138647424086e+03 2.4876617686176204e+21 1.1731722181281550e+21 -1 +160 -9.2447544552854203e+27 4.5254833414552442e+33 -4.5675485491432184e+06 1.5806138415778885e+06 -6.0565515683287559e-03 -1.2081397743579570e+13 -1 +161 -1.2145231262513010e+05 8.9082375123439226e+27 -7.5795610200162581e+28 8.2238260253270359e+13 -6.9999672029206067e-03 -9.6302107678772220e+22 1 +162 -3.8978342923627518e+31 1.8851731001080463e+00 -5.5322315871433777e+11 1.0956232320498326e+20 -5.5347910193776345e+19 -1.7640302434328981e+24 -1 +163 8.9522515109146800e-02 -6.2909759301991797e+11 1.4923129798990960e+21 -5.1517858327679709e+05 2.3965299053776211e+25 1.9181066631488913e+19 1 +164 2.2921452566545940e+05 3.2321577266240677e+10 -3.6355933858623525e+29 8.5691105329519329e+22 -1.2472500836983772e+22 1.5836419348890709e+10 1 +165 -2.7545608535766052e+16 -2.1153269583325691e+04 3.5753592641394958e+11 1.3141604683301872e+08 1.2340270138981726e+07 -2.2089260252842371e-02 -1 +166 -3.6278790835768309e+28 8.6476261955905724e+32 -3.3353308976213280e+04 1.4968576543238067e+27 7.8413246117172586e+31 4.8041194736991634e+23 1 +167 -1.8127629304625562e+27 -9.9629045407801190e+30 -8.3913053687673784e+05 -1.7407698511693665e+15 4.0790087344518564e+12 8.0397882765968973e+31 1 +168 9.3122626104677128e+30 -2.0191309404716813e-02 8.4012168239537623e+23 2.6907005388755537e+27 -2.6415824455736703e-01 -1.0154763355812421e+08 1 +169 -3.1862248579168246e+27 -1.1452695549510519e+34 1.9937352394083264e-03 1.4548624928866178e+02 -3.7074978551482369e+28 -1.4541814643396219e+29 1 +170 4.0246798582963526e-04 -1.2921419815549299e-03 4.7711415509108318e+24 4.8058878933908898e+04 7.5787359956097872e+16 1.1154163987984626e+21 1 +171 1.6753043016450996e+09 2.7404068499440790e+17 -1.2514437328765133e+34 -1.5531407568066582e+12 -3.1619438436159929e+29 -2.7323833148361084e+10 1 +172 1.0369378126673107e+30 1.7109361189408312e+24 7.2029210087709381e+26 -4.6106339456264834e+01 -1.2548990336695949e+07 -7.6982180076051216e+09 -1 +173 1.7793426133898234e+34 7.5347537648659577e+34 -6.1378486757798500e-03 -4.7874237537791012e+23 -1.4687811836159254e-01 7.0787994308436388e+30 -1 +174 -9.3326855517160873e+10 -9.0751212500641494e+33 -1.6252872929253133e+33 7.1914405991539969e+28 -1.6109112757870623e+08 -8.2253411752614769e+27 -1 +175 -3.8387124872460760e+15 -1.1003369508959680e+15 -1.0422719274507669e+10 -3.0025803449880220e-02 1.3406533238274843e+07 2.8204075687350875e+14 1 +176 1.3122750410646739e+05 -2.2936743522519448e+08 -4.1468505505965177e+32 1.2013371047580440e-01 2.7712648851832674e+23 -1.0711867460139592e-03 -1 +177 -1.4901522637563979e+34 7.6195571530869991e+07 2.4015289579947610e+22 -4.6118349653653141e+01 1.3919043108732804e+34 -5.4262916257461494e+19 -1 +178 -1.5308419627600098e+08 1.3476839556372156e+11 6.2325863327508932e+05 1.9104849030607183e+18 2.7771942874248708e+20 -2.2029018024624845e+18 -1 +179 -2.9414068933048815e+30 5.5197339768002822e+12 -2.2922947731233284e+25 6.7755759598051371e-04 5.5655589038520732e+29 -1.3093644130864404e-02 1 +180 3.3942417222407856e+10 -2.9765573913726241e+25 6.4857801970350208e+16 -2.8239943080866992e+11 -6.0690001892795157e+21 -1.6234128927901816e+04 1 +181 2.7700340454769616e+01 6.6895402143742400e+15 -5.4638821110348880e-02 -4.9958109771342754e+07 -4.8518028613794332e+27 4.1899825988727626e+23 -1 +182 5.7751420694550026e-02 2.2341275881551300e+10 -2.9432665033550078e+22 -2.6261644991802807e-03 9.6294316926196384e+29 -1.4935977142076904e+10 1 +183 -1.2299762094653297e+19 -7.7879965212414675e+22 2.0114969757743424e+30 -1.2577273482988016e-01 1.7699254534364180e+21 2.7512971035194442e-02 1 +184 -5.9658878308790120e-01 5.4496232193159360e+15 -5.0617898990336460e+08 2.3772245480599319e+20 2.1386686054448456e+07 1.7287315043619064e+24 -1 +185 4.2471124166082294e+05 -2.9194740102848672e+12 -5.1742236778825959e-03 -1.4241301583586511e+32 9.0316425051059866e+02 -8.2906782826287417e+02 -1 +186 3.9048638864288563e+00 -3.1666770695566732e+28 2.1423586595297755e+19 -2.8375870256029737e-03 3.9366216706968456e+21 3.3312967690925344e+22 -1 +187 2.0462345897525315e+18 8.5202714041048286e+28 -5.4737685747492291e-04 6.3077552283533677e+24 1.0213087675695848e+10 -3.8096539469827707e+18 1 +188 1.8618482056612954e+08 1.7700949797979754e+20 -3.0996196589081641e+18 1.0866964781781869e+27 -1.6853564872524357e+13 1.5386118990192199e+00 1 +189 1.6918918827319367e+03 -3.0387823424465780e+04 3.8617251499849250e+13 -6.1649078115506780e+18 2.3476534888188863e+09 -1.1742235393269600e+21 -1 +190 6.4616331970448868e+10 3.5282340934650393e+21 1.4635232843090638e+15 8.5575918712705120e+15 -4.1740590652413440e+17 1.9748859699167022e+20 -1 +191 -5.7872948911966397e+32 8.5422740450296914e+18 -1.4388808842141890e+15 5.8903515710291378e+32 2.2154804685684544e+05 -6.4345655485352274e+26 -1 +192 -2.5901175594133417e+18 -8.5121147777558092e+26 -4.8533200777372698e-01 3.9001298366480431e+14 1.8270436273887259e+32 1.8421406876381352e-01 -1 +193 -1.5432657521857113e+29 6.0620731995394155e+31 7.0309153810610212e+02 2.7618203693484045e+20 9.3324765310124000e+24 -4.0960961545454089e-02 1 +194 -1.5051033865380909e-02 2.8345602704638943e+07 2.5444465844220760e+26 7.1664564356913162e+10 4.2121933860383927e+31 -8.5836828250067251e+17 -1 +195 -6.7411491420734941e+12 3.6668337744526630e-03 -2.0561630560510364e+21 9.1533794943358470e+05 5.5294828992982500e+13 -8.4736824818352416e+20 1 +196 2.9350162188885878e+20 8.6148526060745209e+26 7.7642776195618819e+31 9.6055870738200877e-03 -5.8384015751457114e+17 9.9891104541843849e+20 -1 +197 -1.2977475976315051e+07 2.8631793643177114e+07 -2.3734330827933506e+14 -5.9640592248503848e+22 -2.7067068286109859e-03 -1.8557783229981976e+24 1 +198 -1.1420039312960263e+23 6.5246175397117874e+10 9.3864080306162805e+11 -1.1601650049269535e+07 -2.6166742051706215e+22 -8.0224535125120117e+10 -1 +199 -4.0458694240669206e+02 7.8746944204295619e+33 -7.4190985601082930e+03 2.9936358991313988e+04 -1.0585294895248543e+22 3.3514808390642330e+05 -1 +200 -3.8727953272518780e+00 -2.2499101932645794e+06 -1.0474268849045171e+11 1.4027524145501593e+04 2.9074193355394407e-01 -4.4628773508142334e+21 1 +201 -3.2851294707739815e+10 6.0556585681913508e+30 5.8276455856621033e+05 -6.3179462910723200e-04 4.7893083187565526e+33 7.4247521765981834e+32 1 +202 -1.7132965061999286e+28 -1.5592542466096631e+12 4.2209857181806945e+18 1.1925579874661034e+28 4.3314895792787996e+02 -7.2166234823993518e+03 -1 +203 9.6502426666589701e+24 2.5856113857562073e+11 2.3548111895054645e-02 4.9608501874774609e+09 -8.8824143002810929e+28 7.9995728480553579e+24 -1 +204 -6.1588679947671751e+29 6.2416863126764755e+09 1.2930898300194661e+28 -4.6503507169326445e+33 2.8548660523084595e+17 1.0472327794750229e+17 1 +205 1.5296306425928509e-02 4.4929104300527708e+29 -8.1294919797608852e+06 -7.3164564648484898e+08 1.7017375030789776e+00 3.5366334814587312e+33 -1 +206 -1.1031978755872492e+28 1.0176288946185564e+22 -6.4894842916155520e+15 -4.0577408482794916e+11 -1.4087950271604511e+30 6.3196159959710472e+22 -1 +207 -2.0453141894314305e+06 6.0883412073971680e+05 -2.3669981019231349e+25 -1.4449057682441712e+34 1.5637490633308651e+00 1.5818375693556108e+20 -1 +208 5.7212844990479127e+01 -1.8540018284906500e+24 -1.2322575366006669e+08 -7.2379778763226886e+30 -3.0229532015124150e+15 -1.0782998069585313e+23 -1 +209 -2.4795351600110867e+11 4.6821899125320855e+24 -1.8590084552697744e+12 1.1247032466639471e+08 3.6689863490492660e+15 1.1704595002366201e+12 1 +210 -2.0813492706195308e+12 1.4177040864241719e+06 4.2385987214159448e+23 1.7026840807978721e+29 -1.0608133915753881e+30 -2.8635101257528411e+04 1 +211 -9.5824889798229218e-01 5.2311834629147375e+08 -4.5419976688611525e+20 -1.6315511659374108e+16 4.7009354891621252e-02 3.7349702756626595e+30 -1 +212 5.2476450956581694e+33 -2.4810223051413815e+05 2.8584903262382423e-02 2.4097441248433209e-02 7.2814939679826558e-03 -1.7926924492168130e+01 1 +213 3.3666141070852765e+24 7.6897423930287669e-03 -9.2735501217019475e+14 -4.8071857553123097e+24 6.3915994761939943e+19 -1.2517685190157482e+31 1 +214 -9.7788664398254643e+17 3.2022750476733862e+17 1.5104529651760824e+01 1.2721141437883341e-03 -6.9282469856380854e+19 4.5609251708146570e+18 -1 +215 -3.4548561347423910e+34 7.1400815238297367e+21 1.3120130332280642e+03 1.3276053309597941e+13 -4.1890967893140124e+33 -1.9613890845907676e+12 -1 +216 1.4731047380870790e-02 -3.6142759906151924e+19 -4.3872902010687062e+29 -1.0797247002473923e+20 -2.4772797608935860e+32 7.4217576076138982e+23 -1 +217 -1.4189914293808364e+04 1.1812101947918840e+07 7.6069707729447718e-03 6.5787032091164633e+01 -3.1516532587654572e+10 2.1770651622859077e+02 -1 +218 -2.4915376386094485e+23 2.3130200939218338e+10 -1.0199246887106736e+02 -1.3250507657933151e+04 1.9750191239020409e+04 4.3828020029176696e+23 1 +219 -7.6276606410973867e+12 -1.0298914442590366e+30 9.3369801898829062e+13 2.7721447879806571e-03 -1.1240463098610235e+02 4.4441837670677598e+12 1 +220 4.5597872238506204e-04 -9.5474479541882100e+22 2.7763037864564072e-01 -5.2937603838155448e+07 4.6885685796277548e+33 5.3013608078165594e+14 -1 +221 1.0253430925551131e+14 2.5884468166163181e+17 -8.2495526663368830e+04 1.5231644202224024e+34 -4.9307779481146435e+33 2.2725085488784947e+02 1 +222 2.4957837388322284e+14 7.0983773842483409e+32 -3.5714982582804670e+33 3.1181330683270633e+07 8.2940178852201922e+29 1.1635122712401926e+21 1 +223 1.4900406577276356e+33 -1.7444343516629162e+13 6.0974841222886800e+14 -1.8898272901421156e-01 -3.5100433968912793e+12 -1.2799997601142642e+28 1 +224 -3.8858042231487208e+16 -5.3461389013870898e+12 1.4970713303574641e+24 4.6371014231331018e+27 3.6011760824669213e+31 1.9303485092503864e+31 -1 +225 -4.3250474067552452e+31 2.1403216033376401e+33 -4.4717220126464234e+13 -2.9263872460507791e+29 5.7627067578494774e+22 -2.5167241050892705e+34 -1 +226 -8.0850881518514646e+29 1.7683538823164813e+31 -1.6664021678305785e+26 -3.2766033028282777e+00 -8.2669596755104848e+00 -5.2390149819227199e+28 -1 +227 -1.8806279921123380e+15 -3.4646462171205788e+10 -6.4506222419779592e+21 5.0735286751139950e-03 -1.7208554835095036e-03 2.6525555432182674e+24 -1 +228 8.9696622734166124e+02 6.9049966239219312e+16 4.4373026540894170e+15 -6.6882928778345208e-01 -7.9072134987613068e+09 5.0757815285457730e+22 1 +229 -4.4605868469905160e+07 4.7624079816608082e+20 -2.5299391905413696e+10 -2.0212828092167816e+16 -2.5115171737740044e+29 3.5210834311045070e+21 -1 +230 -5.8488529128968509e-03 -4.0949719324308576e+16 3.4533669114305574e+13 3.4953542662378501e-01 -9.6182766202620000e+14 2.3537789193100821e+01 1 +231 1.0260356673482928e+27 2.8573364543261903e+31 9.3915314254496221e+24 -3.2392660614673871e+08 -9.1392110227822593e+22 -2.6392256567226736e+23 -1 +232 -2.6182738206605963e+28 -1.9827988311384475e+08 -1.3282720559226827e+28 -6.8623583619544126e-01 -6.6914320372346520e+07 4.7690736322957655e+32 1 +233 1.2930400078187599e+28 4.2352842578265786e+33 7.5792776257647107e+21 -2.4143306060742198e-01 -4.2291696220180281e+24 3.5239607654949054e+01 -1 +234 -1.6327994852637137e+13 -7.1376184250466368e-01 6.9660491279196387e+11 4.0227451080853268e+02 4.3663140527845618e+32 -9.2398797353157846e+01 -1 +235 -4.2199676657056198e-03 2.0379715564435860e+28 3.3217940216165344e+13 -7.7305866602594122e+00 -5.8840328820336123e-02 -1.7295357157852082e+05 -1 +236 -8.0027885995318671e+05 -6.2225471525120172e+13 5.6163608400981789e+09 -5.4101890639910305e-02 1.8118883514817322e+34 -2.5996853108006695e+23 -1 +237 4.9406554747810562e+26 2.9488020302463750e+12 -1.4893917466624181e+31 4.7357897038295838e+23 -6.7209340004038070e+27 1.3761508213891772e+34 -1 +238 -5.5009678872203824e+30 2.4927379590642812e+29 2.7721595737697397e+23 -4.1178543320934494e+10 8.9309312857585352e+11 -2.9639744221838944e+04 -1 +239 -1.1108875736609378e-01 -5.3206022179012597e+08 -3.0607104508701917e+24 2.3264592555189417e+20 1.0236367617373707e-02 -1.1855400585651620e+34 1 +240 1.0940074981299980e+24 3.9540151655665816e+28 1.4536134267423683e+31 -3.1017347401230626e+34 -9.6888930211294107e+06 3.8195205454859093e+31 1 +241 -4.8014288961929843e+07 -1.2317735736208163e+29 -1.9986354780197925e+14 -5.4024127539792375e+13 -5.6319706998826074e+12 -1.8785263242984854e+22 -1 +242 -4.0058401217248924e+06 1.3625011939218571e+07 -4.4185016790501287e+23 -8.1801535886654401e+03 3.0473338762403656e+11 -1.4679848818758979e+20 1 +243 -3.8735997398319142e+32 -8.0448330027094167e+30 -1.8053863807477659e+22 -1.7309519858600064e+30 -1.3693066932577582e+05 2.1315939607683188e+23 1 +244 1.9746947014812896e+09 -4.1436671135018999e-01 9.7052961144204083e+17 2.0347924030954961e-01 -7.1218247486655859e+11 -1.6624191805790093e+09 -1 +245 -1.3581464309299803e+08 3.2062858479930895e+18 -6.4853914749738138e+17 9.3820712554065039e+11 -2.6894547582857489e+27 3.4539830717958933e+24 -1 +246 -2.6329842351094667e+32 3.4272207252404285e+18 -5.9311203603963693e+32 -6.6730634288596899e+28 -5.0338301233553935e+22 6.8796314731081826e-03 1 +247 -6.3407178836068198e+17 -6.2966759694496643e+10 8.0075698952543220e+15 -1.8352476645831644e+01 -3.6038018451588375e+15 1.6340979014782241e+07 1 +248 -1.4509376239342039e+32 -3.9999140723969276e+21 -4.9542692039119721e+22 -7.6302818034636289e+01 -2.2888216833437488e+21 -2.4516113683473122e+02 -1 +249 9.9793881489110227e+24 9.2987410024815944e+31 -2.5714326297848263e+09 -1.0357029278101904e+31 -5.1322180255051141e+13 -1.0938006388726250e+12 -1 +250 1.9989612148992587e+11 5.9894275643705566e+10 -1.2940003485843482e+18 -1.2014235527721368e+20 -3.6246728096198668e+06 -5.5598309936840461e+17 1 +251 -6.2759483546145713e+28 1.8033991495445316e+20 -1.7124775287132110e+27 -1.7132894797058463e+25 1.0271939976667052e-01 -3.4593047377834005e+22 1 +252 -7.3158692216987066e+31 -1.2669736914449916e+29 -1.6170761692116541e+19 -3.2479994070080430e+19 5.9871349058069536e+04 4.1645001403715493e+26 1 +253 -1.2472667442693862e+32 -6.1904649273527377e-03 -1.6940163936726212e-02 -9.9811258034001927e+30 -1.4194716769223038e+26 -7.2977777929823625e+19 1 +254 -7.1115388932373740e+28 8.1559277986117632e+16 2.3325718659633983e+24 5.0417929547178443e+29 -4.8465932462105626e+05 -4.4973579384899609e+11 -1 +255 -5.6762099633766758e+12 4.4538072558306120e+15 4.2110091745513333e+30 -1.4027534363807751e+11 2.4440252259898820e+01 -4.0491871630069699e+09 -1 +256 2.7719201999694719e+09 -1.6505810109607798e+16 5.4661272938545807e-03 1.1111026546222458e+20 5.0847638620683792e+16 -3.2888022529063756e+29 1 +257 6.1080193278241829e+23 7.0376944853330676e+27 -1.3902330725985740e-01 -6.1664778222039871e+09 -2.6338763874738795e+08 -9.0212355735920020e+15 1 +258 -2.8425443435871338e+20 -7.0140007956510985e+01 3.2119118424419612e+23 3.6867851368235832e+18 9.1956353218744202e+09 -5.2133225916653738e+20 -1 +259 3.1694344879072867e+32 3.7399234781581400e+14 1.2165448889965069e-02 1.0322372291854398e+06 -9.8998963867406928e+23 -2.5556127165897422e+12 1 +260 2.1401090720326587e+12 8.1911839702823556e+02 -5.8071068689839750e+14 1.2444210584034733e+14 -2.2823189483922887e+13 5.0068671311945305e+23 -1 +261 -1.4706997860301619e+14 -3.5719250781552476e+18 1.1301552095898870e+29 -2.8509062480671226e+01 3.0457150022733789e+12 7.5780644434587157e+02 1 +262 3.8798310730787451e+32 -2.3652294644178440e+01 9.8620749963612278e+31 -2.5444515158227147e+25 9.0755505216192109e+12 3.6510332971874619e+24 -1 +263 5.4124085367680780e+27 -2.2694956004862728e+04 -1.1093181097671742e+20 -7.9040893760668076e+30 -3.0281666654694740e+15 -3.2309134502360844e+22 -1 +264 -1.4581308499069844e+12 -5.0591539512799158e+29 1.6736045525885606e+02 8.5428523163234955e+10 -8.8380049059617377e+03 2.0233727592276310e+17 1 +265 -2.9239911090880000e+17 -2.7283027861545769e-03 3.1920260773608665e+09 1.9732578501203645e+05 -2.6058221164229952e+31 -4.5263048369614488e+19 -1 +266 -7.9302363570873573e+07 -1.5688850598878043e+28 -4.2476985037469460e+30 -4.7314511912081213e+34 -9.7255188394573021e+19 -1.9224661674200401e+06 -1 +267 -2.2678214541960110e+30 -5.0913224026080301e+04 -4.0330877461021994e+06 8.8275588400916256e+23 8.2387302813168972e-02 -7.1433858636473840e+15 -1 +268 -6.3893904713377579e+19 1.9775360203256682e+02 1.6785871626813269e+28 -1.5042601169271037e+07 -6.8285996346363972e+03 -1.0062422141936404e+12 -1 +269 3.6302791779635940e+27 -1.0053361721581712e+26 1.7917548344430228e+14 -2.9481794317317562e+33 2.0020316782688674e-01 4.4525091252631121e+01 -1 +270 3.2573851373662569e+32 1.0012650448184336e+16 8.8872526123133972e+07 -8.3252851438063534e+18 2.8924686237370734e+29 -4.4666383209185864e+04 -1 +271 -2.3580105510208547e+01 2.2066395775747816e-02 1.0432442236172489e-03 1.2108570851120947e+04 -7.2709496317345850e+14 4.9732683949429352e+10 1 +272 8.0111607075487940e+28 -3.2277723458393039e+25 -3.3114304533073714e+30 -5.9732404544353337e+19 -2.6573607108464767e+10 3.9239153886224274e+28 -1 +273 3.6516829437247669e-02 3.5207258655282618e+17 -1.3660512541671347e+17 -2.8348167819447040e+18 1.9159368053547497e+31 -8.0543408688285644e+31 1 +274 -3.5797375670263776e+31 1.2995296031523004e+07 -6.5013934120389898e+18 2.1464281712582385e+18 4.5694834050424675e-04 -1.2001153521346935e+29 -1 +275 -1.2144928367053322e+23 3.5380809114135632e+28 2.3285076509450647e+14 -3.3468575745310081e-01 1.3259145345760137e+12 -4.1156376897818744e+04 -1 +276 -6.2657879467356540e+31 1.0018635556750148e+24 -1.4383556625011597e+12 5.1798912851722806e-04 5.1574345118756547e+01 9.5983682131439330e-01 1 +277 -1.7665982041313960e+25 -2.8861585546918943e+20 1.2061818522663716e+30 -2.9951557784939963e+08 -1.0033237835948037e+31 1.7452076017826892e+29 1 +278 -8.7987690908164030e+20 1.6526039268492395e+05 3.7182538995630866e+19 3.3707837128978695e+32 8.0322066522326807e+11 1.8614304803173535e+27 -1 +279 2.0830245901256913e+32 -3.2234400866214258e+34 -2.0048989997399803e+06 1.6569767342862362e+10 -7.2829537635730484e+13 6.9766045621526500e+03 1 +280 -4.4186915679497280e+27 1.0825384314314192e+01 -1.0632938194177182e+03 -1.6613401537552280e-02 -5.2815939690273794e+04 -5.4773031944599893e+02 -1 +281 2.1692135382494998e+15 -5.6092831054914543e+26 -4.3863166578188519e+27 1.3196316014235986e-03 3.8790829036193974e-01 -3.3006760835501036e+25 -1 +282 6.4851161721913516e+12 1.2968489067898910e+08 -2.9200721822489297e+19 -5.7061052445960859e+13 -1.0939737160798047e+27 1.9171916193778038e+01 -1 +283 1.4195316162002702e+20 -1.3511948692288569e+32 5.1781680383461361e-04 -5.4137401320132306e+11 -5.7958411289574076e+30 1.8256670408755074e+28 1 +284 -1.1137832642059717e+21 -5.5014752603408917e+27 4.3828687993995752e+05 -3.8766798917115045e+25 -4.8763527849420299e+01 9.4420687377621212e+14 1 +285 6.0203542663072143e+05 4.8966721015290058e+08 -2.6933830509686237e+02 -1.7324905004499049e+05 -4.6567957436765544e+07 -1.5748713207501275e+30 1 +286 -2.0321603533672845e+23 -1.9459420374470448e+08 -5.1334180870380402e+07 -8.8082876251697851e+27 -3.1583337419166083e+09 2.0769309955241997e+32 1 +287 1.1040304481022200e+15 1.9835812999864517e+20 -8.6058381231155315e+19 2.1976504921705254e+27 3.9821383021843044e+31 1.4632313906148010e+34 -1 +288 -1.9104506451954786e+25 -4.9627290094134830e+15 -1.2147920120397072e+29 -1.0382170640793171e+30 -4.4054252852981361e+28 3.2514166390697660e+21 -1 +289 -1.7065571501073900e+03 3.4728085527803990e+29 2.8034842628078321e+33 2.5577926315386835e-03 -4.6685389891495250e+13 -2.1570446449142798e+28 -1 +290 -1.8797046730788144e+25 1.0518607530866255e+15 2.1719731018020728e+05 5.8311964843838080e+17 1.1665180190406320e+20 -1.2038051904102211e+30 -1 +291 5.6528641631324789e-02 4.3718641868252905e-01 6.4697750236521439e+04 -2.1353688046501079e+08 -5.6403740548624369e+27 -1.1955869426354562e+34 -1 +292 -2.8971772758202241e+19 -3.6004986348745762e+24 2.7841101122297760e+15 -9.8655859073925825e+19 -1.0368016467445100e+14 -1.4644699859234726e+26 -1 +293 -7.1208181302614394e+04 -2.0848184725487384e+25 5.1023445880380144e-02 2.0675579135229049e+05 4.0528347311245972e+11 -9.4582828382416920e+15 -1 +294 -5.5828030466032640e+15 2.5605599601229536e+16 1.8696995415221476e-01 -1.6008406546577219e+27 -3.3824311813776177e+01 5.6770685485583685e+32 1 +295 -2.1360308943993950e+15 -2.9951734987766850e+14 -1.3924981456364101e+24 -8.3410025211545780e+21 1.9836483506762122e+23 2.1940555954518822e+26 -1 +296 -4.4629793564123760e+15 1.1887127674428216e+25 -2.1648990216372480e+15 -9.8018992157851102e+01 5.3215956493415760e+32 -5.2167270221934618e+20 1 +297 2.7948935869177580e+27 -3.8278173654604843e+10 -6.0694166036946699e+06 9.4514346599640512e+16 -3.8991350673310309e+28 -5.9967425811560006e+21 1 +298 -2.4191838137850213e+25 5.2933518489227627e-01 1.5004828486342435e+06 -6.3264789157773849e+20 8.4808990947203194e+30 -1.3841815585439305e+20 1 +299 1.1627789873004848e-02 -8.3416939485994601e-03 -1.8143654422180042e+01 4.0068638219373580e+15 -4.1079044734577547e-03 -2.6419139110848376e+23 1 +300 -1.2232150796578800e+16 3.7380947445192115e+17 3.3132092863583908e+09 5.3583871093991453e+20 -1.8838367359359400e+14 -6.9877379863034060e+15 -1 +301 1.0333294902790528e+06 -1.5683469100945801e+19 3.0947581237204654e+18 -3.5002497184388487e+33 -8.0813914447858560e-04 1.7931435736767084e+33 1 +302 -1.9155584893672358e+17 1.9677356035394171e+34 -6.2860869879321901e+04 3.7396644286947248e+03 -8.3501695713901780e-01 1.9693483823317677e+26 1 +303 -3.3966422908347084e+30 -1.6544388898377628e+09 1.4234759791652488e+27 -7.0075193385251100e+02 1.9226677205020769e+14 -9.4777734439504830e+33 -1 +304 -2.4135693420837981e+02 -2.6380062107761772e+24 -5.6975688583142909e+32 -4.1502999202637512e+11 -5.1191846462353755e+23 6.0763429774539986e-05 -1 +305 8.8823799642341859e+24 -1.2299520405326491e+22 -4.2797305574887059e+27 2.3085548357325347e+00 3.0283118081350945e+23 -4.5715248459051752e+08 -1 +306 -8.5905618884480154e+17 -1.5835429080372841e+10 -1.7988223204008556e+34 7.3367141713587642e+06 -8.3765385923822123e+01 7.7716763462114754e+28 -1 +307 1.8130582282254007e+27 -9.6439651508023486e+11 -2.0169144286027689e+11 5.6816777270016049e+04 -1.6756911209171151e+03 1.2104363801975155e+15 -1 +308 -1.5316681494142207e+34 -1.1818073491556269e+34 -3.0397622606517455e+29 1.5782581409107821e+24 3.8874919212007960e+15 1.1948042783819375e+28 -1 +309 2.6557777042184825e+15 -1.4555326714194244e+19 -6.6034152504579897e+03 1.5175251594699339e+03 -5.8366286352107281e+21 1.1225359268374335e+00 1 +310 -3.4381354423206211e+28 8.4974030789081473e+04 2.0365312826343518e+15 2.8463516841764290e+33 -6.3537672322658416e+29 -6.3786333003946392e+34 -1 +311 -1.4781832459079786e+29 -3.1721787847497549e+30 -1.9443567484210769e+34 1.6296407225208289e+06 -4.0084517392107031e+11 4.4723387513258308e+02 -1 +312 6.6935395090336304e+09 -1.1657540785161978e+17 -1.2760637384911144e+27 -3.7624544714947480e+33 7.6156818382019225e+00 -2.2683099974308475e+15 -1 +313 -7.6250098460306233e+28 -8.0787805969088711e+12 -7.1315214643751096e+02 3.7317677104462311e+06 4.4089137486363733e+11 -9.5168866799965486e+30 -1 +314 1.5874964453887273e+31 -6.7986365722670660e+15 1.2599076238285305e+34 -1.8938898839497976e+06 8.9920991693876540e+15 -1.8166099152485020e+28 -1 +315 2.5744679966521704e+30 -4.0464198542941944e+01 -1.0351620806410223e+18 -2.6240452847325099e+21 6.4152468715369537e+01 2.7445664230140401e+06 -1 +316 3.9094082086887470e+18 1.0116607702664965e+01 -2.0942679074145341e+24 6.4553760067701958e+04 -3.3051207424264128e+17 -8.4683039736056409e+05 1 +317 7.6189663934329417e+02 -2.5131770642299172e+30 3.9401972457448844e+24 3.8855236862426950e+15 3.1783767112508997e+11 -3.2093410910618452e+19 1 +318 3.9706413801391771e-04 -1.9663708062266916e-03 3.9602767908769056e+22 -2.2820698901233667e+11 6.8730252080808163e+07 -1.6835739848367876e+25 -1 +319 -1.3644981480801619e+17 2.1436293190701600e+14 6.2510102534760910e+25 -8.4003740071126950e+08 9.7355434367687619e+29 3.6086538324710403e+30 1 +320 -5.0809756386482438e+13 -2.8488235925769206e+21 5.6466175826034153e+21 -3.0932105876935612e+34 1.9872470288343184e+21 -6.9219552582973896e-04 1 +321 6.3310508495018067e+24 -9.9733417890180158e+05 -6.7515458014167392e+16 -9.7923538655533697e+32 2.4647016333225447e-01 -4.3678518894252996e+05 -1 +322 7.1609271583612637e+26 2.0877669343197231e+14 -2.7439898156599533e+23 -2.4634571644327161e+03 9.5407331527615334e+17 -1.4495007321680183e+19 1 +323 1.0987929298032021e+07 1.5084609518793999e+12 1.1142960201815191e+04 9.8182068856222477e+17 4.7943899615145790e+02 7.5573408001848419e-01 1 +324 7.6429037353323552e+33 1.3323009681190492e+03 1.0922570822084301e+33 -6.4842822631908552e+04 -1.3931416715999399e+29 -8.4078507243973466e+17 1 +325 2.9988701236759240e+29 -4.3862897650174784e+31 1.1143366672271055e+25 8.6602397701816770e+31 -2.0995511026472461e+12 -4.6597289670610082e+25 1 +326 -1.4887410781210808e+03 -3.3241214200318800e+14 -5.7760549848637002e+21 1.0913752277178762e+27 1.2166689636825504e+24 -2.7203921781102792e+20 -1 +327 6.9198836822753452e+19 8.4136622049390329e+24 1.3956933675024734e+28 2.8112258298197503e+01 1.2851581331700016e+01 -6.4406898376432571e+02 -1 +328 8.5441273563910540e+29 -1.0080199125980036e+16 3.4199712965481833e+05 9.2415870600488555e+12 1.2220973784936323e+33 -6.1359023236492253e+28 1 +329 -3.6603249880986724e+28 -8.8828864956535680e+16 -7.5394559600390005e+08 -2.8590023404002942e+07 -4.0084579763174139e-01 -5.5816513837183748e-03 1 +330 5.4755592901101005e+22 7.1966801189693174e+31 -1.0017549072151717e+33 -4.1447540932657407e+00 -2.3705748451786448e+02 7.8838037291058511e+33 -1 +331 2.6551938452334847e+14 -3.7968934922934616e+33 7.8226006949524900e+31 -6.1917418317690719e+13 1.0270285933516820e+15 6.0946235579750939e+22 1 +332 -1.6870942442699909e+07 -3.5472045632239089e-04 1.3685653111973404e+26 2.6762329863333521e+11 -1.1791891018658678e+26 3.8612357411031667e+01 1 +333 -1.0369272157042632e+16 4.4165705168504086e+29 -5.7080452187768523e+25 -3.5383032273137570e+34 7.2920658481873846e-02 -1.7158056464168247e+31 1 +334 -3.7857308356730888e+16 -2.4437100921776362e+14 2.0249814233215056e+31 2.2480051887580967e+08 -3.8865462747783189e+09 1.8607476828134861e+30 1 +335 -1.0853869285043506e+11 7.6912510140632648e+09 -4.3602372058676384e+17 1.3579196908641612e+33 -1.0091552063324259e+03 -6.6394670081655206e+06 -1 +336 -2.3022494611732215e+06 -5.7051860671618466e+27 1.1697212899542434e+30 -3.5371474484446092e+25 -5.2299934856140790e-02 3.3809062097558144e+17 1 +337 7.1087877166147813e+27 6.6714043192581534e+06 -4.7061288719468079e+09 2.8172298574037553e+33 4.4398442849237055e+07 -2.2040423828299560e+15 1 +338 -3.0796520676880223e+06 1.8710800077904006e+28 -2.1626132809204190e+28 1.1641706959773242e-02 -6.0567936976029544e+23 -2.1073105849220371e+17 1 +339 7.4908638600449219e+09 7.7377346348681075e+28 8.8961045122392350e+23 -1.5371870956998080e+16 -1.7640420299456752e+05 -8.2869316254155114e+28 -1 +340 5.1115218571431363e+18 -2.8270505538245028e+25 4.9277729660099933e+33 2.1025299430504623e+08 -3.0711278867287664e+16 -5.8391003539473033e+01 1 +341 2.0155694962363825e+15 -2.0038291945838810e+03 1.2162897885120229e+30 -1.0787258954271871e+26 7.2740126115387738e+27 2.2624140658582858e+05 1 +342 -2.1351831505547085e+09 -1.0310862644459972e+15 4.7403035294463501e+10 -3.7145876173386227e+24 3.6560976724092506e+17 2.0438174212392126e-03 1 +343 8.0664336325029018e+17 5.1865131827702426e+05 -6.9320978047059501e+19 -5.8300708803819888e+32 -8.0380778847201799e+22 2.1029171528948090e+11 -1 +344 7.0152696577741314e+27 -7.4283657028912441e+20 -1.4157788753715699e-04 3.5829134883922005e+08 -2.6405524258171880e+15 1.2369376901837912e+16 -1 +345 -5.0799426030706917e+05 -1.1888200836482538e-04 -1.0100242928385007e+08 1.0158505939534676e+08 2.7235404397964330e+03 -8.2379407627628136e+09 1 +346 -2.8672381565567267e+25 -8.0078797160930817e+03 3.5698844750316154e+23 3.1355887592016000e+14 1.6259858911818031e+21 -5.2697565783851128e+05 -1 +347 -5.6750767377947225e+23 -1.8327777360033926e+12 -6.5820895432095649e+03 5.7468958154358630e+17 -2.6503089014606428e+25 1.0244420771991838e+30 1 +348 1.2815760324024881e+31 -2.4089262109871955e-02 1.4715221722802694e+01 -2.9338236892293379e+12 3.5933444957632913e+19 -2.1282080416324867e+00 -1 +349 5.0365057452093971e+08 -1.9795679044893906e+00 1.4677697135130133e+23 -1.3214392962464708e+10 -5.8540109320915094e+27 -5.0503701259991640e-04 -1 +350 1.8837017871157099e+07 1.7488083202174697e+06 -4.4022857917420674e+23 4.3937599459487854e+10 -8.0004482241337448e+10 -1.5119702558180129e+31 1 +351 3.7830363782188886e+20 2.3693304964679751e+12 -2.9581487270807400e+14 -7.7222424601692300e+26 1.2491174873951159e+29 6.0709667744940701e+00 1 +352 1.0814652466365936e+10 3.5698781384068979e+30 -1.0143862185404958e+17 -1.0628077432695031e+14 -1.0874600405801402e+01 4.7216648945255174e+03 1 +353 1.7932807304713002e-03 -1.4857607272162705e+13 5.6399923276609823e-02 -4.0930604340944782e+07 -8.3498631471502874e+05 -5.3791158983041882e+11 1 +354 -1.6237239993936431e+12 7.5925486816358796e+31 3.1353872268286123e+29 2.4673806445985067e+30 -8.5630273395583406e-03 1.1589691445391421e+26 -1 +355 -1.6421662138321675e+00 -6.5575301716942064e-03 7.8415178801119364e+22 1.3294592749544056e+10 -4.1411995030544014e-04 8.1989594772266783e+06 1 +356 -2.5923465336604004e+20 1.7129019070850343e+32 -4.1313459231739552e+22 -2.0251915003015856e+21 -2.4485707935558909e+26 -1.1355059770547131e+06 -1 +357 1.0714651543034373e-02 -3.1863062692277719e+27 5.7833103600801739e-03 -7.5549313354162583e+22 -1.5020098399990655e+02 -4.6002692242524672e+16 1 +358 -1.3645124340298785e+20 -2.9789523171085781e-04 -1.5587719360929661e+32 3.8657904874522109e+22 9.0177838330185608e+10 2.4562128965456133e+28 -1 +359 -3.3595820113640137e+12 -5.9462584448313522e+09 -4.5520944034426678e+30 3.3153445239503863e+13 -2.2397836301388113e+32 5.1965421216809372e+32 -1 +360 -2.2956224641819179e+08 7.3443228613697523e+06 -3.4108271387280008e+13 2.6401651146926648e+04 7.1023505039552506e+28 7.9241073741049251e+00 1 +361 1.9688408978211769e+10 -1.4780020374187306e+26 1.1182718226799808e+27 -3.4071669693740773e+01 -2.0577241705402816e-02 3.1137554947283067e+18 1 +362 -7.5617559040768223e-02 -2.1027568716223560e-01 -4.0887147053695775e+26 3.8421807674757843e+10 4.5798950057742535e+04 -2.2064539411236965e+06 1 +363 -3.7659053821275048e+06 2.3934057764079523e+25 -3.6514820940330848e+06 -2.1466031845215354e+32 7.3046149632922000e+14 7.9004307220342541e+27 1 +364 9.0422880693189628e+21 -6.8838620592118794e+04 1.3660907761330416e+09 -4.0146588772845018e+00 2.1131207652370665e+07 -5.7592431656120300e+08 1 +365 1.2106723943357101e+04 -6.0977332836180519e+24 1.1124743901873082e+06 -2.3443044627859206e+19 -1.8113288436710563e+03 -4.0821218112920255e+30 -1 +366 1.5445822073769857e-03 4.6214286284324800e+16 2.8229719279664941e+05 2.8893724698967224e+10 2.5152982809587480e+15 -3.2912133003558464e+16 1 +367 -5.3139014703561969e+33 -1.4037224230904439e-02 2.9235321659974004e+06 -1.5369889671049545e+30 -9.2433111474251805e+24 1.4591131641595382e+22 1 +368 2.9562535685767930e+13 -2.7061459949885630e-01 2.0763431706238479e+18 -1.9888982479517769e+34 -3.9561067749533296e-01 6.4623620729958617e+01 -1 +369 -1.4446739374526082e+03 3.9445228951670594e+24 8.7349990500638985e-01 -1.3087258489973222e+14 4.1756096919035866e+00 -2.4839863254666626e+08 1 +370 -1.8655224039696777e+05 4.4486116467467980e+15 1.5467119000220369e+13 -1.4969066921026968e+12 9.9814861589963226e+21 4.4542030361182856e+29 1 +371 3.8869520999437555e+31 6.8511499081509864e+22 -2.9025290799536878e+21 9.2344209267959055e+24 -3.0008032371983089e+28 5.5653657514195049e+12 1 +372 6.6406297869374339e+02 9.7539186295039332e+22 -2.9539209067793532e+29 5.0603129199475973e+01 4.5179924409562725e+24 2.6033115057353636e+04 1 +373 -1.1029578710219219e+26 -1.3700367773426911e+33 7.6642507375361013e+08 6.8532948240429814e-01 5.9264588995005205e+00 -1.3286394365437952e+16 -1 +374 -9.2250939021497848e+31 -7.2013787070747266e+12 -8.0611660670927144e+24 -3.2209137461732686e+31 4.8584411130781302e+02 -1.9899115230960090e+17 1 +375 -3.7552475081041484e+21 2.0694173072892607e+30 8.1681530881295949e+06 -4.0901194487285118e+09 4.8862282045369083e+27 8.9303339662996930e+15 1 +376 -3.8818406190605747e+34 -6.6070187239511782e+25 -4.1446915826421432e+32 1.8840769311360452e+07 2.4123988873466097e+18 4.9917187327286001e+01 -1 +377 4.4568990473928458e+18 5.1755906621977620e+18 -1.6354406057803275e+06 4.1814069258274738e+11 9.5222170410342786e+11 1.5298951726926760e+19 -1 +378 2.7891869580501480e+09 5.2607349055600525e+17 3.8492425278542422e-03 6.2993157416827442e+30 -1.5450678028319075e+14 -3.1632935030615066e+28 1 +379 4.0206890545976984e+16 2.2533482864543559e+23 1.8919701766958513e+21 -6.7125220083028639e-03 1.9678246188289550e+14 -5.5122053162607372e+03 -1 +380 5.1629310137099130e+17 -3.0863683202179384e+09 -6.1635085503711364e+23 1.5679933780330520e+01 -3.2493194402401026e+19 -7.2798102507136970e+33 1 +381 3.2971035678304415e+03 -1.3689560929931195e+21 -1.2421897519262147e+30 -8.8159698934395794e+02 1.6261358472463872e+16 4.4891464052532701e+05 -1 +382 6.8951850975409968e+16 -2.0758336068037525e+02 -1.8426289518779844e+13 -1.2838878911239172e+11 1.0899927790838740e+22 -1.0203715367698808e+16 1 +383 6.0824659253358133e+19 1.8126657247305984e+13 -5.1106653482693427e+17 4.1707311289509955e+32 2.1959969507406664e+13 -2.1727342060469556e+14 1 +384 2.3378053882203875e+13 -7.0565213774652224e+09 -2.4878207147309688e+21 3.1434586345066869e+04 -2.2646666418959866e+09 -2.0491073190177874e+04 -1 +385 -2.2475894798243300e+18 9.0963861236044337e-03 -6.4602095331327942e-04 -1.0668573825792433e+04 -2.1577120670411449e+32 8.2558121249401206e+06 -1 +386 5.6176032040478950e+22 3.4062262227449246e+13 6.1611403619133039e-04 -7.1639338355559353e+22 -5.9682598912464977e+25 1.3988844265841731e+14 -1 +387 -1.8598761465292835e+08 -3.2122696289775848e+08 2.3946344135892723e+03 -4.7467265866781953e-03 -2.4614175971928031e+13 1.5493688134451000e-01 1 +388 -6.1594516495404688e+11 8.5530655797165449e+12 4.0655120976010791e+05 6.2504489453471509e+22 1.4547737940416698e+17 1.0157678285238209e+09 -1 +389 7.2249537969202201e+20 2.5910710578430631e+00 4.8310809019956196e+00 3.5833106443851471e+09 2.5995600264725184e+16 6.6942339898217791e+19 -1 +390 6.6220054061884817e+25 4.1129009276617742e+06 3.2272145736161792e+08 -1.4955725798124664e+32 -8.1621531547674703e+34 4.1393732941847710e+32 -1 +391 1.1970752714705476e+24 2.4121106928170881e+14 3.2556693614334745e+09 6.7166828920741061e+31 2.7867956837423370e+10 3.8824606925052702e+33 -1 +392 6.5384623375376205e+10 4.0203516007058267e+29 -3.5917249358470226e+03 -7.7856459187201272e+00 -1.3326997042793071e+20 -4.0115132715978172e+10 -1 +393 -2.0440048263987293e-03 -1.2686367693883163e+21 -7.3129429730247539e+12 7.1116635677266690e+25 2.8306696346010491e+20 1.5853864740886893e+31 -1 +394 -1.4493668143672539e+02 -1.2211986049089427e+17 4.3425459806464227e+02 -1.2727328454319555e+19 -2.9167088267724795e+09 -8.0566290281389937e+31 -1 +395 4.9517606542933606e+19 4.1987984342775058e+31 -4.6380350663140203e+24 2.6147906662544027e+07 -6.4765027940456060e+15 -7.0276521918281540e+31 1 +396 5.3875320414867066e+06 7.4780414917041217e+03 -4.1818923723137500e+11 7.1282964459151328e+12 -7.9309659347435856e+09 6.6309664057266722e+06 1 +397 -3.2805632509252252e+25 2.0404906510003521e+12 -3.1747844786081658e-01 -1.7952771788552777e+11 2.3454846335122000e+17 -4.8396864005077491e+30 -1 +398 -1.7266603431510201e+09 -1.6679606770037110e+21 2.1545624845856935e+01 -2.2230642196234664e+13 -2.0411283687005153e+08 -1.1799716023469329e+33 -1 +399 1.0970470901195840e+01 -1.8535013816991127e+29 -1.9529110091758012e+21 4.1828699637677900e+01 -1.2473740058806255e+22 -1.7750375597484968e+16 1 +400 -3.5821233985801262e+26 -3.3260181718459965e+18 7.4517488795792416e+07 -3.6800114387488584e+16 -1.7963020906759603e+06 1.9267963995339483e+23 1 +401 1.5193180902590750e+14 -1.2626027904390443e+33 3.6577043934918896e-03 -4.9740511612698529e+06 1.5535948118970740e-03 -2.0110623670707114e+09 1 +402 -3.0995946225596600e+26 -1.4593630387484306e+16 -9.6648887638554798e+23 2.4175244013863678e+14 8.0165481523071787e+02 1.0341896810276497e+11 -1 +403 7.7726711059581787e+10 -1.3612041337491816e+10 1.7138358700935153e+34 -1.1952993932518464e+24 -1.0975079767509191e+24 -2.1019902939020060e+06 -1 +404 1.4299653145862890e-02 6.2327416328693214e+30 -4.8216668387583986e+07 7.0993841141882684e+25 8.4686470801089732e+33 3.1248350000773067e+22 1 +405 3.8210517805676369e+33 7.8499619020113418e+18 -9.8973678902123984e+12 -3.1022797160638496e+05 5.2645453447743821e+31 1.8988930808210320e+31 -1 +406 4.1572182162246723e+20 -8.1988408587886480e+30 3.7706673307655128e+24 -1.0291278862607428e+10 -2.2978668088320504e+27 4.4239029377470668e+28 1 +407 1.2156423320958776e+28 5.5329377000950075e+14 -1.0785051549937484e+24 -2.6175092748541786e+00 7.7118955005696177e+07 -4.7310014988712896e+26 1 +408 1.0507312032833051e+20 1.0065496340533169e+06 -3.5689825896223947e+03 -2.1713925865738563e+01 6.1269255081339213e+23 -1.1808003131477085e+23 1 +409 -1.4767540356293853e+02 1.3442978170036386e+22 7.2289162862338820e+15 4.4143380678150038e+01 -6.9493338986491616e+32 -1.7384980522381354e+03 -1 +410 8.4851585902798958e+09 5.0778976431830050e+33 8.6623896841587777e-01 1.1811077703616116e+06 -9.7511300418251694e+29 2.6702604702268524e+10 -1 +411 -9.7058843708887407e+24 3.2350173195050203e+33 8.1438816506596053e+33 -2.3953928974785975e+25 1.6525001316622570e+07 2.1929153100869074e+30 -1 +412 -1.1567923094155498e+17 -6.1604953028500185e+05 -4.8861954478293066e+11 8.9746546149464881e-03 -5.5705349145859037e+32 3.4723292610251060e+15 1 +413 9.3551433685097123e+25 -2.2820064664818956e+31 6.0827425303689781e+29 -6.7454398986740050e-01 1.3640045486140211e+03 4.9147510293837502e+32 1 +414 3.1997805207505971e+03 -8.8556622752525898e+12 -1.0606536618070876e+26 2.4414247606455270e+23 1.2022848423914155e+34 -4.0828021531157403e+25 -1 +415 -5.1821552338677330e+30 2.7077721192798780e+15 -7.1691590668826539e+29 -3.9106409238192454e+28 2.1249634773650543e+23 -3.8882653919373223e+12 1 +416 -5.8394342988343396e+01 1.7789817464171076e+24 -1.5969602250326220e+15 3.0492920776810378e-01 5.4309046443449775e+14 -1.9421532858967913e+31 1 +417 -6.4620083986150687e+19 -2.5136861558611795e+15 2.8595429078451814e+17 -8.7487382927211090e+10 -6.7442751018991859e+29 -2.5627796855044626e+29 -1 +418 3.5545895429440717e+31 -6.1036337668776042e+01 3.0141846895559424e+17 -2.7920417737332417e+31 -5.8517348070234251e+19 -1.2934289351476448e+01 -1 +419 -2.0398603648734634e+31 7.9252750917458993e+25 -7.7966931117104891e+33 2.7595065537131104e+10 -1.4838222815358892e+27 -3.9363844060009467e+18 1 +420 -1.9675678422758220e+00 1.0337994192548627e+08 5.8662856436519152e+30 6.4360606353601850e+25 1.9799508256205750e+14 -1.0491092772997199e+18 -1 +421 -2.5337655055558243e+17 2.8170280240312095e+26 1.0784506053243490e+07 4.7421410650707484e+25 -2.8768029700910500e+13 6.9188739601397852e-04 -1 +422 1.3491273419358645e+25 -2.4725690425885009e+05 -2.7561181789974864e+22 2.0165318484312809e+00 -2.5708636376068025e+23 -2.4385201980190758e+32 1 +423 1.0178656186667756e+34 -6.6450815873479248e+11 -6.2374302531942070e+28 3.8177972694367658e+04 9.6342001497472210e+09 2.1074217989933747e+25 -1 +424 8.4896515305735720e-01 1.1952146991485290e+04 -3.1239282457506723e-01 -2.1480134290013762e+19 -2.1155298543824220e+18 7.3131654911401248e-04 -1 +425 -6.9381033736951462e+31 -1.8856300545838192e+00 -3.1835253343599178e+07 -4.6536543051030499e-01 2.6952169793318538e+05 -4.8782456909977511e+33 -1 +426 3.3832325952694389e+34 -1.5048806904647614e+27 -1.0007206282622668e+20 3.6225171628344789e+07 1.8801816044419253e+08 -1.3341848057355568e+32 1 +427 -1.5138407094799309e+09 -4.4801808013864351e+20 1.0937579052181785e+28 -5.3189475796043639e-01 -2.1965661057783498e+24 -3.0436842870542573e+17 1 +428 4.6012254017841690e+18 -6.8408371616999774e+32 3.6644345103107731e+21 2.1346015699113916e+11 6.0186993414239731e+27 1.2402776730386744e+04 -1 +429 2.0674195499653954e+30 1.3217049364778636e+16 -3.0906899918767391e+28 -1.5891024429833167e+09 1.2292328123353827e+11 -2.7088787704235810e+22 1 +430 -3.6096049229090027e+10 1.5298650358385515e+02 -4.1906435638628826e+06 -1.2777453805431819e-03 -3.4773350313326120e+15 1.4884621794223518e+05 -1 +431 2.1496302718114478e+01 -9.9586618097275634e+23 -1.0073660134152318e+34 5.7532799162406500e+14 3.9765350779850489e+08 1.4252315691685603e+12 -1 +432 1.0879468796299330e+19 1.2464466689239883e+10 2.1449168848548715e+09 -4.1995090906696000e+17 2.4483052672149551e+08 2.6928003005019629e+21 -1 +433 -1.4297941682861211e+09 -2.2386898349163138e+26 -1.5091113775588243e+21 -3.7312221332705611e+30 3.8378941045842913e-02 5.8204411305017139e+01 -1 +434 -3.3885948573107567e+10 5.1256656734448742e+26 1.9664907921188203e+12 9.3090984959680512e+00 -5.8240707164383930e+15 -2.3680585121980323e+23 -1 +435 5.3575879619952431e+01 1.7633429937956009e+10 1.1949183306419258e+21 3.2128787372142238e+00 -2.9914777652582994e+04 7.2115608218318987e+23 1 +436 -1.8712981049544029e+09 -1.5167961459098573e+17 -2.2273063224169359e+01 -2.2544064192664505e+30 -3.2439182357098509e+28 2.0686631364267395e+32 -1 +437 5.7151426355480626e+07 -1.2396702777121780e+14 4.1774916211890252e+06 2.2888263957159969e+13 7.9538751742852688e+09 1.4987427786610258e+01 -1 +438 -2.0935890853949677e+11 5.9539789267087461e+28 1.6485301372386998e+19 -3.6996193477675905e+32 2.1928496019953046e+21 7.1337944760968664e+16 1 +439 7.5348365958098606e-01 1.0699838663449425e+09 2.7606741343315364e+00 -2.4216094355315610e+17 8.8525695267677580e+15 3.5485351651336279e+24 1 +440 -1.9728570439176378e+29 1.2041937249597179e+21 -3.6485625619125517e+17 -9.0404765753924982e+25 2.2657754823529327e+10 -5.7506380512721589e+04 1 +441 -5.9574186224236393e+09 1.2894165333277875e+14 4.9673913515327456e+01 -2.1037931241843510e+08 4.9000942458295466e-03 4.1706035820469437e+10 1 +442 -2.4027653286597643e+09 -4.3465884351477742e+21 1.7570719252641070e-01 -1.7600155060652023e+33 1.0753879645199773e+12 4.8018658709041476e-04 1 +443 -9.8115193601038470e+26 4.9988249417565427e+33 -1.4273986143464094e+19 8.7335382413055826e+26 -7.8186481277542666e+12 -1.8927497902893630e+05 -1 +444 -6.4960371580736520e+31 1.7453942617214426e+17 2.2362887772567975e+24 -4.1629008724113660e+20 1.5726720056410183e+10 5.1285735115955353e+08 1 +445 -5.1277898417965355e+09 5.4666236408929989e+07 1.6795187001158300e+31 -1.5004856589076841e+18 5.1826581772333063e-04 1.7949180206768160e+28 1 +446 -7.9920793339527818e+32 -2.2338557069704651e-03 -1.0846130429346384e+28 -9.5070110709844280e-01 -1.6093064711305449e-01 -1.4121523203098008e+17 -1 +447 -2.1915451213829605e+27 1.4677663459220744e-02 9.0080014974716905e+03 -2.6931790935703237e+00 3.4488948847045120e+16 -1.7977507516836806e+03 -1 +448 1.8637814146755929e+00 7.5523287072206493e+00 2.2778875742837348e+23 -5.8972925325594832e+21 -2.4100624853478004e+26 -3.0389755096139878e+23 -1 +449 -2.1362149166042775e+07 4.5192850982395784e+32 -1.1817577059860735e+00 2.8289814679031470e+11 1.8417956714915396e+12 -3.2043267809670950e-01 1 +450 3.5391473779591578e+17 8.8392449648275906e-01 -3.5439819260054977e+27 -2.0447997255635016e+20 -6.6337048740644303e+30 -7.5508211620673600e+14 -1 +451 4.3598253354824012e+21 -7.6178721482720293e+12 -6.3266882318024312e-04 -7.9191389046240338e+14 4.6326214987733610e+29 -1.0055175597719092e+23 1 +452 -1.0588303626244354e-04 7.6546114537313450e+06 -5.3535993202089370e+17 7.4365194576451993e+08 6.7266877460717397e-02 -5.7703381842350576e-01 1 +453 7.2342213998142918e-03 2.0919416113411582e+12 3.3201913314384301e+13 -1.4190374388159340e+28 -3.9237296758920815e+25 1.6031164818391652e+23 -1 +454 1.8545012463874141e+01 5.0114154134736503e-04 -1.0202472833853959e+08 -3.0070837875175948e+04 -3.4819396828879188e+33 -2.0850878267944170e-04 -1 +455 -4.0074976548539609e+13 -5.9089672880497193e+18 -1.8033413261455200e+14 1.5748747005226251e+32 2.2217188692293460e+15 9.1147205709871662e+02 -1 +456 -4.5610776822691954e+32 1.1115944311831003e-01 1.6432679792371428e+21 -3.0820737382618332e+08 -5.9019790598233203e+02 -8.8526399879276685e+20 -1 +457 -2.5033267962941493e+28 3.1578253649684542e+20 -1.4979625550294727e+22 8.2838091178447238e+24 1.0753060593235010e+11 5.3117440297551130e+29 1 +458 -2.3504445556563383e+00 -3.7795937940237723e-01 2.1692413768029139e+31 1.3768444642855272e+09 -5.7747064189384930e+15 1.4962721957679305e+26 1 +459 -4.6240598285915031e+13 -1.3456055425588228e+06 5.8306589251159159e+29 -3.1249486905323004e-03 -6.7313681629120884e+23 5.0780556180002306e-03 1 +460 -2.4231929479399038e+29 -4.2102379613156404e+09 -1.7846073110543159e-01 6.3815973874524176e+16 1.8138709439959939e+12 2.0549521422881613e+17 1 +461 -5.6100099924076879e+24 -4.0967675395104922e+13 1.6778650848365101e+10 3.0773389936184452e+25 -5.4234881941055253e+04 -1.5511083768852621e-01 -1 +462 -1.6426162621795747e+14 -4.3232467803157572e+33 1.0481098028068959e+33 8.0338273548510752e-02 -3.7727043648085837e+34 -9.6318605105622540e-02 1 +463 -1.6805118349268214e+03 -2.4928003418014497e+06 -1.6882717035083894e+12 -5.7250457382452108e+07 -1.2413521415265860e+15 -5.6272096740490106e+14 1 +464 3.7368836155189565e+22 1.5803922597586091e+29 1.8744142402255929e+20 4.3978219558035889e+25 -5.0414336216140117e+23 3.4662700837085901e+18 -1 +465 -6.7235024330065582e+10 1.5310810813495072e+26 9.3204629504279324e-01 -3.6958439972654309e+11 3.8284549946889284e+29 -7.9340329096424890e+11 1 +466 2.6766052718825481e+25 8.5963013380250100e+15 -7.0688279221915340e+08 -5.2009275521798439e+28 -1.1428571619743526e+24 9.8653197131076308e+02 -1 +467 -1.3982956914520089e+32 -5.8620699207486106e+18 -1.2743623154920521e+06 -3.7907177444082918e+04 2.7860664279106995e+32 -1.3754500773636871e+06 -1 +468 -6.8335693522159795e+23 6.5256406458105936e+22 -1.3452265562601032e+09 7.5103142496200249e+07 -1.0071937214421860e+00 -2.7116090657492874e+11 -1 +469 1.3737173273588650e+28 2.9234007257962832e+04 2.0849667919493875e+01 2.1874236821147821e+02 3.7079020870595917e+07 3.6582700043139482e+17 -1 +470 -5.0781727795470240e+34 3.9959481337827328e+23 -1.7200052728622279e+29 -9.4871915274109050e+14 -2.8049878257773537e+05 3.8794114409669056e+16 1 +471 1.0735681763455304e+03 1.9678068438488952e+26 -4.7684927101757480e+15 -8.0295658875754598e+04 -1.9764938498991975e+32 -1.9632760444449301e+21 -1 +472 -8.8329483686051840e+16 4.1806648428358829e+28 1.8018830892710246e+07 -1.1052704106700004e+25 -1.0111227794935983e+08 4.4904963763491797e+11 1 +473 2.9795776893971792e+22 -1.3313217105937485e+17 7.9823486858090660e-03 -1.5106675549046243e+20 1.1114962108032592e+05 -7.2664572095511288e+14 -1 +474 4.2280600478601062e+29 7.1864831832707324e-02 5.7324339673066832e+33 -8.0687683858028442e+18 1.7513189448800963e+03 -6.8702453451802634e+04 -1 +475 -8.2729812428232544e+11 -9.7968732625351064e+06 1.1677074004029030e+08 2.2682340011643069e+06 -7.2046756702836683e+22 -8.2093612819313044e-02 1 +476 -2.7799893124307289e+00 -2.9826350800911094e+31 6.7027822869023002e+25 9.3316320716628979e+01 6.0078548130083235e+05 -2.1888163043115265e+21 1 +477 4.2454257193813138e-03 -1.5451789277288489e+11 1.8620906793529663e+22 2.4944102106720306e+28 -1.5051582844670264e+11 -4.4017318184554823e+32 -1 +478 5.5575107968240802e+28 1.3842397556334925e+17 2.6442482542077950e+14 2.0896033119536236e+08 -1.6257984810452810e+23 2.2828364657915625e+15 -1 +479 -5.0997468048417451e+12 -2.6780180231897463e+29 4.3686472847315588e-01 3.6210819054246605e+23 -4.7166178202121364e+24 -4.5627718072732771e+05 1 +480 3.1820558093044309e+28 -6.9779857825873856e+04 -1.0822966376203564e+00 -4.8724278973429536e-01 2.7696485053038191e+29 -9.5436710582879329e+08 1 +481 3.1206112819745976e+31 -1.0691300643923214e+19 -4.1747444877275656e+05 1.6983316015183407e+34 7.9864077019781692e-03 2.4357008269283225e+14 1 +482 -2.4847276689852972e+05 -1.1939818372460498e+13 -8.8146173216484827e+21 1.3591996042582285e+07 -3.4597272161234949e+18 9.3028709017306602e+08 -1 +483 -2.5471846249735599e+20 6.8051124829631362e+02 1.1706964321044128e+16 4.6956217354553565e+05 -2.0489395959853400e+16 -1.2756014400604406e+18 -1 +484 -5.1915149514249275e+32 -7.0194553284747986e+10 -1.5486011441793960e+15 1.5290111838651835e+33 3.5051648829785948e+19 2.1236359065295461e+13 -1 +485 7.9232397749969005e+02 -2.1719274852993805e+05 -4.5652218644964711e+13 2.9842881490093022e-03 -5.3371947488333024e+27 -2.2383427998839504e+08 1 +486 3.0368681742601765e+19 -8.6298364899815461e-01 1.2488277080698975e+15 5.1580325642290290e+15 -1.1028009169764115e+00 -1.7793925516523464e+26 1 +487 -1.8041853581767405e+15 -7.9297606597653939e+04 3.3457122634506935e+20 -1.8818277704652156e-01 1.0756816687937006e+29 1.0001529174840380e+03 -1 +488 9.1210795254304685e+01 -3.7024975919349700e+07 -1.6667866547232300e+12 5.6848458008641347e+30 -3.8121153103672810e+01 2.6688429271919443e+29 -1 +489 -1.0952786090879258e+00 -1.0968436906149659e+21 -6.8479325225855440e+32 -3.0130443256327045e+21 -4.7014159938166232e-03 3.3297534438511456e+21 -1 +490 -7.0030976542489359e+33 4.2133698634124181e+00 -2.0085120802770939e-01 5.0954509993083340e+28 6.9678749240544094e+22 1.7342311975645119e+33 1 +491 2.5792990503740387e+09 9.4365410430617877e+29 -1.2123442776441138e+22 -2.2453400759232778e+02 -6.6417590323255286e+30 1.0983899131527608e+15 -1 +492 -3.2190239296837209e+20 -1.1323721607008917e+01 3.9821886046394414e+12 7.9803014702285351e+06 1.2187791560009111e+04 3.5815509691189092e+12 1 +493 -8.5884163959891757e+32 9.5531070433649021e+25 -4.2996075911335100e+02 1.7401065193963539e-01 2.1709464240518180e+18 -1.4279058655037105e+08 1 +494 -1.3334730625281006e+07 6.2050137335891759e+03 -5.4249270244024306e-01 2.5810191859462513e+18 -3.7945547849553229e-02 3.5104519415294495e+10 -1 +495 4.5737732266140319e+18 7.0586567766567241e-03 1.2499719361084328e+30 -1.7227636346193035e+19 1.6431843023352855e+13 1.3953137764447351e+09 1 +496 2.0557964679555488e+08 -9.1086850664072960e-02 -8.8228785825748789e+24 -7.9849374119552863e+00 -2.3046600081646276e+08 1.2845117851747325e-02 -1 +497 1.4614277952936279e+11 -9.1260793155071215e+22 -3.7683375665693524e+11 -2.7372122067929010e+19 1.7518267505519344e+27 -1.7339616207544897e-01 -1 +498 -4.4934292337210645e+04 -2.5661341830020359e+13 2.7609773335779068e+23 7.3365443449280176e+16 -1.1050314674360051e+06 9.6967412284399757e+00 1 +499 6.9118437709278667e+30 -3.8958246856919494e+14 -1.3855177194028770e+31 -1.9352136143479309e+33 6.9061440597598953e+06 -1.1365881400596345e+05 -1 +500 -3.4960421812997913e+08 -1.9151811658843737e+21 -3.5868043184639660e+16 -1.1225644587549232e+15 1.0098287618156171e+03 8.5547203317795758e+18 -1 +501 -3.6883915743957950e+14 1.9228435738216164e+10 5.1140634939306586e+17 9.2143578319313844e+13 -2.0598531987521773e+31 -8.6190242380273220e+15 1 +502 -3.5887994634527935e+01 -1.8353435326279181e+27 3.4716041939514771e+11 1.8272182155515736e+23 -1.4308616814512513e-02 1.0464112457973633e+09 1 +503 1.1737081100784397e+02 -3.1392762707251562e+13 1.5040375201841022e+02 6.8129660699143602e+27 8.9865471837314779e+29 -6.3115591456008726e+05 -1 +504 1.0244686288875149e+17 4.8917824390420313e+33 -1.1665742265794182e+17 -3.9105339844275150e+09 -7.2056989494541813e+02 -2.1754347408333601e+29 1 +505 1.3748059491922868e+02 3.5435041001319019e+11 4.5112171293164062e+10 -1.1645840157440560e+25 -2.9253521795453118e+01 -3.8004892154237330e+29 -1 +506 1.0972745887578038e+19 6.6208636799733711e+19 -4.3517309206318028e-01 -6.1423591728065688e+13 -1.1343065654247325e+15 4.5288222971864120e+18 -1 +507 -3.4244584395157607e+28 1.0059171054180967e-01 -2.1893918046940061e+23 -4.6880079038740849e-02 -2.2455217361440842e+18 -1.5942076085313073e-01 -1 +508 6.8023321289014071e+06 1.3731280401485174e+10 -1.9329564420135480e+16 1.0529582137748862e+20 3.5297118266907346e-03 -9.1596865640919920e+27 1 +509 -3.4156590453367669e+05 1.1367730236231568e-03 1.1332013165095001e+04 -5.3132407958837125e-01 5.2808223828583322e+32 -7.3856283935870078e+20 1 +510 8.2642201351642268e+25 -3.8808341513508389e+26 8.5054811937109007e+25 3.8577442887082007e+23 -5.2211179345104814e+18 7.7060540164834192e-04 1 +511 -1.3829342567953554e+23 6.4076393218665595e-02 1.6270647272228791e+04 1.0692855973394219e-02 -1.8067755851096113e+19 -1.8584414307474785e+15 -1 +512 -7.1822462542010779e-04 -2.4264744789905042e+27 -6.1146527435672806e+03 2.4503154667005816e+04 -7.9917596177669787e+08 4.8328157791200127e+24 1 +513 5.1454014114150547e+13 -3.7096439442922417e+28 -1.4093853660715689e-03 4.6312086032072880e+05 2.0803248068106958e+33 5.5584295415477696e+04 -1 +514 -9.5065162446990767e+29 1.2355497425448114e+31 -1.2003876037704678e+01 8.0758846728187880e+15 3.1018172372565167e+21 2.3874315742444242e+02 1 +515 -3.6596466674208676e+20 6.6573660730797911e+26 -2.7610073883305358e-02 1.6230544235172965e+25 6.8042500081428298e+03 9.8715502285191016e+23 -1 +516 8.0290225162478018e+08 2.1269792339357973e+26 -2.8699254038660758e+33 8.7357659562035227e+08 -1.8848856265921777e+28 -1.1167829254435946e+06 1 +517 3.5078480351811012e+13 -6.2879506252731346e+01 1.6005700897225538e+33 4.6746580015332139e+08 -2.5610689047334052e+18 1.1105447573936226e+26 1 +518 -1.3795817311358712e+32 -1.6623192896470892e-01 2.3889650405573825e+03 6.4352360178182512e+22 -5.7508212386268343e+28 -1.5863918735262806e+16 -1 +519 -2.1613579551847310e+29 5.5683714339308343e+29 3.0870457994618189e+18 2.3048139740988564e-04 7.7314569718732843e+20 -6.3064536727636792e+01 1 +520 2.6130286633546610e-03 2.1254111328927422e+12 -2.0488420949482036e+22 5.4433419381936556e+27 -2.9076002654274497e+06 3.5626037287598065e+30 -1 +521 -1.1755400657996970e-01 7.7643582266886630e+25 -2.6090872393827097e-02 -2.3010701863101870e+06 2.4549633834940127e-01 -6.4167069459204602e+08 1 +522 -3.4225108994145264e+00 -6.0753806899769325e+06 1.4609861737937611e-03 -2.7435584964976238e+14 -8.4088763949116097e+32 -1.3048000457296519e+09 -1 +523 1.9722454035507779e+22 -1.9243822237026640e+16 1.8947153615072413e+04 -7.9095154663836682e+11 -2.6214064087596667e+04 -4.7958591630141062e+21 1 +524 2.0109051715391941e+28 7.8166218572755668e+01 -7.3918663120205566e+10 -1.2465692320359362e+16 9.7805477434958400e+15 7.2120115674094557e+31 -1 +525 -1.4487137165985574e+25 1.4539112682355420e+29 7.6194405793953247e+03 -2.2848715146058638e+21 2.4162383882341718e+00 -4.6871298464902890e+08 1 +526 3.6942050525147429e+33 1.8776337857208893e+32 -1.6730457569650758e+31 4.6600867385656666e+24 -2.5320233787727966e+09 -8.2393905977677690e+15 1 +527 7.2915640087017015e+24 5.4242298655799837e+19 -3.8872073418724185e+12 -1.1413246904869375e+12 4.6240899936849394e+32 6.7824487450385816e+29 -1 +528 2.0504465459122645e+32 1.8835002903826374e+10 1.8917364774172305e+00 -5.5875152849353237e+21 -7.5166449717104104e+34 -1.9787075199606416e+23 -1 +529 -7.7246110684828153e+00 1.3517281045743319e+22 3.1058780152074653e-03 3.2737827119565334e+20 -5.2841481259115076e+08 4.4481533123726521e+01 -1 +530 -1.2882535417714610e+02 4.5346774320907663e+29 2.7846784875938796e+26 3.9354432342987103e+01 -1.5115086483025002e+10 -9.3821619377348219e+13 -1 +531 -8.2602491799255627e+11 1.1765631863547385e+31 2.0343351380810051e+18 3.9776161291096980e+15 5.9649211297915326e+02 8.0269096931122156e+13 -1 +532 1.3145250449729107e+20 -2.6273747440670616e+29 -1.1951921826878424e+22 -1.4234867497998781e+13 1.0680973655095055e+18 -2.4944134297611475e-01 -1 +533 6.7454592734345879e+10 2.7863829017463516e+13 -5.0294413769564977e+30 3.0778292237833175e+20 4.0181203712741059e+08 -1.1307645755396590e+18 1 +534 -2.6421551165571246e+18 4.7552675208847053e+26 -9.0985967492390409e+02 -1.4755465209004590e+11 5.0338357071841538e+07 -8.1665495686299050e+15 1 +535 4.4009270959449891e+00 -2.2062100021708517e+04 -3.6972210185515830e+15 -3.0103332237937360e+21 -1.6542666575650845e+17 1.0722767957321234e+11 -1 +536 7.3882141184753640e+24 -2.4196680400798432e+17 1.6946037162857919e+30 -2.2960643208954399e+06 -7.0438911644516773e+09 2.6713101371566388e+20 1 +537 5.9254944338523783e+03 -2.4427700285030533e+34 -2.7078125642617784e+22 4.8406862233796180e+32 -2.3585830725676119e+06 3.8270991745696505e+15 -1 +538 1.0922561736767278e-01 -2.1080974393652893e+10 5.1634671423491028e+10 -3.8274147886504157e+21 -1.0366947354558605e+17 1.0792113254529237e+19 -1 +539 2.5517173011977382e+17 -2.1034086806964114e+30 1.4815977822281390e+18 4.6192009509193929e+04 4.7572940442774898e+34 -3.4076508071785562e+28 -1 +540 -2.4958384606468823e+07 4.5197689110077026e+32 -1.4702504674795079e+08 9.1025445428720986e-03 4.3789576273244700e+23 -6.4035176308363771e+25 1 +541 2.5463780527563012e+25 1.2378930754181572e-01 2.2446843515895560e+07 -1.9447871293563743e+00 4.1925613532927191e+33 2.1941550623811556e+16 -1 +542 -3.6514667595234096e+02 1.7333980152095261e+10 4.1133667685570679e+10 6.3061582103666229e+10 7.1698311573610396e-02 -2.6016346260114311e+01 -1 +543 -7.3081464261041731e+00 -5.1795029483536260e-04 -4.4285751182864676e+05 -7.7172975565837763e+25 1.2897469268352774e+17 4.2607649816252210e+32 1 +544 -2.3796905483206196e+09 4.8903421771063656e+06 8.6312797492865173e+10 8.4462381686728393e+19 -6.1073548901630670e+07 2.3599146091479138e+28 1 +545 -7.1810085027032523e+21 3.2620442185337705e+22 -1.5062418417042552e+15 -9.7502397639447022e+06 4.3283359047282437e-05 1.5761322834099552e+06 1 +546 6.8377602881193053e-03 4.4895397743673362e+27 -2.0322821604119123e-01 -2.1237173914460552e+18 -2.5713638582076752e+33 -1.1421982782730796e-02 -1 +547 4.3213720471542445e+27 -7.0665669418929857e+24 1.0535806616288413e+24 -4.8264426255043654e+03 -7.8564660189697399e+09 5.9621247460342018e+32 -1 +548 4.1776108319472883e+30 1.9747408276801601e+32 -2.1039116191162124e-01 6.4409047774711947e+29 -2.2207018574736656e+10 -1.0725596388893290e+09 1 +549 1.0712370945189638e-01 -5.8577223351047197e+21 -2.9309439837278723e+31 -7.0500108107147597e-01 -1.8490386608912895e+34 2.9172296273324819e+24 1 +550 5.2716091423741123e+06 4.1596785040441094e+12 9.6754914364329204e+22 3.5249462372983241e+08 -2.6252036570376924e+31 -1.4795214258411537e+01 -1 +551 1.5473541521914963e+30 -1.6568263991266795e+03 5.0253537914701720e+00 6.3407313386359880e+15 -5.3681164764888102e+25 -4.4309169198167170e-01 1 +552 7.1044580245670764e+27 1.9903793883597433e+23 6.3245244877244058e-04 2.4080560366220445e+21 -1.2044973100081979e-01 1.7602871591450766e+07 1 +553 3.7643539824784000e+15 2.2149470851835534e+20 2.7513799815569622e+23 -7.5622790350444280e+15 -1.6100798594132438e+09 -1.2416488659391158e+24 -1 +554 2.7186388861940585e+30 -1.1589872479397094e+26 3.0675458309302914e+25 1.2735556654562565e+00 1.4077473572165686e+26 -5.7912636733989952e+16 -1 +555 6.9416033633643725e+18 2.0412089968284436e-01 -3.3148157543686580e+16 -1.0510243784753784e+03 1.0997012255630615e+08 3.5026994756376717e-01 -1 +556 1.2768699552469607e+02 5.1582512481096741e+00 -1.3370244877637348e+10 1.4521132738398880e+15 3.5943158909811169e+14 2.6689799536739330e+22 -1 +557 -2.7552089637528493e-01 3.0165437098748442e+27 6.0671042894525856e+07 9.1351947001204968e+11 -1.3312757525070024e+03 9.0733328205190432e+08 -1 +558 3.5071952684621020e+15 -3.3725548927006359e+22 1.1828903071403705e+27 -1.6502968394309702e+09 5.9375974985958572e+04 3.3189510547130331e+29 1 +559 -5.1352183199718479e+02 -6.8996599502320708e-03 6.7760904371888488e+19 -8.6697463043802967e+25 -6.0035725408783439e+22 -1.8160069700679037e+17 -1 +560 -8.0960425847935203e+03 -1.0236775651656117e+05 1.1949316630126777e+01 1.6291673134143567e+09 3.2147913980598715e+06 -3.7453403625581522e-01 -1 +561 -2.6613720751973295e+26 4.7046643478392547e-02 5.5846600713239450e+17 -1.7462885460186685e-02 -1.8019558558263470e+15 7.9618776550522408e-02 1 +562 3.2192788599530919e-01 2.9353716011931038e+08 2.2452542928364746e+04 7.8758758567202787e+23 2.4756893360322048e+31 1.4115238223472783e+01 -1 +563 -3.5776705019564062e+14 4.4134165584077141e+13 1.1688047287755790e+05 1.6339651188569948e-02 -2.7568551947113867e-03 -5.0678429980218665e+11 -1 +564 3.9615854088784238e+27 -1.8714262811372470e-03 2.0583523315875730e+01 4.0509887632833551e+29 1.1963984433606593e+33 -3.2940685193730819e+22 -1 +565 4.7553217109716082e+00 -1.1957923736536745e+25 1.2553006391326373e+11 -3.1306850328825499e+02 -3.7645157680217365e+15 -1.4942478711171852e+00 1 +566 -3.7888216864239654e-02 7.9366929131878933e+01 -3.2992014977685196e+30 5.8719977781162793e+32 2.2378402893188316e+34 9.4422822989970885e+25 -1 +567 3.8380628484000087e+21 -5.2353236430536606e+14 6.7187236845863679e+22 -2.3198088375095067e+32 1.1789650144010662e+02 -2.3172426394759229e+05 -1 +568 4.3299864696422042e+33 -4.8277975677354476e+18 -6.9304372494531457e+24 -7.0667567057696381e+00 -4.0511182364375884e+01 -4.2677134584426801e+25 1 +569 -1.9637837077862761e+30 -2.1032328504877056e+04 1.1792438740417420e+14 2.8643851777809699e+24 -1.2145165467614072e+03 1.7963103758936807e+00 -1 +570 -9.2853987836807590e+01 4.0884635516200997e+06 7.4286105218687370e+25 -1.6849222599895608e-01 6.1676453613695692e-01 -4.1943251221768452e+24 -1 +571 -2.0538683745769494e+23 -2.3226627695092265e+07 -6.4895551803143613e+33 -1.4948122551500039e-03 2.2910621990922875e+18 -9.6058301659608934e+21 1 +572 -5.2918546692394234e+23 9.3004706109893476e-02 5.3030947848120225e+12 -3.3467734490970832e+02 -7.7538126263239880e+15 7.2098192048146606e+29 1 +573 -5.9637703788502846e+09 -6.2163149051741420e+03 -7.9907586135788411e+06 -5.6795973051458962e+30 -3.1772768021675622e+17 -5.0116045516215239e-04 -1 +574 8.7733247617747110e+26 7.6657647251457422e+12 -4.4596370468183434e+08 -5.7835822766123810e+32 -2.7662348368722349e+17 2.2239155013441600e+14 -1 +575 1.7330749200003908e+00 1.4541130253600184e+32 -1.4342831122364636e+33 9.4889410563298125e+12 7.3684753495624744e+31 6.3325832314573595e-03 1 +576 -1.7112192164148918e+13 4.0529358238822243e-04 2.5875090110519793e+23 -4.8462012791461577e+19 -2.2724140787649457e+24 -2.3360287119943265e+11 -1 +577 4.9915981358808422e+09 -9.5119099244340003e+30 1.0546084172397551e+26 -3.0679796002619239e+25 2.3216482758964743e+25 -8.1828592015452760e+26 1 +578 1.6169734690107699e+34 -3.5221138468358298e+17 3.2261513625343391e-01 -5.9260306147172670e+01 -6.4285121612012859e+13 -7.1129394600614905e+04 1 +579 -5.5382408921550312e+12 -5.6117613989622509e+30 -5.9458402560573292e+09 3.0937852639158038e+01 -2.9290368391415150e+03 -7.4430656965586432e+17 -1 +580 2.0798722035281272e+26 -2.0298705217119500e+13 -2.6309447929123639e-02 7.0333897245240749e+30 1.6991540838928096e+22 1.5077473494165519e+00 1 +581 3.4532434617107720e+15 3.8203719183606952e+07 9.5579787255012236e+20 2.3068215011524766e+13 2.9659206201399092e+21 -2.1283607797096481e+32 -1 +582 4.4531317250666615e+29 -1.2114423634163564e+22 -3.5881923557226642e+03 1.1209802486722247e+21 -1.4171388678946282e+25 -1.3588346220001149e+29 1 +583 -1.7472602394555347e+30 -2.1178092193356647e+21 6.0602907218282041e+01 -1.2595004890916832e+21 1.0179700152551942e+30 -2.1253525937757204e+18 1 +584 1.4489942607285377e+27 -6.0904229102662288e+00 -3.7560157804769463e+10 -1.5078915235618553e+09 -6.5328990906419832e-02 -7.7510269048267219e+02 -1 +585 3.6910922850342199e+31 3.8546104515588377e+02 -3.3894820979634946e+12 -1.1693948677230054e+01 -1.1757360197613944e+33 -1.1535405530338477e+28 1 +586 -2.0996809954607812e+23 1.0898347450366944e+04 2.6678142506441170e+10 4.6988208822569647e+26 -3.9017700298646494e+33 -5.6155016478007715e+12 1 +587 -2.4902171297903515e+03 -3.2773142010262016e+17 7.8446313208613647e+21 -1.7795705575856535e+13 -1.5826736358616239e+08 2.4092529604459713e+10 1 +588 2.2408085798187775e+29 -7.0678913657513935e+19 -1.1753200513695447e+04 -8.5995170047802424e+02 -5.2175284778692070e+00 7.9828148495923804e+25 -1 +589 3.9616004662792778e+08 5.4909496794713783e+08 6.3295454799661404e-03 2.7115543405419312e+03 1.4166524283829793e-03 1.2247746225827105e+09 -1 +590 1.8700765142277236e+00 -2.6809876839087332e-01 1.9594367855198104e+02 1.9446689213855089e+31 1.5076578774590489e+03 -1.2641037815502960e+02 -1 +591 -3.9564897409719740e+15 -2.9212390054616406e-02 -8.5870476079916763e+08 -2.8538293617198599e+12 7.6993259873045997e+20 -5.8589740270636040e+15 1 +592 -8.2208872522042577e+02 7.8433535673054067e+00 2.1970516130991811e+01 -1.3346714900819027e+08 -2.4579287948294433e+02 -8.9289308326944675e+09 -1 +593 9.6233789661261106e+08 -1.8473644713057833e+30 -9.0011992045934784e+16 -3.0368645175698313e+19 5.4402724974723021e+23 4.1915793172403900e+21 -1 +594 -2.2107627963070725e+23 -1.6165819249826777e+05 -1.4643020084741162e+14 -1.6642350275589156e+21 -1.6470298963281235e+12 -4.4836192249940178e+30 -1 +595 -9.6232301977439969e+13 1.5230713807265117e+28 3.3261030136866757e+22 -3.2969578213044522e+28 -1.9357559470287788e+14 -1.1275270082734746e+17 -1 +596 1.5393551892919980e+27 -1.0609896830361123e+24 3.2304907556927842e+33 1.9149162008437460e+24 9.0945373840632954e+25 9.9266358123952230e+17 1 +597 4.7185355124955368e+03 -1.3143176186243981e+14 -1.0711878169852942e+28 -2.2077827940386428e+24 3.0705075690345442e+08 -1.1552257357840478e+27 1 +598 -1.2098408003298644e-01 -7.5638193823766274e+26 -1.0157098100806418e+05 -1.9871408694643875e+13 4.9232376169556570e+04 6.5272666622335255e+19 -1 +599 6.6456897220948552e+16 1.1671232081364914e+30 -1.6796430143356678e+09 1.2947968583974581e-02 5.5633616569718062e+14 5.2356472534372549e+19 1 +600 -6.8849154113061295e+09 4.6958558245141248e+03 3.8279337237924548e+11 -4.8397445186679717e+04 -4.5629692155226085e+34 3.8956348129712734e+19 -1 +601 1.2316505620046138e+11 1.4048064890096517e+29 -5.7886106394723259e+26 9.1683047938306547e+13 6.3003910012271561e+23 1.4663690708666296e+18 1 +602 -5.2522626699338380e+22 3.9846710211018527e-01 -4.7465801038450678e+01 7.5531564796474325e+24 2.5986357596711153e+26 -1.2111386954123351e+24 -1 +603 2.3418523690988135e+21 -7.4870696106535941e+05 -1.5779857301391030e+04 1.8777280000955646e+05 1.2640345901924656e+13 -1.9071682937935509e+26 1 +604 1.0268172366330340e+24 -3.2723585372597847e+24 3.4885943390977021e+12 -1.0260490987731357e-03 -4.1677510487081402e+33 -9.6116247257291025e+14 1 +605 8.8983881908982330e+21 -2.8014307696024265e+26 -8.7496835671777148e-04 -3.4571459094151482e+17 -2.0707661757847423e+25 -3.3592925567630674e+28 1 +606 5.7220486609031568e+25 5.6060740327185596e-02 2.4081169656915663e-01 -1.0940780041324423e+01 8.1992502794407077e+25 5.5653980030029830e+25 -1 +607 6.2829729413395197e-01 1.0370795576003687e+25 -1.2420648054887312e+15 -2.5585932244908780e+15 7.3951457588440107e+31 2.1303329568103997e+25 1 +608 -1.2531137930393581e+14 5.5527145482934486e+26 -1.1138122858356673e+31 1.5630647538216403e+27 9.3451722637878179e+30 5.5655912958153516e+11 -1 +609 -1.1213982219946906e+29 -2.1543117337157788e+18 -4.3336259380910314e+29 2.0028739778857397e+11 -3.4696882531739041e+07 -3.8552308256652689e+19 1 +610 -1.3088693552342509e+20 1.3598629408477750e+14 -2.1031880647291206e+07 -2.4772689537581695e+31 1.2754270834548869e-03 -1.0813571923592317e+33 -1 +611 2.2160957591233080e+02 2.9407665408833243e+04 -1.3951233258962259e+05 -2.1349511599906986e-03 -5.3603139787320517e+29 -9.8599381450918620e+04 -1 +612 -8.6761034905344231e-02 1.2507235107714680e+29 -3.0107583122059470e+05 6.2917809406365041e+02 1.1895317097451183e+00 -1.3584724187325463e+07 1 +613 1.8896821485136230e+15 1.1238994592243837e-01 1.9427055859796906e+13 3.5535198691454824e+24 -2.2408482421508327e-04 -2.0620010749559849e-04 1 +614 3.0961042255235186e+34 8.9603125988524789e+22 3.7729271111462803e+30 4.4601297153400565e+31 -8.3047219405192020e+19 1.6817426647210573e+06 1 +615 -6.6242569254096106e+03 -4.0182800077867942e-01 1.1432712005985324e+20 -2.4508036298642692e+05 -1.5800374594531265e+33 -1.0799565800003807e+13 -1 +616 -1.7712931738047159e+28 4.9754207655335629e+17 2.9169154889324529e+32 9.8238007057316366e+28 1.0868887381162953e+22 -3.9287666740235052e+34 -1 +617 2.8455566871069553e+21 -2.9903318118403121e+28 7.6625916695380642e+27 2.2487089624404691e+23 -7.0361186896483911e+11 8.5332405145200767e+01 1 +618 -3.0348353300408455e+00 -3.0813086505519344e+27 1.3684489166427485e+20 -1.0350315785527812e+01 1.0682662711845102e+23 -8.9086538167746232e+20 -1 +619 6.4441567753388553e+22 -2.5084009114874739e+33 -3.3832506683672363e+11 -6.4422238791127029e+00 -4.3947427164900541e+25 2.0474372496749268e+20 1 +620 -1.0771899082754172e+11 -3.1039223007079409e+24 -1.2872386660136695e+32 -3.6448177258226066e+09 -6.6193418810190192e+34 -1.8519662107437633e+31 1 +621 3.1893050534442008e+22 -1.3143639218474382e+33 2.6049977583543560e+33 -7.8181321123317479e-02 4.8297200960862239e+04 -1.0729671182579330e+14 1 +622 -9.4106359512868945e+12 -2.2741349234417575e+21 -3.4477527010570225e+18 1.4326342555852756e+07 -6.4130664227165491e+17 -3.0187278427204770e+08 -1 +623 -7.0250596511817098e+30 8.7560928013122444e+20 1.3329811412312762e+29 1.8283631900316239e+29 -9.5958468345953088e+02 -4.3534690181824286e+05 -1 +624 3.3582831875019404e+32 -7.0042192202026208e+11 5.7322461933148189e-03 5.4082714405157065e+29 6.5161975770835340e+15 -5.0124046426281434e+24 1 +625 2.3500907279970515e-01 1.7368607319418714e+16 7.4073031398608923e+07 2.2385044732648851e+29 1.7478056852410937e+03 -8.6509971821494058e-02 -1 +626 4.1755330793510885e+09 1.6399104706829609e+06 -4.7837317615889233e+08 -3.8474412583753466e+28 1.0171950201051892e+01 9.7953636176015060e+10 -1 +627 5.7624499903523463e-01 3.8921122820720293e+03 2.4632718376962362e+27 6.4172993406397090e+12 -6.5326010737631429e+19 -8.9877235799047168e+18 -1 +628 5.9374150904904664e+08 1.0704264058797143e-01 5.5840781597188329e+26 -2.2880527948473421e+20 -3.3205143359162221e+00 -8.6634075106878853e+08 -1 +629 1.8607522834613632e+30 7.7296032862601536e+34 5.1626529491657937e+08 5.7638164896081822e+19 2.4490721209376766e+13 -3.7664337490232717e+26 1 +630 -3.7356618015094230e+23 9.4048413432826028e+24 -1.1821878746789821e+01 3.0134297284399094e+06 4.3822684733485746e+08 1.5736994470903986e-03 1 +631 -1.6386011563495103e+12 -3.8630500685494721e+20 -4.0032711877814463e+03 -9.9792136141281200e+15 -4.8543203707375577e+29 -1.0820550677634600e+14 1 +632 4.0604524083839491e+28 1.8704207855379943e-03 1.4837102489559495e+23 -2.8534707709980269e+32 -3.4419950898154385e+23 -1.6602007112219453e+13 -1 +633 -2.0478774348772001e+09 3.2995134320864754e+34 3.9011550636309435e-02 7.0916451406449190e+17 3.9070963376080518e+28 -7.3136283672801152e+16 1 +634 -1.0335159834911430e+34 -3.2154136433760565e+22 -7.7421681361336564e+26 6.2964736907327851e+32 -2.3356277686321475e+30 6.3229282327441654e+18 -1 +635 2.1089328648671262e+11 -6.3759893384911315e+19 6.4553722313417897e+30 1.6590017546652256e+00 -9.9254014807872000e+14 8.5657158965152930e+11 1 +636 -2.2308618085491477e+05 -6.7659299297489190e+08 -5.7128162200502319e+09 -1.0821595669483569e-02 1.6619985296694458e+03 7.4111098264867172e+09 -1 +637 -3.2915601181245759e+26 -7.9956174045803750e+21 -1.9876878945043194e+14 8.2343324953773091e-04 -1.0579044414345914e+05 8.5050132171566206e-02 -1 +638 -1.2181076195152590e+20 2.5395526506718260e+15 2.6577550563906757e+06 -1.6947618383592432e+19 -7.6965431539474837e+06 2.5605054427948918e+13 1 +639 8.4931443258425391e+13 -1.5282096420527960e+15 3.6130512341157935e-03 5.1969244478203213e+08 4.6521235457100110e+11 -2.0680151121468043e+21 1 +640 8.6604211049324851e+06 1.9926423384904275e+12 8.8566181467420600e+15 -2.1567223038430092e+28 2.6747689755320996e+12 -7.6039971074761072e+16 1 +641 2.8691051791673077e+33 -5.4058516363261824e+16 3.2740807240380594e+06 3.0047577538422645e+26 5.2822078456389437e+18 -3.4909782887261831e+32 1 +642 4.4410117373864670e+32 -1.7002603405080459e+04 1.7239913870500611e+25 -3.6397512914094454e+27 -4.4150543502493856e+03 -7.4455101276591634e-04 -1 +643 -9.0753655099420950e+14 -9.5362283535580517e-01 4.8995102032291493e-01 -9.9799791962180532e+28 8.2786943032792620e+06 -2.0531692319287253e+26 1 +644 2.2111548436245050e+02 1.3596853761458773e+22 -2.7513230394348817e+01 -6.0190265856232897e-02 1.1015644996648116e+21 -4.2855953432653852e+31 1 +645 1.5560111901609357e+03 -1.7267399122796678e+15 1.5798974526297513e-02 9.5234798619252988e+20 -8.4976101006394522e-01 4.9921545735531058e+06 1 +646 3.1954386261255965e+24 1.7194859801927014e+21 1.5536218056675104e+25 2.4006865622877477e+13 2.1780339192896591e+33 2.8086581084897204e+25 1 +647 5.4194609678997202e+33 5.8640361283614368e+16 1.1806784312584308e+25 9.6770867404139027e-01 -1.7846515456877179e+28 3.2260716703760824e+18 -1 +648 1.5855403108353119e+09 -4.8362118719133830e+17 -2.2985302093736318e+08 -1.0591894998626456e+23 8.9488372868575445e+19 1.9379761649778633e+23 1 +649 2.3240755336648020e+25 -4.4691550087622864e+10 5.9711879528218939e+04 -2.6036900203714371e+08 -1.8723036613228010e+33 -9.6387881228621984e+16 1 +650 -6.2135477055023415e-04 4.4034632716457769e+18 3.3913191609405109e+31 8.1994286176438665e+08 -8.1755133034927452e+33 -2.5753012675865318e+05 -1 +651 8.7771241711173675e-03 2.0675134028967842e+26 -1.7847209223286798e+06 3.9093964267217342e-03 -6.4855190315524767e+34 1.3272918276535537e-03 -1 +652 2.3007871293824473e+13 2.4291222681012031e+20 8.0405475348205063e+33 1.3865567561570207e+32 -1.7835564311140051e+25 9.3613400533629805e+12 1 +653 9.2159266421278444e+21 -3.1680698371425887e+27 -5.7220489816536286e+23 1.8953674321282862e+23 1.6356833563082383e+30 -1.5396024233472848e+26 -1 +654 -4.4519958062556768e+23 2.5750259105531401e-02 4.4498462660070199e+03 3.6879436970786401e+05 5.3282699276594449e+03 -2.9455626873953857e+10 -1 +655 -9.1336267965906469e+13 -5.4433362365358491e+28 1.5127381515516611e+32 7.7855890305410529e-04 -5.0863449000235605e+08 -7.6570886376570842e+17 1 +656 8.0434844852842314e+21 1.2002299745349383e+32 2.4440563950276074e+12 9.4353666268545074e+31 4.5036588082432718e+02 3.8073737020239937e+00 1 +657 9.6079741326998841e-03 -4.9951580948625437e+20 1.1017128896180366e+28 -6.8407300579993564e+31 -1.5453954130934391e+30 2.2969064423645519e-02 -1 +658 1.0173155156407246e+24 -6.1428848380142681e+07 9.5577413722927100e+05 -3.6757670012825955e-03 -1.8222890667039770e+04 -1.6205074846331469e+04 1 +659 1.0855960397701551e+24 1.1666199528531499e+02 -1.6625208368886574e+13 2.3744535717748078e+21 -1.4621172970609289e+03 1.0475261631292998e+25 -1 +660 1.4769440857314358e-03 1.0861523321307905e+15 4.2826663779059835e+06 8.5284478923804134e+17 6.3263114761560133e+31 4.3532185257932617e+31 -1 +661 -3.4462824930564850e-02 3.4396989994827905e-04 -3.1944547919263758e+04 -1.2794593172838691e+14 1.3474934677024573e+19 3.9062122094157773e+12 1 +662 1.3472848864503426e+30 7.0616613513789471e-03 -1.7619331023299108e+21 5.8860612343657548e+27 6.5055663149817102e+19 -3.9351859167310254e+32 1 +663 2.4892345448212269e+33 -8.9788027889730948e-01 4.8982057512427092e+24 4.5955118619504615e-01 9.6605685369582708e-03 1.2251982924792833e+25 -1 +664 2.1181185129079204e+03 -4.0886764552669874e-02 9.3387735182707764e+31 1.8871236863860456e+25 6.8656304300566809e+05 -3.0671739987384694e+28 -1 +665 -7.8026155782797852e+00 1.2269695993129361e-02 9.4873793973728083e+05 -2.3751118381656808e+00 3.0312215163717813e+31 3.5687468032872300e+12 1 +666 -1.3677770302166655e+21 -4.5590651309176106e-01 3.1277121310232545e+15 -4.4799906894011688e+09 -2.3484646023938171e+28 -5.3820718637827415e+26 -1 +667 -2.0631380739312205e+15 -2.2150488573650782e+34 -5.0357270701271069e+32 -2.3717145234536264e+18 2.9345150697354169e+34 8.1393482600358714e+21 -1 +668 2.6812593461292211e+27 -7.7981695603270508e+12 -7.4403641741183552e+24 2.7637936534001498e-02 -1.6547664295343625e+11 -1.2358651746348698e+02 -1 +669 -8.3556487099871186e+20 -3.4634456254803885e+34 6.9087187712879607e+25 2.5506787221088794e+11 3.4698545483377858e+22 -2.1252155294394154e+25 1 +670 -2.9685730450353883e+06 7.9425694202762570e+03 2.7465351782764867e+22 2.0519093171370987e+03 1.6978267577415619e+02 -1.2836666764186702e+01 -1 +671 -1.9356980792892845e+21 3.1258839464213360e+29 -2.0394507158471630e+15 -6.9715157711517838e+02 -1.4950198645472318e+07 -1.3172688674907241e+30 -1 +672 2.3945564248635394e+04 5.3276872272720367e+26 -1.4444775988226218e+32 1.6179623907627010e+10 -2.2311861737813000e+15 1.7469144791504287e+06 1 +673 -1.1765057885578018e+34 2.2087673479171980e+15 -1.6158394734103203e+09 -1.4846983703818383e+09 1.1004390834024315e+09 1.2451190203232146e-01 1 +674 1.3304209128489092e-02 -2.9665714911278334e+24 2.3183430395463143e+00 -1.4522430431427142e+19 1.3673146659673288e+20 7.7880724793057889e+03 -1 +675 -5.1362195035254672e+02 6.4336518595187325e-03 -6.7967537250428722e+02 4.6884202134791657e+07 2.4220802307726105e+25 -1.4640413141664122e+10 -1 +676 6.4365827228425102e+26 -1.0651677666369980e+16 -3.3185350643844362e-03 -1.8355992137627987e+17 -1.9334182687427266e+34 1.6925219168213832e+26 -1 +677 4.2468247546517209e+27 -4.6402755623760220e+27 3.9266084583790466e+11 5.7149848392129485e-03 -2.1458134347684860e+09 5.5225751521062031e+06 1 +678 -3.5663028675732678e+30 -1.2124868398201308e+18 -1.8728025541502858e+29 1.5355074193366873e+01 1.0520324525346723e+30 -9.1215370881264448e+16 -1 +679 -5.4367049377298808e+03 -5.4681199587572358e+28 -1.1398695645031496e+24 -1.5283836793263295e-01 -9.9501223477448192e-02 1.1785560433277918e+24 -1 +680 -4.9407254519498875e+33 6.3056366135856444e+29 -2.2399326503353138e+27 2.9764985821356443e+28 -1.0124133183154957e+09 -2.0008191295987746e+08 -1 +681 -3.8567659810733606e+14 1.0361333992520068e-02 -2.0739525689876597e+14 6.7188342109023079e+25 -1.2406471829995790e+33 3.4131444587887509e+31 1 +682 -9.3329495857143172e+01 -2.0318287050709794e+22 1.1792924808234913e+23 -4.3336917260138289e+03 7.2786967870048600e+15 -1.7266153090405747e+34 -1 +683 -1.0218421811340889e+05 -1.1247291119582876e+32 5.3402893536299029e-03 -5.4024020108258445e+13 -4.9494450612768483e+25 -9.3011794848845696e+16 1 +684 -3.4837034373309919e+27 -1.7744391987970997e+07 4.3365092423998489e+24 -8.5647000063814229e+28 4.7350951104291094e+13 2.8783234280665842e+19 1 +685 9.4570896063620128e+24 2.0171642192538644e+26 -5.6864921177874692e+01 -2.2192886490981726e+33 4.4328113484238407e+22 -2.8364573877513816e+04 -1 +686 -3.8895837492702029e-01 -5.0919915756330621e+08 -6.7054098607535269e+24 1.0326977142998120e-01 -1.4857649238870607e+01 2.5905207866146931e+00 -1 +687 -1.9185570906758382e+20 -1.7015900329311939e+25 -3.9915318067802972e+18 -2.7192029705329611e+27 7.0211882927883454e+24 -1.8023457597817987e+00 1 +688 -1.4775573370067680e+26 -4.3776067976955080e+15 5.3257137256688639e+34 -1.7622316534369746e+12 -9.4954360143928525e+17 -1.4084642120037699e+29 -1 +689 2.6859429593114014e+11 4.0290085979834656e+10 3.7834223208869661e+28 5.3978011549953680e+16 1.6082079136912536e+05 2.1386400994565243e+10 -1 +690 3.5858667738382259e+17 -5.5938908017939939e+03 4.1237646307524912e+21 -4.4351126685293025e+29 -6.1807467567911572e+12 -4.8956446549303294e+14 -1 +691 -1.1635110329150959e+26 1.2610758006078470e+19 -1.8346603601445990e+24 -4.0231714613046488e+22 -1.1007538563756958e+15 -5.3768226663449473e+21 1 +692 -6.9887133728790690e+15 -7.4805089338617677e+17 -5.1135532412677769e+25 5.0263771655675180e+22 1.8359446509515947e+03 8.1017370910731519e+31 -1 +693 2.2580989719252387e+28 -5.2236679402171600e+10 1.0268484054177095e-02 3.3138376123301480e+06 -8.0674275206793298e+24 1.0981869613526095e+32 -1 +694 -1.6179305331403186e+19 -9.3921545127004503e+33 6.7091918566883510e+02 -7.7396320822202561e+03 1.2454139671136597e+00 -4.1303003108811632e+07 1 +695 2.8037248079317134e-01 -6.4608492702146339e+08 2.8190735827134543e-02 2.5111626154743957e+27 -9.3956325867884653e+22 -2.6092416433019639e+12 1 +696 2.0282552523571677e+00 5.6900872920913905e+27 -3.8818785456088832e+28 -3.3195741204427891e+12 3.5003478101805408e+16 1.7493948428633630e+16 1 +697 -9.8108702371275052e+05 3.8376735696694850e+23 3.4052153145057791e+03 6.9337182507684246e+31 7.6513254426612811e+26 -6.0160354258722475e-04 -1 +698 -4.1006079303857650e+03 -2.7962419115807298e+23 -5.1173354425062669e+14 -1.3053100660427230e-01 3.6758423534779761e-01 -3.6941062546648471e+04 -1 +699 1.0924976285440119e+33 3.0869731873410270e+26 -1.9446763098626315e+02 9.6735226163831512e+31 4.8254138786665705e+31 1.0082298760624774e+03 1 +700 -6.5860193389917807e+00 -4.5384795653217980e+15 7.3524228620881314e+19 7.4967472117431046e+21 -7.3880706611539453e+12 -2.6115302804167941e+20 -1 +701 -2.9752310915272764e+28 -9.8653585459971799e+25 -2.9447616776484238e+00 -6.0654582707552879e+02 -4.4272294986050162e+20 -1.8944794050108960e-02 1 +702 -7.4625705519879107e+20 -9.6622450681962528e+28 -7.2012629178625061e+25 -4.2868368153708329e+22 1.8438960831461248e-03 -1.2542094744139076e+23 -1 +703 1.6448078977535427e+10 -2.0033286346343644e+28 -1.9529450133670492e+16 3.4589512364740671e+01 3.7275469767940096e+27 5.4120684265832648e+24 -1 +704 -6.5431425658044130e+15 -5.3287370027506665e+11 1.2621396298310364e+26 8.9149498313339626e-02 -4.0702479248788699e+34 9.7352683617156600e+01 1 +705 1.6504353433974414e+13 -1.8080653092074075e+09 -1.5920693146334514e+24 -6.7355317594120760e+15 -2.1893909764186584e+12 7.6844682605165884e+25 -1 +706 -5.3103457928994802e+33 -9.9740968117173763e+31 3.1967699401849130e+25 9.4841736612033496e+30 -3.4314253690225859e+22 -4.7370279053903249e+25 -1 +707 2.7775513424254947e+33 8.8937294930746351e+21 -2.4330267846749595e+05 5.1854887071004177e-02 7.4417333964893260e+01 -9.7471691869393296e+22 1 +708 6.7232653942759934e+31 -1.0636793199349187e+26 7.4836611998374690e+02 3.3897351710184068e+24 2.4419731813636648e+01 1.8517813127572674e+02 1 +709 6.1469725088611123e+31 6.7528995028932800e+27 6.3187003371442643e+00 -3.1806100581176858e+17 3.8241975113585234e+29 2.3287979004182630e+17 1 +710 -4.7619006916190853e+09 -3.7606336524762660e+06 3.4762625238733570e+15 4.5773431920386086e+17 -1.3271849216133832e+13 -2.4369048658180839e+02 1 +711 -1.3900430208189263e+01 -2.7904543700858005e+29 -5.1286558099639050e+26 -2.8424484400387467e+26 1.4803619787290710e+01 1.9095779158593792e+20 -1 +712 -1.6887494490290288e+05 3.4812205369825218e+25 1.4246577115501005e+00 2.3524027885398436e+08 -6.1940112750500306e-03 1.1594319319165554e-02 -1 +713 2.9300597500194574e+25 -9.6440507191589475e-02 -2.9720504429434390e+04 -1.7652049198583223e+23 -6.1547713806478683e+01 2.3427691805124985e+19 -1 +714 1.5455499154605437e+06 2.0453140900656275e+17 -1.3255859620035627e+33 8.5289329938066160e+15 1.1898458468186788e+33 2.1958339338646127e+20 -1 +715 1.7589687860326525e+26 -2.2730754406975590e+20 -1.3785567780561830e+15 8.9318388091587153e-02 1.1518684719509832e+24 -8.1958904100470300e+14 -1 +716 -1.0102512427153324e+33 -2.5495947552263843e+31 2.0590707299134991e+29 2.5035899969197488e+21 -4.3915479809127658e+20 -3.5753597100449585e+10 1 +717 3.7112919372364487e+06 4.9370505428708084e+29 -4.4586271468222964e+00 1.2188165506971080e+33 3.4208362649657249e+07 6.9394735554502250e+20 -1 +718 1.5661459528152858e+04 9.1374162081247601e+29 8.5006322826596915e+24 -5.7042108650769241e+07 4.6188709393051770e+00 7.8868102038172368e+30 1 +719 -2.6376079225198463e+25 -1.7699728155014374e+10 -1.9570564745425800e+04 5.6815204075656354e+00 2.1053586492187456e+14 7.5988460292041385e-04 -1 +720 1.8045991196636031e+25 1.3482304169204918e+25 6.8454581522689468e+10 4.0175648732344642e+04 -8.0103361240387012e+31 -2.4379254712295457e+13 -1 +721 -1.6277445599699328e+16 4.9102679352921426e+30 -1.7064572598903631e-03 -1.5248083457116521e-02 -1.2781709645452585e+02 2.5887626953405770e+27 1 +722 -6.2787427504814154e+29 -3.9629157224433525e+15 -1.7097438594914713e+13 4.9938883268473570e+15 6.9802709181251157e+03 1.0736376484141722e+29 1 +723 9.0628361479713874e+33 -7.1723100398404597e+01 -1.9536823102862434e+12 -1.8154059727816056e+06 -1.6990711158317082e+00 -4.0772041671582854e+17 1 +724 -1.4788396773989540e+10 -5.9245733922601151e-01 5.1583631927033580e+18 4.1591437830365030e+03 -2.0225730289226155e+09 1.4681589457973746e+30 1 +725 -1.3301478527436070e+34 4.1341211411005506e+20 5.2514196549481419e+31 1.4516683134948255e+24 -5.4175409896731330e+05 -4.7874970530398492e-02 -1 +726 -3.1663430371145714e+04 -3.2247132307988417e+05 2.5531882548665563e-02 1.2506171893470480e+08 -4.1293017898433840e+16 -1.1026575628351297e+30 -1 +727 3.9507720606552029e+09 -4.9272141695163021e+17 4.3416364129205898e+24 2.4584109134660306e+00 -2.4933942790711367e+24 -1.9149527386328166e+19 -1 +728 -1.4276962313663567e+32 1.7865175042906198e+32 -2.5981574233612645e+07 1.9021778887461352e+20 1.3214334237481897e+18 1.0495773835079661e+18 -1 +729 -1.4584169627006373e+32 2.0557759701873447e+12 -1.9362622287297663e+06 2.9968723461697130e+19 -7.9170978522149181e-04 -3.4678901222632870e+21 -1 +730 2.0423375335028334e+29 -1.7404660051474416e+03 -1.5749570081096244e+33 -1.0858236794126980e-02 4.1312614193882645e+15 -3.9162720051663497e+26 1 +731 1.2691766339567998e+01 1.3115451949703752e+16 2.7735884592057555e+34 -3.4854858199764528e+30 -4.7464805889761513e-02 -2.2318464460483778e+00 -1 +732 -4.5055392694346995e+17 2.2941324780729790e+09 1.1386171622393127e+10 -1.0511800282679014e+05 -4.8491119537926308e-01 1.1613781052130268e-01 1 +733 7.1765248315370944e+30 4.3532397013888335e+12 -6.1491543145363353e+22 2.9675945602246240e+15 -7.2550192748751926e+09 2.8737570684686326e+27 -1 +734 8.6351232439815332e+18 2.2105045516615067e+24 9.7053841650881055e+12 8.8178123544302868e+22 2.9379081922814250e+04 -3.8900814901035321e+11 1 +735 5.2504253797825183e+30 -2.8730681743341571e+20 -2.1657701727116985e+12 1.4609588561862373e+08 7.4622135017986014e+05 1.5528062278185075e+00 1 +736 -2.4360849378655888e+07 -1.1456046780131332e+10 -5.3257009078277361e+25 4.3100419858839404e+11 -1.0506390518192919e+18 -4.7030002549497463e-02 -1 +737 -9.2443220979954627e+28 -2.2928925470924940e+09 -2.7397413073180244e+32 -7.7290567874657720e+15 1.9680730899351263e+03 3.0152346361575963e+31 -1 +738 3.1192312695612798e+27 2.2505325847086989e+05 -9.7694509480078328e+08 -3.3019946319497912e+18 -7.9509335987006942e+33 -8.0320240820704581e+04 -1 +739 -1.0352572495165819e+05 -2.1075498904790251e+29 3.7147245990708063e+05 3.3228774450825781e+13 -1.4494889393325670e+22 2.8206328680990904e+18 1 +740 2.0795523701931871e+05 6.5649473857736178e+25 -3.0463425250250783e+23 1.9899096181127782e+18 2.4712482327985107e+11 -1.1795880266625745e+23 1 +741 1.3600296577398856e+14 -2.6181035787875697e+26 -6.1894600857524991e+27 -1.3062824924497923e+04 -4.7357576745590272e+17 5.7661409138850459e+31 -1 +742 -1.9194262387750427e+11 -8.4830105103525120e+15 8.4491620366637177e+20 5.0235567598220780e+06 -4.3424059778560109e-01 2.5690602978459379e+29 1 +743 -1.9531250577148126e+34 2.1093140154891458e+09 2.1411180554853080e+26 -5.6071492303915787e+08 6.5376849481592779e+09 -7.4810436287439863e+12 -1 +744 -2.4639531823402970e+24 -9.4729007023442654e+30 1.5306528583695737e-02 -3.4249924568072038e+02 -1.5240796980913459e+17 4.1601993075356032e+17 1 +745 -2.0381504819640318e+24 -8.0978611503648537e+05 5.5674425805955054e+29 -1.6491798827252351e+27 -8.1016478612971009e+33 -1.9511194584206132e-03 -1 +746 1.8471379856982821e+01 -3.2904909444735758e+23 -4.2126357155046490e-01 -2.8564651705665769e+14 4.1757456603578147e+33 1.1186398876994388e+19 -1 +747 -9.3709245082908989e+32 -1.7022037375217075e+12 -2.6294125520548828e+29 1.5542439622704851e+28 -1.0956726841924691e+18 4.1027124907574825e+15 -1 +748 2.3872396882591307e+04 -1.0911345563026587e+10 -7.1602466631986502e+24 4.7801292437830522e+23 -3.4307456008526356e+19 -5.1363777094730249e+26 1 +749 7.9278813816090394e+06 7.4824851742645429e-02 4.8978868254294413e+23 -4.1209705131893308e+00 -6.6412685255396834e+25 -2.1342894016427600e+23 -1 +750 -2.0544832741526050e+15 2.4325171372574501e+07 -1.0737938343585984e+30 1.4412006554215055e+13 1.1969538599570396e+27 -5.0945438943449770e+15 1 +751 3.3185401353789198e+08 6.2384505270892981e+11 -1.6455666086173622e+01 7.4864145208549593e+05 -3.6390303422267102e+13 2.3291988114173828e+27 -1 +752 -3.1407652454981636e+06 -7.4960746378426522e+27 -1.5425353233055415e+31 8.0033490776027946e+09 -2.4096488502944298e+09 -4.8221360281433624e-02 -1 +753 3.1805918869127811e+02 -2.8836734198086438e+33 1.0866848363773833e+00 -1.7681888745308062e-03 -5.1194052624944151e+26 6.3688058630655214e+19 1 +754 -1.8953649798910474e+32 1.6633558880052214e+21 -3.2926994728767864e+21 3.2470982198333392e+16 -2.7527149546815871e-02 3.9396342824785004e+09 -1 +755 -2.8613823113061428e+07 3.1464679142774800e+20 9.4245248659110324e+33 4.5067638838568671e+00 -2.7430066321234697e+20 3.2700276652691833e+25 1 +756 -2.7168225062080615e+04 -1.1752497296484414e+05 4.0548100380319840e+15 2.0883334459923800e-01 1.3111834205265834e+29 2.3125637779425552e+29 1 +757 8.4155187649584960e+15 1.1538692868680609e+24 7.1585172236171560e+16 -6.0739484214111515e+20 1.0385817509447480e+20 5.6175199894258085e+00 1 +758 -6.4350814998079668e+12 -3.8826159467819184e+26 -1.9717346623590670e+09 4.1729547508600721e+04 -2.3929091857005188e+32 1.4095191511412960e+07 1 +759 2.5207896312699251e+30 -2.5195841922460460e+01 -2.8803140255563192e+33 1.1965069537120758e+29 1.7362296390347083e+06 1.6077599094317120e+34 -1 +760 8.1518553399600320e+16 -4.9161236118200250e+14 5.8160030556486641e+12 2.3745288977881745e+30 -2.8433780848720006e+32 8.1899682237273125e+24 1 +761 -1.9447279736767014e+04 -3.7419712070391124e+32 8.3558062833419421e+30 2.4031311714292412e+16 5.1404275232642100e+14 -3.5052600988438988e+10 1 +762 -1.7807074903335948e+07 3.4267595844784349e+07 -3.9549639278833461e+03 -4.0014123871087268e+21 -4.3741966650059971e+04 -1.3446995849463425e+20 1 +763 4.9484019475294275e+14 -2.0853718841843972e+24 -5.5870192345599219e+26 2.4134981233978271e+08 5.5996474219416079e+01 -1.5078226603595480e+15 -1 +764 -8.3651073358348571e+06 -3.9449734806993888e+00 -5.9834863121598003e+00 -3.5343758889608164e+09 3.2831172907036567e+30 -1.7351873862526170e+06 1 +765 1.4219312800517352e+31 3.1175647842388809e+07 -2.4318942850187740e+16 2.5353153548874252e+03 -1.1253032829487152e+05 -1.0856527746843006e+17 1 +766 2.4599293997126868e+08 4.7437907766603969e+13 3.0443289403301636e+10 -5.6841346528857924e+30 7.6929205025337954e-02 7.5542880126089265e+04 -1 +767 2.9430232761238561e+23 1.1304044083977278e+21 1.0760793064705302e+21 3.1583471098806490e+17 -6.2468579951644246e+19 -4.6437871606663626e+05 -1 +768 7.3293540968602605e+22 -9.1380968968690130e+22 3.1917204668573824e+16 -2.1457272752300888e+14 -4.5177398063254176e+20 -1.9044809133190165e+23 1 +769 1.3236446227416762e+34 -6.2255443091290935e+34 1.8878595518999739e+00 -4.0503914423965917e+28 -3.3216005056152020e+15 -1.4601752773363472e+02 -1 +770 -4.4017648904784417e+08 -2.5298671439231110e+08 -6.9039391898416925e+14 2.2933647105682613e+13 -1.2675731756242450e+25 6.6304256935233537e+31 -1 +771 -5.4854665699677506e+29 -5.8788290846476625e+14 -4.9637222722205456e+33 4.1778590533372534e-01 1.2905531673226395e+34 5.7715958495158520e+09 -1 +772 2.7535521509945166e-03 5.1765215340627569e+18 1.1275593190344286e+33 2.3400305130983577e+09 8.0483988037028132e+32 9.8038684342914433e+31 1 +773 1.5717427618735377e+05 5.9432125027798259e-02 5.5054419824269955e-03 -2.4332533001554032e+26 4.4867406096537498e+18 -8.7624665876639160e+11 1 +774 -5.3048754463436730e+30 1.9431660628958255e+07 -1.2419136926008082e+02 -1.8852052060901031e+27 8.8090289166162596e+32 4.5109393270883619e-02 1 +775 1.1614067925849654e+24 3.4744862723234946e+03 1.8882494139816812e+08 -5.0068783330673225e+07 1.3172942244478314e+16 1.2914654154074974e+24 -1 +776 -4.1334019334928136e+32 -6.7531621492698682e+12 4.1086312490701023e+06 1.2503541534259600e+16 6.0785897380348456e+02 8.3515804192007663e+23 1 +777 1.0584050043593342e-02 -2.1094623781766786e+29 3.6737205453129427e+03 4.0689224358724869e+10 -1.5165522081882325e+29 -4.8168923904866097e+02 1 +778 1.2785703763396358e+09 5.8276473434364759e+20 -1.7220237002428771e+21 -7.3217782154258327e+33 -2.5747229046811326e+05 1.4350856013457874e+21 -1 +779 2.0331560782912480e+15 -1.4385562473663193e+33 -1.0519644192184320e+30 -6.3038784278893457e+12 6.2489403738775042e+00 7.1215106169050726e+18 -1 +780 -5.8559987109147438e+13 3.7987314586959050e+24 4.0648937402477640e+08 2.9685808483215187e+27 2.1137678392031059e+07 -1.1287781646633167e+24 -1 +781 -6.2011668252066936e+27 -1.5985062062962885e+19 -1.0928293268124078e+11 -4.6244632785402962e-01 2.8054013763335347e+07 -1.8915435903056783e-02 -1 +782 -2.7579129425786300e+14 7.8828245027353500e+13 6.2448858893690210e+15 -2.1053800406577683e+17 -1.7302686565456206e+23 4.9792713561361538e+01 -1 +783 1.7664193274218755e+12 3.0541677753755145e+00 7.1457607559965877e+05 -9.8107497547115301e+01 7.8244429717244832e+28 1.1187753074161197e+17 1 +784 -3.2936737230716784e+29 -6.4971097385957629e+31 8.8094262979312400e+14 -5.1147613505585792e+17 2.3831815890143248e+19 1.4165081808581149e+11 -1 +785 5.7151663750795454e+32 4.7825531025714615e-02 9.0877007243077314e+08 2.8091827607291489e+03 -1.4266610818315486e+22 1.1177136922384584e+29 -1 +786 -2.9659783465606304e+16 2.8292601485953106e+18 -3.2963148986496075e+14 2.7280598354742786e+11 1.2867386141322054e+19 3.9177135156004397e+01 1 +787 1.3440610028630292e+09 2.2295796551033335e+23 -3.0828348841033097e+19 3.2152234290361655e+15 4.0648745253952623e-01 -1.7944136016393749e+34 1 +788 1.3009917370370842e+10 1.1419188397723571e+33 2.0682022534994958e+30 -4.8196378522947028e+32 -2.9589336065554785e-03 4.3911537444135337e+05 -1 +789 -4.1843157228623664e+16 4.9243720757155552e+27 -6.9448721334459868e+29 -4.2988376905285910e+05 2.6104972361416463e+25 -1.4716031503553735e+04 1 +790 -1.9993149266084459e-01 2.7118403894866943e+09 1.3109487350886508e+18 2.8495796169620827e+23 4.8368858778774365e+03 -8.2853149206838250e+07 -1 +791 1.0705208291134134e+07 4.3800643609516753e+32 -1.2532746901828692e+23 4.9750444987087270e+01 -4.8979175514320433e+06 1.9899840595208680e+16 1 +792 -1.0435161282574006e+02 5.6105426686065675e+03 -1.9389067008120159e+10 8.5947168850135246e+20 -9.3141314264391161e+33 3.7287487342092987e+10 1 +793 3.7717563253886487e+21 -1.4678289770692154e+34 1.1597718592328058e+10 1.3973779707058767e+30 6.7487215043667250e+13 -1.7726535898727835e+24 1 +794 3.4255197843877704e+18 -1.3985577772605983e+21 -4.0812986603378109e+13 -1.3702332532732800e+17 7.0404619084768656e+13 5.3540530709170019e+32 -1 +795 2.5192027467635612e+00 6.9529982234349577e+00 -1.1066478437763582e+01 -1.4240810062264679e+06 2.2421474939625674e-01 6.4709863051986191e+06 -1 +796 -5.5418707725112100e+15 7.7647607113070250e+28 4.6103738634141672e+30 7.5915119953477583e+28 2.2382097337818404e+28 4.9760849355836841e+11 -1 +797 -3.2221637230377188e+13 -1.9190043870901081e+02 -7.4546751922415674e+08 2.2044308654894820e+21 -2.4521156292489673e+21 -1.5009987135101752e-01 1 +798 1.1002350146800300e+14 -1.9679058712071584e+32 -4.1605797961451330e+01 -4.3699622789280344e+04 3.4865594428584625e+10 -1.9003692921844598e+32 1 +799 1.4204685683905858e+19 4.4520799019930139e+21 4.1737800125332102e+06 1.5970703363537484e+03 2.6365956465920013e+32 -1.2179700563721411e+14 1 +800 1.2652018822999858e+03 -3.7963322908750580e+22 9.4785876764489551e+11 2.4618730817621798e+17 1.0933997705950350e+31 7.8336265993063425e+27 -1 +801 -3.6839557791502085e+06 -4.7742164980108312e+13 9.5439265193309512e+18 8.5780711887443033e+00 1.9730097368682484e+31 1.7316950447638143e+33 1 +802 2.5713770503850442e+17 1.0017234482796208e+29 3.2743207082429246e-03 3.7159034139513672e+34 -1.8938055759201725e+03 9.8830586170625196e+32 1 +803 -3.9437319555186178e+06 -5.2588437272248255e+27 -1.4243872330333740e+18 1.2532878864178616e+19 4.5087008177325194e-01 6.1195679593570557e+10 -1 +804 -8.7881422393452411e+00 3.3083128761447105e+00 3.0353618781151929e+32 -2.5910995706153192e+16 1.5598799763626893e+19 3.2729138565842025e-01 1 +805 -2.5027514654019279e+32 4.5144622067763505e+20 4.2045163018438024e+20 1.1554924365052645e+22 -1.4588825323811461e+03 8.9711268459871292e+07 -1 +806 1.9904722575036190e+15 5.1964302189635096e+21 5.5839695040327818e+01 -3.2483269575369707e+32 6.8207093044007050e-01 1.1891281287972898e+24 -1 +807 1.1718041894258192e+33 1.5546144629067631e+14 2.6781346289797557e+03 3.6558924871797468e+32 -6.9971524932539864e-01 1.3477752878012186e+01 1 +808 6.6897618873696448e+16 -2.0613902953226056e+07 -2.1300795632758707e+24 3.0144438243632584e+10 -5.4911472289762169e+04 -2.7013579943010118e+03 -1 +809 8.6117575732630707e+10 -1.8510892341882847e+24 -2.5982583260337549e+17 9.9970078070034964e+29 -3.2488270338078438e+12 -7.6749511832726292e+18 1 +810 1.6301952217741414e+17 -7.8971916832636832e+05 9.5581245697572012e+02 -2.5174399146746996e+20 -2.3077606685570262e+30 -4.5298824004163504e+07 -1 +811 -3.2509152528208810e+15 -1.9070882339431819e+01 -8.4908540034389901e+19 2.0417137480788712e+15 -7.2801331893858936e+04 1.8060661342050972e+10 -1 +812 -4.0279572227299977e+06 7.1645674160519608e+18 -8.1916191852594635e+24 1.5148552055289112e+27 9.3633252716633512e+14 5.8250289755763725e+29 -1 +813 8.6497770285058088e+27 1.5087788376548224e+03 -2.4239201138045523e+07 -3.5187305801968268e+25 -4.8659494529488116e+11 6.4269650008245839e+32 -1 +814 -6.2054525050776482e+08 1.3036031048710788e+05 2.5065040593883088e+06 3.8561265536751986e+08 5.0829172404729948e+21 -8.9415646940081150e+15 -1 +815 -5.3910187368130580e-01 -2.3544571578381957e+32 2.0537889487210908e+29 2.0843543838123746e+24 -4.4082745190034379e+24 2.4426197865943888e-01 1 +816 1.4259255951917092e+16 -2.2161870172205142e+17 6.2480498816334784e+16 -1.5493119636338524e+03 2.4150360125413058e-02 -5.2998813484053971e+02 1 +817 -3.0023221185695669e+24 -8.5053587855841517e+07 4.5139207230273264e+20 2.5934329692808997e+11 -4.8521301827418438e+13 -2.2657090682705682e+11 -1 +818 -1.7841518277043487e-03 -4.3010576304957512e+18 2.9502902187644913e+21 4.0754763119021317e+10 1.1473151047928918e+33 -7.8263073928383322e+34 -1 +819 2.8605423693432841e+25 -2.0535099449023535e+05 -1.8248255295819988e+18 -6.0106274029852600e+10 6.5828298227062225e+07 1.4240120317457786e+17 -1 +820 8.5994170771415560e+15 3.3738301555452750e+27 1.1844851916435741e+24 -1.4644426339542273e+11 -3.3961247614286304e+06 -1.3090897254062746e+18 -1 +821 -5.8657073853199175e+06 -2.8595162893242841e+29 -9.4728007291108415e+27 9.2980958666648000e+13 -2.2555642665983162e-04 3.8472001840490905e-03 -1 +822 -6.0732126136994010e+17 4.5083452269684852e+13 -4.5630802715097517e+31 -4.2367062503933175e+14 -3.4372594246285461e+29 6.8838247008719405e+26 -1 +823 1.2548822782688918e+11 -3.7885263800037346e+23 -1.7629104074740961e+30 1.3753532506518764e+18 -3.9729515283712662e+03 9.7833580731774218e+03 -1 +824 2.0303861428752640e-01 7.3877913471733500e+13 3.1119718821501912e+31 1.9074740968772525e+23 -4.9921032148840977e+13 -9.2760253072121600e+05 -1 +825 -4.2566830052014939e+07 -2.9621587891424065e+26 -9.8491507170316439e+22 5.1459555729696106e+29 1.1108576584402442e+17 -4.6259223878756107e+25 -1 +826 -4.3265866195690708e-03 4.6830595866776438e+13 -1.0153440402039079e+27 6.6897505472715470e-03 2.4206498043396343e+23 -7.9825148238325515e+05 1 +827 -9.3992228106791890e+08 -6.1350169317728627e+24 -7.2729560259197628e+33 2.4113593255635807e+34 1.5306254073394520e+15 -6.7905069009261524e+03 -1 +828 -4.3429796556606939e+19 3.0469196407738912e+26 4.0018638122218843e+04 -2.0665195146731630e+07 1.9307249148548923e+25 -3.2037403896380147e+02 1 +829 -6.4678135497479984e+25 8.5343229731657318e+26 3.0814780056796252e+01 -3.6067261699355270e+15 -7.6318390351193613e+33 8.6101629580322519e+07 -1 +830 4.7884687230163755e+09 -9.6228032889230728e+08 -1.5769170480062133e+33 -2.9114581418901211e+12 4.3878285057966440e+05 8.8076004103329782e-04 -1 +831 1.0807510623439615e+05 -4.3731661314999365e+26 1.1839692407392094e+23 -7.4413988130831086e+01 4.0582796652321377e+12 -9.4429315841492400e+15 1 +832 9.0348703328287439e+11 3.7050368957633829e+08 -2.1583673709230244e+08 8.9316282454475276e+21 -1.1227879125436411e+03 -8.3930431937727578e+29 1 +833 1.6830767358032907e+06 -5.1632721662570099e+23 -5.6589821904802294e+23 -2.1161714644064713e+33 6.7649427129117714e+10 1.8321848801361679e+25 -1 +834 -2.3644455224600293e+12 -4.0375998249602527e+30 -3.1656360093177360e+05 6.0440718351382875e+29 -1.2656111551260202e-02 -2.0660173414330293e+12 -1 +835 4.6929664197555492e+24 -3.8595109314186896e+16 -6.7263029309075878e-02 2.7294129748033026e+34 -4.2225407735431147e+28 -2.0571046910752486e+06 1 +836 -2.5311899754042514e-05 -1.4555316726728526e+26 -1.1293333356254413e+24 4.3353654541832829e+09 6.4942731433930728e+26 -1.0953394204566239e+14 -1 +837 7.6142978988271048e-02 1.1452371177162068e+02 1.9442838549672803e+11 1.6884135437852252e+05 5.0746874834222905e+05 -1.2497542709299806e+02 -1 +838 6.0242683300618886e-04 -1.8458844866817347e+28 1.2121025743010784e+32 5.1442653110969631e+19 2.4994210337372075e+33 -9.1160661273076301e+04 -1 +839 2.4250443682480771e+01 1.0274129998569849e+34 -1.0668039999377104e+16 -1.0656181927644587e+33 1.2912713045485559e+28 -4.7403026623142468e+03 1 +840 -4.3271384683249262e+33 -2.2951326220895430e+12 1.5068298736214565e+04 1.6671872458400636e+34 -2.1698134450266726e+18 -7.9527276441311836e+05 -1 +841 2.4867015301142159e+19 -1.4619915109281146e+20 3.9742970799841734e+21 4.5230384553246240e+11 -5.8613907281449400e+18 -3.0838172117485718e+10 1 +842 6.5875907681938250e+14 -1.0210978280777629e+32 -3.8750128960241004e+18 1.9544740850657689e+01 -3.7062364492175243e+03 4.6751781820990837e+10 -1 +843 -2.0582869062347341e+17 -1.0333048413503495e+22 -1.8986123775273587e+17 -5.9696485887372724e+25 -2.9995148829511032e+09 4.5750870191356242e+08 1 +844 -3.0756672811142244e+02 1.4956467546201059e+23 7.1958074283752111e+00 -7.7244847419624014e+12 2.0022616439477993e+31 -5.7791926174717649e+29 1 +845 2.0518382613162973e+06 7.4766054802850748e-04 -6.7267625384842000e+24 -9.3295248563798409e+19 -2.5336451791152613e+04 2.2198314379778280e+16 -1 +846 -8.4499659410744397e+24 -3.1788462192077277e+28 2.4943444323886673e+10 4.0665909291475993e+19 2.3354355247643311e+12 -5.6364943805214859e+10 -1 +847 -2.0642327140670120e+31 -4.0395575289653866e+21 -7.2411565557928157e+19 -4.9957086379643203e+23 -3.9286761696120387e-01 -5.5440169365171821e-03 1 +848 -2.5743445348346295e+31 -5.1445613128960720e+15 1.9821497965997951e+03 -6.5092556957616445e+12 -1.4557455162386293e+07 1.3748940545284108e+19 1 +849 -1.3254286646741044e+06 -3.1365096515469567e+05 1.9433581934910446e+11 7.8760769615302002e+10 5.5953061360020263e+28 -8.0533116147449707e+11 -1 +850 -1.4109744431125606e+01 2.9793571465272626e+00 4.7028066964141913e+30 -2.5475471619211070e+32 -4.3505875187262470e+08 2.3096327799257843e+01 -1 +851 4.2617648459905184e+27 -6.6092229273450255e+07 -5.6295669521035920e+16 -1.4697006873134367e+28 -3.4943145424333696e+16 2.6886491340665412e+14 -1 +852 1.2376662610464850e+14 -2.0371522015854568e+12 2.6945909828220790e+23 4.3545215348976960e+01 -1.1466695410148891e+14 -2.5214330022338538e+14 -1 +853 1.0792524589399773e+12 1.8059905089729270e+33 4.6936951039245753e+26 -1.4491385879554508e+10 1.9464062679449374e+34 -6.2278407980986864e+04 1 +854 8.4655298878761250e+15 -2.6422800362098202e-02 2.5942321671764779e+32 1.0765807677383355e+28 2.8250895809194296e+18 -4.1875610898721960e+15 -1 +855 3.0122839398523105e+12 -4.4753645751652270e+15 1.1066881702857053e+18 -1.9456994200399190e+06 5.0266006270203008e-02 -3.4359403643797755e+03 1 +856 -4.0174493958876020e+15 -3.9439889594569089e+19 -1.6139498461324274e+03 4.1236683209675510e+15 2.4534809554970704e-03 5.3421093857075242e+28 1 +857 3.3308409520867554e+02 1.1826542070827568e+15 -3.7137593015096187e+25 9.8473138817553250e+13 1.0472742592406782e-01 4.4900215774565914e+17 -1 +858 6.2044145734558166e+04 -3.4062295851350964e+33 -2.1539899634788971e+10 1.3457686510886173e+20 -1.4404785588267293e+07 -2.3896887432519572e+25 -1 +859 1.0942775745212180e+13 1.1835395151145412e+25 -1.4666731576748952e+30 -3.3840577517226417e+25 3.9204334979548279e+10 -6.5676906457347702e+25 1 +860 5.4723348696880973e-03 -7.0125424285914375e+13 -1.1397194864271089e+12 6.6423928822640921e+00 -3.0851794201672093e+29 -7.2526275487997685e-02 1 +861 2.4678721462350606e+14 -4.1225777046098886e+05 -5.9751643360477360e+15 -1.4409157896553968e+03 2.1471683917518977e+23 -1.2292683195982328e+05 -1 +862 1.7820931382979847e-02 -9.5053191073956279e+32 -2.5254295387887335e+08 -8.0824152336401062e+30 -3.8819082163675455e+05 -4.9841770146963347e+04 -1 +863 -1.0577496092714525e+14 -3.8082195153860355e+23 5.9713908360524878e+11 3.2924119646754951e+12 -6.8264804336472498e+03 -7.8412173759477958e+07 1 +864 -5.1859880944344337e+05 -3.0542080242098030e+10 -3.9368024208586838e+24 -1.6031510272664483e+21 4.3935329407717031e+05 -4.6628634538412568e+26 1 +865 -1.8440651515887570e+15 -1.8378463852752680e+28 6.4727643877133058e+19 -7.2459227724605817e+19 -4.1411464949163046e-01 -6.0180294849667407e+11 1 +866 -2.1404299180811876e+01 -2.7575472390663746e+27 9.3144206008331840e+15 5.3795136153719740e+15 1.2388225555911803e+21 1.0428475167206784e+01 -1 +867 -4.6790326793106006e+11 3.3940751222036910e+25 4.4282232982955469e+12 -2.7723872836881018e+08 -5.8730628608419417e+24 4.1012365809713950e+14 -1 +868 -9.9997737738170201e+01 -2.4884479548932577e+05 -5.6317378946692578e+11 -6.8252794509366920e+16 6.5266942631315827e+07 -5.8062658973896192e+04 1 +869 -1.1784648371883829e+10 -2.5767451237590909e+06 -1.3668724740266930e+10 -5.9568914055927994e+28 -1.4376117981380400e+22 -1.9782897769721020e+13 -1 +870 -3.1968248182917476e+22 -1.2406122208519698e+25 1.5061646190042421e+05 -3.3531940933756431e+26 6.1713135556364108e+19 1.0711391296768066e+10 1 +871 -3.3477816095492890e+03 1.2046302876555725e+14 -8.5142151521992731e+08 -3.0060462067007340e+24 7.4176707468751005e+31 -6.2885934212980423e+10 1 +872 -3.8475763341538580e+15 -1.1564485937266631e+26 4.8789476680524158e+34 -1.0335167063571839e+09 -2.6981033563649125e+09 3.3475827473201064e+22 1 +873 -2.4007268936480042e+06 4.6081712390613057e+22 7.5644501618977995e+33 3.3109449544283009e+08 4.2202304647527344e+11 -6.3033155020895800e+04 -1 +874 5.0402687034156961e+22 3.2349026433667839e+07 -1.4546512794955736e+07 -3.4319308443855068e+32 9.2414958518659448e+11 -2.0215116021022979e+01 -1 +875 -2.8351216622997231e+02 1.2957391899312974e+19 4.7568925991539334e+17 7.6073645519411788e+21 -3.1302644471597339e+33 4.7758638266635211e+02 1 +876 -2.5916654714545459e+01 1.2632718061576914e+23 2.3850386141826195e+04 6.5872601651195244e+25 -2.8105702832379814e+10 -6.7191728570290958e+04 1 +877 6.4662320928815187e+22 4.4444572614819531e+11 7.9775406452958008e+10 5.3650212660383258e+04 -3.8253409926324013e+26 3.2458017838620720e+06 -1 +878 8.7383135968349512e+11 3.0216544466579188e+14 1.2710870548201265e+12 1.4274169493003461e+31 1.9117047853382458e+24 6.5081772003754312e+14 -1 +879 8.0432118701173617e+18 -6.6541529476686666e-04 3.9086845832744987e+10 1.5840109552036802e+02 4.8133504739724368e+20 -2.8965549878141477e+31 1 +880 -9.7873297461182895e+32 5.8693664650463822e+32 5.6410650642417602e+27 -6.6445384785317322e+10 2.2400895885615628e+03 9.8404661186302755e-02 -1 +881 -7.0394458822105150e+14 -5.6286189312517745e+03 2.6837394136353092e+25 1.0865008673350625e-03 -4.3148058925345286e+30 -4.7346415336334692e+30 -1 +882 -1.6858696715053141e+00 -9.4551800798016875e+13 -1.7740272861367438e+09 -2.8369449820539096e+25 -1.2474982308668808e-03 -3.5844069111175194e+31 1 +883 -2.2149527499573412e+21 -8.5061509552617611e+00 4.9772752256511437e+17 5.2813789234091889e+18 -2.6144109908388450e+15 -2.0570870667847300e+29 -1 +884 -1.9968583592656479e+09 1.9523013620609911e+24 4.6239302382208098e+34 -1.3871784464385202e+06 2.7311469526265475e+14 -8.2131192465113941e+01 -1 +885 -2.3075027666330566e+09 2.0139672540851919e+01 3.0892569164069462e+23 -1.7657268477827610e+22 1.4107927299516459e+31 4.6237157084646604e+30 1 +886 1.1899725798351540e+01 7.4680544134043620e+30 2.5262388807688018e+04 7.3935118282040938e+13 -1.3221778766277407e+10 5.4927015724541433e+05 -1 +887 8.2184092083553157e+18 -1.3203791195895560e+01 -1.2584733444664668e+18 -1.4502627202470600e+23 1.5546914846525271e+18 -1.2274708346890837e+32 1 +888 2.8218365799064521e+28 3.5488113737395182e+06 -1.2800095823006852e+34 -5.0219086877384480e+16 7.1961995893092103e+00 7.3612309495651840e+18 -1 +889 -7.8364439404376745e+30 -1.3962314902364078e-03 9.6292924620810781e+28 -1.2899556262288289e-01 -1.5590367701542738e+14 1.9384943649190521e+11 1 +890 -2.5925638975817879e+05 -1.1717571062464600e+00 -2.4381215573421278e+14 -2.0276222972780475e+29 9.3404325223150702e-04 4.5595783859470043e+00 1 +891 -7.7733618395322672e+33 -2.0617070005499463e+02 -1.8231373764822119e+12 6.9735596193604600e+23 2.3827776121107552e+16 6.3716413802802375e+13 -1 +892 -4.3399463373554230e+21 -6.5372569620728861e+28 -1.9259878986374609e+11 -6.3018250452656386e+04 3.4546615892253022e+34 -4.2650344730747664e+08 -1 +893 1.3908782159597915e+08 -8.0462471834192276e+06 7.1354089982576417e-04 2.1347205608812673e+34 1.6427122102967990e+18 2.7679251139970355e+17 -1 +894 -1.7606122350905379e-02 -7.3141692410286210e+15 3.1651947241716143e+03 -1.0822832691082887e-01 -7.1957688095899337e+24 -2.2323936681086749e+25 1 +895 9.6265508773051850e+14 3.8772781459082764e+33 1.6920162632147542e+21 4.6398667010131669e+14 -6.8159781183166423e+18 -3.1010736298354557e+06 -1 +896 5.5722592188045979e+01 9.2704625282002842e+33 -1.2258982828514917e+32 8.2048417260910340e+15 5.7635634127172029e+32 4.7787259232525744e+07 1 +897 -4.5244213142163977e+06 -1.5753506701347375e+31 -1.4130147492461630e+27 -5.9176415400913159e+26 6.0731791740158599e+01 -5.9274206922626431e-04 -1 +898 -5.0090703488299412e+22 2.1457400040773652e+06 -5.4114256028036819e+10 -1.3946711866205924e+01 -6.5932107517602239e+00 9.5236924673559476e-03 1 +899 8.0657644201492798e+05 1.7589070745118256e+09 2.5697892002882138e+33 2.0340152018587366e+07 2.5858933751853467e+01 -3.8709877420377050e+15 -1 +900 -4.5759124795830709e+33 -1.6479814051280475e+15 8.6698468683966317e+29 -9.7116924814109007e-01 -4.2955566119479751e+21 -1.7638902065164736e+05 1 +901 -1.3735898651871431e+08 3.4336651025049830e-01 1.0284492292544143e+18 -2.6396448523553124e+28 1.3060623254978377e+07 4.7671202389621737e-04 1 +902 -1.7270375447188661e+08 2.0387249866118422e+13 -3.2050541205172984e+04 3.1819739148706345e+25 2.4574653215416320e+29 -4.9117882068846405e+08 -1 +903 -8.2387429075220518e+30 -6.9859814455157200e+14 3.9190719486697085e+30 -2.2125639393499784e+16 -4.3411895458604801e+02 1.8771265879102766e+25 1 +904 1.1236853430672858e+29 2.6473541742784399e+08 1.3354315799170246e+29 1.4783763288320362e+33 2.2068052785755232e+17 -9.0298666090794575e+27 1 +905 1.2546916682608455e+08 -7.7799783514029087e+18 8.1625373357446289e+08 8.7489311762111125e+24 -1.1025600682675503e-02 2.1672475755720703e+26 1 +906 -1.1080200239703522e+15 -1.1965747693214171e+24 1.6482875008547571e+03 -7.0140801329731232e+02 5.4848494127784099e+32 4.6323908351649683e+23 -1 +907 -3.4651733552927936e+17 9.9255698297592509e+28 1.5093846182741549e+29 9.6813032084414573e-03 -3.1711370540310601e-03 3.5699719783117312e+32 1 +908 1.9481443430470800e+14 -1.5701398957001695e+30 7.6652168350599468e+30 2.2631530023823494e+17 -1.9316014955269461e+05 -1.5137305877687443e+24 1 +909 -2.1108753855252752e+08 1.1261192015922453e+33 1.8881904442636088e+00 -9.7046820677391466e+33 7.3706213871048924e-03 -1.1851048290007840e-03 1 +910 -3.3201170779960752e+07 -1.2568057104906951e+23 3.8843947536786175e+26 2.4305433582108650e+15 -2.8282536627845988e+19 -5.6887073548208237e+10 1 +911 -8.9710424202160000e-01 -8.8150415106162802e+33 -1.3027413855860116e+03 7.5233620605236109e+33 -7.7518621981123047e+09 1.5099244233236109e+31 1 +912 3.7178345753635481e+21 3.3736598377213190e+23 2.9003501681615962e+00 -6.0575800109169608e+25 -1.4433447990801319e+21 8.4183641796452313e+23 -1 +913 2.4251966795667692e+00 5.9991390641763086e+11 1.9683787265588918e+09 -1.1608970828071836e+02 5.1986851269557825e-03 -2.7654145575336337e+22 -1 +914 -1.0169475904821788e+18 5.6964315155256958e+10 7.5704118459364211e+24 4.3067062061073610e+20 1.0076699428766517e-02 6.6338307065249282e+23 1 +915 4.2666799049675873e+11 1.8561650534829903e+10 1.5811653920597346e+30 -2.9026308176521070e+01 -3.4277078338076401e+10 1.4835340772179436e+04 -1 +916 1.5055204804198218e-03 1.4058644281070812e+01 1.1433015433750725e+29 2.7966868135153594e+28 1.4434922210308723e+04 -6.8312138553974137e+21 -1 +917 -3.1646163578502448e+24 6.6831634289690112e+11 6.7470554577812400e+32 -2.3334219609782383e+10 7.9871412412106141e+30 7.2159428432447217e+33 1 +918 5.1748288564249062e+14 -2.7777003970133537e+10 -2.0064753536062236e+21 1.4734387046214011e+32 -1.3950871148034988e+34 7.8721352972731125e+04 1 +919 8.8340594410251223e+20 2.6362636975344998e+17 3.8785170637190092e+00 -4.2294465911336174e+19 6.8674999874957325e+14 -1.8692985781672793e+27 1 +920 6.3057415960348480e+03 -3.9217414794458470e+17 -7.3016243862089847e-01 9.1508288067052176e-04 1.9263060303960733e+09 -6.2178301651134383e-05 -1 +921 -1.8931750522297565e+27 -1.0129146292902760e+02 -5.6320556329362296e+32 4.5974131151843034e+06 5.0392886423844775e+11 9.8436847260004224e+17 -1 +922 -1.5596433851498508e+22 -6.4118001251219344e+13 1.8992007537209690e+18 -2.4400159949641650e+31 -1.4221521221358987e+29 1.7971934037980334e+18 -1 +923 1.1483174173590144e+32 -1.8757862544909785e+13 2.0541724457542031e+13 8.3683171665170374e+11 1.7281974701356903e+30 1.7262427014534609e-01 1 +924 3.6964917881960006e+19 -6.8438432565926619e+27 -2.8531108244093328e-02 -1.9257430397262280e+02 -2.8380191689416015e+21 2.0736587471517277e+09 1 +925 -7.7233423562031858e+19 1.5142971391161666e+14 1.4961904093857905e+08 -1.8692458622255976e+26 3.5753889070271008e+00 -3.8030815166594062e+12 1 +926 -2.1026533144603145e+15 1.8409293608819025e+03 8.1218551650610180e+15 -9.1329748727348462e+11 -2.9882877174591160e+18 -1.6837352798958805e+09 -1 +927 -1.6118494747099453e+12 -2.8559613873365389e+01 -3.3473049481239142e+18 6.5645400330504162e+28 -1.4560777681754331e-04 3.7206673874314875e+22 -1 +928 6.6732800841358081e+31 -1.9431173590580532e+27 -5.1341732261808502e+04 2.6152879825119264e+04 2.4127603744018199e+26 4.0588415770019779e+21 -1 +929 -1.3402455871792373e+31 2.3068511171254886e+17 -7.9649741960144517e+18 -8.6192110972734976e+16 2.1582266920591043e+18 1.2563738738030843e+30 1 +930 1.6321233885451236e+13 9.2842713971854160e+15 -3.8570322815710153e+25 9.0526873587155029e+10 2.3539358883419830e+00 6.7027154000310625e+12 1 +931 -1.0017079702446081e+03 8.8583555406431333e+24 -1.0968594158308479e+03 1.0385380695225755e+05 4.5936661064873450e+04 3.6823569280088911e+09 1 +932 3.6171363260468336e+24 -6.6178700937387388e+04 -4.9297553779372848e+27 -5.5195690487558223e+07 5.6251014401478577e+20 1.2054436136994026e+34 -1 +933 -1.1253270556615173e+32 -3.9372549506042901e+01 -1.7781583489295735e+03 7.6647180761772348e+05 -2.4460734882065690e+08 -1.2887423476791928e+29 -1 +934 1.8918646362796936e+30 -3.6478828447974061e+22 -5.8685023037720630e+11 -6.2732197278616485e+27 -8.9492286765436113e+12 -4.5796134647673780e+33 1 +935 -6.4391310971575865e-03 -8.5411661648025850e+14 -7.3651451933071420e+26 -6.8353634290209902e+02 1.0466582365864038e+02 2.0133691726704761e+30 -1 +936 2.3476452716507160e+32 -4.0814216312015137e+10 3.5875458072155036e+20 2.9120564431347157e+02 -5.4602894325186011e+11 2.7481913235730682e+22 -1 +937 1.0242408536960709e-01 -5.9883279756632680e+15 1.4898269520434861e+12 -9.0067380861300850e+14 1.6649781129794201e+02 -3.0239638850885390e+29 -1 +938 -1.5385039811557545e-02 6.6805970300170159e-02 -1.2739300057415096e-02 -2.9987683337223893e+30 -6.5092619803671369e+02 -1.4345053454850297e+06 -1 +939 -1.4931625739362416e+28 -5.0448090288022649e+08 8.7014507231045520e+08 -4.2539282557570357e+02 2.0752407551235301e+33 4.8002506009157363e+12 -1 +940 -1.6035491968540930e+19 -7.6004347814103718e+20 5.4657096282985674e+20 9.1957885598053076e+32 -1.7432079574385095e+20 -6.3347706878206182e+30 1 +941 1.7752367250044556e+11 -2.8101842579031029e+00 -2.0760538975403560e+15 -2.0572807985733138e+30 -1.7927081892633754e+13 -8.4172806667428500e+15 -1 +942 -1.2397553278148182e+05 -2.4136043378421873e+08 3.6114455466842443e-01 -2.4745387916661446e+32 5.5959721137709886e+07 2.1257196993242347e+22 1 +943 -4.7591960140748349e-04 -1.3598410011269846e+27 9.5542947097623774e+00 6.3331926359404778e+08 1.2472552062388963e+03 -1.4104502680527986e-02 -1 +944 -7.8386556736339812e+28 -1.5480214462040710e+34 1.3731839109321667e+04 1.3118778290632747e+22 -3.1643913028490150e+19 6.1579382661959648e+12 1 +945 6.0051180320118587e+19 1.1112521376443608e+24 2.5436820221586595e+26 -1.0473783489136061e+12 2.0996388244424553e+27 5.0610354428068237e+09 1 +946 -1.0810677490249040e+23 -9.2031565663349187e+18 -5.7057261695137766e+17 1.3545563075698459e+02 -2.0482194033695646e+32 -7.3559992210324556e-03 1 +947 -1.3434611165363556e+06 7.4614469478239119e+05 2.1922883934471912e+10 3.7357163670493364e+07 6.1736249422419772e+28 -1.3560566671772578e+04 -1 +948 -1.8310794545433140e+09 2.2108212854029521e+12 -4.9769774966185587e+32 -9.0452600334910718e+11 1.4060121747060041e+13 1.5628092298450847e+18 -1 +949 -6.8653514175797340e+24 -1.0332107147297344e+12 -1.0701533178546143e+32 5.9040225641862392e+07 1.0622047684662833e+14 -1.2145237023068045e+01 -1 +950 -8.9599877349297136e+31 -7.7476788649703718e+31 1.4552869665013609e+05 4.5178848404892795e+19 -5.5142204343332320e+15 -3.7684001667517396e+02 -1 +951 1.0841949762347175e+01 -1.2063059029751055e+12 -9.8299451846953240e-02 1.9173357760499506e+14 -4.1819281250145645e+10 5.5622015468822969e+12 1 +952 -8.8531975540957260e+08 2.7688467436364054e+27 -1.4135422180938935e+28 -1.4511014098100848e+06 4.3614305475375381e+10 4.2502696372444421e+11 1 +953 1.2956550062498703e+23 -3.9575636263951984e+20 -4.4688907630006719e+08 -5.7609738275243750e+17 -1.6273831435191520e+06 2.2021676186608963e+25 -1 +954 3.9861862864415684e+01 1.4203423171252450e+32 -2.7097734174717403e+27 1.8052635891821339e+33 2.4124309227049723e+13 2.3288312912820487e+01 1 +955 7.7127410825607325e+22 6.8312423503366631e+28 -3.4039039692966318e+12 -5.2420417774470739e+07 -3.3904097855489380e+15 2.2738275183394738e+14 -1 +956 5.3708046757530430e+12 1.1172959108257449e+26 -4.9358995249937535e+22 5.7467113096280943e+26 -5.8558554529470993e+10 -3.6633332023046410e+02 1 +957 -1.0881527682162748e+26 6.8675431135545959e+09 -8.7589737548904917e+24 2.0099408129268390e+11 -4.5448989715050312e+18 -7.1316083755818163e+03 -1 +958 4.5983266505791660e+15 -8.7816422326505131e+02 -4.2235677841427780e+10 -2.0055127672948676e+30 -2.4664876798867090e+12 1.8181704465545574e+31 -1 +959 2.2281438019226184e+09 -2.5731719395909156e+30 3.7487895565858308e+22 2.7012912677988135e+32 -3.8271309414288213e+12 6.6671307625523397e+19 1 +960 -1.0179222568506977e+18 -6.9030826116469071e+28 -1.3059801370220775e-02 -9.4761349665344471e+18 5.9378728922867095e+31 -5.0408446997613121e-01 -1 +961 9.3356757495440998e+19 -1.6741822493697168e+12 -4.1997399919222025e+03 4.8779231287401408e+05 -1.5094819704420780e+34 7.6577221951652232e+28 -1 +962 -2.3691921711999512e+08 -3.5309742802971901e+10 2.2388022120284014e+24 -3.4010384759748310e+07 5.8356666774165490e+01 8.0096821557143654e+17 1 +963 4.9597623149702090e+28 1.0640253332642889e+27 4.9308264539363738e+32 -1.5804554665048820e+16 -1.0053584653852106e+29 1.4552605736808362e+14 -1 +964 6.2451648493734032e+16 2.3679678500750668e+22 -4.5166719509220400e+20 -1.2313681736383794e+33 -7.9691586601638368e+16 6.1854085208892606e+29 -1 +965 4.8351475489468027e+18 2.3156117842111513e+07 2.1851284701986345e+27 -7.5029104433249358e+00 -1.1226285689460827e+24 -1.7852126710743433e+12 -1 +966 2.3149776802068190e-02 -2.2662539076042250e+13 -6.4610080492941648e+16 -3.6207383095966688e+13 -3.7428423193747825e+15 1.3606456250383541e+01 -1 +967 -4.6177517199240379e+10 -3.7118195471659198e+09 -5.1007860523781589e+22 -6.2371801967452683e+01 -5.4994342788863889e+01 -3.7331858982619270e+27 1 +968 -3.4288745574125610e+15 2.9976100648372290e+30 -7.9133752382527455e+04 2.8505640847303800e+15 1.9374355784787354e+18 5.8698471392613187e+33 1 +969 6.5286647601291575e-03 -8.6331833923048293e+01 -1.5513775455097994e+14 3.1615794143495023e+13 3.2660670330317344e+13 -3.5524919385767753e+01 -1 +970 -5.2265082872717345e+33 -2.6014941857394137e+30 -1.1143122339214861e-02 -1.5249349895460999e-03 -6.1553050370928644e+22 -2.6443879252363395e+32 -1 +971 -4.6764771408035891e+05 -1.4070738296614504e+22 1.6924638909798734e+03 1.5309026231504195e+21 1.3694943985407875e+14 5.1119196364200296e+09 -1 +972 -2.2243508346986615e+32 2.2958074889202790e+28 -1.1930033325432712e+00 -3.3259734077063464e+07 1.0915062821099369e+05 3.7211805294812369e+22 1 +973 -3.5014424353903456e+02 6.4020540712433331e+03 6.7097956421922813e+00 -3.1862786405811288e+23 -4.5008460534226758e+21 7.4073228123381845e+31 -1 +974 -2.0707867774695345e+02 -3.1168977374772153e+03 -2.0638812708136458e+18 -6.2383651940791429e+00 5.0266813334562431e+02 -1.6737224254471230e+15 1 +975 1.7865263337453994e+20 -8.2530163244278436e+26 2.0264354743220991e+12 1.1621610048884686e+10 8.7042812841053438e+14 4.0976699526910037e+06 -1 +976 2.1264753300090906e+25 5.9432580589575804e-04 -5.9567939195668382e+26 2.1529598908526845e+33 -1.6474722955829450e+27 -5.0251222261532546e+24 1 +977 -5.7359920320970351e+23 1.1849103458728129e+30 -2.4930352656133566e+06 1.0609305403366136e+20 9.1779077039746779e+32 -2.4678253398868038e+10 1 +978 2.5848270388203803e+22 -2.9080301196575777e+29 -1.1017584122148219e-02 -4.7626923196265950e-03 -9.3575666122574171e+26 3.1124150414476611e+18 1 +979 -1.6682391842914801e+22 -5.4380340860940995e+23 6.5751297805182252e+05 2.3851530792014242e-03 2.2807399681389808e+02 3.3206189349286443e+08 1 +980 -5.8351659260610780e+20 2.4374141235749531e+13 -7.6707253131814341e+27 2.6769733044337851e-01 -1.9117394645712462e+14 -8.4965759358427470e-04 1 +981 -2.6287904859452555e+05 -5.9334143279574523e+13 4.2705133843303870e+24 -6.7058536939430391e+12 1.8317781292831681e-02 1.2396293938951502e+06 1 +982 6.0698457560436295e-03 -7.2828658665424446e+05 9.7386056991202427e+18 -3.9325537823277767e+00 8.3517389751960354e+02 -6.9198592096881295e+18 -1 +983 6.1575489562550704e+31 8.7844586766781754e+31 -2.1093416295511790e+27 2.4720944792206061e+08 -4.7223143023120127e+00 -3.5521943803063074e+11 1 +984 1.5165292192771412e+16 -3.6653762752851647e+29 5.0787635972895488e+28 -1.0101740654154318e-01 3.9330442653030291e+21 3.3465076493930738e+23 1 +985 2.8397427167471824e+31 -4.0730337589108939e+22 -1.8175073830038696e+03 -6.7790084289172341e+19 7.7650075309903627e+01 -2.5230875631912090e+12 -1 +986 1.5734112647830472e+33 2.4832838677452728e+32 -3.4623590129286377e-04 2.5269316642064859e+19 2.4305778078686427e+07 1.3416184455968754e+06 1 +987 1.7433834305124823e+22 8.0728785071548100e+15 1.7945795485278279e+12 -1.3416040850306004e+02 -5.6438571539642163e+30 2.5292767764679712e+21 -1 +988 -5.9699207426880605e+12 -4.9032802499999478e+06 1.1979892414400015e+09 -1.3646292473817900e+21 3.2155409323225593e+20 1.2380098341872198e+14 1 +989 -8.7638568640683130e+15 1.2586508727012395e+33 -2.7797117384940443e+33 2.1766502291471064e+04 -5.3956625300296320e+15 -3.5984227645016348e+32 1 +990 -1.0255882021122351e+23 8.3276126775776342e+04 2.4427160319871137e+20 9.1099158797770269e+02 -1.2272932727526559e+01 -1.8851450191713465e+25 -1 +991 1.3923421383625878e+00 -3.3990041869307330e+04 -4.5622101564122132e+18 -7.3853086263321837e+33 1.5950750915199725e+32 -2.7438574629587820e+34 1 +992 1.0367762342092248e+23 3.2879753762744398e+25 -2.5678446230863747e+14 -1.8717361181347856e+03 -1.0412380202363791e-01 2.2920814186288065e+11 1 +993 1.3901121766009608e+08 -4.6532979393495407e+33 1.4915239752605086e+05 -6.5699582335463601e-03 5.4167086764960388e+14 -4.3793456492539863e+23 -1 +994 3.1098325051839703e+20 -2.7915367473345874e+18 1.1791072493130857e-01 2.6197921504732431e+11 -2.0770436492349825e+19 -1.4509024607530332e-04 1 +995 1.4987679348036862e+20 2.5982005386406049e-02 -1.1833960792716984e+33 -1.1459627733064065e+32 -4.3879344608721392e+16 1.2035463728011475e+05 -1 +996 -1.4643052902826151e+07 1.2932187722059799e+19 -5.9916705177420537e+26 -7.7598817240654550e+15 5.8321482767790493e+20 6.8678852777126312e+21 -1 +997 -6.2684268778206169e+04 -9.6506767305618890e+00 -2.2826114748902292e+18 -2.7266382856550771e+30 -8.7293488750203585e+31 8.2817336826635987e-04 -1 +998 1.0797915840309869e+21 -2.8751648470458100e+14 1.3576377580818268e+13 8.5393945091084019e+21 5.4784631956445090e-02 8.3439734977867675e+24 -1 +999 -1.2551985456527059e+33 2.3926255415013582e+33 5.8022440398608125e+12 4.5817211159971096e+20 3.3213093804256459e+01 6.7318803902448410e+34 1 +1000 -6.7003992733503242e+02 -2.8089361872929582e+13 3.1412289929824258e+12 -1.9589418156339870e+32 1.1208555802922646e+13 -1.7849265604699733e+22 1 diff --git a/src/Triangle.Tests/Triangle.Tests.csproj b/src/Triangle.Tests/Triangle.Tests.csproj index 7461677..d80134b 100644 --- a/src/Triangle.Tests/Triangle.Tests.csproj +++ b/src/Triangle.Tests/Triangle.Tests.csproj @@ -21,6 +21,7 @@ + From 29f4bc7b7ba01c1a773b0bc647ab4cb9d87ccf6a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 04:44:42 +0000 Subject: [PATCH 29/50] Noder: snap rounding as last resort; corpus: CDT inputs, Natural Earth - SegmentNoder.Node: if noding doesn't converge with any tolerance, snap round to the largest tolerance instead of throwing (issue-211 of the CDT test inputs: long edges crossing a polyline at tiny angles). - SnapRound routes segments through existing hot pixels before computing new intersections (the number of vertices exploded otherwise) and allows 100 iterations. Results of inputs that converged before are unchanged. - Corpus harness: spatial index for the coverage check and the strip classification (quadratic before: timeout on Natural Earth 10m), strip width relative to the extent, Steiner limit detected like the library. - Docs: performance results (interleaved A/B), standard CDT benchmarks. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 73 +++++++++++ src/Triangle.Tests/Corpus/CorpusCheck.cs | 115 +++++++++++++++++- .../Robustness/NodingAndRefinementTest.cs | 30 ++++- src/Triangle/Meshing/SegmentNoder.cs | 34 ++++-- 4 files changed, 234 insertions(+), 18 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 9646419..8efee1d 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -334,6 +334,79 @@ Ausgangswerte (`Triangle.Benchmarks`, `--job short`, Release, Container mit 4 Ke Vorgehen pro Optimierung: Benchmark vorher/nachher (Standard-Job), Charakterisierungstests grün (bei verhaltensneutralen Änderungen unveränderte Fingerabdrücke). +### Performance-Optimierung + +Profil der realen Fälle: In großen Netzen gingen 25–30 % der Laufzeit in Garbage-Collection- +Pausen. Das wachsende Netz ist komplett lebendig, und jede Sammlung kopiert alle neuen Objekte – +die Pausen hängen an der **Anzahl** der Objekte. Jedes Dreieck bestand aus vier Heap-Objekten +(das Dreieck und je ein Array für Ecken, Nachbarn, Teilsegmente), das waren über die Hälfte aller +Allokationen. Änderungen (alle verhaltensneutral, Golden-Fingerprints unverändert): + +* Dreiecke und Teilsegmente speichern Ecken, Nachbarn und Teilsegmente unter .NET 8 als + `[InlineArray]` direkt im Objekt (die Bibliothek baut dafür zusätzlich für `net8.0`; + `netstandard2.0`, z. B. .NET Framework 4.8, behält die Arrays). +* `InCircleAdapt` legte bei jedem Aufruf rund 40 Hilfsarrays an; sie liegen jetzt im + thread-lokalen Arbeitsspeicher (fast kozirkuläre Punkte, z. B. im Rastermodus, rufen ihn oft auf). +* Rastermodus: Die aCute-Relocation wurde berechnet und dann verworfen (24 % der Zeit), am Ende + wurden für alle Punkte Sterne aufgebaut, obwohl fast alle schon auf dem Raster liegen. +* aCute-Keilschnitt: Winkelfunktionen einmal pro Aufruf statt pro Kante. + +Gemessen mit BenchmarkDotNet (Standard-Job), alter und neuer Stand je Szenario direkt +hintereinander (zwei getrennte Läufe im Abstand von Stunden sind auf der Cloud-Maschine nicht +vergleichbar, die CPU-Leistung schwankte dort um 20–25 %): + +| Szenario | vorher | nachher | | +|----------|-------:|--------:|---:| +| ALKIS-Kachel 30°, Snap 1 cm | 501 ms | 398 ms | −21 % | +| ALKIS-Kachel 30°, Raster 1 cm + Keil 3 cm | 638 ms | 327 ms | −49 % | +| ALKIS-Kachel 20°, Snap 1 cm | 178 ms | 147 ms | −17 % | +| kleine ALKIS-Kachel 20° | 26,1 ms | 23,5 ms | −10 % | +| Zufallspunkte 30° | 33,2 ms | 28,3 ms | −15 % | +| `parcels-mismatch` (Steiner-Limit) | 1.010 ms | 839 ms | −17 % | +| kreuzende Segmente 20° | 3,73 ms | 3,55 ms | −5 % | +| UTM-Bruchkanten 33° | 10,5 ms | 9,7 ms | −7 % | + +Der Herne-Korpus (201 Kacheln, Raster + Keil) läuft in 60/92 s statt 109/180 s (20°/30°). + +## Standard-Benchmarks für CDT (`BenchmarkDatasetsTest`, Korpus) + +Immer im Testlauf (`Robustness/BenchmarkDatasetsTest.cs`, Daten in `Robustness/Data`): + +* **Exakte Prädikate:** je 1.000 extreme Grenzfälle für `orient2d` und `incircle` mit bekanntem + Vorzeichen (Nanevski et al., Werte bis 10³³): alle richtig. +* **Ruppert-Ahornblatt** (Kanadische Flagge) ohne Qualität und mit 20°, 30°, 33°. +* **Gitter** (kozirkulär): 10×10 (auch Abstand 0,1 und UTM-Koordinaten), 100×100: deterministisch, + mit allen drei Triangulatoren und gemischter Reihenfolge Delaunay; mit diagonalen Zwangskanten + bei 30° keine schlechten Dreiecke. +* **Konzentrische Kreise** mit Loch (kein Dreieck im Loch, Fläche exakt) und ohne Loch (kein + Dreieck kreuzt den inneren Kreis). +* **Spitzer Stern** mit Spitzenwinkeln von 10⁻³ bis 10⁻¹⁵ rad bei drei Maßstäben (1, UTM, 10⁻⁶). + +Korpus (explizit, externe Daten): + +| Daten | Ergebnis | +|-------|----------| +| Testsammlung von artem-ogre/CDT (43 Dateien: hängende und überlappende Constraints, Punkte auf Kanten, Schweden, Gitarre …) | alle gültig, auch `issue-211` (siehe unten) | +| Natural Earth Küsten 110m / 50m / 10m (10.000 / 59.000 / 407.000 Punkte) | CDT 0,1 / 1,0 / 4,8 s | +| Natural Earth 10m mit Qualität (ausreichend Steiner-Punkte) | 20°: 11 s, 1,7 Mio. Dreiecke, 0,27 % schlecht; 30°: 22 s, 2,8 Mio., 0,39 % | +| Natural Earth 50m, 30° | 2,6 s, 0,23 % schlecht | + +Gefunden und behoben: + +* **`issue-211`** (lange Kanten, die eine Polylinie unter praktisch 0° vielfach kreuzen): Der Noder + konvergierte bei keiner Toleranz, die Triangulierung brach mit einer Exception ab (die CDT- + Bibliothek selbst wirft hier ebenfalls). Jetzt folgt als letzte Stufe Snap-Rounding auf die größte + Toleranz. Dabei werden die Segmente zuerst durch die vorhandenen Punkte geführt und erst dann + neue Schnittpunkte berechnet; umgekehrt explodierte die Punktzahl (244 → 12.634 in vier Runden). + Eingaben, die bisher konvergierten, sind unverändert. +* Der Korpus-Harness selbst war für große Daten quadratisch (Segmentabdeckung, Streifen- + Klassifizierung) und lief bei Natural Earth 10m in den Timeout; die Triangulierung brauchte + nur 3 s. Außerdem zählt die Steiner-Limit-Erkennung jetzt wie die Bibliothek (auch wieder + gelöschte Punkte). + +Thingi10k (3D-Modelle) wurde nicht verwendet: Dafür müssten erst 2D-Schnitte erzeugt werden, +das testet eher den Schnittgenerator als die Triangulierung. + ## Raster, Keile und Geländevereinfachung Testgetrieben entwickelt (Tests zuerst rot: `GridSnapRoundingTest`, `WedgeMergeTest`, diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index ecd2187..331a1f1 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -119,7 +119,7 @@ Vertex V((double, double) p) SegmentNoder.Node(poly, predicates, out double noderTolerance, minTolerance: snapTolerance); double tol = Math.Max(Math.Max(scale * 1e-11, 4 * noderTolerance), gridSize + wedgeTolerance); - var subsegs = mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(); + var subsegs = new SegmentIndex(mesh.Segments.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(), tol); int missing = poly.Segments.Count(s => !IsCovered(subsegs, s.GetVertex(0), s.GetVertex(1), tol)); if (missing > 0 && Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_DEBUG") == "1") @@ -138,7 +138,8 @@ Vertex V((double, double) p) // Quality statistics (no failure: small input angles can't be fixed, and the // Steiner point limit may stop the refinement). int bad = minAngle > 0 ? mesh.Triangles.Count(t => MinimumAngle(t) < minAngle - 0.01) : 0; - bool limit = minAngle > 0 && mesh.Vertices.Count - poly.Points.Count >= steinerPoints; + // The limit counts all insertions (also vertices deleted again). + bool limit = minAngle > 0 && mesh.steinerleft == 0; // Triangles which are flat or inverted after rounding the coordinates to the output grid. double og = gridSize > 0.0 ? gridSize : outputGrid; @@ -176,7 +177,8 @@ Vertex V((double, double) p) /// /// Classify the bad triangles: at a small input angle (a vertex where two segments form an /// angle below the minimum angle), below the grid floor (shortest edge less than two grid - /// cells), in a narrow strip between a segment and another segment closer than 5 cm, + /// cells), in a narrow strip between a segment and another segment closer than 5 cm + /// (at most 0.1 % of the extent), /// touching a segment, or in the interior. /// private static (int, int, int, int, int) Classify(Mesh mesh, double minAngle, double gridSize) @@ -186,7 +188,10 @@ private static (int, int, int, int, int) Classify(Mesh mesh, double minAngle, do return (0, 0, 0, 0, 0); } - const double strip = 0.05; + // 5 cm for metric data; for data at other scales (degrees, unit square) a small + // fraction of the extent (a fixed width would cover everything there). + var extent = mesh.Bounds; + double strip = Math.Min(0.05, 1e-3 * Math.Max(extent.Width, extent.Height)); // Directions of the segments at each vertex, and the segment edges. var directions = new Dictionary>(); @@ -236,6 +241,7 @@ void Add(Vertex p, Vertex q) int angle = 0, floor = 0, narrow = 0, segment = 0, interior = 0; var segmentList = mesh.Segments.ToList(); + var segmentIndex = new SegmentIndex(segmentList.Select(s => ((Point)s.GetVertex(0), (Point)s.GetVertex(1))).ToList(), strip); // Is a segment other than (p, q) (and its collinear continuations) closer than the // strip width to the point? @@ -243,8 +249,9 @@ bool InStrip(Point c, Vertex p, Vertex q) { double ux = q.X - p.X, uy = q.Y - p.Y; - foreach (var s in segmentList) + foreach (int k in segmentIndex.QueryIndices(c, c)) { + var s = segmentList[k]; Vertex a = s.GetVertex(0), b = s.GetVertex(1); if (Math.Max(Math.Min(a.X, b.X) - c.X, c.X - Math.Max(a.X, b.X)) > strip || @@ -322,8 +329,10 @@ private static double MinimumAngle(Point p, Point q, Point r) return min; } - private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, double tol) + private static bool IsCovered(SegmentIndex index, Point p0, Point p1, double tol) { + var subsegs = index.Query(p0, p1); + double dx = p1.X - p0.X, dy = p1.Y - p0.Y, len = Math.Sqrt(dx * dx + dy * dy); // Union of the subsegments lying on p0-p1, projected onto p0-p1. @@ -356,6 +365,100 @@ private static bool IsCovered(List<(Point, Point)> subsegs, Point p0, Point p1, return Math.Abs(covered - len) <= tol * 10 + len * 1e-9; } + /// + /// Uniform grid of segments (the coverage check is quadratic otherwise, e.g. 400,000 + /// coastline segments). + /// + private class SegmentIndex + { + readonly List<(Point, Point)> segments; + readonly Dictionary<(long, long), List> cells = new Dictionary<(long, long), List>(); + readonly double size, margin; + readonly int[] stamp; + int query; + + public SegmentIndex(List<(Point, Point)> segments, double margin) + { + this.segments = segments; + this.margin = margin; + stamp = new int[segments.Count]; + + double minx = double.MaxValue, miny = double.MaxValue, maxx = double.MinValue, maxy = double.MinValue; + + foreach (var (a, b) in segments) + { + minx = Math.Min(minx, Math.Min(a.X, b.X)); maxx = Math.Max(maxx, Math.Max(a.X, b.X)); + miny = Math.Min(miny, Math.Min(a.Y, b.Y)); maxy = Math.Max(maxy, Math.Max(a.Y, b.Y)); + } + + size = Math.Max(Math.Max(maxx - minx, maxy - miny) / Math.Max(1.0, Math.Sqrt(segments.Count)), 1e-300); + + for (int i = 0; i < segments.Count; i++) + { + var (a, b) = segments[i]; + + foreach (var key in Cells(a, b)) + { + if (!cells.TryGetValue(key, out var list)) + { + cells[key] = list = new List(); + } + + list.Add(i); + } + } + } + + private IEnumerable<(long, long)> Cells(Point a, Point b) + { + long i0 = (long)Math.Floor((Math.Min(a.X, b.X) - margin) / size), i1 = (long)Math.Floor((Math.Max(a.X, b.X) + margin) / size); + long j0 = (long)Math.Floor((Math.Min(a.Y, b.Y) - margin) / size), j1 = (long)Math.Floor((Math.Max(a.Y, b.Y) + margin) / size); + + // Long diagonal segments: only the cells near the segment. + double dx = b.X - a.X, dy = b.Y - a.Y, length = Math.Sqrt(dx * dx + dy * dy); + + for (long i = i0; i <= i1; i++) + { + for (long j = j0; j <= j1; j++) + { + if (length > 0) + { + double cx = (i + 0.5) * size, cy = (j + 0.5) * size; + double distance = Math.Abs(dx * (cy - a.Y) - dy * (cx - a.X)) / length; + + if (distance > size + margin) continue; + } + + yield return (i, j); + } + } + } + + public List<(Point, Point)> Query(Point a, Point b) => QueryIndices(a, b).Select(i => segments[i]).ToList(); + + public List QueryIndices(Point a, Point b) + { + query++; + var result = new List(); + + foreach (var key in Cells(a, b)) + { + if (!cells.TryGetValue(key, out var list)) continue; + + foreach (int i in list) + { + if (stamp[i] != query) + { + stamp[i] = query; + result.Add(i); + } + } + } + + return result; + } + } + private static bool IsFinite(double x) => !double.IsNaN(x) && !double.IsInfinity(x); private static double DistanceToSegment(Point v, Point p, Point q) diff --git a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs index a75a58f..c2ad568 100644 --- a/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs +++ b/src/Triangle.Tests/Robustness/NodingAndRefinementTest.cs @@ -194,13 +194,35 @@ public void StackedNearlyIdenticalSquaresBeyondTolerance([Values(1e-6, 1e-5, 1e- } [Test] - public void NodingThatDoesNotConvergeIsReported() + public void NodingThatDoesNotConvergeFallsBackToSnapRounding() { - // If noding doesn't converge (here: only one iteration allowed), this must be - // reported instead of running forever or returning crossing segments. + // If noding doesn't converge (here: only one iteration allowed; in practice e.g. + // many segments crossing at tiny angles, test input issue-211 of artem-ogre/CDT), + // snap rounding to the largest tolerance is used instead of giving up. It never + // returns crossing segments. var poly = StackedSquares(1e-6); - Assert.Throws(() => SegmentNoder.Node(poly, new RobustPredicates(), maxIterations: 1)); + var noded = SegmentNoder.Node(poly, new RobustPredicates(), maxIterations: 1); + + var predicates = new RobustPredicates(); + var segments = noded.Segments.ToList(); + + for (int i = 0; i < segments.Count; i++) + { + for (int j = i + 1; j < segments.Count; j++) + { + Vertex a = segments[i].GetVertex(0), b = segments[i].GetVertex(1); + Vertex c = segments[j].GetVertex(0), d = segments[j].GetVertex(1); + + bool cross = predicates.CounterClockwise(a, b, c) * predicates.CounterClockwise(a, b, d) < 0 && + predicates.CounterClockwise(c, d, a) * predicates.CounterClockwise(c, d, b) < 0; + + Assert.That(cross, Is.False); + } + } + + var mesh = new GenericMesher().Triangulate(noded, new ConstraintOptions { ResolveIntersections = false }); + MeshAssert.IsValid(mesh); } [Test] diff --git a/src/Triangle/Meshing/SegmentNoder.cs b/src/Triangle/Meshing/SegmentNoder.cs index 692c273..9897b27 100644 --- a/src/Triangle/Meshing/SegmentNoder.cs +++ b/src/Triangle/Meshing/SegmentNoder.cs @@ -128,6 +128,16 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double } } + // Last resort: snap rounding to the largest tolerance (always converges in theory, + // e.g. for many segments crossing at tiny angles, where the rounded intersection + // points keep creating new intersections). + var rounded = SnapRound(polygon, predicates, tolerance, 100, fallback: false); + + if (rounded != null) + { + return rounded; + } + throw new InvalidOperationException("Segment noding doesn't converge (too many nearly coincident segments). " + "Consider cleaning the input (e.g. snapping it to a grid)."); } @@ -152,7 +162,14 @@ public static IPolygon Node(IPolygon polygon, IPredicates predicates, out double /// If snap rounding doesn't converge, the result of /// with the grid size as minimum tolerance is returned (not all vertices are on the grid then). /// - public static IPolygon SnapRound(IPolygon polygon, IPredicates predicates, double gridSize, int maxIterations = 20) + public static IPolygon SnapRound(IPolygon polygon, IPredicates predicates, double gridSize, int maxIterations = 100) + { + return SnapRound(polygon, predicates, gridSize, maxIterations, fallback: true); + } + + /// If true, the result of + /// is returned if snap rounding doesn't converge, otherwise null. + private static IPolygon SnapRound(IPolygon polygon, IPredicates predicates, double gridSize, int maxIterations, bool fallback) { if (!(gridSize > 0.0) || double.IsInfinity(gridSize)) { @@ -263,7 +280,13 @@ Vertex Snap(Vertex p) { var splits = new Dictionary>(); - foreach (var (i, j) in FindCrossings(segments, predicates)) + // First route the segments through the hot pixels of the existing vertices: this + // merges nearly coincident segments without creating new vertices. (Computing + // new intersections first made the number of vertices explode for segments + // crossing at tiny angles, whose rounded intersections create new crossings.) + AddHotPixels(segments, vertices, half, retired, splits); + + foreach (var (i, j) in splits.Count > 0 ? new List<(int, int)>() : FindCrossings(segments, predicates)) { var a = segments[i].GetVertex(0); var b = segments[i].GetVertex(1); @@ -303,11 +326,6 @@ Vertex Snap(Vertex p) } } - if (splits.Count == 0) - { - AddHotPixels(segments, vertices, half, retired, splits); - } - if (splits.Count == 0) { converged = true; @@ -325,7 +343,7 @@ Vertex Snap(Vertex p) if (!converged) { - return Node(polygon, predicates, minTolerance: gridSize); + return fallback ? Node(polygon, predicates, minTolerance: gridSize) : null; } if (!changed) From a1424df2fa9318547a017f098b13f7ffa8dd5aff Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 04:58:01 +0000 Subject: [PATCH 30/50] Add switchable field layout for net48 (TriangleLayout=Fields|Arrays) Triangles and subsegments can store vertices, neighbors and subsegments as plain fields accessed through ref indexers, so .NET Framework 4.8 gets one heap object per triangle instead of four. Default stays InlineArray on net8.0 and arrays on netstandard2.0. Benchmarks also target net48. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 34 ++++++++++++ src/Triangle.Benchmarks/Program.cs | 5 ++ .../Triangle.Benchmarks.csproj | 4 +- src/Triangle/Topology/InlineBuffers.cs | 2 +- src/Triangle/Topology/SubSegment.cs | 54 +++++++++++++++++- src/Triangle/Topology/Triangle.cs | 55 ++++++++++++++++++- src/Triangle/Triangle.csproj | 11 ++++ 7 files changed, 161 insertions(+), 4 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 8efee1d..5c72abe 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -368,6 +368,40 @@ vergleichbar, die CPU-Leistung schwankte dort um 20–25 %): Der Herne-Korpus (201 Kacheln, Raster + Keil) läuft in 60/92 s statt 109/180 s (20°/30°). +#### Speicherlayout für .NET Framework 4.8 (`TriangleLayout`) + +`[InlineArray]` gibt es erst ab .NET 8. Für `netstandard2.0` (also net48) lässt sich beim Bauen +ein Layout wählen, bei dem Ecken, Nachbarn und Teilsegmente als einzelne Felder im Objekt +liegen (ein Heap-Objekt pro Dreieck statt vier). Der Zugriff läuft über kleine Strukturen mit +`ref`-Indexer, der übrige Code bleibt unverändert: + +| Eigenschaft | Layout | +|-------------|--------| +| (Standard) | `net8.0`: InlineArray, `netstandard2.0`: Arrays | +| `-p:TriangleLayout=Fields` | einzelne Felder in allen Zielplattformen | +| `-p:TriangleLayout=Arrays` | Arrays in allen Zielplattformen (altes Verhalten) | + +Alle Tests laufen in allen drei Varianten grün, die Golden-Fingerprints sind gleich. Ob `Fields` +unter net48 schneller ist, muss auf Windows gemessen werden (der JIT von .NET Framework inlinet +anders als .NET 8; hier läuft kein net48). `Triangle.Benchmarks` baut dafür zusätzlich `net48`: + +``` +dotnet run -c Release -f net48 --project src/Triangle.Benchmarks -p:TriangleLayout=Arrays -- --filter "*" +dotnet run -c Release -f net48 --project src/Triangle.Benchmarks -p:TriangleLayout=Fields -- --filter "*" +``` + +Mit `TRIANGLE_BENCH_SCENARIOS=herne_373600_5709000/q30-snap1cm` (kommagetrennt) lässt sich die +Auswahl einschränken. Läufe abwechselnd starten, da die CPU-Leistung schwanken kann. + +Einbinden im eigenen Projekt, wenn `Fields` gewinnt: + +```xml + +``` + +oder beim Bauen `msbuild /p:TriangleLayout=Fields` bzw. `dotnet build -p:TriangleLayout=Fields`. + ## Standard-Benchmarks für CDT (`BenchmarkDatasetsTest`, Korpus) Immer im Testlauf (`Robustness/BenchmarkDatasetsTest.cs`, Daten in `Robustness/Data`): diff --git a/src/Triangle.Benchmarks/Program.cs b/src/Triangle.Benchmarks/Program.cs index f174957..d21c3c8 100644 --- a/src/Triangle.Benchmarks/Program.cs +++ b/src/Triangle.Benchmarks/Program.cs @@ -9,6 +9,11 @@ namespace TriangleNet.Benchmarks /// /// dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*" /// dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*" --job short + /// + /// Memory layout of triangles on .NET Framework 4.8 (Windows): compare + /// dotnet run -c Release -f net48 --project src/Triangle.Benchmarks -p:TriangleLayout=Arrays -- --filter "*" + /// dotnet run -c Release -f net48 --project src/Triangle.Benchmarks -p:TriangleLayout=Fields -- --filter "*" + /// (select scenarios with the environment variable TRIANGLE_BENCH_SCENARIOS, see MeshingBenchmark). /// public static class Program { diff --git a/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj b/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj index 20dd07c..2602bbf 100644 --- a/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj +++ b/src/Triangle.Benchmarks/Triangle.Benchmarks.csproj @@ -2,7 +2,9 @@ Exe - net10.0 + + net10.0;net48 + latest TriangleNet.Benchmarks false diff --git a/src/Triangle/Topology/InlineBuffers.cs b/src/Triangle/Topology/InlineBuffers.cs index aa4f22e..debbac2 100644 --- a/src/Triangle/Topology/InlineBuffers.cs +++ b/src/Triangle/Topology/InlineBuffers.cs @@ -4,7 +4,7 @@ // // ----------------------------------------------------------------------- -#if NET8_0_OR_GREATER +#if NET8_0_OR_GREATER && !FIELD_LAYOUT && !ARRAY_LAYOUT namespace TriangleNet.Topology { using System.Runtime.CompilerServices; diff --git a/src/Triangle/Topology/SubSegment.cs b/src/Triangle/Topology/SubSegment.cs index 359cde0..9146190 100644 --- a/src/Triangle/Topology/SubSegment.cs +++ b/src/Triangle/Topology/SubSegment.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Topology { using System; + using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -18,7 +19,16 @@ public class SubSegment : ISegment // Hash for dictionary. Will be set by mesh instance. internal int hash; -#if NET8_0_OR_GREATER +#if FIELD_LAYOUT + // Fields with ref-returning indexers (see Triangle). + private Osub subseg0, subseg1; + private Vertex vertex0, vertex1, vertex2, vertex3; + private Otri triangle0, triangle1; + + internal SubsegList subsegs => new SubsegList(this); + internal VertexList vertices => new VertexList(this); + internal TriangleList triangles => new TriangleList(this); +#elif NET8_0_OR_GREATER && !ARRAY_LAYOUT // Stored inline instead of arrays (fewer objects on the heap, see Triangle). internal Buffer2 subsegs; internal Buffer4 vertices; @@ -39,6 +49,48 @@ public SubSegment() // boundary marker is zero. } +#if FIELD_LAYOUT + internal readonly struct SubsegList + { + private readonly SubSegment o; + + public SubsegList(SubSegment o) { this.o = o; } + + public ref Osub this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.subseg0 : ref o.subseg1; + } + } + + internal readonly struct VertexList + { + private readonly SubSegment o; + + public VertexList(SubSegment o) { this.o = o; } + + public ref Vertex this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.vertex0 : ref index == 1 ? ref o.vertex1 : ref index == 2 ? ref o.vertex2 : ref o.vertex3; + } + } + + internal readonly struct TriangleList + { + private readonly SubSegment o; + + public TriangleList(SubSegment o) { this.o = o; } + + public ref Otri this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.triangle0 : ref o.triangle1; + } + } + +#endif + #region Public properties /// diff --git a/src/Triangle/Topology/Triangle.cs b/src/Triangle/Topology/Triangle.cs index 2768076..f016742 100644 --- a/src/Triangle/Topology/Triangle.cs +++ b/src/Triangle/Topology/Triangle.cs @@ -8,6 +8,7 @@ namespace TriangleNet.Topology { using System; + using System.Runtime.CompilerServices; using TriangleNet.Geometry; /// @@ -21,7 +22,17 @@ public class Triangle : ITriangle // The ID is only used for mesh output. internal int id; -#if NET8_0_OR_GREATER +#if FIELD_LAYOUT + // Fields with ref-returning indexers (one heap object per triangle, also on + // netstandard2.0, e.g. .NET Framework 4.8). Build with -p:TriangleLayout=Fields. + private Vertex vertex0, vertex1, vertex2; + private Otri neighbor0, neighbor1, neighbor2; + private Osub subseg0, subseg1, subseg2; + + internal VertexList vertices => new VertexList(this); + internal NeighborList neighbors => new NeighborList(this); + internal SubsegList subsegs => new SubsegList(this); +#elif NET8_0_OR_GREATER && !ARRAY_LAYOUT // The vertices, adjoining triangles and subsegments are stored inline. With arrays, a // triangle consists of four objects on the heap, which make up more than half of all // allocations of a quality mesh and a large part of the garbage collection time. @@ -45,6 +56,48 @@ public Triangle() // The vertices, adjoining subsegments and triangles are null (default). } +#if FIELD_LAYOUT + internal readonly struct VertexList + { + private readonly Triangle o; + + public VertexList(Triangle o) { this.o = o; } + + public ref Vertex this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.vertex0 : ref index == 1 ? ref o.vertex1 : ref o.vertex2; + } + } + + internal readonly struct NeighborList + { + private readonly Triangle o; + + public NeighborList(Triangle o) { this.o = o; } + + public ref Otri this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.neighbor0 : ref index == 1 ? ref o.neighbor1 : ref o.neighbor2; + } + } + + internal readonly struct SubsegList + { + private readonly Triangle o; + + public SubsegList(Triangle o) { this.o = o; } + + public ref Osub this[int index] + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => ref index == 0 ? ref o.subseg0 : ref index == 1 ? ref o.subseg1 : ref o.subseg2; + } + } + +#endif + #region Public properties /// diff --git a/src/Triangle/Triangle.csproj b/src/Triangle/Triangle.csproj index aed2c6e..128f148 100644 --- a/src/Triangle/Triangle.csproj +++ b/src/Triangle/Triangle.csproj @@ -12,6 +12,17 @@ default + + + $(DefineConstants);FIELD_LAYOUT + + + $(DefineConstants);ARRAY_LAYOUT + + From cf7da2266d13f53b23826b12e4963a7f53965ea9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 05:48:49 +0000 Subject: [PATCH 31/50] Add optional Steiner point reduction and ODT smoothing after refinement QualityOptions.ReduceSteinerPoints deletes free Steiner points whose retriangulated cavity meets all quality constraints, or collapses an edge to a free neighbor when that makes the point removable (exactly undoable flips otherwise). QualityOptions.SmoothingSteps moves free Steiner points towards the optimal Delaunay triangulation position (grid-rounded) and keeps only moves that improve the changed triangles. Input vertices, segments and segment vertices are never changed. Herne tile 30 deg with 1 cm grid: 17-18% fewer triangles and fewer bad triangles. Tests cover all catalog scenarios with full invariants. Docs: research summary and .NET 10 layout benchmark (Fields slower). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 79 +++- .../Characterization/MeshCases.cs | 33 +- .../Robustness/SteinerReductionTest.cs | 173 +++++++ .../Robustness/SteinerSmoothingTest.cs | 154 +++++++ src/Triangle/Meshing/QualityMesher.cs | 28 ++ src/Triangle/Meshing/QualityOptions.cs | 28 ++ src/Triangle/Meshing/SteinerReducer.cs | 412 +++++++++++++++++ src/Triangle/Meshing/SteinerSmoother.cs | 429 ++++++++++++++++++ src/Triangle/Meshing/TriangleQuality.cs | 130 ++++++ 9 files changed, 1458 insertions(+), 8 deletions(-) create mode 100644 src/Triangle.Tests/Robustness/SteinerReductionTest.cs create mode 100644 src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs create mode 100644 src/Triangle/Meshing/SteinerReducer.cs create mode 100644 src/Triangle/Meshing/SteinerSmoother.cs create mode 100644 src/Triangle/Meshing/TriangleQuality.cs diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 5c72abe..3b8eecc 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -381,9 +381,21 @@ liegen (ein Heap-Objekt pro Dreieck statt vier). Der Zugriff läuft über kleine | `-p:TriangleLayout=Fields` | einzelne Felder in allen Zielplattformen | | `-p:TriangleLayout=Arrays` | Arrays in allen Zielplattformen (altes Verhalten) | -Alle Tests laufen in allen drei Varianten grün, die Golden-Fingerprints sind gleich. Ob `Fields` -unter net48 schneller ist, muss auf Windows gemessen werden (der JIT von .NET Framework inlinet -anders als .NET 8; hier läuft kein net48). `Triangle.Benchmarks` baut dafür zusätzlich `net48`: +Alle Tests laufen in allen drei Varianten grün, die Golden-Fingerprints sind gleich. Auf .NET 10 +(BenchmarkDotNet, je zwei Runden abwechselnd) ist `Fields` aber langsamer als `Arrays`, der +`ref`-Indexer mit Verzweigung kostet mehr, als die gesparten Objekte bringen: + +| Szenario | Arrays | Fields | InlineArray | +|----------|-------:|-------:|------------:| +| kleine Kachel 30° | 9,1 ms | 10,8 ms | 8,6 ms | +| kleine Kachel 20° | 25,6 ms | 29,3 ms | 23,7 ms | +| Zufallspunkte 30° | 32,2 ms | 35,1 ms | 29,7 ms | +| Kachel 30°, Snap 1 cm | 474 ms | 506 ms | 410 ms | +| Kachel 30°, Raster + Keil | 400 ms | 402 ms | 338 ms | + +Unter net48 kann es anders aussehen (anderer JIT und GC); hier läuft kein net48. Deshalb bleibt +`Arrays` der Standard für `netstandard2.0`. `Triangle.Benchmarks` baut für den Vergleich auf +Windows zusätzlich `net48`: ``` dotnet run -c Release -f net48 --project src/Triangle.Benchmarks -p:TriangleLayout=Arrays -- --filter "*" @@ -550,6 +562,67 @@ vorherigen Runden: | Herne Nutzung, Snap 1 cm (ungerundet) | 8,70 % / 10,74 %, 1–2 Kacheln am Limit | 1,10 % / 0,98 %, kein Limit | | Herne Nutzung ohne Snap | lief nicht durch | läuft durch, aber 110 von 201 Kacheln am Limit, 78 % schlecht: Snap ist nötig | +## Steiner-Punkte ausdünnen und glätten (`SteinerReductionTest`, `SteinerSmoothingTest`) + +Recherche (Oktober 2026) nach neueren, integrierbaren Verfahren. Die Grundverfahren sind älter und +im Fork schon enthalten (Off-Center nach Üngör, aCute nach Erten/Üngör, Snap-Rounding, +Greedy Insertion). Übernommen wurden zwei Ideen, die auf einem fertigen Qualitätsnetz arbeiten: + +* **Lokale Suche über Steiner-Punkte** (Abrahamsen, Brunck, Conradi, Kolbe, Nusser: „Computing + Non-Obtuse Triangulations with Few Steiner Points“, SoCG 2025, Gewinner der CG:SHOP Challenge + 2025): eine constrained Delaunay-Triangulierung, in der Steiner-Punkte entfernt, verschoben + oder hinzugefügt werden, je nachdem, was das Netz am meisten verbessert. Ähnlich „Delaunay + Sifting“: Steiner-Punkte entfernen, ohne die Qualitätsmaße zu verschlechtern. +* **Optimale Delaunay-Triangulierung (ODT)** (Chen/Xu 2004, Alliez u. a. 2005) und die + Verzahnung von Verfeinerung und Optimierung (Tournois, Alliez, Devillers, IMR 2007: weniger + Steiner-Punkte und bessere Qualität als reine Delaunay-Verfeinerung). + +Nicht übernommen: exakte implizite Punkte (Attene 2020, Diazzi u. a. 2023; die Ausgabe braucht +ohnehin Raster-/Gleitkommakoordinaten), Stable Snap Rounding, randomisiertes Einfügen von +Segmenten (GIS-Segmente sind kurz), parallele und lernende Verfahren (nicht deterministisch). + +Umsetzung (beide optional, Standard aus; Eingabepunkte, Segmente und Punkte auf Segmenten +werden nie verändert, gesperrte Kanten also auch nicht): + +* `QualityOptions.ReduceSteinerPoints`: Ein freier Steiner-Punkt wird gelöscht, wenn alle + Dreiecke der Delaunay-Triangulierung seines Hohlraums die Qualitätsvorgaben erfüllen (ohne die + Ausnahmen der Verfeinerung, z. B. das Rasterminimum) und kein Teilsegment verletzen. Der + Hohlraum wird vorab genauso trianguliert wie bei `Mesh.DeleteVertex`. Geht das nicht, wird ein + benachbarter freier Punkt auf die Mitte der gemeinsamen Kante geschoben (Kantenkollaps), wenn + der Punkt danach entfernbar ist und kein anderes Dreieck schlechter wird als vorher. Die Flips + dieser Verschiebung werden sonst exakt rückgängig gemacht. +* `QualityOptions.SmoothingSteps`: Durchläufe, in denen jeder freie Steiner-Punkt zur + ODT-Position (flächengewichtetes Mittel der Umkreismittelpunkte seiner Dreiecke) oder halb + dorthin rückt, im Rastermodus auf das Raster gerundet, mit Delaunay-Flips (nie über + Teilsegmente). Behalten wird die Verschiebung nur, wenn die geänderten Dreiecke besser werden + (weniger Verletzungen, sonst größerer kleinster Winkel). Kombiniert wird nach jedem Durchlauf + ausgedünnt. + +Ergebnis (Dreiecke, in Klammern Dreiecke unter dem Mindestwinkel; ALKIS-Kacheln Herne): + +| Szenario | ohne | ausdünnen | 3× glätten | 3× glätten + ausdünnen | +|----------|-----:|----------:|-----------:|-----------------------:| +| Kachel 30°, Snap 1 cm | 107.190 (1.147) | 104.312 (1.147) | 107.190 (1.147) | 103.984 (1.147), −3,0 % | +| Kachel 30°, Raster 1 cm + Keil 3 cm | 112.353 (3.319) | 97.015 (3.207) | 112.353 (3.153) | 92.167 (3.120), −18,0 % | +| kleine Kachel 20°, Snap 1 cm | 8.952 (184) | 8.596 (184) | 8.952 (184) | 8.514 (184), −4,9 % | +| Zufallspunkte 30° | 13.679 (0) | 13.587 (0) | 13.679 (0) | 13.567 (0), −0,8 % | + +Im Rastermodus lohnt es sich am meisten: Die gerundeten Steiner-Punkte der Verfeinerung +liegen oft dichter als nötig. Glätten hebt den mittleren kleinsten Winkel um 0,1–0,5°. +Durch das Ausdünnen sinkt er leicht, weil weniger Punkte da sind; der Mindestwinkel bleibt +eingehalten. Die schlechten Dreiecke an kleinen Eingabewinkeln bleiben (sie hängen an +Eingabepunkten und Segmenten). + +Mit `ConformingDelaunay` (so ruft der Fallback im alten Repo auf) dieselbe Kachel mit Raster: +136.265 Dreiecke (5.516 schlecht), ausgedünnt 119.271 (−12,5 %), geglättet und ausgedünnt +112.713 (−17,3 %, 5.210 schlecht). Laufzeit (Minimum aus drei Läufen): 0,5 s, 1,3 s, 2,7 s, +nur geglättet 0,7 s. + +Tests: alle Qualitätsszenarien des Katalogs mit allen Invarianten (Konsistenz, constrained bzw. +conforming Delaunay, Fläche, Segmente, gesperrte Segmente, Winkelgarantie), dazu: nur freie +Steiner-Punkte ändern sich, Segmente identisch, nicht mehr schlechte Dreiecke, kleinster Winkel +sinkt beim Glätten nie, Maximalfläche und -winkel, Raster, `UserTest`, Determinismus. + ## Klassenweises Review (`src/Triangle.Tests/Review`) Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit diff --git a/src/Triangle.Tests/Characterization/MeshCases.cs b/src/Triangle.Tests/Characterization/MeshCases.cs index 1a58dfd..c0391cc 100644 --- a/src/Triangle.Tests/Characterization/MeshCases.cs +++ b/src/Triangle.Tests/Characterization/MeshCases.cs @@ -62,6 +62,23 @@ public class Case /// public double Snap { get; set; } + /// + /// Runs the scenario with additional quality options (null if the scenario can't + /// be configured). + /// + public Func, Mesh> RunWith { get; set; } + + /// + /// A copy of the scenario with additional quality options. + /// + public Case With(string suffix, Action configure) + { + var copy = (Case)MemberwiseClone(); + copy.Name = Name + "+" + suffix; + copy.Run = p => RunWith(p, configure); + return copy; + } + public override string ToString() => Name; } @@ -174,7 +191,7 @@ private static Case Quality(string name, Func input, ConstraintOptions double maxArea = 0, bool variableArea = false, bool angleGuarantee = false, bool conforming = false, bool legacy = false, Func locked = null) { - return new Case + var c = new Case { Name = name, Input = input, @@ -183,8 +200,10 @@ private static Case Quality(string name, Func input, ConstraintOptions AngleGuarantee = angleGuarantee && minAngle > 0, Conforming = conforming, Locked = locked, - Snap = options.SnapTolerance, - Run = p => + Snap = options.SnapTolerance + }; + + c.RunWith = (p, configure) => { // Conforming Delaunay without quality constraints has no Steiner point // limit otherwise. @@ -199,9 +218,13 @@ private static Case Quality(string name, Func input, ConstraintOptions } : null; + if (quality != null) configure?.Invoke(quality); + return (Mesh)p.Triangulate(options, quality); - } - }; + }; + c.Run = p => c.RunWith(p, null); + + return c; } #region Inputs diff --git a/src/Triangle.Tests/Robustness/SteinerReductionTest.cs b/src/Triangle.Tests/Robustness/SteinerReductionTest.cs new file mode 100644 index 0000000..26e456e --- /dev/null +++ b/src/Triangle.Tests/Robustness/SteinerReductionTest.cs @@ -0,0 +1,173 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tests.Characterization; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Removing redundant Steiner points after refinement (): + /// a free Steiner point is deleted if all triangles of the retriangulated cavity still meet the + /// quality constraints. Input vertices, segments and points on segments are never touched. + /// + public class SteinerReductionTest + { + private static void Reduce(QualityOptions q) => q.ReduceSteinerPoints = true; + + public static IEnumerable QualityCases() => Select(MeshCases.All().Concat(MeshCases.GridCases())); + + // With an output grid the mesh isn't exactly Delaunay (see MeshCases.GridCases). + public static IEnumerable DelaunayCases() => Select(MeshCases.All()); + + private static IEnumerable Select(IEnumerable cases) => + cases.Where(c => c.RunWith != null && (c.MinAngle > 0 || c.MaxArea > 0)) + .Select(c => new TestCaseData(c).SetName("{m}(" + c.Name + ")")); + + [TestCaseSource(nameof(DelaunayCases))] + public void ReducedMeshKeepsAllInvariants(MeshCases.Case c) + { + var reduced = c.With("reduce", Reduce); + + var input = reduced.Input(); + var mesh = MeshAssert.Terminates(() => reduced.Run(input), TimeSpan.FromSeconds(120)); + + var reference = c.Input(); + var plain = reference.Segments.Count == 0 + ? (Mesh)new GenericMesher().Triangulate(reference.Points) + : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); + double area = plain.Triangles.Sum(MeshInvariants.Area); + + var errors = MeshInvariants.Check(mesh, input, reduced, area); + + Assert.That(errors, Is.Empty, string.Join(", ", errors)); + } + + [TestCaseSource(nameof(QualityCases))] + public void ReductionOnlyRemovesFreeSteinerPoints(MeshCases.Case c) + { + var plain = MeshAssert.Terminates(() => c.Run(c.Input()), TimeSpan.FromSeconds(120)); + var reduced = MeshAssert.Terminates(() => c.With("reduce", Reduce).Run(c.Input()), TimeSpan.FromSeconds(120)); + + Assert.That(reduced.Triangles.Count, Is.LessThanOrEqualTo(plain.Triangles.Count)); + + // Only free Steiner points are removed or moved (collapses move a neighbor). + var reducedFixed = reduced.Vertices.Where(v => v.Type != VertexType.FreeVertex).Select(v => (v.X, v.Y)).OrderBy(p => p); + var plainFixed = plain.Vertices.Where(v => v.Type != VertexType.FreeVertex).Select(v => (v.X, v.Y)).OrderBy(p => p); + + Assert.That(reducedFixed, Is.EqualTo(plainFixed), "input or segment vertex changed"); + Assert.That(reduced.Vertices.Count, Is.LessThanOrEqualTo(plain.Vertices.Count)); + + // Subsegments are unchanged. + Assert.That(Subsegments(reduced), Is.EqualTo(Subsegments(plain))); + + // Not more bad triangles than before (some can't be avoided near small input angles). + if (c.MinAngle > 0) + { + Assert.That(Bad(reduced, c.MinAngle), Is.LessThanOrEqualTo(Bad(plain, c.MinAngle))); + } + + if (c.MaxArea > 0) + { + Assert.That(reduced.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(c.MaxArea)); + } + } + + [TestCase("herne_373600_5709000/q30-snap1cm")] + [TestCase("herne_373600_5709000/q30-grid1cm-wedge3cm")] + [TestCase("points-random/q30")] + [TestCase("square/q20-area")] + public void ReductionRemovesSteinerPoints(string name) + { + var c = MeshCases.All().Concat(MeshCases.GridCases()).Single(x => x.Name == name); + + var plain = c.Run(c.Input()); + var reduced = c.With("reduce", Reduce).Run(c.Input()); + + int before = plain.Vertices.Count(v => v.Type == VertexType.FreeVertex); + int after = reduced.Vertices.Count(v => v.Type == VertexType.FreeVertex); + + TestContext.WriteLine($"{name}: triangles {plain.Triangles.Count} -> {reduced.Triangles.Count}, " + + $"free Steiner points {before} -> {after}"); + + Assert.That(after, Is.LessThan(before)); + } + + [Test] + public void GridModeKeepsVerticesOnTheGrid() + { + var c = MeshCases.GridCases().First().With("reduce", Reduce); + + var mesh = c.Run(c.Input()); + + Assert.That(mesh.Vertices.All(v => v.X == GridSnapper.Round(v.X, 0.01) && v.Y == GridSnapper.Round(v.Y, 0.01)), Is.True); + } + + [Test] + public void MaximumAngleAndAreaAreRespected() + { + var quality = new QualityOptions { MinimumAngle = 25, MaximumAngle = 110, MaximumArea = 0.3, ReduceSteinerPoints = true }; + + var mesh = (Mesh)TestData.SquareWithSegments((1, 1, 9, 2), (2, 8, 8, 7)).Triangulate(new ConstraintOptions(), quality); + + MeshAssert.IsValid(mesh); + + foreach (var t in mesh.Triangles) + { + Assert.That(MeshInvariants.Area(t), Is.LessThanOrEqualTo(0.3)); + Assert.That(MeshInvariants.MinimumAngle(t), Is.GreaterThanOrEqualTo(25 - 1e-9)); + Assert.That(MaximumAngle(t), Is.LessThanOrEqualTo(110 + 1e-9)); + } + } + + [Test] + public void UserTestDisablesReduction() + { + // A user test can't be evaluated for triangles that don't exist yet. + bool Large(ITriangle t, double area) => area > 0.5; + + var plain = (Mesh)TestData.SquareWithSegments((1, 1, 9, 2)).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 30, UserTest = Large }); + var reduced = (Mesh)TestData.SquareWithSegments((1, 1, 9, 2)).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 30, UserTest = Large, ReduceSteinerPoints = true }); + + Assert.That(reduced.Triangles.Count, Is.EqualTo(plain.Triangles.Count)); + } + + [Test] + public void ReductionIsDeterministic() + { + var c = MeshCases.All().Single(x => x.Name == "herne_371800_5710600/q30-snap1cm").With("reduce", Reduce); + + Assert.That(MeshInvariants.Fingerprint(c.Run(c.Input())), Is.EqualTo(MeshInvariants.Fingerprint(c.Run(c.Input())))); + } + + private static int Bad(Mesh mesh, double minAngle) => + mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < minAngle - 1e-9); + + private static List<(double, double, double, double)> Subsegments(Mesh mesh) + { + return mesh.Segments.Select(s => + { + Point a = s.GetVertex(0), b = s.GetVertex(1); + return a.X < b.X || (a.X == b.X && a.Y < b.Y) ? (a.X, a.Y, b.X, b.Y) : (b.X, b.Y, a.X, a.Y); + }).OrderBy(k => k).ToList(); + } + + private static double MaximumAngle(ITriangle t) + { + double max = 0; + + for (int i = 0; i < 3; i++) + { + Point a = t.GetVertex(i), b = t.GetVertex((i + 1) % 3), c = t.GetVertex((i + 2) % 3); + double ux = b.X - a.X, uy = b.Y - a.Y, vx = c.X - a.X, vy = c.Y - a.Y; + max = Math.Max(max, Math.Atan2(Math.Abs(ux * vy - uy * vx), ux * vx + uy * vy) * 180 / Math.PI); + } + + return max; + } + } +} diff --git a/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs b/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs new file mode 100644 index 0000000..d8f0b64 --- /dev/null +++ b/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs @@ -0,0 +1,154 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using TriangleNet.Geometry; +using TriangleNet.Meshing; +using TriangleNet.Tests.Characterization; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Smoothing of the Steiner points after refinement (): + /// free Steiner points move towards the optimal Delaunay triangulation position if that makes + /// the changed triangles better. Input vertices, segments and points on segments are not changed. + /// + public class SteinerSmoothingTest + { + private static void Smooth(QualityOptions q) => q.SmoothingSteps = 3; + + private static void SmoothAndReduce(QualityOptions q) + { + q.SmoothingSteps = 3; + q.ReduceSteinerPoints = true; + } + + public static IEnumerable QualityCases() => + SteinerReductionTest.QualityCases(); + + public static IEnumerable DelaunayCases() => + SteinerReductionTest.DelaunayCases(); + + [TestCaseSource(nameof(DelaunayCases))] + public void SmoothedMeshKeepsAllInvariants(MeshCases.Case c) + { + AssertInvariants(c.With("smooth", Smooth), c); + } + + [TestCaseSource(nameof(DelaunayCases))] + public void SmoothedAndReducedMeshKeepsAllInvariants(MeshCases.Case c) + { + AssertInvariants(c.With("smooth-reduce", SmoothAndReduce), c); + } + + [TestCaseSource(nameof(QualityCases))] + public void SmoothingOnlyMovesFreeSteinerPointsAndNeverMakesTheMeshWorse(MeshCases.Case c) + { + var plain = MeshAssert.Terminates(() => c.Run(c.Input()), TimeSpan.FromSeconds(120)); + var smoothed = MeshAssert.Terminates(() => c.With("smooth", Smooth).Run(c.Input()), TimeSpan.FromSeconds(120)); + + Assert.That(smoothed.Vertices.Count, Is.EqualTo(plain.Vertices.Count)); + Assert.That(smoothed.Triangles.Count, Is.EqualTo(plain.Triangles.Count)); + + var smoothedFixed = smoothed.Vertices.Where(v => v.Type != VertexType.FreeVertex).Select(v => (v.X, v.Y)).OrderBy(p => p); + var plainFixed = plain.Vertices.Where(v => v.Type != VertexType.FreeVertex).Select(v => (v.X, v.Y)).OrderBy(p => p); + + Assert.That(smoothedFixed, Is.EqualTo(plainFixed), "input or segment vertex changed"); + + // Each move makes the changed triangles better, so the smallest angle can't decrease + // and no more triangles violate the minimum angle. + if (c.MinAngle > 0) + { + Assert.That(smoothed.Triangles.Min(MeshInvariants.MinimumAngle), + Is.GreaterThanOrEqualTo(plain.Triangles.Min(MeshInvariants.MinimumAngle) - 1e-9)); + Assert.That(Bad(smoothed, c.MinAngle), Is.LessThanOrEqualTo(Bad(plain, c.MinAngle))); + } + + if (c.MaxArea > 0) + { + Assert.That(smoothed.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(c.MaxArea)); + } + } + + [TestCase("herne_373600_5709000/q30-snap1cm")] + [TestCase("herne_373600_5709000/q30-grid1cm-wedge3cm")] + [TestCase("points-random/q30")] + public void SmoothingImprovesTheAverageQuality(string name) + { + var c = MeshCases.All().Concat(MeshCases.GridCases()).Single(x => x.Name == name); + + var plain = c.Run(c.Input()); + var smoothed = c.With("smooth", Smooth).Run(c.Input()); + + double before = plain.Triangles.Average(MeshInvariants.MinimumAngle); + double after = smoothed.Triangles.Average(MeshInvariants.MinimumAngle); + + TestContext.WriteLine($"{name}: mean minimum angle {before:F2} -> {after:F2}, " + + $"bad {Bad(plain, c.MinAngle)} -> {Bad(smoothed, c.MinAngle)}"); + + Assert.That(after, Is.GreaterThan(before)); + } + + [Test] + public void SmoothingWithReductionRemovesMoreSteinerPoints() + { + var c = MeshCases.GridCases().Single(x => x.Name == "herne_373600_5709000/q30-grid1cm-wedge3cm"); + + var reduced = c.With("reduce", q => q.ReduceSteinerPoints = true).Run(c.Input()); + var both = c.With("smooth-reduce", SmoothAndReduce).Run(c.Input()); + + Assert.That(both.Vertices.Count, Is.LessThan(reduced.Vertices.Count)); + Assert.That(Bad(both, c.MinAngle), Is.LessThanOrEqualTo(Bad(reduced, c.MinAngle))); + } + + [Test] + public void GridModeKeepsVerticesOnTheGrid() + { + var c = MeshCases.GridCases().First().With("smooth-reduce", SmoothAndReduce); + + var mesh = c.Run(c.Input()); + + Assert.That(mesh.Vertices.All(v => v.X == GridSnapper.Round(v.X, 0.01) && v.Y == GridSnapper.Round(v.Y, 0.01)), Is.True); + } + + [Test] + public void UserTestIsRespected() + { + bool Large(ITriangle t, double area) => area > 0.5; + + var mesh = (Mesh)TestData.SquareWithSegments((1, 1, 9, 2), (2, 8, 8, 7)).Triangulate(new ConstraintOptions(), + new QualityOptions { MinimumAngle = 30, UserTest = Large, SmoothingSteps = 5 }); + + MeshAssert.IsValid(mesh); + + Assert.That(mesh.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(0.5)); + } + + [Test] + public void SmoothingIsDeterministic() + { + var c = MeshCases.All().Single(x => x.Name == "herne_371800_5710600/q30-snap1cm").With("smooth-reduce", SmoothAndReduce); + + Assert.That(MeshInvariants.Fingerprint(c.Run(c.Input())), Is.EqualTo(MeshInvariants.Fingerprint(c.Run(c.Input())))); + } + + private static void AssertInvariants(MeshCases.Case configured, MeshCases.Case c) + { + var input = configured.Input(); + var mesh = MeshAssert.Terminates(() => configured.Run(input), TimeSpan.FromSeconds(120)); + + var reference = c.Input(); + var plain = reference.Segments.Count == 0 + ? (Mesh)new GenericMesher().Triangulate(reference.Points) + : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); + double area = plain.Triangles.Sum(MeshInvariants.Area); + + var errors = MeshInvariants.Check(mesh, input, configured, area); + + Assert.That(errors, Is.Empty, string.Join(", ", errors)); + } + + private static int Bad(Mesh mesh, double minAngle) => + mesh.Triangles.Count(t => MeshInvariants.MinimumAngle(t) < minAngle - 1e-9); + } +} diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 679ebc5..0de107c 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -39,6 +39,10 @@ class QualityMesher bool enableAcute = true; + bool reduceSteinerPoints; + + int smoothingSteps; + public QualityMesher(Mesh mesh, Configuration config) { badsubsegs = new Queue(); @@ -79,6 +83,9 @@ public void Apply(QualityOptions quality, bool delaunay = false, CancellationTok mesh.steinerleft = quality.SteinerPoints == 0 ? -1 : quality.SteinerPoints; enableAcute = !quality.UseLegacyRefinement; + + reduceSteinerPoints = quality.ReduceSteinerPoints; + smoothingSteps = quality.SmoothingSteps; } // Ensure that no vertex can be mistaken for a triangular bounding @@ -1394,6 +1401,22 @@ private void CheckOrientation() /// /// Remove all the encroached subsegments and bad triangles from the triangulation. /// + /// + /// Smooth and remove Steiner points (see + /// and ). + /// + private void OptimizeSteinerPoints(CancellationToken cancellationToken) + { + var smoother = smoothingSteps > 0 ? new SteinerSmoother(mesh, predicates, gridSize) : null; + var reducer = reduceSteinerPoints ? new SteinerReducer(mesh, predicates, gridSize) : null; + + for (int i = 0; i < Math.Max(1, smoothingSteps); i++) + { + smoother?.Apply(cancellationToken); + reducer?.Apply(cancellationToken); + } + } + private void EnforceQuality(CancellationToken cancellationToken) { BadTriangle badtri; @@ -1443,6 +1466,11 @@ private void EnforceQuality(CancellationToken cancellationToken) // of Steiner points, the triangulation should be (conforming) Delaunay // and have no low-quality triangles. + if (reduceSteinerPoints || smoothingSteps > 0) + { + OptimizeSteinerPoints(cancellationToken); + } + CheckOrientation(); // Might we have run out of Steiner points too soon? diff --git a/src/Triangle/Meshing/QualityOptions.cs b/src/Triangle/Meshing/QualityOptions.cs index 6980c16..839e988 100644 --- a/src/Triangle/Meshing/QualityOptions.cs +++ b/src/Triangle/Meshing/QualityOptions.cs @@ -69,5 +69,33 @@ public class QualityOptions /// used (Ruppert's algorithm). Otherwise the aCute algorithm is used. /// public bool UseLegacyRefinement { get; set; } + + /// + /// Gets or sets a value indicating whether redundant Steiner points are removed after + /// refinement (default = false). + /// + /// + /// Refinement inserts Steiner points greedily, and later points often make earlier ones + /// unnecessary. If this flag is set, a Steiner point that doesn't lie on a segment is + /// deleted if all triangles of the retriangulated cavity meet the quality constraints + /// (and don't encroach upon subsegments). Input vertices, segments and the points on + /// segments are not changed. Not applied if a is set. + /// + public bool ReduceSteinerPoints { get; set; } + + /// + /// Gets or sets the number of smoothing passes over the Steiner points after refinement + /// (default = 0). + /// + /// + /// In each pass, every Steiner point that doesn't lie on a segment is moved towards the + /// position of the optimal Delaunay triangulation (the area-weighted mean of the + /// circumcenters of its triangles; on an output grid, rounded to the grid). A move is + /// kept only if the changed triangles get better, so no constraint that the mesh met + /// before is violated afterwards. Combined with , + /// redundant points are removed after each pass. Input vertices, segments and the + /// points on segments are not changed. Not applied if is set. + /// + public int SmoothingSteps { get; set; } } } diff --git a/src/Triangle/Meshing/SteinerReducer.cs b/src/Triangle/Meshing/SteinerReducer.cs new file mode 100644 index 0000000..b4d144a --- /dev/null +++ b/src/Triangle/Meshing/SteinerReducer.cs @@ -0,0 +1,412 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Meshing +{ + using System.Collections.Generic; + using System.Threading; + using TriangleNet.Geometry; + using TriangleNet.Topology; + + /// + /// Removes redundant Steiner points after refinement. + /// + /// + /// Delaunay refinement inserts points greedily, so later points often make earlier ones + /// unnecessary (cf. "Delaunay sifting", and the local search of Abrahamsen et al., + /// "Computing Non-Obtuse Triangulations with Few Steiner Points", SoCG 2025, which also + /// removes Steiner points of a constrained Delaunay triangulation). + /// + /// A free Steiner point (not on a segment) is deleted if all triangles of the Delaunay + /// triangulation of its cavity meet the quality constraints and don't encroach upon a + /// subsegment. The cavity is triangulated the same way + /// does it, so the check sees the triangles the deletion creates. Input vertices, + /// segments and points on segments are not changed, and no coordinates are created + /// (vertices on an output grid stay on the grid). + /// + internal class SteinerReducer + { + // Larger cavities are skipped (they don't occur in quality meshes). + private const int MaxDegree = 64; + + private readonly Mesh mesh; + private readonly Behavior behavior; + private readonly IPredicates predicates; + + // The cavity polygon (counterclockwise) and whether its edge i -> i + 1 is a subsegment. + private readonly List polygon = new List(); + private readonly List constrained = new List(); + + // Polygon indices of the vertices of the retriangulated cavity. + private readonly List chain = new List(); + + private double areaLimit; + private bool tie; + + // Moves neighbors for collapses. + private readonly SteinerSmoother smoother; + private readonly List neighbors = new List(); + + public SteinerReducer(Mesh mesh, IPredicates predicates, double gridSize) + { + this.mesh = mesh; + this.behavior = mesh.behavior; + this.predicates = predicates; + + smoother = behavior.Exclude == null ? new SteinerSmoother(mesh, predicates, gridSize) : null; + } + + /// + /// Remove redundant Steiner points. + /// + /// The number of removed points. + public int Apply(CancellationToken cancellationToken) + { + if (behavior.UserTest != null) + { + return 0; + } + + int removed = 0; + + var handles = new List(); + + HashSet candidates = null; + + // Deleting a point changes the cavities of its neighbors, so repeat for the + // neighbors of deleted points until no point can be removed. + do + { + CollectFreeVertices(mesh, handles, candidates); + + candidates = new HashSet(); + + foreach (var handle in handles) + { + cancellationToken.ThrowIfCancellationRequested(); + + var deltri = handle; + + if (!Find(ref deltri)) + { + continue; + } + + if (Removable(deltri)) + { + candidates.UnionWith(polygon); + mesh.DeleteVertex(ref deltri); + removed++; + } + else if (smoother != null && Collapse(deltri, candidates)) + { + removed++; + } + } + } + while (candidates.Count > 0); + + return removed; + } + + /// + /// Collect one triangle per free Steiner point (with the point as origin). + /// + internal static void CollectFreeVertices(Mesh mesh, List handles, HashSet only = null) + { + handles.Clear(); + + var seen = new HashSet(); + var tri = default(Otri); + + foreach (var t in mesh.triangles) + { + tri.tri = t; + + for (tri.orient = 0; tri.orient < 3; tri.orient++) + { + var v = tri.Org(); + + if (v.type == VertexType.FreeVertex && (only == null || only.Contains(v)) && seen.Add(v)) + { + handles.Add(tri); + } + } + } + } + + /// + /// Check that the handle still has a free Steiner point as origin (earlier deletions + /// flip edges and free triangles). + /// + private static bool Find(ref Otri tri) + { + return !Otri.IsDead(tri.tri) && tri.Org().type == VertexType.FreeVertex; + } + + /// + /// Try to delete the origin of the given triangle after moving a neighbor (a free + /// Steiner point) to the midpoint of their edge, which collapses the edge. + /// + /// + /// The move is kept only if the point can then be deleted, and the other triangles + /// changed by the move don't violate more constraints than before (see + /// ). + /// + private bool Collapse(Otri deltri, HashSet changed) + { + Vertex w = deltri.Org(); + + var tri = deltri; + var nb = default(Otri); + + neighbors.Clear(); + + do + { + if (tri.tri.id == Mesh.DUMMY) + { + return false; + } + + if (tri.Dest().type == VertexType.FreeVertex) + { + // The edge from the neighbor to w. + tri.Sym(ref nb); + neighbors.Add(nb); + } + + tri.Onext(); + } + while (!tri.Equals(deltri)); + + var found = default(Otri); + + foreach (var start in neighbors) + { + Vertex v = start.Org(); + + if (smoother.TryMove(start, 0.5 * (v.x + w.x), 0.5 * (v.y + w.y), + () => Find(smoother.Touched, w, ref found) && Removable(found) && smoother.NotWorse(w))) + { + changed.UnionWith(polygon); + foreach (var t in smoother.Touched) + { + changed.Add(t.vertices[0]); + changed.Add(t.vertices[1]); + changed.Add(t.vertices[2]); + } + + mesh.DeleteVertex(ref found); + return true; + } + } + + return false; + } + + /// + /// Find a triangle with the given origin. + /// + private static bool Find(List triangles, Vertex v, ref Otri tri) + { + foreach (var t in triangles) + { + tri.tri = t; + + for (tri.orient = 0; tri.orient < 3; tri.orient++) + { + if (tri.Org() == v) + { + return true; + } + } + } + + return false; + } + + /// + /// Check whether the origin of the given triangle can be deleted. + /// + private bool Removable(Otri deltri) + { + if (!GatherCavity(deltri)) + { + return false; + } + + // Triangulate the cavity: polygon vertices 1, 2, ..., n - 1, 0, base edge 0 -> 1. + int n = polygon.Count; + + chain.Clear(); + for (int i = 1; i < n; i++) chain.Add(i); + chain.Add(0); + + tie = false; + + if (!Triangulate(0, n - 1)) + { + return false; + } + + // In a cocircular configuration, the deletion may choose other diagonals. They + // have the same angles opposite to each polygon edge (so the same minimum angle + // and encroachments), but not the same maximum angle and areas. + return !tie || (behavior.MaxAngle == 0.0 && !behavior.fixedArea && !behavior.VarArea); + } + + /// + /// Gather the polygon around the origin of the given triangle. Returns false if the + /// point can't be deleted. + /// + private bool GatherCavity(Otri deltri) + { + polygon.Clear(); + constrained.Clear(); + + var tri = deltri; + var edge = default(Otri); + var sub = default(Osub); + + Triangle first = deltri.tri; + + areaLimit = double.MaxValue; + + do + { + if (tri.tri.id == Mesh.DUMMY || polygon.Count == MaxDegree) + { + return false; + } + + // A segment through the point. + tri.Pivot(ref sub); + if (sub.seg.hash != Mesh.DUMMY) + { + return false; + } + + // All triangles of the cavity must belong to the same region. + if (tri.tri.label != first.label) + { + return false; + } + + if (behavior.Exclude != null && behavior.Exclude(tri.tri)) + { + return false; + } + + if (behavior.VarArea && tri.tri.area > 0.0 && tri.tri.area < areaLimit) + { + areaLimit = tri.tri.area; + } + + polygon.Add(tri.Dest()); + + // The polygon edge opposite to the point. + tri.Lnext(ref edge); + edge.Pivot(ref sub); + constrained.Add(sub.seg.hash != Mesh.DUMMY); + + tri.Onext(); + } + while (!tri.Equals(deltri)); + + return polygon.Count >= 3; + } + + /// + /// Triangulate the polygon chain[first], ..., chain[last] (counterclockwise, closed by + /// the edge chain[last] -> chain[first]) like + /// and check the triangles. + /// + private bool Triangulate(int first, int last) + { + if (last - first < 2) + { + return true; + } + + Vertex a = polygon[chain[first]]; + Vertex c = polygon[chain[last]]; + + // Find the vertex whose circle with the base edge contains no other vertex. + int best = first + 1; + + for (int i = first + 2; i < last; i++) + { + double incircle = predicates.InCircle(c, a, polygon[chain[best]], polygon[chain[i]]); + + if (incircle > 0.0) + { + best = i; + } + else if (incircle == 0.0) + { + tie = true; + } + } + + if (!Good(first, best, last)) + { + return false; + } + + return Triangulate(first, best) && Triangulate(best, last); + } + + /// + /// Check the triangle chain[i], chain[j], chain[k] of the retriangulated cavity. + /// + private bool Good(int i, int j, int k) + { + Vertex torg = polygon[chain[i]]; + Vertex tdest = polygon[chain[j]]; + Vertex tapex = polygon[chain[k]]; + + if (predicates.CounterClockwise(torg, tdest, tapex) <= 0.0) + { + return false; + } + + // Polygon edges which are subsegments must not be encroached. The edges of the + // triangle are polygon edges if their endpoints are adjacent in the chain. + if ((j == i + 1 && Encroached(chain[i], chain[j], tapex)) || + (k == j + 1 && Encroached(chain[j], chain[k], torg))) + { + return false; + } + + if (i == 0 && k == chain.Count - 1 && Encroached(chain[k], chain[i], tdest)) + { + return false; + } + + return TriangleQuality.Check(behavior, torg, tdest, tapex, areaLimit, out _); + } + + /// + /// Check whether the polygon edge from polygon[p] to polygon[q] is a subsegment that + /// the given apex encroaches upon (see QualityMesher.CheckSeg4Encroach). + /// + private bool Encroached(int p, int q, Vertex apex) + { + int n = polygon.Count; + + // Polygon edge p -> p + 1 (counterclockwise) or q -> q + 1. + bool isConstrained = (q == (p + 1) % n && constrained[p]) || (p == (q + 1) % n && constrained[q]); + + if (!isConstrained) + { + return false; + } + + return TriangleQuality.Encroaches(behavior, polygon[p], polygon[q], apex); + } + } +} diff --git a/src/Triangle/Meshing/SteinerSmoother.cs b/src/Triangle/Meshing/SteinerSmoother.cs new file mode 100644 index 0000000..4605a80 --- /dev/null +++ b/src/Triangle/Meshing/SteinerSmoother.cs @@ -0,0 +1,429 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Meshing +{ + using System.Collections.Generic; + using System.Threading; + using TriangleNet.Geometry; + using TriangleNet.Topology; + + /// + /// Moves free Steiner points to improve the mesh quality (optimal Delaunay triangulation + /// smoothing). + /// + /// + /// Each free Steiner point (not on a segment) is moved to the area-weighted mean of the + /// circumcenters of its triangles, the update of the optimal Delaunay triangulation + /// (L. Chen, J. Xu, "Optimal Delaunay triangulations", J. Comput. Math. 22, 2004; also + /// P. Alliez et al., "Variational tetrahedral meshing", 2005), or halfway there. On an + /// output grid, the new position is rounded to the grid. The triangulation is made + /// Delaunay again by edge flips (never across subsegments). The move is kept only if the + /// changed triangles are better than before: fewer triangles violate the quality + /// constraints, or the same number and the smallest angle is larger. Otherwise the flips + /// are undone exactly. So no triangle gets worse than the worst triangle it replaces, and + /// input vertices, segments and points on segments are not changed. + /// + internal class SteinerSmoother + { + // Points with more neighbors are skipped (they don't occur in quality meshes). + private const int MaxDegree = 64; + + // Flips per move (a move that needs more is rejected). + private const int MaxFlips = 256; + + private readonly Mesh mesh; + private readonly Behavior behavior; + private readonly IPredicates predicates; + private readonly double gridSize; + + private readonly List star = new List(); + private readonly List touched = new List(); + private readonly HashSet touchedSet = new HashSet(); + private readonly Stack work = new Stack(); + private readonly List flips = new List(); + private readonly List handles = new List(); + + private readonly Vertex candidate = new Vertex(); + + // Quality of the triangles before the move. + private int oldBad; + private double oldWorst; + + public SteinerSmoother(Mesh mesh, IPredicates predicates, double gridSize) + { + this.mesh = mesh; + this.behavior = mesh.behavior; + this.predicates = predicates; + this.gridSize = gridSize; + } + + /// + /// Move each free Steiner point once (if that improves the mesh). + /// + /// The number of moved points. + public int Apply(CancellationToken cancellationToken) + { + if (behavior.Exclude != null) + { + return 0; + } + + int moved = 0; + + SteinerReducer.CollectFreeVertices(mesh, handles); + + foreach (var handle in handles) + { + cancellationToken.ThrowIfCancellationRequested(); + + var tri = handle; + + if (!Otri.IsDead(tri.tri) && tri.Org().type == VertexType.FreeVertex && Move(tri)) + { + moved++; + } + } + + return moved; + } + + /// + /// Try to move the origin of the given triangle. + /// + private bool Move(Otri start) + { + if (!GatherStar(start)) + { + return false; + } + + Vertex v = start.Org(); + + double x = v.x; + double y = v.y; + + // Optimal Delaunay triangulation update: area-weighted mean of the circumcenters. + double sx = 0.0, sy = 0.0, sa = 0.0; + + foreach (var t in star) + { + Vertex b = t.Dest(); + Vertex c = t.Apex(); + + double bx = b.x - x, by = b.y - y; + double cx = c.x - x, cy = c.y - y; + + double d = 2.0 * (bx * cy - by * cx); + + if (d <= 0.0) + { + return false; + } + + double b2 = bx * bx + by * by; + double c2 = cx * cx + cy * cy; + + // Circumcenter relative to v, weighted with the area (d / 4). + double area = 0.25 * d; + + sx += area * (cy * b2 - by * c2) / d; + sy += area * (bx * c2 - cx * b2) / d; + sa += area; + } + + double tx = x + sx / sa; + double ty = y + sy / sa; + + return TryMove(start, tx, ty, Better) || TryMove(start, 0.5 * (x + tx), 0.5 * (y + ty), Better); + } + + /// + /// Gather the triangles around the origin of the given triangle. + /// + private bool GatherStar(Otri start) + { + star.Clear(); + + var tri = start; + var sub = default(Osub); + + do + { + if (tri.tri.id == Mesh.DUMMY || star.Count == MaxDegree) + { + return false; + } + + tri.Pivot(ref sub); + if (sub.seg.hash != Mesh.DUMMY) + { + return false; + } + + star.Add(tri); + + tri.Onext(); + } + while (!tri.Equals(start)); + + return star.Count >= 3; + } + + /// + /// Move the origin of the given triangle to the given position (rounded to the output + /// grid) and restore the Delaunay property. The move is undone if the position is + /// outside the kernel of the star, or if returns false. + /// + /// + /// The triangles changed by the move are available as when + /// is called. + /// + public bool TryMove(Otri start, double tx, double ty, System.Func accept) + { + if (!GatherStar(start)) + { + return false; + } + + Vertex v = start.Org(); + + if (gridSize > 0.0) + { + tx = GridSnapper.Round(tx, gridSize); + ty = GridSnapper.Round(ty, gridSize); + } + + if (tx == v.x && ty == v.y) + { + return false; + } + + // The new position must lie in the kernel of the star polygon. + candidate.x = tx; + candidate.y = ty; + + foreach (var t in star) + { + if (predicates.CounterClockwise(candidate, t.Dest(), t.Apex()) <= 0.0) + { + return false; + } + } + + touched.Clear(); + touchedSet.Clear(); + flips.Clear(); + work.Clear(); + + oldBad = 0; + oldWorst = 0.0; + + foreach (var t in star) + { + Touch(t.tri); + } + + double x = v.x, y = v.y; + + v.x = tx; + v.y = ty; + + bool accepted = MakeDelaunay() && accept(); + + if (!accepted) + { + for (int i = flips.Count - 1; i >= 0; i--) + { + var flip = flips[i]; + mesh.Unflip(ref flip); + } + + v.x = x; + v.y = y; + } + + return accepted; + } + + /// + /// Restore the Delaunay property with edge flips (Lawson), starting with the edges of + /// the star of the moved point. + /// + private bool MakeDelaunay() + { + var top = default(Otri); + var sub = default(Osub); + + foreach (var t in star) + { + var e = t; + work.Push(e); + e.Lnext(); + work.Push(e); + } + + while (work.Count > 0) + { + var e = work.Pop(); + + e.Pivot(ref sub); + if (sub.seg.hash != Mesh.DUMMY) + { + continue; + } + + e.Sym(ref top); + if (top.tri.id == Mesh.DUMMY) + { + continue; + } + + Vertex a = e.Org(); + Vertex b = e.Dest(); + Vertex c = e.Apex(); + Vertex d = top.Apex(); + + if (predicates.InCircle(a, b, c, d) <= 0.0 || + predicates.CounterClockwise(c, d, b) <= 0.0 || + predicates.CounterClockwise(d, c, a) <= 0.0) + { + continue; + } + + if (flips.Count == MaxFlips) + { + return false; + } + + Touch(e.tri); + Touch(top.tri); + + // Triangles abc and bad become dca (handle d -> c) and cdb. + mesh.Flip(ref e); + flips.Add(e); + + var next = e; + next.Lnext(); + work.Push(next); + next.Lnext(); + work.Push(next); + + e.Sym(ref next); + next.Lnext(); + work.Push(next); + next.Lnext(); + work.Push(next); + } + + return true; + } + + /// + /// Remember a triangle that is changed by the move, with its quality before the move. + /// + private void Touch(Triangle t) + { + if (touchedSet.Add(t)) + { + touched.Add(t); + + Evaluate(t, ref oldBad, ref oldWorst); + } + } + + /// + /// The triangles changed by the current move. + /// + public List Touched => touched; + + private bool Better() + { + Score(null, out int bad, out double worst); + + return bad < oldBad || (bad == oldBad && worst < oldWorst - 1e-12); + } + + /// + /// Check that the changed triangles (except the ones with the given vertex, which will + /// be deleted) don't violate more constraints than before the move, and that no + /// triangle is worse than the worst triangle before the move or the minimum angle. + /// + public bool NotWorse(Vertex deleted) + { + Score(deleted, out int bad, out double worst); + + return bad <= oldBad && worst <= System.Math.Max(oldWorst, behavior.goodAngle); + } + + private void Score(Vertex skip, out int bad, out double worst) + { + bad = 0; + worst = 0.0; + + var tri = default(Otri); + + foreach (var t in touched) + { + tri.tri = t; + + if (skip != null) + { + tri.orient = 0; + if (tri.Org() == skip || tri.Dest() == skip || tri.Apex() == skip) + { + continue; + } + } + + Evaluate(t, ref bad, ref worst); + } + } + + /// + /// Count the triangle if it violates the quality constraints, and update the worst + /// (square of the cosine of the) smallest angle. + /// + private void Evaluate(Triangle t, ref int bad, ref double worst) + { + var tri = new Otri { tri = t, orient = 0 }; + var sub = default(Osub); + + Vertex a = tri.Org(); + Vertex b = tri.Dest(); + Vertex c = tri.Apex(); + + bool good = TriangleQuality.Check(behavior, a, b, c, t.area, out double cos2); + + if (good && behavior.UserTest != null) + { + double area = 0.5 * ((b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y)); + good = !behavior.UserTest(t, area); + } + + // Subsegments must not be encroached. + for (tri.orient = 0; good && tri.orient < 3; tri.orient++) + { + tri.Pivot(ref sub); + + if (sub.seg.hash != Mesh.DUMMY && TriangleQuality.Encroaches(behavior, tri.Org(), tri.Dest(), tri.Apex())) + { + good = false; + } + } + + if (!good) + { + bad++; + } + + if (cos2 > worst) + { + worst = cos2; + } + } + } +} diff --git a/src/Triangle/Meshing/TriangleQuality.cs b/src/Triangle/Meshing/TriangleQuality.cs new file mode 100644 index 0000000..083cd6b --- /dev/null +++ b/src/Triangle/Meshing/TriangleQuality.cs @@ -0,0 +1,130 @@ +// ----------------------------------------------------------------------- +// +// Triangle.NET code by Christian Woltering, http://triangle.codeplex.com/ +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Meshing +{ + using System; + using TriangleNet.Geometry; + + /// + /// Quality constraints for triangles that may not exist yet (used to check local mesh + /// changes before or after they are made). Same computations as QualityMesher.TestTriangle + /// and CheckSeg4Encroach, but without the exemptions for triangles that refinement can't + /// improve. + /// + internal static class TriangleQuality + { + /// + /// Check the angle and area constraints of a counterclockwise triangle. + /// + /// The quality constraints. + /// First vertex. + /// Second vertex. + /// Third vertex. + /// The area constraint of the triangle (if variable area constraints are used). + /// The square of the cosine of the smallest angle. + /// True, if the triangle meets the constraints. + public static bool Check(Behavior behavior, Vertex torg, Vertex tdest, Vertex tapex, double areaLimit, out double cos2) + { + double dxod = torg.x - tdest.x; + double dyod = torg.y - tdest.y; + double dxda = tdest.x - tapex.x; + double dyda = tdest.y - tapex.y; + double dxao = tapex.x - torg.x; + double dyao = tapex.y - torg.y; + + double apexlen = dxod * dxod + dyod * dyod; + double orglen = dxda * dxda + dyda * dyda; + double destlen = dxao * dxao + dyao * dyao; + + // The square of the cosine of the angle opposite to the shortest edge. + if ((apexlen < orglen) && (apexlen < destlen)) + { + cos2 = dxda * dxao + dyda * dyao; + cos2 = cos2 * cos2 / (orglen * destlen); + } + else if (orglen < destlen) + { + cos2 = dxod * dxao + dyod * dyao; + cos2 = cos2 * cos2 / (apexlen * destlen); + } + else + { + cos2 = dxod * dxda + dyod * dyda; + cos2 = cos2 * cos2 / (apexlen * orglen); + } + + if (cos2 > behavior.goodAngle) + { + return false; + } + + if (behavior.fixedArea || behavior.VarArea) + { + double area = 0.5 * (dxod * dyda - dyod * dxda); + + if (behavior.fixedArea && area > behavior.MaxArea) + { + return false; + } + + // Nonpositive area constraints are treated as unconstrained. + if (behavior.VarArea && areaLimit > 0.0 && area > areaLimit) + { + return false; + } + } + + if (behavior.MaxAngle != 0.0) + { + double maxangle; + + if ((apexlen > orglen) && (apexlen > destlen)) + { + maxangle = (orglen + destlen - apexlen) / (2 * Math.Sqrt(orglen * destlen)); + } + else if (orglen > destlen) + { + maxangle = (apexlen + destlen - orglen) / (2 * Math.Sqrt(apexlen * destlen)); + } + else + { + maxangle = (apexlen + orglen - destlen) / (2 * Math.Sqrt(apexlen * orglen)); + } + + if (maxangle < behavior.maxGoodAngle) + { + return false; + } + } + + return true; + } + + /// + /// Check whether the apex lies in the diametral lens (or circle, for conforming + /// Delaunay meshes) of the subsegment from eorg to edest. + /// + public static bool Encroaches(Behavior behavior, Vertex eorg, Vertex edest, Vertex apex) + { + double dotproduct = (eorg.x - apex.x) * (edest.x - apex.x) + + (eorg.y - apex.y) * (edest.y - apex.y); + + if (dotproduct < 0.0) + { + return behavior.ConformingDelaunay || + (dotproduct * dotproduct >= + (2.0 * behavior.goodAngle - 1.0) * (2.0 * behavior.goodAngle - 1.0) * + ((eorg.x - apex.x) * (eorg.x - apex.x) + + (eorg.y - apex.y) * (eorg.y - apex.y)) * + ((edest.x - apex.x) * (edest.x - apex.x) + + (edest.y - apex.y) * (edest.y - apex.y))); + } + + return false; + } + } +} From 8420718ad7517f3974f36248c8f807d852e8cb24 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 06:10:34 +0000 Subject: [PATCH 32/50] Corpus harness: options for Steiner reduction, smoothing and conforming TRIANGLE_CORPUS_REDUCE, TRIANGLE_CORPUS_SMOOTH and TRIANGLE_CORPUS_CONFORMING set the corresponding mesher options for the external corpus tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Tests/Corpus/CorpusCheck.cs | 16 ++++++++++++++-- src/Triangle.Tests/Corpus/CorpusTest.cs | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Triangle.Tests/Corpus/CorpusCheck.cs b/src/Triangle.Tests/Corpus/CorpusCheck.cs index 331a1f1..eae5d46 100644 --- a/src/Triangle.Tests/Corpus/CorpusCheck.cs +++ b/src/Triangle.Tests/Corpus/CorpusCheck.cs @@ -77,8 +77,20 @@ Vertex V((double, double) p) try { - var quality = minAngle > 0 ? new QualityOptions { MinimumAngle = minAngle, SteinerPoints = steinerPoints } : null; - mesh = (Mesh)poly.Triangulate(new ConstraintOptions { SnapTolerance = snapTolerance, GridSize = gridSize, WedgeTolerance = wedgeTolerance }, quality); + var quality = minAngle > 0 ? new QualityOptions + { + MinimumAngle = minAngle, + SteinerPoints = steinerPoints, + ReduceSteinerPoints = Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_REDUCE") == "1", + SmoothingSteps = int.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_SMOOTH"), out var steps) ? steps : 0 + } : null; + mesh = (Mesh)poly.Triangulate(new ConstraintOptions + { + SnapTolerance = snapTolerance, + GridSize = gridSize, + WedgeTolerance = wedgeTolerance, + ConformingDelaunay = Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_CONFORMING") == "1" + }, quality); } catch (ArgumentException) when (poly.Points.Any(p => !IsFinite(p.X) || !IsFinite(p.Y))) { diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index d484248..7246e91 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -35,6 +35,9 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_CORPUS_ROUND count triangles flipped by rounding to this grid (default 0 = off, /// the output grid if set) /// TRIANGLE_CORPUS_ANGLES comma separated minimum angles (default 0,20; 0 = no quality) + /// TRIANGLE_CORPUS_REDUCE 1 = QualityOptions.ReduceSteinerPoints + /// TRIANGLE_CORPUS_SMOOTH QualityOptions.SmoothingSteps (default 0) + /// TRIANGLE_CORPUS_CONFORMING 1 = ConstraintOptions.ConformingDelaunay /// /// Run: dotnet test --filter TestCategory=Corpus /// From 8805f7de168df457e8816a839b864806ddf4b479 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 06:13:52 +0000 Subject: [PATCH 33/50] Docs: corpus evaluation of Steiner reduction/smoothing and pooling measurements Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 3b8eecc..e576a32 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -623,6 +623,59 @@ conforming Delaunay, Fläche, Segmente, gesperrte Segmente, Winkelgarantie), daz Steiner-Punkte ändern sich, Segmente identisch, nicht mehr schlechte Dreiecke, kleinster Winkel sinkt beim Glätten nie, Maximalfläche und -winkel, Raster, `UserTest`, Determinismus. +### Breite Bewertung am Korpus + +Alle 201 Herne-Kacheln (Raster 1 cm, Keil 3 cm), dazu Herne nur mit Snap, Natural Earth und die +CDT-Testfälle (`TRIANGLE_CORPUS_REDUCE`, `TRIANGLE_CORPUS_SMOOTH`, +`TRIANGLE_CORPUS_CONFORMING`). Alle Läufe gültig (keine Fehler, keine Kippungen beim Runden im +Rastermodus). Zeiten sind die Summe der Einzelläufe: + +| Herne, Raster + Keil | Dreiecke 20° | Zeit 20° | Dreiecke 30° | schlecht 30° | Zeit 30° | +|----------------------|-------------:|---------:|-------------:|-------------:|---------:| +| ohne | 2.965.369 | 66 s | 6.586.381 | 145.925 | 102 s | +| ausdünnen | −5,9 % | 112 s | −8,7 % | 143.794 | 196 s | +| 3× glätten | ±0 | 96 s | ±0 | 142.260 | 159 s | +| 3× glätten + ausdünnen | −6,7 % | 153 s | −11,6 % | 140.621 | 275 s | +| conforming, ohne | 4.288.070 | 67 s | 8.100.427 | 211.063 | 96 s | +| conforming, ausdünnen | −6,4 % | 124 s | −9,3 % | 207.402 | 208 s | +| conforming, 3× glätten | ±0 | 113 s | ±0 | 204.608 | 171 s | +| conforming, 3× glätten + ausdünnen | −7,2 % | 186 s | −12,4 % | 202.069 | 323 s | + +Nur Snap (ohne Raster): −2,5 % bis −4 % Dreiecke. Natural Earth und CDT-Fälle: unter 1 % +(dort hängen die schlechten Dreiecke an winzigen Eingabewinkeln und am Steiner-Limit). + +Bewertung: Lohnt sich, wenn die Netzgröße zählt (Speicher, Weiterverarbeitung), vor allem im +Rastermodus bei 30°: rund 10–12 % weniger Dreiecke und 3–4 % weniger schlechte, bei 2–3,4-facher +Laufzeit. Glätten allein verbessert die Qualität nur wenig (−2,5 bis −3 % schlechte Dreiecke). +Als Standard nicht sinnvoll, als Option für große Exporte ja. + +### Pooling + +Kurzlebige Objekte (Umkreismittelpunkte, Iteratoren, Hilfsarrays) sind für den .NET-GC billig. Teuer +sind die langlebigen Netzobjekte, die bei jeder Sammlung kopiert werden: Allokationsprofil der +Herne-Kachel mit `Arrays` (wie net48): `Osub[]` 13 %, `Otri[]` 13 %, `Triangle` 11 %, `Vertex[]` 9 %, +dazu Punkte, Vertices und Dictionary-Einträge. `ArrayPool` hilft dafür nicht (die Arrays leben so +lange wie das Netz), die Hilfsarrays der Prädikate liegen schon im Thread-Arbeitsspeicher. + +Was hilft, gibt es schon: `TrianglePool` hält die Dreiecke eines Netzes und lässt sich über +`Configuration` für mehrere Vermaschungen nacheinander wiederverwenden +(`new Configuration(() => RobustPredicates.Default, () => pool.Restart())`). Die Dreiecke samt ihren +Arrays liegen dann schon in Gen 2 und werden nicht neu angelegt (Ergebnis identisch, gleicher +Fingerprint). Gemessen (Mittel aus 10–40 abwechselnden Läufen, .NET 10): + +| Layout | Szenario | neuer Pool | wiederverwendeter Pool | +|--------|----------|-----------:|-----------------------:| +| Arrays (wie net48) | Kachel 30°, Raster + Keil | 550 ms | 384 ms (−30 %) | +| Arrays | kleine Kachel 20° | 45 ms | 38 ms (−16 %) | +| Arrays, kleines Gen-0-Budget (4 MB) | Kachel 30°, Raster + Keil | 769 ms | 583 ms (−24 %) | +| InlineArray (net8) | Kachel 30°, Raster + Keil | 434 ms | 354 ms (−18 %) | +| InlineArray | kleine Kachel 20° | 34 ms | 37 ms (±) | + +Voraussetzung: Das vorige Netz wird nicht mehr benutzt, wenn der Pool neu startet (der Fallback im +alten Repo wandelt das Netz sofort in `NetzDaten` um; Referenz- und Hauptnetz brauchen dort aber +getrennte Pools, weil beide gleichzeitig leben). Je Thread ein Pool, `TrianglePool` ist nicht +threadsicher. + ## Klassenweises Review (`src/Triangle.Tests/Review`) Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit From 27b52d57ae6f25cf55ef41a1798d252673bac9de Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 07:28:52 +0000 Subject: [PATCH 34/50] Faster area refinement: no aCute relocation for triangles that are only too large aCute tried to relocate a vertex of every bad triangle whose off-center lies beyond the circumcenter, which includes all triangles that are bad only by area. Relocation improves angles, so it rarely helped there and cost ~80% of the time (unit square, area 0.001: 148 -> 14 ms, same triangle count). Only regions/q25-variable-area changes (463 -> 464 vertices). The encroachment pre-check now returns early when no boundary subsegment of the cavity is encroached, before building the boundary map (legacy area refinement back to upstream speed). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Characterization/golden.txt | 2 +- src/Triangle/Meshing/QualityMesher.cs | 29 ++++++++++++++----- src/Triangle/Meshing/TriangleQuality.cs | 15 +++++++++- src/Triangle/NewLocation.cs | 20 ++++++++++--- 4 files changed, 52 insertions(+), 14 deletions(-) diff --git a/src/Triangle.Tests/Characterization/golden.txt b/src/Triangle.Tests/Characterization/golden.txt index b1d101d..6b15ccf 100644 --- a/src/Triangle.Tests/Characterization/golden.txt +++ b/src/Triangle.Tests/Characterization/golden.txt @@ -44,7 +44,7 @@ points-utm/dwyer V=2000 T=3979 S=0 H=23343a853965d5a8 points-utm/incremental V=2000 T=3979 S=0 H=23343a853965d5a8 points-utm/q30 V=4905 T=9407 S=401 H=48512e2b2abbbeb8 points-utm/sweepline V=2000 T=3979 S=0 H=23343a853965d5a8 -regions/q25-variable-area V=463 T=861 S=92 H=94d37520ac45974f +regions/q25-variable-area V=464 T=871 S=84 H=3684dba3fbcb8be7 square-hole/cdt V=8 T=8 S=8 H=d3cbe572ce5dd341 square-hole/conforming V=12 T=12 S=12 H=588f772472ed13c9 square-hole/q20 V=12 T=12 S=12 H=588f772472ed13c9 diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 0de107c..909aede 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -1065,6 +1065,7 @@ private void InsertCentroid(Otri tri) private readonly HashSet cavity = new HashSet(); private readonly Stack cavityStack = new Stack(); private readonly Dictionary cavityBoundary = new Dictionary(); + private readonly List cavityEdges = new List(); private readonly List cavitySubsegs = new List(); private readonly List cavityEncroached = new List(); @@ -1110,6 +1111,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) cavity.Clear(); cavityStack.Clear(); cavityBoundary.Clear(); + cavityEdges.Clear(); cavitySubsegs.Clear(); cavityEncroached.Clear(); @@ -1149,14 +1151,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) } // Boundary edge of the cavity (the cavity is on its left side). - var org = tri.Org(); - - if (cavityBoundary.ContainsKey(org)) - { - return false; - } - - cavityBoundary.Add(org, tri); + cavityEdges.Add(tri); if (sub.seg.hash != Mesh.DUMMY && CheckSeg4Encroach(ref sub, v, false) > 0) { @@ -1176,6 +1171,24 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) } } + if (cavityEncroached.Count == 0) + { + // No subsegment on the boundary of the cavity is encroached (the most common case). + return false; + } + + foreach (var edge in cavityEdges) + { + var org = edge.Org(); + + if (cavityBoundary.ContainsKey(org)) + { + return false; + } + + cavityBoundary.Add(org, edge); + } + // Walk along the boundary (counterclockwise around v) and collect the subsegments. var start = horiz.Org(); var u = start; diff --git a/src/Triangle/Meshing/TriangleQuality.cs b/src/Triangle/Meshing/TriangleQuality.cs index 083cd6b..5effc46 100644 --- a/src/Triangle/Meshing/TriangleQuality.cs +++ b/src/Triangle/Meshing/TriangleQuality.cs @@ -28,6 +28,19 @@ internal static class TriangleQuality /// The square of the cosine of the smallest angle. /// True, if the triangle meets the constraints. public static bool Check(Behavior behavior, Vertex torg, Vertex tdest, Vertex tapex, double areaLimit, out double cos2) + { + return Check(behavior, torg, tdest, tapex, areaLimit, true, out cos2); + } + + /// + /// Check the angle constraints of a counterclockwise triangle (not the area). + /// + public static bool CheckAngles(Behavior behavior, Vertex torg, Vertex tdest, Vertex tapex) + { + return Check(behavior, torg, tdest, tapex, 0.0, false, out _); + } + + private static bool Check(Behavior behavior, Vertex torg, Vertex tdest, Vertex tapex, double areaLimit, bool checkArea, out double cos2) { double dxod = torg.x - tdest.x; double dyod = torg.y - tdest.y; @@ -62,7 +75,7 @@ public static bool Check(Behavior behavior, Vertex torg, Vertex tdest, Vertex ta return false; } - if (behavior.fixedArea || behavior.VarArea) + if (checkArea && (behavior.fixedArea || behavior.VarArea)) { double area = 0.5 * (dxod * dyda - dyod * dxda); diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 78e3faa..07274b7 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -440,8 +440,10 @@ private Point FindNewLocationWithoutMaxAngle(Vertex torg, Vertex tdest, Vertex t } //- RELOCATION (LOCAL SMOOTHING) -// // check for possible relocation of one of triangle's points - // With a grid, vertices aren't relocated (see GridSize). - relocated = GridSize > 0.0 ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); + // With a grid, vertices aren't relocated (see GridSize). Relocation improves angles, + // so it isn't tried for triangles that are only too large (it rarely succeeds and + // made area refinement 10x slower). + relocated = GridSize > 0.0 || !BadAngles(torg, tdest, tapex) ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { @@ -1143,8 +1145,10 @@ private Point FindNewLocation(Vertex torg, Vertex tdest, Vertex tapex, } // RELOCATION (LOCAL SMOOTHING) // check for possible relocation of one of triangle's points - // With a grid, vertices aren't relocated (see GridSize). - relocated = GridSize > 0.0 ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); + // With a grid, vertices aren't relocated (see GridSize). Relocation improves angles, + // so it isn't tried for triangles that are only too large (it rarely succeeds and + // made area refinement 10x slower). + relocated = GridSize > 0.0 || !BadAngles(torg, tdest, tapex) ? 0 : DoSmoothing(delotri, torg, tdest, tapex, ref newloc); // if relocation is possible, delete that vertex and insert a vertex at the new location if (relocated > 0) { @@ -2087,6 +2091,14 @@ private int LongestShortestEdge(double aodist, double dadist, double dodist) /// /// The new location for the point, if somothing is possible. /// Returns 1, 2 or 3 if smoothing will work, 0 otherwise. + /// + /// Check whether the triangle violates the minimum or maximum angle constraint. + /// + private bool BadAngles(Vertex torg, Vertex tdest, Vertex tapex) + { + return !TriangleNet.Meshing.TriangleQuality.CheckAngles(behavior, torg, tdest, tapex); + } + private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, ref double[] newloc) { From 79db9dd2304412b8ee8b1528cba22c7a1f158fc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 07:41:14 +0000 Subject: [PATCH 35/50] Degenerate hole rings as segments; public fixtures corpus; comparison docs A hole contour without interior (all points on a line, fewer than three distinct points) no longer throws in Polygon.Add: it removes nothing, so its edges are added as segments (earcut fixtures water-huge, issue83). CorpusTest.PublicFixtures runs the test fixtures of mapbox/earcut, mapbox/delaunator and jhasse/poly2tri (TRIANGLE_PUBLIC_FIXTURES): 273 runs, all valid. Docs: comparison with upstream Triangle.NET, delaunator-sharp and BurstTriangulator (Delaunay grid/random, Lake Superior refinement). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 59 +++++++++++++++++++ src/Triangle.Tests/Corpus/CorpusReaders.cs | 59 +++++++++++++++++++ src/Triangle.Tests/Corpus/CorpusTest.cs | 16 +++++ .../Robustness/InputValidationTest.cs | 22 +++++++ src/Triangle/Geometry/IPolygon.cs | 3 +- src/Triangle/Geometry/Polygon.cs | 17 +++++- 6 files changed, 174 insertions(+), 2 deletions(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index e576a32..80a6833 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -676,6 +676,65 @@ alten Repo wandelt das Netz sofort in `NetzDaten` um; Referenz- und Hauptnetz br getrennte Pools, weil beide gleichzeitig leben). Je Thread ein Pool, `TrianglePool` ist nicht threadsicher. +## Vergleich mit anderen Bibliotheken und öffentlichen Testdaten + +Gleiche Maschine, .NET 10, Median aus wiederholten Läufen. „Original“ ist Triangle.NET von +wo80 (Commit `fa6f2fd`, Basis dieses Forks). + +**Delaunay ohne Constraints** (Szenario des BurstTriangulator-Benchmarks: n×n-Gitter im +Einheitsquadrat, dazu gleich viele Zufallspunkte): + +| Punkte | Original Gitter | Fork Gitter | delaunator-sharp Gitter | Original zufällig | Fork zufällig | delaunator-sharp zufällig | +|-------:|----------------:|------------:|------------------------:|------------------:|--------------:|--------------------------:| +| 10.000 | 25 ms | 10 ms | 3,8 ms | 11 ms | 8,7 ms | 4,7 ms | +| 99.856 | 1.004 ms | 132 ms | 44 ms | 188 ms | 110 ms | 52 ms | +| 1.000.000 | 9.188 ms | 4.373 ms | 768 ms | 4.545 ms | 2.356 ms | 1.189 ms | + +BurstTriangulator ist in seiner eigenen Grafik 7–8× schneller als delaunator-sharp (nativer +Code über Burst/LLVM, Unity). Für reine Delaunay-Triangulierung großer Punktmengen bleibt der Fork +also deutlich langsamer; das liegt an den Objekten pro Dreieck (siehe Pooling) und ist nur mit +einer index-basierten Struktur aufzuholen. + +**Verfeinerung:** Lake Superior (aus BurstTriangulator, 518 Punkte, 6 Löcher), Flächengrenze 100 +(wirkungslos), Mindestwinkel wie im Burst-Benchmark: + +| Mindestwinkel | Dreiecke | Zeit | +|--------------:|---------:|-----:| +| 20° | 1.003 | 2,8 ms | +| 30° | 1.481 | 3,9 ms | +| 33,73° (Grenze von Burst) | 1.812 | 4,5 ms | +| 36° | 2.144 | 5,5 ms | +| 38° | 2.751 | 7,3 ms | + +Laut BurstTriangulator-Dokumentation (v3.6) braucht Burst dort bis zu ~7.800 Dreiecke und 69 ms und +endet bei 33,73°. Der Fork vernetzt mit rund einem Viertel der Dreiecke, ist etwa 15× schneller und +kommt bis 38° (40° endet am Steiner-Limit). Das Original rechnet bis 38° gleich, stürzt bei 40° aber +in den Prädikaten ab (`IndexOutOfRangeException`). Mit `ConformingDelaunay` ändern sich die Zahlen +kaum. + +Gefunden und behoben dabei: reine Flächenverfeinerung (Einheitsquadrat, Maximalfläche 0,001) war +mit aCute 10× langsamer als nötig, weil für jedes zu große Dreieck versucht wurde, eine Ecke zu +verschieben (Relocation verbessert Winkel, nicht die Fläche): 148 → 14 ms bei gleicher +Dreieckszahl; Original 125 ms. Die Vorabprüfung auf verletzte Teilsegmente bricht jetzt ab, wenn +keines betroffen ist (klassische Verfeinerung wieder so schnell wie im Original). + +**Öffentliche Testdaten** (`CorpusTest.PublicFixtures`, `TRIANGLE_PUBLIC_FIXTURES`): Testfälle +von mapbox/earcut (61 Polygone aus echten Daten und Fehlerberichten: Gewässer, sich berührende +Löcher, selbstberührende Ringe), mapbox/delaunator (Robustheitsfälle, Ukraine) und jhasse/poly2tri +(22 Umrisse). Jeweils ohne Qualität, 20° und 30°: 273 Läufe, alle gültig (Konsistenz, keine +gekippten Dreiecke, alle Linien abgedeckt, Delaunay). + +Direkter Vergleich mit Original (Ringe als Linien und als Löcher, ohne Qualität und 30°): + +| | gültig | leer (erwartet) | Exception | Endlosschleife | inkonsistent | +|---|---:|---:|---:|---:|---:| +| Original | 305 | 8 | 31 | 2 | 2 | +| Fork | 338 | 10 | 0 | 0 | 0 | + +Die leeren Ergebnisse entsprechen den Erwartungen von earcut (0 Dreiecke für entartete +Eingaben). Lochringe ohne Fläche (earcut `water-huge`, `issue83`) warfen vorher eine Exception; +jetzt werden ihre Kanten als Linien übernommen (earcut ignoriert solche Löcher). + ## Klassenweises Review (`src/Triangle.Tests/Review`) Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit diff --git a/src/Triangle.Tests/Corpus/CorpusReaders.cs b/src/Triangle.Tests/Corpus/CorpusReaders.cs index 5532116..62a07d8 100644 --- a/src/Triangle.Tests/Corpus/CorpusReaders.cs +++ b/src/Triangle.Tests/Corpus/CorpusReaders.cs @@ -129,6 +129,65 @@ private static void AddPolygon(List> rings, JsonEleme /// CDT/tests/inputs): number of vertices and edges, the vertex coordinates, the edges /// as pairs of vertex indices. /// + /// + /// Test fixtures of other triangulation libraries below the given directory (each in its + /// own folder, as cloned from GitHub): mapbox/earcut test/fixtures (rings as closed lines), + /// mapbox/delaunator test/fixtures (point sets), jhasse/poly2tri testbed/data (outlines). + /// + public static IEnumerable ReadPublicFixtures(string root) + { + (double, double) P(System.Text.Json.JsonElement e) => (e[0].GetDouble(), e[1].GetDouble()); + + var earcut = Path.Combine(root, "earcut", "test", "fixtures"); + if (Directory.Exists(earcut)) + { + foreach (var path in Directory.GetFiles(earcut, "*.json").OrderBy(p => p, StringComparer.Ordinal)) + { + var c = new CorpusCase { Name = "earcut/" + Path.GetFileNameWithoutExtension(path) }; + + foreach (var ring in System.Text.Json.JsonDocument.Parse(File.ReadAllText(path)).RootElement.EnumerateArray()) + { + var line = ring.EnumerateArray().Select(P).ToList(); + if (line.Count > 1 && line[0] != line[line.Count - 1]) line.Add(line[0]); + if (line.Count > 1) c.Lines.Add(line); + } + + yield return c; + } + } + + var delaunator = Path.Combine(root, "delaunator", "test", "fixtures"); + if (Directory.Exists(delaunator)) + { + foreach (var path in Directory.GetFiles(delaunator, "*.json").OrderBy(p => p, StringComparer.Ordinal)) + { + var c = new CorpusCase { Name = "delaunator/" + Path.GetFileNameWithoutExtension(path) }; + c.Points.AddRange(System.Text.Json.JsonDocument.Parse(File.ReadAllText(path)).RootElement.EnumerateArray().Select(P)); + yield return c; + } + } + + var poly2tri = Path.Combine(root, "poly2tri", "testbed", "data"); + if (Directory.Exists(poly2tri)) + { + foreach (var path in Directory.GetFiles(poly2tri, "*.dat").OrderBy(p => p, StringComparer.Ordinal)) + { + var line = File.ReadAllLines(path) + .Select(l => l.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries)) + .Where(t => t.Length >= 2) + .Select(t => (double.Parse(t[0], CultureInfo.InvariantCulture), double.Parse(t[1], CultureInfo.InvariantCulture))) + .ToList(); + + if (line.Count < 2) continue; + line.Add(line[0]); + + var c = new CorpusCase { Name = "poly2tri/" + Path.GetFileNameWithoutExtension(path) }; + c.Lines.Add(line); + yield return c; + } + } + } + public static IEnumerable ReadCdtInputs(string directory) { foreach (var path in Directory.GetFiles(directory, "*.txt").OrderBy(p => p, StringComparer.Ordinal)) diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index 7246e91..87d6528 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -27,6 +27,9 @@ namespace TriangleNet.Tests.Corpus /// https://github.com/nvkelso/natural-earth-vector/tree/master/geojson) /// TRIANGLE_CDT_INPUTS directory CDT/tests/inputs of https://github.com/artem-ogre/CDT /// (edge cases: hanging and overlapping constraints, points on edges, ...) + /// TRIANGLE_PUBLIC_FIXTURES directory with clones of https://github.com/mapbox/earcut, + /// https://github.com/mapbox/delaunator and https://github.com/jhasse/poly2tri + /// (test fixtures of other triangulation libraries, ISC/BSD licensed) /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) @@ -83,6 +86,19 @@ public void NaturalEarthCoastlines() RunCases(cases); } + [Test] + public void PublicFixtures() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_PUBLIC_FIXTURES"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_PUBLIC_FIXTURES not set."); + } + + RunCases(CorpusReaders.ReadPublicFixtures(directory)); + } + [Test] public void CdtLibraryInputs() { diff --git a/src/Triangle.Tests/Robustness/InputValidationTest.cs b/src/Triangle.Tests/Robustness/InputValidationTest.cs index f61a00a..4965256 100644 --- a/src/Triangle.Tests/Robustness/InputValidationTest.cs +++ b/src/Triangle.Tests/Robustness/InputValidationTest.cs @@ -129,6 +129,28 @@ public void SegmentEndpointsNotInPointList() Assert.That(e.Message, Does.Contain("Unable to locate PSLG vertex")); } + [TestCase(new double[] { 2, 2, 5, 5, 8, 8 }, TestName = "DegenerateHoleCollinear")] + [TestCase(new double[] { 2, 2, 8, 8, 2, 2 }, TestName = "DegenerateHoleTwoDistinctPoints")] + [TestCase(new double[] { 2, 2, 8, 8, 5, 5, 2, 2 }, TestName = "DegenerateHoleFolded")] + public void DegenerateHoleRingIsMeshedAsSegments(double[] ring) + { + // A hole ring without interior (earcut fixtures water-huge, issue83) removes nothing; + // its edges are kept as segments (earcut ignores such holes). + var poly = new Polygon(); + poly.Add(TestData.Square(0, 0, 10)); + + var hole = new List(); + for (int i = 0; i < ring.Length; i += 2) hole.Add(new Vertex(ring[i], ring[i + 1])); + + Assert.That(() => poly.Add(new Contour(hole), true), Throws.Nothing); + + var mesh = poly.Triangulate(new QualityOptions { MinimumAngle = 25 }); + + MeshAssert.IsValid(mesh); + Assert.That(mesh.Triangles.Sum(t => Characterization.MeshInvariants.Area(t)), Is.EqualTo(100.0).Within(1e-9)); + Assert.That(mesh.Vertices.Any(v => v.X == 8 && v.Y == 8), Is.True); + } + [Test] public void PolygonTriangulatedTwice() { diff --git a/src/Triangle/Geometry/IPolygon.cs b/src/Triangle/Geometry/IPolygon.cs index e07daf5..3cd1aec 100644 --- a/src/Triangle/Geometry/IPolygon.cs +++ b/src/Triangle/Geometry/IPolygon.cs @@ -80,7 +80,8 @@ public interface IPolygon /// Add a contour to the polygon. /// /// The contour to insert. - /// Treat contour as a hole. + /// Treat contour as a hole (a hole contour without interior, e.g. with + /// all points on a line, removes nothing: only its edges are added as segments). void Add(Contour contour, bool hole = false); /// diff --git a/src/Triangle/Geometry/Polygon.cs b/src/Triangle/Geometry/Polygon.cs index 87d5fd9..94b88f5 100644 --- a/src/Triangle/Geometry/Polygon.cs +++ b/src/Triangle/Geometry/Polygon.cs @@ -6,6 +6,7 @@ namespace TriangleNet.Geometry { + using System; using System.Collections.Generic; /// @@ -133,7 +134,21 @@ public void Add(Contour contour, bool hole = false) { if (hole) { - Add(contour, contour.FindInteriorPoint()); + Point interior; + + try + { + interior = contour.FindInteriorPoint(); + } + catch (InvalidOperationException) + { + // A hole without interior (fewer than three distinct points, or all edges + // on one line) removes nothing: only its edges are added as segments. + AddContourPointsAndSegments(contour); + return; + } + + Add(contour, interior); } else { From 7ad34bbaec83415966077fd7c896af2e4c31aebd Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 07:41:37 +0000 Subject: [PATCH 36/50] Docs: corrected fixture comparison counts Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 80a6833..90c79bf 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -729,7 +729,7 @@ Direkter Vergleich mit Original (Ringe als Linien und als Löcher, ohne Qualitä | | gültig | leer (erwartet) | Exception | Endlosschleife | inkonsistent | |---|---:|---:|---:|---:|---:| | Original | 305 | 8 | 31 | 2 | 2 | -| Fork | 338 | 10 | 0 | 0 | 0 | +| Fork | 336 | 12 | 0 | 0 | 0 | Die leeren Ergebnisse entsprechen den Erwartungen von earcut (0 Dreiecke für entartete Eingaben). Lochringe ohne Fläche (earcut `water-huge`, `issue83`) warfen vorher eine Exception; From fe454f5aa153eda15b0cd8ede4a2cdcfc841d245 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 08:18:46 +0000 Subject: [PATCH 37/50] Prototype of index-based triangle storage; corpora for CGAL and Natural Earth polygons Prototype (Triangle.Tests/Prototype): the divide-and-conquer triangulation on arrays (vertices and encoded neighbors per triangle) instead of objects, same result. 1.05-1.8x faster on net10 with InlineArray, 1.2-2.4x with the array layout of net48, up to 3.2x with a small gen0 budget. Corpus tests CgalData (Polygon_repair, Straight_skeleton_2) and NaturalEarthPolygons (10m layers as a whole and per feature). Docs: results for ALKIS Muenster, Koeln, Hoexter, CGAL, Natural Earth polygons. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 36 + src/Triangle.Tests/Corpus/CorpusReaders.cs | 98 +++ src/Triangle.Tests/Corpus/CorpusTest.cs | 55 ++ src/Triangle.Tests/Prototype/IndexTopology.cs | 102 +++ .../Prototype/PrototypeBenchmark.cs | 118 +++ src/Triangle.Tests/Prototype/XDwyer.cs | 699 ++++++++++++++++++ 6 files changed, 1108 insertions(+) create mode 100644 src/Triangle.Tests/Prototype/IndexTopology.cs create mode 100644 src/Triangle.Tests/Prototype/PrototypeBenchmark.cs create mode 100644 src/Triangle.Tests/Prototype/XDwyer.cs diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 90c79bf..2b1a0bc 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -735,6 +735,42 @@ Die leeren Ergebnisse entsprechen den Erwartungen von earcut (0 Dreiecke für en Eingaben). Lochringe ohne Fläche (earcut `water-huge`, `issue83`) warfen vorher eine Exception; jetzt werden ihre Kanten als Linien übernommen (earcut ignoriert solche Löcher). +### Prototyp: Dreiecke als Indizes statt Objekte + +`src/Triangle.Tests/Prototype`: derselbe Divide-and-Conquer-Algorithmus (Kopie von `Dwyer`, +nur `Otri` ersetzt) auf einer index-basierten Ablage: alle Ecken in einem `Vertex[]`, alle +Nachbarn in einem `int[]` (Dreieck · 4 + Ausrichtung), so wie delaunator-sharp und +BurstTriangulator. Ergebnis identisch (gleiche Dreiecke). Delaunay, Median, .NET 10: + +| Punkte | Objekte (InlineArray, net8) | Indizes | Faktor | Objekte (Arrays, wie net48) | Indizes | Faktor | +|-------:|----------:|--------:|------:|----------:|--------:|------:| +| 10.000 Gitter | 13,3 ms | 9,4 ms | 1,4 | 13,0 ms | 8,5 ms | 1,5 | +| 10.000 zufällig | 10,0 ms | 9,6 ms | 1,05 | 9,0 ms | 7,4 ms | 1,2 | +| 100.000 Gitter | 163 ms | 90 ms | 1,8 | 147 ms | 91 ms | 1,6 | +| 100.000 zufällig | 124 ms | 90 ms | 1,4 | 150 ms | 91 ms | 1,7 | +| 1 Mio. Gitter | 2.124 ms | 1.204 ms | 1,8 | 3.355 ms | 1.374 ms | 2,4 | +| 1 Mio. zufällig | 2.415 ms | 1.514 ms | 1,6 | 3.205 ms | 1.420 ms | 2,3 | + +Mit kleinem Gen-0-Budget (4 MB, eher wie ein Desktop-GC unter net48) und `Arrays`: Faktor 2,0–3,2. +delaunator-sharp bleibt bei 100.000 Punkten mit 44–52 ms etwa doppelt so schnell wie der Prototyp +(die Punkte sind dort auch nur Koordinaten-Arrays, und es verwendet keine exakten Prädikate). + +### Weitere Korpora: NRW-Städte, CGAL, Natural Earth Polygone + +* **ALKIS Münster, Köln, Kreis Höxter** (opengeodata.nrw.de, Flurstücke, Gebäude, Nutzungen; je + 250 gleichmäßig verteilte 200-m-Kacheln, Raster 1 cm, Keil 3 cm, 20° und 30°): 1.504 Läufe, + alle gültig. Schlechte Dreiecke (bei 30°): Münster 0,56 %, Köln 0,70 %, Höxter 0,20 % + (Herne: 2,2 %, dort mit vielen fast deckungsgleichen Gebäude- und Nutzungsgrenzen). + OSM (Overpass, Geofabrik) war aus der Testumgebung nicht erreichbar. +* **CGAL** (`CorpusTest.CgalData`, `TRIANGLE_CGAL`): 36 Sonderfälle von Polygon_repair + (Schleifen, Bowtie, Löcher auf dem Rand, Hin-und-zurück-Kanten, sich kreuzende Polygone) und 172 + Polygone mit Löchern von Straight_skeleton_2, ohne Qualität, 20° und 30°: alle gültig. +* **Natural Earth 10m Polygone** (`CorpusTest.NaturalEarthPolygons`, + `TRIANGLE_NATURAL_EARTH_POLYGONS`): Länder, Bundesländer/Provinzen, Seen, Landflächen, Flüsse, + jede Ebene als Ganzes (gemeinsame Grenzen fallen zusammen) und bis zu 150 Einzelobjekte je + Ebene: 2.307 Läufe, alle gültig. Zwei Ganz-Ebenen-Läufe mit Qualität (Provinzen 20°, Seen 30°, + Koordinaten in Grad) brauchten länger als die 120 s des Testgerüsts. + ## Klassenweises Review (`src/Triangle.Tests/Review`) Alle 80 Quelldateien wurden in sechs Bereichen auf Fehler untersucht; jede Vermutung wurde mit diff --git a/src/Triangle.Tests/Corpus/CorpusReaders.cs b/src/Triangle.Tests/Corpus/CorpusReaders.cs index 62a07d8..c24f035 100644 --- a/src/Triangle.Tests/Corpus/CorpusReaders.cs +++ b/src/Triangle.Tests/Corpus/CorpusReaders.cs @@ -116,6 +116,104 @@ public static void AddWkt(CorpusCase c, string wkt) return rings; } + /// + /// Test data of CGAL (sparse checkout of https://github.com/CGAL/cgal): polygons with holes + /// and invalid polygons of Polygon_repair (WKT) and of Straight_skeleton_2 (.poly: number + /// of rings, then per ring the number of points and the coordinates). + /// + public static IEnumerable ReadCgal(string root) + { + var repair = Path.Combine(root, "Polygon_repair", "test", "Polygon_repair", "data", "in"); + if (Directory.Exists(repair)) + { + foreach (var path in Directory.GetFiles(repair, "*.wkt").OrderBy(p => p, StringComparer.Ordinal)) + { + var c = new CorpusCase { Name = "cgal/repair/" + Path.GetFileNameWithoutExtension(path) }; + AddWkt(c, File.ReadAllText(path)); + yield return c; + } + } + + var skeleton = Path.Combine(root, "Straight_skeleton_2", "test", "Straight_skeleton_2", "data"); + if (Directory.Exists(skeleton)) + { + foreach (var path in Directory.GetFiles(skeleton, "*.poly").OrderBy(p => p, StringComparer.Ordinal)) + { + var tokens = File.ReadAllText(path).Split(new[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); + var c = new CorpusCase { Name = "cgal/skeleton/" + Path.GetFileNameWithoutExtension(path) }; + int k = 0; + + if (tokens.Length == 0 || !int.TryParse(tokens[k++], out int rings)) continue; + + for (int r = 0; r < rings && k < tokens.Length; r++) + { + if (!int.TryParse(tokens[k++], out int n) || k + 2 * n > tokens.Length) break; + + var ring = new List<(double X, double Y)>(n + 1); + for (int i = 0; i < n; i++, k += 2) + { + ring.Add((double.Parse(tokens[k], CultureInfo.InvariantCulture), double.Parse(tokens[k + 1], CultureInfo.InvariantCulture))); + } + + if (ring.Count > 1) + { + ring.Add(ring[0]); + c.Lines.Add(ring); + } + } + + if (c.Lines.Count > 0) yield return c; + } + } + } + + /// + /// Read the rings (and lines) of each feature of a GeoJSON file separately, named by the + /// property NAME, name or the feature index. + /// + public static List<(string Name, List> Rings)> ReadGeoJsonFeatures(string path) + { + var features = new List<(string, List>)>(); + + using var stream = File.OpenRead(path); + using var doc = JsonDocument.Parse(stream); + + int index = 0; + + foreach (var feature in doc.RootElement.GetProperty("features").EnumerateArray()) + { + index++; + + if (!feature.TryGetProperty("geometry", out var geometry) || geometry.ValueKind != JsonValueKind.Object) continue; + + string name = index.ToString(CultureInfo.InvariantCulture); + + if (feature.TryGetProperty("properties", out var properties) && properties.ValueKind == JsonValueKind.Object) + { + foreach (var key in new[] { "NAME", "name" }) + { + if (properties.TryGetProperty(key, out var value) && value.ValueKind == JsonValueKind.String) + { + name = value.GetString() + " #" + index; + break; + } + } + } + + var rings = new List>(); + var type = geometry.GetProperty("type").GetString(); + var coordinates = geometry.GetProperty("coordinates"); + + if (type == "Polygon" || type == "MultiLineString") AddPolygon(rings, coordinates); + else if (type == "MultiPolygon") foreach (var polygon in coordinates.EnumerateArray()) AddPolygon(rings, polygon); + else if (type == "LineString") rings.Add(coordinates.EnumerateArray().Select(p => (p[0].GetDouble(), p[1].GetDouble())).ToList()); + + if (rings.Count > 0) features.Add((name, rings)); + } + + return features; + } + private static void AddPolygon(List> rings, JsonElement polygon) { foreach (var ring in polygon.EnumerateArray()) diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index 87d6528..6ab2b58 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -30,6 +30,11 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_PUBLIC_FIXTURES directory with clones of https://github.com/mapbox/earcut, /// https://github.com/mapbox/delaunator and https://github.com/jhasse/poly2tri /// (test fixtures of other triangulation libraries, ISC/BSD licensed) + /// TRIANGLE_CGAL sparse checkout of https://github.com/CGAL/cgal with + /// Polygon_repair/test/Polygon_repair/data and Straight_skeleton_2/test/Straight_skeleton_2/data + /// TRIANGLE_NATURAL_EARTH_POLYGONS directory with Natural Earth polygon layers (ne_*.geojson, + /// e.g. ne_10m_admin_0_countries, ne_10m_lakes): each layer as a whole + /// and each feature separately (at most TRIANGLE_CORPUS_TILES per layer) /// TRIANGLE_CORPUS_TILES maximum number of tiles (default 200) /// TRIANGLE_CORPUS_TILE tile size in meters (default 200) /// TRIANGLE_CORPUS_SNAP snap tolerance (ConstraintOptions.SnapTolerance, default 0) @@ -99,6 +104,56 @@ public void PublicFixtures() RunCases(CorpusReaders.ReadPublicFixtures(directory)); } + [Test] + public void CgalData() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_CGAL"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_CGAL not set."); + } + + RunCases(CorpusReaders.ReadCgal(directory)); + } + + [Test] + public void NaturalEarthPolygons() + { + var directory = Environment.GetEnvironmentVariable("TRIANGLE_NATURAL_EARTH_POLYGONS"); + + if (string.IsNullOrEmpty(directory) || !Directory.Exists(directory)) + { + Assert.Ignore("TRIANGLE_NATURAL_EARTH_POLYGONS not set."); + } + + var cases = new List(); + + foreach (var path in Directory.GetFiles(directory, "ne_*.geojson").OrderBy(p => p, StringComparer.Ordinal)) + { + var features = CorpusReaders.ReadGeoJsonFeatures(path); + var file = Path.GetFileNameWithoutExtension(path); + + // The whole layer (shared borders of neighboring polygons coincide) ... + var all = new CorpusCase { Name = file }; + foreach (var f in features) all.Lines.AddRange(f.Rings); + cases.Add(all); + + // ... and each feature (country, lake, ...) separately, sampled evenly. + double step = Math.Max(1.0, (double)features.Count / MaxTiles()); + + for (double k = 0; k < features.Count; k += step) + { + var f = features[(int)k]; + var c = new CorpusCase { Name = file + "/" + f.Name }; + c.Lines.AddRange(f.Rings); + cases.Add(c); + } + } + + RunCases(cases); + } + [Test] public void CdtLibraryInputs() { diff --git a/src/Triangle.Tests/Prototype/IndexTopology.cs b/src/Triangle.Tests/Prototype/IndexTopology.cs new file mode 100644 index 0000000..2e42a22 --- /dev/null +++ b/src/Triangle.Tests/Prototype/IndexTopology.cs @@ -0,0 +1,102 @@ +using System; +using TriangleNet.Geometry; + +namespace TriangleNet.Tests.Prototype +{ + /// + /// Prototype of an index-based triangle storage: the vertices and neighbors of all triangles + /// in two arrays instead of an object (and its arrays) per triangle. Triangle 0 is the + /// "outer space" triangle (dummytri). + /// + internal sealed class TriangleStore + { + // Three vertices per triangle. + public Vertex[] Vertices; + + // Three neighbors per triangle, encoded as (triangle << 2) | orientation. + public int[] Neighbors; + + public int Count; + + public TriangleStore(int capacity) + { + capacity = Math.Max(capacity, 16); + Vertices = new Vertex[3 * capacity]; + Neighbors = new int[3 * capacity]; + Count = 1; + } + + public int Make() + { + if (3 * (Count + 1) > Neighbors.Length) + { + Array.Resize(ref Vertices, 2 * Vertices.Length); + Array.Resize(ref Neighbors, 2 * Neighbors.Length); + } + + int t = Count++; + int i = 3 * t; + Neighbors[i] = Neighbors[i + 1] = Neighbors[i + 2] = 0; + Vertices[i] = Vertices[i + 1] = Vertices[i + 2] = null; + return t; + } + + public void Kill(int t) => Neighbors[3 * t] = -1; + + public bool IsDead(int t) => Neighbors[3 * t] == -1; + } + + /// + /// Oriented triangle on a (same operations as ). + /// + internal struct XOtri + { + // The store of the running triangulation (prototype: one per thread). + [ThreadStatic] public static TriangleStore S; + + public int t; + public int o; + + private static int Plus1(int o) => o == 2 ? 0 : o + 1; + private static int Minus1(int o) => o == 0 ? 2 : o - 1; + + public static void Make(ref XOtri ot) { ot.t = S.Make(); ot.o = 0; } + + public void Sym(ref XOtri ot) { int c = S.Neighbors[3 * t + o]; ot.t = c >> 2; ot.o = c & 3; } + public void Sym() { int c = S.Neighbors[3 * t + o]; t = c >> 2; o = c & 3; } + public void Lnext(ref XOtri ot) { ot.t = t; ot.o = Plus1(o); } + public void Lnext() { o = Plus1(o); } + public void Lprev(ref XOtri ot) { ot.t = t; ot.o = Minus1(o); } + public void Lprev() { o = Minus1(o); } + public void Onext(ref XOtri ot) { int c = S.Neighbors[3 * t + Minus1(o)]; ot.t = c >> 2; ot.o = c & 3; } + public void Onext() { int c = S.Neighbors[3 * t + Minus1(o)]; t = c >> 2; o = c & 3; } + public void Oprev(ref XOtri ot) { int c = S.Neighbors[3 * t + o]; ot.t = c >> 2; ot.o = Plus1(c & 3); } + public void Oprev() { int c = S.Neighbors[3 * t + o]; t = c >> 2; o = Plus1(c & 3); } + public void Dnext(ref XOtri ot) { int c = S.Neighbors[3 * t + o]; ot.t = c >> 2; ot.o = Minus1(c & 3); } + public void Dnext() { int c = S.Neighbors[3 * t + o]; t = c >> 2; o = Minus1(c & 3); } + public void Dprev(ref XOtri ot) { int c = S.Neighbors[3 * t + Plus1(o)]; ot.t = c >> 2; ot.o = c & 3; } + public void Dprev() { int c = S.Neighbors[3 * t + Plus1(o)]; t = c >> 2; o = c & 3; } + public void Rnext(ref XOtri ot) { var x = this; x.Sym(); x.Lnext(); x.Sym(); ot = x; } + public void Rnext() { Sym(); Lnext(); Sym(); } + public void Rprev(ref XOtri ot) { var x = this; x.Sym(); x.Lprev(); x.Sym(); ot = x; } + public void Rprev() { Sym(); Lprev(); Sym(); } + + public Vertex Org() => S.Vertices[3 * t + Plus1(o)]; + public Vertex Dest() => S.Vertices[3 * t + Minus1(o)]; + public Vertex Apex() => S.Vertices[3 * t + o]; + public void SetOrg(Vertex v) => S.Vertices[3 * t + Plus1(o)] = v; + public void SetDest(Vertex v) => S.Vertices[3 * t + Minus1(o)] = v; + public void SetApex(Vertex v) => S.Vertices[3 * t + o] = v; + + public void Copy(ref XOtri ot) { ot.t = t; ot.o = o; } + public bool Equals(XOtri ot) => t == ot.t && o == ot.o; + + public void Bond(ref XOtri ot) + { + S.Neighbors[3 * t + o] = (ot.t << 2) | ot.o; + S.Neighbors[3 * ot.t + ot.o] = (t << 2) | o; + } + + public void Dissolve() => S.Neighbors[3 * t + o] = 0; + } +} diff --git a/src/Triangle.Tests/Prototype/PrototypeBenchmark.cs b/src/Triangle.Tests/Prototype/PrototypeBenchmark.cs new file mode 100644 index 0000000..a18a394 --- /dev/null +++ b/src/Triangle.Tests/Prototype/PrototypeBenchmark.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using NUnit.Framework; +using TriangleNet.Geometry; +using TriangleNet.Meshing.Algorithm; + +namespace TriangleNet.Tests.Prototype +{ + /// + /// Compares the divide-and-conquer triangulation on the object-based mesh with the same + /// algorithm on an index-based storage (). + /// + public static class PrototypeBenchmark + { + public static List Grid(int n) + { + var list = new List(n * n); + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + list.Add(new Vertex(i / (double)(float)(n - 1), j / (double)(float)(n - 1)) { ID = list.Count }); + return list; + } + + public static List Random(int count) + { + var r = new System.Random(1); + var list = new List(count); + for (int i = 0; i < count; i++) list.Add(new Vertex(r.NextDouble(), r.NextDouble()) { ID = i }); + return list; + } + + /// + /// Sorted vertex id triples of the triangles (for comparing the results). + /// + internal static List<(int, int, int)> Triangles(TriangleStore store) + { + var list = new List<(int, int, int)>(); + for (int t = 1; t < store.Count; t++) + { + if (store.IsDead(t)) continue; + list.Add(Key(store.Vertices[3 * t].ID, store.Vertices[3 * t + 1].ID, store.Vertices[3 * t + 2].ID)); + } + list.Sort(); + return list; + } + + public static List<(int, int, int)> Triangles(Mesh mesh) + { + var list = mesh.Triangles.Select(t => Key(t.GetVertexID(0), t.GetVertexID(1), t.GetVertexID(2))).ToList(); + list.Sort(); + return list; + } + + private static (int, int, int) Key(int a, int b, int c) + { + // Rotate so that the smallest id comes first (keeps the orientation). + if (a < b && a < c) return (a, b, c); + if (b < c) return (b, c, a); + return (c, a, b); + } + + private static double Median(Func run, out int result, double budgetMs) + { + result = run(); + var times = new List(); + var total = Stopwatch.StartNew(); + do + { + var sw = Stopwatch.StartNew(); + result = run(); + times.Add(sw.Elapsed.TotalMilliseconds); + } while (total.ElapsedMilliseconds < budgetMs && times.Count < 200); + times.Sort(); + return times[times.Count / 2]; + } + + public static void Run(Action output, double budgetMs = 2000) + { + var config = new Configuration(); + + foreach (var n in new[] { 100, 316, 1000 }) + { + foreach (var (name, points) in new[] { ("grid", Grid(n)), ("random", Random(n * n)) }) + { + // Same result? + var a = Triangles((Mesh)new Dwyer().Triangulate(points, config)); + var b = Triangles(new XDwyer().Triangulate(points, config)); + bool same = a.SequenceEqual(b); + + long g0 = GC.CollectionCount(0); + double objects = Median(() => new Dwyer().Triangulate(points, config).Triangles.Count, out int c1, budgetMs); + double indices = Median(() => new XDwyer().Triangulate(points, config).Count, out _, budgetMs); + double meshOnly = Median(() => new Mesh(config, points).Vertices.Count, out _, budgetMs / 4); + + output($"{name,-6} {points.Count,9} points: objects {objects,9:F2} ms (thereof new Mesh {meshOnly,7:F2} ms), " + + $"indices {indices,9:F2} ms, factor {objects / indices:F2}, same result {same} ({c1} triangles)"); + } + } + } + } + + [Category("Benchmark"), Explicit("Prototype benchmark")] + public class PrototypeBenchmarkTest + { + [Test] + public void IndexStorageGivesSameTriangulation() + { + foreach (var points in new[] { PrototypeBenchmark.Grid(50), PrototypeBenchmark.Random(5000) }) + { + var a = PrototypeBenchmark.Triangles((Mesh)new Dwyer().Triangulate(points, new Configuration())); + var b = PrototypeBenchmark.Triangles(new XDwyer().Triangulate(points, new Configuration())); + Assert.That(b, Is.EqualTo(a)); + } + } + } +} diff --git a/src/Triangle.Tests/Prototype/XDwyer.cs b/src/Triangle.Tests/Prototype/XDwyer.cs new file mode 100644 index 0000000..5ca4859 --- /dev/null +++ b/src/Triangle.Tests/Prototype/XDwyer.cs @@ -0,0 +1,699 @@ +// ----------------------------------------------------------------------- +// +// Triangle Copyright (c) 1993, 1995, 1997, 1998, 2002, 2005 Jonathan Richard Shewchuk +// Triangle.NET code by Christian Woltering +// +// ----------------------------------------------------------------------- + +namespace TriangleNet.Tests.Prototype +{ + using System; + using System.Collections.Generic; + using TriangleNet.Geometry; + using TriangleNet.Tools; + using TriangleNet.Topology; + + /// + /// Builds a delaunay triangulation using the divide-and-conquer algorithm. + /// + /// + /// The divide-and-conquer bounding box + /// + /// I originally implemented the divide-and-conquer and incremental Delaunay + /// triangulations using the edge-based data structure presented by Guibas + /// and Stolfi. Switching to a triangle-based data structure doubled the + /// speed. However, I had to think of a few extra tricks to maintain the + /// elegance of the original algorithms. + /// + /// The "bounding box" used by my variant of the divide-and-conquer + /// algorithm uses one triangle for each edge of the convex hull of the + /// triangulation. These bounding triangles all share a common apical + /// vertex, which is represented by NULL and which represents nothing. + /// The bounding triangles are linked in a circular fan about this NULL + /// vertex, and the edges on the convex hull of the triangulation appear + /// opposite the NULL vertex. You might find it easiest to imagine that + /// the NULL vertex is a point in 3D space behind the center of the + /// triangulation, and that the bounding triangles form a sort of cone. + /// + /// This bounding box makes it easy to represent degenerate cases. For + /// instance, the triangulation of two vertices is a single edge. This edge + /// is represented by two bounding box triangles, one on each "side" of the + /// edge. These triangles are also linked together in a fan about the NULL + /// vertex. + /// + /// The bounding box also makes it easy to traverse the convex hull, as the + /// divide-and-conquer algorithm needs to do. + /// + internal class XDwyer + { + IPredicates predicates; + + /// + /// Gets or sets a value indicating whether to use alternating cuts (default = true). + /// + public bool UseDwyer = true; + + Vertex[] sortarray; + public int hullsize; + + /// + /// Compute a Delaunay triangulation by the divide-and-conquer method. + /// + /// + /// + /// Sorts the vertices, calls a recursive procedure to triangulate them, and + /// removes the bounding box, setting boundary markers as appropriate. + /// + public TriangleStore Triangulate(IList points, Configuration config) + { + predicates = config.Predicates(); + + var store = XOtri.S = new TriangleStore(2 * points.Count + 16); + + XOtri hullleft = default(XOtri), hullright = default(XOtri); + int i, j, n = points.Count; + + // Allocate an array of pointers to vertices for sorting. + sortarray = new Vertex[n]; + i = 0; + foreach (var v in points) + { + sortarray[i++] = v; + } + + // Sort the vertices. + VertexSorter.Sort(sortarray); + + // Discard duplicate vertices, which can really mess up the algorithm. + i = 0; + for (j = 1; j < n; j++) + { + if ((sortarray[i].x == sortarray[j].x) && (sortarray[i].y == sortarray[j].y)) + { + if (Log.Verbose) + { + Log.Instance.Warning( + string.Format("A duplicate vertex appeared and was ignored (ID {0}).", sortarray[j].id), + "Dwyer.Triangulate()"); + } + sortarray[j].type = VertexType.UndeadVertex; + } + else + { + i++; + sortarray[i] = sortarray[j]; + } + } + i++; + + if (i < 2) + { + // All input vertices are identical, so there is no triangulation. + return store; + } + + if (UseDwyer) + { + // Re-sort the array of vertices to accommodate alternating cuts. + VertexSorter.Alternate(sortarray, i); + } + + // Form the Delaunay triangulation. + DivconqRecurse(0, i - 1, 0, ref hullleft, ref hullright); + + hullsize = RemoveGhosts(ref hullleft); + + return store; + } + + /// + /// Merge two adjacent Delaunay triangulations into a single Delaunay triangulation. + /// + /// Bounding triangles of the left triangulation. + /// Bounding triangles of the left triangulation. + /// Bounding triangles of the right triangulation. + /// Bounding triangles of the right triangulation. + /// + /// + /// This is similar to the algorithm given by Guibas and Stolfi, but uses + /// a triangle-based, rather than edge-based, data structure. + /// + /// The algorithm walks up the gap between the two triangulations, knitting + /// them together. As they are merged, some of their bounding triangles + /// are converted into real triangles of the triangulation. The procedure + /// pulls each hull's bounding triangles apart, then knits them together + /// like the teeth of two gears. The Delaunay property determines, at each + /// step, whether the next "tooth" is a bounding triangle of the left hull + /// or the right. When a bounding triangle becomes real, its apex is + /// changed from NULL to a real vertex. + /// + /// Only two new triangles need to be allocated. These become new bounding + /// triangles at the top and bottom of the seam. They are used to connect + /// the remaining bounding triangles (those that have not been converted + /// into real triangles) into a single fan. + /// + /// On entry, 'farleft' and 'innerleft' are bounding triangles of the left + /// triangulation. The origin of 'farleft' is the leftmost vertex, and + /// the destination of 'innerleft' is the rightmost vertex of the + /// triangulation. Similarly, 'innerright' and 'farright' are bounding + /// triangles of the right triangulation. The origin of 'innerright' and + /// destination of 'farright' are the leftmost and rightmost vertices. + /// + /// On completion, the origin of 'farleft' is the leftmost vertex of the + /// merged triangulation, and the destination of 'farright' is the rightmost + /// vertex. + /// + void MergeHulls(ref XOtri farleft, ref XOtri innerleft, ref XOtri innerright, + ref XOtri farright, int axis) + { + XOtri leftcand = default(XOtri), rightcand = default(XOtri); + XOtri nextedge = default(XOtri); + XOtri sidecasing = default(XOtri), topcasing = default(XOtri), outercasing = default(XOtri); + XOtri checkedge = default(XOtri); + XOtri baseedge = default(XOtri); + Vertex innerleftdest; + Vertex innerrightorg; + Vertex innerleftapex, innerrightapex; + Vertex farleftpt, farrightpt; + Vertex farleftapex, farrightapex; + Vertex lowerleft, lowerright; + Vertex upperleft, upperright; + Vertex nextapex; + Vertex checkvertex; + bool changemade; + bool badedge; + bool leftfinished, rightfinished; + + innerleftdest = innerleft.Dest(); + innerleftapex = innerleft.Apex(); + innerrightorg = innerright.Org(); + innerrightapex = innerright.Apex(); + // Special treatment for horizontal cuts. + if (UseDwyer && (axis == 1)) + { + farleftpt = farleft.Org(); + farleftapex = farleft.Apex(); + farrightpt = farright.Dest(); + farrightapex = farright.Apex(); + // The pointers to the extremal vertices are shifted to point to the + // topmost and bottommost vertex of each hull, rather than the + // leftmost and rightmost vertices. + while (farleftapex.y < farleftpt.y) + { + farleft.Lnext(); + farleft.Sym(); + farleftpt = farleftapex; + farleftapex = farleft.Apex(); + } + innerleft.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + while (checkvertex.y > innerleftdest.y) + { + checkedge.Lnext(ref innerleft); + innerleftapex = innerleftdest; + innerleftdest = checkvertex; + innerleft.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + } + while (innerrightapex.y < innerrightorg.y) + { + innerright.Lnext(); + innerright.Sym(); + innerrightorg = innerrightapex; + innerrightapex = innerright.Apex(); + } + farright.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + while (checkvertex.y > farrightpt.y) + { + checkedge.Lnext(ref farright); + farrightapex = farrightpt; + farrightpt = checkvertex; + farright.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + } + } + // Find a line tangent to and below both hulls. + do + { + changemade = false; + // Make innerleftdest the "bottommost" vertex of the left hull. + if (predicates.CounterClockwise(innerleftdest, innerleftapex, innerrightorg) > 0.0) + { + innerleft.Lprev(); + innerleft.Sym(); + innerleftdest = innerleftapex; + innerleftapex = innerleft.Apex(); + changemade = true; + } + // Make innerrightorg the "bottommost" vertex of the right hull. + if (predicates.CounterClockwise(innerrightapex, innerrightorg, innerleftdest) > 0.0) + { + innerright.Lnext(); + innerright.Sym(); + innerrightorg = innerrightapex; + innerrightapex = innerright.Apex(); + changemade = true; + } + } while (changemade); + + // Find the two candidates to be the next "gear tooth." + innerleft.Sym(ref leftcand); + innerright.Sym(ref rightcand); + // Create the bottom new bounding triangle. + XOtri.Make(ref baseedge); + // Connect it to the bounding boxes of the left and right triangulations. + baseedge.Bond(ref innerleft); + baseedge.Lnext(); + baseedge.Bond(ref innerright); + baseedge.Lnext(); + baseedge.SetOrg(innerrightorg); + baseedge.SetDest(innerleftdest); + // Apex is intentionally left NULL. + + // Fix the extreme triangles if necessary. + farleftpt = farleft.Org(); + if (innerleftdest == farleftpt) + { + baseedge.Lnext(ref farleft); + } + farrightpt = farright.Dest(); + if (innerrightorg == farrightpt) + { + baseedge.Lprev(ref farright); + } + // The vertices of the current knitting edge. + lowerleft = innerleftdest; + lowerright = innerrightorg; + // The candidate vertices for knitting. + upperleft = leftcand.Apex(); + upperright = rightcand.Apex(); + // Walk up the gap between the two triangulations, knitting them together. + while (true) + { + // Have we reached the top? (This isn't quite the right question, + // because even though the left triangulation might seem finished now, + // moving up on the right triangulation might reveal a new vertex of + // the left triangulation. And vice-versa.) + leftfinished = predicates.CounterClockwise(upperleft, lowerleft, lowerright) <= 0.0; + rightfinished = predicates.CounterClockwise(upperright, lowerleft, lowerright) <= 0.0; + if (leftfinished && rightfinished) + { + // Create the top new bounding triangle. + XOtri.Make(ref nextedge); + nextedge.SetOrg(lowerleft); + nextedge.SetDest(lowerright); + // Apex is intentionally left NULL. + // Connect it to the bounding boxes of the two triangulations. + nextedge.Bond(ref baseedge); + nextedge.Lnext(); + nextedge.Bond(ref rightcand); + nextedge.Lnext(); + nextedge.Bond(ref leftcand); + + // Special treatment for horizontal cuts. + if (UseDwyer && (axis == 1)) + { + farleftpt = farleft.Org(); + farleftapex = farleft.Apex(); + farrightpt = farright.Dest(); + farrightapex = farright.Apex(); + farleft.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + // The pointers to the extremal vertices are restored to the + // leftmost and rightmost vertices (rather than topmost and + // bottommost). + while (checkvertex.x < farleftpt.x) + { + checkedge.Lprev(ref farleft); + farleftapex = farleftpt; + farleftpt = checkvertex; + farleft.Sym(ref checkedge); + checkvertex = checkedge.Apex(); + } + while (farrightapex.x > farrightpt.x) + { + farright.Lprev(); + farright.Sym(); + farrightpt = farrightapex; + farrightapex = farright.Apex(); + } + } + return; + } + // Consider eliminating edges from the left triangulation. + if (!leftfinished) + { + // What vertex would be exposed if an edge were deleted? + leftcand.Lprev(ref nextedge); + nextedge.Sym(); + nextapex = nextedge.Apex(); + // If nextapex is NULL, then no vertex would be exposed; the + // triangulation would have been eaten right through. + if (nextapex != null) + { + // Check whether the edge is Delaunay. + badedge = predicates.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0; + while (badedge) + { + // Eliminate the edge with an edge flip. As a result, the + // left triangulation will have one more boundary triangle. + nextedge.Lnext(); + nextedge.Sym(ref topcasing); + nextedge.Lnext(); + nextedge.Sym(ref sidecasing); + nextedge.Bond(ref topcasing); + leftcand.Bond(ref sidecasing); + leftcand.Lnext(); + leftcand.Sym(ref outercasing); + nextedge.Lprev(); + nextedge.Bond(ref outercasing); + // Correct the vertices to reflect the edge flip. + leftcand.SetOrg(lowerleft); + leftcand.SetDest(null); + leftcand.SetApex(nextapex); + nextedge.SetOrg(null); + nextedge.SetDest(upperleft); + nextedge.SetApex(nextapex); + // Consider the newly exposed vertex. + upperleft = nextapex; + // What vertex would be exposed if another edge were deleted? + sidecasing.Copy(ref nextedge); + nextapex = nextedge.Apex(); + if (nextapex != null) + { + // Check whether the edge is Delaunay. + badedge = predicates.InCircle(lowerleft, lowerright, upperleft, nextapex) > 0.0; + } + else + { + // Avoid eating right through the triangulation. + badedge = false; + } + } + } + } + // Consider eliminating edges from the right triangulation. + if (!rightfinished) + { + // What vertex would be exposed if an edge were deleted? + rightcand.Lnext(ref nextedge); + nextedge.Sym(); + nextapex = nextedge.Apex(); + // If nextapex is NULL, then no vertex would be exposed; the + // triangulation would have been eaten right through. + if (nextapex != null) + { + // Check whether the edge is Delaunay. + badedge = predicates.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0; + while (badedge) + { + // Eliminate the edge with an edge flip. As a result, the + // right triangulation will have one more boundary triangle. + nextedge.Lprev(); + nextedge.Sym(ref topcasing); + nextedge.Lprev(); + nextedge.Sym(ref sidecasing); + nextedge.Bond(ref topcasing); + rightcand.Bond(ref sidecasing); + rightcand.Lprev(); + rightcand.Sym(ref outercasing); + nextedge.Lnext(); + nextedge.Bond(ref outercasing); + // Correct the vertices to reflect the edge flip. + rightcand.SetOrg(null); + rightcand.SetDest(lowerright); + rightcand.SetApex(nextapex); + nextedge.SetOrg(upperright); + nextedge.SetDest(null); + nextedge.SetApex(nextapex); + // Consider the newly exposed vertex. + upperright = nextapex; + // What vertex would be exposed if another edge were deleted? + sidecasing.Copy(ref nextedge); + nextapex = nextedge.Apex(); + if (nextapex != null) + { + // Check whether the edge is Delaunay. + badedge = predicates.InCircle(lowerleft, lowerright, upperright, nextapex) > 0.0; + } + else + { + // Avoid eating right through the triangulation. + badedge = false; + } + } + } + } + if (leftfinished || (!rightfinished && + (predicates.InCircle(upperleft, lowerleft, lowerright, upperright) > 0.0))) + { + // Knit the triangulations, adding an edge from 'lowerleft' + // to 'upperright'. + baseedge.Bond(ref rightcand); + rightcand.Lprev(ref baseedge); + baseedge.SetDest(lowerleft); + lowerright = upperright; + baseedge.Sym(ref rightcand); + upperright = rightcand.Apex(); + } + else + { + // Knit the triangulations, adding an edge from 'upperleft' + // to 'lowerright'. + baseedge.Bond(ref leftcand); + leftcand.Lnext(ref baseedge); + baseedge.SetOrg(lowerright); + lowerleft = upperleft; + baseedge.Sym(ref leftcand); + upperleft = leftcand.Apex(); + } + } + } + + /// + /// Recursively form a Delaunay triangulation by the divide-and-conquer method. + /// + /// + /// + /// + /// + /// + /// + /// Recursively breaks down the problem into smaller pieces, which are + /// knitted together by mergehulls(). The base cases (problems of two or + /// three vertices) are handled specially here. + /// + /// On completion, 'farleft' and 'farright' are bounding triangles such that + /// the origin of 'farleft' is the leftmost vertex (breaking ties by + /// choosing the highest leftmost vertex), and the destination of + /// 'farright' is the rightmost vertex (breaking ties by choosing the + /// lowest rightmost vertex). + /// + void DivconqRecurse(int left, int right, int axis, + ref XOtri farleft, ref XOtri farright) + { + XOtri midtri = default(XOtri); + XOtri tri1 = default(XOtri); + XOtri tri2 = default(XOtri); + XOtri tri3 = default(XOtri); + XOtri innerleft = default(XOtri), innerright = default(XOtri); + double area; + int vertices = right - left + 1; + int divider; + + if (vertices == 2) + { + // The triangulation of two vertices is an edge. An edge is + // represented by two bounding triangles. + XOtri.Make(ref farleft); + farleft.SetOrg(sortarray[left]); + farleft.SetDest(sortarray[left + 1]); + // The apex is intentionally left NULL. + XOtri.Make(ref farright); + farright.SetOrg(sortarray[left + 1]); + farright.SetDest(sortarray[left]); + // The apex is intentionally left NULL. + farleft.Bond(ref farright); + farleft.Lprev(); + farright.Lnext(); + farleft.Bond(ref farright); + farleft.Lprev(); + farright.Lnext(); + farleft.Bond(ref farright); + + // Ensure that the origin of 'farleft' is sortarray[0]. + farright.Lprev(ref farleft); + return; + } + else if (vertices == 3) + { + // The triangulation of three vertices is either a triangle (with + // three bounding triangles) or two edges (with four bounding + // triangles). In either case, four triangles are created. + XOtri.Make(ref midtri); + XOtri.Make(ref tri1); + XOtri.Make(ref tri2); + XOtri.Make(ref tri3); + area = predicates.CounterClockwise(sortarray[left], sortarray[left + 1], sortarray[left + 2]); + if (area == 0.0) + { + // Three collinear vertices; the triangulation is two edges. + midtri.SetOrg(sortarray[left]); + midtri.SetDest(sortarray[left + 1]); + tri1.SetOrg(sortarray[left + 1]); + tri1.SetDest(sortarray[left]); + tri2.SetOrg(sortarray[left + 2]); + tri2.SetDest(sortarray[left + 1]); + tri3.SetOrg(sortarray[left + 1]); + tri3.SetDest(sortarray[left + 2]); + // All apices are intentionally left NULL. + midtri.Bond(ref tri1); + tri2.Bond(ref tri3); + midtri.Lnext(); + tri1.Lprev(); + tri2.Lnext(); + tri3.Lprev(); + midtri.Bond(ref tri3); + tri1.Bond(ref tri2); + midtri.Lnext(); + tri1.Lprev(); + tri2.Lnext(); + tri3.Lprev(); + midtri.Bond(ref tri1); + tri2.Bond(ref tri3); + // Ensure that the origin of 'farleft' is sortarray[0]. + tri1.Copy(ref farleft); + // Ensure that the destination of 'farright' is sortarray[2]. + tri2.Copy(ref farright); + } + else + { + // The three vertices are not collinear; the triangulation is one + // triangle, namely 'midtri'. + midtri.SetOrg(sortarray[left]); + tri1.SetDest(sortarray[left]); + tri3.SetOrg(sortarray[left]); + // Apices of tri1, tri2, and tri3 are left NULL. + if (area > 0.0) + { + // The vertices are in counterclockwise order. + midtri.SetDest(sortarray[left + 1]); + tri1.SetOrg(sortarray[left + 1]); + tri2.SetDest(sortarray[left + 1]); + midtri.SetApex(sortarray[left + 2]); + tri2.SetOrg(sortarray[left + 2]); + tri3.SetDest(sortarray[left + 2]); + } + else + { + // The vertices are in clockwise order. + midtri.SetDest(sortarray[left + 2]); + tri1.SetOrg(sortarray[left + 2]); + tri2.SetDest(sortarray[left + 2]); + midtri.SetApex(sortarray[left + 1]); + tri2.SetOrg(sortarray[left + 1]); + tri3.SetDest(sortarray[left + 1]); + } + // The topology does not depend on how the vertices are ordered. + midtri.Bond(ref tri1); + midtri.Lnext(); + midtri.Bond(ref tri2); + midtri.Lnext(); + midtri.Bond(ref tri3); + tri1.Lprev(); + tri2.Lnext(); + tri1.Bond(ref tri2); + tri1.Lprev(); + tri3.Lprev(); + tri1.Bond(ref tri3); + tri2.Lnext(); + tri3.Lprev(); + tri2.Bond(ref tri3); + // Ensure that the origin of 'farleft' is sortarray[0]. + tri1.Copy(ref farleft); + // Ensure that the destination of 'farright' is sortarray[2]. + if (area > 0.0) + { + tri2.Copy(ref farright); + } + else + { + farleft.Lnext(ref farright); + } + } + + return; + } + else + { + // Split the vertices in half. + divider = vertices >> 1; + + // Recursively triangulate each half. + DivconqRecurse(left, left + divider - 1, 1 - axis, ref farleft, ref innerleft); + DivconqRecurse(left + divider, right, 1 - axis, ref innerright, ref farright); + + // Merge the two triangulations into one. + MergeHulls(ref farleft, ref innerleft, ref innerright, ref farright, axis); + } + } + + /// + /// Removes ghost triangles. + /// + /// + /// Number of vertices on the hull. + int RemoveGhosts(ref XOtri startghost) + { + XOtri searchedge = default(XOtri); + XOtri dissolveedge = default(XOtri); + XOtri deadtriangle = default(XOtri); + Vertex markorg; + + int hullsize; + + bool noPoly = true; + + // Find an edge on the convex hull to start point location from. + startghost.Lprev(ref searchedge); + searchedge.Sym(); + XOtri.S.Neighbors[0] = (searchedge.t << 2) | searchedge.o; + + // Remove the bounding box and count the convex hull edges. + startghost.Copy(ref dissolveedge); + hullsize = 0; + do + { + hullsize++; + dissolveedge.Lnext(ref deadtriangle); + dissolveedge.Lprev(); + dissolveedge.Sym(); + + // If no PSLG is involved, set the boundary markers of all the vertices + // on the convex hull. If a PSLG is used, this step is done later. + if (noPoly) + { + // Watch out for the case where all the input vertices are collinear. + if (dissolveedge.t != 0) + { + markorg = dissolveedge.Org(); + if (markorg.label == 0) + { + markorg.label = 1; + } + } + } + // Remove a bounding triangle from a convex hull triangle. + dissolveedge.Dissolve(); + // Find the next bounding triangle. + deadtriangle.Sym(ref dissolveedge); + + // Delete the bounding triangle. + XOtri.S.Kill(deadtriangle.t); + } while (!dissolveedge.Equals(startghost)); + + return hullsize; + } + } +} From 60b83477313493302dd47f15ff40b4bec84622ab Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 08:20:16 +0000 Subject: [PATCH 38/50] Docs: Natural Earth lakes timeout is the corpus check, not the mesher Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 2b1a0bc..1c3c5eb 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -769,7 +769,10 @@ delaunator-sharp bleibt bei 100.000 Punkten mit 44–52 ms etwa doppelt so schne `TRIANGLE_NATURAL_EARTH_POLYGONS`): Länder, Bundesländer/Provinzen, Seen, Landflächen, Flüsse, jede Ebene als Ganzes (gemeinsame Grenzen fallen zusammen) und bis zu 150 Einzelobjekte je Ebene: 2.307 Läufe, alle gültig. Zwei Ganz-Ebenen-Läufe mit Qualität (Provinzen 20°, Seen 30°, - Koordinaten in Grad) brauchten länger als die 120 s des Testgerüsts. + Koordinaten in Grad) liefen in die 120 s des Testgerüsts. Einzeln nachgemessen: Seen bei 30° + (162.852 Punkte) vernetzt in 3,1 s (520.110 Dreiecke, Steiner-Limit) und ist gültig; die übrige + Zeit braucht die Prüfung des Testgerüsts (Klassifizierung von 375.000 schlechten Dreiecken an + winzigen Eingabewinkeln und schmalen Streifen). ## Klassenweises Review (`src/Triangle.Tests/Review`) From b00975cc9d995212f87bae3416dc88c44cf4f7fc Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 08:35:39 +0000 Subject: [PATCH 39/50] Encroachment pre-check marks cavity triangles instead of using a set Triangles get a mark field; the cavity search uses a per-mesh stamp (Mesh.NextMark) instead of a HashSet, whose Clear cost grows with the largest cavity seen. Results identical (all golden fingerprints unchanged); Herne tile 30 deg with grid -6%. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/Mesh.cs | 17 +++++++++++++++++ src/Triangle/Meshing/QualityMesher.cs | 16 +++++++++------- src/Triangle/Topology/Triangle.cs | 3 +++ src/Triangle/TrianglePool.cs | 1 + 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 916b5a6..0834a45 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -515,6 +515,23 @@ internal void MakeVertexMap() /// Create a new triangle with orientation zero. /// /// Reference to the new triangle. + // Last value used to mark triangles in a search. + private int mark; + + /// + /// Returns a new value to mark triangles as visited (instead of a set of triangles). + /// + internal int NextMark() + { + if (++mark == int.MaxValue) + { + foreach (var t in triangles) t.mark = 0; + mark = 1; + } + + return mark; + } + internal void MakeTriangle(ref Otri newotri) { Triangle tri = triangles.Get(); diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 909aede..0886c2b 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -1062,7 +1062,6 @@ private void InsertCentroid(Otri tri) } // Work data of EncroachesBeforeInsertion. - private readonly HashSet cavity = new HashSet(); private readonly Stack cavityStack = new Stack(); private readonly Dictionary cavityBoundary = new Dictionary(); private readonly List cavityEdges = new List(); @@ -1108,7 +1107,9 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) return false; } - cavity.Clear(); + int stamp = mesh.NextMark(); + int cavityCount = 1; + cavityStack.Clear(); cavityBoundary.Clear(); cavityEdges.Clear(); @@ -1118,7 +1119,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) Otri tri = default(Otri), neighbor = default(Otri); Osub sub = default(Osub); - cavity.Add(horiz.tri); + horiz.tri.mark = stamp; cavityStack.Push(horiz); while (cavityStack.Count > 0) @@ -1135,7 +1136,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) if (neighbor.tri.id != Mesh.DUMMY) { - if (cavity.Contains(neighbor.tri)) + if (neighbor.tri.mark == stamp) { continue; } @@ -1143,7 +1144,8 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) // Same test (and argument order) as in Mesh.InsertVertex. if (predicates.InCircle(tri.Dest(), v, tri.Org(), neighbor.Apex()) > 0.0) { - cavity.Add(neighbor.tri); + neighbor.tri.mark = stamp; + cavityCount++; cavityStack.Push(neighbor); continue; } @@ -1159,7 +1161,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) } } - if (cavity.Count > LargeCavity && cavityEncroached.Count > 0) + if (cavityCount > LargeCavity && cavityEncroached.Count > 0) { for (int i = 0; i < cavityEncroached.Count; i++) { @@ -1210,7 +1212,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) sub.Sym(ref sym); sym.Pivot(ref neighbor); - if (neighbor.tri.id != Mesh.DUMMY && cavity.Contains(neighbor.tri)) + if (neighbor.tri.id != Mesh.DUMMY && neighbor.tri.mark == stamp) { return false; } diff --git a/src/Triangle/Topology/Triangle.cs b/src/Triangle/Topology/Triangle.cs index f016742..204ad8b 100644 --- a/src/Triangle/Topology/Triangle.cs +++ b/src/Triangle/Topology/Triangle.cs @@ -48,6 +48,9 @@ public class Triangle : ITriangle internal double area; internal bool infected; + // Marks the triangle as visited in a search (see Mesh.NextMark). + internal int mark; + /// /// Initializes a new instance of the class. /// diff --git a/src/Triangle/TrianglePool.cs b/src/Triangle/TrianglePool.cs index 3d5943e..c06053e 100644 --- a/src/Triangle/TrianglePool.cs +++ b/src/Triangle/TrianglePool.cs @@ -194,6 +194,7 @@ private void Cleanup(Triangle triangle) triangle.label = 0; triangle.area = 0.0; triangle.infected = false; + triangle.mark = 0; for (int i = 0; i < 3; i++) { From 6c43e03739b7954f469e3a87a837460ae0a5b000 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 08:42:46 +0000 Subject: [PATCH 40/50] aCute: fast path for half-planes that don't cut the polygon; stop at the first relocatable vertex 72% of the half-plane intersections in the wedge computation leave the polygon unchanged and 2% empty it; these are detected by the signs of the vertices (with a margin that rules out the tolerance cases of the general code) and give the same result. DoSmoothing returns as soon as the origin (or destination) can be relocated, since that result was preferred anyway. Results identical (all golden fingerprints unchanged); Herne tile 30 deg -4%. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/NewLocation.cs | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 07274b7..56adb28 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -2168,6 +2168,14 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, // get the surrounding points of q, so this gives us the triangles // Only free vertices can be relocated (checked first, the star is expensive). + if (flag1 > 0) + { + // The origin is preferred (see below), the other vertices needn't be tried. + newloc[0] = possibilities[0]; + newloc[1] = possibilities[1]; + return flag1; + } + numpoints_q = tdest.type == VertexType.FreeVertex && !relocatedVertices.Contains(tdest) ? GetStarPoints(badotri, torg, tdest, tapex, 2, ref points_q) : 0; // // check if the points in counterclockwise order @@ -2216,6 +2224,13 @@ private int DoSmoothing(Otri badotri, Vertex torg, Vertex tdest, Vertex tapex, //********************* TRY TO RELOCATE POINT "q" *************** // get the surrounding points of r, so this gives us the triangles // Only free vertices can be relocated (checked first, the star is expensive). + if (flag2 > 0) + { + newloc[0] = possibilities[2]; + newloc[1] = possibilities[3]; + return flag2; + } + numpoints_r = tapex.type == VertexType.FreeVertex && !relocatedVertices.Contains(tapex) ? GetStarPoints(badotri, torg, tdest, tapex, 3, ref points_r) : 0; // check if the points in counterclockwise order @@ -3413,6 +3428,21 @@ private void LineLineIntersection( /// private int HalfPlaneIntersection(int numvertices, ref double[] convexPoly, double x1, double y1, double x2, double y2) { + // Fast path (most calls): all vertices clearly on one side of the line. The general + // code below then finds no intersection and returns the polygon starting at its + // second vertex (left side), or nothing (right side); the same is done here. + switch (Side(numvertices, convexPoly, x1, y1, x2, y2)) + { + case 1: + double fx = convexPoly[0], fy = convexPoly[1]; + Array.Copy(convexPoly, 2, convexPoly, 0, 2 * numvertices - 2); + convexPoly[2 * numvertices - 2] = fx; + convexPoly[2 * numvertices - 1] = fy; + return numvertices; + case -1: + return 0; + } + double dx, dy; // direction of the line double z, min, max; int i, j; @@ -3469,6 +3499,45 @@ private int HalfPlaneIntersection(int numvertices, ref double[] convexPoly, doub return count; } + /// + /// Returns 1 (-1), if all vertices of the polygon lie on the left (right) side of the line + /// with a margin that makes the general intersection code find no intersection, else 0. + /// + private static int Side(int numvertices, double[] convexPoly, double x1, double y1, double x2, double y2) + { + double dx = x2 - x1, dy = y2 - y1; + double min = double.MaxValue, max = double.MinValue, scale = 0.0; + + for (int k = 0; k < numvertices; k++) + { + double px = convexPoly[2 * k] - x1, py = convexPoly[2 * k + 1] - y1; + double z = dx * py - dy * px; + + if (z < min) min = z; + if (z > max) max = z; + + double r = Math.Abs(px) + Math.Abs(py); + if (r > scale) scale = r; + } + + // The intersection code works with absolute tolerances (1e-13 relative to the edge + // parameter): the distances must be clearly positive (rounding) and not too different + // (the line could otherwise pass the polygon within that tolerance). + double margin = 1e-9 * (Math.Abs(dx) + Math.Abs(dy)) * scale; + + if (min > margin && min > 1e-10 * max) + { + return 1; + } + + if (max < -margin && -max > 1e-10 * -min) + { + return -1; + } + + return 0; + } + /// /// Splits a convex polygons into one or two polygons through the intersection /// with the given line (regarding the directional vector of the given line). From 795f1df01b773a149dca5f4b1753b92c5fa7df45 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:07:19 +0000 Subject: [PATCH 41/50] Predicate micro-benchmarks (BenchmarkDotNet) and analysis PredicatesBenchmark measures the orientation and incircle tests through the interface, directly and as an experimental fast path (same arithmetic and bounds, checked against the library). Fast path 4-8 ns, exact stages on grid data 140 ns; the predicates cost about 2% of a quality mesh, no worthwhile optimization (documented). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 19 ++ .../PredicatesBenchmark.cs | 215 ++++++++++++++++++ 2 files changed, 234 insertions(+) create mode 100644 src/Triangle.Benchmarks/PredicatesBenchmark.cs diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 1c3c5eb..436d5c6 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -755,6 +755,25 @@ Mit kleinem Gen-0-Budget (4 MB, eher wie ein Desktop-GC unter net48) und `Arrays delaunator-sharp bleibt bei 100.000 Punkten mit 44–52 ms etwa doppelt so schnell wie der Prototyp (die Punkte sind dort auch nur Koordinaten-Arrays, und es verwendet keine exakten Prädikate). +### Prädikate: Messung (`PredicatesBenchmark`) + +Aufrufe pro Vermaschung der Herne-Kachel (30°, Snap 1 cm): 853.370 Orientierungs- und 1.033.899 +Inkreis-Tests, davon gehen 0,6 % bzw. 0,002 % in die exakten Stufen (Raster + Keil: 0,2 % bzw. +0,4 %; reguläres Gitter: 1 % bzw. 23 %). BenchmarkDotNet, .NET 10, je Aufruf: + +| Daten | Orientierung | Inkreis | +|-------|-------------:|--------:| +| zufällige UTM-Punkte (schneller Pfad) | 4,5 ns | 7,2 ns | +| Punkte nahe Kreis/Linie (1e-9) | 4,3 ns | 7,7 ns | +| Gitter (kozirkulär, exakte Stufen) | 4,2 ns | 140 ns | + +Über das Interface oder direkt aufgerufen macht keinen messbaren Unterschied. Eine Variante mit +`static readonly`-Schranken, ohne Statistikzähler und mit `AggressiveInlining` ist höchstens +0,5 ns schneller. Die Prädikate kosten auf der Herne-Kachel damit rund 11 ms von 500 ms (2 %): +keine lohnende Baustelle. Einzige Ausnahme sind die globalen Statistikzähler +(`Statistic.CounterClockwiseCount` usw.), die bei paralleler Vermaschung auf mehreren Kernen +dieselbe Cache-Zeile beschreiben. + ### Weitere Korpora: NRW-Städte, CGAL, Natural Earth Polygone * **ALKIS Münster, Köln, Kreis Höxter** (opengeodata.nrw.de, Flurstücke, Gebäude, Nutzungen; je diff --git a/src/Triangle.Benchmarks/PredicatesBenchmark.cs b/src/Triangle.Benchmarks/PredicatesBenchmark.cs new file mode 100644 index 0000000..e5ba1bf --- /dev/null +++ b/src/Triangle.Benchmarks/PredicatesBenchmark.cs @@ -0,0 +1,215 @@ +using System; +using System.Runtime.CompilerServices; +using BenchmarkDotNet.Attributes; +using TriangleNet.Geometry; + +namespace TriangleNet.Benchmarks +{ + /// + /// Micro-benchmarks of the exact predicates (orientation and incircle test). Each operation + /// evaluates one predicate; the data sets decide how often the exact (adaptive) stages run. + /// + /// + /// dotnet run -c Release --project src/Triangle.Benchmarks -- --filter "*Predicates*" + /// + /// Variants: through the interface (as the mesher calls them), on the + /// class directly, and an experimental fast path () with the same + /// arithmetic and error bounds (so the same results), but without statistics counters and with + /// readonly bounds. The experimental variant is checked against the library in the setup. + /// + [MemoryDiagnoser] + public class PredicatesBenchmark + { + private const int N = 4096; + + private Point[] a, b, c, d; + + private IPredicates viaInterface; + private RobustPredicates direct; + + /// + /// utm: random points of a 200 m tile in UTM coordinates (well conditioned); + /// grid: neighboring points of a regular grid (collinear and cocircular, exact stages); + /// near: points within 1e-9 of a line or circle (mostly the exact stages). + /// + [Params("utm", "grid", "near")] + public string Data { get; set; } + + [GlobalSetup] + public void Setup() + { + var random = new Random(1); + a = new Point[N]; b = new Point[N]; c = new Point[N]; d = new Point[N]; + + for (int i = 0; i < N; i++) + { + switch (Data) + { + case "utm": + a[i] = Utm(random); b[i] = Utm(random); c[i] = Utm(random); d[i] = Utm(random); + break; + + case "grid": + { + // A unit square of a 1 cm grid and a fourth point on the grid. + double x = 372000 + 0.01 * random.Next(10000), y = 5710000 + 0.01 * random.Next(10000); + a[i] = new Point(x, y); + b[i] = new Point(x + 0.01, y); + c[i] = new Point(x + 0.01, y + 0.01); + d[i] = random.Next(2) == 0 ? new Point(x, y + 0.01) : new Point(x + 0.02, y + 0.02); + break; + } + + default: + { + double x = 372000 + 200 * random.NextDouble(), y = 5710000 + 200 * random.NextDouble(); + double r = 1 + random.NextDouble(); + double t1 = random.NextDouble() * 6.28, t2 = t1 + 2, t3 = t1 + 4; + a[i] = new Point(x + r * Math.Cos(t1), y + r * Math.Sin(t1)); + b[i] = new Point(x + r * Math.Cos(t2), y + r * Math.Sin(t2)); + c[i] = new Point(x + r * Math.Cos(t3), y + r * Math.Sin(t3)); + double t4 = random.NextDouble() * 6.28, e = (random.NextDouble() - 0.5) * 1e-9; + d[i] = new Point(x + (r + e) * Math.Cos(t4), y + (r + e) * Math.Sin(t4)); + break; + } + } + } + + direct = new RobustPredicates(); + viaInterface = direct; + + for (int i = 0; i < N; i++) + { + if (Math.Sign(FastPredicates.CounterClockwise(a[i], b[i], c[i])) != Math.Sign(direct.CounterClockwise(a[i], b[i], c[i])) || + Math.Sign(FastPredicates.InCircle(a[i], b[i], c[i], d[i])) != Math.Sign(direct.InCircle(a[i], b[i], c[i], d[i]))) + { + throw new InvalidOperationException("Experimental predicates differ."); + } + } + } + + private static Point Utm(Random random) => + new Point(372000 + 200 * random.NextDouble(), 5710000 + 200 * random.NextDouble()); + + [Benchmark(OperationsPerInvoke = N, Baseline = true)] + public double OrientInterface() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(viaInterface.CounterClockwise(a[i], b[i], c[i])); + return s; + } + + [Benchmark(OperationsPerInvoke = N)] + public double OrientDirect() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(direct.CounterClockwise(a[i], b[i], c[i])); + return s; + } + + [Benchmark(OperationsPerInvoke = N)] + public double OrientExperimental() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(FastPredicates.CounterClockwise(a[i], b[i], c[i])); + return s; + } + + [Benchmark(OperationsPerInvoke = N)] + public double InCircleInterface() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(viaInterface.InCircle(a[i], b[i], c[i], d[i])); + return s; + } + + [Benchmark(OperationsPerInvoke = N)] + public double InCircleDirect() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(direct.InCircle(a[i], b[i], c[i], d[i])); + return s; + } + + [Benchmark(OperationsPerInvoke = N)] + public double InCircleExperimental() + { + double s = 0; + for (int i = 0; i < N; i++) s += Math.Sign(FastPredicates.InCircle(a[i], b[i], c[i], d[i])); + return s; + } + } + + /// + /// Experimental fast path of the predicates: same arithmetic and error bounds as + /// , the exact stages are those of the library. + /// + internal static class FastPredicates + { + private static readonly double Epsilon = ComputeEpsilon(); + private static readonly double CcwErrBoundA = (3.0 + 16.0 * Epsilon) * Epsilon; + private static readonly double IccErrBoundA = (10.0 + 96.0 * Epsilon) * Epsilon; + + private static double ComputeEpsilon() + { + double epsilon = 1.0, check = 1.0, lastcheck; + do + { + lastcheck = check; + epsilon *= 0.5; + check = 1.0 + epsilon; + } while ((check != 1.0) && (check != lastcheck)); + return epsilon; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static double CounterClockwise(Point pa, Point pb, Point pc) + { + double detleft = (pa.X - pc.X) * (pb.Y - pc.Y); + double detright = (pa.Y - pc.Y) * (pb.X - pc.X); + double det = detleft - detright; + double detsum; + + if (detleft > 0.0) + { + if (detright <= 0.0) return det; + detsum = detleft + detright; + } + else if (detleft < 0.0) + { + if (detright >= 0.0) return det; + detsum = -detleft - detright; + } + else + { + return det; + } + + double errbound = CcwErrBoundA * detsum; + if ((det >= errbound) || (-det >= errbound)) return det; + + return RobustPredicates.Default.CounterClockwise(pa, pb, pc); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static double InCircle(Point pa, Point pb, Point pc, Point pd) + { + double adx = pa.X - pd.X, bdx = pb.X - pd.X, cdx = pc.X - pd.X; + double ady = pa.Y - pd.Y, bdy = pb.Y - pd.Y, cdy = pc.Y - pd.Y; + + double bdxcdy = bdx * cdy, cdxbdy = cdx * bdy, alift = adx * adx + ady * ady; + double cdxady = cdx * ady, adxcdy = adx * cdy, blift = bdx * bdx + bdy * bdy; + double adxbdy = adx * bdy, bdxady = bdx * ady, clift = cdx * cdx + cdy * cdy; + + double det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); + + double permanent = (Math.Abs(bdxcdy) + Math.Abs(cdxbdy)) * alift + + (Math.Abs(cdxady) + Math.Abs(adxcdy)) * blift + + (Math.Abs(adxbdy) + Math.Abs(bdxady)) * clift; + double errbound = IccErrBoundA * permanent; + if ((det > errbound) || (-det > errbound)) return det; + + return RobustPredicates.Default.InCircle(pa, pb, pc, pd); + } + } +} From afd0debf51f10466d5184ae1e7be45e8e372b6d7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 09:21:25 +0000 Subject: [PATCH 42/50] Index-based triangle storage (stage 1) Triangle is now a handle (pool + index) to the data of the triangle in the arrays of the TrianglePool: vertices, neighbors (encoded index << 2 | orient), subsegments, ids, labels, area constraints, infection and search marks. The outer space triangle is position 0 of the pool. Otri, the mesh primitives and the algorithms are unchanged except for the few places that wrote neighbor references directly or compared triangles with null (now errors, CS8073). Public API: Triangle is a readonly struct implementing ITriangle; two handles are equal if they refer to the same triangle (ITriangle values from a mesh must be compared with Equals, not ==). TrianglePool keeps its API, so reusing a pool across meshes (Configuration) reuses the arrays. All tests pass, all golden fingerprints unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Characterization/InvariantTest.cs | 2 +- src/Triangle.Tests/Helper.cs | 13 +- src/Triangle.Tests/Review/ReviewATest.cs | 9 +- src/Triangle.Tests/Review/ReviewBTest.cs | 2 +- src/Triangle.Tests/Review/ReviewCTest.cs | 2 +- src/Triangle.Tests/Review/ReviewDTest.cs | 8 +- .../Robustness/SteinerReductionTest.cs | 4 +- .../Robustness/SteinerSmoothingTest.cs | 14 +- src/Triangle.Tests/Topology/OtriTest.cs | 41 ++-- src/Triangle.Tests/TrianglePoolTest.cs | 4 +- src/Triangle/Mesh.cs | 26 +-- src/Triangle/MeshValidator.cs | 2 +- src/Triangle/Meshing/Algorithm/Dwyer.cs | 2 +- src/Triangle/Meshing/Algorithm/Incremental.cs | 4 +- src/Triangle/Meshing/Algorithm/SweepLine.cs | 2 +- src/Triangle/Meshing/ConstraintMesher.cs | 4 +- .../Meshing/Iterators/VertexCirculator.cs | 2 +- src/Triangle/Meshing/QualityMesher.cs | 3 +- src/Triangle/Tools/QualityMeasure.cs | 2 +- src/Triangle/Tools/TriangleQuadTree.cs | 2 +- src/Triangle/Topology/Otri.cs | 121 ++++++----- src/Triangle/Topology/Triangle.cs | 159 +++++++++----- src/Triangle/Triangle.csproj | 2 + src/Triangle/TriangleLocator.cs | 4 +- src/Triangle/TrianglePool.cs | 201 ++++++++++-------- 25 files changed, 359 insertions(+), 276 deletions(-) diff --git a/src/Triangle.Tests/Characterization/InvariantTest.cs b/src/Triangle.Tests/Characterization/InvariantTest.cs index 3b7351d..9600877 100644 --- a/src/Triangle.Tests/Characterization/InvariantTest.cs +++ b/src/Triangle.Tests/Characterization/InvariantTest.cs @@ -30,7 +30,7 @@ public void Invariants(MeshCases.Case c) var plain = reference.Segments.Count == 0 ? (Mesh)new GenericMesher().Triangulate(reference.Points) : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); - double area = plain.Triangles.Sum(MeshInvariants.Area); + double area = plain.Triangles.Sum(t => MeshInvariants.Area(t)); var errors = MeshInvariants.Check(mesh, input, c, area); diff --git a/src/Triangle.Tests/Helper.cs b/src/Triangle.Tests/Helper.cs index 6433073..3c40a29 100644 --- a/src/Triangle.Tests/Helper.cs +++ b/src/Triangle.Tests/Helper.cs @@ -1,3 +1,4 @@ +using System;  namespace TriangleNet.Tests { @@ -51,9 +52,19 @@ public static Polygon SplitRectangle(double left, double top, return poly; } + [ThreadStatic] + private static TrianglePool pool; + + /// + /// The pool of the triangles created by (triangles are + /// indices into the arrays of a pool; neighbors must be in the same pool). + /// + public static TrianglePool Pool => pool ?? (pool = new TrianglePool()); + public static Triangle CreateTriangle(int id, Vertex org, Vertex dest, Vertex apex) { - var t = new Triangle() { id = id, hash = id }; + var t = Pool.Get(); + t.id = id; // Node ordering 'plus 1 mod 3'. t.vertices[0] = apex; diff --git a/src/Triangle.Tests/Review/ReviewATest.cs b/src/Triangle.Tests/Review/ReviewATest.cs index 4fa5558..f4c29d6 100644 --- a/src/Triangle.Tests/Review/ReviewATest.cs +++ b/src/Triangle.Tests/Review/ReviewATest.cs @@ -27,7 +27,7 @@ public void PoolContainsTriangleWithHashEqualToSize() for (int i = 0; i < 10; i++) pool.Get(); var other = new TrianglePool(); - Triangle foreign = null; + Triangle foreign = default; for (int i = 0; i < 11; i++) foreign = other.Get(); // hash == 10 Assert.That(foreign.hash, Is.EqualTo(pool.Capacity)); @@ -66,11 +66,8 @@ public void PoolClearReleasesAllTriangles() pool.Clear(); - var field = typeof(TrianglePool).GetField("pool", - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - var blocks = (Triangle[][])field.GetValue(pool); - - int remaining = blocks.Where(b => b != null).Sum(b => b.Count(t => t != null)); + // No references to vertices or subsegments of the old triangles remain. + int remaining = pool.vertices.Count(v => v != null) + pool.subsegs.Count(s => s.seg != null); Assert.That(pool.Count, Is.EqualTo(0)); Assert.That(remaining, Is.EqualTo(0), "Pool still references triangles after Clear()."); diff --git a/src/Triangle.Tests/Review/ReviewBTest.cs b/src/Triangle.Tests/Review/ReviewBTest.cs index a0aad69..b354d47 100644 --- a/src/Triangle.Tests/Review/ReviewBTest.cs +++ b/src/Triangle.Tests/Review/ReviewBTest.cs @@ -77,7 +77,7 @@ public void MaximumAngleAlone_IsEnforced([Values(false, true)] bool legacy) new QualityOptions { MaximumAngle = 100, UseLegacyRefinement = legacy }); MeshAssert.IsValid(mesh); - double max = mesh.Triangles.Max(MaximumAngle); + double max = mesh.Triangles.Max(t => MaximumAngle(t)); Assert.That(max, Is.LessThanOrEqualTo(100 + 1e-6)); } diff --git a/src/Triangle.Tests/Review/ReviewCTest.cs b/src/Triangle.Tests/Review/ReviewCTest.cs index 7fa7257..2c7de44 100644 --- a/src/Triangle.Tests/Review/ReviewCTest.cs +++ b/src/Triangle.Tests/Review/ReviewCTest.cs @@ -83,7 +83,7 @@ public void SnapToleranceCollapsingHoleKeepsDomain() var mesh = poly.Triangulate(new ConstraintOptions { SnapTolerance = 0.1 }); - Assert.That(mesh.Triangles.Sum(MeshAssert.Area), Is.GreaterThan(99.0)); + Assert.That(mesh.Triangles.Sum(t => MeshAssert.Area(t)), Is.GreaterThan(99.0)); } [Test] diff --git a/src/Triangle.Tests/Review/ReviewDTest.cs b/src/Triangle.Tests/Review/ReviewDTest.cs index 912c116..037b48b 100644 --- a/src/Triangle.Tests/Review/ReviewDTest.cs +++ b/src/Triangle.Tests/Review/ReviewDTest.cs @@ -519,7 +519,7 @@ public void TriangleNeighborAndSegmentAccessors() { Assert.That(t.GetNeighborID(i), Is.EqualTo(n.ID)); // Neighbor relation is symmetric. - Assert.That(Enumerable.Range(0, 3).Any(j => n.GetNeighbor(j) == t), Is.True); + Assert.That(Enumerable.Range(0, 3).Any(j => Equals(n.GetNeighbor(j), t)), Is.True); } var s = t.GetSegment(i); @@ -626,9 +626,9 @@ public void VertexCirculatorMatchesTopology([Values(false, true)] bool hole) // (except across the boundary gap). for (int i = 0; i + 1 < tris.Count; i++) { - Assert.That(tris[i].GetNeighbor(0) == tris[i + 1] || - tris[i].GetNeighbor(1) == tris[i + 1] || - tris[i].GetNeighbor(2) == tris[i + 1], Is.True, + Assert.That(Equals(tris[i].GetNeighbor(0), tris[i + 1]) || + Equals(tris[i].GetNeighbor(1), tris[i + 1]) || + Equals(tris[i].GetNeighbor(2), tris[i + 1]), Is.True, "consecutive triangles are not adjacent"); } } diff --git a/src/Triangle.Tests/Robustness/SteinerReductionTest.cs b/src/Triangle.Tests/Robustness/SteinerReductionTest.cs index 26e456e..6e60449 100644 --- a/src/Triangle.Tests/Robustness/SteinerReductionTest.cs +++ b/src/Triangle.Tests/Robustness/SteinerReductionTest.cs @@ -38,7 +38,7 @@ public void ReducedMeshKeepsAllInvariants(MeshCases.Case c) var plain = reference.Segments.Count == 0 ? (Mesh)new GenericMesher().Triangulate(reference.Points) : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); - double area = plain.Triangles.Sum(MeshInvariants.Area); + double area = plain.Triangles.Sum(t => MeshInvariants.Area(t)); var errors = MeshInvariants.Check(mesh, input, reduced, area); @@ -71,7 +71,7 @@ public void ReductionOnlyRemovesFreeSteinerPoints(MeshCases.Case c) if (c.MaxArea > 0) { - Assert.That(reduced.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(c.MaxArea)); + Assert.That(reduced.Triangles.Max(t => MeshInvariants.Area(t)), Is.LessThanOrEqualTo(c.MaxArea)); } } diff --git a/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs b/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs index d8f0b64..4712918 100644 --- a/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs +++ b/src/Triangle.Tests/Robustness/SteinerSmoothingTest.cs @@ -59,14 +59,14 @@ public void SmoothingOnlyMovesFreeSteinerPointsAndNeverMakesTheMeshWorse(MeshCas // and no more triangles violate the minimum angle. if (c.MinAngle > 0) { - Assert.That(smoothed.Triangles.Min(MeshInvariants.MinimumAngle), - Is.GreaterThanOrEqualTo(plain.Triangles.Min(MeshInvariants.MinimumAngle) - 1e-9)); + Assert.That(smoothed.Triangles.Min(t => MeshInvariants.MinimumAngle(t)), + Is.GreaterThanOrEqualTo(plain.Triangles.Min(t => MeshInvariants.MinimumAngle(t)) - 1e-9)); Assert.That(Bad(smoothed, c.MinAngle), Is.LessThanOrEqualTo(Bad(plain, c.MinAngle))); } if (c.MaxArea > 0) { - Assert.That(smoothed.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(c.MaxArea)); + Assert.That(smoothed.Triangles.Max(t => MeshInvariants.Area(t)), Is.LessThanOrEqualTo(c.MaxArea)); } } @@ -80,8 +80,8 @@ public void SmoothingImprovesTheAverageQuality(string name) var plain = c.Run(c.Input()); var smoothed = c.With("smooth", Smooth).Run(c.Input()); - double before = plain.Triangles.Average(MeshInvariants.MinimumAngle); - double after = smoothed.Triangles.Average(MeshInvariants.MinimumAngle); + double before = plain.Triangles.Average(t => MeshInvariants.MinimumAngle(t)); + double after = smoothed.Triangles.Average(t => MeshInvariants.MinimumAngle(t)); TestContext.WriteLine($"{name}: mean minimum angle {before:F2} -> {after:F2}, " + $"bad {Bad(plain, c.MinAngle)} -> {Bad(smoothed, c.MinAngle)}"); @@ -121,7 +121,7 @@ public void UserTestIsRespected() MeshAssert.IsValid(mesh); - Assert.That(mesh.Triangles.Max(MeshInvariants.Area), Is.LessThanOrEqualTo(0.5)); + Assert.That(mesh.Triangles.Max(t => MeshInvariants.Area(t)), Is.LessThanOrEqualTo(0.5)); } [Test] @@ -141,7 +141,7 @@ private static void AssertInvariants(MeshCases.Case configured, MeshCases.Case c var plain = reference.Segments.Count == 0 ? (Mesh)new GenericMesher().Triangulate(reference.Points) : (Mesh)reference.Triangulate(new ConstraintOptions { SnapTolerance = c.Snap }); - double area = plain.Triangles.Sum(MeshInvariants.Area); + double area = plain.Triangles.Sum(t => MeshInvariants.Area(t)); var errors = MeshInvariants.Check(mesh, input, configured, area); diff --git a/src/Triangle.Tests/Topology/OtriTest.cs b/src/Triangle.Tests/Topology/OtriTest.cs index f8a292b..083191c 100644 --- a/src/Triangle.Tests/Topology/OtriTest.cs +++ b/src/Triangle.Tests/Topology/OtriTest.cs @@ -34,7 +34,7 @@ private Triangle[] CreateExampleMesh() var triangles = new Triangle[4]; // Outer space triangle. - var dummy = new Triangle() { id = -1 }; + var dummy = Helper.Pool.Dummy; // Setup triangles. Keep in mind the ordering: // @@ -53,30 +53,24 @@ private Triangle[] CreateExampleMesh() var t3 = triangles[3] = Helper.CreateTriangle(3, vertices[3], vertices[4], vertices[5]); // Setup connectivity of triangle 0. - t0.neighbors[0].tri = dummy; - t0.neighbors[1].tri = t1; - t0.neighbors[1].orient = 2; - t0.neighbors[2].tri = dummy; + t0.SetNeighbor(0, new Otri { tri = dummy }); + t0.SetNeighbor(1, new Otri { tri = t1, orient = 2 }); + t0.SetNeighbor(2, new Otri { tri = dummy }); // Setup connectivity of triangle 1. - t1.neighbors[0].tri = t2; - t1.neighbors[0].orient = 2; - t1.neighbors[1].tri = t3; - t1.neighbors[1].orient = 0; - t1.neighbors[2].tri = t0; - t1.neighbors[2].orient = 1; + t1.SetNeighbor(0, new Otri { tri = t2, orient = 2 }); + t1.SetNeighbor(1, new Otri { tri = t3, orient = 0 }); + t1.SetNeighbor(2, new Otri { tri = t0, orient = 1 }); // Setup connectivity of triangle 2. - t2.neighbors[0].tri = dummy; - t2.neighbors[1].tri = dummy; - t2.neighbors[2].tri = t1; - t2.neighbors[2].orient = 0; + t2.SetNeighbor(0, new Otri { tri = dummy }); + t2.SetNeighbor(1, new Otri { tri = dummy }); + t2.SetNeighbor(2, new Otri { tri = t1, orient = 0 }); // Setup connectivity of triangle 3. - t3.neighbors[0].tri = t1; - t3.neighbors[0].orient = 1; - t3.neighbors[1].tri = dummy; - t3.neighbors[2].tri = dummy; + t3.SetNeighbor(0, new Otri { tri = t1, orient = 1 }); + t3.SetNeighbor(1, new Otri { tri = dummy }); + t3.SetNeighbor(2, new Otri { tri = dummy }); return triangles; } @@ -424,12 +418,11 @@ public void TestBond() Assert.That(t.Dest().ID, Is.EqualTo(1)); // Check that the triangles don't have neighbors. + // (A triangle without neighbor is adjacent to the outer space triangle.) s.Sym(ref tmp); - //Assert.AreEqual(-1, tmp.tri.ID); - Assert.That(tmp.tri, Is.Null); + Assert.That(tmp.tri.hash, Is.EqualTo(Mesh.DUMMY)); t.Sym(ref tmp); - //Assert.AreEqual(-1, tmp.tri.ID); - Assert.That(tmp.tri, Is.Null); + Assert.That(tmp.tri.hash, Is.EqualTo(Mesh.DUMMY)); // Bond the two triangles. s.Bond(ref t); @@ -445,7 +438,7 @@ public void TestBond() public void TestDissolve() { // Outer space triangle. - var dummy = new Triangle() { id = -1 }; + var dummy = Helper.Pool.Dummy; var triangles = CreateExampleMesh(); diff --git a/src/Triangle.Tests/TrianglePoolTest.cs b/src/Triangle.Tests/TrianglePoolTest.cs index 1fa7f61..bb1ecb3 100644 --- a/src/Triangle.Tests/TrianglePoolTest.cs +++ b/src/Triangle.Tests/TrianglePoolTest.cs @@ -23,12 +23,12 @@ public void TestGetRelease() pool.Release(t0); Assert.That(pool.Count, Is.EqualTo(2)); - Assert.That(t0.GetHashCode(), Is.LessThan(0)); + Assert.That(pool.Contains(t0), Is.False); pool.Release(t1); Assert.That(pool.Count, Is.EqualTo(1)); - Assert.That(t1.GetHashCode(), Is.LessThan(0)); + Assert.That(pool.Contains(t1), Is.False); var t4 = pool.Get(); diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 0834a45..0be723c 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -179,17 +179,9 @@ private void Initialize() dummysub.subsegs[0].seg = dummysub; dummysub.subsegs[1].seg = dummysub; - // Set up 'dummytri', the 'triangle' that occupies "outer space." - dummytri = new Triangle(); - dummytri.hash = dummytri.id = DUMMY; - - // Initialize the three adjoining triangles to be "outer space." These - // will eventually be changed by various bonding operations, but their - // values don't really matter, as long as they can legally be - // dereferenced. - dummytri.neighbors[0].tri = dummytri; - dummytri.neighbors[1].tri = dummytri; - dummytri.neighbors[2].tri = dummytri; + // Set up 'dummytri', the 'triangle' that occupies "outer space" (position 0 of the + // triangle pool, its id is DUMMY and its three adjoining triangles are "outer space"). + dummytri = triangles.Dummy; // Initialize the three adjoining subsegments of 'dummytri' to be // the omnipresent subsegment. @@ -205,6 +197,8 @@ private void Initialize() /// public Mesh(Configuration config, IList points) { + triangles = config.TrianglePool(); + Initialize(); behavior = new Behavior(); @@ -212,8 +206,6 @@ public Mesh(Configuration config, IList points) vertices = new Dictionary(points.Count); subsegs = new Dictionary(); - triangles = config.TrianglePool(); - flipstack = new Stack(); holes = new List(); @@ -542,9 +534,7 @@ internal void MakeTriangle(ref Otri newotri) tri.subsegs[1].seg = dummysub; tri.subsegs[2].seg = dummysub; - tri.neighbors[0].tri = dummytri; - tri.neighbors[1].tri = dummytri; - tri.neighbors[2].tri = dummytri; + // The adjoining triangles are "outer space" (see TrianglePool.Get). newotri.tri = tri; newotri.orient = 0; @@ -940,7 +930,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, // subsegment is found. success = InsertVertexResult.Successful; - if (newvertex.tri.tri != null) + if (!newvertex.tri.tri.IsNull) { // Store the coordinates of the triangle that contains newvertex. newvertex.tri.SetOrg(rightvertex); @@ -1727,7 +1717,7 @@ internal void UndoVertex() TriangleDealloc(botleft.tri); TriangleDealloc(botright.tri); } - else if (flipstack.Peek().tri == null) // Dummy flip + else if (flipstack.Peek().tri.IsNull) // Dummy flip { // Restore two triangles that were split into four triangles, // so they are again two triangles. diff --git a/src/Triangle/MeshValidator.cs b/src/Triangle/MeshValidator.cs index e2d9bcb..038c321 100644 --- a/src/Triangle/MeshValidator.cs +++ b/src/Triangle/MeshValidator.cs @@ -106,7 +106,7 @@ public static bool IsConsistent(Mesh mesh) mesh.MakeVertexMap(); foreach (var v in mesh.vertices.Values) { - if (v.tri.tri == null && Log.Verbose) + if (v.tri.tri.IsNull && Log.Verbose) { logger.Warning("Vertex (ID " + v.id + ") not connected to mesh (duplicate input vertex?)", "MeshValidator.IsConsistent()"); diff --git a/src/Triangle/Meshing/Algorithm/Dwyer.cs b/src/Triangle/Meshing/Algorithm/Dwyer.cs index 323ed08..525c2a2 100644 --- a/src/Triangle/Meshing/Algorithm/Dwyer.cs +++ b/src/Triangle/Meshing/Algorithm/Dwyer.cs @@ -659,7 +659,7 @@ int RemoveGhosts(ref Otri startghost) // Find an edge on the convex hull to start point location from. startghost.Lprev(ref searchedge); searchedge.Sym(); - mesh.dummytri.neighbors[0] = searchedge; + mesh.dummytri.SetNeighbor(0, searchedge); // Remove the bounding box and count the convex hull edges. startghost.Copy(ref dissolveedge); diff --git a/src/Triangle/Meshing/Algorithm/Incremental.cs b/src/Triangle/Meshing/Algorithm/Incremental.cs index 100bb9d..9e3b619 100644 --- a/src/Triangle/Meshing/Algorithm/Incremental.cs +++ b/src/Triangle/Meshing/Algorithm/Incremental.cs @@ -90,7 +90,7 @@ void GetBoundingBox() // Link dummytri to the bounding box so we can always find an // edge to begin searching (point location) from. - mesh.dummytri.neighbors[0] = inftri; + mesh.dummytri.SetNeighbor(0, inftri); } /// @@ -142,7 +142,7 @@ int RemoveBox() // Find a new boundary edge to search from, as the current search // edge lies on a bounding box triangle and will be deleted. - mesh.dummytri.neighbors[0] = searchedge; + mesh.dummytri.SetNeighbor(0, searchedge); hullsize = -2; while (!nextedge.Equals(finaledge)) diff --git a/src/Triangle/Meshing/Algorithm/SweepLine.cs b/src/Triangle/Meshing/Algorithm/SweepLine.cs index cdded65..79a5feb 100644 --- a/src/Triangle/Meshing/Algorithm/SweepLine.cs +++ b/src/Triangle/Meshing/Algorithm/SweepLine.cs @@ -763,7 +763,7 @@ int RemoveGhosts(ref Otri startghost) // Find an edge on the convex hull to start point location from. startghost.Lprev(ref searchedge); searchedge.Sym(); - dummytri.neighbors[0] = searchedge; + dummytri.SetNeighbor(0, searchedge); // Remove the bounding box and count the convex hull edges. startghost.Copy(ref dissolveedge); hullsize = 0; diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 198fe87..74e548a 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -1199,7 +1199,7 @@ private void InsertSegment(Vertex endpoint1, Vertex endpoint2, int newmark) // Find a triangle whose origin is the segment's first endpoint. searchtri1 = endpoint1.tri; - if (searchtri1.tri != null) + if (!searchtri1.tri.IsNull) { checkvertex = searchtri1.Org(); } @@ -1234,7 +1234,7 @@ private void InsertSegment(Vertex endpoint1, Vertex endpoint2, int newmark) // Find a triangle whose origin is the segment's second endpoint. checkvertex = null; searchtri2 = endpoint2.tri; - if (searchtri2.tri != null) + if (!searchtri2.tri.IsNull) { checkvertex = searchtri2.Org(); } diff --git a/src/Triangle/Meshing/Iterators/VertexCirculator.cs b/src/Triangle/Meshing/Iterators/VertexCirculator.cs index 44ce28d..24cb58c 100644 --- a/src/Triangle/Meshing/Iterators/VertexCirculator.cs +++ b/src/Triangle/Meshing/Iterators/VertexCirculator.cs @@ -54,7 +54,7 @@ private List BuildCache(Vertex vertex, bool vertices) // A new list for each call (enumerations may be nested). var cache = new List(); - if (vertex.tri.tri == null || vertex.type == VertexType.UndeadVertex) + if (vertex.tri.tri.IsNull || vertex.type == VertexType.UndeadVertex) { // Not part of the mesh topology (e.g. a duplicate input vertex). return cache; diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index 0886c2b..a1fd7e1 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -55,7 +55,8 @@ public QualityMesher(Mesh mesh, Configuration config) newLocation = new NewLocation(mesh, predicates); - newvertex_tri = new Triangle(); + // Holds the vertices of the triangle that contains a new vertex (not part of the mesh). + newvertex_tri = new TrianglePool(1).Get(); } /// diff --git a/src/Triangle/Tools/QualityMeasure.cs b/src/Triangle/Tools/QualityMeasure.cs index 0c89d60..0b247f9 100644 --- a/src/Triangle/Tools/QualityMeasure.cs +++ b/src/Triangle/Tools/QualityMeasure.cs @@ -194,7 +194,7 @@ public void Add(Measure measure) /// The mesh. public void Update(IMesh mesh) { - Update(mesh.Triangles); + Update(System.Linq.Enumerable.Cast(mesh.Triangles)); } /// diff --git a/src/Triangle/Tools/TriangleQuadTree.cs b/src/Triangle/Tools/TriangleQuadTree.cs index b191d21..7fea687 100644 --- a/src/Triangle/Tools/TriangleQuadTree.cs +++ b/src/Triangle/Tools/TriangleQuadTree.cs @@ -18,7 +18,7 @@ public class TriangleQuadTree { QuadNode root; - internal ITriangle[] triangles; + internal Topology.Triangle[] triangles; internal int sizeBound; internal int maxDepth; diff --git a/src/Triangle/Topology/Otri.cs b/src/Triangle/Topology/Otri.cs index 3ddd547..6e36757 100644 --- a/src/Triangle/Topology/Otri.cs +++ b/src/Triangle/Topology/Otri.cs @@ -37,7 +37,7 @@ public Triangle Triangle /// public override string ToString() { - if (tri == null) + if (tri.IsNull) { return "O-TID [null]"; } @@ -89,8 +89,9 @@ public override string ToString() /// public void Sym(ref Otri ot) { - ot.tri = tri.neighbors[orient].tri; - ot.orient = tri.neighbors[orient].orient; + int code = tri.pool.neighbors[3 * tri.index + orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; } /// @@ -98,9 +99,9 @@ public void Sym(ref Otri ot) /// public void Sym() { - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; } /// @@ -147,9 +148,9 @@ public void Onext(ref Otri ot) ot.orient = minus1Mod3[orient]; //ot.SymSelf(); - int tmp = ot.orient; - ot.orient = ot.tri.neighbors[tmp].orient; - ot.tri = ot.tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + ot.orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; } /// @@ -161,9 +162,9 @@ public void Onext() orient = minus1Mod3[orient]; //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; } /// @@ -172,8 +173,9 @@ public void Onext() public void Oprev(ref Otri ot) { //Sym(ref ot); - ot.tri = tri.neighbors[orient].tri; - ot.orient = tri.neighbors[orient].orient; + int code = tri.pool.neighbors[3 * tri.index + orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; //ot.LnextSelf(); ot.orient = plus1Mod3[ot.orient]; @@ -185,9 +187,9 @@ public void Oprev(ref Otri ot) public void Oprev() { //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; //LnextSelf(); orient = plus1Mod3[orient]; @@ -199,8 +201,9 @@ public void Oprev() public void Dnext(ref Otri ot) { //Sym(ref ot); - ot.tri = tri.neighbors[orient].tri; - ot.orient = tri.neighbors[orient].orient; + int code = tri.pool.neighbors[3 * tri.index + orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; //ot.LprevSelf(); ot.orient = minus1Mod3[ot.orient]; @@ -212,9 +215,9 @@ public void Dnext(ref Otri ot) public void Dnext() { //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; //LprevSelf(); orient = minus1Mod3[orient]; @@ -230,9 +233,9 @@ public void Dprev(ref Otri ot) ot.orient = plus1Mod3[orient]; //ot.SymSelf(); - int tmp = ot.orient; - ot.orient = ot.tri.neighbors[tmp].orient; - ot.tri = ot.tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + ot.orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; } /// @@ -244,9 +247,9 @@ public void Dprev() orient = plus1Mod3[orient]; //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; } /// @@ -255,16 +258,17 @@ public void Dprev() public void Rnext(ref Otri ot) { //Sym(ref ot); - ot.tri = tri.neighbors[orient].tri; - ot.orient = tri.neighbors[orient].orient; + int code = tri.pool.neighbors[3 * tri.index + orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; //ot.LnextSelf(); ot.orient = plus1Mod3[ot.orient]; //ot.SymSelf(); - int tmp = ot.orient; - ot.orient = ot.tri.neighbors[tmp].orient; - ot.tri = ot.tri.neighbors[tmp].tri; + code = tri.pool.neighbors[3 * ot.tri.index + ot.orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; } /// @@ -273,17 +277,17 @@ public void Rnext(ref Otri ot) public void Rnext() { //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; //LnextSelf(); orient = plus1Mod3[orient]; //SymSelf(); - tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; } /// @@ -292,16 +296,17 @@ public void Rnext() public void Rprev(ref Otri ot) { //Sym(ref ot); - ot.tri = tri.neighbors[orient].tri; - ot.orient = tri.neighbors[orient].orient; + int code = tri.pool.neighbors[3 * tri.index + orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; //ot.LprevSelf(); ot.orient = minus1Mod3[ot.orient]; //ot.SymSelf(); - int tmp = ot.orient; - ot.orient = ot.tri.neighbors[tmp].orient; - ot.tri = ot.tri.neighbors[tmp].tri; + code = tri.pool.neighbors[3 * ot.tri.index + ot.orient]; + ot.tri = new Triangle(tri.pool, code >> 2); + ot.orient = code & 3; } /// @@ -310,17 +315,17 @@ public void Rprev(ref Otri ot) public void Rprev() { //SymSelf(); - int tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + int code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; //LprevSelf(); orient = minus1Mod3[orient]; //SymSelf(); - tmp = orient; - orient = tri.neighbors[tmp].orient; - tri = tri.neighbors[tmp].tri; + code = tri.pool.neighbors[3 * tri.index + orient]; + tri = new Triangle(tri.pool, code >> 2); + orient = code & 3; } /// @@ -405,11 +410,10 @@ internal void SetApex(Vertex v) /// internal void Bond(ref Otri ot) { - tri.neighbors[orient].tri = ot.tri; - tri.neighbors[orient].orient = ot.orient; + var n = tri.pool.neighbors; + n[3 * tri.index + orient] = (ot.tri.index << 2) | ot.orient; - ot.tri.neighbors[ot.orient].tri = this.tri; - ot.tri.neighbors[ot.orient].orient = this.orient; + n[3 * ot.tri.index + ot.orient] = (tri.index << 2) | orient; } /// @@ -421,8 +425,7 @@ internal void Bond(ref Otri ot) /// internal void Dissolve(Triangle dummy) { - tri.neighbors[orient].tri = dummy; - tri.neighbors[orient].orient = 0; + tri.pool.neighbors[3 * tri.index + orient] = dummy.index << 2; } /// @@ -471,7 +474,7 @@ internal void SegDissolve(SubSegment dummy) /// internal static bool IsDead(Triangle tria) { - return tria.neighbors[0].tri == null; + return tria.pool.neighbors[3 * tria.index] == -1; } /// @@ -479,8 +482,8 @@ internal static bool IsDead(Triangle tria) /// internal static void Kill(Triangle tri) { - tri.neighbors[0].tri = null; - tri.neighbors[2].tri = null; + tri.pool.neighbors[3 * tri.index] = -1; + tri.pool.neighbors[3 * tri.index + 2] = -1; } #endregion diff --git a/src/Triangle/Topology/Triangle.cs b/src/Triangle/Topology/Triangle.cs index 204ad8b..b8dbb8b 100644 --- a/src/Triangle/Topology/Triangle.cs +++ b/src/Triangle/Topology/Triangle.cs @@ -12,95 +12,128 @@ namespace TriangleNet.Topology using TriangleNet.Geometry; /// - /// The triangle data structure. + /// A triangle of a mesh: a handle to the triangle's data in the . /// - public class Triangle : ITriangle + /// + /// The vertices, neighbors, subsegments and attributes of all triangles of a mesh are stored + /// in arrays of the pool (index-based storage, like delaunator or BurstTriangulator), not in + /// an object per triangle. This saves most of the garbage collection work for large meshes. + /// Two handles are equal, if they refer to the same triangle. + /// + public readonly struct Triangle : ITriangle, IEquatable { - // Hash for dictionary. Will be set by mesh instance. - internal int hash; + internal readonly TrianglePool pool; + + // Position in the arrays of the pool (0 is the "outer space" triangle of the mesh). + internal readonly int index; + + internal Triangle(TrianglePool pool, int index) + { + this.pool = pool; + this.index = index; + } + + // Hash for dictionary (the position in the pool, -1 for the outer space triangle). + internal int hash => index - 1; // The ID is only used for mesh output. - internal int id; - -#if FIELD_LAYOUT - // Fields with ref-returning indexers (one heap object per triangle, also on - // netstandard2.0, e.g. .NET Framework 4.8). Build with -p:TriangleLayout=Fields. - private Vertex vertex0, vertex1, vertex2; - private Otri neighbor0, neighbor1, neighbor2; - private Osub subseg0, subseg1, subseg2; - - internal VertexList vertices => new VertexList(this); - internal NeighborList neighbors => new NeighborList(this); - internal SubsegList subsegs => new SubsegList(this); -#elif NET8_0_OR_GREATER && !ARRAY_LAYOUT - // The vertices, adjoining triangles and subsegments are stored inline. With arrays, a - // triangle consists of four objects on the heap, which make up more than half of all - // allocations of a quality mesh and a large part of the garbage collection time. - internal Buffer3 vertices; - internal Buffer3 neighbors; - internal Buffer3 subsegs; -#else - internal Vertex[] vertices = new Vertex[3]; - internal Otri[] neighbors = new Otri[3]; - internal Osub[] subsegs = new Osub[3]; -#endif - internal int label; - internal double area; - internal bool infected; + internal int id + { + get => pool.ids[index]; + set => pool.ids[index] = value; + } + + internal int label + { + get => pool.labels[index]; + set => pool.labels[index] = value; + } + + internal double area + { + get => pool.areas[index]; + set => pool.areas[index] = value; + } + + internal bool infected + { + get => pool.infected[index]; + set => pool.infected[index] = value; + } // Marks the triangle as visited in a search (see Mesh.NextMark). - internal int mark; + internal int mark + { + get => pool.marks[index]; + set => pool.marks[index] = value; + } + + internal VertexList vertices => new VertexList(pool.vertices, 3 * index); + internal NeighborList neighbors => new NeighborList(pool, 3 * index); + internal SubsegList subsegs => new SubsegList(pool.subsegs, 3 * index); /// - /// Initializes a new instance of the class. + /// Set the neighbor opposite to the given corner. /// - public Triangle() + internal void SetNeighbor(int k, Otri ot) { - // The vertices, adjoining subsegments and triangles are null (default). + pool.neighbors[3 * index + k] = (ot.tri.index << 2) | ot.orient; } -#if FIELD_LAYOUT + /// + /// Gets a value indicating whether the handle refers to no triangle. + /// + internal bool IsNull => pool == null; + internal readonly struct VertexList { - private readonly Triangle o; + private readonly Vertex[] a; + private readonly int offset; - public VertexList(Triangle o) { this.o = o; } + public VertexList(Vertex[] a, int offset) { this.a = a; this.offset = offset; } - public ref Vertex this[int index] + public ref Vertex this[int k] { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => ref index == 0 ? ref o.vertex0 : ref index == 1 ? ref o.vertex1 : ref o.vertex2; + get => ref a[offset + k]; } } - internal readonly struct NeighborList + internal readonly struct SubsegList { - private readonly Triangle o; + private readonly Osub[] a; + private readonly int offset; - public NeighborList(Triangle o) { this.o = o; } + public SubsegList(Osub[] a, int offset) { this.a = a; this.offset = offset; } - public ref Otri this[int index] + public ref Osub this[int k] { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => ref index == 0 ? ref o.neighbor0 : ref index == 1 ? ref o.neighbor1 : ref o.neighbor2; + get => ref a[offset + k]; } } - internal readonly struct SubsegList + internal readonly struct NeighborList { - private readonly Triangle o; + private readonly TrianglePool pool; + private readonly int offset; - public SubsegList(Triangle o) { this.o = o; } + public NeighborList(TrianglePool pool, int offset) { this.pool = pool; this.offset = offset; } - public ref Osub this[int index] + public Otri this[int k] { [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => ref index == 0 ? ref o.subseg0 : ref index == 1 ? ref o.subseg1 : ref o.subseg2; + get + { + int code = pool.neighbors[offset + k]; + return new Otri { tri = new Triangle(pool, code >> 2), orient = code & 3 }; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + set => pool.neighbors[offset + k] = (value.tri.index << 2) | value.orient; } } -#endif - #region Public properties /// @@ -157,13 +190,15 @@ public int GetVertexID(int index) /// The neighbor opposite of vertex with given index. public ITriangle GetNeighbor(int index) { - return neighbors[index].tri.hash == Mesh.DUMMY ? null : neighbors[index].tri; + var neighbor = neighbors[index].tri; + return neighbor.hash == Mesh.DUMMY ? null : (ITriangle)neighbor; } /// public int GetNeighborID(int index) { - return neighbors[index].tri.hash == Mesh.DUMMY ? -1 : neighbors[index].tri.id; + var neighbor = neighbors[index].tri; + return neighbor.hash == Mesh.DUMMY ? -1 : neighbor.id; } /// @@ -178,12 +213,28 @@ public ISegment GetSegment(int index) #endregion + /// + public bool Equals(Triangle other) => index == other.index && pool == other.pool; + + /// + public override bool Equals(object obj) => obj is Triangle other && Equals(other); + /// public override int GetHashCode() { return hash; } + /// + /// Equality of handles (same triangle). + /// + public static bool operator ==(Triangle a, Triangle b) => a.Equals(b); + + /// + /// Inequality of handles. + /// + public static bool operator !=(Triangle a, Triangle b) => !a.Equals(b); + /// public override string ToString() { diff --git a/src/Triangle/Triangle.csproj b/src/Triangle/Triangle.csproj index 128f148..4ab717d 100644 --- a/src/Triangle/Triangle.csproj +++ b/src/Triangle/Triangle.csproj @@ -2,6 +2,8 @@ netstandard2.0;net8.0 + + $(WarningsAsErrors);CS8073;CS0472 TriangleNet Triangle AnyCPU;x64 diff --git a/src/Triangle/TriangleLocator.cs b/src/Triangle/TriangleLocator.cs index 05b2295..010f668 100644 --- a/src/Triangle/TriangleLocator.cs +++ b/src/Triangle/TriangleLocator.cs @@ -60,7 +60,7 @@ public void Update(ref Otri otri) internal void Reset() { sampler.Reset(); - recenttri.tri = null; // No triangle has been visited yet. + recenttri.tri = default; // No triangle has been visited yet. } /// @@ -287,7 +287,7 @@ public LocateResult Locate(Point searchpoint, ref Otri searchtri) // If a recently encountered triangle has been recorded and has not been // deallocated, test it as a good starting point. - if (recenttri.tri != null) + if (!recenttri.tri.IsNull) { if (!Otri.IsDead(recenttri.tri)) { diff --git a/src/Triangle/TrianglePool.cs b/src/Triangle/TrianglePool.cs index c06053e..a8b7548 100644 --- a/src/Triangle/TrianglePool.cs +++ b/src/Triangle/TrianglePool.cs @@ -8,27 +8,41 @@ namespace TriangleNet { using System; using System.Collections.Generic; + using TriangleNet.Geometry; using TriangleNet.Topology; /// /// Pool datastructure storing triangles of a . /// + /// + /// The data of all triangles is stored in arrays (three vertices, neighbors and subsegments + /// per triangle, and the attributes), a is an index into them. Position + /// 0 is the "outer space" triangle of the mesh. A pool can be reused for several meshes, one + /// after another (see ), which also reuses the arrays. + /// public class TrianglePool : ICollection { - // Determines the size of each block in the pool. - private const int BLOCKSIZE = 1024; - - // The total number of currently allocated triangles. + // The total number of currently allocated triangles (positions 1 to size). int size; // The number of triangles currently used. int count; - // The pool. - Triangle[][] pool; + // Per triangle (index), three entries per triangle (3 * index + orientation). + internal Vertex[] vertices; + internal int[] neighbors; // (index << 2) | orientation of the neighbor, -1: dead + internal Osub[] subsegs; + internal int[] ids; + internal int[] labels; + internal double[] areas; + internal bool[] infected; + internal int[] marks; + + // Whether the triangle at the position is used. + bool[] alive; // A stack of free triangles. - Stack stack; + Stack stack; /// /// Gets the total number of currently allocated triangles. @@ -38,19 +52,57 @@ public class TrianglePool : ICollection /// /// Initializes a new instance of the class. /// - public TrianglePool() + public TrianglePool() : this(1024) + { + } + + /// + /// Initializes a new instance of the class with the given + /// initial capacity (the arrays grow as needed). + /// + internal TrianglePool(int capacity) { size = 0; - // On startup, the pool should be able to hold 2^16 triangles. - int n = Math.Max(1, 65536 / BLOCKSIZE); + Allocate(Math.Max(1, capacity)); - pool = new Triangle[n][]; - pool[0] = new Triangle[BLOCKSIZE]; + stack = new Stack(1024); - stack = new Stack(BLOCKSIZE); + InitializeDummy(); } + private void Allocate(int capacity) + { + capacity += 1; // The outer space triangle. + + Array.Resize(ref vertices, 3 * capacity); + Array.Resize(ref neighbors, 3 * capacity); + Array.Resize(ref subsegs, 3 * capacity); + Array.Resize(ref ids, capacity); + Array.Resize(ref labels, capacity); + Array.Resize(ref areas, capacity); + Array.Resize(ref infected, capacity); + Array.Resize(ref marks, capacity); + Array.Resize(ref alive, capacity); + } + + private void InitializeDummy() + { + // The outer space triangle: all neighbors are the outer space triangle itself. + ids[0] = Mesh.DUMMY; + neighbors[0] = neighbors[1] = neighbors[2] = 0; + vertices[0] = vertices[1] = vertices[2] = null; + labels[0] = 0; + areas[0] = 0.0; + infected[0] = false; + marks[0] = 0; + } + + /// + /// Gets the outer space triangle ('dummytri') of the mesh using this pool. + /// + internal Triangle Dummy => new Triangle(this, 0); + // After the triangles have been renumbered (ids 0 to n-1), new triangles get the // following ids (their hash could collide with the new ids). -1: ids are hashes. private int nextId = -1; @@ -63,9 +115,9 @@ internal void SetNextId(int id) nextId = id; } - private int NextId(Triangle triangle) + private int NextId(int index) { - return nextId < 0 ? triangle.hash : nextId++; + return nextId < 0 ? index - 1 : nextId++; } /// @@ -74,52 +126,43 @@ private int NextId(Triangle triangle) /// public Triangle Get() { - Triangle triangle; + int index; if (stack.Count > 0) { - triangle = stack.Pop(); - triangle.hash = -triangle.hash - 1; + index = stack.Pop(); + alive[index] = true; - triangle.id = NextId(triangle); + ids[index] = NextId(index); - Cleanup(triangle); + Cleanup(index); } else if (count < size) { - triangle = pool[count / BLOCKSIZE][count % BLOCKSIZE]; - triangle.id = NextId(triangle); + index = count + 1; + ids[index] = NextId(index); - Cleanup(triangle); + Cleanup(index); count++; } else { - triangle = new Triangle(); - triangle.hash = size; - triangle.id = NextId(triangle); - - int block = size / BLOCKSIZE; - - if (pool[block] == null) + if (size + 2 > ids.Length) { - pool[block] = new Triangle[BLOCKSIZE]; - - // Check if the pool has to be resized. - if (block + 1 == pool.Length) - { - Array.Resize(ref pool, 2 * pool.Length); - } + Allocate(2 * (ids.Length - 1)); } - // Add triangle to pool. - pool[block][size % BLOCKSIZE] = triangle; + index = size + 1; + alive[index] = true; + ids[index] = NextId(index); + + Cleanup(index); count = ++size; } - return triangle; + return new Triangle(this, index); } /// @@ -127,10 +170,10 @@ public Triangle Get() /// public void Release(Triangle triangle) { - stack.Push(triangle); + stack.Push(triangle.index); // Mark the triangle as free (used by enumerator). - triangle.hash = -triangle.hash - 1; + alive[triangle.index] = false; } /// @@ -138,16 +181,17 @@ public void Release(Triangle triangle) /// public TrianglePool Restart() { - foreach (var triangle in stack) + foreach (var index in stack) { - // Reset hash to original value. - triangle.hash = -triangle.hash - 1; + alive[index] = true; } stack.Clear(); count = 0; + InitializeDummy(); + return this; } @@ -167,8 +211,6 @@ internal IEnumerable Sample(int k, Random random) k = alive; } - Triangle t; - // TODO: improve sampling code (to ensure no duplicates). // Live triangles are spread over all used slots [0, count), not only the first @@ -179,30 +221,26 @@ internal IEnumerable Sample(int k, Random random) { i = random.Next(0, count); - t = pool[i / BLOCKSIZE][i % BLOCKSIZE]; - - if (t.hash >= 0) + if (this.alive[i + 1]) { k--; - yield return t; + yield return new Triangle(this, i + 1); } } } - private void Cleanup(Triangle triangle) + private void Cleanup(int index) { - triangle.label = 0; - triangle.area = 0.0; - triangle.infected = false; - triangle.mark = 0; + labels[index] = 0; + areas[index] = 0.0; + infected[index] = false; + marks[index] = 0; - for (int i = 0; i < 3; i++) - { - triangle.vertices[i] = null; + int i = 3 * index; - triangle.subsegs[i] = default(Osub); - triangle.neighbors[i] = default(Otri); - } + vertices[i] = vertices[i + 1] = vertices[i + 2] = null; + subsegs[i] = subsegs[i + 1] = subsegs[i + 2] = default(Osub); + neighbors[i] = neighbors[i + 1] = neighbors[i + 2] = 0; } /// @@ -220,28 +258,24 @@ public void Clear() { stack.Clear(); - int blocks = (size / BLOCKSIZE) + 1; - - for (int i = 0; i < blocks; i++) - { - var block = pool[i]; - - // Number of triangles in current block: - int length = Math.Min(BLOCKSIZE, size - i * BLOCKSIZE); - - for (int j = 0; j < length; j++) - { - block[j] = null; - } - } + Array.Clear(alive, 0, alive.Length); + Array.Clear(vertices, 0, vertices.Length); + Array.Clear(subsegs, 0, subsegs.Length); size = count = 0; nextId = -1; + + InitializeDummy(); } /// public bool Contains(Triangle item) { + if (item.pool != this) + { + return false; + } + int i = item.hash; if (i < 0 || i >= size) @@ -249,7 +283,7 @@ public bool Contains(Triangle item) return false; } - return pool[i / BLOCKSIZE][i % BLOCKSIZE].hash >= 0; + return alive[item.index]; } /// @@ -291,9 +325,9 @@ class Enumerator : IEnumerator { // TODO: enumerator should be able to tell if collection changed. - int count; + readonly int count; - Triangle[][] pool; + readonly TrianglePool pool; Triangle current; @@ -302,7 +336,7 @@ class Enumerator : IEnumerator public Enumerator(TrianglePool pool) { this.count = pool.Count; - this.pool = pool.pool; + this.pool = pool; index = 0; offset = 0; @@ -324,14 +358,15 @@ object System.Collections.IEnumerator.Current public bool MoveNext() { + var alive = pool.alive; + while (index < count) { - current = pool[offset / BLOCKSIZE][offset % BLOCKSIZE]; - offset++; - if (current.hash >= 0) + if (alive[offset]) { + current = new Triangle(pool, offset); index++; return true; } From e13e48a6547a763d019ea2a54d7dd205fd2ee8fc Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 10:07:12 +0000 Subject: [PATCH 43/50] Index storage: flat Otri (pool, index, orient), index checks for the outer space triangle, pre-sized pool Otri stores the pool and index directly (16 instead of 24 bytes); the 73 checks against the outer space triangle compare the index with 0 instead of reading the id from the pool; the pool is sized for 2n triangles of n input points. All tests pass, golden fingerprints unchanged. BenchmarkDotNet against the object layouts (net10): large Herne tiles equal (snap) or 9% faster (grid) than InlineArray and 10-13% faster than the array layout of net48; small meshes 10-16% slower than InlineArray. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle/IO/TriangleWriter.cs | 4 +- src/Triangle/Mesh.cs | 39 +++--- src/Triangle/MeshValidator.cs | 4 +- src/Triangle/Meshing/Algorithm/Dwyer.cs | 2 +- src/Triangle/Meshing/Algorithm/Incremental.cs | 6 +- src/Triangle/Meshing/Algorithm/SweepLine.cs | 4 +- src/Triangle/Meshing/ConstraintMesher.cs | 24 ++-- src/Triangle/Meshing/Converter.cs | 16 +-- .../Meshing/Iterators/RegionIterator.cs | 2 +- .../Meshing/Iterators/VertexCirculator.cs | 6 +- src/Triangle/Meshing/QualityMesher.cs | 16 +-- src/Triangle/Meshing/SteinerReducer.cs | 4 +- src/Triangle/Meshing/SteinerSmoother.cs | 4 +- src/Triangle/NewLocation.cs | 2 +- src/Triangle/Tools/TerrainSimplifier.cs | 22 +-- src/Triangle/Topology/Otri.cs | 129 ++++++++++-------- src/Triangle/Topology/SubSegment.cs | 2 +- src/Triangle/TriangleLocator.cs | 2 +- src/Triangle/TrianglePool.cs | 11 ++ .../Voronoi/Legacy/BoundedVoronoiLegacy.cs | 16 +-- src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs | 8 +- src/Triangle/Voronoi/VoronoiBase.cs | 2 +- 22 files changed, 174 insertions(+), 151 deletions(-) diff --git a/src/Triangle/IO/TriangleWriter.cs b/src/Triangle/IO/TriangleWriter.cs index 84e4c0a..8f9d5dd 100644 --- a/src/Triangle/IO/TriangleWriter.cs +++ b/src/Triangle/IO/TriangleWriter.cs @@ -418,7 +418,7 @@ public void WriteEdges(Mesh mesh, string filename) for (tri.orient = 0; tri.orient < 3; tri.orient++) { tri.Sym(ref trisym); - if ((tri.tri.id < trisym.tri.id) || (trisym.tri.id == Mesh.DUMMY)) + if ((tri.tri.id < trisym.tri.id) || (trisym.index == 0)) { var p1 = tri.Org(); var p2 = tri.Dest(); @@ -444,7 +444,7 @@ public void WriteEdges(Mesh mesh, string filename) else { writer.WriteLine("{0} {1} {2} {3}", index, p1.id, p2.id, - trisym.tri.id == Mesh.DUMMY ? "1" : "0"); + trisym.index == 0 ? "1" : "0"); } } else diff --git a/src/Triangle/Mesh.cs b/src/Triangle/Mesh.cs index 0be723c..a5ec1b3 100644 --- a/src/Triangle/Mesh.cs +++ b/src/Triangle/Mesh.cs @@ -199,6 +199,9 @@ public Mesh(Configuration config, IList points) { triangles = config.TrianglePool(); + // A triangulation of n points has less than 2n triangles (refinement adds more). + triangles.EnsureCapacity(2 * points.Count + 16); + Initialize(); behavior = new Behavior(); @@ -650,7 +653,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, { // Find the location of the vertex to be inserted. Check if a good // starting triangle has already been provided by the caller. - if (searchtri.tri.id == DUMMY) + if (searchtri.index == 0) { // Find a boundary triangle. horiz.tri = dummytri; @@ -701,7 +704,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, // This subsegment may be split only if it is an // internal boundary. horiz.Sym(ref testtri); - enq = testtri.tri.id != DUMMY; + enq = testtri.index != 0; } if (enq && (qualityMesher != null)) { @@ -732,7 +735,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, botright.Sym(ref botrcasing); horiz.Sym(ref topright); // Is there a second triangle? (Or does this edge lie on a boundary?) - mirrorflag = topright.tri.id != DUMMY; + mirrorflag = topright.index != 0; if (mirrorflag) { topright.Lnext(); @@ -756,12 +759,12 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, horiz.SetOrg(newvertex); // Set the region of a new triangle. - newbotright.tri.label = botright.tri.label; + newbotright.pool.labels[newbotright.index] = botright.tri.label; if (behavior.VarArea) { // Set the area constraint of a new triangle. - newbotright.tri.area = botright.tri.area; + newbotright.pool.areas[newbotright.index] = botright.tri.area; } if (mirrorflag) @@ -773,12 +776,12 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, topright.SetOrg(newvertex); // Set the region of another new triangle. - newtopright.tri.label = topright.tri.label; + newtopright.pool.labels[newtopright.index] = topright.tri.label; if (behavior.VarArea) { // Set the area constraint of another new triangle. - newtopright.tri.area = topright.tri.area; + newtopright.pool.areas[newtopright.index] = topright.tri.area; } } @@ -879,15 +882,15 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, horiz.SetApex(newvertex); // Set the region of the new triangles. - newbotleft.tri.label = horiz.tri.label; - newbotright.tri.label = horiz.tri.label; + newbotleft.pool.labels[newbotleft.index] = horiz.tri.label; + newbotright.pool.labels[newbotright.index] = horiz.tri.label; if (behavior.VarArea) { // Set the area constraint of the new triangles. area = horiz.tri.area; - newbotleft.tri.area = area; - newbotright.tri.area = area; + newbotleft.pool.areas[newbotleft.index] = area; + newbotright.pool.areas[newbotright.index] = area; } // There may be subsegments that need to be bonded @@ -974,7 +977,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, { // Check if the edge is a boundary edge. horiz.Sym(ref top); - if (top.tri.id == DUMMY) + if (top.index == 0) { // The edge is a boundary edge and cannot be flipped. doflip = false; @@ -1089,8 +1092,8 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, // Assign region. // TODO: check region ok (no Math.Min necessary) region = Math.Min(top.tri.label, horiz.tri.label); - top.tri.label = region; - horiz.tri.label = region; + top.pool.labels[top.index] = region; + horiz.pool.labels[horiz.index] = region; if (behavior.VarArea) { @@ -1106,8 +1109,8 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, area = 0.5 * (top.tri.area + horiz.tri.area); } - top.tri.area = area; - horiz.tri.area = area; + top.pool.areas[top.index] = area; + horiz.pool.areas[horiz.index] = area; } if (checkquality) @@ -1137,7 +1140,7 @@ internal InsertVertexResult InsertVertex(Vertex newvertex, ref Otri searchtri, // Check for finishing a complete revolution about the new vertex, or // falling outside of the triangulation. The latter will happen when // a vertex is inserted at a boundary. - if ((leftvertex == first) || (testtri.tri.id == DUMMY)) + if ((leftvertex == first) || (testtri.index == 0)) { // We're done. Return a triangle whose origin is the new vertex. horiz.Lnext(ref searchtri); @@ -1736,7 +1739,7 @@ internal void UndoVertex() TriangleDealloc(botright.tri); fliptri.Sym(ref gluetri); - if (gluetri.tri.id != DUMMY) + if (gluetri.index != 0) { gluetri.Lnext(); gluetri.Dnext(ref topright); diff --git a/src/Triangle/MeshValidator.cs b/src/Triangle/MeshValidator.cs index 038c321..69a9a9e 100644 --- a/src/Triangle/MeshValidator.cs +++ b/src/Triangle/MeshValidator.cs @@ -70,7 +70,7 @@ public static bool IsConsistent(Mesh mesh) // Find the neighboring triangle on this edge. tri.Sym(ref oppotri); - if (oppotri.tri.id != Mesh.DUMMY) + if (oppotri.index != 0) { // Check that the triangle's neighbor knows it's a neighbor. oppotri.Sym(ref oppooppotri); @@ -183,7 +183,7 @@ private static bool IsDelaunay(Mesh mesh, bool constrained) // adjoining triangle whose pointer is larger (to ensure that // each pair isn't tested twice). shouldbedelaunay = (loop.tri.id < oppotri.tri.id) && - !Otri.IsDead(oppotri.tri) && (oppotri.tri.id != Mesh.DUMMY) && + !Otri.IsDead(oppotri.tri) && (oppotri.index != 0) && (org != inf1) && (org != inf2) && (org != inf3) && (dest != inf1) && (dest != inf2) && (dest != inf3) && (apex != inf1) && (apex != inf2) && (apex != inf3) && diff --git a/src/Triangle/Meshing/Algorithm/Dwyer.cs b/src/Triangle/Meshing/Algorithm/Dwyer.cs index 525c2a2..b686657 100644 --- a/src/Triangle/Meshing/Algorithm/Dwyer.cs +++ b/src/Triangle/Meshing/Algorithm/Dwyer.cs @@ -676,7 +676,7 @@ int RemoveGhosts(ref Otri startghost) if (noPoly) { // Watch out for the case where all the input vertices are collinear. - if (dissolveedge.tri.id != Mesh.DUMMY) + if (dissolveedge.index != 0) { markorg = dissolveedge.Org(); if (markorg.label == 0) diff --git a/src/Triangle/Meshing/Algorithm/Incremental.cs b/src/Triangle/Meshing/Algorithm/Incremental.cs index 9e3b619..d751dbb 100644 --- a/src/Triangle/Meshing/Algorithm/Incremental.cs +++ b/src/Triangle/Meshing/Algorithm/Incremental.cs @@ -131,7 +131,7 @@ int RemoveBox() // adjacent to the first one. nextedge.Lnext(ref checkedge); checkedge.Sym(); - if (checkedge.tri.id == Mesh.DUMMY) + if (checkedge.index == 0) { // Go on to the next triangle. There are only three boundary // triangles, and this next triangle cannot be the third one, @@ -158,7 +158,7 @@ int RemoveBox() // vertices are collinear, and thus all the triangles are part of // the bounding box. Otherwise, the setvertexmark() call below // will cause a bad pointer reference. - if (dissolveedge.tri.id != Mesh.DUMMY) + if (dissolveedge.index != 0) { markorg = dissolveedge.Org(); if (markorg.label == 0) @@ -174,7 +174,7 @@ int RemoveBox() // Get rid of the bounding box triangle. mesh.TriangleDealloc(deadtriangle.tri); // Do we need to turn the corner? - if (nextedge.tri.id == Mesh.DUMMY) + if (nextedge.index == 0) { // Turn the corner. dissolveedge.Copy(ref nextedge); diff --git a/src/Triangle/Meshing/Algorithm/SweepLine.cs b/src/Triangle/Meshing/Algorithm/SweepLine.cs index 79a5feb..4394f96 100644 --- a/src/Triangle/Meshing/Algorithm/SweepLine.cs +++ b/src/Triangle/Meshing/Algorithm/SweepLine.cs @@ -296,7 +296,7 @@ private void RestoreDelaunay() tri.Sym(ref oppo); // Test each edge only once. - if (oppo.tri.id == Mesh.DUMMY || tri.tri.id > oppo.tri.id) + if (oppo.index == 0 || tri.tri.id > oppo.tri.id) { continue; } @@ -779,7 +779,7 @@ int RemoveGhosts(ref Otri startghost) if (noPoly) { // Watch out for the case where all the input vertices are collinear. - if (dissolveedge.tri.id != Mesh.DUMMY) + if (dissolveedge.index != 0) { markorg = dissolveedge.Org(); if (markorg.label == 0) diff --git a/src/Triangle/Meshing/ConstraintMesher.cs b/src/Triangle/Meshing/ConstraintMesher.cs index 74e548a..4c08d7f 100644 --- a/src/Triangle/Meshing/ConstraintMesher.cs +++ b/src/Triangle/Meshing/ConstraintMesher.cs @@ -386,7 +386,7 @@ private void InfectHull() // To find the next hull edge, go clockwise around the next vertex. hulltri.Lnext(); hulltri.Oprev(ref nexttri); - while (nexttri.tri.id != Mesh.DUMMY) + while (nexttri.index != 0) { nexttri.Copy(ref hulltri); hulltri.Oprev(ref nexttri); @@ -445,7 +445,7 @@ void Plague() // Check for a subsegment between the triangle and its neighbor. testtri.Pivot(ref neighborsubseg); // Check if the neighbor is nonexistent or already infected. - if ((neighbor.tri.id == Mesh.DUMMY) || neighbor.IsInfected()) + if ((neighbor.index == 0) || neighbor.IsInfected()) { if (neighborsubseg.seg.hash != Mesh.DUMMY) { @@ -453,7 +453,7 @@ void Plague() // neighbor, but both triangles are dying, so the subsegment // dies too. mesh.SubsegDealloc(neighborsubseg.seg); - if (neighbor.tri.id != Mesh.DUMMY) + if (neighbor.index != 0) { // Make sure the subsegment doesn't get deallocated again // later when the infected neighbor is visited. @@ -520,7 +520,7 @@ void Plague() // Walk counterclockwise about the vertex. testtri.Onext(ref neighbor); // Stop upon reaching a boundary or the starting triangle. - while ((neighbor.tri.id != Mesh.DUMMY) && + while ((neighbor.index != 0) && (!neighbor.Equals(testtri))) { if (neighbor.IsInfected()) @@ -537,12 +537,12 @@ void Plague() neighbor.Onext(); } // If we reached a boundary, we must walk clockwise as well. - if (neighbor.tri.id == Mesh.DUMMY) + if (neighbor.index == 0) { // Walk clockwise about the vertex. testtri.Oprev(ref neighbor); // Stop upon reaching a boundary. - while (neighbor.tri.id != Mesh.DUMMY) + while (neighbor.index != 0) { if (neighbor.IsInfected()) { @@ -572,7 +572,7 @@ void Plague() for (testtri.orient = 0; testtri.orient < 3; testtri.orient++) { testtri.Sym(ref neighbor); - if (neighbor.tri.id == Mesh.DUMMY) + if (neighbor.index == 0) { // There is no neighboring triangle on this edge, so this edge // is a boundary edge. This triangle is being deleted, so this @@ -638,7 +638,7 @@ private FindDirectionResult FindDirection(ref Otri searchtri, Vertex searchpoint // 'searchtri' faces directly away from 'searchpoint'. We could go left // or right. Ask whether it's a triangle or a boundary on the left. searchtri.Onext(ref checktri); - if (checktri.tri.id == Mesh.DUMMY) + if (checktri.index == 0) { leftflag = false; } @@ -651,7 +651,7 @@ private FindDirectionResult FindDirection(ref Otri searchtri, Vertex searchpoint { // Turn left until satisfied. searchtri.Onext(); - if (searchtri.tri.id == Mesh.DUMMY) + if (searchtri.index == 0) { logger.Error("Unable to find a triangle on path.", "Mesh.FindDirection().1"); throw new Exception("Unable to find a triangle on path."); @@ -665,7 +665,7 @@ private FindDirectionResult FindDirection(ref Otri searchtri, Vertex searchpoint { // Turn right until satisfied. searchtri.Oprev(); - if (searchtri.tri.id == Mesh.DUMMY) + if (searchtri.index == 0) { logger.Error("Unable to find a triangle on path.", "Mesh.FindDirection().2"); throw new Exception("Unable to find a triangle on path."); @@ -952,7 +952,7 @@ private void DelaunayFixup(ref Otri fixuptri, bool leftside) fixuptri.Lnext(ref neartri); neartri.Sym(ref fartri); // Check if the edge opposite the origin of fixuptri can be flipped. - if (fartri.tri.id == Mesh.DUMMY) + if (fartri.index == 0) { return; } @@ -1291,7 +1291,7 @@ internal void MarkHull() // To find the next hull edge, go clockwise around the next vertex. hulltri.Lnext(); hulltri.Oprev(ref nexttri); - while (nexttri.tri.id != Mesh.DUMMY) + while (nexttri.index != 0) { nexttri.Copy(ref hulltri); hulltri.Oprev(ref nexttri); diff --git a/src/Triangle/Meshing/Converter.cs b/src/Triangle/Meshing/Converter.cs index d4be96d..1c9f277 100644 --- a/src/Triangle/Meshing/Converter.cs +++ b/src/Triangle/Meshing/Converter.cs @@ -146,12 +146,12 @@ private List[] SetNeighbors(Mesh mesh, ITriangle[] triangles) } // Read the triangle's attributes. - tri.tri.label = triangles[i].Label; + tri.pool.labels[tri.index] = triangles[i].Label; // TODO: VarArea if (mesh.behavior.VarArea) { - tri.tri.area = triangles[i].Area; + tri.pool.areas[tri.index] = triangles[i].Area; } // Set the triangle's vertices. @@ -176,7 +176,7 @@ private List[] SetNeighbors(Mesh mesh, ITriangle[] triangles) checktri = nexttri; - if (checktri.tri.id != Mesh.DUMMY) + if (checktri.index != 0) { tdest = tri.Dest(); tapex = tri.Apex(); @@ -204,7 +204,7 @@ private List[] SetNeighbors(Mesh mesh, ITriangle[] triangles) nexttri = vertexarray[aroundvertex][index]; checktri = nexttri; - } while (checktri.tri.id != Mesh.DUMMY); + } while (checktri.index != 0); } } @@ -287,7 +287,7 @@ private void SetSegments(Mesh mesh, Polygon polygon, List[] vertexarray) // occurrence of a triangle on a list can (and does) represent // an edge. In this way, most edges are represented twice, and // every triangle-subsegment bond is represented once. - while (notfound && (checktri.tri.id != Mesh.DUMMY)) + while (notfound && (checktri.index != 0)) { checkdest = checktri.Dest(); @@ -300,7 +300,7 @@ private void SetSegments(Mesh mesh, Polygon polygon, List[] vertexarray) checktri.SegBond(ref subseg); // Check if this is a boundary edge. checktri.Sym(ref checkneighbor); - if (checkneighbor.tri.id == Mesh.DUMMY) + if (checkneighbor.index == 0) { // The next line doesn't insert a subsegment (because there's // already one there), but it sets the boundary markers of @@ -332,7 +332,7 @@ private void SetSegments(Mesh mesh, Polygon polygon, List[] vertexarray) nexttri = vertexarray[i][index]; checktri = nexttri; - while (checktri.tri.id != Mesh.DUMMY) + while (checktri.index != 0) { // Find the next triangle in the stack before this // information gets overwritten. @@ -341,7 +341,7 @@ private void SetSegments(Mesh mesh, Polygon polygon, List[] vertexarray) // No adjacent subsegment. (This overwrites the stack info.) checktri.SegDissolve(mesh.dummysub); checktri.Sym(ref checkneighbor); - if (checkneighbor.tri.id == Mesh.DUMMY) + if (checkneighbor.index == 0) { mesh.InsertSubseg(ref checktri, 1); hullsize++; diff --git a/src/Triangle/Meshing/Iterators/RegionIterator.cs b/src/Triangle/Meshing/Iterators/RegionIterator.cs index 1d784d3..57ab1dd 100644 --- a/src/Triangle/Meshing/Iterators/RegionIterator.cs +++ b/src/Triangle/Meshing/Iterators/RegionIterator.cs @@ -114,7 +114,7 @@ void ProcessRegion(Action action, Func protector) testtri.Pivot(ref neighborsubseg); // Make sure the neighbor exists, is not already infected, and // isn't protected by a subsegment. - if ((neighbor.tri.id != Mesh.DUMMY) && !neighbor.IsInfected() + if ((neighbor.index != 0) && !neighbor.IsInfected() && protector(neighborsubseg.seg)) { // Infect the neighbor. diff --git a/src/Triangle/Meshing/Iterators/VertexCirculator.cs b/src/Triangle/Meshing/Iterators/VertexCirculator.cs index 24cb58c..3497e79 100644 --- a/src/Triangle/Meshing/Iterators/VertexCirculator.cs +++ b/src/Triangle/Meshing/Iterators/VertexCirculator.cs @@ -67,7 +67,7 @@ private List BuildCache(Vertex vertex, bool vertices) init.Copy(ref next); // Move counter-clockwise around the vertex. - while (next.tri.id != Mesh.DUMMY) + while (next.index != 0) { cache.Add(next); @@ -80,7 +80,7 @@ private List BuildCache(Vertex vertex, bool vertices) } } - if (next.tri.id == Mesh.DUMMY) + if (next.index == 0) { // We reached the boundary. To get all adjacent triangles, start // again at init triangle and now move clockwise. @@ -95,7 +95,7 @@ private List BuildCache(Vertex vertex, bool vertices) next.Oprev(); - while (next.tri.id != Mesh.DUMMY) + while (next.index != 0) { cache.Insert(0, next); diff --git a/src/Triangle/Meshing/QualityMesher.cs b/src/Triangle/Meshing/QualityMesher.cs index a1fd7e1..c51ebba 100644 --- a/src/Triangle/Meshing/QualityMesher.cs +++ b/src/Triangle/Meshing/QualityMesher.cs @@ -166,7 +166,7 @@ private int CheckSeg4Encroach(ref Osub testsubseg, Vertex apex1, bool enqueue = // Check one neighbor of the subsegment. testsubseg.Pivot(ref neighbortri); // Does the neighbor exist, or is this a boundary edge? - if (neighbortri.tri.id != Mesh.DUMMY) + if (neighbortri.index != 0) { sides++; // Find a vertex opposite this subsegment. @@ -196,7 +196,7 @@ private int CheckSeg4Encroach(ref Osub testsubseg, Vertex apex1, bool enqueue = testsubseg.Sym(ref testsym); testsym.Pivot(ref neighbortri); // Does the neighbor exist, or is this a boundary edge? - if (neighbortri.tri.id != Mesh.DUMMY) + if (neighbortri.index != 0) { sides++; // Find the other vertex opposite this subsegment. @@ -573,7 +573,7 @@ private void SplitEncSegs(bool triflaws) // Now, check the other side of the segment, if there's a triangle there. enctri.Sym(ref testtri); - if (testtri.tri.id != Mesh.DUMMY) + if (testtri.index != 0) { // Is the destination shared with another segment? testtri.Lnext(); @@ -1120,7 +1120,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) Otri tri = default(Otri), neighbor = default(Otri); Osub sub = default(Osub); - horiz.tri.mark = stamp; + horiz.pool.marks[horiz.index] = stamp; cavityStack.Push(horiz); while (cavityStack.Count > 0) @@ -1135,7 +1135,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) { tri.Sym(ref neighbor); - if (neighbor.tri.id != Mesh.DUMMY) + if (neighbor.index != 0) { if (neighbor.tri.mark == stamp) { @@ -1145,7 +1145,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) // Same test (and argument order) as in Mesh.InsertVertex. if (predicates.InCircle(tri.Dest(), v, tri.Org(), neighbor.Apex()) > 0.0) { - neighbor.tri.mark = stamp; + neighbor.pool.marks[neighbor.index] = stamp; cavityCount++; cavityStack.Push(neighbor); continue; @@ -1213,7 +1213,7 @@ private bool EncroachesBeforeInsertion(Vertex v, Otri searchtri) sub.Sym(ref sym); sym.Pivot(ref neighbor); - if (neighbor.tri.id != Mesh.DUMMY && neighbor.tri.mark == stamp) + if (neighbor.index != 0 && neighbor.tri.mark == stamp) { return false; } @@ -1380,7 +1380,7 @@ private bool IsValidSplit(ref Otri tri, Vertex v) tri.Sym(ref sym); - if (sym.tri.id != Mesh.DUMMY) + if (sym.index != 0) { apex = sym.Apex(); diff --git a/src/Triangle/Meshing/SteinerReducer.cs b/src/Triangle/Meshing/SteinerReducer.cs index b4d144a..aa0114f 100644 --- a/src/Triangle/Meshing/SteinerReducer.cs +++ b/src/Triangle/Meshing/SteinerReducer.cs @@ -167,7 +167,7 @@ private bool Collapse(Otri deltri, HashSet changed) do { - if (tri.tri.id == Mesh.DUMMY) + if (tri.index == 0) { return false; } @@ -278,7 +278,7 @@ private bool GatherCavity(Otri deltri) do { - if (tri.tri.id == Mesh.DUMMY || polygon.Count == MaxDegree) + if (tri.index == 0 || polygon.Count == MaxDegree) { return false; } diff --git a/src/Triangle/Meshing/SteinerSmoother.cs b/src/Triangle/Meshing/SteinerSmoother.cs index 4605a80..6962b52 100644 --- a/src/Triangle/Meshing/SteinerSmoother.cs +++ b/src/Triangle/Meshing/SteinerSmoother.cs @@ -153,7 +153,7 @@ private bool GatherStar(Otri start) do { - if (tri.tri.id == Mesh.DUMMY || star.Count == MaxDegree) + if (tri.index == 0 || star.Count == MaxDegree) { return false; } @@ -277,7 +277,7 @@ private bool MakeDelaunay() } e.Sym(ref top); - if (top.tri.id == Mesh.DUMMY) + if (top.index == 0) { continue; } diff --git a/src/Triangle/NewLocation.cs b/src/Triangle/NewLocation.cs index 56adb28..0c2a287 100644 --- a/src/Triangle/NewLocation.cs +++ b/src/Triangle/NewLocation.cs @@ -2466,7 +2466,7 @@ private bool GetNeighborsVertex(Otri badotri, badotri.Sym(ref neighbor); - if (neighbor.tri.id == Mesh.DUMMY) + if (neighbor.index == 0) { break; } diff --git a/src/Triangle/Tools/TerrainSimplifier.cs b/src/Triangle/Tools/TerrainSimplifier.cs index cfb46d3..27e8c97 100644 --- a/src/Triangle/Tools/TerrainSimplifier.cs +++ b/src/Triangle/Tools/TerrainSimplifier.cs @@ -191,12 +191,12 @@ double Z(Vertex v) var result = Locate(mesh, p, ref tri); - if (result == LocateResult.Outside || tri.tri.id == Mesh.DUMMY) + if (result == LocateResult.Outside || tri.index == 0) { // On the boundary (or outside due to snapping of the break lines). tri.Sym(); - if (tri.tri.id == Mesh.DUMMY) + if (tri.index == 0) { tri.tri = mesh.triangles.First(); continue; @@ -345,7 +345,7 @@ double Z(Vertex v) { edge.Sym(ref sym); - if (sym.tri.id != Mesh.DUMMY) + if (sym.index != 0) { ring.Add(sym.tri); } @@ -614,7 +614,7 @@ private static LocateResult Locate(Mesh mesh, Point p, ref Otri tri) { tri.Sym(); - if (tri.tri.id == Mesh.DUMMY) + if (tri.index == 0) { tri.Sym(); return mesh.locator.Locate(p, ref tri); @@ -644,7 +644,7 @@ private static bool Insert(Mesh mesh, Vertex p, ref Otri tri) return false; } - if (tri.tri.id == Mesh.DUMMY) + if (tri.index == 0) { tri.Sym(); } @@ -691,9 +691,9 @@ private static void AddStar(Otri start, HashSet star) star.Add(t.tri); t.Onext(); } - while (t.tri.id != Mesh.DUMMY && t.tri != start.tri); + while (t.index != 0 && t.tri != start.tri); - if (t.tri.id == Mesh.DUMMY) + if (t.index == 0) { // Boundary vertex: the other direction. t = start; @@ -702,7 +702,7 @@ private static void AddStar(Otri start, HashSet star) { t.Oprev(); - if (t.tri.id == Mesh.DUMMY) + if (t.index == 0) { break; } @@ -860,7 +860,7 @@ private static List CocircularTriangles(Mesh mesh, Triangle start) { edge.Sym(ref sym); - if (sym.tri.id == Mesh.DUMMY || visited.Contains(sym.tri)) + if (sym.index == 0 || visited.Contains(sym.tri)) { continue; } @@ -937,12 +937,12 @@ private static Func CreateInterpolation(IList po var result = mesh.locator.Locate(new Point(x, y), ref tri); - if (result == LocateResult.Outside || tri.tri.id == Mesh.DUMMY) + if (result == LocateResult.Outside || tri.index == 0) { tri.Sym(); } - if (tri.tri.id == Mesh.DUMMY) + if (tri.index == 0) { // Outside of the terrain model: use the nearest point. var v = copies.OrderBy(p => (p.x - x) * (p.x - x) + (p.y - y) * (p.y - y)).First(); diff --git a/src/Triangle/Topology/Otri.cs b/src/Triangle/Topology/Otri.cs index 6e36757..5a8d193 100644 --- a/src/Triangle/Topology/Otri.cs +++ b/src/Triangle/Topology/Otri.cs @@ -20,9 +20,19 @@ namespace TriangleNet.Topology /// public struct Otri { - internal Triangle tri; + // The triangle (index into the arrays of the pool), stored flat (16 bytes per handle). + internal TrianglePool pool; + internal int index; internal int orient; // Ranges from 0 to 2. + internal Triangle tri + { + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + get => new Triangle(pool, index); + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + set { pool = value.pool; index = value.index; } + } + public int Orient => orient; /// @@ -89,8 +99,8 @@ public override string ToString() /// public void Sym(ref Otri ot) { - int code = tri.pool.neighbors[3 * tri.index + orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; } @@ -99,8 +109,8 @@ public void Sym(ref Otri ot) /// public void Sym() { - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; } @@ -109,7 +119,7 @@ public void Sym() /// public void Lnext(ref Otri ot) { - ot.tri = tri; + ot.pool = pool; ot.index = index; ot.orient = plus1Mod3[orient]; } @@ -126,7 +136,7 @@ public void Lnext() /// public void Lprev(ref Otri ot) { - ot.tri = tri; + ot.pool = pool; ot.index = index; ot.orient = minus1Mod3[orient]; } @@ -144,12 +154,12 @@ public void Lprev() public void Onext(ref Otri ot) { //Lprev(ref ot); - ot.tri = tri; + ot.pool = pool; ot.index = index; ot.orient = minus1Mod3[orient]; //ot.SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + ot.orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + ot.orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; } @@ -162,8 +172,8 @@ public void Onext() orient = minus1Mod3[orient]; //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; } @@ -173,8 +183,8 @@ public void Onext() public void Oprev(ref Otri ot) { //Sym(ref ot); - int code = tri.pool.neighbors[3 * tri.index + orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; //ot.LnextSelf(); @@ -187,8 +197,8 @@ public void Oprev(ref Otri ot) public void Oprev() { //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; //LnextSelf(); @@ -201,8 +211,8 @@ public void Oprev() public void Dnext(ref Otri ot) { //Sym(ref ot); - int code = tri.pool.neighbors[3 * tri.index + orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; //ot.LprevSelf(); @@ -215,8 +225,8 @@ public void Dnext(ref Otri ot) public void Dnext() { //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; //LprevSelf(); @@ -229,12 +239,12 @@ public void Dnext() public void Dprev(ref Otri ot) { //Lnext(ref ot); - ot.tri = tri; + ot.pool = pool; ot.index = index; ot.orient = plus1Mod3[orient]; //ot.SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + ot.orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + ot.orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; } @@ -247,8 +257,8 @@ public void Dprev() orient = plus1Mod3[orient]; //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; } @@ -258,16 +268,16 @@ public void Dprev() public void Rnext(ref Otri ot) { //Sym(ref ot); - int code = tri.pool.neighbors[3 * tri.index + orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; //ot.LnextSelf(); ot.orient = plus1Mod3[ot.orient]; //ot.SymSelf(); - code = tri.pool.neighbors[3 * ot.tri.index + ot.orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + code = pool.neighbors[3 * ot.index + ot.orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; } @@ -277,16 +287,16 @@ public void Rnext(ref Otri ot) public void Rnext() { //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; //LnextSelf(); orient = plus1Mod3[orient]; //SymSelf(); - code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; } @@ -296,16 +306,16 @@ public void Rnext() public void Rprev(ref Otri ot) { //Sym(ref ot); - int code = tri.pool.neighbors[3 * tri.index + orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; //ot.LprevSelf(); ot.orient = minus1Mod3[ot.orient]; //ot.SymSelf(); - code = tri.pool.neighbors[3 * ot.tri.index + ot.orient]; - ot.tri = new Triangle(tri.pool, code >> 2); + code = pool.neighbors[3 * ot.index + ot.orient]; + ot.pool = pool; ot.index = code >> 2; ot.orient = code & 3; } @@ -315,16 +325,16 @@ public void Rprev(ref Otri ot) public void Rprev() { //SymSelf(); - int code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + int code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; //LprevSelf(); orient = minus1Mod3[orient]; //SymSelf(); - code = tri.pool.neighbors[3 * tri.index + orient]; - tri = new Triangle(tri.pool, code >> 2); + code = pool.neighbors[3 * index + orient]; + index = code >> 2; orient = code & 3; } @@ -333,7 +343,7 @@ public void Rprev() /// public Vertex Org() { - return tri.vertices[plus1Mod3[orient]]; + return pool.vertices[3 * index + plus1Mod3[orient]]; } /// @@ -341,7 +351,7 @@ public Vertex Org() /// public Vertex Dest() { - return tri.vertices[minus1Mod3[orient]]; + return pool.vertices[3 * index + minus1Mod3[orient]]; } /// @@ -349,7 +359,7 @@ public Vertex Dest() /// public Vertex Apex() { - return tri.vertices[orient]; + return pool.vertices[3 * index + orient]; } /// @@ -357,7 +367,7 @@ public Vertex Apex() /// public void Copy(ref Otri ot) { - ot.tri = tri; + ot.pool = pool; ot.index = index; ot.orient = orient; } @@ -366,7 +376,7 @@ public void Copy(ref Otri ot) /// public void Pivot(ref Osub os) { - os = tri.subsegs[orient]; + os = pool.subsegs[3 * index + orient]; } /// @@ -374,7 +384,7 @@ public void Pivot(ref Osub os) /// public bool Equals(Otri ot) { - return ((tri == ot.tri) && (orient == ot.orient)); + return index == ot.index && orient == ot.orient && pool == ot.pool; } #endregion @@ -386,7 +396,7 @@ public bool Equals(Otri ot) /// internal void SetOrg(Vertex v) { - tri.vertices[plus1Mod3[orient]] = v; + pool.vertices[3 * index + plus1Mod3[orient]] = v; } /// @@ -394,7 +404,7 @@ internal void SetOrg(Vertex v) /// internal void SetDest(Vertex v) { - tri.vertices[minus1Mod3[orient]] = v; + pool.vertices[3 * index + minus1Mod3[orient]] = v; } /// @@ -402,7 +412,7 @@ internal void SetDest(Vertex v) /// internal void SetApex(Vertex v) { - tri.vertices[orient] = v; + pool.vertices[3 * index + orient] = v; } /// @@ -410,10 +420,9 @@ internal void SetApex(Vertex v) /// internal void Bond(ref Otri ot) { - var n = tri.pool.neighbors; - n[3 * tri.index + orient] = (ot.tri.index << 2) | ot.orient; - - n[3 * ot.tri.index + ot.orient] = (tri.index << 2) | orient; + var n = pool.neighbors; + n[3 * index + orient] = (ot.index << 2) | ot.orient; + n[3 * ot.index + ot.orient] = (index << 2) | orient; } /// @@ -425,7 +434,7 @@ internal void Bond(ref Otri ot) /// internal void Dissolve(Triangle dummy) { - tri.pool.neighbors[3 * tri.index + orient] = dummy.index << 2; + pool.neighbors[3 * index + orient] = dummy.index << 2; } /// @@ -433,7 +442,7 @@ internal void Dissolve(Triangle dummy) /// internal void Infect() { - tri.infected = true; + pool.infected[index] = true; } /// @@ -441,7 +450,7 @@ internal void Infect() /// internal void Uninfect() { - tri.infected = false; + pool.infected[index] = false; } /// @@ -449,7 +458,7 @@ internal void Uninfect() /// internal bool IsInfected() { - return tri.infected; + return pool.infected[index]; } /// @@ -457,7 +466,7 @@ internal bool IsInfected() /// internal void SegBond(ref Osub os) { - tri.subsegs[orient] = os; + pool.subsegs[3 * index + orient] = os; os.seg.triangles[os.orient] = this; } @@ -466,7 +475,7 @@ internal void SegBond(ref Osub os) /// internal void SegDissolve(SubSegment dummy) { - tri.subsegs[orient].seg = dummy; + pool.subsegs[3 * index + orient].seg = dummy; } /// diff --git a/src/Triangle/Topology/SubSegment.cs b/src/Triangle/Topology/SubSegment.cs index 9146190..07d36f2 100644 --- a/src/Triangle/Topology/SubSegment.cs +++ b/src/Triangle/Topology/SubSegment.cs @@ -123,7 +123,7 @@ public Vertex GetVertex(int index) /// public ITriangle GetTriangle(int index) { - return triangles[index].tri.hash == Mesh.DUMMY ? null : triangles[index].tri; + return triangles[index].index == 0 ? null : triangles[index].tri; } /// diff --git a/src/Triangle/TriangleLocator.cs b/src/Triangle/TriangleLocator.cs index 010f668..67058b4 100644 --- a/src/Triangle/TriangleLocator.cs +++ b/src/Triangle/TriangleLocator.cs @@ -224,7 +224,7 @@ public LocateResult PreciseLocate(Point searchpoint, ref Otri searchtri, } } // Check for walking right out of the triangulation. - if (searchtri.tri.id == Mesh.DUMMY) + if (searchtri.index == 0) { // Go back to the last triangle. backtracktri.Copy(ref searchtri); diff --git a/src/Triangle/TrianglePool.cs b/src/Triangle/TrianglePool.cs index a8b7548..8130ef4 100644 --- a/src/Triangle/TrianglePool.cs +++ b/src/Triangle/TrianglePool.cs @@ -71,6 +71,17 @@ internal TrianglePool(int capacity) InitializeDummy(); } + /// + /// Make sure the pool can hold the given number of triangles without growing. + /// + internal void EnsureCapacity(int capacity) + { + if (capacity + 1 > ids.Length) + { + Allocate(capacity); + } + } + private void Allocate(int capacity) { capacity += 1; // The outer space triangle. diff --git a/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs b/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs index 5d9353e..d267fb7 100644 --- a/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs +++ b/src/Triangle/Voronoi/Legacy/BoundedVoronoiLegacy.cs @@ -185,7 +185,7 @@ private void TagBlindTriangles() e.orient = 0; e.Pivot(ref f); - if (f.tri.id != Mesh.DUMMY && !f.tri.infected) + if (f.index != 0 && !f.tri.infected) { triangles.Push(f.tri); } @@ -193,7 +193,7 @@ private void TagBlindTriangles() e.Sym(); e.Pivot(ref f); - if (f.tri.id != Mesh.DUMMY && !f.tri.infected) + if (f.index != 0 && !f.tri.infected) { triangles.Push(f.tri); } @@ -209,7 +209,7 @@ private void TagBlindTriangles() if (TriangleIsBlinded(ref f, ref e)) { // Tag f as blinded by e - f.tri.infected = true; + f.pool.infected[f.index] = true; blinded++; // Store association triangle -> subseg @@ -224,7 +224,7 @@ private void TagBlindTriangles() // if f0 is finite and tagged non-blind & the common edge // between f and f0 is unconstrained then - if (f0.tri.id != Mesh.DUMMY && !f0.tri.infected && sub1.seg.hash == Mesh.DUMMY) + if (f0.index != 0 && !f0.tri.infected && sub1.seg.hash == Mesh.DUMMY) { // Push f0 into triangles. triangles.Push(f0.tri); @@ -421,10 +421,10 @@ private void ConstructBoundaryCell(Vertex vertex) f_init.Oprev(ref f_prev); // Is the border to the left? - if (f_prev.tri.id != Mesh.DUMMY) + if (f_prev.index != 0) { // Go clockwise until we reach the border (or the initial triangle) - while (f_prev.tri.id != Mesh.DUMMY && !f_prev.Equals(f_init)) + while (f_prev.index != 0 && !f_prev.Equals(f_init)) { f_prev.Copy(ref f); f_prev.Oprev(); @@ -434,7 +434,7 @@ private void ConstructBoundaryCell(Vertex vertex) f.Onext(ref f_next); } - if (f_prev.tri.id == Mesh.DUMMY) + if (f_prev.index == 0) { // For vertices on the domain boundaray, add the vertex. For // internal boundaries don't add it. @@ -460,7 +460,7 @@ private void ConstructBoundaryCell(Vertex vertex) // Call Lffnext the line going through the circumcenters of f and f_next cc_f = this.points[f.tri.id]; - if (f_next.tri.id == Mesh.DUMMY) + if (f_next.index == 0) { if (!f.tri.infected) { diff --git a/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs b/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs index fefd4a7..1193c52 100644 --- a/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs +++ b/src/Triangle/Voronoi/Legacy/SimpleVoronoi.cs @@ -169,11 +169,11 @@ private void ConstructCell(VoronoiRegion region) f_init.Onext(ref f_next); // Check if f_init lies on the boundary of the triangulation. - if (f_next.tri.id == Mesh.DUMMY) + if (f_next.index == 0) { f_init.Oprev(ref f_prev); - if (f_prev.tri.id != Mesh.DUMMY) + if (f_prev.index != 0) { f_init.Copy(ref f_next); // Move one triangle clockwise @@ -183,7 +183,7 @@ private void ConstructCell(VoronoiRegion region) } // Go counterclockwise until we reach the border or the initial triangle. - while (f_next.tri.id != Mesh.DUMMY) + while (f_next.index != 0) { // Add circumcenter of current triangle vpoints.Add(points[f.tri.id]); @@ -241,7 +241,7 @@ private void ConstructCell(VoronoiRegion region) f_init.Copy(ref f); f.Oprev(ref f_prev); - while (f_prev.tri.id != Mesh.DUMMY) + while (f_prev.index != 0) { vpoints.Add(points[f_prev.tri.id]); region.AddNeighbor(f_prev.tri.id, regions[f_prev.Apex().id]); diff --git a/src/Triangle/Voronoi/VoronoiBase.cs b/src/Triangle/Voronoi/VoronoiBase.cs index e93699d..e02c044 100644 --- a/src/Triangle/Voronoi/VoronoiBase.cs +++ b/src/Triangle/Voronoi/VoronoiBase.cs @@ -148,7 +148,7 @@ protected List[] ComputeVertices(Mesh mesh, Vertex[] vertices) /// Empty vertex map. protected void ComputeEdges(Mesh mesh, Vertex[] vertices, Face[] faces, List[] map) { - Otri tri, neighbor = default; + Otri tri = default, neighbor = default; TriangleNet.Geometry.Vertex org, dest; double px, py; From 2db8eba1b40cf9379e66dc7e3a6bd8088531602d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 11:07:26 +0000 Subject: [PATCH 44/50] Fix solution build with triangle handles: rendering index buffer, example, viewer IndexBuffer.Create takes any IEnumerable of ITriangle (mesh.Triangles is a collection of Triangle values; covariance doesn't apply to value types). Example7 casts the quad tree result instead of 'as'; the viewer compares the handle with default instead of null. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Examples/Examples/Example7.cs | 2 +- src/Triangle.Rendering/Buffer/IndexBuffer.cs | 4 +++- src/Triangle.Viewer/Topology/TopologyRenderControl.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Triangle.Examples/Examples/Example7.cs b/src/Triangle.Examples/Examples/Example7.cs index 4ff5ee4..e3431a6 100644 --- a/src/Triangle.Examples/Examples/Example7.cs +++ b/src/Triangle.Examples/Examples/Example7.cs @@ -33,7 +33,7 @@ public bool Run(bool print = false) // Find a seeding triangle (in this case, the point (2, 2) lies in // both rectangles). - var seed = (new TriangleQuadTree(mesh)).Query(2.0, 2.0) as Triangle; + var seed = (Triangle)(new TriangleQuadTree(mesh)).Query(2.0, 2.0); var iterator = new RegionIterator(); diff --git a/src/Triangle.Rendering/Buffer/IndexBuffer.cs b/src/Triangle.Rendering/Buffer/IndexBuffer.cs index 296da7f..f0bd80c 100644 --- a/src/Triangle.Rendering/Buffer/IndexBuffer.cs +++ b/src/Triangle.Rendering/Buffer/IndexBuffer.cs @@ -28,7 +28,9 @@ public static IBuffer Create(IEnumerable edges, int size) return buffer; } - public static IBuffer Create(IEnumerable elements, int size) + // Generic, so that mesh.Triangles (a collection of Triangle values) can be passed without + // conversion (covariance doesn't apply to value types). + public static IBuffer Create(IEnumerable elements, int size) where T : ITriangle { var buffer = new IndexBuffer(size * elements.Count(), size); diff --git a/src/Triangle.Viewer/Topology/TopologyRenderControl.cs b/src/Triangle.Viewer/Topology/TopologyRenderControl.cs index d8090c9..481e7f5 100644 --- a/src/Triangle.Viewer/Topology/TopologyRenderControl.cs +++ b/src/Triangle.Viewer/Topology/TopologyRenderControl.cs @@ -56,7 +56,7 @@ public void Initialize(Mesh mesh) public void Update(Otri otri) { - if (otri.Triangle == null || otri.Triangle.ID < 0) + if (otri.Triangle.Equals(default(TriangleNet.Topology.Triangle)) || otri.Triangle.ID < 0) { renderer.SelectTriangle(null, null, null); } From 383acc55945802dd4e635b5e2f53de958b059cce Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 11:17:35 +0000 Subject: [PATCH 45/50] CI: Build und Tests im Release-Modus Debug-Tests dauern rund 15 Minuten, Release rund 3,5 Minuten. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .github/workflows/dotnet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d627f42..5e09501 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,12 +21,12 @@ jobs: run: dotnet restore Triangle.sln working-directory: ./src - name: Build - run: dotnet build Triangle.sln --no-restore + run: dotnet build Triangle.sln --no-restore -c Release working-directory: ./src - name: Test - run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory!=KnownBug" + run: dotnet test Triangle.sln --no-build -c Release --verbosity normal --filter "TestCategory!=KnownBug" working-directory: ./src - name: Known bugs (red tests, expected to fail) - run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory=KnownBug" + run: dotnet test Triangle.sln --no-build -c Release --verbosity normal --filter "TestCategory=KnownBug" working-directory: ./src continue-on-error: true From 80983fcb25280c0410669d80f11092044f46cb46 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 11:20:04 +0000 Subject: [PATCH 46/50] CI: Build und Tests im Release-Modus Debug-Tests dauern rund 15 Minuten, Release rund 3,5 Minuten. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .github/workflows/dotnet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d627f42..5e09501 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -21,12 +21,12 @@ jobs: run: dotnet restore Triangle.sln working-directory: ./src - name: Build - run: dotnet build Triangle.sln --no-restore + run: dotnet build Triangle.sln --no-restore -c Release working-directory: ./src - name: Test - run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory!=KnownBug" + run: dotnet test Triangle.sln --no-build -c Release --verbosity normal --filter "TestCategory!=KnownBug" working-directory: ./src - name: Known bugs (red tests, expected to fail) - run: dotnet test Triangle.sln --no-build --verbosity normal --filter "TestCategory=KnownBug" + run: dotnet test Triangle.sln --no-build -c Release --verbosity normal --filter "TestCategory=KnownBug" working-directory: ./src continue-on-error: true From 16bcdeee0786102e9f2f9a54c07fa5a6ea8c4a21 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 12:37:56 +0000 Subject: [PATCH 47/50] Korpus: Steiner-Limit per TRIANGLE_CORPUS_STEINER einstellbar Ganze Natural-Earth-Ebenen (z. B. US-Landkreise, 148.000 Punkte) brauchen mehr als die festen 100.000 Steiner-Punkte. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- src/Triangle.Tests/Corpus/CorpusTest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Triangle.Tests/Corpus/CorpusTest.cs b/src/Triangle.Tests/Corpus/CorpusTest.cs index 6ab2b58..b4b2a01 100644 --- a/src/Triangle.Tests/Corpus/CorpusTest.cs +++ b/src/Triangle.Tests/Corpus/CorpusTest.cs @@ -43,6 +43,7 @@ namespace TriangleNet.Tests.Corpus /// TRIANGLE_CORPUS_ROUND count triangles flipped by rounding to this grid (default 0 = off, /// the output grid if set) /// TRIANGLE_CORPUS_ANGLES comma separated minimum angles (default 0,20; 0 = no quality) + /// TRIANGLE_CORPUS_STEINER Steiner point limit (default 100000) /// TRIANGLE_CORPUS_REDUCE 1 = QualityOptions.ReduceSteinerPoints /// TRIANGLE_CORPUS_SMOOTH QualityOptions.SmoothingSteps (default 0) /// TRIANGLE_CORPUS_CONFORMING 1 = ConstraintOptions.ConformingDelaunay @@ -54,7 +55,9 @@ public class CorpusTest { private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(120); - private const int SteinerPoints = 100000; + // Steiner point limit (TRIANGLE_CORPUS_STEINER, default 100000). + private static int SteinerPoints => + int.TryParse(Environment.GetEnvironmentVariable("TRIANGLE_CORPUS_STEINER"), out var n) ? n : 100000; [Test] public void GeosXmlTestSuite() From 13a9760b7b2db0de39e5813e1fa7a574b31798cd Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 12:43:26 +0000 Subject: [PATCH 48/50] Doku: weitere Natural-Earth-Ebenen ausgewertet Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- docs/Robustheitsanalyse.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/Robustheitsanalyse.md b/docs/Robustheitsanalyse.md index 436d5c6..d678869 100644 --- a/docs/Robustheitsanalyse.md +++ b/docs/Robustheitsanalyse.md @@ -792,6 +792,19 @@ dieselbe Cache-Zeile beschreiben. (162.852 Punkte) vernetzt in 3,1 s (520.110 Dreiecke, Steiner-Limit) und ist gültig; die übrige Zeit braucht die Prüfung des Testgerüsts (Klassifizierung von 375.000 schlechten Dreiecken an winzigen Eingabewinkeln und schmalen Streifen). +* **Weitere Natural-Earth-10m-Ebenen** (direkt von naciscdn.org: Ozean, Küstenlinie, kleine + Inseln, Gletscher, Riffe, Salzseen, Schelfeis, Seen Europa/Nordamerika, Stadtgebiete, + Map-Subunits, Provinzen mit Seen, US-Landkreise; je Ebene ganz und 60 Einzelobjekte; 0°, 20°, + 30°): 2.220 Läufe, alle gültig bis auf die ganze Landkreis-Ebene (148.000 Punkte) bei 20° und + 30°, die in die 120 s lief. Ursache: im Landkreis Chugach (Alaska) läuft eine Grenze 5 km hin und + fast deckungsgleich zurück (Abstand 5,7e-10 Grad, etwa 0,06 mm; Winkel 6,5e-7 Grad). Den + Streifen kann keine Verfeinerung mit 20° füllen; der Mesher hält nach 0,5 s am Steiner-Limit an, + die übrige Zeit braucht die Klassifizierung der 300.000 schlechten Dreiecke im Testgerüst. + Mit `SnapTolerance` 1e-8 (etwa 1 mm) verschwindet der Streifen; alle 3.224 Landkreise einzeln + und alle 68 5-Grad-Regionen sind dann ohne Limit fertig, die ganze Ebene mit + `TRIANGLE_CORPUS_STEINER=1000000` in 4,3 s (471.716 Dreiecke, 23.478 schlechte Dreiecke nur an + kleinen Eingabewinkeln und schmalen Streifen). Für Daten in Grad also eine Snap-Toleranz + passend zur Datengenauigkeit setzen. ## Klassenweises Review (`src/Triangle.Tests/Review`) From 32d48690926c03049f8858ebb606a94ea312f377 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 12:55:44 +0000 Subject: [PATCH 49/50] =?UTF-8?q?Regressionstests=20mit=20harten=20F=C3=A4?= =?UTF-8?q?llen=20aus=20externen=20Daten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Öffentliche Fixtures von earcut, delaunator und poly2tri, an denen das ursprüngliche Triangle.NET scheitert (Exception, Endlosschleife, inkonsistentes Netz), jetzt fest im Repo und im CI: je ohne Qualität, 20° und 30°. Dazu die fast deckungsgleiche Hin-und-zurück-Grenze aus den Natural-Earth-US-Landkreisen (Steiner-Limit greift; mit Snap-Toleranz keine schlechten Dreiecke). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Data/Public/delaunator-issue43.txt | 6 + .../Data/Public/delaunator-robustness1.txt | 80 + .../Data/Public/delaunator-robustness2.txt | 1001 ++++++++++++ .../Data/Public/delaunator-robustness3.txt | 71 + .../Data/Public/delaunator-robustness4.txt | 37 + .../Data/Public/earcut-bad-hole.txt | 5 + .../Robustness/Data/Public/earcut-earcut.txt | 8 + .../Data/Public/earcut-infinite-loop-jhl.txt | 3 + .../Data/Public/earcut-issue142.txt | 3 + .../Robustness/Data/Public/earcut-issue17.txt | 3 + .../Robustness/Data/Public/earcut-issue83.txt | 4 + .../Data/Public/earcut-self-tangent-3.txt | 24 + .../Data/Public/earcut-self-tangent-4.txt | 274 ++++ .../Data/Public/earcut-touching-holes6.txt | 170 ++ .../Data/Public/earcut-water-huge.txt | 194 +++ .../Data/Public/earcut-water-huge2.txt | 444 +++++ .../Data/Public/earcut-water-huge3.txt | 1445 +++++++++++++++++ .../Robustness/Data/Public/earcut-water.txt | 11 + .../Data/Public/poly2tri-sketchup.txt | 2 + src/Triangle.Tests/Robustness/Data/README.md | 10 + .../Robustness/ExternalDataRegressionTest.cs | 86 + src/Triangle.Tests/Triangle.Tests.csproj | 1 + 22 files changed, 3882 insertions(+) create mode 100644 src/Triangle.Tests/Robustness/Data/Public/delaunator-issue43.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness1.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness2.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness3.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness4.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-bad-hole.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-earcut.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-infinite-loop-jhl.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-issue142.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-issue17.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-issue83.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-3.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-4.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-touching-holes6.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge2.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge3.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/earcut-water.txt create mode 100644 src/Triangle.Tests/Robustness/Data/Public/poly2tri-sketchup.txt create mode 100644 src/Triangle.Tests/Robustness/ExternalDataRegressionTest.cs diff --git a/src/Triangle.Tests/Robustness/Data/Public/delaunator-issue43.txt b/src/Triangle.Tests/Robustness/Data/Public/delaunator-issue43.txt new file mode 100644 index 0000000..00f41cf --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/delaunator-issue43.txt @@ -0,0 +1,6 @@ +# delaunator/issue43 +P -537.7739674441619,-122.26130468750004 +P -495.533967444162,-183.39195703125006 +P -453.29396744416204,-244.5226093750001 +P -411.0539674441621,-305.6532617187501 +P -164,-122 diff --git a/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness1.txt b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness1.txt new file mode 100644 index 0000000..a8debe0 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness1.txt @@ -0,0 +1,80 @@ +# delaunator/robustness1 +P 66.10364838437141,68.58861247166476 +P 146.6807134621004,121.68071346210043 +P 128.86889656046745,117.26179755904141 +P 66.10364838437144,68.58861247166477 +P 169.552139667572,146.1337765382769 +P 126.62939224605088,181.11140466039208 +P 74.43444828023371,78.63089877952069 +P 121.11140466039205,153.37060775394912 +P 98.88859533960789,186.62939224605086 +P 52.66066896814022,63.178539267712424 +P 85.32133793628044,86.35707853542483 +P 129.61570560806462,173.90180644032262 +P 91.52240934977428,162.34633135269814 +P 137.24095128280055,112.24095128280054 +P 93.37060775394912,158.88859533960792 +P 175,150 +P 124.14213562373091,184.14213562373098 +P 96.2082275923272,94.08325829132899 +P 98.88859533960799,153.37060775394906 +P 117.9820069044207,109.53561780313727 +P 116.19447026430383,108.26704341337691 +P 54.32437806124571,62.30633496599771 +P 30.88688965604674,47.72617975590414 +P 107.09511724837395,101.80943804723313 +P 38.892261948632665,52.59484129908844 +P 146.6807134621004,121.6807134621004 +P 95.85786437626908,155.85786437626902 +P 54.3243780612457,62.306334965997706 +P 137.24095128280055,112.24095128280055 +P 161.5295655286077,140.44033682675382 +P 90.3842943919354,166.09819355967738 +P 113.22072967687429,93.71772249433295 +P 77.88291870749715,74.87088997733181 +P 50,60 +P 85.32133793628046,86.35707853542485 +P 41.77377931209348,55.45235951180829 +P 89.66218903062287,81.15316748299887 +P 101.44145935374857,87.4354449886659 +P 124.14213562373097,155.85786437626905 +P 172.41645518465438,148.16651658265795 +P 63.54755862418691,70.90471902361652 +P 150.64267587256094,132.7141570708497 +P 109.99999999999993,190 +P 128.47759065022572,177.65366864730183 +P 90,169.99999999999994 +P 128.47759065022575,162.3463313526982 +P 156.12047564140028,131.12047564140028 +P 90.38429439193538,173.9018064403225 +P 95.85786437626899,184.1421356237309 +P 77.88291870749714,74.8708899773318 +P 139.7557862165142,124.98797731494555 +P 130,170 +P 102.34633135269813,188.4775906502257 +P 41.77377931209348,55.45235951180828 +P 91.52240934977424,177.6536686473017 +P 27.7845238972653,45.189682598176866 +P 126.62939224605091,158.88859533960797 +P 106.09819355967736,189.6157056080646 +P 52.6606689681402,63.178539267712395 +P 74.43444828023368,78.63089877952068 +P 106.09819355967747,150.38429439193538 +P 117.65366864730173,188.47759065022575 +P 125,100 +P 38.892261948632566,52.59484129908838 +P 52.66066896814023,63.17853926771242 +P 129.61570560806462,166.09819355967744 +P 20,40 +P 117.65366864730181,151.52240934977428 +P 161.52956552860766,140.44033682675382 +P 63.54755862418697,70.90471902361656 +P 127.80118910350068,102.80118910350068 +P 89.66218903062284,81.15316748299885 +P 102.34633135269824,151.52240934977425 +P 93.37060775394906,181.11140466039197 +P 113.9018064403225,189.61570560806462 +P 121.111404660392,186.62939224605094 +P 113.90180644032259,150.38429439193538 +P 110.00000000000003,150 +P 165.56023782070014,140.56023782070014 diff --git a/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness2.txt b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness2.txt new file mode 100644 index 0000000..df068bd --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness2.txt @@ -0,0 +1,1001 @@ +# delaunator/robustness2 +P 0.226270008640849,-0.5484478681473859 +P 0.22627000864084906,-0.5484478681473857 +P 0.766192698520777,-0.06114560279536302 +P 0.7661926985207771,-0.06114560279536302 +P 0.40151121510492016,0.08616979557470032 +P 0.40151121510492027,0.08616979557470034 +P -0.41675996433129736,-0.5902787491305856 +P -0.4167599643312972,-0.5902787491305853 +P -0.2479064469635639,-0.7472011647497873 +P -0.24790644696356384,-0.7472011647497872 +P 0.6078988481689899,-0.8087190266174613 +P 0.6078988481689901,-0.808719026617461 +P 0.6844238681986647,-0.22229148851718702 +P 0.6844238681986647,-0.222291488517187 +P 0.6486832941181451,0.3706194950394349 +P 0.6486832941181452,0.3706194950394349 +P -0.5361048842131249,-0.16765691382574804 +P -0.5361048842131245,-0.167656913825748 +P 0.4588358986737203,-0.9000280551977525 +P 0.4588358986737205,-0.9000280551977525 +P 0.3960651926938643,0.19117525930527385 +P 0.39606519269386437,0.1911752593052739 +P 0.30699987842448867,-0.4067155996580057 +P 0.3069998784244887,-0.4067155996580056 +P 0.47811583559881354,0.4551485080955586 +P 0.47811583559881354,0.4551485080955586 +P 0.5569494202770435,0.3174275448747843 +P 0.5569494202770439,0.3174275448747845 +P -0.4277027605175392,0.09695587866512022 +P -0.4277027605175391,0.09695587866512025 +P -0.5748114807265807,-0.03838218657575568 +P -0.5748114807265806,-0.03838218657575567 +P -1.0317070883952917,-0.5245256032470283 +P -1.031707088395291,-0.5245256032470283 +P 0.14712374452633492,0.33141471681448986 +P 0.147123744526335,0.33141471681448986 +P -0.2834737219004291,-0.9271587984120542 +P -0.2834737219004289,-0.9271587984120538 +P -0.6098149486946731,0.5553773725836295 +P -0.6098149486946729,0.5553773725836295 +P 1.1206314478250745,0.3921423623286639 +P 1.1206314478250745,0.39214236232866406 +P 0.4477538973665876,-0.04256704865570235 +P 0.4477538973665877,-0.04256704865570235 +P -0.6156635308889042,-0.10817302193016937 +P -0.6156635308889041,-0.10817302193016932 +P 0.17897362794557034,-0.04224227852769616 +P 0.17897362794557034,-0.04224227852769614 +P -0.9646885789850332,-1.4563419829050452 +P -0.9646885789850331,-1.456341982905045 +P 0.2911613415160255,0.015655417967490592 +P 0.29116134151602563,0.015655417967490596 +P -0.3698918540831971,0.6983267205999204 +P -0.3698918540831969,0.6983267205999205 +P 1.4056553730213062,-0.41615789580202767 +P 1.4056553730213066,-0.41615789580202767 +P 0.34141990921721344,-0.5679551502988661 +P 0.3414199092172136,-0.5679551502988661 +P 0.2957318137669341,0.8416499601535058 +P 0.29573181376693425,0.841649960153506 +P 0.035141462612931273,-0.45835970615650135 +P 0.03514146261293129,-0.45835970615650123 +P -1.3263110033694971,0.8223290351908346 +P -1.326311003369497,0.8223290351908346 +P -0.18787969354847422,1.4601214758378256 +P -0.18787969354847417,1.4601214758378258 +P -0.5421684590742957,-0.5196118080038157 +P -0.5421684590742956,-0.5196118080038157 +P -0.15415956428809274,0.2553265483092856 +P -0.15415956428809266,0.25532654830928564 +P 0.24744639466303925,0.36561549310806263 +P 0.24744639466303933,0.36561549310806274 +P -0.007949225522230624,-0.4463313570187974 +P -0.00794922552223062,-0.4463313570187972 +P 0.4314282749865176,0.6907165244683744 +P 0.4314282749865177,0.6907165244683744 +P 0.22721916356346672,-1.145924985720078 +P 0.22721916356346675,-1.1459249857200775 +P 0.11627266697915434,0.5679584977485386 +P 0.11627266697915438,0.5679584977485389 +P -0.004760241854834868,1.341758406463988 +P -0.004760241854834866,1.3417584064639887 +P 0.34070213758085,-0.4524446934513693 +P 0.3407021375808501,-0.45244469345136923 +P 0.8842875090593054,-0.4369329059094983 +P 0.8842875090593055,-0.43693290590949824 +P 0.1514286184534766,-0.17725085421066233 +P 0.15142861845347666,-0.17725085421066225 +P -0.4255258812089902,-0.48986352859695054 +P -0.42552588120899015,-0.4898635285969505 +P 0.9377261482762783,-0.1443481348548356 +P 0.9377261482762784,-0.14434813485483552 +P 0.04260345503852292,0.951377045867543 +P 0.04260345503852292,0.951377045867543 +P 0.305243584013604,-0.3875472629266138 +P 0.305243584013604,-0.3875472629266138 +P 0.03603755940893599,0.34504467425927055 +P 0.036037559408936,0.34504467425927055 +P 0.7432869522329792,-0.7836440067269177 +P 0.7432869522329795,-0.7836440067269175 +P -0.2963957383054346,-0.8541077824286829 +P -0.2963957383054344,-0.8541077824286829 +P -0.5957774790480242,-0.600709712349726 +P -0.5957774790480241,-0.6007097123497258 +P -0.16224562470708315,0.34537414926581733 +P -0.16224562470708306,0.34537414926581733 +P -0.7424662163367453,-0.41130625924230096 +P -0.742466216336745,-0.41130625924230085 +P -0.3624590396531042,-0.10563984421746442 +P -0.3624590396531041,-0.10563984421746442 +P -0.5392904110560361,-0.08518185259429017 +P -0.5392904110560358,-0.08518185259429016 +P -0.6778672159722301,0.3431673449069855 +P -0.6778672159722301,0.3431673449069856 +P 0.36715717958832705,-0.5910728761089766 +P 0.36715717958832716,-0.5910728761089764 +P -0.025023155416355747,0.049551540818041445 +P -0.025023155416355747,0.04955154081804146 +P -0.24819669042158904,1.551076727423892 +P -0.24819669042158898,1.5510767274238921 +P 0.567193157662795,0.11906741314152564 +P 0.567193157662795,0.11906741314152564 +P -0.040143445247768667,0.26972252794743534 +P -0.04014344524776866,0.26972252794743534 +P -0.2625294670890006,-0.9866393501381076 +P -0.2625294670890005,-0.9866393501381073 +P 0.44843907219373064,0.8048081754922025 +P 0.44843907219373064,0.8048081754922027 +P 0.0645600537587031,1.0817638655728792 +P 0.06456005375870313,1.0817638655728798 +P 0.7675432088110417,-0.8812717114610312 +P 0.7675432088110417,-0.8812717114610309 +P -0.08286494268897,-0.4289421536808215 +P -0.08286494268896998,-0.42894215368082134 +P -0.41612370586918423,0.4886715855834002 +P -0.41612370586918423,0.48867158558340035 +P 0.19771717248920714,-0.1094932114101852 +P 0.19771717248920723,-0.10949321141018517 +P 0.3325743770435765,0.3050059606614455 +P 0.3325743770435766,0.3050059606614456 +P -0.6076675750885592,-0.2488880571567846 +P -0.6076675750885588,-0.24888805715678455 +P -0.13216710101702264,-0.5066473875502346 +P -0.13216710101702256,-0.5066473875502345 +P 0.8513876721292416,-0.5489241609365357 +P 0.8513876721292416,-0.5489241609365356 +P -0.382289175026138,-0.47285448091622573 +P -0.38228917502613796,-0.4728544809162256 +P -0.22454842691828375,0.6151379112650053 +P -0.22454842691828367,0.6151379112650056 +P -0.8646014175536286,-0.42386569643498184 +P -0.8646014175536284,-0.4238656964349818 +P 0.3117316226386966,0.2627613357418179 +P 0.3117316226386967,0.262761335741818 +P -0.15249103914387663,0.4395379613315442 +P -0.15249103914387657,0.4395379613315443 +P -0.8535303948590758,-0.5171136892316436 +P -0.8535303948590756,-0.5171136892316435 +P 0.5548908499705427,0.7505471621260598 +P 0.5548908499705427,0.7505471621260601 +P -0.06051133138765111,0.10241755750407933 +P -0.0605113313876511,0.10241755750407933 +P 0.5337288423213871,-0.4674709006951539 +P 0.5337288423213873,-0.4674709006951539 +P 0.05432726705458686,0.7404240043361822 +P 0.054327267054586875,0.7404240043361824 +P 0.18755513858332273,-0.33846461008241124 +P 0.1875551385833228,-0.33846461008241124 +P -0.8591170242442958,0.10096092456106642 +P -0.8591170242442956,0.10096092456106642 +P -0.6532878500824677,0.06191743854152687 +P -0.6532878500824675,0.06191743854152687 +P -0.8539614587215372,-0.7324824009962402 +P -0.8539614587215372,-0.7324824009962402 +P -0.5863802667964559,-1.056546154929931 +P -0.5863802667964556,-1.0565461549299304 +P -0.1790469166305501,0.2959320232236789 +P -0.17904691663055006,0.2959320232236789 +P -0.1360834565364501,-0.11972427421383847 +P -0.13608345653645007,-0.11972427421383845 +P 1.000279652308404,0.5677840712010568 +P 1.0002796523084043,0.5677840712010568 +P -0.2539417014734854,-0.24824262411661902 +P -0.2539417014734853,-0.24824262411661896 +P -0.5513314210236925,0.164455936053998 +P -0.5513314210236921,0.16445593605399808 +P -0.35669084505120763,-0.5579365995173293 +P -0.3566908450512076,-0.557936599517329 +P -0.00479028693868494,0.5747959597699825 +P -0.004790286938684939,0.5747959597699829 +P 0.9274618857336762,0.3137388167061812 +P 0.9274618857336765,0.3137388167061813 +P -0.1582654462645559,0.08532244403569378 +P -0.1582654462645559,0.08532244403569382 +P -0.7338606250043278,0.03884536523072413 +P -0.7338606250043278,0.038845365230724134 +P 0.441630546674704,-0.4757978998267975 +P 0.4416305466747042,-0.4757978998267975 +P -0.340639188849867,-0.016461235375619054 +P -0.340639188849867,-0.01646123537561905 +P 0.6944973204450795,-0.05127049077067958 +P 0.6944973204450798,-0.051270490770679564 +P 0.05692195764635159,-0.4860234898913355 +P 0.05692195764635161,-0.4860234898913355 +P -0.34909544551668503,0.07925987763994416 +P -0.3490954455166849,0.07925987763994416 +P 0.020842670418798892,-0.18962128485770935 +P 0.020842670418798902,-0.1896212848577093 +P -0.24296262993119017,-0.7557062436624338 +P -0.24296262993119008,-0.7557062436624334 +P 0.07767785036524773,-0.0756745138376198 +P 0.07767785036524774,-0.0756745138376198 +P -0.5383587124935423,0.3149908402335876 +P -0.538358712493542,0.3149908402335876 +P -0.3672547557130592,0.8497352282145765 +P -0.3672547557130592,0.8497352282145768 +P 1.0306858576839981,0.6132170100848149 +P 1.0306858576839986,0.6132170100848152 +P 0.026403641820751278,-0.11123958700346126 +P 0.02640364182075129,-0.11123958700346125 +P -0.39673068933170313,0.7365210212380586 +P -0.3967306893317031,0.7365210212380586 +P -0.273859110739041,0.15083421880672626 +P -0.2738591107390409,0.15083421880672626 +P -0.7502503591118193,-0.6273750425323015 +P -0.7502503591118191,-0.6273750425323014 +P 1.040458273889268,0.3592162639445413 +P 1.0404582738892683,0.3592162639445414 +P -0.30951481303178596,-0.7990197975684153 +P -0.30951481303178585,-0.7990197975684152 +P -0.3049861667890695,1.6737307580052914 +P -0.30498616678906937,1.673730758005292 +P 0.601935475297747,1.1660575124169412 +P 0.601935475297747,1.1660575124169419 +P 0.8838992370838099,0.2656415636074353 +P 0.8838992370838102,0.2656415636074353 +P -0.5085727248068516,-0.23584500534815295 +P -0.5085727248068515,-0.2358450053481529 +P 0.5396217328637709,-0.39810497658583466 +P 0.5396217328637712,-0.39810497658583466 +P 0.8665494841240842,0.11624211166929022 +P 0.8665494841240843,0.11624211166929023 +P -0.51942267345288,0.5395224235439922 +P -0.5194226734528796,0.5395224235439922 +P 0.19088288221197763,-0.4663336215970121 +P 0.19088288221197763,-0.4663336215970119 +P -0.23194847381262582,0.21901474700861162 +P -0.23194847381262573,0.21901474700861162 +P 0.8359436402369345,-0.2679779650730807 +P 0.8359436402369346,-0.2679779650730805 +P 0.4468309121482219,0.724738511770195 +P 0.4468309121482219,0.7247385117701953 +P 0.5963791684457523,0.8746079737915003 +P 0.5963791684457525,0.8746079737915007 +P -0.16268657840268694,-0.10458689278692812 +P -0.16268657840268685,-0.10458689278692809 +P 0.15167543844454376,0.3810633395493045 +P 0.1516754384445438,0.3810633395493046 +P 0.3175047149330903,-0.4680659139099735 +P 0.31750471493309046,-0.4680659139099735 +P 0.24518019737678892,0.14105859064554405 +P 0.24518019737678892,0.1410585906455441 +P 0.1337014618382204,0.216053384319761 +P 0.1337014618382205,0.21605338431976104 +P -0.5196743788563577,-0.24381508621133063 +P -0.5196743788563577,-0.24381508621133063 +P 0.16145768845022127,-0.18548235309792105 +P 0.16145768845022135,-0.18548235309792097 +P 0.5267956022472777,-0.07806817831728718 +P 0.5267956022472777,-0.07806817831728716 +P 0.2690528801662905,0.007775444056135339 +P 0.2690528801662905,0.00777544405613534 +P 0.7565821160819859,-0.3047749278545374 +P 0.7565821160819859,-0.30477492785453736 +P -0.7016467625353928,0.04470959700747512 +P -0.7016467625353925,0.04470959700747514 +P 0.2415239307661166,0.2972238198129453 +P 0.24152393076611664,0.2972238198129453 +P 0.2284592008150542,-0.6608245027366711 +P 0.2284592008150542,-0.6608245027366711 +P 0.2123088556780684,0.01782161739519142 +P 0.21230885567806848,0.017821617395191426 +P -0.14619514581307758,-0.8833238459080084 +P -0.14619514581307758,-0.8833238459080082 +P 0.1989466009909055,-0.6118402241082294 +P 0.1989466009909055,-0.6118402241082291 +P 0.49059993119084305,-0.16493514201871323 +P 0.4905999311908431,-0.1649351420187132 +P -0.4129648372506063,-0.05944366961592451 +P -0.4129648372506062,-0.059443669615924496 +P 0.586485692893329,0.3271185970911774 +P 0.5864856928933292,0.32711859709117747 +P -0.06023227911161408,-0.7107842875157466 +P -0.06023227911161407,-0.7107842875157466 +P 0.6310359079249456,0.29992699270395096 +P 0.6310359079249456,0.29992699270395107 +P -0.6703089300986523,0.6107470941705689 +P -0.670308930098652,0.6107470941705689 +P 0.5005957282133777,0.01407262429060302 +P 0.500595728213378,0.014072624290603021 +P -0.18934890988546538,-0.9372780070318394 +P -0.1893489098854653,-0.9372780070318394 +P -0.2863087126284564,-0.40444718862380247 +P -0.28630871262845636,-0.4044471886238023 +P 1.190084782443751,0.5322874598725964 +P 1.1900847824437517,0.5322874598725967 +P 0.1341442916393324,-0.8420626196661292 +P 0.13414429163933247,-0.8420626196661289 +P -0.7649861084427345,-0.7071073574041574 +P -0.7649861084427344,-0.7071073574041573 +P -0.362881463482392,0.4530261596665785 +P -0.3628814634823919,0.45302615966657866 +P 0.13437240869925704,0.0763221848731111 +P 0.13437240869925712,0.0763221848731111 +P 1.0481657649638807,-0.004257185833033583 +P 1.0481657649638814,-0.004257185833033581 +P -0.7474948815245823,-0.9786844358659653 +P -0.7474948815245823,-0.9786844358659653 +P 0.12735871993303205,-0.3185548367971229 +P 0.12735871993303208,-0.31855483679712276 +P 0.36855220211615,-0.5588123239347687 +P 0.36855220211615003,-0.5588123239347685 +P -0.18314335566244416,-0.5442250179734792 +P -0.18314335566244408,-0.544225017973479 +P 0.08693873231351551,-0.6447286294698766 +P 0.08693873231351551,-0.6447286294698766 +P -0.05481436374055537,0.20956141264894845 +P -0.05481436374055537,0.2095614126489485 +P -0.27114580055426557,0.12928945128646963 +P -0.2711458005542655,0.12928945128646968 +P -0.4451760474692624,0.46862844610576626 +P -0.4451760474692623,0.4686284461057663 +P 0.1341730804119372,-0.5079494612186458 +P 0.13417308041193723,-0.5079494612186456 +P 0.3257440025696646,0.4153507171529827 +P 0.3257440025696647,0.4153507171529827 +P -1.2231311278955395,0.5704928559937266 +P -1.223131127895539,0.5704928559937269 +P -0.07375248343426033,-0.5524759317685063 +P -0.0737524834342603,-0.5524759317685063 +P -0.6413383012441964,-0.3892879515624541 +P -0.6413383012441963,-0.38928795156245405 +P -0.000884182358095037,-0.003185720596142992 +P -0.0008841823580950368,-0.003185720596142991 +P 0.737566803637365,-0.7615040446353664 +P 0.7375668036373654,-0.761504044635366 +P 0.23446047289831606,0.19035505393365781 +P 0.23446047289831606,0.19035505393365784 +P -0.07211988377390469,-0.13169854040950443 +P -0.07211988377390469,-0.13169854040950443 +P 0.18143877838398617,1.132013860293268 +P 0.18143877838398625,1.1320138602932683 +P -0.22066292105815377,-0.19117568196580417 +P -0.22066292105815372,-0.19117568196580417 +P -0.4347453028054331,0.5888401578252912 +P -0.43474530280543294,0.5888401578252915 +P 0.24005504098930414,0.8021441938204985 +P 0.24005504098930416,0.8021441938204986 +P -0.34929799898447755,-0.261775797658851 +P -0.34929799898447744,-0.26177579765885084 +P 0.3490077668059596,-0.007752337813972554 +P 0.3490077668059597,-0.0077523378139725515 +P -0.6025788068137587,0.46068756636034236 +P -0.6025788068137585,0.4606875663603424 +P -0.7122333712891852,0.26308462754739115 +P -0.7122333712891852,0.26308462754739115 +P 0.15764425398809745,0.18964163728856187 +P 0.15764425398809748,0.18964163728856193 +P 0.1853787174021873,-0.6789040209134625 +P 0.18537871740218737,-0.6789040209134621 +P 0.634911453390334,0.13339968677329644 +P 0.6349114533903343,0.13339968677329647 +P -1.2578415170869763,0.2517963788258869 +P -1.2578415170869757,0.2517963788258869 +P 0.1400845593846478,0.40593141307431857 +P 0.14008455938464787,0.4059314130743186 +P -0.7095485725512902,0.8225233205642902 +P -0.7095485725512899,0.8225233205642903 +P -1.1960848307098382,0.17404679607890605 +P -1.196084830709838,0.17404679607890608 +P 0.21828979413603433,-0.3280264848946596 +P 0.2182897941360344,-0.3280264848946595 +P 0.2662387358530971,0.3568929623829047 +P 0.26623873585309726,0.3568929623829048 +P 0.24305026107578037,-0.23724020319018074 +P 0.24305026107578043,-0.23724020319018066 +P -0.3433832627650342,0.3389417719770061 +P -0.34338326276503406,0.3389417719770061 +P -0.0437269904343551,0.5869495454659391 +P -0.04372699043435508,0.5869495454659392 +P -0.12109570623011018,-0.8772834803160542 +P -0.12109570623011016,-0.8772834803160542 +P 0.09631218123471452,-0.12108887934946555 +P 0.09631218123471456,-0.12108887934946555 +P -0.41811390046020547,0.8465092639539217 +P -0.4181139004602053,0.8465092639539218 +P -0.34396631561394114,0.8358904797678759 +P -0.343966315613941,0.8358904797678759 +P 0.43085589801084057,-0.16054297058369527 +P 0.4308558980108406,-0.1605429705836952 +P -0.19787245165430847,0.8949780141072381 +P -0.19787245165430842,0.8949780141072381 +P -0.5907860100454578,0.18974221311023962 +P -0.5907860100454575,0.18974221311023964 +P -0.5306691342020886,-0.7275053842709899 +P -0.5306691342020886,-0.7275053842709899 +P -0.345074608245379,1.207589321519286 +P -0.34507460824537883,1.207589321519286 +P -0.32302823411726667,0.08250252511437048 +P -0.32302823411726667,0.0825025251143705 +P -0.1000939664088763,-1.056428113867832 +P -0.10009396640887627,-1.056428113867832 +P 0.0057223538613018765,-0.07997801149692216 +P 0.005722353861301878,-0.07997801149692216 +P -1.0232923766303312,0.22905472765407248 +P -1.0232923766303312,0.22905472765407253 +P -0.04071787429636753,0.03839904161757046 +P -0.04071787429636751,0.03839904161757047 +P -0.5114614823431506,-0.0673439850879256 +P -0.5114614823431503,-0.06734398508792559 +P -0.033395285925899576,-0.25197193535594753 +P -0.03339528592589957,-0.2519719353559475 +P -1.3238866550876203,-0.34335648499193994 +P -1.3238866550876196,-0.3433564849919398 +P 0.3098949809621799,-0.692558554406312 +P 0.30989498096218,-0.6925585544063119 +P -0.7778172969650805,-0.7251725696504421 +P -0.7778172969650804,-0.7251725696504421 +P 0.5832467520992983,-0.0005585979375463679 +P 0.5832467520992983,-0.0005585979375463677 +P 0.6402717430536337,-0.24460516745019825 +P 0.6402717430536337,-0.24460516745019825 +P 0.3744231501345624,0.23752933224278633 +P 0.37442315013456257,0.23752933224278638 +P -0.5526534599107001,0.2959174882702319 +P -0.5526534599106999,0.29591748827023195 +P 0.0870980709703463,0.011155933053077993 +P 0.08709807097034632,0.011155933053077997 +P 0.10294466025799387,0.6246279155358483 +P 0.10294466025799387,0.6246279155358484 +P 0.7907530514131953,0.7968130944966136 +P 0.7907530514131955,0.796813094496614 +P -0.06771348768905705,-0.19742894579933645 +P -0.06771348768905704,-0.19742894579933642 +P 1.7336246702438183,-0.08111369728186346 +P 1.7336246702438185,-0.08111369728186343 +P 0.39279504341227045,-0.2803428186493195 +P 0.39279504341227056,-0.2803428186493194 +P -0.3837990187335033,0.5817465996045292 +P -0.38379901873350314,0.5817465996045292 +P -0.15897299229161954,0.2123178635236439 +P -0.15897299229161949,0.21231786352364398 +P 1.2871753315186103,-0.2936546706485327 +P 1.2871753315186105,-0.2936546706485326 +P -0.28157817609809926,0.015215204873323618 +P -0.28157817609809926,0.015215204873323621 +P -0.8407785771058587,0.11715953275528568 +P -0.8407785771058583,0.11715953275528568 +P 0.057427665729494065,0.17741033446395021 +P 0.057427665729494086,0.17741033446395027 +P -0.3919333534914909,-0.8777063099779623 +P -0.3919333534914909,-0.8777063099779623 +P 1.046062759037447,0.12566529633175702 +P 1.0460627590374476,0.1256652963317571 +P 0.05208282489856039,0.23074154552008772 +P 0.05208282489856039,0.23074154552008772 +P 0.3090093991217477,-0.28949051651550656 +P 0.3090093991217478,-0.2894905165155065 +P -0.903992079888195,-0.08968028913527537 +P -0.903992079888195,-0.08968028913527537 +P 0.1114034542194284,-0.1420055490952354 +P 0.11140345421942845,-0.1420055490952354 +P 0.49928483909803145,-1.031860401303775 +P 0.49928483909803145,-1.031860401303775 +P -0.25021332122685536,-0.23430348924020267 +P -0.2502133212268553,-0.23430348924020258 +P 0.45788605189844944,0.008986832993373578 +P 0.45788605189844944,0.008986832993373583 +P 0.9922986143818168,-0.3970601247358978 +P 0.9922986143818171,-0.3970601247358978 +P 0.3242247399299542,0.00883592005445788 +P 0.3242247399299542,0.008835920054457881 +P 0.6104748391149722,-0.1588370496187479 +P 0.6104748391149722,-0.15883704961874784 +P -0.2328772934092499,-0.28654852459626834 +P -0.23287729340924987,-0.28654852459626823 +P 0.2591579326588679,-0.48250620169929226 +P 0.2591579326588679,-0.4825062016992922 +P 0.030769057057074042,-0.6677902182695195 +P 0.030769057057074042,-0.6677902182695192 +P 0.5724668628416123,0.17684659209108886 +P 0.5724668628416124,0.17684659209108886 +P -0.1936816938025718,0.017884183939394893 +P -0.19368169380257177,0.017884183939394897 +P 0.3927424946727771,-0.3589320240798228 +P 0.3927424946727773,-0.35893202407982266 +P -0.13217719866296695,0.4509072577920714 +P -0.13217719866296687,0.4509072577920715 +P 0.7771200989698435,0.07094000492318109 +P 0.7771200989698438,0.07094000492318112 +P -0.043208921594939775,-0.7058014850795868 +P -0.043208921594939755,-0.7058014850795865 +P -0.44161734737621083,0.17508260808335738 +P -0.44161734737621083,0.17508260808335738 +P 0.3111521947954433,0.5211230285003844 +P 0.3111521947954433,0.5211230285003846 +P -0.5089025606249975,-0.08897969566205755 +P -0.5089025606249975,-0.08897969566205753 +P -0.785274533858358,0.2966023384405856 +P -0.785274533858358,0.2966023384405857 +P 0.13643734685972797,-0.5487534801505365 +P 0.136437346859728,-0.5487534801505362 +P -0.5113536157192956,-0.38818343681854633 +P -0.5113536157192953,-0.3881834368185463 +P 0.6482527388360249,-0.3660801422494009 +P 0.6482527388360252,-0.3660801422494007 +P 0.1219550825441264,0.2636220365395331 +P 0.12195508254412644,0.2636220365395332 +P 0.830646565838305,0.05595258169938715 +P 0.8306465658383052,0.055952581699387154 +P 0.02087272912166732,-0.2757601788166507 +P 0.02087272912166733,-0.2757601788166507 +P -0.8969757534742673,-1.0096320440536182 +P -0.8969757534742671,-1.0096320440536182 +P 0.281470556211261,-0.5392051870077439 +P 0.281470556211261,-0.5392051870077438 +P 0.09939015666169382,-0.0010699511947921958 +P 0.09939015666169386,-0.0010699511947921952 +P -0.002256115172019346,-0.04020319566150099 +P -0.0022561151720193458,-0.04020319566150097 +P 0.4504785560293585,0.373102472756903 +P 0.4504785560293585,0.3731024727569031 +P 0.5231672603524817,0.16985255790851625 +P 0.5231672603524821,0.16985255790851628 +P -0.7514640400004967,0.07080018087746165 +P -0.7514640400004965,0.07080018087746165 +P 0.13303832542382837,0.2602273203264872 +P 0.1330383254238284,0.2602273203264874 +P 0.19343395931079577,-0.5502548672222486 +P 0.1934339593107958,-0.5502548672222483 +P -0.20823169078587966,-0.925945416171643 +P -0.20823169078587964,-0.925945416171643 +P -1.0354112179615744,0.9009086420084467 +P -1.035411217961574,0.9009086420084467 +P -0.13833287790394402,0.33595123313495734 +P -0.13833287790394397,0.3359512331349575 +P -0.48681401106341476,0.012840401303908289 +P -0.4868140110634147,0.012840401303908292 +P -0.38580806564875847,-0.3414309718415358 +P -0.3858080656487583,-0.3414309718415357 +P -0.387387928447792,0.3363647167396555 +P -0.387387928447792,0.3363647167396555 +P -0.7289577885281368,0.11000344782305926 +P -0.7289577885281364,0.11000344782305929 +P 0.5996652640170703,-0.3788676471009784 +P 0.5996652640170704,-0.37886764710097826 +P 0.1184108904136601,-0.36481788339618465 +P 0.11841089041366011,-0.36481788339618465 +P -0.030883796635844396,-0.2470002368704879 +P -0.030883796635844393,-0.24700023687048783 +P 0.003754694361758959,-0.19869298401291166 +P 0.0037546943617589594,-0.1986929840129116 +P 0.11693502055240339,0.2098964093295748 +P 0.11693502055240342,0.20989640932957487 +P -0.44372931923544234,0.056472315155220026 +P -0.44372931923544234,0.05647231515522005 +P -0.2835673309912712,-0.5631986234801009 +P -0.2835673309912712,-0.5631986234801006 +P 0.6006827467154858,-0.5932750105917384 +P 0.6006827467154859,-0.593275010591738 +P 0.24363277450292076,-0.14517064380485928 +P 0.24363277450292084,-0.14517064380485925 +P -0.4381173292277971,0.8515765445495456 +P -0.4381173292277971,0.8515765445495457 +P -0.4772264554892779,-0.4558040067081244 +P -0.4772264554892779,-0.4558040067081244 +P 0.42511520260261526,-0.11760098022868892 +P 0.4251152026026154,-0.11760098022868892 +P -0.317536469473846,-0.6047699984659938 +P -0.31753646947384584,-0.6047699984659937 +P -0.47946248289928994,-0.6870741625598951 +P -0.47946248289928994,-0.6870741625598947 +P 0.24756054302633185,0.738575212829874 +P 0.24756054302633188,0.738575212829874 +P 0.30991707565082616,-0.1730076242522987 +P 0.3099170756508263,-0.17300762425229868 +P 0.1762415438802143,-0.45603299469545666 +P 0.17624154388021437,-0.4560329946954566 +P -0.5684090790521096,-0.5323520385817601 +P -0.5684090790521092,-0.5323520385817597 +P 1.1773067064626908,-0.31618798230516987 +P 1.177306706462691,-0.3161879823051697 +P -0.2853416740347503,-0.7541701445620144 +P -0.28534167403475025,-0.7541701445620143 +P -0.3324739283651593,-0.041138670378205386 +P -0.33247392836515915,-0.041138670378205386 +P 1.2664180977863824,-0.7401911722318033 +P 1.2664180977863828,-0.740191172231803 +P 0.4182693143279388,-0.7039334975576141 +P 0.41826931432793885,-0.703933497557614 +P 0.3813359912592416,-1.0453256669790556 +P 0.3813359912592416,-1.0453256669790554 +P 0.6509129030314083,-0.5412696201327558 +P 0.6509129030314084,-0.5412696201327558 +P 0.12018094767199916,0.5279211204926886 +P 0.12018094767199916,0.5279211204926887 +P -0.45305717081196895,0.008198588994697165 +P -0.45305717081196883,0.008198588994697166 +P 1.1671283999119613,-0.15065449704305311 +P 1.167128399911962,-0.1506544970430531 +P -0.9008096320814036,0.1402761647761295 +P -0.9008096320814036,0.14027616477612953 +P -0.33154219658246964,0.2612070104089204 +P -0.3315421965824696,0.2612070104089204 +P -0.03280139984795011,-0.46647401981355685 +P -0.032801399847950094,-0.46647401981355685 +P 0.01502591710973531,-0.5159959791954403 +P 0.015025917109735313,-0.51599597919544 +P 0.08126445056757484,-0.059451961687364746 +P 0.08126445056757486,-0.05945196168736473 +P -0.4257412994811337,-0.20546840486340784 +P -0.4257412994811336,-0.20546840486340776 +P 0.38799639318217627,0.3512270928822726 +P 0.3879963931821764,0.35122709288227266 +P 0.21154693848150546,-0.03634275654418231 +P 0.21154693848150552,-0.0363427565441823 +P -0.23511045964865424,-0.3182820554745927 +P -0.23511045964865424,-0.3182820554745926 +P -0.27930734350964126,-0.34019779603069944 +P -0.27930734350964115,-0.3401977960306993 +P -0.7191434211894179,0.018581718879366438 +P -0.7191434211894179,0.018581718879366448 +P -0.020348708221664874,-0.11541476308320475 +P -0.020348708221664864,-0.11541476308320471 +P -0.869130537954744,0.5168791425703672 +P -0.8691305379547439,0.5168791425703672 +P -0.30797478551715907,0.16894312777393505 +P -0.30797478551715896,0.16894312777393514 +P -0.3412253953512523,-0.13703919671643483 +P -0.3412253953512523,-0.1370391967164348 +P -0.2363788997551411,0.020160959823633195 +P -0.2363788997551411,0.020160959823633202 +P -1.1342573157600304,-1.0490903515949865 +P -1.1342573157600302,-1.0490903515949863 +P -0.7951801524174422,-0.39048765852721024 +P -0.7951801524174421,-0.39048765852721024 +P -0.37682393173602985,-0.7154876526440125 +P -0.37682393173602974,-0.7154876526440123 +P -0.7261698499159233,0.25576182656428276 +P -0.7261698499159229,0.25576182656428287 +P 0.6047122068958138,0.3531321759458359 +P 0.604712206895814,0.35313217594583596 +P -0.3347865534686024,-0.44639370766792674 +P -0.3347865534686024,-0.4463937076679267 +P -0.3162737402922597,-0.6054254978296343 +P -0.3162737402922597,-0.6054254978296342 +P -0.38296113359720985,1.055727844318872 +P -0.38296113359720985,1.0557278443188722 +P -0.002541168924166004,-0.08959542143473792 +P -0.0025411689241660036,-0.08959542143473788 +P -0.46847678028199197,0.3128229066138286 +P -0.4684767802819919,0.3128229066138288 +P -0.7474510887594696,-0.11273520921655422 +P -0.7474510887594695,-0.11273520921655422 +P -0.10138857243233154,0.6540514477632215 +P -0.10138857243233154,0.6540514477632217 +P 0.7025815823095183,-0.6472293123262207 +P 0.7025815823095184,-0.6472293123262207 +P 0.7918249248447928,-0.19424553454596438 +P 0.7918249248447932,-0.19424553454596438 +P 0.054665259285737594,-0.1426160884627486 +P 0.05466525928573761,-0.14261608846274854 +P 0.8678958225451003,0.7680573370722297 +P 0.8678958225451004,0.7680573370722298 +P 0.2527320686719843,-0.10300747956510839 +P 0.25273206867198444,-0.10300747956510836 +P 0.013030931888632663,0.2996259196764839 +P 0.013030931888632665,0.2996259196764839 +P 1.2101948699429645,0.7680276029628541 +P 1.210194869942965,0.7680276029628543 +P 0.001739080834353146,0.7050842932559666 +P 0.0017390808343531463,0.7050842932559666 +P 0.7920805263720672,-0.5649631474553106 +P 0.7920805263720672,-0.5649631474553105 +P 0.25575043599568525,0.0889317006762374 +P 0.25575043599568525,0.08893170067623742 +P 0.09261316731698108,0.2703067174076892 +P 0.0926131673169811,0.27030671740768925 +P -0.5747802180771169,0.08613851106223658 +P -0.5747802180771168,0.08613851106223662 +P 0.40507673833837643,-0.8945358512704514 +P 0.40507673833837643,-0.8945358512704511 +P 0.3856111747477545,-0.11976774680260635 +P 0.3856111747477546,-0.11976774680260632 +P -0.25578702556512617,0.3677566511805598 +P -0.255787025565126,0.36775665118055983 +P -0.20976738975410314,0.6671667928732408 +P -0.20976738975410314,0.6671667928732408 +P -0.21007992057543357,0.11101431938197523 +P -0.21007992057543348,0.11101431938197523 +P -0.5538419739084758,-0.050566470413442005 +P -0.5538419739084757,-0.05056647041344199 +P -0.26983745787555147,-0.005254721629673997 +P -0.2698374578755514,-0.0052547216296739965 +P -0.31654388864740896,0.4356887820490702 +P -0.3165438886474089,0.43568878204907036 +P -0.6124922582532396,-0.22656761299178974 +P -0.6124922582532395,-0.22656761299178974 +P 0.5136728866074527,-0.14672923625352396 +P 0.513672886607453,-0.14672923625352388 +P -0.06100014188022765,-0.07483055132359873 +P -0.06100014188022765,-0.07483055132359868 +P 0.0632389321030824,-0.3727037315430909 +P 0.06323893210308244,-0.3727037315430909 +P -0.6239765829480394,-0.43378186506793615 +P -0.6239765829480394,-0.43378186506793603 +P -0.2962023614106011,-0.24082492622254642 +P -0.296202361410601,-0.24082492622254636 +P -0.08363974045743232,0.4635673337808054 +P -0.08363974045743229,0.4635673337808054 +P -0.07869730556773968,0.7594146318238462 +P -0.07869730556773967,0.7594146318238463 +P 0.559161552723403,0.26005051714491845 +P 0.5591615527234033,0.2600505171449186 +P 0.009099193447173748,-0.8925628969298484 +P 0.00909919344717375,-0.892562896929848 +P -0.01551647656911137,-0.38885814801603924 +P -0.015516476569111365,-0.38885814801603924 +P -0.01567035614455939,-0.3579485826040038 +P -0.015670356144559385,-0.35794858260400375 +P 0.446781462990565,-0.052239411468506664 +P 0.446781462990565,-0.05223941146850665 +P 1.0710389841912518,-0.2731132034289364 +P 1.0710389841912522,-0.2731132034289364 +P 0.23533790163003582,-0.23476194158747798 +P 0.23533790163003585,-0.23476194158747793 +P 0.07915424936926652,0.6036539628377416 +P 0.07915424936926652,0.6036539628377419 +P 0.6311044368999582,-0.6562564634414947 +P 0.6311044368999585,-0.6562564634414947 +P -0.21077148265812098,0.032523815759867236 +P -0.2107714826581209,0.03252381575986725 +P -0.7231240597670221,-0.006544627251553192 +P -0.7231240597670221,-0.006544627251553192 +P -0.08060584759784664,0.13336777305165762 +P -0.08060584759784663,0.13336777305165762 +P 0.48597827619774187,-0.6069162101181359 +P 0.48597827619774203,-0.6069162101181359 +P -0.4507483055292626,0.19434862886898324 +P -0.4507483055292625,0.19434862886898324 +P 0.2827195867383647,-0.22519487430374507 +P 0.2827195867383647,-0.22519487430374502 +P -0.8215093346304647,-0.03268014435976413 +P -0.8215093346304647,-0.03268014435976413 +P -0.11933763497114419,0.25235131805383626 +P -0.11933763497114419,0.25235131805383626 +P -0.050641541900826315,-0.05481336786080909 +P -0.05064154190082631,-0.05481336786080908 +P 0.37639163137503584,-0.04913023720926801 +P 0.37639163137503595,-0.049130237209268006 +P 0.2754899163868257,-1.2892018379461803 +P 0.27548991638682585,-1.28920183794618 +P 0.19113786193208002,-0.49992907513642937 +P 0.1911378619320801,-0.4999290751364293 +P -0.18408107881733532,-0.6738283284096425 +P -0.18408107881733524,-0.6738283284096425 +P 0.26736586776080096,0.35645201936711196 +P 0.2673658677608011,0.35645201936711196 +P 1.1765511302564113,-0.5480893596413949 +P 1.176551130256412,-0.5480893596413949 +P 1.1542398998705217,-0.3147952918363603 +P 1.1542398998705217,-0.3147952918363603 +P -0.6689853024562176,0.8040377543458188 +P -0.6689853024562172,0.804037754345819 +P 0.24120212235388105,-0.07423471553787372 +P 0.2412021223538811,-0.0742347155378737 +P 0.5689391732853385,-0.4334628652354342 +P 0.5689391732853388,-0.43346286523543415 +P -0.4229071860412019,0.11827577249881677 +P -0.4229071860412019,0.11827577249881677 +P -0.5721332694193333,0.26812444739865027 +P -0.5721332694193333,0.26812444739865043 +P -0.14648803653271852,0.4305316791577641 +P -0.1464880365327185,0.43053167915776425 +P 0.05374623984152754,-0.4459959249147729 +P 0.053746239841527564,-0.4459959249147729 +P 0.5896530144495327,0.07735649659442079 +P 0.589653014449533,0.07735649659442081 +P -0.25257596915203095,-0.1831343633500895 +P -0.2525759691520309,-0.18313436335008942 +P 0.6519199000082152,0.8113502122689806 +P 0.6519199000082153,0.811350212268981 +P -0.20987680281715365,0.31018961232143716 +P -0.2098768028171536,0.3101896123214372 +P 0.488852615545995,-0.7694857263920457 +P 0.488852615545995,-0.7694857263920457 +P 0.32498664525642773,0.35466894818618966 +P 0.3249866452564279,0.3546689481861898 +P -0.21867254773101694,0.33653237135631914 +P -0.21867254773101685,0.3365323713563192 +P -0.1628632057456908,0.12513912098254698 +P -0.16286320574569077,0.12513912098254704 +P -0.2482127546806861,0.054592620932045616 +P -0.24821275468068604,0.05459262093204564 +P 0.19972864932719311,0.48470032915534 +P 0.19972864932719311,0.4847003291553401 +P 0.5194203708908046,0.6086898891039105 +P 0.519420370890805,0.6086898891039109 +P 0.19766219439600413,-0.624494348335875 +P 0.1976621943960042,-0.6244943483358748 +P -0.6659766058933296,0.5642507949642299 +P -0.6659766058933294,0.56425079496423 +P 0.6380303702196312,0.7911458327140173 +P 0.6380303702196312,0.7911458327140173 +P -0.2639580944341406,1.0973674142268384 +P -0.26395809443414053,1.0973674142268388 +P -0.013043068475538544,-0.18048505417693753 +P -0.013043068475538539,-0.1804850541769375 +P -0.6177459783187123,-0.2779905668540201 +P -0.6177459783187123,-0.27799056685401996 +P 0.6541020344580163,0.582124792529954 +P 0.6541020344580166,0.5821247925299543 +P -1.0384774049322054,0.8009193618277922 +P -1.0384774049322048,0.8009193618277922 +P -0.1554306169575903,0.44885645072316704 +P -0.15543061695759022,0.4488564507231671 +P -0.21901225075291414,0.029572470395186623 +P -0.21901225075291408,0.029572470395186626 +P 0.06665349581693292,0.2278463140029154 +P 0.06665349581693296,0.22784631400291547 +P -0.18730209014152358,-0.44204961843797247 +P -0.1873020901415235,-0.44204961843797247 +P -0.8954194222707068,-0.09622762051569644 +P -0.8954194222707068,-0.09622762051569644 +P 0.6876813467148475,-0.1006745035590906 +P 0.6876813467148476,-0.10067450355909059 +P 0.8020144882556199,-0.4557444532553835 +P 0.80201448825562,-0.4557444532553834 +P 0.11678579588295551,0.4778013596576872 +P 0.11678579588295553,0.4778013596576872 +P -0.6173779479953273,-0.1463086195272349 +P -0.6173779479953271,-0.1463086195272348 +P 0.04109570275886973,-0.38022576288843984 +P 0.04109570275886973,-0.3802257628884398 +P 0.8314003498756972,-0.48166469434786263 +P 0.8314003498756976,-0.4816646943478625 +P -0.3417449594665635,0.2351852756985343 +P -0.34174495946656336,0.23518527569853434 +P -0.747231864230736,-0.05533196936496787 +P -0.7472318642307357,-0.055331969364967856 +P 0.44786515872763016,-0.8581662077619436 +P 0.4478651587276303,-0.8581662077619435 +P 0.2394196493059546,0.5685962507505915 +P 0.23941964930595466,0.5685962507505915 +P -0.47370747024486054,-0.518217306207919 +P -0.4737074702448605,-0.5182173062079186 +P -0.24686466238928517,0.5140980999371543 +P -0.24686466238928517,0.5140980999371544 +P 0.4465869335283311,-0.37822156772624715 +P 0.4465869335283311,-0.378221567726247 +P 0.7216840280411014,-0.12155234552799939 +P 0.7216840280411017,-0.12155234552799934 +P 0.015204864396908546,0.6376683618342354 +P 0.015204864396908548,0.6376683618342357 +P -0.42393694982300156,-0.5218089477315881 +P -0.42393694982300145,-0.5218089477315878 +P 0.07415078821601045,0.6371956908817733 +P 0.07415078821601047,0.6371956908817734 +P -0.1903574628038755,-0.38684400671343444 +P -0.19035746280387544,-0.38684400671343444 +P -0.3773559131237457,0.0068579608273421355 +P -0.3773559131237457,0.006857960827342137 +P 0.08501466839094085,0.27421860297639405 +P 0.08501466839094089,0.2742186029763941 +P 1.3703190609240201,-0.6705242349995242 +P 1.3703190609240201,-0.6705242349995238 +P 0.22067502222484947,-0.42972719575427676 +P 0.22067502222484955,-0.4297271957542766 +P 0.4496324731373458,-0.5997904924904096 +P 0.44963247313734583,-0.5997904924904094 +P 0.4606769016215748,-0.4028663766293615 +P 0.4606769016215748,-0.4028663766293614 +P 0.20461881450521396,0.23845839738985905 +P 0.20461881450521396,0.2384583973898591 +P -0.177021903697815,0.0017472361069717779 +P -0.17702190369781493,0.0017472361069717785 +P 0.33088666738271627,0.39635242461181414 +P 0.33088666738271644,0.39635242461181425 +P -0.5126793030962896,-0.9816818891160128 +P -0.5126793030962894,-0.9816818891160127 +P -0.20315580021343643,0.25993483522132416 +P -0.2031558002134364,0.2599348352213242 +P 0.01157315314252727,-0.0752286580183012 +P 0.011573153142527272,-0.07522865801830117 +P -0.2122874953702656,1.0455265018271471 +P -0.2122874953702656,1.0455265018271478 +P -0.4118959539781374,0.2565463745780656 +P -0.41189595397813733,0.2565463745780657 +P -0.40504807761153394,-0.826767279687959 +P -0.40504807761153383,-0.8267672796879587 +P 0.8728370056581523,-0.8489146211330629 +P 0.8728370056581523,-0.8489146211330626 +P -0.15484731030271964,0.2978543674333216 +P -0.15484731030271962,0.2978543674333217 +P 0.9598395979151622,-0.021475535817715843 +P 0.9598395979151622,-0.021475535817715833 +P -0.3813769756912948,0.7192828208488169 +P -0.38137697569129464,0.719282820848817 +P 0.21951101473819934,0.6480843500744788 +P 0.21951101473819934,0.6480843500744791 +P -0.3113427744080721,0.045948715073330315 +P -0.31134277440807195,0.045948715073330336 +P -0.16009981684527497,-0.17250123317199526 +P -0.16009981684527497,-0.17250123317199526 +P 0.25568807750253153,0.30423782531372767 +P 0.2556880775025317,0.30423782531372784 +P 0.2534978588720535,0.41258202395216825 +P 0.25349785887205356,0.4125820239521684 +P -0.22823188438717018,0.3555909158613313 +P -0.22823188438717018,0.3555909158613314 +P -0.043847734475191566,0.546988883272136 +P -0.04384773447519155,0.5469888832721362 +P 0.0022848127328267687,0.16581911916150355 +P 0.0022848127328267695,0.16581911916150358 +P -0.9664510167365821,0.5772556019222926 +P -0.9664510167365818,0.5772556019222929 +P 0.19331577714046103,0.16819098929912168 +P 0.1933157771404611,0.16819098929912168 +P 0.880938028512706,1.3996876457175011 +P 0.8809380285127063,1.3996876457175018 +P -0.6403207225525454,0.2297596920614577 +P -0.640320722552545,0.22975969206145774 +P -0.926993144927124,-0.7404608887419831 +P -0.9269931449271237,-0.7404608887419828 +P -0.30368277421537726,-0.5055446699316368 +P -0.3036827742153772,-0.5055446699316366 +P 0.5466694604144853,0.07004761038909013 +P 0.5466694604144854,0.07004761038909016 +P 0.25500851421300097,-0.29367076034138706 +P 0.25500851421300114,-0.29367076034138695 +P 0.15138727668563495,-0.0049418965549759275 +P 0.151387276685635,-0.004941896554975927 +P -0.43887856303510187,0.8136477342030863 +P -0.4388785630351018,0.8136477342030866 +P -0.33880265875092413,-0.31551224415527107 +P -0.33880265875092397,-0.315512244155271 +P 1.377423681456482,0.012704561359672462 +P 1.377423681456482,0.012704561359672462 +P -0.041263422421853435,0.4035844851267748 +P -0.041263422421853414,0.40358448512677497 +P -0.08610165644909173,-0.7986737010728233 +P -0.08610165644909172,-0.7986737010728232 +P 0.3836918938530838,0.8390085156051033 +P 0.38369189385308383,0.8390085156051033 +P -0.17307936456124118,-0.06474709047756155 +P -0.1730793645612411,-0.06474709047756153 +P -0.02753475823767776,-0.15870621273858665 +P -0.02753475823767775,-0.15870621273858657 +P -0.5116996522331295,-0.4553457116638264 +P -0.5116996522331294,-0.45534571166382637 +P 0.6086269804673172,0.015815755110900165 +P 0.6086269804673176,0.015815755110900165 +P -0.3066696359213093,-0.6490796718967194 +P -0.3066696359213093,-0.6490796718967194 +P 0.2573582808012723,0.49429943061451787 +P 0.25735828080127243,0.4942994306145179 +P -0.5573569025227104,0.10864971359925568 +P -0.5573569025227101,0.1086497135992557 +P 0.10100854569812368,-0.5775400700305715 +P 0.10100854569812368,-0.5775400700305712 +P 0.16011849083924728,-0.5182501761924749 +P 0.1601184908392473,-0.5182501761924749 +P 1.1626364195660153,-0.027141868869618918 +P 1.162636419566016,-0.027141868869618915 +P -0.45286020053725284,0.46618578082394724 +P -0.4528602005372528,0.4661857808239473 +P 0.32258327609642495,-0.2102016160014837 +P 0.3225832760964251,-0.21020161600148368 +P -0.4469041249092892,-0.30385833257152894 +P -0.4469041249092891,-0.30385833257152894 +P 0.8377224062973287,-0.5225876068528582 +P 0.8377224062973289,-0.5225876068528581 +P -0.35063350958529577,-0.44521824304962737 +P -0.3506335095852957,-0.44521824304962726 +P 0.042917945172412694,-0.2699072536318396 +P 0.0429179451724127,-0.2699072536318395 +P 0.28617439894992625,-0.6241441143108587 +P 0.28617439894992625,-0.6241441143108584 +P -0.21331655993940007,1.1315954154549954 +P -0.21331655993940002,1.1315954154549959 +P -0.7071603986591413,-0.0587365030909921 +P -0.7071603986591409,-0.0587365030909921 +P -0.43104678259786616,-0.4031905103539523 +P -0.4310467825978661,-0.40319051035395215 +P 0.479647329346727,-0.6208557999362405 +P 0.47964732934672716,-0.6208557999362404 +P -0.27104983788326825,0.005338803231299233 +P -0.2710498378832682,0.0053388032312992354 +P -0.0041329173810210895,0.3935166528530436 +P -0.004132917381021089,0.39351665285304366 diff --git a/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness3.txt b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness3.txt new file mode 100644 index 0000000..9de5a1b --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness3.txt @@ -0,0 +1,71 @@ +# delaunator/robustness3 +P 1.2000108248775223,0.08939813876119695 +P 3.197878575122478,0.08939813876119695 +P 3.9347512248775223,0.08939813876119695 +P 5.932618975122478,0.08939813876119695 +P 6.669491624877522,0.08939813876119695 +P 1.2000108248775223,1.9106018612388114 +P 3.197878575122478,1.9106018612388114 +P 3.9347512248775223,1.9106018612388114 +P 5.932618975122478,1.9106018612388114 +P 6.669491624877522,1.9106018612388114 +P 2.0267626140791766,-0.21046296655057145 +P 2.371126785920824,-0.21046296655057145 +P 4.761503014079176,-0.21046296655057145 +P 5.105867185920824,-0.21046296655057145 +P 7.496243414079176,-0.21046296655057145 +P 2.0267626140791766,2.2104629665505797 +P 2.371126785920824,2.2104629665505797 +P 4.761503014079176,2.2104629665505797 +P 5.105867185920824,2.2104629665505797 +P 7.496243414079176,2.2104629665505797 +P 1.5802128246274927,0.22503184151033584 +P 2.8176765753725075,0.22503184151033584 +P 4.314953224627493,0.22503184151033584 +P 5.552416975372507,0.22503184151033584 +P 7.049693624627492,0.22503184151033584 +P 1.5802128246274927,1.7749681584896724 +P 2.8176765753725075,1.7749681584896724 +P 4.314953224627493,1.7749681584896724 +P 5.552416975372507,1.7749681584896724 +P 7.049693624627492,1.7749681584896724 +P 0.8315745000000003,1.000000000000004 +P 3.5663149,1.000000000000004 +P 3.5663149,1.000000000000004 +P 6.3010553,1.000000000000004 +P 6.3010553,1.000000000000004 +P 0.8315745000000003,1.0000000000000044 +P 3.5663149,1.0000000000000044 +P 3.5663149,1.0000000000000044 +P 6.3010553,1.0000000000000044 +P 6.3010553,1.0000000000000044 +P 0.8315745000000003,-0.488685099999997 +P 3.5663149,-0.488685099999997 +P 3.5663149,-0.488685099999997 +P 6.3010553,-0.488685099999997 +P 6.3010553,-0.488685099999997 +P 0.8315745000000003,2.4886851000000054 +P 3.5663149,2.4886851000000054 +P 3.5663149,2.4886851000000054 +P 6.3010553,2.4886851000000054 +P 6.3010553,2.4886851000000054 +P 2.1989447,-0.61 +P 2.1989447,-0.61 +P 4.9336851,-0.61 +P 4.9336851,-0.61 +P 7.6684255,-0.61 +P 2.1989447,2.6100000000000083 +P 2.1989447,2.6100000000000083 +P 4.9336851,2.6100000000000083 +P 4.9336851,2.6100000000000083 +P 7.6684255,2.6100000000000083 +P 2.1989447,0.878685100000001 +P 2.1989447,0.878685100000001 +P 4.9336851,0.878685100000001 +P 4.9336851,0.878685100000001 +P 7.6684255,0.878685100000001 +P 2.1989447,1.1213149000000073 +P 2.1989447,1.1213149000000073 +P 4.9336851,1.1213149000000073 +P 4.9336851,1.1213149000000073 +P 7.6684255,1.1213149000000073 diff --git a/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness4.txt b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness4.txt new file mode 100644 index 0000000..19d0880 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/delaunator-robustness4.txt @@ -0,0 +1,37 @@ +# delaunator/robustness4 +P -3.0381276552207055,10.481881920449052 +P -2.1931270567413446,11.016647278872279 +P -1.3481264582619854,11.551412637295508 +P -0.5031258597826245,12.086177995718735 +P 0.3418747386967347,12.620943354141964 +P 1.1868753371760938,13.155708712565193 +P -2.5033622967974765,9.63688132196969 +P -1.6583616983181173,10.171646680392918 +P -0.8133610998387582,10.706412038816147 +P 0.03163949864060278,11.241177397239376 +P 0.8766400971199619,11.775942755662605 +P 1.721640695599322,12.310708114085832 +P -1.9685969383742474,8.791880723490332 +P -1.1235963398948883,9.326646081913559 +P -0.2785957414155291,9.861411440336788 +P 0.5664048570638318,10.396176798760017 +P 1.411405455543191,10.930942157183246 +P 2.25640605402255,11.465707515606473 +P -1.4338315799510184,7.9468801250109715 +P -0.5888309814716592,8.4816454834342 +P 0.2561696170076999,9.016410841857429 +P 1.10117021548706,9.551176200280658 +P 1.94617081396642,10.085941558703885 +P 2.791171412445779,10.620706917127112 +P -0.8990662215277911,7.1018795265316115 +P -0.05406562304843021,7.6366448849548405 +P 0.7909349754309281,8.17141024337807 +P 1.635935573910288,8.706175601801297 +P 2.4809361723896473,9.240940960224526 +P 3.3259367708690073,9.775706318647753 +P -0.3643008631045621,6.256878928052252 +P 0.48069973537479704,6.7916442864754805 +P 1.3257003338541562,7.326409644898709 +P 2.1707009323335162,7.861175003321938 +P 3.0157015308128763,8.395940361745165 +P 3.8607021292922354,8.930705720168394 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-bad-hole.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-bad-hole.txt new file mode 100644 index 0000000..d030abf --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-bad-hole.txt @@ -0,0 +1,5 @@ +# earcut/bad-hole +L 810,2828 818,2828 832,2818 844,2806 855,2808 866,2816 867,2824 876,2827 883,2834 875,2834 867,2840 878,2838 889,2844 880,2847 870,2847 860,2864 852,2879 847,2867 810,2828 810,2828 +L 818,2834 823,2833 831,2828 839,2829 839,2837 851,2845 847,2835 846,2827 847,2827 837,2827 840,2815 835,2823 818,2834 818,2834 +L 857,2846 864,2850 866,2839 857,2846 857,2846 +L 848,2863 848,2866 854,2852 846,2854 847,2862 838,2851 838,2859 848,2863 848,2863 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-earcut.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-earcut.txt new file mode 100644 index 0000000..dc36214 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-earcut.txt @@ -0,0 +1,8 @@ +# earcut/earcut +L 1400,340 1633,345 1867,350 2100,356 2333,361 2567,366 2800,371 3033,375 3267,380 3500,384 3733,389 3967,393 4200,397 4433,400 4667,403 4900,407 5133,409 5367,412 5600,414 5833,416 6067,417 6300,418 6533,419 6767,420 7000,420 7233,420 7467,419 7700,418 7933,417 8167,416 8400,414 8633,412 8867,409 9100,407 9333,403 9567,400 9800,397 10033,393 10267,389 10500,384 10733,380 10967,375 11200,371 11433,366 11667,361 11900,356 12133,350 12367,345 12600,340 12737,349 12873,378 13006,424 13136,489 13260,571 13378,670 13488,785 13590,914 13682,1057 13764,1211 13835,1376 13893,1550 13940,1731 13973,1918 13993,2108 14000,2300 13993,2492 13973,2682 13940,2869 13893,3050 13835,3224 13764,3389 13682,3543 13590,3686 13488,3815 13378,3930 13260,4029 13136,4111 13006,4176 12873,4222 12737,4251 12600,4260 12367,4255 12133,4250 11900,4244 11667,4239 11433,4234 11200,4229 10967,4225 10733,4220 10500,4216 10267,4211 10033,4207 9800,4203 9567,4200 9333,4197 9100,4193 8867,4191 8633,4188 8400,4186 8167,4184 7933,4183 7700,4182 7467,4181 7233,4180 7000,4180 6767,4180 6533,4181 6300,4182 6067,4183 5833,4184 5600,4186 5367,4188 5133,4191 4900,4193 4667,4197 4433,4200 4200,4203 3967,4207 3733,4211 3500,4216 3267,4220 3033,4225 2800,4229 2567,4234 2333,4239 2100,4244 1867,4250 1633,4255 1400,4260 1263,4251 1127,4222 994,4176 864,4111 740,4029 622,3930 512,3815 410,3686 318,3543 236,3389 165,3224 107,3050 60,2869 27,2682 7,2492 0,2300 7,2108 27,1918 60,1731 107,1550 165,1376 236,1211 318,1057 410,914 512,785 622,670 740,571 864,489 994,424 1127,378 1263,349 1400,340 +L 1656,1327 1508,1336 1368,1364 1238,1411 1116,1476 1003,1561 899,1664 808,1780 733,1905 675,2038 633,2180 608,2329 600,2487 608,2642 676,2926 736,3056 812,3177 905,3290 1011,3390 1124,3472 1245,3536 1375,3581 1512,3609 1656,3618 1894,3587 2046,3531 2190,3449 2326,3342 2447,3218 2543,3088 2546,3034 2511,2980 2472,2976 2374,3084 2253,3176 2113,3250 1971,3295 1830,3310 1697,3302 1576,3276 1468,3233 1373,3173 1291,3096 1222,3003 1169,2895 1131,2772 1109,2634 1101,2482 1116,2204 2475,2204 2532,2193 2564,2135 2554,2015 2522,1899 2475,1799 2097,1799 2113,1917 2102,1967 2071,2003 1980,2034 1136,2066 1190,1873 1228,1789 1325,1645 1446,1543 1582,1492 1734,1490 1871,1529 1985,1608 2031,1660 2082,1752 2445,1752 2302,1578 2193,1488 2073,1417 1944,1367 1805,1337 1656,1327 +L 3130,1701 3061,1781 3019,1859 3005,1937 3013,1995 3037,2043 3125,2103 3184,2110 3282,2096 3398,2021 3467,1889 3486,1732 3520,1658 3628,1570 3723,1536 3890,1529 3988,1563 4030,1592 4068,1630 4124,1726 4156,1927 4141,2313 3742,2434 3424,2568 3185,2715 3025,2874 2976,2958 2946,3046 2941,3216 2987,3359 3077,3480 3137,3530 3276,3596 3442,3618 3607,3607 3759,3574 3897,3520 4023,3443 4136,3345 4176,3431 4276,3530 4412,3587 4518,3598 4720,3560 4844,3494 4940,3416 4988,3348 4994,3318 4983,3273 4947,3237 4765,3336 4670,3330 4623,3298 4589,3246 4569,3173 4565,2964 4121,2964 4116,3147 4067,3219 3944,3309 3789,3364 3685,3375 3586,3361 3510,3318 3455,3248 3423,3149 3412,3023 3427,2919 3471,2825 3545,2739 3648,2661 3781,2593 4136,2482 4124,2893 4568,2893 4597,1942 4590,1809 4537,1630 4431,1485 4282,1384 4195,1352 3997,1327 3876,1335 3751,1360 3489,1461 3227,1619 3130,1701 +L 5104,3541 5085,3518 5078,3474 5085,3433 5104,3411 5266,3378 5364,3333 5394,3305 5433,3219 5453,3078 5455,2070 5437,1881 5423,1840 5379,1787 5298,1751 5152,1718 5138,1664 5152,1614 5360,1553 5583,1467 5693,1410 5840,1308 5896,1313 5919,1332 5902,1659 6183,1435 6356,1353 6526,1327 6613,1338 6688,1374 6775,1464 6804,1575 6782,1683 6743,1743 6691,1788 6596,1813 6509,1801 6316,1704 6234,1684 6169,1691 6037,1751 5902,1872 5902,2988 5928,3200 5976,3289 6012,3321 6126,3373 6319,3420 6333,3474 6319,3532 6249,3543 5627,3514 5104,3541 +L 7519,3473 7294,3292 7197,3178 7118,3055 7057,2923 7013,2780 6987,2629 6978,2467 6987,2307 7015,2157 7061,2016 7125,1885 7208,1763 7309,1650 7423,1551 7543,1470 7671,1407 7805,1362 8094,1327 8345,1345 8563,1400 8744,1490 8855,1597 8883,1656 8892,1718 8884,1792 8860,1848 8819,1889 8762,1914 8624,1916 8546,1884 8479,1809 8350,1584 8291,1531 8223,1502 8094,1485 7979,1495 7876,1525 7785,1575 7705,1645 7636,1734 7579,1843 7535,1971 7485,2280 7487,2616 7510,2757 7550,2886 7606,3002 7677,3106 7762,3194 7857,3262 7963,3311 8080,3340 8208,3350 8352,3341 8484,3312 8604,3265 8711,3199 8818,3109 8853,3128 8879,3174 8882,3201 8859,3252 8737,3372 8553,3497 8420,3556 8205,3608 8054,3618 7910,3609 7772,3582 7642,3536 7519,3473 +L 11618,3425 11153,3523 10906,3638 10874,3631 10856,3598 10876,3286 10593,3498 10460,3565 10333,3604 10211,3618 10081,3610 9858,3549 9764,3495 9682,3426 9613,3343 9560,3250 9522,3145 9500,3030 9492,1976 9472,1765 9435,1684 9372,1638 9272,1615 9124,1612 9106,1591 9100,1550 9115,1483 9140,1470 9549,1430 9894,1359 9931,1381 9938,2785 9943,2891 9977,3066 10045,3193 10150,3274 10293,3315 10437,3318 10543,3301 10638,3266 10777,3170 10876,3072 10876,1976 10855,1767 10817,1685 10752,1638 10650,1615 10503,1612 10481,1573 10485,1499 10519,1470 10777,1453 11272,1359 11301,1369 11317,1421 11325,3122 11348,3204 11390,3254 11470,3290 11618,3326 11632,3380 11618,3425 +L 12846,3594 12647,3591 12457,3536 12304,3426 12196,3270 12162,3179 12135,2971 12143,1718 12107,1676 11878,1671 11845,1632 11850,1573 11871,1546 12000,1462 12210,1290 12400,1081 12499,948 12557,922 12615,937 12626,962 12606,1436 13336,1436 13377,1457 13397,1521 13390,1655 13377,1682 13336,1703 12597,1684 12597,2874 12610,3042 12650,3172 12716,3265 12809,3321 12929,3340 13088,3325 13303,3243 13333,3260 13355,3313 13326,3382 13171,3493 13015,3560 12846,3594 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-infinite-loop-jhl.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-infinite-loop-jhl.txt new file mode 100644 index 0000000..f27ed62 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-infinite-loop-jhl.txt @@ -0,0 +1,3 @@ +# earcut/infinite-loop-jhl +L -1,2 0,0 2,-1 -1,2 +L 2,-1 0,1e-28 -1,2 2,-1 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-issue142.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue142.txt new file mode 100644 index 0000000..10ac638 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue142.txt @@ -0,0 +1,3 @@ +# earcut/issue142 +L 5.62675358811389,31.94879819160804 -16.369709114391867,28.341954255099814 -10.786562672455382,-1.2779295357476745 10.819423740334923,2.069348113719755 5.62675358811389,31.94879819160804 +L 3.220439475288522,4.197526331591453 5.024815373142793,1.1716264034331543 10.819423740334923,2.069348113719755 5.62675358811389,31.94879819160804 -16.369709114391867,28.341954255099814 -10.786562672455382,-1.2779295357476745 -6.833718161055838,-0.6655405509524673 -8.602352370111433,2.142874784407777 -5.34630560403934,6.768689248602321 -1.4053749889060216,7.453573097663546 3.220439475288522,4.197526331591453 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-issue17.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue17.txt new file mode 100644 index 0000000..e090ce7 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue17.txt @@ -0,0 +1,3 @@ +# earcut/issue17 +L -20037508.34,19971868.877628453 -20037508.34,-19971868.877628453 20037508.34,-19971868.877628453 20037508.34,19971868.877628453 -20037508.34,19971868.877628453 +L 537637.6007702783,5907542.234420554 539500.1483225027,5905165.501947839 538610.3146341922,5905217.430281373 538040.6306361248,5906132.0755739985 538068.958329954,5906571.138846622 537711.0379352621,5906645.06648362 537629.886026485,5907533.69114742 537637.6007702783,5907542.234420554 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-issue83.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue83.txt new file mode 100644 index 0000000..9750582 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-issue83.txt @@ -0,0 +1,4 @@ +# earcut/issue83 +L 0,0 4000,0 4000,4000 0,4000 0,0 +L 0,0 4000,0 4000,4000 0,4000 0,0 +L -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 -1,-1 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-3.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-3.txt new file mode 100644 index 0000000..9a697bb --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-3.txt @@ -0,0 +1,24 @@ +# earcut/self-tangent-3 +L 731,1513 739,1506 731,1490 723,1489 733,1481 720,1475 723,1465 714,1475 701,1473 708,1472 708,1459 718,1457 723,1445 801,1445 805,1451 805,1445 853,1445 868,1460 868,1529 853,1528 851,1538 836,1536 826,1544 837,1559 847,1557 853,1548 862,1548 860,1555 868,1553 868,1559 860,1557 860,1570 845,1574 841,1568 832,1574 822,1569 822,1578 807,1567 792,1567 799,1565 797,1557 784,1561 784,1572 746,1572 748,1561 731,1555 731,1536 723,1536 725,1521 713,1508 723,1506 723,1513 731,1513 +L 841,1568 851,1559 841,1559 841,1568 +L 837,1559 830,1563 837,1565 837,1559 +L 799,1529 786,1534 789,1540 782,1551 792,1555 797,1538 815,1534 813,1529 801,1529 805,1521 799,1521 799,1529 +L 769,1567 777,1561 769,1561 769,1567 +L 762,1555 758,1561 752,1557 752,1563 764,1565 762,1555 +L 847,1502 851,1517 834,1517 828,1523 853,1528 853,1515 862,1517 860,1506 847,1502 +L 801,1515 811,1523 815,1517 809,1513 820,1513 824,1519 828,1513 822,1512 822,1504 807,1504 801,1515 +L 813,1538 807,1550 826,1544 828,1540 813,1538 +L 760,1532 752,1534 761,1536 760,1532 +L 769,1519 769,1530 792,1529 792,1521 773,1525 769,1519 +L 731,1513 729,1521 739,1521 737,1513 731,1513 +L 742,1512 740,1525 746,1525 742,1512 +L 739,1491 739,1498 746,1498 746,1491 739,1491 +L 815,1481 818,1491 822,1483 815,1481 +L 834,1470 834,1477 843,1475 834,1470 +L 750,1500 742,1506 753,1505 750,1500 +L 837,1508 837,1515 845,1515 837,1508 +L 752,1483 744,1487 754,1489 752,1483 +L 754,1508 754,1513 761,1512 754,1508 +L 853,1481 860,1483 855,1479 859,1475 853,1475 853,1481 +L 733,1460 727,1464 733,1468 733,1460 +L 739,1491 739,1483 733,1491 739,1491 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-4.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-4.txt new file mode 100644 index 0000000..bc28d82 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-self-tangent-4.txt @@ -0,0 +1,274 @@ +# earcut/self-tangent-4 +L 248,3883 243,3890 216,3888 206,3854 182,3856 170,3832 171,3854 161,3856 168,3872 183,3873 210,3916 198,3915 206,3919 199,3931 190,3928 201,3935 195,3941 205,3940 192,3946 201,3953 196,3973 171,3993 175,3999 152,3992 158,3966 173,3960 182,3975 190,3955 185,3948 165,3959 156,3952 139,3987 125,3983 96,3997 63,4027 59,4018 44,4046 56,4059 67,4045 69,4060 33,4094 97,4098 90,4116 97,4120 96,4105 111,4103 128,4085 110,4083 102,4096 98,4089 108,4077 102,4055 110,4046 100,4038 113,4025 114,4009 130,3998 188,4002 208,3958 219,3960 225,3982 215,3977 204,3985 225,3987 216,3996 224,4010 218,4022 233,4037 219,4037 225,4062 218,4074 241,4070 239,4042 258,4065 273,4067 256,4098 289,4124 285,4132 304,4132 294,4137 301,4159 312,4160 245,4160 222,4160 220,4153 229,4152 220,4142 215,4160 185,4160 186,4149 163,4158 155,4148 154,4157 147,4148 133,4160 -31,4160 -25,4139 -35,4134 -33,4125 -22,4122 -12,4137 -15,4118 6,4114 22,4098 -19,4092 -10,4090 -31,4079 -30,4102 -44,4085 -47,4100 -52,4090 -64,4090 -64,4053 -62,4059 -48,4049 -44,4058 -34,4044 -38,4016 -30,4013 -48,4015 -51,4026 -59,4022 -64,4050 -64,4003 -55,4008 -56,3995 -64,4002 -55,3986 -64,3989 -64,3962 -42,3947 -64,3951 -64,3892 -32,3881 -47,3881 -43,3868 -64,3890 -64,3741 -54,3738 -53,3708 -34,3688 -6,3690 -11,3682 13,3671 24,3652 48,3650 29,3643 31,3632 52,3619 43,3618 44,3600 78,3586 71,3593 82,3593 79,3585 86,3582 68,3574 56,3547 42,3558 46,3590 30,3597 23,3582 29,3516 23,3517 22,3492 37,3449 61,3449 77,3434 70,3443 86,3452 73,3463 84,3473 120,3468 131,3482 130,3466 139,3483 153,3487 168,3510 158,3522 142,3521 150,3568 169,3543 192,3549 199,3539 196,3550 208,3559 193,3578 193,3598 176,3601 181,3596 173,3589 157,3589 167,3610 147,3617 167,3630 174,3653 187,3662 219,3659 213,3678 203,3681 203,3708 218,3724 211,3734 223,3731 228,3739 220,3770 238,3791 250,3782 249,3758 266,3753 258,3744 260,3723 275,3722 237,3691 254,3682 248,3679 267,3679 284,3696 295,3690 291,3669 253,3657 266,3643 293,3639 281,3637 281,3627 292,3625 294,3602 268,3591 300,3581 278,3564 263,3577 242,3552 255,3547 259,3525 267,3531 265,3518 275,3529 284,3520 288,3512 276,3504 281,3494 270,3502 256,3493 238,3499 229,3486 221,3498 218,3490 203,3490 212,3466 244,3457 243,3448 226,3443 208,3450 180,3424 198,3431 218,3407 216,3390 208,3409 198,3392 139,3383 131,3355 118,3353 110,3372 98,3366 112,3358 105,3349 117,3321 140,3313 159,3335 147,3318 172,3322 163,3360 154,3355 152,3359 182,3369 212,3362 228,3378 237,3369 238,3417 279,3335 302,3329 309,3351 340,3361 352,3353 342,3326 324,3336 315,3328 321,3326 290,3320 255,3333 237,3328 236,3310 259,3300 287,3307 316,3289 345,3295 346,3285 336,3281 342,3252 315,3251 314,3226 305,3219 321,3197 314,3181 275,3158 278,3138 292,3152 289,3162 302,3161 298,3154 311,3146 323,3165 334,3155 345,3168 352,3153 411,3160 397,3140 408,3135 404,3127 396,3140 385,3132 407,3114 384,3123 374,3109 401,3105 416,3117 442,3100 471,3104 463,3075 483,3070 480,3079 491,3064 521,3062 526,3051 544,3054 539,3074 555,3062 580,3079 576,3086 583,3081 596,3091 600,3078 613,3081 619,3072 598,3077 581,3054 582,3039 580,3047 566,3047 552,3030 557,3010 570,3021 595,3018 604,3026 596,3034 612,3048 604,3030 612,3037 619,3023 611,3032 596,3015 574,3010 574,2980 531,3005 587,2943 633,2934 664,2895 673,2898 661,2912 675,2928 656,2940 677,2952 664,2975 675,2984 675,2965 699,2975 702,2956 718,2978 740,2969 744,2987 784,2989 784,2981 794,2992 793,3008 804,3006 807,3017 818,2999 858,2997 884,3010 904,2999 925,3001 934,2988 951,3010 947,3068 911,3052 927,3077 940,3081 937,3106 880,3098 869,3059 856,3065 865,3082 851,3090 866,3090 867,3106 884,3107 906,3128 910,3154 843,3150 853,3133 843,3125 820,3140 812,3130 788,3144 776,3139 764,3162 751,3164 752,3186 734,3201 758,3191 771,3155 790,3151 817,3160 827,3173 819,3178 845,3184 851,3194 824,3198 834,3223 815,3219 802,3228 799,3221 782,3230 798,3199 786,3194 799,3181 785,3175 777,3201 730,3255 734,3237 716,3227 710,3198 732,3155 754,3142 727,3128 708,3136 708,3145 688,3141 680,3152 667,3142 674,3151 663,3157 667,3170 679,3160 702,3226 687,3231 683,3268 652,3277 607,3274 621,3286 684,3273 674,3278 675,3294 662,3310 640,3309 641,3339 613,3338 614,3347 589,3360 588,3375 572,3387 586,3401 577,3410 617,3426 626,3419 621,3413 655,3417 649,3435 681,3448 668,3456 690,3452 708,3473 720,3463 724,3438 712,3436 713,3410 721,3409 712,3399 696,3418 669,3415 665,3423 655,3409 664,3396 654,3393 647,3403 628,3395 603,3399 596,3391 621,3379 593,3370 606,3359 621,3365 615,3347 640,3346 700,3293 705,3304 721,3292 722,3324 740,3331 733,3355 715,3364 714,3352 712,3364 705,3359 711,3352 687,3340 677,3349 668,3350 669,3340 654,3346 687,3370 705,3367 699,3375 708,3378 713,3370 736,3373 734,3388 757,3390 763,3404 752,3407 754,3416 737,3414 728,3423 737,3425 737,3459 748,3468 741,3473 756,3486 755,3463 775,3440 792,3438 796,3418 768,3410 762,3394 775,3391 755,3368 772,3371 772,3343 781,3349 791,3337 803,3341 823,3323 831,3330 834,3321 792,3298 797,3280 815,3270 814,3254 821,3251 830,3267 834,3250 868,3250 864,3257 869,3253 873,3264 859,3304 882,3318 899,3320 900,3309 919,3317 905,3316 901,3332 892,3326 884,3336 848,3325 855,3320 849,3315 837,3320 870,3348 855,3360 863,3364 848,3366 851,3374 868,3381 864,3365 878,3366 882,3357 903,3365 915,3352 930,3365 924,3380 935,3380 936,3394 951,3404 921,3411 915,3388 909,3396 890,3383 895,3399 887,3412 861,3393 866,3408 874,3405 869,3418 887,3422 901,3410 915,3438 940,3421 928,3413 954,3418 944,3427 933,3487 910,3491 917,3499 892,3479 877,3494 874,3512 904,3500 904,3520 923,3521 913,3558 894,3556 884,3573 868,3564 863,3576 882,3602 883,3574 902,3581 908,3597 915,3581 938,3594 949,3583 935,3583 921,3562 932,3553 952,3490 998,3472 1012,3478 1011,3492 1015,3483 1033,3487 1031,3475 1017,3482 1031,3446 1043,3447 1053,3474 1085,3477 1093,3492 1088,3507 1079,3508 1097,3550 1105,3550 1099,3528 1112,3501 1115,3517 1138,3531 1144,3512 1132,3494 1159,3490 1151,3482 1137,3491 1126,3487 1134,3441 1120,3428 1124,3413 1135,3411 1116,3407 1115,3425 1106,3419 1099,3427 1104,3439 1079,3447 1069,3468 1058,3436 1065,3428 1055,3416 1060,3405 1030,3380 1042,3369 1048,3374 1050,3357 1069,3354 1077,3322 1098,3306 1111,3323 1091,3347 1107,3359 1099,3366 1100,3395 1111,3403 1117,3384 1136,3374 1148,3389 1136,3411 1159,3420 1164,3449 1184,3450 1197,3443 1161,3419 1175,3389 1177,3398 1192,3378 1211,3397 1190,3400 1201,3402 1210,3419 1220,3409 1245,3441 1245,3458 1224,3466 1238,3485 1221,3480 1226,3495 1235,3488 1238,3502 1250,3504 1250,3517 1240,3526 1230,3510 1217,3508 1203,3527 1196,3521 1180,3561 1187,3573 1212,3560 1239,3580 1250,3564 1250,3541 1276,3546 1262,3515 1273,3390 1285,3399 1280,3412 1289,3450 1310,3436 1296,3406 1350,3382 1349,3370 1322,3379 1297,3368 1347,3329 1365,3360 1359,3370 1377,3377 1358,3409 1412,3403 1445,3425 1432,3454 1413,3460 1413,3487 1435,3506 1433,3533 1413,3563 1361,3568 1345,3561 1339,3549 1380,3546 1370,3542 1398,3502 1386,3498 1354,3503 1356,3518 1336,3543 1321,3536 1318,3519 1291,3555 1383,3585 1415,3583 1409,3602 1423,3602 1406,3630 1416,3632 1423,3650 1408,3645 1401,3653 1419,3660 1418,3668 1444,3662 1455,3672 1434,3695 1442,3700 1471,3670 1475,3679 1528,3675 1527,3687 1544,3699 1540,3708 1530,3704 1536,3731 1529,3721 1524,3733 1521,3724 1515,3732 1517,3752 1494,3752 1509,3754 1515,3769 1490,3794 1479,3793 1485,3798 1455,3826 1424,3807 1412,3775 1412,3792 1401,3803 1406,3823 1433,3848 1446,3838 1475,3856 1477,3874 1486,3863 1489,3872 1520,3875 1523,3895 1491,3887 1486,3894 1497,3896 1500,3922 1523,3909 1520,3941 1529,3949 1545,3931 1553,3940 1557,3982 1578,3979 1574,3995 1594,3996 1582,3975 1591,3955 1572,3950 1579,3958 1565,3971 1571,3961 1557,3946 1572,3942 1563,3930 1571,3898 1582,3912 1599,3910 1559,3887 1567,3866 1576,3867 1567,3838 1582,3823 1570,3805 1570,3781 1589,3776 1584,3761 1587,3753 1593,3740 1616,3741 1628,3730 1674,3736 1676,3748 1679,3739 1700,3754 1699,3764 1713,3763 1710,3798 1720,3796 1722,3804 1727,3797 1753,3813 1759,3803 1783,3804 1779,3796 1747,3802 1716,3766 1770,3784 1779,3781 1762,3771 1773,3751 1830,3742 1819,3746 1819,3756 1809,3750 1801,3760 1811,3762 1799,3771 1812,3776 1805,3786 1828,3783 1822,3796 1831,3795 1855,3821 1867,3813 1867,3834 1853,3842 1859,3825 1846,3836 1849,3844 1837,3846 1843,3853 1835,3849 1830,3857 1838,3856 1824,3863 1833,3890 1813,3901 1819,3912 1806,3908 1781,3924 1783,3912 1775,3917 1783,3946 1754,3944 1772,3949 1766,3968 1750,3977 1750,3970 1739,3972 1742,3980 1716,3979 1724,3987 1745,3985 1734,4010 1754,4003 1746,4012 1754,4009 1768,4032 1760,4050 1732,4076 1728,4071 1720,4087 1707,4072 1716,4072 1706,4068 1711,4053 1706,4064 1692,4061 1693,4074 1701,4072 1649,4133 1641,4132 1650,4119 1638,4077 1624,4066 1611,4095 1634,4110 1637,4142 1625,4146 1615,4114 1605,4111 1615,4131 1606,4134 1609,4155 1626,4151 1627,4160 1530,4160 1520,4154 1541,4150 1523,4125 1539,4095 1526,4059 1543,4043 1525,4029 1543,4004 1523,4006 1504,3962 1465,3963 1453,3955 1452,3969 1465,3965 1497,3987 1507,4019 1491,4035 1518,4036 1522,4048 1506,4088 1527,4107 1497,4149 1471,4157 1465,4148 1481,4149 1481,4126 1471,4139 1455,4141 1461,4150 1441,4148 1447,4119 1425,4118 1419,4084 1410,4092 1376,4088 1376,4063 1386,4062 1373,4051 1359,4055 1372,4061 1369,4090 1417,4102 1421,4160 1311,4160 1311,4131 1306,4160 1273,4160 1138,4160 1145,4140 1169,4150 1137,4123 1124,4160 1113,4160 1120,4145 1094,4136 1084,4146 1099,4160 1075,4160 1077,4143 1074,4150 1046,4151 1052,4160 904,4160 925,4136 923,4126 897,4153 880,4143 883,4157 895,4160 856,4160 856,4153 855,4160 594,4160 577,4148 572,4160 496,4160 490,4152 503,4146 497,4124 474,4134 475,4160 412,4160 389,4144 417,4122 403,4121 409,4084 393,4077 402,4078 396,4065 414,4050 401,4043 402,4033 384,4082 350,4112 352,4124 334,4093 343,4081 333,4081 333,4065 322,4059 331,4036 304,4038 302,4019 294,4024 299,4037 290,4028 269,4036 258,4024 248,4045 233,4033 227,3993 247,4003 258,3995 231,3969 237,3959 227,3942 247,3935 258,3915 284,3910 302,3890 318,3892 317,3920 327,3928 331,3887 315,3871 356,3859 351,3850 361,3836 351,3833 370,3833 381,3816 391,3819 378,3811 383,3802 421,3793 384,3788 365,3800 354,3788 343,3802 335,3786 308,3818 341,3814 341,3815 346,3839 326,3838 294,3882 283,3884 283,3875 253,3863 251,3844 261,3839 253,3817 256,3808 241,3829 255,3828 250,3839 239,3840 253,3865 242,3868 251,3875 240,3874 244,3871 234,3875 234,3887 248,3883 +L 169,4110 177,4149 181,4115 169,4110 +L 264,4142 245,4160 263,4152 264,4142 +L 215,3836 211,3849 219,3847 215,3836 +L 179,4007 166,4011 171,4018 158,4029 161,4039 148,4045 158,4055 136,4087 138,4111 124,4122 123,4135 134,4119 145,4126 159,4121 160,4104 174,4095 161,4059 171,4056 162,4047 163,4029 184,4011 179,4007 +L 243,4117 233,4118 234,4127 243,4117 +L 341,3815 331,3819 337,3824 341,3815 +L 614,4129 612,4150 595,4159 621,4152 614,4129 +L 213,4108 214,4119 219,4113 213,4108 +L 183,4100 183,4118 191,4101 183,4100 +L 247,4086 246,4097 255,4098 247,4086 +L 718,4132 707,4138 717,4146 718,4132 +L 207,4058 201,4068 212,4071 207,4058 +L 857,4135 859,4142 869,4136 857,4135 +L 757,4122 734,4125 753,4130 757,4122 +L 216,4047 194,4049 212,4059 216,4047 +L 1025,4126 1010,4130 1014,4146 1028,4143 1025,4126 +L 926,4092 931,4115 923,4126 944,4124 958,4143 979,4131 970,4105 955,4094 926,4092 +L 1268,4151 1273,4160 1277,4154 1268,4151 +L 22,3934 17,3938 29,3952 39,3953 22,3934 +L 130,3915 118,3931 130,3941 120,3942 156,3952 147,3932 130,3915 +L -1,3939 -39,3946 -16,3949 -1,3939 +L 994,4115 997,4126 1002,4119 994,4115 +L 26,3884 9,3894 30,3908 26,3884 +L 144,3887 140,3903 152,3902 151,3889 144,3887 +L 87,3864 84,3890 92,3882 87,3864 +L 8,3866 -8,3875 10,3873 8,3866 +L 89,3850 88,3859 100,3860 99,3851 89,3850 +L 92,3833 84,3836 101,3837 102,3850 105,3834 92,3833 +L -18,3830 -27,3831 -25,3842 -18,3830 +L 601,4117 597,4125 610,4123 601,4117 +L -46,3755 -52,3762 -34,3804 -61,3829 -10,3796 -27,3796 -17,3767 -46,3755 +L 120,3805 130,3820 142,3811 148,3816 149,3807 120,3805 +L 658,4067 652,4069 668,4083 669,4104 685,4102 689,4124 691,4082 670,4083 658,4067 +L 183,3797 185,3810 195,3803 183,3797 +L 262,3795 242,3796 256,3808 262,3795 +L 104,3790 94,3793 109,3800 104,3790 +L 1079,3400 1069,3407 1090,3408 1079,3400 +L 173,3775 165,3788 174,3785 173,3775 +L 1375,4132 1375,4147 1389,4155 1375,4132 +L 1175,4107 1186,4124 1186,4110 1175,4107 +L 1330,4017 1302,4023 1310,4027 1302,4072 1293,4080 1302,4085 1296,4118 1308,4123 1307,4115 1303,4112 1312,4035 1319,4033 1327,4049 1328,4042 1343,4044 1324,4039 1322,4023 1330,4017 +L 850,4097 844,4114 855,4115 850,4097 +L 365,4036 355,4046 333,4038 341,4052 352,4052 365,4036 +L 1290,4081 1278,4082 1284,4093 1290,4081 +L 749,4075 742,4080 749,4090 749,4075 +L 874,3953 861,3985 843,3975 843,3954 819,3953 810,3963 831,3988 861,3986 855,3997 864,4033 829,4051 849,4070 841,4085 852,4089 864,4085 857,4080 874,4049 869,4022 902,4015 899,3982 882,3981 874,3953 +L 923,4069 914,4082 922,4087 923,4069 +L 1231,4018 1208,4025 1199,4085 1213,4068 1212,4053 1228,4045 1231,4018 +L 1055,4001 1045,4023 1027,4023 1012,4040 993,4043 998,4051 989,4047 990,4056 982,4056 982,4048 973,4059 1002,4083 1033,4038 1052,4033 1053,4017 1071,4009 1055,4001 +L 1648,4066 1641,4076 1654,4072 1648,4066 +L 481,3986 472,3987 465,4016 475,4025 461,4030 461,4064 483,4070 483,4060 507,4058 500,4032 475,4016 484,3998 481,3986 +L 1074,4049 1080,4069 1116,4061 1074,4049 +L 904,4043 924,4063 938,4058 904,4043 +L 434,4046 418,4052 423,4060 434,4046 +L 808,4045 807,4056 815,4050 808,4045 +L 1553,4134 1544,4139 1561,4142 1553,4134 +L 657,3985 646,3987 630,3999 646,4017 625,4027 640,4040 639,4028 657,4028 694,4044 701,4029 682,4014 685,3999 664,4008 657,3985 +L 1576,4126 1574,4137 1581,4130 1576,4126 +L 1590,4095 1575,4106 1583,4128 1605,4111 1608,4097 1590,4095 +L 591,4029 592,4038 599,4036 591,4029 +L 722,3985 736,4002 726,4009 746,4002 745,4017 756,4018 752,4030 767,4032 774,4021 758,3994 748,4002 722,3985 +L 1414,3995 1410,4005 1421,4025 1414,3995 +L 1231,3989 1231,4018 1253,4013 1251,4023 1261,4024 1254,4018 1259,4001 1231,3989 +L 1440,4014 1438,4022 1447,4017 1440,4014 +L 1378,4005 1352,4010 1349,4021 1374,4017 1378,4005 +L 1608,4019 1599,4046 1586,4043 1591,4080 1609,4042 1624,4056 1624,4046 1609,4038 1608,4019 +L 1391,4012 1410,4005 1379,4005 1391,4012 +L 290,3996 285,4005 298,4010 290,3996 +L 1630,4042 1627,4056 1642,4055 1630,4042 +L 572,3957 552,3979 561,3987 563,3999 571,3998 558,4008 573,4001 578,4008 592,3997 581,3986 593,3975 572,3957 +L 1558,4039 1555,4047 1564,4053 1573,4046 1558,4039 +L 276,3947 255,3969 294,3974 292,3992 307,3984 300,3992 314,3990 323,4004 340,4005 338,3995 347,3999 360,3987 354,3978 328,3997 305,3977 315,3967 311,3955 297,3953 295,3961 283,3954 276,3947 +L 1655,4022 1662,4036 1667,4029 1655,4022 +L 1574,3995 1561,4004 1559,4019 1547,4020 1548,4029 1556,4032 1574,3995 +L 1748,4013 1748,4020 1755,4017 1748,4013 +L 1666,3960 1648,3984 1637,3981 1641,3988 1622,3990 1611,4006 1595,3998 1591,4010 1618,4012 1626,4001 1646,4013 1660,4010 1643,4002 1661,3994 1649,3988 1677,3965 1666,3960 +L 903,3631 914,3645 916,3636 903,3631 +L 1032,3968 1037,3973 1027,3983 1045,3992 1054,3971 1032,3968 +L 1679,3968 1679,3981 1687,3979 1679,3968 +L 1228,3973 1221,3984 1227,3987 1228,3973 +L 981,3973 969,3979 979,3981 981,3973 +L 494,3964 489,3978 500,3970 494,3964 +L 1208,3957 1203,3976 1220,3965 1208,3957 +L 1650,3790 1613,3799 1625,3812 1638,3811 1636,3855 1649,3862 1651,3877 1659,3873 1686,3896 1678,3900 1673,3940 1644,3934 1655,3939 1659,3955 1663,3939 1699,3961 1705,3950 1698,3936 1735,3926 1738,3934 1746,3931 1757,3913 1736,3917 1746,3909 1738,3895 1738,3911 1728,3901 1719,3912 1690,3898 1724,3879 1718,3868 1715,3880 1698,3888 1681,3876 1677,3887 1660,3866 1683,3867 1682,3851 1669,3849 1665,3860 1658,3852 1669,3819 1672,3830 1685,3824 1705,3834 1692,3816 1675,3817 1688,3805 1668,3816 1650,3790 +L 756,3779 748,3792 720,3795 728,3817 719,3825 735,3829 726,3849 736,3908 716,3925 690,3918 693,3935 714,3941 705,3951 717,3966 710,3955 746,3918 748,3892 758,3893 744,3888 742,3861 778,3865 751,3846 754,3825 746,3825 743,3806 766,3801 768,3790 749,3792 756,3779 +L 1118,3946 1110,3949 1122,3965 1118,3946 +L 1185,3955 1172,3959 1178,3964 1185,3955 +L 372,3957 367,3962 376,3963 372,3957 +L 802,3944 797,3950 805,3950 802,3944 +L 813,3927 808,3932 806,3950 813,3927 +L 1249,3913 1252,3947 1271,3942 1270,3924 1249,3913 +L 1042,3940 1036,3945 1045,3947 1042,3940 +L 1433,3848 1365,3891 1402,3906 1415,3922 1422,3920 1420,3896 1430,3896 1432,3913 1443,3920 1407,3926 1418,3945 1451,3918 1431,3887 1445,3871 1428,3862 1433,3848 +L 426,3901 414,3905 420,3917 412,3928 425,3924 424,3940 442,3931 427,3922 426,3901 +L 659,3915 639,3923 641,3934 659,3915 +L 1161,3922 1190,3930 1202,3918 1199,3908 1209,3915 1212,3907 1199,3900 1191,3919 1161,3922 +L 687,3862 695,3874 682,3883 668,3878 685,3888 668,3908 680,3913 678,3927 695,3890 714,3882 686,3886 706,3869 701,3864 687,3862 +L 1651,3883 1605,3909 1634,3925 1642,3910 1655,3905 1658,3912 1651,3883 +L 983,3903 988,3923 997,3916 998,3924 1009,3924 1011,3917 983,3903 +L 837,3906 827,3918 840,3924 843,3916 836,3918 837,3906 +L 620,3904 616,3920 625,3918 620,3904 +L 1012,3916 1028,3898 1019,3898 1012,3916 +L 1293,3901 1286,3903 1295,3912 1293,3901 +L 866,3854 845,3870 852,3885 844,3892 845,3911 850,3897 872,3889 866,3854 +L 798,3901 793,3909 800,3911 809,3908 798,3901 +L 1212,3869 1208,3880 1202,3877 1215,3907 1238,3905 1217,3904 1232,3882 1227,3875 1221,3882 1212,3869 +L 605,3892 600,3897 611,3907 605,3892 +L 1066,3894 1060,3905 1070,3901 1066,3894 +L 945,3873 953,3904 959,3902 961,3880 945,3873 +L 586,3895 590,3904 599,3900 586,3895 +L 663,3888 651,3895 658,3900 663,3888 +L 1122,3879 1115,3889 1120,3899 1147,3898 1143,3889 1124,3896 1122,3879 +L 913,3884 904,3895 895,3888 885,3891 907,3897 913,3884 +L 592,3882 591,3883 583,3892 594,3895 592,3882 +L 1124,3832 1104,3833 1096,3846 1078,3833 1071,3837 1082,3845 1066,3846 1066,3858 1054,3845 1045,3866 1029,3860 1032,3886 1051,3894 1052,3884 1060,3892 1078,3875 1089,3892 1098,3891 1098,3880 1088,3881 1102,3853 1097,3847 1144,3861 1157,3839 1140,3835 1137,3846 1124,3832 +L 539,3804 531,3805 525,3813 525,3808 503,3839 549,3847 520,3851 520,3867 479,3872 503,3892 530,3893 533,3879 551,3880 563,3862 554,3860 558,3849 574,3834 551,3849 552,3839 536,3831 543,3825 526,3826 525,3815 537,3812 539,3804 +L 1463,3879 1466,3890 1468,3883 1463,3879 +L 583,3865 585,3888 591,3883 585,3868 583,3865 +L 1724,3879 1740,3888 1742,3881 1724,3879 +L 906,3821 896,3883 906,3870 905,3836 906,3821 +L 941,3871 936,3875 944,3872 941,3871 +L 422,3848 420,3857 410,3855 427,3872 422,3848 +L 939,3850 927,3872 941,3865 939,3850 +L 406,3860 409,3870 412,3863 406,3860 +L 610,3854 584,3862 585,3868 610,3854 +L 448,3860 433,3862 444,3868 448,3860 +L 640,3832 614,3860 624,3867 639,3855 640,3832 +L 462,3853 454,3857 465,3867 462,3853 +L 1016,3821 1001,3825 1010,3830 1002,3844 966,3849 950,3837 939,3850 950,3840 958,3853 989,3847 995,3864 1019,3861 1000,3862 1014,3849 1016,3821 +L 1746,3852 1744,3861 1752,3861 1746,3852 +L 518,3850 510,3856 515,3861 518,3850 +L 585,3831 600,3856 609,3845 585,3831 +L 1740,3840 1733,3846 1746,3852 1740,3840 +L 1807,3829 1809,3848 1827,3833 1807,3829 +L 1195,3836 1190,3846 1204,3846 1195,3836 +L 1168,3833 1157,3839 1170,3839 1168,3833 +L 594,3820 580,3824 585,3831 594,3820 +L 1791,3803 1783,3804 1807,3829 1791,3803 +L 1258,3809 1246,3823 1282,3823 1258,3809 +L 1029,3807 1030,3819 1038,3810 1029,3807 +L 1344,3814 1338,3819 1350,3815 1344,3814 +L 839,3805 841,3814 853,3813 839,3805 +L 1394,3546 1387,3547 1395,3552 1394,3546 +L 1101,3778 1084,3793 1094,3809 1101,3778 +L 641,3799 649,3809 658,3802 641,3799 +L 674,3804 661,3805 679,3808 674,3804 +L 815,3557 780,3566 770,3588 750,3599 737,3580 734,3594 706,3573 706,3610 671,3628 670,3619 669,3626 636,3621 634,3634 642,3638 648,3626 658,3638 665,3629 671,3646 681,3643 675,3639 682,3629 687,3641 679,3649 687,3658 694,3640 747,3661 771,3675 763,3691 794,3707 802,3685 836,3693 834,3710 842,3712 852,3699 844,3692 847,3679 881,3694 882,3685 910,3682 911,3698 927,3702 926,3752 904,3777 896,3760 882,3756 887,3764 872,3781 883,3806 897,3800 923,3807 921,3798 940,3789 948,3799 959,3797 935,3778 940,3773 924,3776 925,3770 933,3769 927,3768 936,3743 957,3726 945,3714 971,3703 971,3685 990,3679 982,3672 993,3663 969,3660 963,3641 957,3653 942,3652 957,3661 937,3683 894,3680 868,3663 866,3648 854,3668 851,3651 832,3673 800,3671 751,3636 745,3626 757,3637 762,3619 737,3624 749,3612 773,3612 781,3628 790,3627 787,3617 831,3636 837,3622 864,3620 833,3599 815,3599 801,3618 783,3573 795,3578 815,3557 +L 968,3793 963,3800 968,3807 980,3799 968,3793 +L 1808,3793 1809,3804 1816,3798 1808,3793 +L 790,3787 768,3790 785,3797 790,3787 +L 1231,3782 1216,3786 1220,3794 1231,3782 +L 1647,3768 1650,3790 1665,3775 1647,3768 +L 1417,3510 1411,3518 1423,3529 1417,3510 +L 64,3779 65,3786 82,3783 64,3779 +L 1073,3760 1074,3780 1063,3778 1065,3784 1080,3785 1088,3768 1073,3760 +L 736,3002 659,3021 683,3029 682,3052 719,3045 731,3058 749,3055 757,3067 728,3089 731,3103 681,3102 754,3108 769,3119 795,3088 827,3083 794,3048 804,3012 793,3020 792,3035 770,3039 759,3055 729,3036 733,3023 757,3018 736,3002 +L 705,3764 706,3780 712,3770 705,3764 +L 306,3720 293,3745 274,3751 288,3764 285,3750 308,3752 310,3743 321,3751 308,3765 335,3774 327,3767 335,3752 323,3755 323,3741 305,3738 306,3720 +L 650,3697 639,3716 678,3723 646,3755 651,3759 676,3758 685,3769 692,3757 704,3762 707,3733 686,3736 670,3700 650,3697 +L 985,3748 979,3752 991,3766 985,3748 +L 1241,3719 1214,3737 1210,3735 1210,3765 1228,3759 1233,3746 1252,3743 1259,3728 1241,3719 +L 1157,3639 1145,3649 1144,3716 1129,3679 1083,3691 1074,3682 1071,3695 1087,3710 1066,3736 1072,3732 1078,3742 1100,3728 1102,3734 1145,3724 1146,3742 1153,3743 1155,3697 1163,3691 1157,3639 +L 553,3185 526,3187 542,3190 568,3237 591,3230 605,3236 595,3242 611,3252 614,3225 642,3234 641,3215 657,3205 676,3217 677,3197 660,3186 620,3198 607,3218 587,3201 567,3212 553,3185 +L 1010,3501 975,3603 950,3591 937,3604 934,3622 961,3611 968,3616 965,3637 986,3595 1004,3581 1002,3549 1048,3525 1011,3514 1010,3501 +L 431,3458 414,3514 412,3520 406,3518 400,3528 412,3535 419,3561 419,3522 415,3521 421,3520 419,3513 436,3523 444,3517 439,3508 451,3508 456,3522 478,3499 454,3498 477,3487 478,3477 451,3473 444,3480 431,3458 +L 13,3682 0,3706 -20,3718 -35,3752 -29,3754 -16,3724 14,3708 23,3694 13,3682 +L 1038,3632 1037,3658 1018,3653 1013,3691 1049,3702 1044,3683 1068,3678 1051,3644 1038,3632 +L 845,3727 834,3743 851,3752 857,3740 845,3727 +L 851,3432 798,3459 788,3476 805,3461 820,3463 830,3476 841,3462 864,3474 865,3449 851,3432 +L 100,3688 95,3709 51,3745 82,3737 112,3711 115,3691 100,3688 +L 374,3736 359,3738 351,3738 366,3744 374,3736 +L 479,3124 462,3136 450,3129 437,3159 468,3170 478,3165 467,3151 485,3148 485,3131 479,3124 +L 98,3732 99,3743 106,3739 98,3732 +L 328,3495 313,3497 320,3498 315,3518 323,3515 312,3524 336,3511 339,3524 354,3518 379,3528 381,3498 371,3502 368,3520 362,3506 328,3495 +L 1336,3448 1309,3464 1305,3483 1337,3486 1346,3458 1336,3448 +L 198,3724 197,3737 208,3736 198,3724 +L 536,3261 513,3290 507,3284 507,3304 489,3312 494,3317 482,3327 519,3312 526,3291 541,3284 536,3261 +L 1193,3723 1180,3732 1210,3735 1193,3723 +L 797,3711 800,3735 820,3721 797,3711 +L 361,3566 347,3572 352,3611 343,3628 377,3615 360,3590 367,3575 361,3566 +L 1047,3547 1047,3567 1037,3566 1031,3582 1019,3584 1043,3592 1043,3606 1060,3589 1049,3576 1063,3559 1054,3560 1055,3548 1047,3547 +L 1262,3726 1261,3734 1269,3733 1262,3726 +L 1507,3690 1507,3697 1498,3693 1501,3713 1474,3728 1483,3732 1512,3704 1507,3690 +L 621,3685 585,3694 582,3715 595,3723 597,3703 621,3685 +L 1054,3711 1058,3720 1049,3722 1063,3722 1054,3711 +L 1372,3699 1363,3703 1372,3722 1379,3712 1372,3699 +L 49,3691 38,3715 51,3711 49,3691 +L 1265,3689 1288,3714 1301,3691 1265,3689 +L 764,3494 712,3495 710,3502 702,3496 704,3514 713,3501 736,3499 732,3506 747,3509 736,3526 747,3527 764,3494 +L 1050,3704 1044,3712 1054,3711 1050,3704 +L 84,3673 52,3711 62,3709 84,3673 +L 613,3089 597,3098 618,3100 663,3142 657,3118 644,3115 643,3108 659,3106 655,3101 618,3099 613,3089 +L 486,3572 481,3589 472,3585 478,3591 499,3601 512,3585 503,3576 494,3583 486,3572 +L 1337,3663 1312,3673 1310,3692 1329,3692 1337,3663 +L 370,3186 344,3187 350,3202 378,3202 370,3186 +L 360,3261 352,3262 341,3280 371,3285 360,3261 +L 1057,3601 1050,3610 1057,3627 1067,3627 1070,3604 1057,3601 +L 506,3610 504,3621 522,3636 527,3619 506,3610 +L 52,3664 58,3674 48,3681 60,3686 73,3672 91,3672 52,3664 +L 94,3634 82,3651 95,3656 107,3636 94,3634 +L 1371,3661 1377,3679 1383,3670 1371,3661 +L 22,3670 15,3676 26,3677 22,3670 +L 1284,3663 1277,3668 1285,3670 1284,3663 +L 587,3112 593,3144 607,3128 587,3112 +L 1003,3649 993,3663 1010,3652 1003,3649 +L 1208,3623 1177,3639 1176,3654 1184,3644 1198,3645 1193,3635 1208,3623 +L 628,3594 607,3603 623,3612 634,3601 628,3594 +L 836,3543 826,3554 817,3556 834,3562 847,3547 836,3543 +L 308,3649 308,3656 315,3653 308,3649 +L 438,3327 434,3365 447,3359 438,3327 +L 368,3635 375,3642 366,3641 364,3650 377,3650 378,3640 368,3635 +L 1115,3614 1101,3623 1090,3642 1114,3631 1108,3623 1115,3614 +L 1288,3490 1284,3511 1300,3509 1288,3490 +L 428,3395 416,3411 430,3416 428,3395 +L 437,3292 428,3278 409,3278 437,3292 +L 548,3101 533,3102 532,3119 548,3101 +L 625,2952 615,2963 635,2966 625,2952 +L 881,3535 865,3548 869,3554 880,3540 887,3546 881,3535 +L 1190,3596 1168,3619 1188,3608 1190,3596 +L 1142,3566 1132,3585 1139,3593 1142,3566 +L 1161,3631 1168,3619 1158,3619 1161,3631 +L 543,3618 530,3619 534,3629 545,3629 536,3624 543,3618 +L 544,3243 541,3254 561,3249 544,3243 +L 1162,3598 1151,3606 1158,3619 1162,3598 +L 563,3428 553,3442 563,3445 563,3428 +L 625,3613 623,3626 634,3621 625,3613 +L 126,3561 104,3577 117,3575 126,3561 +L 1248,3611 1238,3612 1250,3621 1248,3611 +L 892,3033 876,3051 894,3041 892,3033 +L 1213,3497 1196,3516 1216,3503 1213,3497 +L 578,3606 567,3607 569,3615 578,3606 +L 1174,3530 1159,3532 1170,3541 1174,3530 +L 433,3366 422,3373 427,3384 433,3366 +L 1146,3591 1140,3594 1148,3603 1146,3591 +L 640,3160 636,3174 647,3173 640,3160 +L 815,3413 806,3417 827,3424 815,3413 +L 427,3259 434,3268 444,3260 427,3259 +L 102,3587 100,3595 108,3596 102,3587 +L 858,3542 847,3547 859,3554 858,3542 +L 544,3506 546,3499 527,3499 544,3506 +L 727,3391 720,3400 728,3408 727,3391 +L 656,3562 649,3573 659,3575 656,3562 +L 351,3413 347,3419 366,3421 351,3413 +L 666,3216 670,3230 677,3224 666,3216 +L 486,3356 476,3359 485,3368 486,3356 +L 481,3459 475,3474 483,3473 481,3459 +L 308,3566 303,3575 312,3574 308,3566 +L 294,3524 285,3530 297,3534 294,3524 +L 351,3384 349,3395 359,3393 351,3384 +L 339,3560 337,3566 351,3566 339,3560 +L 377,3292 367,3295 372,3304 377,3292 +L 486,3451 481,3459 494,3458 486,3451 +L 1056,3511 1055,3521 1065,3514 1056,3511 +L 216,3390 226,3380 217,3380 216,3390 +L 427,3164 418,3167 421,3176 427,3164 +L 495,3530 494,3541 503,3531 495,3530 +L 788,3477 778,3485 787,3486 788,3477 +L 1348,3429 1341,3431 1350,3440 1348,3429 +L 96,3477 98,3483 111,3483 96,3477 +L 826,3393 832,3402 836,3395 826,3393 +L 1069,3389 1067,3395 1080,3395 1069,3389 +L 859,3304 854,3313 864,3310 859,3304 +L 293,3503 296,3510 304,3504 293,3503 +L 758,3516 756,3522 769,3519 758,3516 +L 1329,3417 1327,3429 1334,3423 1329,3417 +L 1161,3922 1157,3914 1152,3922 1161,3922 +L 577,3410 560,3416 563,3428 563,3417 577,3410 +L 375,3257 368,3261 380,3263 375,3257 +L 441,3225 434,3229 439,3235 441,3225 +L 364,3361 356,3365 363,3369 364,3361 +L 632,3379 626,3380 626,3389 632,3379 +L 565,3364 560,3372 557,3381 565,3364 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-touching-holes6.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-touching-holes6.txt new file mode 100644 index 0000000..496ae27 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-touching-holes6.txt @@ -0,0 +1,170 @@ +# earcut/touching-holes6 +L -56,2836 -45,2831 -41,2835 -48,2838 -52,2836 -64,2848 -64,0 4160,0 4160,3451 4139,3445 4141,3451 4136,3450 4133,3456 4127,3456 4126,3452 4117,3452 4115,3448 4111,3453 4103,3452 4102,3455 3968,3456 4094,3456 4091,3463 4086,3463 4086,3468 4073,3472 4059,3492 4046,3500 4043,3508 4034,3520 4034,3526 4040,3550 4040,3561 4061,3548 4071,3551 4076,3550 4091,3535 4096,3534 4112,3538 4121,3547 4133,3545 4155,3536 4160,3535 4160,3842 4147,3827 4129,3816 4120,3805 4117,3809 4110,3809 4096,3800 4069,3768 4045,3748 4025,3738 4005,3736 3981,3720 3968,3719 3940,3706 3930,3698 3918,3683 3903,3683 3874,3688 3845,3688 3840,3685 3828,3683 3816,3687 3813,3685 3812,3692 3809,3683 3799,3676 3790,3679 3792,3684 3801,3693 3798,3697 3789,3699 3786,3695 3791,3693 3770,3680 3766,3671 3754,3675 3712,3663 3662,3651 3661,3654 3667,3658 3665,3679 3667,3683 3667,3700 3652,3706 3648,3719 3650,3722 3665,3720 3671,3725 3672,3737 3676,3740 3676,3750 3679,3750 3683,3762 3681,3776 3686,3779 3688,3785 3679,3800 3661,3814 3647,3823 3624,3826 3617,3821 3614,3815 3616,3805 3613,3790 3610,3787 3600,3786 3584,3773 3566,3771 3562,3766 3560,3743 3563,3727 3554,3721 3547,3712 3552,3708 3553,3703 3546,3697 3538,3698 3514,3726 3500,3737 3496,3734 3470,3732 3456,3726 3427,3721 3405,3724 3393,3722 3381,3712 3374,3700 3369,3699 3358,3709 3345,3710 3337,3706 3321,3712 3303,3710 3296,3712 3231,3712 3212,3710 3202,3712 3200,3707 3191,3705 3191,3710 3185,3700 3176,3693 3171,3683 3180,3669 3183,3648 3190,3633 3183,3603 3174,3584 3167,3573 3156,3563 3123,3540 3087,3527 3072,3525 3056,3521 3001,3520 2944,3534 2922,3541 2898,3552 2897,3549 2867,3557 2845,3555 2827,3547 2825,3541 2816,3539 2807,3535 2804,3533 2804,3531 2816,3535 2825,3531 2816,3514 2810,3497 2802,3486 2775,3477 2770,3468 2763,3468 2761,3460 2741,3457 2738,3453 2732,3455 2730,3456 2730,3437 2726,3436 2710,3439 2704,3437 2700,3432 2696,3435 2691,3431 2688,3436 2689,3422 2694,3420 2699,3410 2704,3407 2701,3404 2709,3405 2712,3417 2717,3424 2734,3413 2736,3406 2731,3392 2718,3373 2704,3361 2688,3353 2684,3353 2657,3340 2616,3339 2600,3342 2586,3361 2582,3373 2560,3408 2553,3418 2539,3430 2534,3427 2523,3437 2518,3434 2512,3437 2501,3431 2503,3426 2499,3421 2505,3422 2512,3416 2514,3411 2505,3402 2504,3396 2512,3398 2518,3407 2530,3399 2537,3401 2541,3396 2540,3383 2533,3382 2532,3374 2536,3363 2539,3363 2540,3355 2534,3356 2532,3351 2537,3349 2546,3359 2543,3365 2551,3357 2547,3374 2553,3370 2551,3364 2556,3365 2558,3361 2563,3370 2550,3384 2549,3381 2547,3407 2556,3394 2569,3380 2592,3342 2560,3342 2513,3348 2493,3354 2483,3365 2472,3360 2469,3354 2471,3345 2480,3353 2492,3328 2502,3323 2508,3328 2514,3323 2518,3328 2521,3337 2526,3334 2533,3336 2560,3336 2588,3337 2560,3322 2529,3308 2478,3293 2432,3284 2364,3279 2349,3273 2337,3260 2310,3254 2308,3257 2310,3267 2314,3269 2322,3284 2330,3290 2329,3297 2332,3301 2321,3300 2318,3311 2314,3309 2304,3315 2283,3318 2267,3313 2257,3314 2246,3328 2237,3349 2239,3361 2248,3365 2258,3354 2272,3353 2278,3346 2279,3354 2296,3357 2281,3367 2273,3363 2271,3372 2266,3377 2259,3394 2251,3391 2253,3380 2247,3390 2249,3395 2263,3399 2269,3409 2266,3412 2266,3432 2270,3446 2277,3456 2274,3456 2277,3463 2271,3459 2271,3465 2266,3468 2264,3463 2253,3461 2249,3473 2241,3473 2237,3456 2237,3448 2230,3447 2222,3440 2212,3444 2215,3449 2207,3456 2206,3447 2194,3448 2191,3445 2190,3456 2184,3472 2182,3481 2186,3480 2194,3485 2187,3487 2191,3492 2200,3493 2198,3497 2193,3496 2188,3501 2179,3493 2176,3500 2185,3501 2192,3511 2187,3518 2184,3509 2180,3516 2177,3515 2176,3506 2163,3489 2166,3479 2158,3480 2157,3475 2144,3471 2137,3464 2136,3456 2127,3454 2121,3456 2127,3450 2107,3447 2093,3439 2087,3438 2078,3440 2065,3450 2048,3456 2040,3466 2048,3476 2037,3472 2042,3479 2035,3474 2021,3479 2006,3477 1986,3468 1972,3456 1964,3446 1955,3425 1949,3424 1946,3418 1949,3411 1947,3398 1952,3398 1962,3393 1972,3408 1965,3393 1961,3391 1945,3395 1940,3400 1926,3430 1920,3451 1920,3328 1919,3456 1911,3494 1920,3501 1909,3501 1905,3507 1906,3511 1894,3550 1881,3569 1869,3571 1864,3566 1863,3553 1859,3541 1854,3551 1847,3551 1845,3542 1837,3544 1832,3537 1833,3533 1828,3521 1813,3514 1808,3499 1796,3488 1792,3456 1792,3467 1788,3460 1789,3456 1784,3444 1772,3448 1770,3439 1774,3430 1792,3426 1802,3430 1792,3417 1792,3410 1780,3386 1787,3416 1780,3423 1771,3425 1765,3422 1760,3406 1756,3403 1752,3394 1752,3381 1745,3376 1744,3369 1735,3364 1734,3358 1726,3352 1720,3339 1713,3333 1708,3333 1704,3325 1701,3328 1693,3326 1684,3328 1682,3326 1668,3328 1664,3321 1665,3309 1680,3305 1702,3282 1719,3281 1723,3272 1730,3269 1737,3271 1745,3263 1753,3265 1758,3270 1768,3269 1786,3272 1792,3271 1792,3269 1794,3264 1792,3255 1758,3258 1764,3254 1754,3256 1746,3248 1756,3249 1766,3246 1780,3235 1784,3221 1779,3216 1773,3222 1769,3214 1766,3214 1770,3205 1764,3197 1755,3197 1747,3200 1749,3196 1746,3194 1746,3195 1741,3200 1745,3187 1746,3193 1751,3190 1751,3181 1740,3177 1731,3185 1727,3185 1735,3172 1734,3171 1717,3176 1722,3162 1711,3163 1709,3166 1705,3161 1704,3171 1701,3171 1700,3156 1696,3153 1684,3154 1685,3170 1683,3165 1679,3171 1682,3177 1678,3177 1676,3165 1670,3176 1667,3165 1664,3169 1664,3072 1663,3179 1659,3175 1654,3181 1649,3164 1655,3173 1659,3167 1659,3155 1655,3154 1652,3148 1644,3154 1642,3160 1635,3153 1635,3158 1626,3166 1624,3165 1624,3152 1616,3152 1615,3144 1613,3153 1609,3149 1602,3155 1603,3135 1598,3135 1594,3141 1594,3125 1590,3133 1589,3121 1580,3126 1581,3117 1571,3119 1566,3114 1567,3108 1563,3109 1561,3123 1554,3129 1549,3130 1548,3141 1545,3136 1543,3143 1540,3137 1536,3146 1532,3135 1535,3126 1529,3126 1530,3131 1521,3132 1521,3140 1525,3148 1519,3143 1520,3150 1516,3151 1519,3157 1517,3161 1522,3165 1519,3173 1521,3177 1526,3176 1519,3182 1525,3189 1524,3198 1528,3205 1536,3203 1527,3212 1535,3220 1524,3218 1520,3228 1522,3240 1518,3241 1512,3252 1506,3246 1493,3240 1501,3240 1487,3228 1481,3236 1484,3240 1478,3242 1486,3246 1485,3242 1488,3247 1499,3253 1494,3257 1489,3249 1483,3249 1488,3257 1486,3260 1479,3254 1476,3256 1461,3251 1444,3241 1430,3242 1415,3247 1408,3246 1395,3240 1372,3237 1362,3233 1352,3237 1342,3228 1326,3222 1298,3208 1293,3200 1292,3191 1296,3180 1292,3176 1295,3167 1300,3161 1306,3164 1311,3162 1317,3165 1321,3159 1305,3147 1280,3144 1248,3144 1212,3130 1197,3132 1174,3124 1159,3123 1152,3124 1141,3131 1134,3141 1119,3143 1102,3141 1089,3150 1070,3156 1075,3169 1086,3181 1082,3185 1078,3195 1073,3200 1077,3210 1070,3211 1069,3200 1072,3193 1072,3182 1064,3178 1055,3165 1062,3145 1068,3140 1066,3130 1055,3097 1047,3089 1039,3075 1047,3107 1046,3113 1039,3121 1024,3124 1015,3124 996,3120 981,3112 970,3099 965,3083 967,3075 973,3078 983,3072 981,3067 968,3068 962,3072 959,3080 960,3088 955,3092 941,3079 931,3074 923,3073 909,3075 904,3095 889,3108 891,3120 896,3129 898,3127 916,3124 924,3128 928,3120 938,3116 941,3109 951,3113 949,3121 954,3124 951,3129 932,3135 927,3139 929,3143 921,3147 915,3147 919,3151 916,3157 911,3158 903,3166 891,3166 884,3161 875,3148 874,3158 880,3157 886,3166 885,3171 876,3161 875,3168 879,3174 867,3178 861,3183 857,3182 830,3190 828,3197 835,3195 838,3200 821,3200 809,3211 790,3212 775,3210 768,3215 760,3214 744,3206 757,3189 766,3184 768,3168 783,3151 776,3141 775,3135 782,3139 802,3136 810,3138 823,3129 824,3136 841,3113 854,3086 865,3072 873,3065 889,3062 896,3052 906,3042 908,3025 901,3021 913,3013 915,3009 919,3015 929,3002 928,2991 937,2993 949,2986 947,2984 958,2982 965,2970 975,2960 987,2961 992,2966 1003,2944 1009,2929 1015,2923 1030,2918 1039,2912 1045,2899 1050,2896 1076,2855 1079,2837 1071,2836 1075,2831 1080,2832 1079,2816 1152,2816 1072,2815 1063,2811 1060,2803 1062,2791 1059,2786 1046,2795 1048,2807 1038,2807 1038,2797 1042,2792 1037,2788 1042,2776 1034,2766 1024,2766 1023,2756 1017,2752 1024,2752 1031,2756 1042,2770 1050,2773 1054,2778 1047,2785 1062,2781 1074,2788 1074,2796 1065,2806 1071,2810 1080,2795 1087,2767 1089,2752 1085,2744 1088,2742 1082,2736 1080,2737 1073,2739 1077,2751 1070,2740 1074,2732 1071,2726 1072,2720 1067,2712 1069,2702 1066,2688 1059,2674 1056,2679 1053,2676 1044,2678 1048,2688 1054,2688 1061,2695 1050,2695 1046,2700 1049,2708 1041,2714 1033,2714 1042,2706 1037,2689 1030,2690 1024,2679 1027,2678 1034,2685 1034,2668 1038,2662 1024,2649 1016,2638 1004,2655 1001,2654 1012,2638 1006,2627 1000,2624 1001,2618 989,2608 981,2608 980,2602 985,2596 980,2593 962,2589 967,2580 961,2577 947,2585 941,2584 942,2578 928,2581 915,2591 902,2589 884,2578 874,2586 870,2584 843,2589 838,2583 832,2590 835,2581 820,2581 817,2583 818,2597 821,2601 820,2610 815,2621 802,2629 792,2622 779,2625 775,2628 768,2628 768,2636 762,2630 755,2631 748,2625 749,2617 747,2612 754,2609 756,2620 762,2612 764,2605 763,2598 767,2594 764,2591 764,2583 771,2585 776,2579 777,2569 785,2568 788,2561 783,2560 792,2555 785,2553 785,2549 791,2550 798,2545 788,2539 790,2535 784,2529 788,2526 775,2530 768,2519 762,2519 758,2529 756,2523 751,2527 749,2520 737,2517 724,2531 718,2530 708,2537 703,2531 708,2522 715,2525 720,2523 718,2518 724,2515 723,2507 720,2510 712,2508 701,2514 692,2510 686,2517 676,2513 673,2506 670,2512 654,2514 649,2511 643,2513 658,2503 662,2504 668,2496 675,2494 680,2497 699,2488 710,2477 706,2475 712,2471 721,2458 719,2453 737,2459 742,2453 730,2444 726,2432 725,2414 712,2414 711,2417 700,2417 676,2404 674,2400 675,2389 666,2387 662,2391 650,2389 655,2385 650,2378 645,2382 642,2379 627,2396 628,2402 623,2399 612,2403 608,2397 605,2398 591,2410 592,2417 576,2426 567,2443 564,2453 557,2457 560,2463 550,2458 519,2506 513,2519 512,2535 504,2537 498,2560 504,2578 512,2579 515,2588 520,2592 518,2595 509,2593 504,2620 501,2620 492,2629 471,2637 460,2634 443,2639 427,2637 407,2627 403,2635 411,2646 414,2660 423,2659 428,2666 428,2671 438,2674 437,2683 439,2688 425,2688 425,2684 409,2681 401,2685 399,2683 404,2676 402,2674 390,2683 388,2687 377,2693 373,2692 362,2701 366,2705 377,2705 374,2710 371,2708 361,2715 357,2706 344,2716 354,2717 358,2729 350,2729 343,2724 335,2727 333,2737 327,2737 331,2732 327,2726 336,2721 335,2718 318,2730 316,2738 310,2743 307,2741 303,2746 296,2745 305,2729 303,2726 294,2728 299,2722 293,2722 281,2735 279,2730 273,2735 262,2755 256,2746 259,2746 269,2727 274,2724 280,2714 276,2715 275,2710 286,2705 280,2702 275,2703 268,2696 258,2697 257,2691 264,2695 273,2693 278,2696 286,2694 290,2700 295,2691 292,2688 284,2682 292,2681 292,2672 295,2669 292,2664 286,2666 284,2676 279,2681 281,2668 273,2668 270,2674 268,2663 258,2670 256,2677 250,2674 253,2670 245,2669 243,2679 247,2684 251,2683 256,2688 256,2695 248,2692 243,2703 237,2700 231,2706 225,2701 223,2694 210,2693 208,2697 219,2697 220,2703 211,2702 214,2708 201,2704 201,2698 191,2704 188,2698 180,2702 170,2700 169,2705 182,2710 184,2714 173,2713 170,2709 163,2717 156,2722 158,2715 153,2710 160,2704 157,2701 148,2711 147,2719 141,2722 139,2716 141,2710 134,2713 136,2724 132,2730 134,2738 141,2735 150,2726 153,2726 149,2735 152,2736 158,2747 162,2747 159,2738 163,2733 167,2745 178,2741 179,2738 188,2737 187,2740 179,2742 177,2748 168,2747 167,2750 158,2752 150,2758 146,2756 137,2761 128,2763 128,2755 131,2756 130,2748 121,2756 127,2754 127,2763 120,2766 116,2764 112,2770 106,2773 99,2771 94,2778 91,2774 81,2778 79,2773 74,2781 78,2795 69,2790 56,2792 57,2785 52,2787 44,2798 41,2790 31,2791 33,2794 20,2801 14,2799 0,2805 -3,2808 2,2813 0,2816 -6,2816 -28,2816 -32,2813 -33,2816 -39,2827 -43,2826 -57,2834 -56,2836 +L 139,2737 134,2738 134,2742 141,2745 144,2742 139,2737 +L 299,2686 292,2688 299,2689 298,2698 302,2694 300,2683 303,2682 305,2674 297,2669 295,2671 299,2686 +L 1075,2734 1080,2737 1080,2730 1075,2734 +L 1313,3166 1311,3162 1307,3165 1313,3166 +L 1523,3211 1527,3212 1530,3206 1523,3211 +L 1536,3140 1540,3137 1541,3134 1538,3133 1536,3140 +L 1541,3121 1541,3134 1543,3127 1541,3121 +L 2731,3440 2732,3455 2738,3447 2731,3440 +L 70,1512 66,1506 48,1496 48,1500 26,1502 9,1510 7,1522 11,1536 30,1550 43,1553 61,1548 69,1536 74,1527 70,1512 +L 99,1797 128,1804 139,1811 163,1836 173,1840 188,1828 192,1829 210,1809 218,1810 220,1801 232,1800 243,1793 250,1792 256,1786 266,1782 305,1783 321,1780 327,1777 333,1780 332,1774 341,1763 341,1753 331,1746 326,1745 331,1739 332,1731 330,1726 334,1718 329,1712 326,1702 322,1699 334,1694 325,1690 326,1683 333,1680 328,1679 332,1673 325,1667 328,1666 333,1672 339,1673 345,1669 343,1665 349,1663 353,1668 359,1662 361,1656 367,1657 365,1651 357,1646 362,1640 358,1638 359,1630 355,1632 354,1626 332,1609 325,1597 317,1588 309,1586 307,1570 310,1566 302,1559 297,1550 296,1540 286,1529 286,1524 280,1518 277,1507 271,1508 270,1502 273,1497 263,1483 256,1483 238,1490 236,1493 240,1500 256,1501 254,1506 241,1508 238,1517 236,1516 225,1529 222,1536 199,1545 192,1555 187,1554 179,1559 172,1558 175,1564 171,1567 166,1562 160,1562 154,1570 155,1574 146,1575 144,1582 148,1584 145,1589 149,1594 145,1595 131,1609 133,1613 118,1641 120,1646 135,1642 149,1636 148,1632 153,1627 158,1631 152,1636 155,1640 141,1661 138,1664 130,1679 133,1713 112,1715 109,1720 103,1722 99,1731 106,1736 125,1742 122,1747 114,1742 106,1743 95,1741 75,1752 68,1770 76,1766 81,1769 90,1767 110,1768 106,1771 109,1779 128,1792 114,1791 0,1792 102,1792 99,1797 +L 128,1704 128,1699 122,1706 128,1704 +L 191,1835 201,1832 197,1826 191,1835 +L 194,1841 191,1835 186,1834 180,1846 194,1841 +L 117,1834 118,1827 106,1829 92,1823 89,1818 68,1822 65,1825 45,1823 52,1826 57,1833 59,1845 52,1851 60,1857 63,1862 60,1868 53,1872 54,1881 73,1888 72,1886 89,1891 96,1888 109,1901 108,1912 103,1910 102,1905 96,1905 99,1912 90,1915 97,1918 91,1920 108,1925 122,1924 144,1915 151,1902 155,1900 159,1892 169,1883 176,1863 173,1858 168,1857 149,1838 134,1831 128,1832 128,1828 127,1833 117,1834 +L 81,1913 86,1909 71,1909 57,1906 56,1914 60,1920 77,1931 83,1930 91,1924 89,1920 89,1916 81,1913 +L 29,1957 35,1956 25,1954 29,1957 +L 67,1977 63,1978 80,1985 70,1977 59,1964 40,1955 62,1970 67,1977 +L 97,1989 82,1986 106,1996 106,1990 114,1982 104,1982 97,1989 +L 139,1985 131,1982 122,1987 128,1996 137,1993 139,1985 +L 104,2058 109,2064 128,2074 132,2074 104,2058 +L 166,2279 173,2284 171,2276 167,2272 166,2279 +L 85,2401 91,2404 95,2399 88,2392 84,2393 85,2401 +L 35,2473 35,2464 32,2464 35,2473 +L -12,2477 -14,2469 -21,2466 -29,2468 -36,2483 -34,2493 -21,2495 -14,2483 -17,2471 -12,2477 +L 452,1941 454,1948 460,1931 469,1927 468,1923 462,1925 462,1920 460,1915 452,1941 +L 456,1993 461,1983 455,1980 454,1983 453,1992 456,1993 +L 609,2036 607,2048 614,2048 615,2041 609,2036 +L 614,2063 612,2054 609,2054 614,2063 +L 647,2086 653,2085 656,2080 647,2086 +L 392,2137 390,2142 395,2142 392,2137 +L 473,2188 467,2196 467,2210 462,2226 457,2227 460,2232 460,2242 455,2253 438,2282 432,2304 427,2315 431,2317 432,2328 436,2335 444,2330 458,2329 487,2304 491,2304 506,2291 512,2282 519,2279 547,2278 552,2281 557,2276 567,2276 571,2273 580,2275 582,2288 592,2279 589,2275 596,2270 604,2274 614,2266 626,2266 655,2249 662,2250 671,2247 675,2252 681,2246 702,2207 704,2196 700,2185 702,2176 700,2173 701,2161 696,2155 700,2153 695,2136 679,2124 673,2129 675,2132 673,2141 670,2132 657,2125 662,2126 668,2121 662,2117 664,2108 658,2093 649,2089 643,2090 643,2080 638,2077 640,2072 640,2058 633,2058 633,2048 630,2055 628,2052 623,2063 624,2048 619,2048 616,2064 608,2069 600,2080 594,2081 591,2078 588,2099 583,2114 579,2117 580,2122 575,2124 577,2129 571,2136 566,2132 573,2120 572,2114 579,2107 581,2098 581,2074 587,2060 584,2057 585,2048 593,2024 596,2026 602,2016 594,2016 596,2011 586,1997 569,1990 567,1985 560,1989 556,2004 561,2036 557,2037 546,2032 545,2017 539,2002 534,2007 531,2005 528,2013 531,2034 517,2036 512,2048 512,2058 521,2063 507,2065 504,2077 512,2083 520,2092 531,2097 531,2100 515,2093 506,2086 501,2087 501,2097 492,2124 495,2130 496,2139 512,2147 512,2151 506,2153 505,2148 492,2143 487,2136 473,2164 472,2176 397,2176 472,2177 473,2188 +L 748,2266 761,2255 765,2262 766,2250 761,2250 759,2244 751,2249 747,2266 744,2262 734,2264 734,2273 741,2278 754,2266 748,2266 +L 274,1806 280,1803 277,1798 272,1803 274,1806 +L 164,1937 154,1951 152,1956 138,1949 132,1952 141,1953 140,1959 143,1962 146,1958 153,1960 153,1968 145,1970 144,1975 149,1980 158,1978 153,1976 161,1969 155,1965 167,1949 168,1954 176,1957 174,1960 183,1966 179,1972 171,1975 178,1983 183,1984 185,1978 182,1970 196,1971 200,1975 202,1985 198,1990 201,2005 195,2008 194,2017 202,2023 199,2032 215,2048 213,2063 222,2077 231,2083 236,2081 250,2065 258,2066 256,2073 262,2076 261,2091 278,2093 290,2085 296,2093 312,2087 317,2095 317,2105 322,2108 327,2117 332,2119 340,2129 348,2135 356,2132 363,2138 367,2134 372,2137 378,2136 381,2143 388,2141 391,2135 413,2136 422,2133 432,2135 435,2125 455,2107 452,2093 448,2086 452,2078 451,2071 447,2067 436,2062 434,2058 442,2055 429,2042 416,2020 422,2016 436,2030 442,2027 441,2022 446,2024 446,2003 444,2001 447,1989 444,1983 449,1968 445,1955 448,1935 453,1925 452,1908 458,1904 460,1889 456,1886 450,1875 450,1868 446,1860 439,1852 435,1856 434,1851 439,1849 425,1844 430,1841 431,1836 427,1833 423,1838 416,1837 425,1830 414,1826 411,1831 401,1833 401,1830 391,1822 392,1828 386,1839 389,1845 389,1855 384,1866 384,1873 380,1875 379,1884 364,1882 354,1883 349,1879 354,1869 361,1865 363,1854 359,1851 362,1843 361,1835 366,1834 365,1828 368,1823 363,1819 359,1810 353,1805 349,1795 327,1795 314,1811 303,1809 302,1803 298,1812 288,1815 286,1809 281,1818 279,1811 269,1812 265,1809 261,1815 256,1810 251,1812 247,1819 245,1833 239,1831 236,1825 230,1821 233,1817 228,1810 225,1812 228,1822 220,1827 215,1843 206,1845 205,1848 198,1845 201,1856 197,1861 197,1868 215,1886 215,1892 209,1892 209,1897 196,1896 185,1901 175,1920 167,1936 164,1937 +L 249,2531 256,2532 272,2526 274,2528 269,2536 265,2534 260,2546 278,2530 283,2533 289,2527 299,2503 294,2492 275,2510 256,2519 248,2527 249,2531 +L 270,2546 266,2543 264,2548 270,2546 +L 794,2299 796,2309 804,2304 809,2290 806,2282 797,2277 787,2284 774,2283 770,2280 764,2285 754,2287 754,2292 768,2298 790,2303 794,2299 +L 523,2396 517,2398 519,2403 523,2396 +L 768,2438 763,2433 756,2443 752,2452 762,2452 763,2445 768,2444 772,2435 768,2438 +L 558,2450 549,2455 556,2454 558,2450 +L -43,2504 -49,2501 -56,2505 -43,2504 +L 5,2510 9,2507 4,2502 0,2503 -2,2506 5,2510 +L -57,2508 -58,2517 -51,2520 -48,2512 -54,2507 -57,2508 +L -51,2526 -58,2517 -53,2527 -51,2526 +L 265,2590 266,2583 259,2584 259,2589 265,2590 +L 251,2588 248,2584 247,2590 251,2588 +L 276,2595 277,2587 272,2584 269,2595 276,2595 +L 201,2591 203,2598 206,2598 207,2592 201,2591 +L 247,2596 249,2603 261,2603 267,2597 259,2593 256,2599 254,2592 247,2596 +L 246,2601 239,2600 234,2590 232,2598 220,2601 223,2608 226,2605 241,2605 246,2601 +L 289,2604 285,2601 292,2597 294,2592 288,2594 282,2591 278,2602 275,2599 268,2602 268,2612 275,2606 276,2609 284,2612 289,2604 +L 217,2599 209,2602 209,2605 215,2604 217,2599 +L 274,2615 273,2621 277,2619 274,2615 +L 248,2617 243,2627 249,2621 248,2617 +L 229,2638 227,2646 233,2642 234,2637 229,2638 +L 278,2658 279,2663 283,2660 278,2658 +L 733,2465 730,2461 730,2470 733,2465 +L 746,2468 750,2464 742,2465 746,2468 +L 804,2471 808,2467 805,2460 801,2465 793,2458 791,2467 788,2466 787,2473 795,2473 796,2478 784,2484 795,2484 798,2481 807,2474 804,2471 +L 721,2479 724,2480 729,2472 726,2470 721,2472 721,2479 +L 816,2540 820,2537 818,2533 816,2540 +L 342,2560 346,2564 346,2555 342,2560 +L 334,2564 342,2560 339,2557 333,2560 334,2564 +L 313,2562 333,2560 298,2560 313,2562 +L 256,2560 298,2560 299,2558 256,2560 +L 351,2566 359,2569 358,2565 351,2566 +L 290,2549 281,2544 266,2551 274,2555 282,2555 290,2549 +L 207,2586 202,2580 203,2587 207,2586 +L 326,2578 328,2581 339,2581 340,2585 344,2578 348,2582 348,2574 326,2578 +L 340,2599 340,2588 338,2595 340,2599 +L 345,2610 340,2599 338,2606 333,2611 345,2610 +L 327,2722 328,2715 336,2707 335,2703 321,2710 306,2724 309,2728 320,2723 327,2722 +L 197,2604 207,2606 201,2599 197,2604 +L 202,2618 197,2614 180,2611 181,2616 185,2614 190,2619 196,2616 198,2620 202,2618 +L 123,2723 117,2723 117,2728 122,2729 123,2723 +L 303,2668 308,2660 303,2657 295,2657 289,2660 303,2663 303,2668 +L 307,2692 312,2685 323,2681 318,2674 307,2687 308,2681 316,2668 318,2673 324,2668 321,2660 312,2664 308,2672 304,2688 307,2692 +L 215,2685 224,2690 225,2683 222,2677 232,2671 226,2669 223,2675 218,2674 221,2683 217,2684 210,2680 202,2685 206,2688 215,2685 +L 235,2682 232,2688 228,2692 233,2695 240,2692 235,2691 239,2687 235,2682 +L -21,2811 -15,2808 -23,2808 -21,2811 +L 993,2607 995,2602 989,2603 993,2607 +L 1030,2642 1031,2653 1034,2641 1030,2637 1029,2628 1025,2625 1029,2620 1024,2615 1023,2605 1017,2610 1021,2603 1015,2601 1014,2605 1009,2604 1000,2608 1005,2610 1004,2621 1014,2622 1021,2638 1024,2640 1030,2642 +L 1056,2656 1069,2656 1064,2650 1060,2651 1062,2644 1059,2641 1054,2652 1056,2656 +L 961,3029 966,3030 965,3023 960,3023 961,3029 +L 1002,2983 1002,3000 1006,3001 1002,3011 1004,3015 994,3021 991,3015 985,3014 980,3018 979,3024 983,3032 999,3039 1011,3053 1024,3056 1031,3061 1039,3062 1046,3045 1057,3040 1061,3027 1065,3021 1067,3009 1065,3000 1057,2993 1048,2990 1024,2988 1002,2983 +L 1510,3085 1517,3088 1511,3081 1510,3085 +L 1507,3098 1510,3101 1510,3094 1507,3098 +L 1540,3119 1540,3113 1534,3117 1536,3121 1540,3119 +L 1366,3232 1374,3233 1378,3227 1384,3226 1379,3217 1369,3219 1358,3227 1363,3228 1366,3232 +L 1353,3233 1348,3220 1349,3230 1353,3233 +L 1475,3234 1477,3229 1471,3226 1475,3234 +L 1478,3229 1477,3238 1480,3232 1478,3229 +L 3029,2506 3025,2513 3032,2513 3032,2506 3029,2506 +L 2697,2598 2697,2588 2701,2581 2708,2577 2688,2582 2678,2583 2661,2600 2688,2597 2694,2602 2697,2598 +L 2846,2695 2856,2706 2860,2705 2860,2688 2850,2689 2846,2695 +L 2325,2707 2318,2706 2324,2710 2325,2707 +L 2336,2709 2331,2705 2333,2712 2336,2709 +L 2312,2786 2304,2779 2304,2791 2308,2792 2312,2786 +L 2308,2797 2304,2791 2301,2795 2293,2791 2297,2762 2287,2760 2281,2766 2283,2760 2272,2748 2268,2747 2269,2740 2276,2733 2257,2726 2249,2713 2240,2709 2231,2689 2304,2688 2232,2688 2236,2684 2222,2685 2215,2688 2195,2703 2190,2723 2186,2726 2181,2723 2169,2725 2159,2740 2167,2763 2162,2769 2155,2766 2148,2770 2146,2779 2149,2788 2140,2799 2139,2800 2149,2812 2152,2823 2147,2828 2149,2835 2147,2839 2136,2844 2137,2859 2155,2895 2176,2913 2193,2947 2216,2955 2232,2968 2242,2967 2250,2958 2258,2934 2255,2931 2253,2920 2261,2910 2275,2923 2280,2939 2268,2939 2271,2941 2284,2939 2304,2929 2348,2916 2349,2913 2362,2904 2371,2905 2377,2903 2377,2910 2384,2920 2380,2920 2373,2910 2368,2912 2367,2921 2383,2938 2391,2940 2395,2936 2399,2924 2406,2929 2411,2923 2414,2927 2437,2923 2444,2914 2438,2904 2432,2905 2414,2894 2401,2892 2379,2850 2374,2832 2373,2816 2370,2807 2375,2799 2368,2798 2365,2794 2374,2796 2379,2789 2372,2786 2368,2789 2365,2786 2371,2783 2382,2787 2386,2785 2382,2776 2386,2772 2390,2775 2399,2772 2401,2775 2409,2774 2415,2778 2418,2789 2410,2803 2392,2823 2394,2827 2391,2844 2401,2852 2401,2864 2407,2866 2409,2880 2415,2881 2416,2886 2421,2886 2429,2896 2440,2893 2452,2894 2455,2903 2475,2895 2491,2879 2493,2863 2499,2857 2495,2852 2493,2838 2496,2828 2510,2816 2521,2816 2515,2803 2495,2790 2489,2780 2475,2777 2461,2761 2445,2752 2432,2752 2427,2756 2430,2759 2418,2761 2393,2749 2358,2703 2347,2698 2340,2691 2342,2700 2348,2711 2347,2716 2353,2721 2355,2728 2347,2720 2331,2712 2321,2717 2318,2735 2320,2750 2317,2776 2327,2786 2328,2790 2319,2798 2308,2797 +L 2601,2904 2625,2913 2645,2940 2651,2944 2672,2951 2688,2952 2711,2949 2733,2937 2760,2929 2762,2912 2761,2906 2774,2882 2771,2879 2763,2882 2764,2886 2755,2891 2745,2880 2744,2875 2737,2869 2719,2865 2703,2858 2692,2862 2683,2868 2671,2871 2665,2867 2663,2849 2666,2840 2657,2833 2640,2835 2622,2826 2618,2831 2609,2831 2610,2832 2600,2842 2610,2838 2615,2847 2608,2842 2601,2848 2596,2848 2584,2842 2578,2827 2578,2821 2583,2816 2580,2807 2571,2799 2566,2807 2568,2816 2565,2827 2560,2833 2561,2846 2558,2860 2554,2862 2560,2872 2583,2886 2601,2904 +L 2104,2793 2094,2785 2089,2777 2081,2747 2079,2753 2081,2759 2075,2784 2077,2798 2075,2816 2070,2826 2071,2837 2080,2840 2088,2838 2096,2826 2092,2816 2098,2801 2104,2793 +L 2076,3038 2068,3035 2069,3051 2079,3058 2085,3072 2095,3082 2097,3090 2102,3095 2107,3089 2106,3078 2100,3072 2096,3062 2076,3038 +L 1790,3235 1792,3238 1794,3230 1790,3235 +L 1787,3236 1781,3235 1783,3240 1787,3236 +L 2285,3040 2283,3060 2286,3072 2293,3087 2297,3089 2304,3087 2320,3078 2323,3072 2323,3057 2326,3044 2324,3037 2316,3031 2304,3031 2291,3034 2285,3040 +L 2434,3176 2438,3164 2422,3137 2404,3119 2395,3107 2388,3102 2378,3099 2369,3090 2350,3095 2335,3103 2329,3098 2325,3101 2318,3112 2312,3140 2304,3154 2292,3166 2270,3167 2265,3172 2269,3181 2275,3182 2293,3171 2304,3168 2304,3200 2305,3168 2316,3170 2334,3182 2350,3190 2382,3197 2387,3200 2397,3199 2424,3207 2432,3203 2440,3203 2438,3200 2437,3200 2434,3176 +L 2204,3412 2209,3408 2216,3409 2206,3403 2200,3410 2204,3412 +L 2212,3429 2204,3434 2208,3438 2215,3437 2225,3431 2212,3429 +L 1577,3091 1569,3091 1561,3098 1567,3104 1574,3101 1578,3101 1577,3091 +L 1553,3108 1547,3112 1552,3114 1553,3108 +L 1553,3120 1549,3127 1552,3127 1553,3120 +L 1549,3128 1549,3127 1548,3116 1546,3116 1546,3131 1549,3128 +L 1629,3141 1633,3133 1630,3132 1629,3141 +L 1627,3152 1629,3141 1624,3150 1627,3152 +L 1633,3155 1627,3152 1629,3159 1633,3155 +L 1512,3140 1520,3121 1515,3125 1512,3140 +L 1713,3159 1721,3160 1723,3156 1714,3152 1713,3159 +L 1731,3166 1728,3163 1724,3169 1731,3166 +L 1309,3176 1307,3169 1305,3174 1309,3176 +L 1311,3178 1304,3183 1310,3185 1311,3178 +L 1363,3220 1368,3217 1369,3211 1364,3213 1363,3220 +L 1356,3213 1350,3219 1357,3224 1356,3213 +L 1344,3220 1340,3224 1347,3224 1344,3220 +L 1745,3286 1745,3290 1752,3286 1750,3281 1743,3280 1728,3283 1724,3289 1732,3290 1732,3293 1745,3286 +L 1721,3287 1728,3283 1741,3277 1751,3276 1752,3281 1762,3284 1764,3283 1768,3286 1769,3282 1775,3278 1764,3276 1749,3269 1731,3276 1725,3274 1721,3287 +L 1776,3286 1768,3286 1777,3290 1776,3286 +L 1788,3292 1776,3286 1782,3292 1788,3292 +L 1712,3285 1703,3285 1701,3291 1707,3291 1712,3285 +L 1754,3294 1752,3289 1744,3292 1734,3293 1749,3303 1748,3298 1753,3303 1756,3300 1769,3304 1769,3302 1756,3297 1754,3294 +L 1720,3307 1731,3303 1734,3298 1729,3294 1727,3299 1720,3307 +L 1738,3300 1731,3303 1723,3307 1732,3307 1738,3300 +L 1716,3301 1712,3297 1706,3305 1710,3301 1716,3301 +L 1718,3299 1717,3303 1723,3302 1725,3299 1718,3299 +L 1686,3308 1691,3311 1699,3308 1707,3301 1702,3302 1693,3300 1686,3308 +L 1713,3306 1715,3312 1720,3305 1713,3306 +L 1685,3310 1685,3304 1672,3313 1671,3319 1674,3322 1689,3324 1684,3320 1695,3312 1697,3310 1691,3312 1685,3310 +L 1705,3318 1695,3312 1692,3319 1700,3321 1705,3318 +L 1690,3319 1684,3320 1694,3323 1690,3319 +L 1710,3317 1704,3320 1712,3321 1710,3317 +L 1783,3318 1762,3319 1737,3304 1732,3308 1720,3309 1712,3317 1728,3328 1737,3328 1753,3333 1757,3336 1768,3337 1764,3328 1770,3336 1781,3332 1776,3328 1787,3327 1789,3323 1792,3328 1795,3325 1783,3318 +L 1733,3335 1726,3332 1729,3337 1733,3335 +L 1736,3347 1747,3350 1746,3343 1733,3336 1730,3338 1736,3347 +L 1746,3341 1746,3343 1748,3349 1756,3351 1762,3356 1770,3352 1775,3357 1776,3357 1783,3360 1792,3367 1792,3358 1799,3355 1792,3352 1794,3343 1797,3342 1779,3336 1761,3343 1768,3338 1758,3338 1742,3331 1732,3331 1746,3341 +L 1788,3334 1779,3336 1792,3337 1788,3334 +L 1796,3366 1792,3367 1786,3369 1774,3364 1768,3365 1772,3377 1775,3375 1792,3375 1799,3368 1796,3366 +L 1788,3328 1783,3334 1795,3332 1788,3328 +L 1761,3369 1752,3364 1758,3370 1761,3369 +L 1800,3242 1792,3241 1792,3245 1800,3242 +L 1781,3253 1787,3250 1773,3247 1764,3253 1781,3253 +L 1773,3273 1767,3270 1762,3272 1773,3273 +L 1768,3276 1772,3274 1762,3273 1768,3276 +L 1792,3285 1792,3283 1778,3283 1774,3283 1792,3287 1792,3285 +L 1770,3291 1758,3286 1756,3292 1770,3300 1779,3300 1771,3295 1770,3291 +L 1760,3311 1766,3310 1757,3304 1760,3311 +L 1764,3385 1775,3387 1761,3381 1764,3385 +L 1771,3392 1764,3385 1759,3385 1767,3393 1771,3392 +L 1768,3397 1756,3385 1760,3399 1766,3398 1768,3397 +L 1822,3449 1818,3444 1822,3456 1822,3449 +L 2153,3448 2141,3456 2154,3463 2155,3460 2167,3463 2171,3472 2176,3471 2182,3465 2186,3456 2184,3449 2176,3446 2172,3450 2166,3447 2153,3448 +L 2795,3479 2783,3476 2797,3482 2795,3479 +L 2175,3490 2169,3495 2173,3499 2175,3490 +L 3255,3546 3254,3540 3251,3546 3255,3546 +L 3218,3558 3217,3547 3206,3543 3211,3547 3209,3557 3218,3558 +L 3256,3556 3254,3562 3258,3563 3263,3570 3261,3562 3263,3559 3256,3556 +L 3288,3579 3294,3583 3300,3580 3288,3579 +L 3615,3684 3610,3678 3604,3675 3615,3684 +L 3584,3673 3566,3666 3561,3666 3548,3677 3540,3692 3554,3700 3557,3709 3584,3723 3604,3725 3609,3712 3608,3699 3614,3699 3615,3686 3584,3673 +L 3650,3696 3641,3702 3646,3706 3650,3696 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge.txt new file mode 100644 index 0000000..9ef81ed --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge.txt @@ -0,0 +1,194 @@ +# earcut/water-huge +L 3116,3071 3118,3068 3108,3102 3100,3105 3096,3113 3099,3121 3091,3135 3099,3133 3105,3144 3113,3144 3105,3143 3117,3157 3129,3155 3137,3167 3152,3177 3160,3187 3172,3204 3174,3195 3179,3217 3197,3225 3189,3217 3203,3217 3199,3202 3186,3188 3186,3174 3174,3166 3165,3145 3168,3143 3159,3143 3151,3118 3154,3107 3165,3110 3174,3105 3175,3082 3186,3076 3178,3089 3183,3103 3196,3116 3181,3105 3180,3111 3155,3111 3173,3130 3179,3150 3197,3170 3199,3178 3216,3190 3214,3203 3235,3219 3243,3212 3244,3198 3246,3208 3244,3219 3236,3240 3237,3249 3248,3262 3263,3267 3327,3313 3338,3327 3340,3340 3351,3349 3353,3361 3345,3365 3355,3387 3363,3392 3364,3401 3375,3413 3382,3421 3394,3431 3404,3433 3398,3416 3406,3433 3409,3422 3428,3400 3423,3392 3446,3377 3461,3366 3495,3354 3506,3343 3506,3334 3495,3338 3505,3332 3503,3323 3511,3316 3512,3303 3502,3302 3513,3296 3509,3286 3517,3283 3525,3277 3528,3269 3526,3277 3526,3287 3517,3288 3518,3301 3515,3313 3508,3329 3517,3333 3522,3341 3534,3344 3547,3333 3549,3323 3561,3314 3565,3302 3576,3301 3573,3314 3568,3329 3559,3348 3543,3341 3547,3362 3563,3362 3573,3327 3576,3309 3583,3292 3594,3256 3611,3205 3599,3181 3585,3172 3574,3167 3583,3176 3597,3193 3583,3184 3583,3192 3583,3200 3576,3188 3575,3198 3573,3190 3557,3197 3565,3205 3564,3211 3564,3224 3563,3233 3565,3245 3555,3240 3564,3226 3558,3218 3558,3210 3549,3208 3557,3202 3540,3186 3539,3195 3540,3204 3532,3198 3530,3209 3528,3222 3516,3220 3515,3235 3503,3239 3503,3241 3495,3241 3497,3249 3489,3260 3478,3271 3477,3281 3478,3272 3482,3253 3470,3248 3481,3245 3488,3230 3496,3232 3509,3221 3515,3199 3502,3197 3493,3189 3488,3181 3478,3174 3470,3185 3474,3172 3470,3162 3461,3170 3452,3169 3449,3160 3464,3158 3456,3146 3464,3154 3476,3153 3470,3145 3488,3161 3504,3182 3511,3171 3522,3166 3533,3168 3541,3169 3537,3158 3545,3152 3544,3163 3553,3159 3578,3138 3570,3127 3561,3128 3561,3120 3552,3119 3518,3101 3509,3090 3508,3085 3517,3085 3508,3079 3506,3071 3512,3056 3495,3053 3481,3056 3478,3066 3491,3073 3497,3099 3493,3091 3467,3086 3470,3096 3476,3104 3484,3106 3474,3108 3484,3124 3472,3116 3464,3116 3468,3107 3464,3099 3452,3108 3448,3120 3448,3112 3440,3114 3449,3108 3440,3108 3457,3103 3461,3090 3453,3089 3452,3099 3437,3103 3453,3083 3435,3077 3432,3087 3424,3087 3425,3077 3413,3082 3407,3090 3413,3102 3405,3102 3406,3116 3403,3094 3392,3092 3386,3101 3382,3118 3385,3130 3380,3119 3354,3116 3378,3115 3377,3107 3367,3098 3376,3100 3378,3092 3386,3092 3375,3084 3374,3071 3381,3082 3397,3081 3398,3072 3407,3061 3398,3055 3406,3057 3411,3045 3402,3042 3397,3033 3383,3037 3375,3035 3367,3038 3358,3047 3348,3040 3356,3041 3359,3033 3372,3034 3368,3024 3375,3032 3385,3029 3383,3018 3379,3010 3389,3025 3397,3024 3419,3040 3419,3023 3427,3034 3431,3043 3436,3029 3422,3010 3435,3021 3436,3008 3414,2983 3417,2995 3413,3008 3406,3000 3407,2992 3384,2994 3378,3003 3378,2994 3367,2995 3348,2988 3373,2990 3383,2990 3387,2985 3397,2985 3395,2975 3390,2964 3368,2965 3328,2969 3326,2977 3324,2985 3326,3001 3319,2988 3314,2997 3319,2986 3311,2984 3321,2974 3313,2978 3305,2979 3295,2982 3289,2970 3297,2977 3321,2973 3285,2952 3264,2928 3239,2921 3203,2882 3194,2873 3190,2882 3184,2892 3184,2883 3189,2880 3179,2880 3191,2877 3152,2864 3160,2878 3164,2890 3166,2902 3158,2907 3163,2891 3151,2882 3151,2873 3151,2855 3137,2864 3129,2860 3119,2869 3128,2859 3142,2850 3153,2849 3158,2858 3155,2848 3133,2837 3114,2818 3094,2819 3071,2818 3079,2816 3108,2809 3081,2774 3072,2753 3050,2728 3044,2711 3043,2694 3028,2690 3024,2679 2993,2629 2965,2604 2950,2584 2919,2559 2909,2528 2896,2507 2894,2482 2883,2474 2837,2458 2831,2438 2835,2413 2846,2402 2867,2396 2871,2429 2879,2431 2893,2446 2908,2456 2916,2454 2915,2462 2921,2458 2921,2466 2933,2479 2948,2508 2953,2528 2969,2552 2977,2545 2983,2537 3002,2542 3006,2550 2997,2553 2989,2549 2985,2541 2987,2551 2985,2566 2992,2579 3001,2575 3009,2575 3018,2574 3010,2576 3000,2577 3000,2592 3016,2602 3028,2613 3038,2609 3040,2599 3040,2608 3050,2609 3048,2621 3061,2620 3053,2618 3047,2631 3058,2650 3073,2662 3098,2699 3105,2704 3113,2704 3121,2730 3129,2733 3141,2747 3142,2730 3151,2735 3143,2740 3145,2752 3143,2763 3167,2789 3162,2777 3185,2754 3174,2766 3182,2791 3188,2781 3189,2796 3199,2796 3213,2777 3205,2791 3193,2803 3191,2815 3196,2826 3197,2807 3208,2815 3205,2824 3213,2823 3203,2827 3212,2834 3224,2832 3218,2821 3226,2827 3226,2819 3225,2790 3230,2801 3233,2799 3233,2821 3227,2837 3226,2849 3239,2846 3247,2848 3259,2865 3269,2916 3305,2899 3302,2889 3293,2891 3295,2883 3296,2875 3297,2884 3307,2882 3306,2890 3316,2890 3321,2882 3329,2881 3328,2888 3343,2888 3329,2890 3317,2894 3305,2902 3318,2906 3327,2908 3367,2899 3388,2886 3386,2878 3378,2880 3367,2878 3368,2870 3379,2864 3383,2876 3391,2882 3401,2872 3401,2881 3430,2880 3438,2885 3439,2873 3427,2875 3417,2868 3441,2869 3442,2853 3437,2832 3424,2828 3438,2827 3427,2825 3431,2815 3420,2824 3415,2836 3415,2825 3425,2816 3414,2817 3422,2811 3433,2808 3426,2794 3408,2799 3425,2803 3395,2803 3389,2816 3394,2802 3380,2796 3381,2807 3370,2802 3365,2812 3370,2816 3362,2816 3368,2825 3359,2823 3350,2818 3348,2835 3356,2846 3345,2833 3336,2843 3328,2844 3318,2847 3329,2841 3338,2831 3336,2816 3327,2813 3319,2815 3328,2808 3337,2808 3355,2808 3359,2799 3343,2801 3352,2795 3346,2790 3356,2790 3367,2791 3353,2779 3349,2783 3340,2783 3331,2793 3319,2783 3295,2799 3299,2791 3319,2780 3315,2769 3306,2770 3310,2751 3300,2746 3301,2738 3313,2746 3317,2758 3317,2767 3323,2777 3331,2776 3345,2775 3336,2774 3343,2760 3351,2762 3356,2762 3356,2748 3363,2757 3363,2768 3367,2776 3375,2776 3370,2758 3381,2774 3391,2778 3399,2779 3407,2772 3400,2764 3398,2753 3402,2744 3385,2729 3373,2717 3358,2695 3357,2704 3360,2719 3350,2715 3352,2705 3338,2709 3335,2701 3327,2696 3317,2706 3309,2704 3294,2708 3303,2699 3295,2693 3297,2680 3301,2683 3301,2691 3306,2699 3319,2697 3322,2681 3324,2671 3328,2667 3328,2659 3327,2648 3315,2651 3312,2643 3300,2645 3292,2633 3278,2629 3289,2630 3285,2621 3284,2608 3294,2620 3307,2636 3316,2629 3320,2641 3329,2640 3337,2639 3341,2653 3350,2655 3349,2660 3349,2669 3381,2667 3390,2680 3401,2691 3411,2689 3408,2679 3397,2670 3399,2644 3391,2648 3394,2640 3385,2640 3389,2631 3397,2636 3401,2628 3399,2616 3375,2612 3364,2627 3371,2610 3353,2606 3329,2611 3346,2599 3334,2590 3347,2592 3346,2578 3338,2569 3350,2570 3354,2559 3344,2544 3359,2538 3360,2531 3370,2531 3367,2539 3356,2542 3361,2560 3364,2573 3354,2580 3360,2593 3377,2597 3384,2589 3394,2599 3405,2601 3418,2599 3399,2582 3407,2577 3400,2559 3409,2572 3410,2581 3421,2585 3426,2574 3420,2588 3432,2583 3429,2592 3425,2602 3428,2615 3436,2615 3428,2619 3427,2630 3437,2630 3434,2639 3434,2650 3442,2658 3452,2649 3444,2661 3453,2665 3457,2656 3454,2664 3465,2667 3468,2659 3466,2670 3470,2679 3482,2674 3480,2684 3489,2685 3498,2687 3491,2678 3501,2679 3505,2668 3507,2653 3500,2643 3493,2633 3485,2636 3494,2632 3485,2629 3488,2619 3496,2614 3493,2603 3478,2605 3479,2595 3470,2593 3472,2582 3470,2565 3479,2559 3482,2550 3474,2548 3482,2547 3490,2542 3487,2557 3478,2571 3477,2584 3484,2594 3492,2596 3500,2582 3497,2593 3501,2602 3512,2604 3516,2596 3520,2587 3530,2577 3523,2591 3523,2600 3514,2604 3516,2612 3500,2627 3512,2629 3511,2637 3519,2635 3518,2644 3533,2642 3519,2654 3532,2657 3524,2660 3526,2670 3518,2669 3518,2677 3516,2689 3514,2701 3525,2717 3533,2718 3538,2726 3540,2737 3549,2734 3560,2720 3567,2728 3556,2732 3559,2742 3551,2739 3558,2764 3570,2767 3570,2759 3579,2759 3571,2766 3583,2774 3594,2769 3594,2783 3603,2800 3609,2787 3610,2762 3601,2769 3598,2765 3598,2754 3596,2738 3597,2748 3609,2748 3606,2732 3598,2725 3609,2718 3600,2719 3599,2709 3589,2706 3579,2715 3581,2704 3577,2704 3569,2704 3563,2690 3553,2693 3544,2679 3554,2690 3562,2689 3570,2697 3580,2698 3592,2702 3604,2698 3607,2688 3608,2700 3621,2697 3619,2711 3632,2698 3629,2685 3631,2677 3619,2676 3610,2682 3605,2673 3593,2678 3585,2668 3601,2672 3599,2660 3608,2672 3609,2657 3600,2652 3613,2660 3622,2669 3630,2671 3642,2673 3633,2684 3644,2679 3645,2653 3637,2654 3620,2651 3615,2641 3627,2650 3635,2650 3630,2638 3632,2623 3642,2619 3635,2561 3624,2537 3622,2551 3620,2541 3615,2550 3608,2558 3607,2528 3617,2529 3600,2513 3595,2527 3601,2539 3589,2554 3590,2542 3589,2534 3586,2522 3563,2523 3562,2531 3554,2543 3554,2531 3561,2522 3550,2519 3544,2527 3548,2517 3560,2518 3568,2519 3581,2516 3585,2503 3598,2501 3573,2481 3565,2490 3554,2492 3563,2484 3568,2474 3547,2476 3526,2474 3517,2477 3507,2479 3493,2475 3484,2471 3495,2474 3508,2477 3508,2468 3517,2474 3523,2466 3518,2443 3497,2443 3489,2439 3480,2421 3481,2410 3467,2413 3459,2408 3447,2407 3437,2399 3424,2400 3428,2409 3430,2421 3427,2413 3419,2411 3418,2396 3411,2409 3414,2422 3402,2436 3387,2439 3376,2431 3361,2432 3347,2423 3317,2429 3334,2417 3329,2401 3311,2404 3301,2397 3301,2387 3293,2389 3283,2383 3271,2387 3268,2395 3272,2377 3260,2365 3249,2364 3240,2366 3231,2347 3222,2347 3209,2346 3212,2334 3204,2330 3200,2350 3190,2349 3184,2339 3170,2340 3166,2332 3155,2322 3161,2311 3147,2306 3142,2291 3149,2303 3166,2307 3174,2317 3169,2327 3182,2330 3196,2339 3195,2331 3201,2325 3211,2325 3218,2331 3218,2339 3233,2339 3243,2357 3256,2355 3254,2340 3262,2343 3268,2359 3277,2353 3278,2366 3280,2378 3291,2381 3308,2374 3319,2387 3335,2392 3342,2407 3350,2407 3359,2413 3359,2404 3369,2396 3380,2397 3385,2406 3390,2428 3402,2421 3397,2410 3400,2382 3401,2384 3401,2407 3402,2412 3402,2398 3411,2376 3422,2375 3434,2386 3430,2378 3432,2369 3444,2362 3432,2371 3435,2379 3464,2378 3479,2387 3491,2382 3502,2383 3510,2380 3513,2371 3522,2373 3524,2403 3528,2369 3517,2371 3509,2367 3509,2357 3515,2366 3524,2364 3518,2353 3531,2364 3533,2352 3537,2363 3546,2366 3554,2363 3554,2355 3566,2354 3571,2344 3598,2233 3579,2200 3566,2194 3546,2192 3554,2193 3554,2207 3543,2208 3541,2217 3520,2210 3488,2216 3485,2205 3477,2200 3467,2190 3481,2203 3496,2201 3499,2209 3511,2200 3522,2207 3520,2190 3520,2178 3511,2168 3505,2180 3505,2172 3492,2171 3473,2167 3486,2168 3498,2168 3510,2164 3517,2152 3514,2147 3506,2147 3500,2156 3506,2143 3495,2141 3488,2153 3487,2145 3494,2137 3485,2140 3485,2133 3476,2133 3486,2128 3475,2121 3471,2117 3460,2117 3472,2115 3472,2106 3473,2119 3482,2117 3484,2125 3496,2124 3497,2132 3505,2134 3503,2123 3509,2134 3513,2126 3518,2128 3518,2137 3526,2132 3519,2115 3509,2110 3498,2108 3498,2096 3492,2101 3481,2101 3491,2098 3496,2087 3487,2088 3495,2081 3482,2070 3496,2080 3500,2065 3490,2056 3500,2056 3508,2059 3506,2067 3498,2076 3498,2091 3507,2088 3505,2097 3517,2100 3519,2092 3518,2103 3527,2108 3526,2093 3538,2092 3534,2100 3542,2105 3550,2110 3544,2102 3549,2090 3540,2077 3549,2082 3552,2090 3557,2103 3566,2086 3561,2073 3556,2064 3552,2066 3552,2051 3542,2053 3533,2049 3543,2051 3537,2042 3540,2034 3531,2029 3522,2028 3513,2035 3525,2023 3536,2025 3526,2013 3512,2006 3508,2017 3500,2020 3508,2012 3516,2003 3502,1994 3514,1989 3517,1983 3517,1975 3516,1967 3508,1962 3517,1962 3519,1973 3516,1997 3527,2002 3536,2003 3534,2011 3549,2017 3558,2026 3556,2007 3548,2004 3545,1994 3553,1978 3544,1966 3535,1967 3531,1959 3539,1959 3555,1966 3555,1944 3542,1942 3560,1943 3571,1931 3581,1927 3586,1940 3590,1931 3574,1929 3560,1921 3555,1932 3539,1935 3546,1927 3538,1924 3544,1916 3530,1914 3520,1913 3512,1913 3508,1903 3496,1897 3485,1904 3490,1895 3503,1892 3512,1906 3527,1911 3541,1909 3551,1914 3552,1905 3538,1895 3556,1904 3558,1878 3548,1878 3539,1878 3528,1875 3518,1870 3529,1872 3525,1861 3541,1869 3551,1872 3559,1857 3543,1861 3539,1851 3534,1838 3521,1847 3531,1841 3522,1837 3532,1837 3525,1826 3528,1818 3518,1812 3505,1820 3497,1818 3510,1825 3502,1840 3504,1829 3491,1826 3490,1814 3483,1826 3471,1841 3473,1833 3473,1823 3481,1813 3472,1818 3459,1816 3453,1810 3453,1818 3445,1815 3436,1822 3432,1812 3454,1807 3465,1806 3460,1795 3454,1784 3445,1790 3443,1781 3434,1784 3423,1781 3431,1775 3418,1777 3400,1769 3402,1777 3390,1773 3379,1765 3370,1766 3364,1753 3375,1755 3386,1766 3395,1767 3408,1765 3418,1770 3434,1766 3437,1758 3443,1767 3439,1776 3448,1779 3458,1777 3469,1784 3472,1779 3472,1764 3473,1774 3472,1782 3473,1800 3472,1809 3480,1797 3503,1806 3499,1791 3509,1789 3506,1802 3527,1796 3532,1808 3543,1798 3551,1795 3540,1804 3548,1807 3541,1825 3547,1827 3547,1842 3547,1823 3559,1807 3555,1819 3553,1829 3554,1837 3564,1837 3568,1825 3572,1834 3580,1837 3575,1839 3575,1849 3583,1859 3593,1858 3593,1842 3597,1834 3589,1831 3582,1821 3590,1826 3593,1810 3585,1807 3584,1796 3593,1793 3591,1801 3605,1804 3595,1812 3597,1821 3598,1829 3606,1819 3615,1815 3611,1825 3619,1822 3614,1831 3605,1826 3612,1836 3604,1831 3602,1839 3607,1854 3603,1864 3595,1865 3597,1875 3606,1874 3619,1866 3616,1855 3624,1858 3621,1847 3623,1839 3628,1848 3639,1835 3641,1811 3632,1816 3642,1807 3626,1806 3634,1802 3644,1801 3660,1733 3651,1755 3640,1770 3643,1762 3646,1752 3644,1740 3638,1751 3630,1748 3637,1744 3637,1734 3626,1738 3605,1744 3608,1756 3619,1757 3618,1767 3608,1758 3609,1770 3605,1754 3600,1771 3592,1766 3596,1758 3600,1737 3588,1746 3591,1736 3579,1738 3565,1734 3573,1729 3561,1717 3552,1723 3559,1714 3555,1704 3547,1696 3538,1694 3548,1694 3553,1685 3550,1694 3556,1702 3567,1698 3559,1708 3563,1717 3576,1713 3577,1722 3583,1732 3600,1729 3592,1713 3597,1722 3605,1734 3615,1732 3618,1724 3604,1710 3599,1702 3613,1714 3621,1712 3620,1721 3631,1723 3640,1723 3648,1728 3661,1732 3640,1721 3619,1694 3516,1632 3453,1610 3456,1619 3458,1628 3449,1613 3446,1622 3441,1634 3455,1642 3446,1647 3449,1661 3438,1671 3449,1673 3456,1682 3444,1688 3453,1680 3440,1676 3430,1676 3446,1660 3440,1652 3438,1642 3430,1645 3438,1641 3422,1639 3422,1631 3442,1621 3426,1621 3428,1616 3436,1616 3445,1610 3421,1602 3420,1611 3420,1601 3403,1594 3406,1602 3404,1611 3396,1622 3403,1632 3398,1624 3387,1616 3395,1616 3397,1608 3389,1608 3389,1599 3403,1593 3385,1573 3377,1568 3373,1581 3377,1589 3374,1593 3374,1585 3372,1576 3363,1572 3356,1582 3358,1573 3366,1567 3359,1554 3350,1562 3334,1554 3341,1563 3341,1588 3323,1598 3317,1588 3307,1601 3315,1612 3305,1605 3305,1615 3300,1624 3305,1626 3305,1644 3296,1645 3286,1656 3295,1648 3301,1638 3297,1627 3299,1612 3287,1608 3275,1617 3290,1604 3303,1608 3304,1598 3315,1583 3303,1587 3313,1579 3325,1582 3331,1566 3315,1569 3318,1558 3310,1561 3312,1552 3300,1550 3296,1562 3292,1552 3281,1551 3282,1562 3274,1565 3269,1575 3272,1565 3263,1568 3264,1565 3255,1565 3269,1563 3277,1562 3275,1546 3265,1547 3264,1537 3274,1542 3284,1546 3288,1536 3293,1547 3297,1537 3308,1543 3318,1541 3298,1531 3306,1526 3301,1514 3313,1516 3311,1527 3322,1526 3327,1535 3331,1535 3331,1520 3323,1520 3314,1511 3306,1510 3320,1504 3276,1492 3255,1480 3224,1481 3240,1492 3224,1490 3224,1499 3222,1507 3231,1504 3231,1516 3223,1522 3239,1524 3230,1526 3222,1526 3218,1537 3220,1545 3224,1555 3225,1569 3217,1558 3215,1549 3219,1541 3206,1544 3212,1535 3211,1527 3218,1517 3205,1514 3198,1522 3186,1524 3176,1531 3182,1522 3185,1516 3193,1516 3204,1509 3202,1501 3214,1507 3211,1491 3199,1493 3190,1503 3193,1495 3196,1484 3188,1481 3180,1486 3173,1482 3173,1498 3160,1504 3156,1514 3143,1524 3154,1514 3158,1505 3170,1495 3167,1483 3161,1481 3169,1481 3168,1473 3158,1468 3150,1466 3158,1465 3171,1475 3181,1477 3177,1469 3186,1476 3194,1476 3205,1475 3202,1457 3194,1451 3190,1460 3192,1450 3184,1454 3183,1446 3171,1440 3185,1439 3193,1446 3190,1436 3188,1426 3190,1414 3194,1425 3199,1436 3204,1448 3208,1457 3220,1459 3217,1447 3235,1444 3244,1445 3227,1412 3223,1389 3186,1367 3158,1353 3158,1372 3147,1369 3145,1383 3143,1375 3150,1363 3158,1350 3136,1332 3138,1340 3132,1337 3132,1346 3128,1336 3117,1348 3118,1340 3127,1336 3135,1332 3126,1320 3109,1322 3109,1331 3105,1319 3106,1311 3108,1321 3120,1317 3116,1308 3126,1318 3126,1309 3130,1320 3125,1288 3113,1271 3115,1255 3090,1247 3072,1252 3071,1265 3084,1266 3084,1297 3074,1305 3083,1300 3083,1308 3080,1324 3078,1335 3066,1334 3063,1342 3065,1357 3059,1348 3047,1347 3046,1355 3046,1344 3023,1344 3034,1343 3052,1344 3049,1336 3061,1333 3069,1328 3071,1320 3071,1303 3066,1293 3056,1295 3057,1306 3043,1309 3054,1297 3042,1300 3055,1292 3057,1286 3043,1286 3056,1282 3048,1278 3036,1255 3025,1249 3008,1240 3003,1234 2984,1234 2981,1253 2954,1274 2977,1258 2984,1267 2971,1269 2980,1273 2975,1286 2988,1280 2990,1289 3007,1293 2995,1291 2993,1302 2992,1293 2982,1289 2984,1297 2970,1288 2968,1277 2965,1291 2964,1300 2976,1304 2975,1319 2971,1331 2965,1340 2957,1342 2942,1338 2938,1353 2949,1368 2953,1376 2962,1390 2972,1389 2983,1398 2986,1407 2994,1410 2983,1409 2975,1396 2950,1384 2939,1386 2950,1380 2934,1360 2931,1351 2932,1343 2921,1341 2906,1338 2937,1337 2942,1329 2953,1332 2959,1323 2948,1315 2961,1320 2952,1311 2953,1294 2930,1282 2923,1291 2929,1281 2920,1277 2917,1265 2909,1258 2898,1255 2889,1265 2898,1246 2885,1237 2883,1246 2875,1243 2879,1246 2879,1238 2876,1222 2840,1217 2804,1226 2783,1227 2760,1220 2754,1212 2728,1209 2688,1174 2681,1194 2673,1197 2666,1212 2663,1197 2669,1197 2669,1189 2675,1178 2684,1170 2670,1160 2640,1155 2619,1142 2609,1149 2596,1150 2587,1147 2583,1137 2576,1144 2576,1153 2568,1157 2561,1149 2544,1154 2534,1161 2525,1161 2538,1160 2539,1150 2558,1148 2567,1145 2572,1136 2585,1123 2602,1137 2603,1126 2597,1111 2598,1102 2589,1101 2590,1093 2591,1082 2593,1069 2585,1072 2583,1080 2574,1074 2583,1076 2591,1062 2601,1074 2601,1082 2602,1093 2600,1104 2609,1098 2611,1080 2604,1054 2578,1023 2544,1023 2530,1027 2529,1033 2505,1033 2526,1027 2535,1019 2537,1012 2546,1012 2523,975 2515,980 2511,969 2506,953 2486,957 2472,945 2457,942 2456,933 2465,935 2463,918 2463,902 2474,931 2486,931 2492,938 2502,938 2515,931 2518,918 2527,912 2524,896 2528,864 2525,842 2488,787 2467,794 2447,827 2432,843 2412,850 2395,845 2373,849 2348,848 2317,884 2289,897 2251,898 2196,916 2162,913 2141,901 2129,864 2117,844 2086,819 2090,808 2087,796 2095,793 2084,755 2078,716 2073,707 2079,661 2097,610 2112,596 2108,580 2133,565 2136,550 2127,550 2142,539 2146,514 2174,488 2166,472 2162,452 2165,443 2173,447 2190,428 2257,380 2270,380 2282,415 2269,444 2243,473 2247,483 2256,486 2277,475 2272,467 2281,454 2288,462 2299,446 2312,443 2314,434 2326,435 2337,425 2345,427 2350,438 2341,439 2334,447 2325,442 2315,455 2301,455 2305,466 2299,480 2285,473 2286,484 2274,492 2266,487 2260,498 2234,498 2205,503 2190,534 2196,523 2209,514 2217,518 2217,509 2220,518 2210,523 2215,533 2201,541 2191,547 2177,554 2174,569 2165,580 2149,636 2162,651 2163,659 2155,668 2166,690 2162,707 2175,728 2162,757 2188,823 2234,856 2250,861 2278,852 2296,836 2308,833 2320,821 2351,803 2364,785 2368,768 2395,776 2415,773 2437,742 2447,739 2487,706 2485,697 2471,699 2468,696 2468,704 2457,708 2463,700 2464,692 2474,691 2483,685 2490,664 2486,650 2490,639 2506,627 2512,612 2510,592 2517,611 2513,636 2509,647 2501,645 2503,656 2504,671 2511,685 2520,693 2546,745 2550,768 2559,790 2568,799 2568,813 2573,857 2585,874 2585,886 2580,896 2596,896 2625,914 2618,901 2635,906 2648,901 2637,910 2634,919 2651,931 2658,943 2677,950 2686,930 2680,950 2685,960 2703,960 2688,962 2704,982 2694,977 2680,969 2678,960 2662,950 2656,983 2659,992 2683,994 2731,1023 2717,1013 2716,994 2718,1012 2730,1020 2738,1019 2748,1027 2744,1019 2753,1024 2767,1036 2778,1035 2841,1066 2856,1060 2849,1045 2856,1034 2855,1056 2872,1068 2855,1063 2860,1074 2869,1074 2876,1093 2870,1104 2878,1109 2887,1109 2902,1110 2911,1118 2920,1108 2922,1100 2909,1094 2898,1094 2894,1086 2892,1073 2897,1084 2903,1083 2903,1092 2913,1090 2922,1095 2942,1065 2934,1069 2940,1061 2933,1051 2925,1050 2915,1046 2924,1041 2933,1044 2946,1044 2947,1059 2955,1058 2955,1046 2967,1037 2959,1030 2941,1025 2958,1028 2956,1017 2948,1014 2960,1013 2961,999 2947,988 2932,989 2938,981 2948,984 2952,976 2952,966 2942,953 2943,938 2948,940 2948,950 2959,959 2962,973 2964,983 2975,985 2975,994 2978,1001 2987,1001 2979,1002 2978,1016 2972,1025 2980,1031 2984,1042 2976,1052 2979,1063 2953,1082 2957,1097 2979,1096 2988,1084 2989,1071 2991,1055 2986,1047 2997,1046 3014,1049 3014,1040 3010,1036 3019,1036 3022,1045 3037,1051 3052,1042 3054,1033 3069,1031 3077,1024 3084,1012 3072,1007 3064,1006 3056,995 3061,998 3071,998 3083,999 3092,1002 3096,1011 3087,1025 3088,1046 3083,1037 3073,1037 3068,1046 3056,1068 3036,1075 3028,1075 3004,1085 3006,1097 3031,1096 3057,1110 3073,1112 3073,1112 3088,1112 3145,1132 3142,1129 3160,1129 3147,1133 3172,1154 3196,1139 3183,1148 3174,1155 3199,1181 3204,1202 3208,1200 3208,1190 3204,1181 3213,1189 3215,1179 3218,1193 3231,1192 3228,1175 3234,1192 3244,1178 3238,1191 3251,1194 3225,1199 3231,1211 3223,1218 3227,1210 3213,1201 3205,1203 3225,1257 3230,1249 3231,1239 3231,1257 3240,1255 3233,1264 3252,1264 3237,1271 3229,1257 3233,1282 3251,1268 3262,1268 3277,1275 3270,1264 3268,1256 3258,1251 3263,1242 3252,1232 3238,1219 3244,1212 3244,1220 3250,1215 3250,1223 3255,1217 3255,1226 3266,1222 3275,1223 3259,1230 3271,1236 3289,1233 3279,1239 3279,1250 3296,1252 3306,1255 3287,1259 3315,1281 3311,1270 3326,1274 3325,1291 3333,1271 3323,1253 3316,1233 3308,1234 3310,1215 3314,1230 3323,1230 3324,1243 3349,1236 3335,1219 3326,1211 3334,1213 3348,1207 3346,1198 3358,1187 3361,1175 3353,1177 3342,1172 3346,1159 3333,1155 3329,1147 3312,1138 3309,1130 3306,1121 3296,1116 3310,1116 3317,1126 3333,1115 3322,1128 3330,1137 3341,1135 3343,1144 3356,1148 3354,1165 3371,1160 3380,1170 3375,1179 3374,1198 3359,1216 3366,1231 3379,1232 3372,1219 3381,1228 3383,1210 3386,1220 3404,1208 3399,1217 3415,1228 3404,1226 3386,1228 3384,1239 3392,1245 3381,1237 3362,1250 3371,1258 3368,1280 3381,1300 3391,1325 3391,1333 3403,1331 3399,1320 3407,1312 3404,1302 3395,1300 3396,1292 3394,1274 3405,1267 3402,1286 3410,1286 3407,1297 3419,1303 3417,1311 3425,1308 3422,1296 3421,1273 3434,1274 3431,1289 3427,1294 3435,1294 3430,1303 3443,1299 3445,1308 3430,1307 3431,1320 3420,1315 3413,1326 3425,1336 3433,1338 3439,1326 3449,1327 3435,1338 3437,1356 3446,1355 3449,1347 3445,1359 3460,1373 3473,1408 3490,1430 3512,1430 3526,1434 3516,1430 3497,1427 3487,1423 3490,1409 3498,1421 3506,1426 3505,1414 3514,1425 3519,1417 3529,1415 3512,1397 3525,1400 3522,1346 3507,1307 3538,1272 3530,1256 3529,1265 3527,1254 3521,1241 3508,1239 3520,1239 3487,1196 3474,1166 3443,1123 3424,1056 3427,1023 3433,1011 3461,975 3422,956 3410,965 3390,964 3395,930 3441,860 3436,833 3449,814 3428,807 3419,799 3400,761 3384,746 3371,726 3348,709 3343,700 3330,679 3319,668 3296,646 3276,611 3251,537 3253,432 3261,387 3255,379 3238,317 3229,246 3211,256 3197,264 3206,261 3207,252 3223,243 3239,184 3217,176 3214,186 3216,176 3204,169 3194,149 3194,140 3185,139 3194,137 3191,121 3190,103 3180,101 3185,74 3185,89 3194,70 3195,61 3188,42 3198,61 3188,91 3197,99 3208,91 3219,89 3206,84 3209,71 3219,74 3216,83 3226,79 3239,67 3223,69 3220,59 3226,67 3236,66 3236,55 3221,49 3234,50 3236,42 3240,53 3262,40 3268,32 3267,24 3280,14 3282,3 3285,-18 3292,-32 3282,-57 3276,-53 3276,-45 3264,-42 3255,-43 3267,-47 3258,-53 3244,-48 3235,-52 3229,-34 3238,-28 3254,-20 3236,-19 3242,-6 3233,-10 3229,-18 3221,-21 3211,-17 3214,-9 3206,-7 3202,-16 3201,-25 3211,-21 3199,-38 3210,-36 3215,-28 3222,-40 3214,-49 3212,-59 3223,-48 3223,-67 3213,-66 3214,-75 3227,-75 3223,-87 3232,-75 3242,-81 3237,-94 3244,-74 3249,-86 3239,-98 3242,-111 3231,-105 3223,-109 3218,-100 3212,-108 3209,-98 3201,-98 3198,-112 3201,-103 3213,-112 3220,-122 3230,-128 3238,-121 3250,-118 3252,-110 3257,-122 3261,-110 3252,-101 3263,-87 3290,-117 3289,-128 4224,-128 4224,-128 3474,-128 3475,-116 3486,-120 3475,-115 3473,-89 3458,-49 3458,-31 3469,-26 3476,-53 3493,-64 3507,-62 3502,-77 3504,-95 3507,-75 3510,-85 3509,-67 3523,-78 3513,-128 3509,-119 3509,-128 3717,-128 3705,-60 3718,-44 3721,-21 3735,-16 3727,-13 3724,-3 3716,18 3714,38 3723,41 3719,29 3727,30 3736,24 3739,15 3754,13 3761,-1 3771,-9 3765,-1 3763,10 3755,14 3764,18 3739,25 3742,35 3725,50 3735,54 3734,72 3742,70 3752,54 3760,51 3768,50 3779,46 3764,53 3748,66 3758,80 3768,73 3758,88 3782,84 3785,75 3794,67 3794,59 3807,50 3815,56 3825,47 3819,43 3819,25 3819,1 3812,-11 3821,-7 3833,-17 3846,-36 3859,-51 3854,-41 3844,-33 3837,-19 3823,-5 3826,12 3835,8 3826,15 3823,26 3829,39 3841,30 3841,22 3850,20 3865,19 3842,32 3831,46 3871,49 3850,53 3840,53 3830,56 3818,62 3827,67 3822,78 3815,66 3807,66 3812,77 3805,69 3796,77 3799,88 3788,93 3793,101 3787,94 3779,94 3779,106 3768,106 3765,116 3777,114 3765,119 3752,134 3751,142 3760,149 3745,148 3750,137 3735,120 3733,103 3724,99 3716,89 3713,103 3706,91 3703,79 3690,67 3681,69 3681,58 3693,51 3685,49 3684,41 3680,31 3692,40 3674,6 3672,16 3667,5 3658,5 3662,13 3651,19 3645,11 3643,-1 3641,-14 3633,-18 3634,-9 3623,-8 3622,-18 3632,-24 3630,-34 3620,-36 3617,-20 3614,-28 3612,-41 3618,-40 3618,-55 3638,-65 3636,-74 3598,-35 3602,-16 3593,-15 3587,-5 3576,-6 3565,1 3557,13 3554,48 3541,66 3542,74 3536,92 3526,90 3531,104 3529,112 3525,122 3521,114 3510,126 3509,169 3513,178 3519,162 3518,174 3518,191 3510,190 3503,218 3506,231 3501,245 3504,270 3511,284 3510,265 3506,265 3506,254 3516,260 3515,250 3524,263 3534,268 3536,250 3528,245 3518,224 3521,211 3527,200 3527,191 3541,170 3549,171 3547,159 3539,162 3530,160 3531,147 3539,149 3539,138 3543,147 3548,125 3542,117 3540,101 3548,101 3549,81 3558,94 3568,101 3574,92 3563,79 3569,87 3581,89 3570,75 3568,65 3568,55 3573,69 3582,80 3582,71 3585,71 3585,60 3588,73 3593,64 3591,73 3588,82 3589,91 3601,86 3602,72 3603,51 3595,41 3586,42 3582,16 3588,25 3590,38 3598,36 3610,53 3610,42 3618,39 3611,24 3626,20 3625,11 3631,19 3618,30 3621,38 3614,59 3616,74 3609,85 3612,93 3602,99 3592,103 3577,110 3569,125 3572,138 3573,160 3576,162 3576,171 3574,182 3570,193 3578,184 3585,193 3594,199 3610,212 3610,197 3603,199 3603,187 3590,181 3582,172 3594,169 3597,175 3597,166 3601,176 3611,183 3616,173 3610,164 3621,173 3634,162 3630,151 3619,161 3611,159 3598,153 3587,160 3594,148 3590,139 3581,139 3583,119 3588,135 3596,137 3597,128 3599,143 3607,118 3605,147 3610,136 3617,146 3619,138 3627,127 3617,121 3614,111 3635,120 3637,130 3633,137 3649,137 3646,124 3644,114 3625,105 3623,91 3623,78 3626,69 3630,42 3636,54 3649,40 3655,29 3656,45 3643,51 3642,59 3633,62 3631,70 3631,78 3646,71 3634,88 3643,93 3642,102 3655,101 3663,112 3669,97 3654,96 3666,94 3662,80 3672,81 3674,97 3683,88 3692,96 3682,98 3687,111 3681,103 3672,112 3682,122 3679,135 3690,141 3695,150 3695,129 3705,147 3715,161 3714,141 3707,129 3715,126 3712,135 3718,146 3720,136 3729,140 3726,151 3725,173 3726,159 3738,154 3730,162 3733,178 3738,170 3733,185 3722,182 3711,176 3708,186 3706,175 3689,178 3689,186 3682,178 3679,168 3671,156 3659,161 3668,170 3669,186 3661,185 3657,195 3658,206 3664,217 3675,233 3675,209 3673,199 3689,214 3695,203 3699,216 3712,220 3710,204 3714,215 3715,230 3707,229 3697,225 3689,223 3696,233 3687,231 3696,245 3692,253 3696,263 3712,281 3642,370 3642,391 3631,389 3633,400 3625,383 3622,397 3613,397 3600,392 3601,383 3589,367 3599,394 3606,411 3627,407 3624,415 3620,424 3609,432 3619,429 3624,437 3616,436 3616,446 3601,455 3596,473 3592,462 3583,457 3585,448 3574,458 3561,466 3570,472 3585,475 3599,492 3605,507 3603,519 3614,517 3617,509 3609,506 3607,497 3604,483 3612,479 3610,468 3610,458 3618,465 3615,487 3622,489 3622,503 3625,513 3633,513 3634,525 3643,529 3641,517 3642,506 3632,506 3642,498 3640,491 3632,491 3628,482 3637,484 3645,475 3637,470 3638,461 3646,463 3635,427 3641,435 3654,431 3652,420 3658,412 3669,419 3659,417 3661,425 3656,435 3645,439 3653,451 3650,473 3660,475 3647,484 3648,513 3652,510 3652,489 3660,485 3657,493 3658,507 3653,516 3661,512 3671,507 3682,507 3681,498 3677,485 3687,483 3680,473 3668,473 3670,464 3667,454 3674,449 3684,449 3684,436 3692,436 3686,451 3675,456 3678,464 3675,466 3687,466 3687,474 3698,478 3702,474 3702,464 3706,465 3706,457 3710,458 3710,431 3713,446 3706,475 3700,492 3708,487 3719,488 3721,478 3723,487 3732,484 3736,475 3745,469 3744,461 3736,451 3737,436 3740,446 3747,462 3759,449 3761,459 3770,463 3786,462 3768,467 3757,463 3747,485 3755,488 3757,499 3752,491 3743,514 3738,496 3729,499 3718,504 3706,504 3694,514 3709,525 3705,535 3713,536 3716,545 3731,543 3746,546 3740,537 3748,542 3747,534 3758,542 3762,531 3761,539 3771,538 3780,538 3781,530 3787,540 3792,536 3792,525 3808,524 3820,512 3810,527 3794,529 3795,540 3796,548 3806,544 3817,551 3826,549 3816,555 3801,547 3798,568 3793,558 3792,542 3775,547 3779,561 3772,541 3764,548 3751,546 3747,557 3760,559 3749,571 3749,579 3754,588 3765,589 3777,598 3768,595 3750,594 3747,586 3737,591 3746,582 3746,563 3742,551 3724,557 3727,565 3721,555 3709,559 3707,546 3697,548 3689,529 3681,528 3685,543 3695,554 3692,565 3698,577 3683,579 3681,588 3677,569 3674,556 3666,553 3659,562 3660,592 3649,570 3652,561 3644,559 3623,595 3633,616 3625,618 3619,607 3606,612 3593,631 3584,658 3592,673 3579,669 3578,658 3570,657 3560,639 3572,653 3580,650 3578,642 3581,629 3582,640 3595,611 3585,612 3583,604 3589,596 3568,600 3553,608 3553,617 3544,607 3527,604 3535,618 3532,637 3521,626 3520,636 3524,652 3538,675 3549,683 3551,694 3565,709 3580,741 3594,757 3599,778 3594,803 3601,820 3609,833 3630,848 3638,850 3649,873 3661,887 3674,878 3666,852 3668,829 3676,823 3667,805 3672,797 3681,798 3690,807 3695,827 3693,838 3688,853 3699,851 3709,842 3720,856 3739,865 3757,897 3755,905 3762,914 3774,932 3761,933 3755,925 3766,944 3775,945 3793,954 3814,957 3813,970 3802,973 3802,988 3788,1002 3788,1025 3766,1025 3789,1026 3839,1025 3789,1025 3791,1015 3804,1008 3826,1009 3814,998 3815,970 3827,976 3834,964 3842,977 3851,980 3837,988 3844,998 3859,988 3864,999 3861,1008 3872,1009 3887,1009 3880,1024 3888,1023 3891,1034 3877,1045 3868,1043 3859,1052 3851,1046 3860,1059 3896,1062 3902,1080 3921,1107 3956,1127 3952,1100 3941,1079 3940,1068 3949,1033 3948,1025 3958,1019 3965,1008 3960,995 3932,966 3917,964 3929,957 3943,933 3979,912 3987,877 3995,871 3988,862 4002,835 4013,843 4043,850 4061,902 4059,919 4058,928 4038,944 3979,955 3992,967 4029,1023 4029,1023 4029,1037 4059,1062 4065,1076 4064,1087 4060,1076 4049,1096 4079,1089 4090,1072 4097,1072 4139,1072 4155,1105 4174,1105 4166,1086 4176,1075 4174,1065 4185,1057 4193,1052 4195,1064 4191,1078 4208,1098 4208,1106 4222,1110 4224,1109 4224,1144 4202,1158 4177,1161 4182,1181 4169,1152 4140,1163 4117,1177 4134,1177 4126,1181 4124,1189 4115,1194 4115,1178 4096,1179 4075,1201 4081,1215 4086,1216 4086,1205 4087,1214 4095,1216 4109,1227 4102,1242 4100,1231 4096,1234 4096,1244 4103,1254 4115,1249 4127,1259 4131,1250 4133,1258 4140,1245 4138,1256 4141,1275 4150,1271 4142,1271 4159,1255 4169,1255 4168,1246 4177,1245 4180,1259 4190,1271 4182,1272 4196,1281 4192,1267 4209,1270 4218,1267 4221,1249 4214,1230 4215,1215 4221,1223 4219,1231 4224,1243 4224,1257 4224,1262 4224,1345 4224,1339 4224,1328 4215,1335 4213,1346 4203,1355 4213,1357 4215,1369 4224,1363 4215,1377 4208,1387 4217,1401 4224,1403 4224,1520 4219,1535 4221,1544 4217,1553 4209,1549 4215,1558 4206,1559 4207,1580 4199,1593 4205,1605 4215,1604 4223,1595 4221,1611 4212,1608 4211,1618 4206,1626 4214,1625 4219,1637 4214,1648 4224,1645 4224,1640 4224,2108 4220,2125 4224,2125 4224,2143 4205,2141 4180,2159 4188,2155 4195,2165 4207,2164 4196,2172 4201,2182 4187,2168 4170,2169 4171,2181 4163,2189 4173,2188 4163,2194 4164,2202 4173,2196 4179,2205 4186,2196 4185,2205 4174,2208 4176,2229 4192,2223 4199,2211 4210,2218 4212,2210 4223,2214 4224,2207 4224,2216 4217,2225 4221,2233 4215,2224 4203,2227 4199,2238 4209,2248 4197,2242 4185,2240 4186,2254 4198,2276 4187,2260 4178,2259 4161,2258 4153,2249 4150,2238 4150,2228 4136,2231 4144,2218 4114,2274 4123,2272 4133,2270 4117,2280 4139,2273 4152,2274 4140,2276 4133,2284 4141,2288 4147,2303 4157,2311 4171,2308 4163,2310 4158,2319 4144,2315 4135,2305 4125,2299 4108,2303 4097,2318 4091,2343 4096,2347 4096,2339 4112,2344 4110,2332 4119,2332 4121,2347 4131,2344 4146,2338 4155,2337 4164,2350 4180,2355 4195,2352 4200,2342 4201,2354 4213,2352 4224,2348 4224,2356 4207,2361 4184,2358 4176,2367 4162,2364 4155,2354 4141,2357 4119,2361 4115,2355 4106,2355 4101,2364 4105,2372 4108,2386 4096,2372 4091,2388 4078,2409 4067,2446 4059,2493 4073,2495 4074,2478 4073,2490 4087,2492 4084,2484 4089,2481 4097,2481 4099,2473 4088,2474 4092,2464 4103,2465 4102,2473 4118,2470 4118,2459 4129,2458 4129,2449 4121,2447 4126,2439 4135,2447 4143,2440 4142,2426 4148,2416 4156,2414 4159,2406 4161,2417 4153,2419 4144,2434 4154,2440 4152,2449 4163,2459 4171,2453 4166,2461 4153,2458 4136,2458 4121,2480 4141,2472 4157,2483 4168,2487 4160,2482 4149,2480 4140,2480 4128,2487 4112,2483 4102,2487 4097,2499 4098,2510 4108,2514 4117,2522 4140,2526 4126,2524 4114,2523 4100,2524 4091,2519 4084,2528 4093,2511 4089,2501 4079,2509 4065,2508 4057,2516 4050,2536 4067,2544 4057,2546 4057,2558 4050,2538 4037,2561 4029,2589 4033,2579 4030,2604 4034,2629 4035,2614 4034,2601 4038,2593 4043,2610 4048,2598 4063,2585 4076,2582 4080,2573 4089,2570 4097,2562 4095,2571 4075,2586 4084,2597 4097,2592 4108,2591 4095,2596 4103,2601 4095,2605 4087,2606 4066,2597 4063,2606 4073,2606 4048,2618 4052,2632 4052,2642 4064,2646 4082,2654 4091,2645 4084,2654 4097,2656 4094,2667 4085,2664 4086,2672 4080,2656 4068,2654 4060,2654 4042,2652 4053,2661 4045,2660 4035,2665 4025,2666 4026,2684 4032,2697 4046,2699 4037,2714 4039,2702 4031,2709 4027,2691 3983,2765 3974,2811 3974,2820 3977,2809 3985,2796 3995,2794 3998,2785 4007,2786 4004,2776 4012,2775 4015,2755 4022,2763 4038,2761 4020,2771 4035,2784 4044,2783 4034,2789 4024,2793 4024,2798 4013,2798 4017,2810 4013,2802 4001,2803 4002,2818 4013,2823 4003,2819 3991,2818 3982,2835 3983,2846 3993,2848 4005,2853 4017,2855 4028,2846 4019,2853 4027,2861 4010,2854 4000,2854 3992,2861 3992,2851 3973,2866 3968,2877 3984,2880 3967,2885 3970,2902 3983,2931 3987,2920 3988,2931 4002,2936 4010,2917 4008,2903 4016,2893 4021,2901 4012,2913 4026,2916 4014,2921 4015,2934 4032,2937 4018,2934 4014,2944 4024,2948 4015,2950 4006,2943 3992,2946 3986,2988 3992,3004 4017,3037 4023,3053 4022,3063 4031,3065 4036,3073 4050,3135 4050,3151 4091,3119 4083,3115 4076,3096 4087,3101 4086,3072 4087,3061 4087,3046 4094,3022 4092,3012 4091,3001 4097,2989 4097,3013 4098,2945 4101,2937 4097,2920 4105,2913 4113,2856 4122,2844 4112,2840 4123,2834 4124,2817 4129,2791 4136,2775 4140,2760 4130,2754 4145,2754 4154,2742 4150,2733 4139,2720 4154,2722 4159,2707 4183,2662 4182,2654 4183,2640 4189,2644 4189,2653 4197,2632 4209,2634 4205,2624 4213,2607 4203,2605 4209,2589 4211,2600 4219,2599 4224,2592 4224,2574 4223,2566 4224,2562 4224,2553 4224,2552 4224,-128 4224,4224 4205,4224 4183,4096 4158,4018 4122,3935 4097,3854 4092,3841 4075,3785 4050,3675 4045,3686 4047,3676 4031,3585 4015,3513 3993,3494 3963,3488 3945,3491 3919,3515 3880,3525 3873,3533 3887,3539 3897,3536 3924,3532 3923,3524 3925,3533 3936,3526 3950,3529 3962,3536 3976,3555 3981,3567 4002,3574 4018,3572 4003,3575 4018,3580 4022,3593 4014,3591 4009,3579 3992,3572 3992,3585 3993,3598 4002,3596 4007,3594 4007,3603 4010,3613 4027,3623 4012,3619 4004,3619 4005,3609 3995,3606 3986,3604 3995,3609 3990,3617 3998,3617 3999,3627 3987,3633 3991,3622 3978,3621 3985,3610 3981,3600 3981,3590 3986,3598 3986,3585 3976,3587 3984,3581 3983,3571 3975,3572 3967,3566 3948,3558 3955,3583 3946,3559 3936,3547 3882,3539 3879,3548 3887,3553 3893,3543 3891,3556 3899,3562 3898,3554 3907,3558 3909,3544 3913,3557 3915,3566 3907,3567 3905,3577 3916,3574 3911,3584 3914,3592 3916,3583 3920,3598 3909,3596 3901,3596 3907,3604 3913,3612 3908,3625 3917,3622 3923,3631 3914,3628 3919,3647 3922,3656 3917,3666 3922,3655 3913,3650 3916,3641 3915,3632 3906,3639 3907,3647 3898,3647 3908,3632 3899,3631 3905,3623 3903,3615 3895,3624 3897,3632 3894,3622 3883,3622 3891,3625 3888,3614 3898,3617 3901,3607 3890,3610 3891,3600 3892,3588 3903,3590 3893,3583 3890,3574 3877,3572 3880,3581 3872,3589 3869,3574 3869,3563 3858,3561 3860,3573 3851,3572 3851,3583 3847,3591 3855,3588 3854,3601 3865,3597 3861,3605 3869,3605 3858,3605 3850,3599 3841,3611 3842,3622 3852,3623 3843,3624 3843,3634 3840,3625 3823,3628 3821,3638 3813,3642 3822,3625 3836,3616 3828,3615 3830,3606 3840,3605 3847,3596 3839,3591 3849,3584 3837,3581 3825,3591 3831,3583 3830,3571 3839,3577 3832,3566 3844,3568 3841,3558 3851,3557 3851,3542 3842,3535 3863,3543 3865,3534 3802,3504 3749,3491 3749,3507 3764,3505 3750,3513 3767,3518 3742,3522 3734,3526 3739,3508 3729,3507 3745,3506 3745,3489 3684,3476 3607,3424 3585,3422 3573,3420 3569,3428 3583,3430 3583,3430 3608,3430 3619,3435 3609,3433 3607,3452 3588,3459 3587,3468 3578,3464 3568,3455 3567,3445 3555,3447 3546,3446 3536,3439 3523,3438 3528,3447 3520,3446 3528,3448 3520,3453 3526,3463 3518,3472 3531,3476 3520,3478 3518,3482 3526,3482 3519,3486 3532,3486 3519,3488 3527,3514 3530,3540 3541,3520 3550,3529 3560,3533 3562,3524 3570,3520 3565,3530 3573,3524 3571,3534 3583,3538 3583,3536 3583,3526 3594,3523 3592,3532 3586,3545 3585,3554 3584,3563 3590,3551 3591,3561 3600,3565 3605,3551 3608,3543 3621,3543 3629,3551 3613,3549 3619,3559 3631,3564 3618,3563 3614,3553 3611,3563 3606,3576 3613,3584 3608,3593 3615,3604 3628,3611 3605,3600 3607,3586 3601,3572 3591,3575 3593,3567 3583,3566 3577,3577 3580,3564 3567,3568 3576,3561 3573,3553 3566,3540 3556,3544 3558,3553 3552,3539 3543,3573 3534,3578 3522,3584 3530,3585 3522,3589 3527,3597 3542,3604 3542,3612 3550,3612 3557,3622 3568,3634 3566,3623 3569,3627 3577,3627 3575,3638 3585,3650 3605,3655 3626,3651 3649,3657 3658,3656 3655,3648 3661,3657 3671,3657 3674,3649 3669,3640 3669,3628 3679,3631 3679,3643 3684,3651 3695,3648 3679,3653 3686,3663 3694,3658 3693,3670 3703,3667 3706,3659 3704,3668 3718,3655 3712,3676 3722,3674 3722,3681 3714,3681 3699,3671 3696,3683 3692,3694 3691,3685 3693,3673 3682,3668 3679,3679 3681,3663 3671,3670 3675,3662 3666,3662 3657,3664 3671,3676 3672,3687 3661,3687 3652,3702 3651,3692 3664,3682 3654,3671 3647,3663 3636,3663 3631,3678 3633,3662 3617,3660 3610,3669 3605,3659 3596,3657 3583,3656 3578,3672 3584,3680 3589,3689 3585,3691 3594,3691 3585,3692 3584,3694 3584,3703 3587,3713 3600,3711 3589,3713 3583,3719 3583,3739 3566,3748 3566,3759 3558,3766 3574,3769 3585,3759 3576,3770 3578,3778 3578,3788 3573,3802 3583,3804 3575,3804 3579,3812 3574,3823 3572,3835 3585,3846 3605,3855 3614,3851 3637,3864 3650,3861 3660,3867 3651,3869 3642,3864 3633,3865 3624,3870 3615,3855 3603,3857 3589,3857 3579,3850 3571,3846 3567,3837 3571,3829 3573,3811 3563,3805 3550,3802 3560,3798 3564,3784 3561,3797 3574,3775 3554,3769 3547,3778 3553,3769 3543,3759 3534,3759 3522,3759 3533,3757 3541,3757 3554,3764 3560,3745 3575,3738 3566,3733 3543,3711 3568,3731 3579,3726 3580,3718 3579,3708 3567,3708 3571,3700 3580,3691 3573,3672 3574,3655 3564,3655 3563,3640 3548,3640 3537,3646 3537,3659 3537,3648 3529,3648 3540,3640 3551,3634 3543,3628 3522,3626 3507,3629 3508,3641 3496,3636 3493,3644 3496,3653 3490,3645 3491,3654 3482,3653 3486,3667 3474,3666 3474,3676 3485,3689 3474,3681 3472,3668 3463,3666 3460,3677 3456,3662 3441,3668 3438,3682 3428,3684 3424,3692 3418,3705 3423,3717 3416,3725 3416,3702 3420,3692 3428,3671 3438,3669 3443,3660 3439,3649 3431,3650 3439,3646 3441,3636 3446,3656 3465,3656 3473,3652 3474,3644 3483,3633 3475,3630 3472,3622 3465,3630 3461,3621 3472,3619 3468,3608 3474,3620 3484,3623 3507,3621 3506,3612 3514,3608 3505,3611 3490,3607 3500,3606 3493,3583 3492,3575 3472,3576 3463,3574 3481,3569 3491,3567 3508,3577 3511,3559 3496,3556 3487,3503 3447,3502 3440,3554 3411,3553 3385,3540 3361,3536 3349,3543 3344,3560 3343,3575 3329,3577 3329,3578 3320,3578 3312,3580 3304,3591 3317,3587 3309,3591 3312,3599 3307,3619 3304,3630 3300,3621 3307,3617 3307,3608 3300,3596 3301,3587 3293,3581 3274,3583 3283,3583 3290,3595 3278,3605 3264,3607 3268,3617 3259,3627 3246,3628 3254,3637 3267,3635 3271,3644 3263,3643 3253,3644 3230,3654 3226,3668 3216,3667 3212,3671 3197,3671 3206,3694 3203,3703 3193,3709 3192,3725 3196,3738 3187,3749 3192,3764 3208,3762 3210,3775 3197,3781 3186,3780 3184,3788 3185,3780 3199,3779 3209,3773 3207,3763 3190,3765 3184,3749 3184,3729 3190,3719 3182,3710 3195,3699 3185,3690 3181,3672 3188,3658 3204,3659 3210,3649 3217,3637 3231,3638 3240,3610 3234,3601 3253,3597 3257,3586 3262,3565 3272,3560 3287,3563 3295,3557 3306,3521 3292,3508 3289,3516 3280,3520 3274,3533 3260,3531 3248,3540 3236,3553 3229,3565 3219,3564 3216,3574 3201,3577 3192,3578 3202,3576 3215,3573 3218,3562 3227,3564 3242,3541 3236,3518 3228,3519 3237,3517 3241,3532 3252,3524 3250,3513 3260,3519 3274,3520 3263,3509 3271,3507 3280,3507 3278,3478 3270,3458 3261,3455 3272,3458 3280,3462 3284,3471 3298,3477 3294,3456 3297,3444 3286,3430 3257,3423 3241,3406 3239,3394 3220,3388 3201,3366 3183,3358 3175,3364 3184,3374 3175,3367 3149,3375 3134,3374 3121,3376 3113,3380 3098,3378 3105,3388 3100,3405 3108,3409 3107,3418 3098,3405 3100,3397 3089,3395 3101,3394 3095,3375 3105,3369 3115,3348 3123,3357 3134,3357 3137,3366 3160,3369 3158,3357 3167,3337 3164,3324 3151,3311 3117,3300 3073,3300 3058,3297 3046,3288 3030,3260 3031,3236 3049,3183 3048,3164 3037,3143 3038,3124 3034,3109 3026,3107 3030,3089 3026,3072 3016,3062 3013,3047 3024,3051 3032,3048 3032,3056 3038,3046 3029,3028 3017,3020 3006,3004 2998,3016 2993,3040 2982,3053 2991,3061 2981,3054 2975,3071 2966,3091 2970,3100 2973,3109 2981,3120 2973,3133 2962,3130 2955,3128 2967,3128 2976,3119 2968,3110 2969,3102 2967,3094 2941,3099 2925,3096 2916,3089 2905,3073 2894,3056 2866,3042 2862,3029 2847,3019 2834,3024 2836,3038 2829,3047 2813,3051 2803,3052 2794,3061 2776,3065 2778,3061 2769,3061 2794,3053 2803,3040 2814,3045 2822,3037 2824,3024 2832,3014 2838,2988 2812,2990 2745,2984 2713,3000 2693,3001 2656,2970 2639,2961 2623,2943 2613,2942 2582,2927 2571,2929 2565,2941 2553,2936 2539,2944 2529,2945 2538,2938 2550,2923 2556,2923 2564,2923 2567,2895 2560,2885 2559,2868 2549,2856 2547,2842 2551,2832 2542,2828 2558,2826 2538,2811 2529,2811 2532,2822 2523,2822 2496,2840 2472,2883 2454,2888 2452,2896 2461,2901 2451,2897 2451,2885 2433,2868 2423,2869 2419,2844 2413,2802 2398,2818 2383,2818 2375,2824 2356,2820 2346,2822 2331,2817 2325,2826 2309,2833 2309,2840 2309,2832 2315,2821 2288,2841 2266,2843 2255,2836 2250,2809 2238,2810 2224,2792 2221,2813 2191,2823 2170,2839 2182,2825 2163,2809 2155,2799 2150,2786 2142,2794 2133,2801 2121,2797 2119,2783 2121,2769 2143,2760 2155,2743 2156,2733 2146,2721 2130,2721 2105,2709 2096,2695 2097,2680 2115,2648 2114,2621 2119,2643 2103,2682 2102,2693 2112,2709 2149,2716 2168,2738 2165,2748 2173,2759 2164,2751 2165,2764 2167,2778 2177,2781 2190,2775 2204,2774 2222,2772 2251,2770 2275,2782 2285,2773 2275,2783 2278,2791 2313,2799 2350,2796 2339,2793 2343,2778 2334,2780 2338,2772 2347,2793 2362,2799 2371,2794 2389,2783 2405,2786 2423,2781 2435,2771 2425,2773 2447,2765 2442,2775 2433,2779 2440,2792 2441,2805 2432,2851 2441,2866 2454,2851 2473,2839 2496,2816 2487,2811 2475,2823 2464,2822 2455,2821 2475,2819 2485,2810 2497,2814 2514,2807 2527,2793 2540,2804 2566,2808 2563,2818 2569,2826 2571,2859 2608,2909 2634,2931 2651,2930 2670,2938 2668,2928 2674,2920 2684,2922 2698,2917 2697,2908 2682,2898 2699,2907 2715,2903 2725,2893 2724,2884 2715,2876 2716,2861 2706,2839 2698,2834 2702,2825 2700,2840 2710,2849 2718,2853 2715,2835 2728,2829 2726,2817 2715,2810 2709,2795 2725,2785 2727,2750 2731,2736 2722,2729 2706,2728 2721,2728 2722,2717 2712,2713 2722,2716 2731,2700 2726,2691 2708,2707 2696,2710 2689,2725 2679,2729 2676,2695 2693,2682 2685,2680 2665,2662 2668,2653 2685,2646 2686,2625 2680,2638 2669,2644 2653,2636 2653,2652 2649,2660 2635,2666 2627,2666 2626,2651 2627,2643 2631,2645 2631,2662 2646,2654 2652,2634 2672,2640 2677,2627 2688,2623 2689,2642 2686,2650 2678,2655 2670,2654 2687,2669 2695,2658 2691,2667 2702,2677 2694,2694 2682,2699 2688,2707 2696,2701 2705,2701 2716,2689 2728,2687 2732,2695 2735,2704 2745,2693 2724,2724 2736,2740 2744,2740 2743,2732 2746,2745 2753,2732 2753,2740 2773,2748 2771,2740 2778,2751 2792,2742 2782,2746 2782,2757 2782,2767 2768,2768 2765,2783 2761,2791 2766,2791 2766,2783 2759,2795 2760,2805 2748,2798 2754,2786 2740,2784 2748,2798 2733,2806 2746,2821 2758,2826 2765,2812 2763,2825 2760,2839 2738,2845 2727,2840 2728,2849 2739,2849 2743,2861 2759,2855 2764,2842 2772,2843 2783,2856 2774,2881 2753,2881 2729,2871 2733,2882 2744,2893 2743,2902 2732,2908 2740,2922 2768,2925 2807,2919 2823,2928 2848,2940 2864,2973 2864,2959 2873,2954 2881,2943 2900,2942 2891,2941 2904,2939 2874,2956 2873,2967 2884,2967 2895,2970 2938,2977 2982,2968 2993,2960 2984,2966 2969,2964 2970,2953 2973,2943 2985,2947 2981,2957 2993,2949 3044,2957 3061,2963 3071,2970 3074,2958 3084,2960 3075,2973 3098,3002 3114,3055 3123,3051 3118,3030 3121,3019 3119,3031 3126,3040 3139,3033 3153,3035 3145,3033 3139,3041 3130,3047 3139,3054 3128,3051 3118,3060 3116,3071 3116,3071 +L 3585,3686 3585,3686 +L 3585,3683 3585,3683 +L 3583,3682 3585,3682 3583,3682 +L 3840,3591 3834,3595 3840,3591 +L 3898,3585 3897,3585 3898,3585 +L 3583,3560 3583,3559 3583,3560 +L 3585,3552 3585,3552 +L 3871,3583 3872,3584 3871,3583 +L 3585,3523 3585,3528 3585,3523 +L 3583,2711 3583,2711 +L 3329,2659 3329,2659 +L 4095,2657 4099,2657 4095,2657 +L 4097,2339 4097,2340 4097,2339 +L 4206,1537 4204,1535 4206,1537 +L 3313,1535 3316,1535 3313,1535 +L 4095,1312 4095,1312 +L 4095,1278 4095,1278 +L 4096,1276 4096,1276 +L 4096,1275 4095,1275 4096,1275 +L 4095,1273 4095,1273 +L 4095,1268 4096,1268 4095,1268 +L 4095,1262 4095,1262 +L 4096,1260 4096,1260 +L 4095,1238 4095,1236 4095,1238 +L 3399,2667 3399,2667 3399,2667 +L 3645,2653 3645,2653 3645,2653 +L 3645,2651 3645,2638 3645,2651 3645,2651 +L 3529,1415 3532,1422 3529,1415 3529,1415 +L 3532,1422 3526,1436 3536,1459 3537,1437 3532,1422 3532,1422 +L 3742,70 3742,70 3742,70 +L 3986,2932 3986,2932 3986,2932 +L 3989,2934 3989,2934 3989,2934 +L 3531,3432 3531,3432 3523,3430 3531,3432 3531,3432 +L 3419,3718 3419,3718 3419,3718 +L 3306,3602 3306,3602 3306,3602 +L 3242,3400 3242,3400 3242,3400 +L 3116,3071 3116,3071 3116,3071 +L 3565,3391 3565,3391 3565,3391 +L 3565,3391 3565,3391 3565,3391 +L 4174,1692 4174,1692 4174,1692 +L 4172,1690 4172,1690 4172,1690 +L 4172,1690 4169,1684 4161,1680 4172,1690 4172,1690 +L 4016,1878 4016,1879 4033,1889 4016,1878 4016,1878 +L 4016,1878 4016,1864 4029,1859 4024,1850 4008,1839 4006,1863 4016,1878 4016,1878 +L 3315,1339 3327,1332 3331,1324 3323,1329 3311,1313 3325,1327 3321,1308 3312,1308 3290,1293 3305,1315 3315,1339 3315,1339 +L 3290,1293 3278,1276 3290,1293 3290,1293 +L 3635,3864 3623,3858 3623,3867 3635,3864 3635,3864 +L 3305,3591 3305,3591 3305,3591 +L 4097,3131 4102,3126 4062,3147 4084,3142 4097,3131 4097,3131 +L 4136,3071 4136,3071 4136,3080 4139,3072 4139,3057 4139,3036 4143,3020 4137,3036 4136,3071 4136,3071 +L 4193,3071 4206,3071 4193,3071 4193,3071 +L 4218,3073 4212,3077 4203,3078 4206,3087 4188,3104 4183,3114 4171,3114 4172,3122 4164,3122 4143,3131 4125,3156 4117,3157 4128,3161 4159,3147 4223,3071 4224,3071 4224,3063 4218,3073 4218,3073 +L 4113,3121 4113,3111 4102,3117 4113,3121 4113,3121 +L 4176,3076 4176,3076 4176,3076 +L 4200,3077 4200,3077 4200,3077 +L 3617,3544 3614,3548 3617,3544 3617,3544 +L 3912,3542 3924,3541 3934,3536 3942,3535 3955,3536 3939,3532 3949,3533 3937,3527 3929,3534 3900,3540 3912,3542 3912,3542 +L 3882,3558 3882,3558 3882,3558 +L 3876,3557 3876,3557 3876,3557 +L 3867,3549 3867,3549 3867,3549 +L 3542,3361 3542,3361 3542,3361 +L 3562,3323 3562,3323 3562,3323 +L 3566,3315 3569,3318 3566,3315 3566,3315 +L 4061,3204 4063,3200 4056,3190 4061,3204 4061,3204 +L 4050,3172 4049,3161 4044,3170 4047,3190 4039,3183 4044,3171 4033,3187 4034,3197 4043,3210 4063,3214 4085,3209 4092,3193 4090,3179 4068,3166 4068,3174 4080,3181 4081,3192 4077,3205 4064,3206 4051,3200 4050,3172 4050,3172 +L 4123,2945 4123,2945 4123,2945 +L 4158,2943 4160,2943 4160,2935 4158,2943 4158,2943 +L 4163,3063 4163,3063 4163,3063 +L 4167,3060 4167,3060 4167,3060 +L 4145,3018 4147,3005 4145,3018 4145,3018 +L 4151,2998 4158,2977 4155,2967 4159,2946 4150,2976 4147,2988 4151,2985 4151,2998 4151,2998 +L 4176,3066 4176,3066 4176,3066 +L 4185,3071 4189,3067 4185,3071 4185,3071 +L 3460,3072 3462,3080 3477,3083 3477,3075 3479,3067 3460,3072 3460,3072 +L 3433,2796 3432,2792 3422,2793 3433,2796 3433,2796 +L 3475,2876 3482,2867 3475,2876 3475,2876 +L 3438,2804 3438,2804 3438,2804 +L 3440,2953 3440,2953 3440,2953 +L 3444,2825 3444,2825 3444,2825 +L 3490,2860 3490,2860 3490,2860 +L 3418,2748 3407,2743 3404,2735 3418,2748 3418,2748 +L 3457,2870 3457,2870 3457,2870 +L 3417,2974 3419,2958 3400,2957 3407,2969 3417,2974 3417,2974 +L 3379,2902 3391,2899 3379,2902 3379,2902 +L 4209,2617 4209,2617 4209,2617 +L 2174,2799 2174,2799 2174,2799 +L 2762,2876 2769,2873 2752,2869 2738,2867 2738,2869 2751,2869 2762,2876 2762,2876 +L 2754,2782 2764,2779 2766,2769 2739,2775 2754,2782 2754,2782 +L 2735,2862 2735,2862 2735,2862 +L 2745,2763 2752,2758 2752,2754 2732,2754 2745,2763 2745,2763 +L 2679,2726 2688,2709 2682,2701 2679,2726 2679,2726 +L 2920,3005 2935,2994 2914,2986 2896,2981 2884,2974 2864,2973 2868,2983 2886,2997 2905,3016 2916,3016 2920,3005 2920,3005 +L 4096,2494 4096,2494 4096,2494 +L 3571,2424 3572,2433 3567,2446 3545,2469 3553,2469 3559,2457 3576,2461 3578,2451 3577,2467 3587,2474 3594,2467 3594,2475 3608,2480 3610,2469 3596,2434 3580,2421 3571,2424 3571,2424 +L 3637,2553 3628,2527 3637,2553 3637,2553 +L 4064,2507 4064,2507 4064,2507 +L 3622,2504 3622,2504 3622,2504 +L 3620,2493 3618,2484 3620,2493 3620,2493 +L 3730,1024 3735,1040 3748,1056 3748,1040 3730,1024 3730,1024 +L 3740,1025 3738,1026 3735,993 3728,984 3725,995 3732,1009 3733,1001 3740,1025 3740,1025 +L 4095,1229 4093,1228 4081,1217 4073,1234 4071,1253 4064,1278 4076,1293 4087,1283 4097,1285 4110,1286 4101,1291 4121,1285 4119,1276 4104,1258 4096,1258 4093,1268 4094,1258 4096,1245 4095,1229 4095,1229 +L 4173,1536 4167,1554 4153,1576 4166,1585 4154,1576 4163,1574 4172,1578 4183,1582 4186,1574 4198,1571 4190,1562 4191,1551 4199,1547 4196,1538 4196,1532 4188,1532 4196,1532 4204,1527 4201,1535 4207,1535 4207,1527 4213,1535 4224,1512 4224,1511 4209,1511 4198,1506 4190,1517 4194,1509 4192,1499 4200,1496 4202,1504 4224,1510 4224,1488 4215,1486 4216,1478 4224,1472 4224,1464 4207,1458 4193,1464 4189,1476 4197,1465 4203,1476 4204,1464 4212,1469 4204,1480 4195,1477 4198,1491 4207,1488 4196,1493 4173,1536 4173,1536 +L 3934,1537 3932,1553 3936,1580 3944,1579 3950,1595 3960,1604 3968,1630 3964,1639 3963,1650 3960,1666 3968,1673 3968,1664 3983,1662 3975,1640 3981,1627 3980,1618 3970,1606 3959,1589 3973,1578 3975,1562 3971,1570 3972,1556 3964,1540 3959,1537 3943,1537 3934,1537 3934,1537 +L 3959,1535 3959,1535 3959,1535 +L 4163,1915 4161,1880 4156,1894 4163,1915 4163,1915 +L 4151,1726 4153,1719 4145,1717 4151,1726 4151,1726 +L 4147,1710 4150,1702 4147,1710 4147,1710 +L 4182,1653 4177,1649 4187,1648 4195,1643 4189,1635 4198,1632 4196,1624 4186,1624 4175,1638 4167,1647 4169,1657 4164,1646 4165,1632 4175,1633 4178,1633 4178,1625 4168,1619 4166,1622 4166,1614 4161,1661 4157,1674 4171,1676 4169,1666 4163,1656 4176,1673 4180,1665 4180,1674 4189,1682 4209,1678 4193,1677 4192,1666 4200,1669 4209,1673 4216,1671 4216,1655 4205,1653 4197,1647 4182,1653 4182,1653 +L 4200,1619 4196,1620 4200,1632 4195,1642 4207,1648 4211,1636 4205,1627 4203,1636 4200,1619 4200,1619 +L 4170,1684 4172,1689 4184,1683 4177,1675 4170,1684 4170,1684 +L 4026,1835 4025,1830 4020,1821 4016,1808 4007,1836 4019,1836 4011,1832 4009,1822 4020,1830 4016,1820 4026,1835 4026,1835 +L 4003,1782 3999,1779 4003,1782 4003,1782 +L 4020,1840 4020,1840 4020,1840 +L 4037,1849 4044,1837 4036,1833 4037,1849 4037,1849 +L 3982,1555 3982,1555 3982,1555 +L 3971,1555 3975,1554 3973,1545 3965,1537 3971,1555 3971,1555 +L 4005,1781 4001,1770 3993,1764 4005,1781 4005,1781 +L 3941,1613 3944,1598 3941,1613 3941,1613 +L 3976,1591 3978,1588 3976,1591 3976,1591 +L 4095,1317 4095,1317 4097,1291 4088,1298 4081,1309 4088,1322 4092,1304 4095,1317 4095,1317 +L 4130,1263 4130,1263 4130,1263 +L 4203,1352 4201,1345 4203,1352 4203,1352 +L 4216,1371 4205,1369 4203,1363 4191,1363 4200,1366 4206,1385 4216,1371 4216,1371 +L 4199,1384 4192,1379 4182,1389 4190,1393 4192,1402 4206,1412 4216,1401 4208,1401 4209,1393 4199,1384 4199,1384 +L 4196,1408 4190,1407 4189,1417 4199,1420 4200,1410 4196,1410 4196,1418 4196,1408 4196,1408 +L 3308,1121 3308,1121 3308,1121 +L 3911,1297 3911,1297 3911,1297 +L 3797,1096 3798,1084 3802,1090 3802,1081 3801,1072 3795,1082 3797,1096 3797,1096 +L 3760,1062 3759,1054 3749,1051 3752,1061 3760,1062 3760,1062 +L 3939,1523 3944,1517 3939,1523 3939,1523 +L 3874,1315 3881,1311 3880,1298 3877,1307 3874,1315 3874,1315 +L 3926,1251 3930,1256 3948,1251 3959,1255 3963,1243 3953,1235 3950,1224 3940,1222 3953,1218 3963,1218 3969,1206 3964,1188 3954,1185 3944,1188 3952,1172 3933,1150 3924,1154 3913,1149 3902,1153 3924,1164 3923,1173 3908,1181 3887,1180 3878,1173 3888,1210 3874,1211 3876,1229 3882,1239 3884,1231 3897,1235 3893,1227 3880,1218 3896,1229 3904,1227 3892,1217 3903,1221 3904,1206 3894,1207 3898,1205 3898,1197 3912,1213 3929,1205 3921,1216 3926,1251 3926,1251 +L 3926,1354 3922,1360 3958,1389 3953,1374 3962,1375 3972,1373 3984,1390 3992,1388 3989,1384 3997,1384 3991,1352 3982,1338 3968,1332 3960,1322 3955,1299 3954,1307 3943,1311 3946,1321 3935,1329 3946,1335 3956,1338 3959,1348 3956,1361 3964,1362 3955,1370 3952,1360 3951,1368 3940,1363 3926,1354 3926,1354 +L 3964,1319 3977,1297 3965,1319 3974,1329 3974,1313 3983,1297 3980,1307 3984,1285 3975,1284 3971,1299 3963,1301 3964,1311 3964,1319 3964,1319 +L 3880,1273 3882,1260 3874,1251 3873,1262 3880,1273 3880,1273 +L 3899,1252 3899,1252 3899,1252 +L 2850,1094 2856,1086 2850,1094 2850,1094 +L 2827,1062 2827,1062 2827,1062 +L 2920,1145 2924,1142 2917,1130 2920,1145 2920,1145 +L 2928,1260 2930,1254 2922,1241 2899,1222 2922,1242 2928,1260 2928,1260 +L 2778,1057 2785,1044 2770,1042 2746,1030 2778,1057 2778,1057 +L 2115,589 2115,589 2115,589 +L 3687,959 3682,948 3672,941 3669,928 3681,942 3680,927 3678,908 3689,908 3698,920 3686,901 3696,903 3684,896 3678,885 3666,890 3664,908 3670,921 3665,930 3671,947 3678,959 3687,959 3687,959 +L 3606,543 3602,537 3602,524 3606,543 3606,543 +L 3631,900 3631,900 3631,900 +L 3512,596 3514,583 3512,596 3512,596 +L 3628,906 3629,897 3619,900 3628,906 3628,906 +L 3630,928 3639,923 3632,913 3630,914 3630,928 3630,928 +L 3514,576 3514,576 3514,576 +L 3452,79 3436,104 3437,124 3448,146 3456,149 3476,141 3460,133 3459,125 3452,116 3450,107 3467,85 3460,75 3452,79 3452,79 +L 3751,927 3754,924 3746,910 3738,906 3729,914 3737,921 3720,923 3719,942 3739,929 3751,927 3751,927 +L 3464,131 3475,136 3475,128 3464,131 3464,131 +L 3754,98 3750,80 3754,98 3754,98 +L 3221,-111 3221,-111 3221,-111 +L 3538,1694 3526,1695 3538,1694 3538,1694 +L 4182,1653 4182,1653 4182,1653 +L 4186,1574 4186,1574 4186,1574 +L 4204,1527 4204,1527 4204,1527 +L 4196,1493 4196,1493 4196,1493 +L 4202,1495 4202,1495 4202,1495 +L 4202,1495 4213,1492 4202,1495 4202,1495 +L 4211,1491 4211,1491 4211,1491 +L 4214,1488 4214,1488 4214,1488 +L 4211,1491 4211,1491 4211,1491 +L 4089,1275 4089,1275 4089,1275 +L 4099,1265 4102,1266 4101,1276 4099,1265 4099,1265 +L 4072,1259 4072,1259 4072,1259 +L 4072,1259 4072,1259 4072,1259 +L 4099,1265 4099,1265 4099,1265 +L 3792,525 3792,525 3792,525 +L 3792,525 3792,517 3792,525 3792,525 +L 2897,3001 2897,3001 2897,3001 +L 2918,3005 2918,3005 2918,3005 +L 2920,3005 2920,3005 2920,3005 +L 2918,3005 2918,3005 2918,3005 +L 2906,3002 2916,3001 2906,3002 2897,3001 2906,3002 2906,3002 +L 2748,2798 2748,2798 2748,2798 +L 3570,2759 3570,2759 3570,2759 +L 3300,2746 3300,2746 3300,2746 +L 3114,2710 3114,2710 3114,2710 +L 3114,2710 3118,2703 3114,2710 3114,2710 +L 4095,2569 4098,2560 4106,2555 4095,2569 4095,2569 +L 4048,2598 4048,2598 4048,2598 +L 4048,2598 4044,2590 4048,2590 4048,2598 4048,2598 +L 3605,3551 3605,3551 3605,3551 +L 3897,3536 3893,3537 3897,3536 3897,3536 +L 3938,3532 3938,3532 3938,3532 +L 3938,3532 3938,3532 3938,3532 +L 3656,3693 3656,3693 3656,3693 +L 3654,3671 3654,3671 3654,3671 +L 3300,3621 3300,3621 3300,3621 +L 3306,3594 3306,3594 3306,3594 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge2.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge2.txt new file mode 100644 index 0000000..d588ccf --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge2.txt @@ -0,0 +1,444 @@ +# earcut/water-huge2 +L -128,4224 -128,2734 -116,2736 -109,2749 -99,2750 -101,2734 -96,2724 -90,2708 -76,2704 -61,2690 -51,2691 -40,2674 -40,2660 -29,2647 -19,2647 -11,2643 -13,2652 -15,2671 -15,2679 -23,2679 -27,2696 -37,2706 -36,2715 -45,2708 -45,2720 -43,2732 -46,2745 -34,2757 -54,2764 -62,2769 -62,2786 -69,2800 -72,2824 -77,2838 -82,2867 -86,2884 -108,2908 -101,2919 -85,2911 -72,2897 -70,2880 -60,2880 -59,2873 -48,2873 -46,2859 -37,2860 -28,2850 -17,2842 -17,2834 -4,2825 8,2825 10,2817 12,2799 4,2800 8,2797 8,2787 22,2796 32,2788 52,2801 67,2781 78,2747 95,2732 97,2720 119,2709 109,2695 117,2701 114,2689 123,2680 128,2670 117,2666 120,2654 122,2669 131,2668 141,2666 143,2676 149,2684 148,2692 160,2698 152,2698 130,2699 133,2717 127,2722 118,2722 119,2743 102,2760 93,2761 83,2772 96,2790 116,2800 104,2800 85,2802 76,2799 80,2809 47,2819 31,2818 19,2846 21,2851 41,2851 61,2850 74,2856 77,2865 93,2877 100,2895 115,2898 138,2890 139,2882 139,2890 148,2891 170,2891 182,2885 197,2894 217,2897 193,2896 182,2889 152,2899 136,2894 113,2905 127,2910 137,2919 158,2924 167,2932 155,2927 143,2927 133,2926 123,2914 101,2909 94,2896 83,2909 91,2914 89,2929 81,2939 84,2926 89,2915 82,2904 92,2893 76,2887 74,2877 63,2878 54,2880 63,2877 49,2869 40,2879 40,2887 30,2887 22,2892 16,2873 1,2873 -13,2873 -27,2891 -20,2901 -1,2907 -10,2918 -19,2910 -33,2903 -43,2895 -57,2922 -60,2940 -69,2949 -85,2954 -95,2970 -99,2987 -88,2988 -75,2988 -79,2998 -93,2998 -94,2990 -101,2998 -106,2989 -128,3002 -128,4224 -128,4224 1249,4224 1247,4199 1231,4132 1221,4130 1230,4148 1214,4165 1198,4171 1162,4169 1134,4155 1091,4128 1068,4096 1025,4052 989,4001 924,3927 909,3902 904,3882 908,3871 909,3858 911,3830 905,3799 868,3727 827,3685 799,3668 787,3655 784,3642 782,3582 771,3537 765,3481 767,3441 786,3409 789,3381 785,3371 786,3361 776,3339 777,3314 770,3305 775,3278 734,3220 728,3203 729,3178 708,3167 695,3147 667,3134 666,3126 651,3121 645,3113 650,3104 630,3089 616,3074 615,3053 607,3047 607,3035 599,3034 603,3026 575,2980 532,2939 524,2926 509,2903 501,2865 509,2844 509,2831 526,2809 531,2794 540,2718 552,2713 543,2711 551,2705 537,2701 512,2675 503,2708 492,2717 502,2705 510,2671 493,2656 463,2663 485,2654 471,2627 474,2614 470,2603 475,2588 483,2583 486,2573 511,2538 550,2523 553,2514 561,2507 582,2472 595,2460 597,2452 605,2447 622,2409 638,2357 654,2337 663,2311 687,2278 718,2256 729,2254 739,2249 760,2240 776,2227 789,2219 786,2213 797,2213 819,2191 855,2170 865,2163 884,2150 897,2147 889,2134 898,2146 906,2143 907,2126 909,2137 917,2138 934,2145 958,2142 989,2146 996,2166 971,2170 967,2181 953,2181 933,2170 900,2180 888,2187 883,2196 868,2204 859,2204 872,2219 873,2234 884,2226 874,2236 876,2244 867,2229 870,2221 861,2209 842,2213 833,2218 812,2228 811,2242 796,2258 760,2272 740,2289 726,2295 704,2319 693,2326 689,2349 672,2382 671,2415 653,2417 643,2443 629,2448 623,2457 624,2473 613,2512 588,2545 576,2549 567,2563 534,2585 534,2596 547,2625 556,2624 571,2640 589,2624 573,2642 581,2642 584,2651 607,2634 615,2638 602,2645 596,2658 602,2665 610,2665 621,2679 620,2695 609,2721 589,2747 598,2758 594,2808 600,2837 583,2842 579,2818 575,2830 575,2880 584,2898 626,2901 630,2912 639,2919 653,2920 672,2937 683,2934 700,2968 706,2979 705,2970 711,2986 740,3032 748,3038 757,3034 769,3035 773,3044 788,3053 798,3089 824,3100 833,3112 844,3105 830,3099 837,3087 847,3084 845,3072 856,3070 858,3062 848,3056 851,3048 833,3037 852,3047 860,3043 877,3052 877,3042 881,3028 893,3034 893,3046 901,3029 914,3030 921,3045 938,3041 942,3054 948,3043 962,3052 962,3043 973,3041 974,3050 984,3045 988,3056 996,3049 1004,3055 1014,3049 1023,3049 1034,3045 1032,3033 1034,3013 1025,3007 1025,2977 1030,2990 1029,3006 1037,3003 1037,3012 1035,3042 1043,3045 1023,3053 1000,3061 997,3053 984,3057 982,3047 973,3052 967,3040 965,3053 950,3048 958,3062 947,3057 933,3059 929,3047 916,3045 915,3034 901,3032 902,3040 897,3048 881,3038 885,3049 880,3055 871,3055 860,3046 857,3055 857,3074 847,3073 850,3086 834,3096 846,3101 846,3110 858,3106 868,3108 890,3123 899,3119 910,3120 915,3130 901,3128 904,3137 917,3140 909,3145 901,3139 894,3130 892,3139 909,3182 946,3217 952,3207 947,3195 961,3188 954,3175 957,3156 949,3157 933,3163 923,3153 930,3143 934,3156 943,3148 943,3140 949,3156 957,3155 959,3141 968,3139 961,3121 973,3118 971,3094 973,3104 987,3095 974,3106 976,3115 988,3104 997,3103 989,3107 988,3116 976,3116 966,3131 987,3135 979,3132 984,3124 993,3137 1001,3135 971,3133 971,3141 961,3146 960,3155 961,3169 966,3181 953,3195 976,3193 1004,3203 1001,3194 1014,3189 1007,3197 997,3208 1012,3227 1020,3227 1023,3218 1032,3203 1026,3219 1027,3228 1024,3218 1023,3227 1011,3241 1014,3249 1025,3254 1057,3270 1068,3271 1077,3284 1088,3304 1100,3300 1098,3292 1100,3302 1125,3305 1133,3310 1122,3306 1107,3308 1116,3320 1122,3353 1129,3361 1137,3357 1153,3350 1144,3353 1139,3362 1122,3377 1132,3387 1146,3408 1161,3413 1166,3423 1170,3412 1179,3406 1177,3395 1166,3396 1155,3397 1166,3394 1157,3387 1170,3377 1169,3391 1177,3391 1193,3374 1188,3366 1196,3367 1210,3360 1203,3350 1195,3347 1196,3338 1205,3338 1198,3329 1207,3336 1207,3353 1221,3357 1219,3348 1220,3362 1233,3367 1243,3364 1257,3363 1260,3360 1276,3360 1268,3344 1270,3327 1282,3329 1270,3327 1269,3339 1281,3339 1269,3339 1274,3354 1282,3349 1280,3360 1290,3360 1287,3348 1287,3356 1296,3343 1291,3359 1304,3348 1320,3351 1311,3339 1321,3322 1331,3318 1343,3325 1330,3300 1338,3305 1336,3287 1344,3285 1342,3294 1350,3273 1355,3276 1355,3288 1359,3280 1358,3270 1345,3270 1360,3269 1352,3255 1365,3245 1373,3248 1376,3238 1380,3221 1386,3209 1372,3201 1375,3196 1367,3196 1376,3196 1367,3191 1377,3193 1380,3188 1365,3188 1361,3177 1368,3167 1357,3164 1353,3155 1361,3152 1346,3149 1341,3141 1342,3133 1334,3128 1335,3119 1322,3112 1330,3109 1320,3099 1319,3091 1310,3073 1321,3073 1312,3075 1321,3074 1317,3082 1326,3081 1330,3094 1334,3102 1341,3110 1345,3121 1337,3128 1345,3130 1347,3122 1357,3117 1359,3111 1359,3103 1363,3093 1363,3102 1360,3113 1350,3129 1364,3150 1358,3160 1368,3164 1373,3176 1381,3183 1389,3176 1381,3184 1381,3200 1391,3198 1398,3206 1413,3186 1391,3215 1379,3228 1382,3238 1384,3230 1397,3226 1395,3228 1407,3228 1394,3229 1397,3248 1391,3258 1380,3260 1377,3283 1361,3291 1359,3303 1343,3303 1352,3317 1350,3326 1341,3328 1330,3322 1320,3331 1332,3325 1354,3334 1357,3343 1347,3347 1335,3349 1346,3351 1337,3357 1345,3360 1337,3361 1338,3369 1328,3363 1334,3382 1325,3398 1345,3401 1346,3388 1347,3397 1358,3402 1361,3393 1370,3383 1371,3394 1362,3399 1387,3402 1374,3401 1388,3398 1376,3392 1388,3396 1375,3389 1387,3391 1375,3383 1388,3391 1404,3390 1387,3377 1396,3379 1413,3374 1411,3386 1407,3400 1435,3408 1436,3399 1419,3387 1427,3376 1420,3366 1429,3370 1427,3378 1422,3389 1430,3387 1430,3395 1435,3409 1453,3416 1445,3406 1443,3399 1443,3386 1454,3397 1462,3391 1465,3382 1473,3390 1474,3382 1458,3364 1477,3383 1473,3394 1482,3395 1478,3410 1494,3408 1494,3416 1493,3426 1502,3427 1510,3436 1514,3428 1505,3420 1514,3428 1513,3419 1522,3417 1507,3411 1520,3412 1518,3401 1526,3394 1522,3403 1523,3411 1532,3426 1543,3438 1548,3429 1554,3443 1568,3435 1570,3456 1579,3457 1588,3465 1580,3459 1579,3469 1580,3459 1569,3457 1563,3441 1555,3444 1546,3438 1537,3442 1528,3440 1526,3453 1537,3458 1542,3450 1537,3460 1526,3461 1532,3486 1528,3502 1527,3523 1536,3528 1522,3525 1522,3557 1513,3583 1511,3591 1509,3602 1509,3593 1473,3664 1450,3709 1429,3764 1417,3824 1458,3825 1491,3840 1504,3850 1522,3849 1526,3834 1518,3833 1530,3834 1532,3826 1527,3823 1535,3823 1535,3820 1544,3820 1560,3816 1571,3811 1563,3799 1554,3800 1543,3811 1552,3804 1551,3796 1559,3802 1556,3787 1547,3790 1556,3786 1564,3784 1560,3776 1552,3778 1564,3775 1570,3788 1586,3800 1574,3783 1588,3799 1582,3787 1597,3787 1595,3778 1580,3769 1579,3780 1579,3769 1581,3747 1589,3731 1604,3729 1603,3720 1605,3730 1596,3733 1608,3738 1609,3747 1617,3731 1633,3721 1631,3710 1615,3710 1614,3723 1610,3715 1616,3708 1632,3708 1642,3702 1651,3702 1635,3681 1625,3681 1616,3693 1621,3685 1615,3662 1625,3660 1635,3637 1644,3637 1655,3630 1648,3615 1680,3638 1678,3599 1664,3598 1661,3590 1672,3572 1687,3560 1701,3556 1711,3562 1716,3571 1724,3570 1735,3561 1753,3559 1762,3547 1740,3551 1727,3545 1716,3531 1714,3517 1723,3512 1734,3526 1744,3530 1752,3525 1780,3522 1774,3507 1749,3508 1742,3494 1729,3488 1751,3468 1764,3474 1777,3478 1798,3472 1807,3473 1796,3475 1794,3495 1782,3507 1779,3540 1792,3530 1810,3485 1843,3426 1872,3393 1873,3383 1860,3397 1841,3405 1845,3413 1835,3420 1835,3429 1824,3449 1803,3448 1807,3459 1809,3470 1798,3472 1803,3453 1794,3449 1796,3439 1788,3432 1787,3418 1802,3409 1815,3391 1844,3380 1847,3372 1844,3359 1854,3349 1853,3337 1876,3335 1880,3313 1901,3306 1908,3298 1880,3315 1882,3333 1868,3337 1884,3336 1872,3344 1882,3351 1870,3345 1870,3355 1881,3360 1874,3370 1949,3282 1971,3261 2006,3241 2018,3223 2016,3204 2004,3208 2001,3216 1979,3235 1962,3244 1960,3252 1951,3245 1956,3256 1947,3245 1944,3253 1953,3258 1943,3254 1933,3264 1925,3279 1912,3281 1908,3291 1904,3281 1909,3250 1915,3238 1924,3238 1917,3224 1904,3222 1899,3187 1905,3178 1902,3165 1912,3166 1913,3150 1911,3160 1907,3170 1918,3194 1927,3194 1936,3184 1951,3187 1966,3178 1964,3169 1973,3167 1982,3159 1995,3160 1984,3168 1970,3169 1975,3181 1992,3194 2006,3176 1992,3168 1995,3160 1995,3151 1992,3143 2004,3136 2005,3122 2015,3113 2029,3111 2027,3099 2030,3111 2032,3122 2033,3131 2040,3117 2034,3104 2028,3084 2038,3099 2049,3097 2049,3111 2050,3091 2063,3095 2055,3091 2067,3083 2063,3072 2056,3062 2061,3048 2070,3041 2089,3046 2100,3055 2102,3063 2112,3053 2117,3067 2135,3066 2157,3075 2168,3085 2170,3073 2159,3071 2151,3057 2162,3052 2161,3042 2167,3033 2160,3042 2166,3033 2153,3047 2145,3049 2139,3058 2149,3057 2145,3066 2146,3058 2135,3053 2141,3044 2133,3044 2120,3039 2130,3043 2143,3039 2130,3031 2120,3031 2128,3029 2139,3034 2131,3029 2144,3026 2149,3016 2139,3014 2136,3023 2128,3024 2111,3022 2105,3013 2112,3005 2112,2997 2101,2994 2113,2997 2110,2989 2117,2980 2121,2969 2123,2959 2122,2972 2143,2972 2146,2953 2134,2950 2146,2952 2128,2948 2148,2944 2138,2937 2151,2942 2151,2925 2169,2922 2169,2913 2164,2901 2172,2905 2164,2899 2172,2904 2173,2896 2182,2898 2171,2891 2197,2906 2222,2930 2233,2910 2223,2900 2214,2891 2224,2898 2222,2890 2238,2893 2247,2903 2243,2890 2234,2890 2243,2890 2240,2879 2231,2875 2222,2879 2230,2874 2218,2869 2204,2876 2212,2882 2189,2864 2202,2860 2215,2861 2225,2864 2223,2850 2235,2849 2247,2857 2249,2849 2247,2858 2254,2857 2254,2869 2265,2863 2266,2852 2258,2849 2247,2840 2239,2847 2245,2836 2227,2821 2224,2811 2224,2798 2213,2786 2201,2782 2183,2795 2185,2785 2169,2795 2182,2791 2189,2777 2187,2789 2194,2781 2202,2779 2201,2767 2206,2783 2221,2785 2219,2769 2225,2753 2215,2742 2205,2729 2197,2729 2194,2738 2194,2739 2194,2755 2182,2752 2174,2747 2173,2755 2160,2752 2156,2760 2143,2768 2147,2758 2156,2753 2171,2755 2173,2743 2169,2731 2174,2719 2166,2716 2166,2734 2153,2737 2147,2719 2131,2733 2122,2729 2120,2717 2111,2721 2109,2729 2101,2738 2102,2728 2096,2720 2089,2733 2089,2725 2095,2716 2094,2708 2085,2712 2085,2696 2076,2696 2072,2685 2059,2697 2049,2692 2032,2681 2025,2666 2003,2662 2024,2665 2013,2642 1998,2644 1987,2638 1978,2642 1967,2625 1964,2614 1951,2608 1930,2593 1918,2595 1926,2593 1915,2589 1904,2598 1900,2594 1900,2584 1890,2593 1895,2584 1905,2596 1911,2585 1956,2606 1967,2613 1969,2624 1978,2628 2004,2639 2012,2632 2026,2655 2049,2671 2059,2679 2058,2691 2072,2682 2078,2690 2094,2662 2087,2688 2094,2698 2110,2698 2114,2706 2106,2713 2119,2709 2130,2706 2123,2698 2117,2680 2108,2678 2116,2679 2113,2655 2117,2647 2105,2636 2099,2604 2094,2591 2088,2575 2088,2564 2098,2578 2089,2586 2096,2588 2096,2598 2105,2606 2103,2616 2107,2625 2110,2637 2118,2641 2131,2626 2121,2635 2125,2648 2116,2655 2115,2668 2123,2673 2123,2681 2131,2676 2123,2681 2122,2673 2122,2689 2131,2689 2124,2697 2131,2705 2125,2716 2140,2715 2141,2707 2145,2698 2140,2690 2130,2684 2140,2689 2141,2697 2152,2697 2145,2714 2158,2732 2160,2716 2166,2704 2175,2712 2189,2715 2198,2718 2218,2708 2211,2697 2214,2686 2206,2689 2196,2694 2199,2685 2209,2684 2219,2687 2232,2692 2234,2683 2231,2693 2219,2691 2219,2705 2222,2713 2229,2703 2223,2714 2219,2728 2228,2711 2236,2709 2230,2717 2239,2719 2239,2727 2230,2728 2243,2727 2243,2739 2249,2751 2259,2749 2267,2747 2258,2739 2268,2742 2263,2733 2268,2745 2281,2736 2290,2737 2289,2729 2280,2735 2272,2737 2277,2727 2285,2730 2269,2715 2268,2724 2262,2715 2264,2707 2276,2711 2276,2719 2284,2718 2291,2709 2299,2706 2308,2710 2316,2713 2319,2705 2330,2694 2326,2667 2325,2656 2326,2666 2328,2676 2339,2679 2347,2680 2348,2668 2340,2674 2350,2664 2335,2670 2347,2664 2334,2668 2350,2663 2361,2659 2363,2647 2352,2640 2360,2639 2369,2642 2363,2632 2376,2630 2385,2623 2398,2630 2394,2617 2378,2613 2368,2596 2379,2613 2390,2618 2407,2612 2418,2613 2433,2625 2441,2618 2439,2607 2429,2605 2426,2597 2418,2593 2405,2582 2392,2577 2405,2581 2414,2590 2427,2595 2437,2600 2438,2584 2439,2570 2436,2559 2441,2569 2436,2581 2445,2591 2453,2584 2452,2569 2456,2573 2456,2561 2450,2541 2438,2517 2453,2536 2453,2547 2464,2553 2473,2550 2479,2542 2493,2550 2489,2535 2493,2547 2503,2550 2499,2534 2487,2519 2494,2527 2500,2519 2494,2508 2502,2516 2492,2498 2508,2510 2503,2491 2493,2482 2505,2492 2507,2501 2521,2474 2519,2466 2533,2460 2551,2454 2550,2439 2538,2436 2534,2424 2550,2433 2561,2435 2577,2440 2569,2426 2560,2429 2548,2429 2558,2427 2575,2420 2567,2416 2550,2402 2540,2404 2532,2403 2541,2397 2551,2401 2559,2401 2569,2400 2580,2407 2573,2392 2576,2381 2567,2381 2579,2375 2561,2368 2552,2365 2547,2357 2554,2368 2550,2377 2548,2377 2548,2368 2539,2363 2545,2375 2547,2385 2541,2390 2533,2390 2546,2385 2543,2374 2532,2359 2528,2350 2528,2340 2533,2327 2535,2337 2535,2328 2536,2337 2537,2329 2529,2341 2529,2349 2529,2358 2537,2358 2546,2349 2541,2324 2533,2326 2529,2317 2537,2316 2541,2324 2546,2313 2551,2305 2542,2300 2551,2305 2549,2297 2553,2286 2545,2278 2555,2280 2557,2268 2543,2268 2553,2267 2553,2257 2561,2256 2574,2239 2565,2238 2556,2242 2538,2236 2546,2233 2560,2237 2573,2235 2583,2225 2565,2226 2573,2223 2578,2212 2567,2215 2578,2212 2580,2224 2588,2213 2576,2211 2568,2210 2560,2215 2524,2219 2518,2229 2522,2219 2561,2205 2585,2205 2613,2180 2602,2186 2609,2177 2600,2185 2607,2177 2599,2184 2590,2182 2608,2176 2587,2173 2568,2165 2588,2171 2604,2169 2614,2167 2624,2153 2621,2142 2629,2151 2634,2142 2592,2140 2617,2140 2602,2139 2613,2137 2626,2141 2625,2126 2621,2134 2609,2133 2583,2127 2578,2122 2586,2122 2610,2122 2631,2118 2623,2116 2622,2106 2614,2104 2621,2100 2611,2100 2619,2100 2611,2098 2619,2096 2617,2088 2618,2081 2626,2081 2625,2071 2623,2060 2623,2052 2628,2063 2637,2052 2627,2048 2614,2046 2616,2038 2615,2046 2623,2039 2630,2047 2642,2037 2654,2038 2665,2027 2660,2016 2668,2008 2651,2007 2650,2015 2642,2014 2630,2013 2615,2010 2609,2001 2594,2006 2600,1998 2569,1988 2560,1993 2544,1979 2534,1973 2546,1971 2553,1979 2561,1979 2574,1977 2589,1980 2600,1989 2612,1993 2621,1996 2627,1986 2619,1979 2628,1985 2644,1982 2645,1973 2645,1982 2654,1976 2660,1967 2661,1950 2636,1947 2645,1951 2656,1944 2659,1932 2647,1932 2653,1923 2642,1916 2634,1916 2628,1904 2611,1886 2602,1885 2602,1877 2623,1880 2620,1872 2610,1871 2625,1870 2635,1876 2651,1875 2654,1865 2643,1861 2658,1859 2659,1873 2666,1852 2656,1852 2651,1844 2616,1843 2638,1839 2621,1832 2635,1832 2620,1816 2630,1820 2624,1809 2629,1818 2645,1832 2654,1830 2649,1822 2649,1813 2654,1823 2666,1830 2670,1846 2682,1844 2696,1852 2709,1834 2700,1832 2707,1822 2699,1821 2709,1819 2711,1809 2728,1808 2739,1799 2730,1788 2714,1780 2695,1788 2680,1779 2673,1787 2663,1781 2650,1776 2639,1775 2647,1769 2638,1763 2629,1758 2614,1740 2622,1746 2630,1753 2638,1754 2666,1774 2702,1771 2716,1767 2728,1770 2723,1762 2708,1766 2676,1764 2712,1761 2691,1750 2689,1728 2696,1744 2700,1752 2716,1762 2724,1758 2747,1755 2745,1745 2753,1751 2751,1769 2742,1821 2729,1831 2739,1825 2735,1831 2727,1831 2737,1832 2729,1836 2739,1840 2730,1844 2725,1852 2736,1847 2735,1858 2731,1871 2732,1861 2722,1868 2730,1875 2725,1889 2723,1899 2714,1903 2722,1907 2714,1907 2715,1915 2717,1924 2712,1938 2697,1944 2707,1951 2708,1960 2700,1956 2703,1972 2705,1983 2706,1998 2699,2008 2708,2008 2704,2009 2704,2029 2694,2049 2681,2049 2697,2049 2694,2057 2691,2073 2699,2089 2694,2109 2690,2171 2687,2180 2688,2197 2682,2243 2675,2252 2674,2265 2682,2290 2674,2287 2679,2300 2671,2305 2662,2299 2651,2289 2654,2300 2667,2308 2681,2323 2710,2049 2733,1891 2764,1727 2776,1685 2767,1679 2765,1683 2754,1683 2743,1689 2734,1703 2720,1709 2711,1708 2699,1700 2690,1686 2673,1680 2681,1678 2681,1665 2678,1656 2675,1639 2680,1631 2681,1644 2688,1654 2691,1667 2694,1673 2694,1683 2699,1691 2710,1697 2719,1697 2734,1688 2756,1669 2746,1666 2748,1657 2757,1661 2765,1660 2762,1670 2754,1671 2767,1674 2781,1626 2810,1522 2794,1521 2783,1526 2776,1535 2765,1535 2744,1531 2734,1510 2745,1515 2762,1525 2766,1513 2764,1505 2781,1510 2786,1520 2809,1520 2812,1494 2828,1438 2850,1332 2862,1242 2863,1186 2858,1103 2849,1075 2847,1025 2832,985 2814,958 2810,966 2796,966 2794,977 2811,986 2817,1021 2830,1025 2739,1025 2831,1026 2830,1057 2842,1063 2845,1081 2836,1076 2850,1090 2848,1101 2855,1117 2859,1174 2853,1235 2844,1227 2836,1240 2835,1232 2827,1235 2835,1242 2838,1253 2846,1252 2844,1263 2842,1254 2828,1252 2831,1261 2839,1279 2828,1273 2811,1286 2820,1277 2827,1261 2824,1246 2808,1252 2806,1262 2807,1250 2794,1258 2791,1266 2785,1277 2776,1277 2788,1262 2768,1263 2759,1272 2751,1272 2775,1260 2790,1259 2797,1240 2784,1243 2802,1233 2777,1234 2792,1228 2798,1220 2800,1225 2809,1225 2811,1217 2804,1215 2812,1215 2820,1205 2829,1202 2842,1199 2854,1187 2851,1160 2827,1161 2806,1154 2797,1161 2788,1159 2776,1176 2754,1175 2744,1183 2740,1195 2724,1204 2713,1198 2708,1213 2699,1221 2703,1229 2705,1209 2710,1195 2723,1193 2724,1179 2739,1170 2755,1166 2784,1148 2797,1145 2797,1134 2785,1123 2794,1125 2799,1134 2811,1136 2819,1131 2829,1145 2848,1143 2850,1123 2846,1108 2821,1092 2811,1094 2788,1088 2770,1081 2762,1081 2734,1068 2712,1051 2704,1048 2653,1025 2626,1005 2606,1020 2598,1022 2579,1020 2565,1004 2548,1023 2540,1034 2511,1046 2520,1038 2516,1024 2494,1012 2478,1004 2465,1002 2447,992 2429,1008 2429,1016 2444,991 2428,951 2424,940 2402,935 2393,923 2397,914 2372,915 2356,945 2341,955 2319,960 2308,959 2304,970 2295,978 2284,980 2288,963 2275,966 2264,962 2261,948 2247,958 2242,944 2231,944 2223,938 2208,948 2194,947 2180,922 2166,911 2120,900 2099,866 2072,842 2062,814 2047,809 2057,808 2066,816 2073,841 2100,866 2122,900 2169,909 2181,920 2189,940 2197,945 2207,945 2221,935 2241,938 2250,948 2258,945 2254,944 2264,944 2265,958 2283,955 2283,943 2283,955 2291,962 2288,976 2301,969 2302,954 2312,951 2302,939 2312,951 2331,947 2341,939 2353,918 2376,901 2392,899 2403,905 2410,915 2434,923 2443,897 2449,886 2458,880 2452,849 2450,817 2451,828 2455,820 2484,802 2500,809 2509,786 2517,740 2528,737 2529,728 2521,724 2523,692 2527,667 2544,646 2561,636 2576,628 2592,611 2605,617 2619,589 2588,563 2612,577 2624,560 2617,551 2597,542 2619,548 2629,561 2641,544 2646,530 2641,506 2649,467 2641,460 2652,461 2647,496 2652,506 2672,497 2674,489 2683,466 2710,452 2710,447 2687,447 2681,435 2691,414 2689,388 2698,373 2688,370 2690,362 2698,371 2701,360 2712,349 2693,330 2715,349 2732,333 2772,327 2776,313 2766,291 2774,286 2775,269 2779,245 2769,219 2770,200 2771,198 2771,217 2781,242 2778,255 2789,269 2802,270 2816,219 2809,246 2804,273 2791,273 2781,259 2778,273 2781,283 2772,293 2780,320 2773,332 2765,334 2773,340 2781,342 2771,351 2773,359 2765,363 2763,353 2770,343 2762,350 2754,351 2761,342 2758,334 2738,337 2724,352 2714,355 2692,390 2696,410 2688,426 2686,440 2710,438 2714,453 2705,463 2692,467 2678,503 2667,511 2667,531 2660,549 2657,558 2648,577 2639,593 2636,605 2628,617 2618,623 2611,637 2612,647 2648,642 2652,631 2680,636 2695,628 2689,611 2691,606 2680,606 2665,598 2693,601 2719,614 2682,587 2693,585 2725,604 2703,584 2717,587 2719,579 2709,572 2718,574 2705,560 2717,560 2726,549 2742,557 2740,548 2762,530 2771,528 2744,515 2760,517 2775,513 2774,505 2772,493 2783,484 2777,475 2768,473 2783,474 2790,452 2790,442 2782,432 2794,428 2792,420 2801,402 2807,398 2807,390 2822,377 2834,342 2845,336 2845,328 2867,287 2866,272 2881,247 2883,232 2903,188 2934,195 2949,205 2940,206 2931,197 2913,231 2899,250 2900,262 2889,292 2883,304 2840,375 2838,385 2831,398 2826,407 2818,413 2818,421 2806,440 2808,449 2804,459 2806,475 2800,484 2803,498 2794,527 2803,539 2814,534 2824,522 2849,520 2863,487 2859,470 2863,455 2905,395 2904,379 2925,355 2925,344 2917,328 2916,279 2937,235 2951,215 2950,206 2919,278 2921,332 2927,342 2950,353 2964,337 2974,333 2989,342 2999,341 3014,334 3014,326 3026,331 3043,337 3042,324 3051,313 3059,335 3067,337 3067,329 3089,320 3123,339 3106,323 3103,315 3108,323 3116,316 3106,310 3102,298 3092,300 3094,292 3090,284 3089,263 3088,247 3094,233 3083,233 3079,212 3083,183 3073,175 3082,160 3078,176 3081,211 3091,211 3091,225 3101,231 3107,243 3112,254 3115,241 3125,229 3125,216 3134,215 3135,205 3136,195 3128,190 3121,205 3110,220 3099,209 3109,214 3124,185 3134,177 3138,168 3148,152 3142,174 3152,166 3162,160 3165,149 3160,137 3152,130 3161,129 3169,133 3173,123 3189,124 3195,120 3195,105 3196,91 3198,101 3204,92 3203,101 3213,94 3208,112 3213,100 3221,100 3227,80 3204,71 3215,71 3211,60 3221,59 3218,68 3229,73 3237,59 3235,67 3247,68 3255,59 3263,51 3271,41 3261,78 3267,69 3281,69 3276,61 3284,59 3281,47 3292,31 3300,26 3314,25 3322,0 3313,-4 3317,8 3309,2 3313,-15 3321,-13 3337,-42 3345,-62 3345,-47 3353,-42 3365,-42 3369,-57 3360,-67 3368,-65 3363,-75 3372,-60 3374,-71 3377,-58 3384,-79 3386,-71 3385,-62 3398,-74 3402,-93 3412,-103 3414,-81 3418,-73 3409,-72 3414,-60 3423,-60 3424,-69 3433,-70 3437,-80 3440,-92 3443,-83 3448,-75 3445,-66 3447,-57 3439,-47 3430,-54 3427,-41 3446,-42 3451,-63 3459,-72 3471,-83 3478,-99 3476,-88 3480,-83 3480,-91 3488,-96 3483,-121 3490,-102 3490,-110 3495,-100 3496,-108 3505,-120 3502,-128 3508,-119 3497,-103 3507,-71 3517,-77 3526,-97 3517,-103 3517,-121 3520,-113 3539,-113 3543,-126 3550,-128 3562,-128 3568,-118 3571,-128 3582,-108 3585,-123 3584,-128 4224,-128 4224,28 4216,28 4216,32 4224,32 4220,45 4212,31 4166,14 4145,14 4156,19 4169,17 4164,25 4180,56 4172,65 4165,55 4139,42 4141,56 4130,60 4130,70 4123,59 4113,56 4113,48 4121,58 4132,50 4132,37 4124,35 4120,23 4105,32 4110,43 4106,53 4109,63 4104,51 4095,52 4091,40 4107,26 4111,17 4124,22 4147,26 4142,20 4125,20 4106,5 4095,15 4079,25 4077,35 4068,35 4059,28 4073,29 4047,24 4068,47 4063,104 4068,100 4068,85 4070,70 4074,81 4074,89 4069,100 4059,114 4063,125 4041,131 4029,146 4032,167 4021,160 4011,142 4012,127 4027,115 4026,124 4033,112 4045,113 4058,104 3959,139 3939,136 3944,144 3934,136 3891,126 3850,107 3815,101 3776,100 3776,114 3774,104 3743,92 3709,50 3696,47 3690,104 3686,124 3688,114 3693,97 3714,110 3721,100 3716,84 3729,90 3722,72 3740,94 3732,90 3724,99 3739,96 3766,111 3762,128 3764,154 3764,163 3762,172 3750,176 3748,174 3748,163 3753,155 3732,127 3723,149 3731,152 3736,163 3725,155 3717,146 3701,137 3680,146 3646,143 3649,154 3667,162 3671,171 3668,182 3665,174 3659,163 3651,161 3631,155 3641,152 3647,137 3636,139 3625,129 3579,133 3574,138 3574,130 3620,127 3634,114 3648,111 3644,128 3654,114 3652,98 3642,88 3603,83 3581,72 3572,63 3560,74 3562,83 3567,71 3568,79 3560,90 3560,81 3554,109 3563,117 3579,154 3591,202 3606,211 3604,232 3594,220 3602,221 3603,216 3590,216 3584,208 3567,199 3563,188 3557,163 3536,167 3534,178 3544,204 3534,201 3517,204 3506,197 3489,199 3480,182 3480,152 3452,160 3457,178 3443,162 3445,151 3456,154 3468,142 3479,147 3492,146 3501,139 3510,126 3517,137 3516,157 3508,169 3501,173 3501,181 3520,180 3521,162 3526,152 3539,151 3536,139 3519,125 3503,129 3481,137 3454,124 3433,135 3411,138 3408,147 3385,150 3378,158 3356,148 3354,158 3352,166 3340,177 3325,195 3322,224 3329,238 3352,228 3343,234 3336,243 3327,254 3328,279 3335,304 3332,345 3327,334 3326,303 3331,293 3323,290 3318,279 3294,237 3237,212 3230,221 3215,219 3219,238 3204,255 3216,266 3218,284 3218,273 3232,275 3245,267 3246,283 3252,272 3260,282 3251,296 3253,319 3243,334 3245,359 3235,335 3234,317 3229,307 3215,301 3212,293 3201,292 3197,284 3186,281 3181,273 3176,283 3181,305 3164,321 3166,333 3183,349 3182,371 3191,379 3179,390 3181,415 3163,396 3151,374 3146,353 3137,356 3124,368 3121,356 3095,352 3084,345 3073,352 3073,360 3067,369 3059,367 3054,351 3046,354 3035,358 3033,368 3032,381 3041,381 3040,403 3048,413 3056,410 3060,419 3057,429 3055,413 3039,425 3026,419 3022,410 3031,406 3008,384 3009,373 3003,382 2988,386 2991,396 2982,397 2980,381 2964,385 2973,372 2953,364 2926,392 2916,389 2917,404 2905,414 2885,444 2876,464 2889,462 2899,466 2911,456 2900,467 2912,480 2938,493 2937,509 2926,506 2921,515 2932,501 2926,487 2912,482 2903,469 2894,465 2884,464 2876,474 2878,489 2869,506 2865,521 2869,532 2862,521 2864,539 2857,540 2857,530 2830,530 2825,540 2821,548 2820,558 2812,559 2804,569 2794,578 2794,592 2803,590 2807,598 2799,606 2807,599 2820,600 2820,610 2807,611 2799,614 2799,623 2790,623 2791,632 2786,641 2781,646 2772,646 2768,656 2762,673 2761,692 2763,702 2775,719 2808,731 2820,745 2821,757 2830,752 2822,757 2827,765 2836,760 2841,769 2812,765 2804,779 2819,788 2922,777 2920,767 2889,763 2950,766 2948,758 2931,760 2922,756 2920,741 2924,743 2924,751 2932,748 2931,758 2947,752 2921,726 2932,731 2945,733 2950,742 2950,757 2968,754 2974,775 2986,773 2997,769 3001,760 2993,723 2948,727 2939,716 2943,705 2943,718 2951,724 2965,720 2964,711 2955,697 2965,708 2968,720 2977,718 2982,710 2973,702 2973,688 2986,677 3001,662 2980,636 3006,661 2997,626 3016,655 3030,647 3026,625 3031,633 3041,633 3039,644 3054,645 3055,612 3062,638 3064,619 3066,627 3073,636 3079,637 3079,615 3097,615 3086,614 3079,627 3086,642 3138,673 3126,688 3114,701 3114,709 3123,714 3127,706 3132,693 3143,678 3156,686 3162,676 3188,663 3189,651 3179,639 3189,647 3191,661 3199,659 3194,669 3203,669 3190,672 3158,694 3174,695 3166,703 3179,709 3169,713 3162,703 3152,705 3155,730 3142,737 3149,722 3150,714 3128,741 3127,732 3133,724 3124,731 3109,733 3109,745 3099,743 3071,760 3056,766 3039,765 3000,790 2978,791 2965,802 2951,798 2929,805 2908,818 2908,841 2954,817 2977,812 3071,771 3080,767 3146,750 3180,749 3193,741 3205,741 3204,727 3218,717 3209,729 3208,737 3221,737 3232,740 3252,747 3276,744 3278,729 3264,721 3259,736 3256,726 3246,723 3252,713 3250,699 3259,692 3270,680 3268,688 3276,686 3274,677 3268,666 3270,658 3270,666 3277,681 3280,670 3288,674 3284,682 3295,670 3307,676 3307,687 3317,667 3316,655 3325,660 3316,685 3326,677 3323,686 3327,695 3328,707 3315,720 3314,734 3325,737 3337,734 3328,731 3339,733 3334,722 3342,722 3341,710 3344,699 3358,707 3367,704 3378,692 3379,677 3371,668 3382,673 3389,686 3400,687 3411,688 3414,675 3405,663 3406,649 3406,657 3423,670 3421,654 3426,680 3426,669 3428,680 3427,669 3429,679 3430,655 3438,684 3440,663 3444,683 3452,672 3450,648 3441,646 3440,632 3444,645 3453,632 3457,671 3469,662 3468,648 3465,639 3469,648 3482,657 3485,643 3478,633 3485,642 3485,631 3491,648 3499,648 3504,657 3507,649 3498,638 3509,647 3505,618 3513,649 3521,655 3529,640 3528,648 3539,654 3538,676 3547,684 3548,676 3556,661 3547,661 3566,646 3572,632 3578,622 3579,632 3580,617 3581,636 3589,632 3591,619 3595,611 3593,624 3596,611 3594,622 3603,640 3612,637 3616,624 3619,631 3619,616 3622,626 3628,617 3622,608 3631,604 3626,628 3635,629 3646,633 3649,618 3659,623 3660,614 3664,624 3672,625 3675,621 3675,601 3682,624 3682,614 3684,625 3688,617 3696,625 3696,610 3696,624 3705,623 3708,605 3711,619 3725,619 3717,615 3714,605 3712,597 3719,609 3723,594 3725,602 3729,615 3731,601 3744,603 3742,585 3745,604 3755,603 3759,593 3753,578 3759,594 3769,599 3769,582 3774,591 3786,587 3787,573 3788,562 3789,588 3791,576 3791,585 3795,575 3807,575 3805,567 3808,577 3806,567 3811,576 3808,566 3811,575 3810,566 3813,575 3813,566 3818,578 3821,566 3813,562 3815,545 3815,558 3820,564 3820,554 3822,563 3824,555 3827,564 3833,556 3831,564 3840,549 3843,567 3844,558 3848,568 3874,569 3871,561 3893,547 3887,537 3894,548 3903,539 3915,532 3901,517 3915,531 3914,521 3932,517 3924,517 3923,494 3931,505 3942,489 3939,504 3951,499 3951,485 3953,490 3953,501 3952,511 3951,522 3956,514 3955,525 3963,520 3964,528 3981,513 3983,491 3983,507 3980,517 3999,530 4002,518 4010,512 4007,520 4015,515 4006,521 4020,536 4022,527 4022,537 4053,542 4062,541 4069,516 4081,505 4085,489 4095,491 4118,501 4127,503 4139,498 4176,494 4195,485 4203,471 4201,484 4224,482 4223,473 4224,476 4224,589 4215,588 4206,596 4176,603 4128,621 4095,627 4080,631 4069,636 4050,635 4033,648 4010,651 3998,657 3997,648 3976,661 3952,670 3936,670 3906,681 3854,682 3844,675 3832,683 3837,677 3818,677 3826,689 3840,691 3915,686 4095,635 4224,592 4224,4224 -128,4224 -128,4224 +L 1747,3583 1749,3583 1747,3583 +L 2049,3132 2049,3134 2049,3132 +L 2049,3135 2049,3136 2049,3135 +L 2175,3040 2177,3039 2175,3040 +L 2177,3039 2178,3039 2177,3039 +L 2175,3009 2175,3008 2175,3009 +L 2175,3004 2175,3001 2175,3004 +L 1025,2978 1025,2985 1025,2978 +L 2303,2955 2303,2957 2303,2955 +L 2176,2986 2173,2987 2176,2986 +L 2304,2928 2304,2926 2304,2928 +L 2305,2923 2306,2924 2305,2923 +L 2303,2915 2304,2913 2303,2915 +L 2561,2531 2562,2532 2561,2531 +L 2551,2559 2551,2559 +L 2559,2427 2559,2427 +L 2559,2206 2561,2206 2559,2206 +L 2639,2049 2638,2049 2639,2049 +L 3071,361 3071,360 3071,361 +L 855,2206 855,2206 855,2206 +L 854,2206 843,2201 834,2208 843,2201 854,2206 854,2206 +L 2494,2527 2494,2527 2494,2527 +L 2495,2527 2500,2533 2504,2543 2509,2534 2500,2524 2507,2535 2495,2527 2495,2527 +L 2504,2513 2504,2523 2504,2513 2504,2513 +L 2607,2128 2607,2128 2607,2128 +L 2637,2042 2637,2042 2637,2042 +L 2637,2042 2637,2042 2637,2042 +L 2665,2017 2665,2017 2665,2017 +L 2635,1757 2635,1757 2635,1757 +L 2635,1757 2635,1757 2635,1757 +L 2721,1892 2721,1892 2721,1892 +L 2720,1893 2720,1893 2720,1893 +L 2773,1679 2773,1679 2773,1679 +L 2444,991 2444,991 2444,991 +L 3178,128 3178,128 3178,128 +L 3176,130 3176,130 3176,130 +L 2799,606 2794,593 2799,606 2799,606 +L 2049,3181 2049,3183 2037,3194 2047,3190 2110,3142 2156,3116 2224,3084 2223,3073 2217,3057 2208,3059 2196,3054 2207,3053 2204,3040 2195,3037 2186,3045 2186,3034 2177,3037 2169,3036 2165,3044 2169,3055 2177,3048 2175,3061 2174,3073 2174,3084 2162,3092 2155,3102 2126,3123 2118,3121 2109,3127 2103,3102 2102,3114 2075,3126 2079,3144 2069,3142 2069,3151 2059,3159 2049,3181 2049,3181 +L 2206,3059 2206,3059 2206,3059 +L 1578,3811 1578,3811 1578,3811 +L 1577,3813 1577,3813 1577,3813 +L 1578,3811 1580,3811 1580,3819 1575,3827 1566,3832 1558,3844 1563,3846 1551,3846 1555,3864 1567,3883 1601,3834 1675,3768 1675,3752 1665,3738 1662,3717 1656,3727 1658,3712 1643,3707 1641,3717 1643,3725 1653,3726 1645,3740 1642,3750 1647,3758 1648,3748 1658,3750 1657,3738 1659,3751 1647,3759 1635,3756 1620,3755 1633,3767 1625,3770 1611,3773 1621,3786 1610,3776 1612,3786 1598,3815 1589,3821 1578,3811 1578,3811 +L 1370,3184 1370,3184 1370,3184 +L 1370,3184 1373,3183 1370,3184 1370,3184 +L 2304,2930 2298,2928 2312,2926 2301,2920 2292,2925 2295,2914 2304,2919 2313,2926 2324,2928 2335,2918 2331,2908 2320,2918 2307,2911 2321,2916 2329,2906 2316,2904 2319,2896 2308,2899 2303,2891 2290,2890 2287,2880 2286,2892 2283,2911 2296,2905 2288,2907 2288,2922 2279,2926 2287,2927 2292,2938 2303,2934 2313,2929 2304,2930 2304,2930 +L 2316,2895 2317,2895 2316,2901 2331,2901 2332,2889 2321,2885 2323,2898 2325,2889 2315,2882 2308,2896 2316,2895 2316,2895 +L 2304,2850 2300,2851 2311,2859 2323,2868 2339,2871 2335,2861 2341,2873 2341,2885 2350,2887 2341,2887 2335,2895 2336,2906 2344,2910 2369,2866 2369,2856 2357,2828 2348,2824 2349,2840 2346,2854 2335,2839 2339,2853 2331,2857 2317,2851 2304,2850 2304,2850 +L 2344,2910 2344,2910 2344,2910 +L 2344,2910 2344,2910 2344,2910 +L 2151,2999 2152,2999 2162,3004 2151,2999 2151,2999 +L 2151,2999 2151,2999 2151,2999 +L 2203,2998 2197,2989 2195,2997 2203,2998 2203,2998 +L 2195,2997 2195,2997 2195,2997 +L 2195,2997 2195,2997 2195,2997 +L 2205,2728 2212,2734 2212,2719 2205,2728 2205,2728 +L 2212,2734 2212,2734 2212,2734 +L 3840,644 3835,649 3857,646 3851,637 3840,644 3840,644 +L 3835,649 3835,649 3835,649 +L 3835,649 3835,649 3835,649 +L 3451,713 3451,713 3451,713 +L 3451,711 3451,711 3451,711 +L 3911,623 3911,623 3911,623 +L 3911,623 3911,623 3911,623 +L 2048,3128 2040,3140 2049,3147 2049,3155 2057,3142 2049,3135 2058,3126 2048,3128 2048,3128 +L 2047,3163 2042,3168 2038,3148 2012,3172 2008,3180 2009,3189 2043,3172 2047,3173 2047,3163 2047,3163 +L 1714,3583 1714,3583 1720,3595 1719,3607 1709,3606 1706,3619 1721,3630 1725,3638 1722,3649 1714,3654 1712,3664 1702,3665 1698,3688 1695,3700 1681,3706 1682,3717 1697,3707 1743,3631 1782,3583 1797,3564 1775,3544 1780,3552 1781,3560 1765,3583 1759,3592 1749,3589 1757,3587 1747,3583 1735,3586 1734,3595 1744,3599 1746,3591 1746,3603 1752,3595 1747,3605 1755,3598 1732,3633 1742,3604 1731,3596 1724,3583 1720,3574 1712,3574 1714,3583 1714,3583 +L 1537,3873 1553,3869 1546,3859 1536,3859 1508,3867 1500,3864 1502,3854 1492,3859 1475,3878 1495,3855 1456,3827 1419,3828 1405,3876 1410,3886 1420,3894 1451,3893 1461,3898 1493,3895 1537,3873 1537,3873 +L 1537,3849 1544,3849 1536,3837 1526,3847 1537,3849 1537,3849 +L 1535,3837 1535,3836 1545,3848 1551,3833 1541,3830 1535,3837 1535,3837 +L 1597,3801 1602,3800 1594,3793 1597,3801 1597,3801 +L 1574,3798 1568,3800 1573,3808 1582,3802 1574,3798 1574,3798 +L 1707,3657 1699,3648 1705,3635 1683,3630 1679,3643 1688,3651 1695,3657 1707,3657 1707,3657 +L 1699,3678 1699,3678 1699,3678 +L 1552,3843 1552,3843 1552,3843 +L 1607,3779 1600,3764 1591,3765 1590,3753 1582,3770 1596,3777 1598,3791 1607,3779 1607,3779 +L 1701,3627 1695,3621 1697,3607 1693,3598 1685,3606 1681,3624 1687,3627 1701,3627 1701,3627 +L 1585,3757 1585,3757 1585,3757 +L 1626,3762 1614,3751 1607,3762 1607,3774 1618,3767 1629,3771 1626,3762 1626,3762 +L 1706,3669 1700,3667 1706,3669 1706,3669 +L 1756,3583 1759,3583 1767,3578 1754,3569 1742,3575 1756,3583 1756,3583 +L 2034,3135 2034,3135 2034,3135 +L 1765,3569 1771,3572 1756,3560 1765,3569 1765,3569 +L 1770,3573 1756,3568 1770,3573 1770,3573 +L 1763,3543 1772,3538 1771,3524 1753,3525 1745,3532 1728,3525 1744,3539 1763,3543 1763,3543 +L 1709,3569 1709,3569 1709,3569 +L 1736,3539 1736,3539 1736,3539 +L 1739,3544 1739,3544 1739,3544 +L 1791,3485 1791,3485 1791,3485 +L 1849,3373 1867,3355 1867,3346 1850,3363 1849,3373 1849,3373 +L 1858,3351 1867,3346 1864,3337 1858,3337 1858,3351 1858,3351 +L 1963,3207 1966,3211 1977,3201 1967,3196 1957,3199 1963,3207 1963,3207 +L 1960,3190 1955,3192 1960,3190 1960,3190 +L 1963,3186 1959,3188 1972,3191 1963,3186 1963,3186 +L 1962,3230 1962,3230 1962,3230 +L 1978,3199 1979,3203 1967,3210 1975,3212 1978,3199 1978,3199 +L 1970,3220 1970,3220 1970,3220 +L 1965,3227 1959,3233 1965,3227 1965,3227 +L 1739,3545 1734,3542 1745,3549 1754,3543 1739,3545 1739,3545 +L 1470,3408 1478,3409 1482,3396 1474,3399 1470,3408 1470,3408 +L 1373,3252 1383,3251 1384,3242 1373,3252 1373,3252 +L 1385,3243 1386,3252 1385,3243 1385,3243 +L 1388,3254 1391,3254 1393,3235 1388,3254 1388,3254 +L 1385,3241 1385,3241 1385,3241 +L 1363,3263 1372,3257 1366,3246 1355,3254 1363,3263 1363,3263 +L 1375,3270 1379,3260 1364,3268 1375,3270 1375,3270 +L 1345,3298 1357,3301 1345,3298 1345,3298 +L 1324,3340 1320,3337 1332,3336 1324,3340 1324,3340 +L 1389,3392 1390,3402 1403,3394 1389,3392 1389,3392 +L 1400,3383 1410,3386 1400,3383 1400,3383 +L 1367,3279 1368,3276 1358,3270 1360,3279 1371,3285 1376,3277 1367,3279 1367,3279 +L 2547,2560 2550,2563 2537,2585 2527,2605 2518,2609 2507,2631 2495,2652 2489,2656 2489,2671 2477,2683 2477,2691 2471,2699 2463,2703 2459,2719 2447,2724 2448,2738 2438,2750 2436,2758 2421,2770 2414,2787 2405,2799 2394,2808 2383,2815 2375,2815 2384,2825 2403,2810 2470,2722 2559,2562 2620,2456 2658,2368 2685,2336 2667,2324 2658,2346 2649,2342 2648,2334 2648,2310 2648,2332 2638,2337 2640,2347 2649,2350 2646,2368 2642,2376 2641,2384 2626,2389 2634,2389 2639,2397 2630,2395 2638,2399 2630,2395 2638,2400 2627,2396 2636,2403 2624,2397 2629,2406 2626,2422 2621,2431 2617,2442 2609,2453 2618,2451 2609,2458 2607,2469 2589,2498 2569,2511 2565,2519 2561,2527 2552,2536 2548,2550 2547,2560 2547,2560 +L 2176,3057 2176,3055 2166,3056 2162,3069 2172,3068 2176,3057 2176,3057 +L 2107,3073 2110,3083 2098,3093 2107,3098 2117,3090 2127,3086 2144,3086 2132,3073 2122,3073 2113,3059 2107,3073 2107,3073 +L 2117,3120 2125,3122 2128,3114 2137,3112 2142,3101 2156,3099 2164,3083 2151,3082 2144,3090 2129,3094 2121,3093 2106,3103 2117,3120 2117,3120 +L 2303,2981 2303,2981 2289,2967 2265,2977 2273,2988 2284,2993 2275,3005 2265,3009 2254,3021 2238,3022 2226,3010 2229,3025 2218,3031 2210,3035 2215,3043 2218,3034 2235,3027 2230,3041 2216,3043 2232,3064 2286,3012 2303,2989 2338,2945 2344,2928 2330,2936 2305,2942 2307,2954 2313,2941 2320,2951 2321,2943 2329,2947 2322,2957 2309,2959 2307,2967 2303,2981 2303,2981 +L 2304,2858 2292,2854 2291,2864 2301,2863 2297,2875 2305,2877 2303,2885 2316,2875 2324,2870 2311,2866 2304,2858 2304,2858 +L 2303,2885 2295,2882 2286,2872 2271,2863 2271,2877 2287,2877 2292,2887 2303,2885 2303,2885 +L 2303,2963 2303,2955 2301,2945 2289,2951 2291,2960 2300,2955 2303,2963 2303,2963 +L 2317,2958 2317,2958 2317,2958 +L 2175,3002 2173,3007 2185,3008 2183,3000 2175,3001 2181,2991 2179,2983 2163,2987 2166,2997 2174,2998 2164,3000 2152,2991 2175,3002 2175,3002 +L 2175,3012 2161,3009 2175,3012 2175,3012 +L 2175,3022 2166,3019 2153,3026 2150,3017 2150,3025 2141,3029 2145,3038 2144,3048 2154,3046 2153,3037 2159,3031 2175,3031 2184,3030 2175,3022 2175,3022 +L 2161,3068 2165,3054 2161,3068 2161,3068 +L 2158,3018 2161,3014 2150,3009 2158,3018 2158,3018 +L 2255,2896 2257,2892 2255,2896 2255,2896 +L 2212,3026 2194,3013 2199,3026 2212,3026 2212,3026 +L 2212,3025 2216,3018 2202,3012 2212,3025 2212,3025 +L 2198,3015 2201,3009 2190,3009 2198,3015 2198,3015 +L 2221,2867 2217,2869 2221,2867 2221,2867 +L 2232,2946 2236,2939 2226,2934 2218,2933 2210,2929 2217,2943 2232,2946 2232,2946 +L 2221,2945 2216,2944 2214,2932 2221,2945 2221,2945 +L 2211,2928 2211,2928 2211,2928 +L 2199,2909 2209,2930 2212,2922 2199,2909 2199,2909 +L 2233,2855 2233,2862 2247,2868 2246,2860 2233,2855 2233,2855 +L 2247,2858 2247,2867 2247,2858 2247,2858 +L 2252,2980 2252,2980 2252,2980 +L 2261,2946 2246,2954 2258,2957 2261,2946 2261,2946 +L 2232,2948 2223,2948 2232,2948 2232,2948 +L 2226,2970 2226,2966 2234,2963 2222,2947 2226,2970 2226,2970 +L 2286,2913 2282,2923 2286,2913 2286,2913 +L 2280,2933 2280,2933 2280,2933 +L 2277,2940 2278,2934 2268,2925 2277,2940 2277,2940 +L 2274,2940 2266,2931 2274,2940 2274,2940 +L 2236,2976 2235,2970 2223,2973 2236,2976 2236,2976 +L 2224,3021 2224,3021 2224,3021 +L 2197,2986 2203,2995 2197,2986 2197,2986 +L 2190,3027 2190,3027 2190,3027 +L 2193,2974 2190,2973 2186,2983 2193,2974 2193,2974 +L 2187,3040 2187,3040 2187,3040 +L 2210,2987 2214,2986 2222,2978 2214,2975 2209,2963 2216,2983 2207,2980 2199,2984 2210,2987 2210,2987 +L 2284,2949 2285,2949 2269,2945 2278,2951 2284,2949 2284,2949 +L 2265,2953 2270,2950 2262,2950 2263,2958 2254,2963 2253,2979 2257,2969 2261,2979 2269,2970 2279,2966 2265,2953 2265,2953 +L 2208,2871 2211,2873 2219,2866 2209,2866 2219,2865 2206,2861 2208,2871 2208,2871 +L 2229,2928 2237,2939 2236,2924 2239,2920 2239,2933 2250,2928 2241,2922 2239,2914 2224,2900 2237,2914 2228,2925 2229,2928 2229,2928 +L 2330,2792 2332,2787 2314,2776 2330,2792 2330,2792 +L 2319,2884 2331,2882 2340,2881 2334,2871 2319,2884 2319,2884 +L 2331,2901 2331,2901 2331,2901 +L 2324,2799 2312,2778 2324,2799 2324,2799 +L 2319,2798 2312,2789 2319,2798 2319,2798 +L 2325,2807 2316,2803 2325,2807 2325,2807 +L 2047,2683 2047,2676 2038,2670 2047,2683 2047,2683 +L 2178,2723 2174,2733 2187,2742 2178,2723 2178,2723 +L 2191,2724 2191,2724 2191,2724 +L 2051,2679 2051,2679 2051,2679 +L 2561,2451 2569,2450 2563,2441 2561,2451 2561,2451 +L 2559,2448 2559,2443 2559,2448 2559,2448 +L 2638,2050 2638,2050 2638,2050 +L 2577,2438 2577,2438 2577,2438 +L 2575,2431 2585,2427 2588,2419 2575,2431 2575,2431 +L 2532,2473 2539,2473 2543,2463 2532,2473 2532,2473 +L 2531,2473 2525,2476 2533,2468 2520,2466 2521,2474 2511,2503 2523,2492 2541,2488 2546,2491 2546,2483 2531,2485 2531,2473 2531,2473 +L 2544,2434 2544,2434 2544,2434 +L 2549,2527 2546,2530 2549,2527 2549,2527 +L 2547,2526 2546,2519 2535,2516 2538,2524 2529,2519 2533,2527 2536,2537 2528,2541 2544,2538 2547,2526 2547,2526 +L 2544,2470 2553,2462 2543,2471 2556,2462 2544,2470 2544,2470 +L 2643,1910 2650,1904 2650,1894 2635,1905 2643,1910 2643,1910 +L 2695,1980 2701,1981 2700,1970 2695,1980 2695,1980 +L 2697,1988 2699,1987 2692,1981 2680,1981 2697,1988 2697,1988 +L 2722,1883 2723,1879 2716,1875 2716,1885 2724,1889 2722,1883 2722,1883 +L 2750,1684 2757,1676 2750,1684 2750,1684 +L 2788,1522 2779,1518 2777,1527 2788,1522 2788,1522 +L 2559,646 2550,647 2530,671 2529,697 2538,704 2533,715 2535,738 2524,751 2521,785 2513,810 2503,818 2489,815 2463,835 2471,858 2468,882 2464,892 2456,895 2449,908 2453,922 2462,930 2485,919 2505,916 2520,900 2531,898 2552,886 2560,884 2615,852 2616,840 2628,833 2636,842 2627,854 2617,854 2619,865 2643,837 2652,831 2664,820 2674,816 2682,802 2712,771 2746,731 2743,719 2717,683 2715,673 2723,676 2715,669 2715,660 2716,652 2707,638 2697,637 2678,644 2662,643 2651,651 2637,654 2633,651 2625,651 2604,659 2596,658 2581,650 2572,651 2559,646 2559,646 +L 2532,728 2529,717 2533,705 2526,716 2532,728 2532,728 +L 3840,653 3841,653 3826,650 3818,645 3809,641 3819,648 3806,645 3795,656 3773,665 3743,671 3751,672 3733,681 3720,678 3718,689 3706,682 3697,685 3700,693 3690,698 3687,688 3677,692 3675,702 3671,694 3663,697 3650,707 3642,702 3634,703 3605,707 3584,716 3575,722 3547,733 3560,725 3551,723 3565,716 3553,712 3534,720 3534,728 3523,732 3506,733 3494,738 3485,742 3474,746 3478,750 3457,750 3443,767 3440,780 3472,767 3583,734 3667,710 3750,679 3808,665 3826,667 3825,656 3839,657 3866,655 3893,663 3908,659 3876,649 3840,653 3840,653 +L 3585,668 3585,668 3577,668 3571,658 3563,668 3576,677 3585,668 3585,668 +L 3583,690 3583,692 3575,691 3562,686 3554,698 3573,704 3583,694 3593,684 3583,690 3583,690 +L 3584,705 3572,715 3583,714 3584,705 3584,705 +L 3327,741 3284,746 3242,750 3195,745 3180,758 3201,758 3253,763 3326,764 3372,759 3438,756 3440,742 3424,744 3381,737 3379,740 3358,740 3357,740 3349,740 3349,751 3348,740 3346,751 3346,740 3342,740 3342,751 3341,740 3338,741 3338,751 3337,741 3327,741 3327,741 +L 3287,738 3287,738 3287,738 +L 3317,716 3320,714 3316,701 3308,715 3317,716 3317,716 +L 3267,707 3267,707 3267,707 +L 3306,709 3315,696 3299,699 3306,709 3306,709 +L 3322,712 3326,698 3318,688 3322,712 3322,712 +L 3219,742 3219,742 3219,742 +L 3253,725 3266,719 3268,710 3253,725 3253,725 +L 3314,727 3314,720 3304,722 3311,737 3314,727 3314,727 +L 3282,702 3284,696 3273,688 3265,699 3272,709 3273,721 3281,722 3281,712 3290,714 3292,696 3282,702 3282,702 +L 3300,722 3301,721 3299,712 3291,724 3290,732 3299,736 3300,722 3300,722 +L 3294,693 3297,698 3297,690 3307,689 3299,689 3291,685 3294,692 3285,692 3294,693 3294,693 +L 3410,737 3394,730 3410,737 3410,737 +L 3576,688 3582,684 3567,680 3558,684 3576,688 3576,688 +L 3442,702 3448,707 3461,701 3443,690 3442,702 3442,702 +L 3511,714 3514,705 3504,697 3498,711 3505,721 3511,714 3511,714 +L 3522,676 3527,682 3519,682 3522,695 3534,689 3533,680 3522,676 3522,676 +L 3469,688 3476,679 3478,661 3468,667 3463,676 3469,688 3469,688 +L 3528,703 3532,703 3535,695 3528,703 3528,703 +L 3486,729 3503,720 3496,711 3500,701 3485,702 3475,698 3471,709 3486,729 3486,729 +L 3571,722 3571,722 3571,722 +L 3387,735 3395,725 3392,717 3387,726 3387,735 3387,735 +L 3478,679 3489,671 3481,665 3478,679 3478,679 +L 3581,655 3577,644 3569,652 3581,655 3581,655 +L 3547,702 3552,687 3547,702 3547,702 +L 3566,712 3566,712 3566,712 +L 3425,721 3443,713 3426,711 3424,702 3413,699 3422,708 3425,721 3425,721 +L 3358,735 3364,722 3370,712 3359,716 3359,724 3358,735 3358,735 +L 3345,732 3355,721 3354,709 3343,710 3345,732 3345,732 +L 3420,726 3423,723 3422,711 3412,704 3412,723 3420,726 3420,726 +L 3516,694 3514,688 3519,679 3508,680 3503,672 3505,691 3516,694 3516,694 +L 3376,721 3382,719 3389,702 3373,702 3376,721 3376,721 +L 3521,723 3541,707 3530,705 3521,723 3521,723 +L 3527,660 3535,656 3527,660 3527,660 +L 3375,734 3377,731 3375,734 3375,734 +L 3422,681 3422,681 3422,681 +L 3387,724 3393,714 3390,706 3387,724 3387,724 +L 3447,722 3442,718 3429,722 3420,730 3419,738 3440,735 3447,722 3447,722 +L 3471,714 3466,712 3452,716 3454,730 3471,733 3461,737 3475,731 3471,714 3471,714 +L 3469,700 3461,675 3451,676 3446,688 3469,700 3469,700 +L 3562,650 3558,658 3562,650 3562,650 +L 3425,690 3417,697 3427,700 3425,690 3425,690 +L 3441,702 3449,696 3439,687 3441,702 3441,702 +L 3513,703 3513,703 3513,703 +L 3486,692 3490,694 3502,699 3502,690 3494,677 3487,689 3491,680 3474,687 3486,692 3486,692 +L 3432,699 3432,699 3433,681 3424,687 3427,701 3428,709 3439,708 3432,699 3432,699 +L 3634,668 3635,659 3634,668 3634,668 +L 3650,697 3670,690 3650,697 3650,697 +L 3717,681 3717,681 3717,681 +L 3691,650 3691,650 3691,650 +L 3789,647 3789,647 3789,647 +L 3670,668 3670,661 3662,662 3670,668 3670,668 +L 3768,643 3774,638 3768,643 3768,643 +L 3693,667 3698,669 3693,667 3693,667 +L 3766,661 3773,659 3766,661 3766,661 +L 3604,703 3604,703 3604,703 +L 3739,670 3748,667 3739,658 3739,670 3739,670 +L 3785,653 3785,653 3785,653 +L 3641,669 3641,669 3641,669 +L 3700,663 3703,656 3692,659 3700,663 3700,663 +L 3714,645 3714,645 3714,645 +L 3724,669 3723,657 3711,657 3724,669 3724,669 +L 3658,659 3661,655 3658,659 3658,659 +L 3649,658 3649,658 3649,658 +L 3620,702 3620,702 3620,702 +L 3655,666 3658,664 3649,662 3646,666 3655,666 3655,666 +L 3614,703 3614,703 3614,703 +L 3695,669 3676,663 3674,683 3685,683 3695,669 3695,669 +L 3780,637 3780,637 3780,637 +L 3795,642 3796,635 3795,642 3795,642 +L 3676,660 3686,652 3676,646 3676,660 3676,660 +L 3724,602 3724,602 3724,602 +L 3654,702 3654,702 3654,702 +L 3644,696 3646,697 3645,683 3631,681 3627,692 3636,691 3626,694 3644,696 3644,696 +L 3662,675 3665,677 3640,674 3647,684 3645,692 3669,682 3662,675 3662,675 +L 3708,648 3715,649 3706,643 3705,652 3708,648 3708,648 +L 3762,662 3763,662 3767,654 3783,654 3785,646 3786,638 3774,639 3771,648 3760,640 3747,652 3742,653 3742,663 3762,662 3762,662 +L 3073,740 3073,740 3073,740 +L 3071,738 3071,737 3062,739 3071,738 3071,738 +L 3071,703 3071,703 3080,711 3080,720 3082,728 3073,735 3082,741 3092,703 3079,655 3064,657 3068,669 3065,677 3058,701 3071,703 3071,703 +L 3107,700 3111,696 3115,682 3104,689 3107,700 3107,700 +L 3097,734 3097,726 3097,734 3097,734 +L 3134,703 3128,707 3126,715 3141,704 3134,693 3134,703 3134,703 +L 3118,713 3109,716 3107,722 3118,722 3118,713 3118,713 +L 3932,513 3935,514 3944,513 3936,513 3938,505 3932,513 3932,513 +L 3946,637 3951,636 3947,632 3936,632 3946,637 3946,637 +L 3862,635 3862,635 3862,635 +L 3849,634 3849,627 3841,632 3849,634 3849,634 +L 3918,638 3924,628 3912,618 3919,632 3918,638 3918,638 +L 3929,621 3929,621 3929,621 +L 4003,618 4000,621 4018,629 4018,617 4003,618 4003,618 +L 3862,644 3862,644 3862,644 +L 3992,627 3997,623 3985,617 3992,627 3992,627 +L 3916,632 3916,632 3916,632 +L 3881,637 3871,642 3885,647 3904,647 3912,642 3904,642 3906,630 3915,631 3914,626 3903,626 3893,617 3891,625 3881,624 3881,635 3879,627 3871,626 3861,638 3870,641 3881,637 3881,637 +L 2804,556 2804,553 2793,552 2783,568 2804,556 2804,556 +L 2991,355 2986,350 2979,353 2979,365 2998,375 3009,372 3008,364 2991,355 2991,355 +L 2971,342 2971,342 2971,342 +L 2878,443 2907,405 2878,443 2878,443 +L 2916,379 2926,383 2947,359 2934,343 2926,361 2916,379 2916,379 +L 3031,674 3038,672 3031,674 3031,674 +L 3001,701 3017,695 3017,677 2998,691 3001,701 3001,701 +L 3061,751 3061,751 3061,751 +L 3057,746 3058,749 3056,737 3057,746 3057,746 +L 2946,747 2949,742 2937,732 2946,747 2946,747 +L 2758,543 2761,546 2758,543 2758,543 +L 3034,718 3041,712 3034,718 3034,718 +L 3042,718 3053,722 3060,707 3047,704 3042,718 3042,718 +L 3061,720 3061,720 3061,720 +L 3032,689 3030,693 3040,690 3032,689 3032,689 +L 3040,668 3048,660 3040,668 3040,668 +L 3030,738 3040,733 3023,726 3030,738 3030,738 +L 2714,562 2719,570 2714,562 2714,562 +L 3143,180 3141,175 3132,186 3143,180 3143,180 +L 3157,193 3161,191 3161,182 3157,193 3157,193 +L 3176,181 3176,181 3176,181 +L 3126,242 3125,256 3138,277 3140,253 3130,243 3129,234 3126,242 3126,242 +L 3157,232 3153,232 3153,247 3158,260 3157,245 3157,232 3157,232 +L 3133,231 3133,231 3133,231 +L 3250,75 3256,67 3248,73 3250,75 3250,75 +L 3368,-8 3362,-7 3368,-8 3368,-8 +L 3350,-24 3342,-32 3350,-24 3350,-24 +L 861,2190 876,2187 869,2179 861,2190 861,2190 +L 536,2663 543,2655 520,2636 526,2654 536,2663 536,2663 +L 960,2157 970,2155 918,2153 960,2157 960,2157 +L 766,3048 770,3048 768,3037 766,3048 766,3048 +L 843,3122 835,3118 843,3122 843,3122 +L 540,2806 548,2794 547,2786 540,2806 540,2806 +L 1497,3860 1497,3860 1497,3860 +L 1656,3727 1657,3738 1656,3727 1656,3727 +L 1647,3722 1647,3722 1647,3722 +L 1749,3589 1749,3589 1749,3589 +L 1726,3635 1726,3635 1726,3635 +L 1740,3546 1740,3546 1740,3546 +L 1521,3409 1521,3409 1521,3409 +L 1515,3425 1515,3425 1515,3425 +L 1365,3279 1365,3279 1365,3279 +L 1992,3168 1992,3168 1992,3168 +L 1995,3160 1995,3160 1995,3160 +L 2117,3090 2117,3090 2117,3090 +L 2661,2015 2661,2015 2661,2015 +L 2661,2015 2661,2015 2661,2015 +L 2763,1664 2763,1664 2763,1664 +L 3707,616 3707,616 3707,616 +L 3292,725 3300,722 3292,725 3292,725 +L 3645,706 3645,706 3645,706 +L 3281,712 3281,712 3281,712 +L 3486,706 3486,706 3486,706 +L 3287,713 3287,713 3287,713 +L 3281,705 3281,705 3281,705 +L 3281,705 3281,705 3281,705 +L 3663,697 3663,697 3663,697 +L 3432,699 3432,699 3432,699 +L 3644,696 3644,696 3644,696 +L 3428,695 3428,695 3428,695 +L 3915,632 3915,632 3915,632 +L 3884,625 3884,625 3884,625 +L 3887,638 3887,638 3887,638 +L 3873,632 3873,632 3873,632 +L 3887,638 3888,632 3887,638 3887,638 +L 3906,630 3906,630 3906,630 +L 3487,689 3487,689 3487,689 +L 3294,693 3294,693 3294,693 +L 3297,690 3297,690 3297,690 +L 3662,675 3662,675 3662,675 +L 3319,683 3319,683 3319,683 +L 3754,654 3754,654 3754,654 +L 3759,658 3759,658 3759,658 +L 3759,658 3759,658 3759,658 +L 3759,656 3759,656 3759,656 +L 3710,644 3710,644 3710,644 +L 3707,647 3707,647 3707,647 +L 3875,560 3875,560 3875,560 +L 2704,1048 2704,1048 2704,1048 +L 2704,1048 2704,1048 2704,1048 +L 2183,3051 2183,3051 2183,3051 +L 2186,3045 2186,3045 2186,3045 +L 2183,3051 2183,3051 2183,3051 +L 2181,3039 2181,3039 2181,3039 +L 2181,3039 2181,3039 2181,3039 +L 2235,3027 2235,3027 2235,3027 +L 2235,3027 2235,3027 2235,3027 +L 2186,3006 2186,3006 2186,3006 +L 2175,3002 2175,3002 2175,3002 +L 2183,3000 2183,3000 2183,3000 +L 2151,3057 2151,3057 2151,3057 +L 2164,2990 2164,2990 2164,2990 +L 2172,2992 2172,2992 2172,2992 +L 2165,2991 2165,2991 2165,2991 +L 2172,2992 2172,2992 2172,2992 +L 2165,2991 2165,2991 2165,2991 +L 2280,2722 2280,2722 2280,2722 +L 2265,2952 2265,2952 2265,2952 +L 2179,2983 2179,2983 2179,2983 +L 2210,2987 2210,2987 2210,2987 +L 2163,2988 2163,2988 2163,2988 +L 2163,2987 2163,2987 2163,2987 +L 2207,2980 2207,2980 2207,2980 +L 2179,2983 2179,2983 2179,2983 +L 2207,2980 2207,2980 2207,2980 +L 2284,2949 2284,2949 2284,2949 +L 2314,2924 2314,2924 2314,2924 +L 2229,2928 2229,2928 2229,2928 +L 2290,2925 2290,2925 2290,2925 +L 2300,2917 2300,2917 2300,2917 +L 2239,2914 2239,2914 2239,2914 +L 2339,2909 2339,2909 2339,2909 +L 2354,2861 2359,2862 2361,2871 2359,2880 2354,2861 2354,2861 +L 2358,2862 2358,2862 2358,2862 +L 2335,2861 2335,2861 2335,2861 +L 2332,2876 2332,2876 2332,2876 +L 2332,2876 2332,2876 2332,2876 +L 2309,2907 2309,2907 2309,2907 +L 2297,2908 2304,2910 2304,2901 2291,2903 2297,2898 2288,2898 2297,2896 2305,2900 2297,2908 2297,2908 +L 2223,2900 2223,2900 2223,2900 +L 2296,2905 2296,2905 2296,2905 +L 2291,2903 2291,2903 2291,2903 +L 2291,2903 2291,2903 2291,2903 +L 2331,2889 2331,2889 2331,2889 +L 2314,2895 2314,2895 2314,2895 +L 2296,2896 2296,2896 2296,2896 +L 2296,2896 2296,2896 2296,2896 +L 2208,2871 2208,2871 2208,2871 +L 2325,2857 2325,2857 2325,2857 +L 2321,2861 2321,2861 2321,2861 +L 2332,2876 2323,2876 2332,2876 2332,2876 +L 2285,2872 2285,2872 2285,2872 +L 2310,2875 2310,2875 2310,2875 +L 2347,2857 2347,2857 2347,2857 +L 2358,2862 2349,2845 2358,2862 2358,2862 +L 2348,2843 2348,2843 2348,2843 +L 2258,2849 2258,2849 2258,2849 +L 2223,2850 2223,2850 2223,2850 +L 2276,2719 2276,2719 2276,2719 +L 2280,2722 2280,2722 2280,2722 +L 2276,2719 2276,2719 2276,2719 +L 2271,2710 2271,2710 2271,2710 +L 2504,2543 2504,2543 2507,2535 2504,2543 2504,2543 +L 2507,2535 2507,2535 2507,2535 +L 2543,2471 2543,2471 2543,2471 +L 2617,2442 2617,2442 2617,2442 +L 2624,2428 2624,2428 2624,2428 +L 2624,2428 2624,2428 2624,2428 +L 2645,2346 2645,2346 2645,2346 +L 2644,2345 2644,2345 2644,2345 +L 2644,2345 2644,2345 2644,2345 +L 2644,2369 2644,2369 2644,2369 +L 2602,2174 2602,2174 2602,2174 +L 2600,2174 2600,2174 2600,2174 +L 2596,2174 2596,2174 2588,2174 2596,2174 2596,2174 +L 2600,2174 2600,2174 2600,2174 +L 2602,2174 2602,2174 2602,2174 +L 2621,2091 2621,2091 2621,2091 +L 2533,2318 2533,2318 2533,2318 +L 2533,2318 2533,2318 2533,2318 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge3.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge3.txt new file mode 100644 index 0000000..69428aa --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-water-huge3.txt @@ -0,0 +1,1445 @@ +# earcut/water-huge3 +L -29,90 -25,43 -35,38 -33,29 -22,26 -12,41 -15,22 6,18 22,2 -19,-4 -10,-6 -32,-17 -29,5 -44,-11 -49,3 -52,-6 -64,-6 -64,-43 -62,-37 -48,-47 -44,-38 -34,-52 -37,-64 45,-64 44,-50 56,-37 67,-51 69,-36 33,-2 97,2 90,20 97,24 96,9 111,7 128,-11 110,-13 100,0 98,-15 108,-19 102,-41 110,-50 102,-64 162,-64 148,-51 158,-41 136,-9 138,15 124,26 126,40 134,23 145,30 159,25 160,8 174,-1 161,-36 171,-40 163,-64 230,-64 231,-56 219,-59 225,-34 218,-22 241,-26 239,-54 258,-31 273,-29 256,2 289,28 285,36 304,36 294,41 301,63 311,63 320,84 334,86 310,56 313,48 329,54 319,61 382,64 376,81 366,78 370,91 361,105 351,93 337,110 350,109 358,119 361,106 371,109 390,96 405,110 388,86 392,72 425,94 434,69 391,56 389,48 417,26 403,25 409,-12 393,-19 402,-18 396,-31 414,-46 396,-62 384,-14 361,2 347,28 334,-3 343,-15 333,-15 333,-31 322,-37 333,-58 315,-54 303,-64 462,-64 461,-32 483,-26 483,-36 507,-38 497,-54 501,-64 551,-64 544,-56 554,-64 635,-64 640,-56 639,-64 671,-64 694,-52 699,-64 864,-64 829,-45 849,-26 841,-11 853,-7 864,-11 857,-16 874,-47 865,-64 1024,-64 973,-37 1000,-13 1041,-64 1207,-64 1198,-41 1204,-10 1210,-40 1228,-51 1228,-64 1305,-64 1302,-24 1293,-16 1302,-11 1296,22 1308,27 1312,21 1303,16 1307,-48 1316,-63 1327,-47 1328,-54 1343,-52 1323,-64 1515,-61 1522,-47 1506,-8 1527,11 1497,53 1471,61 1465,52 1481,53 1481,30 1471,43 1455,45 1461,54 1444,54 1447,23 1425,22 1419,-12 1410,-4 1376,-8 1376,-33 1386,-34 1373,-45 1359,-41 1372,-35 1369,-6 1417,6 1418,59 1426,72 1451,66 1449,99 1461,104 1479,91 1489,105 1500,104 1497,114 1518,113 1512,127 1527,126 1488,169 1520,187 1510,204 1502,203 1507,209 1564,211 1562,233 1576,241 1579,273 1573,267 1558,274 1550,264 1541,272 1578,290 1590,265 1602,271 1607,262 1602,267 1600,241 1580,239 1579,215 1538,183 1538,166 1530,164 1531,135 1548,116 1536,103 1554,108 1550,94 1550,101 1538,99 1538,83 1571,74 1533,79 1520,58 1541,54 1523,30 1539,-1 1526,-37 1543,-53 1527,-64 1605,-64 1599,-50 1586,-53 1591,-16 1609,-54 1624,-40 1607,-64 1768,-64 1720,-9 1707,-24 1716,-24 1706,-28 1711,-43 1706,-32 1692,-35 1693,-22 1701,-24 1677,0 1677,13 1705,16 1699,10 1724,-6 1757,1 1746,11 1753,11 1753,34 1763,46 1773,43 1755,67 1773,88 1767,62 1786,38 1803,75 1798,103 1781,104 1780,93 1771,92 1751,108 1767,105 1796,125 1800,154 1817,159 1819,147 1830,159 1828,171 1833,159 1843,159 1851,131 1894,133 1913,119 1929,131 1931,157 1945,146 1935,143 1936,123 1948,117 1962,132 1985,110 2021,110 2028,101 1997,93 1990,82 1973,87 1952,72 1963,64 1958,52 1977,38 1968,32 1989,29 2010,45 2002,49 2010,57 2005,67 2017,63 2033,84 2009,13 2019,9 2020,-19 1995,15 1984,-4 1978,8 1987,19 1961,1 1952,4 1953,31 1930,38 1901,66 1903,53 1890,46 1900,33 1878,19 1881,6 1868,3 1887,-25 1896,-17 1894,-35 1904,-43 1928,-34 1935,-22 1928,-64 1947,-64 1940,-49 1949,-38 1963,-42 1951,-53 1964,-56 1959,-64 2026,-64 2023,-55 2036,-64 2066,-46 2061,-37 2047,-41 2065,-23 2070,-30 2082,1 2080,54 2095,51 2092,-1 2074,-26 2085,-36 2083,-58 2096,-59 2101,-45 2144,-28 2148,-44 2134,-42 2119,-54 2131,-56 2130,-64 2246,-64 2247,-54 2218,-57 2222,-32 2229,-33 2225,-41 2242,-36 2244,-46 2253,-37 2249,-9 2273,-16 2293,-7 2302,-12 2302,-45 2283,-43 2282,-31 2264,-24 2251,-55 2268,-52 2269,-64 2435,-64 2444,-54 2428,-14 2434,12 2407,61 2347,55 2341,76 2327,74 2338,92 2352,92 2353,102 2319,161 2292,158 2289,138 2301,131 2292,132 2292,117 2289,133 2238,149 2222,120 2208,130 2210,142 2183,148 2161,178 2131,188 2129,198 2114,204 2095,189 2083,198 2082,187 2078,207 2061,197 2057,222 2034,222 2031,232 2069,232 2073,219 2097,213 2102,227 2108,210 2120,212 2150,186 2192,169 2190,201 2210,188 2227,155 2233,167 2248,169 2279,152 2277,162 2293,168 2291,182 2267,191 2279,196 2303,174 2315,175 2263,273 2266,341 2241,353 2219,399 2237,404 2246,418 2240,438 2252,428 2249,405 2228,384 2242,357 2282,345 2284,322 2296,309 2304,313 2303,304 2326,331 2306,301 2317,290 2314,272 2358,288 2348,274 2320,264 2324,247 2331,248 2330,212 2345,174 2367,191 2358,174 2365,168 2345,164 2369,165 2352,156 2362,153 2366,128 2382,146 2382,138 2392,145 2384,115 2417,142 2399,118 2417,103 2430,107 2421,99 2439,82 2442,58 2477,30 2490,34 2480,27 2504,6 2543,14 2551,8 2542,-2 2508,-2 2507,-31 2523,-35 2502,-47 2508,-61 2538,-52 2539,-64 2829,-64 2839,-48 2839,-64 2865,-64 2855,-34 2868,-46 2866,-64 2894,-64 2903,-40 2897,-15 2885,-17 2881,1 2856,6 2852,-23 2833,24 2841,15 2869,12 2875,20 2865,39 2884,31 2877,10 2893,7 2893,-1 2907,20 2926,6 2926,29 2932,14 2941,30 2933,8 2938,3 2945,11 2967,-9 2960,-13 2970,-19 2957,-37 2924,-2 2918,-14 2916,-7 2905,-13 2915,-64 2957,-63 2947,-62 2958,-40 2998,-64 3107,-64 3119,-36 3128,-34 3118,-2 3106,5 3102,-4 3096,14 3121,21 3120,37 3140,-38 3165,-64 3166,-64 3193,-64 3184,-51 3189,-29 3202,-64 3303,-64 3299,-53 3319,-63 3320,-56 3339,-57 3326,-64 3402,-64 3385,-41 3367,-40 3362,-24 3336,-9 3326,6 3328,26 3316,18 3312,27 3324,28 3320,39 3326,37 3304,93 3304,125 3314,142 3300,147 3312,149 3283,203 3253,183 3257,164 3272,163 3283,148 3264,143 3263,131 3258,139 3244,131 3264,106 3250,96 3240,135 3209,140 3218,158 3215,178 3199,179 3193,206 3163,231 3164,247 3194,223 3207,228 3217,201 3226,201 3219,227 3198,236 3188,261 3215,263 3256,198 3283,210 3232,287 3238,288 3231,311 3240,322 3223,340 3224,360 3214,355 3208,367 3167,375 3151,367 3152,341 3161,335 3148,329 3142,341 3128,342 3130,363 3108,372 3140,393 3203,372 3190,393 3204,394 3206,403 3192,429 3234,384 3236,392 3247,389 3251,370 3244,361 3251,361 3242,352 3253,353 3275,295 3293,280 3312,300 3319,286 3338,286 3328,278 3327,253 3350,254 3377,204 3371,228 3386,222 3384,234 3356,297 3363,289 3395,315 3410,304 3418,314 3397,319 3410,329 3393,353 3377,349 3365,366 3365,406 3338,399 3333,409 3342,414 3342,430 3338,436 3325,429 3323,441 3336,442 3320,447 3314,463 3324,473 3289,529 3297,542 3263,580 3250,607 3258,627 3245,632 3248,649 3224,655 3233,665 3226,674 3195,653 3209,629 3224,630 3211,648 3226,647 3227,629 3216,616 3224,603 3215,607 3209,599 3217,573 3235,563 3264,513 3257,506 3277,476 3290,474 3292,460 3260,478 3254,441 3231,465 3240,471 3234,492 3226,492 3211,529 3226,514 3237,533 3204,571 3198,550 3189,550 3196,534 3173,542 3150,522 3162,521 3164,506 3174,503 3160,495 3168,474 3150,474 3157,484 3150,500 3145,487 3137,495 3134,488 3129,508 3149,507 3135,540 3156,531 3156,540 3176,548 3145,595 3131,601 3136,612 3122,612 3128,581 3119,597 3093,602 3074,631 3084,636 3067,648 3086,672 3076,695 3103,707 3083,726 3094,707 3073,705 3063,736 3034,745 3034,758 3047,744 3047,754 3023,788 3037,794 3035,802 3051,799 3059,807 3036,852 3027,852 3021,838 3013,854 3013,846 3004,851 3018,863 3011,867 3020,875 3009,877 3014,896 2997,891 2990,877 2979,883 2984,897 2954,887 2967,905 2942,940 2979,967 2964,986 2944,966 2938,970 2959,992 2952,994 2958,1014 2926,1034 2946,1037 2964,1015 2968,994 2982,991 2995,966 2989,960 2998,958 3022,915 3037,882 3032,871 3061,832 3074,787 3083,776 3090,786 3096,776 3081,771 3082,755 3092,755 3086,751 3096,734 3123,734 3124,725 3152,708 3134,687 3141,682 3136,673 3161,662 3157,677 3167,677 3175,694 3192,685 3210,690 3211,704 3253,645 3270,680 3275,667 3262,656 3270,650 3259,644 3259,612 3295,650 3316,656 3305,650 3314,650 3294,615 3287,618 3292,634 3273,615 3271,609 3287,606 3273,604 3274,586 3283,573 3291,576 3287,569 3304,549 3302,528 3320,487 3346,518 3339,501 3348,502 3348,490 3330,493 3323,481 3361,441 3365,452 3361,416 3386,400 3380,392 3395,383 3408,389 3392,375 3406,361 3402,351 3414,350 3410,341 3428,312 3449,315 3442,288 3471,292 3468,274 3480,282 3487,270 3472,262 3475,251 3496,252 3507,236 3501,227 3486,242 3483,214 3506,168 3501,159 3513,117 3487,174 3485,202 3455,236 3449,229 3442,253 3427,249 3440,258 3427,268 3388,243 3408,243 3410,231 3395,222 3407,208 3419,212 3422,197 3448,201 3454,177 3443,164 3433,173 3435,156 3425,157 3448,113 3434,119 3403,161 3398,147 3407,125 3393,119 3385,153 3363,158 3359,143 3352,146 3350,165 3369,165 3346,211 3335,190 3322,203 3304,196 3321,145 3349,114 3347,100 3355,110 3358,99 3376,91 3387,105 3389,92 3407,85 3418,70 3416,53 3431,48 3440,15 3499,-63 3550,-64 3553,-57 3574,-64 3574,-55 3580,-64 3775,-64 3774,-53 3791,-64 3920,-64 3917,-45 3902,-49 3902,-57 3864,-43 3854,-15 3872,-3 3882,-31 3904,-33 3898,-20 3908,-16 3915,-37 3923,-27 3931,-31 3925,-38 3932,-64 3969,-64 3977,-44 3986,-45 3980,-64 4091,-64 4108,-55 4125,-60 4124,-53 4134,-64 4160,-64 4160,2 4149,17 4151,31 4130,45 4121,70 4107,75 4105,95 4077,82 4047,102 4031,66 4056,38 4040,28 4068,14 4070,26 4076,23 4073,13 4092,-13 4075,-25 4079,-37 4070,-38 4058,-32 4058,-12 4033,-10 4032,28 3980,66 3977,82 3985,85 3956,138 3946,139 3948,151 3921,200 3922,257 3932,272 3920,304 3917,295 3911,299 3918,311 3893,289 3861,299 3836,279 3852,213 3859,116 3850,131 3823,118 3845,132 3850,178 3841,206 3846,210 3849,193 3850,200 3848,212 3835,216 3845,219 3832,245 3840,259 3827,258 3833,300 3821,303 3833,313 3815,317 3825,318 3815,321 3831,338 3823,347 3832,349 3824,358 3821,411 3813,412 3821,417 3789,454 3742,560 3728,572 3735,593 3692,608 3653,599 3679,633 3713,649 3702,652 3687,640 3690,653 3680,644 3658,650 3644,683 3614,689 3607,699 3617,703 3613,712 3591,714 3573,795 3561,803 3569,814 3555,822 3557,843 3541,875 3507,864 3522,902 3510,931 3467,966 3482,965 3490,977 3474,990 3474,1005 3418,1009 3439,1016 3449,1041 3441,1055 3445,1073 3434,1074 3419,1126 3400,1141 3403,1173 3393,1184 3376,1182 3331,1242 3305,1315 3288,1322 3289,1315 3262,1341 3255,1335 3255,1347 3249,1331 3242,1335 3248,1341 3224,1349 3230,1359 3223,1365 3215,1358 3212,1367 3206,1357 3195,1371 3156,1376 3025,1540 2999,1515 2998,1525 2990,1522 3003,1508 2998,1496 2973,1528 2958,1526 2997,1547 2991,1553 3002,1565 2942,1616 2931,1612 2904,1642 2913,1636 2922,1645 2921,1631 2986,1591 3016,1591 3072,1637 3067,1657 3088,1654 3109,1695 3088,1710 3076,1707 3088,1724 3059,1731 3043,1759 3029,1751 3021,1770 3012,1732 3004,1732 2996,1755 2990,1745 2982,1749 2983,1761 2942,1751 2956,1760 2938,1756 2950,1762 2958,1761 2979,1775 2956,1777 2996,1791 2979,1806 2961,1803 2968,1812 2997,1813 2995,1824 3011,1808 3027,1812 3033,1826 3037,1815 3040,1821 3051,1813 3076,1836 3031,1873 3021,1861 3030,1847 3010,1851 3011,1839 3005,1859 2995,1849 3000,1833 2989,1855 2979,1856 2972,1888 2983,1886 2975,1901 2950,1905 2943,1913 2950,1921 2936,1924 2940,1938 2967,1931 2983,1906 3007,1902 2984,1917 2968,1945 2942,1959 2946,1978 2954,1983 2962,1957 2982,1951 2990,1926 3015,1904 3043,1918 3046,1931 3036,1930 3034,1939 3043,1941 3022,1949 3013,1942 3002,1949 3007,1956 2995,1950 2993,1959 3009,1962 3008,1976 3017,1973 3010,1990 2991,1997 2984,1980 2973,1986 2967,1972 2968,1995 2965,1987 2959,1998 2931,1967 2937,1955 2926,1930 2934,1905 2922,1921 2919,1906 2914,1928 2904,1932 2899,1908 2894,1924 2875,1925 2872,1898 2859,1900 2856,1912 2848,1898 2830,1892 2808,1902 2827,1929 2858,1943 2877,1931 2896,1947 2888,1960 2879,1948 2867,1953 2875,1956 2865,1968 2875,1979 2870,1987 2852,1978 2857,1994 2870,1998 2847,2003 2857,2014 2837,2014 2843,2022 2829,2035 2797,2040 2772,2061 2800,2086 2829,2088 2854,2035 2866,2033 2861,2018 2880,2007 2897,2009 2889,2014 2896,2050 2920,2019 2922,2013 2913,2025 2898,2020 2903,2003 2914,2003 2918,1993 2952,2023 2963,2012 2967,2020 2955,2031 3001,2013 3014,2018 3026,2032 2999,2038 3014,2045 3031,2034 3028,2019 3039,2008 3045,2022 3033,2039 3049,2034 3069,1988 3079,1992 3076,2000 3091,1999 3079,2011 3091,2025 3077,2032 3095,2031 3074,2055 3069,2050 3061,2068 3073,2056 3059,2072 3049,2061 3047,2080 3004,2107 2995,2104 2994,2114 2979,2106 2964,2109 2953,2074 2947,2080 2951,2071 2940,2090 2926,2080 2935,2103 2961,2108 2975,2148 2960,2149 2955,2130 2935,2130 2936,2117 2927,2112 2915,2114 2918,2128 2908,2122 2906,2140 2886,2142 2881,2176 2892,2185 2889,2193 2906,2190 2891,2197 2884,2216 2874,2213 2874,2231 2864,2234 2866,2214 2822,2238 2828,2246 2799,2266 2798,2280 2808,2282 2791,2307 2781,2307 2779,2332 2773,2329 2755,2365 2707,2398 2674,2353 2682,2338 2674,2341 2671,2326 2690,2321 2679,2318 2681,2305 2667,2302 2675,2277 2659,2271 2656,2240 2628,2241 2627,2252 2622,2246 2615,2253 2604,2235 2605,2208 2619,2201 2633,2210 2636,2198 2653,2197 2656,2184 2646,2192 2640,2178 2630,2188 2627,2178 2618,2187 2574,2193 2557,2186 2555,2171 2573,2153 2572,2132 2557,2108 2599,2122 2646,2124 2609,2103 2584,2112 2562,2105 2560,2085 2567,2083 2559,2078 2554,2086 2526,2037 2532,2039 2546,2007 2553,2012 2571,1995 2576,1999 2568,2004 2591,1998 2588,1991 2583,1997 2585,1972 2561,1997 2546,1991 2542,1998 2556,1956 2574,1977 2573,1961 2583,1951 2576,1949 2610,1950 2614,1928 2632,1945 2635,1933 2648,1943 2629,1910 2606,1895 2599,1915 2590,1910 2569,1873 2587,1849 2629,1849 2650,1869 2648,1908 2652,1911 2658,1915 2661,1901 2688,1913 2755,1872 2806,1816 2828,1767 2887,1723 2888,1712 2875,1692 2867,1718 2823,1766 2760,1860 2691,1899 2665,1898 2656,1886 2651,1836 2660,1824 2655,1802 2686,1771 2638,1736 2658,1771 2644,1790 2652,1805 2645,1812 2638,1809 2588,1848 2577,1828 2581,1838 2572,1847 2524,1845 2500,1873 2483,1869 2490,1881 2489,1883 2482,1873 2483,1887 2487,1884 2484,1888 2461,1886 2463,1897 2452,1897 2458,1902 2428,1908 2434,1912 2426,1920 2413,1909 2401,1918 2405,1932 2388,1928 2394,1935 2373,1933 2332,1950 2313,1931 2319,1926 2311,1929 2324,1912 2324,1892 2299,1892 2295,1859 2311,1836 2305,1788 2313,1783 2306,1777 2319,1779 2322,1771 2305,1717 2308,1710 2337,1717 2343,1701 2337,1684 2324,1688 2326,1677 2354,1648 2372,1653 2367,1642 2376,1647 2378,1631 2389,1626 2396,1606 2404,1608 2413,1563 2405,1562 2375,1615 2343,1618 2328,1585 2338,1557 2352,1542 2335,1548 2330,1541 2324,1555 2299,1560 2298,1571 2329,1603 2325,1612 2301,1610 2294,1597 2297,1606 2288,1604 2304,1618 2297,1629 2310,1636 2302,1678 2291,1687 2310,1692 2275,1762 2301,1802 2297,1816 2284,1822 2297,1848 2290,1855 2270,1851 2293,1863 2292,1878 2279,1881 2286,1867 2262,1858 2273,1883 2260,1881 2269,1892 2250,1878 2234,1885 2217,1876 2201,1897 2173,1872 2109,1858 2113,1868 2170,1876 2177,1886 2153,1908 2128,1916 2108,1949 2043,1991 2051,1995 2068,1979 2110,1971 2122,1942 2132,1941 2122,1937 2175,1906 2227,1919 2202,1904 2223,1884 2274,1904 2274,1920 2288,1938 2277,1936 2283,1946 2241,1923 2270,1941 2276,1963 2262,1965 2273,1984 2261,1975 2272,1992 2245,1973 2241,1988 2240,1981 2235,1989 2215,1981 2229,2010 2215,2030 2222,2034 2233,2030 2232,2013 2269,2016 2286,2004 2311,2004 2315,1973 2306,1967 2308,1963 2322,1974 2332,1957 2422,1929 2430,1929 2433,1942 2441,1928 2506,1889 2531,1877 2541,1884 2561,1877 2596,1935 2583,1947 2557,1945 2542,1978 2526,1972 2537,1987 2524,1997 2509,1981 2522,1999 2488,2010 2485,2030 2527,2067 2526,2079 2517,2081 2531,2091 2525,2105 2535,2104 2559,2133 2556,2160 2524,2175 2441,2110 2438,2094 2425,2098 2417,2125 2396,2131 2405,2156 2400,2166 2348,2178 2312,2208 2298,2235 2296,2228 2288,2232 2271,2284 2247,2313 2235,2313 2212,2338 2166,2348 2160,2399 2169,2402 2149,2423 2134,2427 2133,2414 2119,2427 2103,2425 2098,2439 2111,2442 2098,2444 2106,2446 2099,2466 2124,2474 2110,2541 2067,2580 2061,2603 2057,2592 2045,2608 2023,2608 2022,2615 2038,2616 2053,2608 2045,2642 2058,2685 2039,2706 2010,2714 2008,2704 1990,2714 1988,2698 1975,2723 1948,2731 1939,2721 1933,2738 1916,2750 1910,2741 1910,2753 1896,2751 1895,2767 1865,2787 1870,2793 1861,2802 1884,2787 1879,2779 1906,2769 1898,2768 1904,2759 1917,2756 1917,2765 1926,2748 1948,2755 1945,2768 1928,2778 1981,2763 1950,2760 1995,2734 2018,2739 2024,2725 2008,2730 2070,2696 2062,2716 2073,2711 2093,2723 2052,2759 1969,2791 1901,2871 1879,2885 1874,2876 1859,2899 1852,2896 1858,2921 1831,2929 1844,2930 1835,2944 1870,2965 1840,2992 1844,3003 1843,2994 1862,2992 1876,2973 1875,2960 1892,2955 1885,2938 1914,2944 1957,2929 1965,2941 1956,2959 1937,2957 1918,3028 1910,3028 1910,3038 1903,3029 1895,3034 1897,3052 1880,3042 1885,3047 1848,3062 1839,3051 1843,3036 1882,3006 1852,3028 1819,3018 1816,3029 1836,3047 1811,3060 1804,3077 1782,3088 1728,3091 1714,3106 1701,3095 1713,3066 1747,3031 1746,3017 1763,3027 1803,3008 1776,3019 1765,3012 1761,2991 1784,2977 1765,2975 1760,2954 1768,2953 1753,2945 1759,2924 1769,2920 1762,2908 1776,2908 1781,2894 1798,2885 1787,2895 1795,2896 1818,2874 1835,2873 1826,2870 1851,2839 1854,2846 1859,2830 1845,2837 1841,2825 1831,2824 1839,2831 1830,2832 1832,2854 1823,2851 1821,2862 1815,2857 1786,2887 1777,2882 1769,2899 1754,2894 1760,2906 1739,2906 1746,2966 1739,2975 1747,2983 1740,2983 1746,2990 1735,2984 1735,2997 1748,3000 1730,3007 1731,3016 1702,2999 1716,2986 1707,2975 1710,2962 1702,2961 1709,2955 1699,2949 1714,2933 1698,2926 1709,2915 1687,2920 1681,2912 1691,2908 1689,2893 1716,2897 1727,2877 1751,2865 1751,2845 1735,2838 1725,2846 1716,2835 1697,2856 1666,2857 1646,2872 1642,2888 1610,2902 1599,2898 1604,2904 1596,2913 1579,2900 1585,2931 1560,2943 1495,2946 1486,2972 1474,2964 1478,2953 1447,2958 1453,2972 1438,2972 1436,2951 1429,2965 1418,2959 1407,2969 1398,2957 1398,2970 1412,2975 1405,2982 1416,2984 1410,2995 1423,3004 1411,3012 1416,3023 1386,2976 1397,2957 1386,2953 1397,2924 1388,2903 1398,2911 1408,2901 1387,2902 1400,2879 1392,2855 1406,2848 1415,2855 1409,2841 1432,2839 1430,2828 1439,2835 1460,2818 1503,2817 1524,2804 1536,2809 1531,2824 1543,2820 1547,2836 1558,2834 1563,2813 1591,2814 1605,2798 1612,2803 1664,2762 1642,2760 1684,2736 1688,2741 1690,2731 1701,2738 1705,2725 1723,2722 1725,2730 1753,2719 1768,2696 1774,2702 1789,2681 1799,2685 1801,2661 1834,2652 1840,2636 1851,2642 1867,2625 1880,2626 1880,2608 1896,2612 1938,2558 1959,2552 1911,2542 1919,2530 1954,2520 1968,2525 1964,2535 1971,2530 1961,2551 1985,2544 1993,2553 2007,2540 2015,2549 2033,2531 2052,2534 2060,2518 2066,2525 2074,2501 2056,2497 2071,2496 2077,2485 2052,2478 2012,2487 2003,2502 1971,2500 1971,2507 1950,2508 1952,2518 1948,2510 1872,2540 1858,2565 1837,2568 1837,2577 1816,2582 1818,2590 1808,2587 1809,2605 1803,2594 1787,2602 1790,2615 1754,2635 1756,2649 1741,2647 1746,2656 1731,2659 1725,2680 1707,2697 1681,2694 1697,2708 1682,2714 1684,2726 1675,2721 1670,2740 1620,2767 1579,2804 1580,2789 1569,2808 1552,2798 1587,2770 1573,2764 1600,2742 1596,2726 1629,2731 1598,2724 1599,2710 1616,2695 1603,2705 1597,2700 1591,2716 1549,2725 1566,2726 1537,2748 1521,2745 1524,2754 1512,2753 1501,2770 1488,2759 1477,2767 1463,2761 1462,2772 1436,2755 1426,2759 1425,2744 1418,2745 1427,2740 1424,2730 1409,2733 1414,2744 1398,2751 1398,2767 1392,2752 1364,2778 1366,2769 1353,2777 1358,2758 1351,2759 1348,2741 1327,2742 1348,2757 1344,2776 1326,2782 1302,2770 1298,2757 1310,2731 1332,2727 1297,2714 1316,2661 1312,2649 1287,2699 1278,2708 1266,2703 1264,2720 1253,2714 1252,2734 1283,2732 1287,2753 1281,2737 1263,2753 1233,2745 1235,2737 1251,2745 1238,2728 1230,2730 1231,2745 1189,2750 1189,2740 1196,2741 1185,2732 1171,2739 1159,2710 1111,2749 1092,2708 1099,2710 1112,2687 1145,2684 1159,2709 1174,2686 1146,2684 1142,2676 1161,2661 1179,2666 1160,2659 1160,2640 1198,2614 1196,2599 1204,2610 1231,2581 1251,2589 1250,2608 1259,2599 1264,2608 1309,2588 1310,2571 1325,2576 1320,2566 1347,2551 1350,2540 1340,2534 1311,2550 1310,2533 1334,2511 1349,2508 1348,2516 1368,2506 1368,2493 1377,2497 1377,2489 1358,2483 1348,2453 1356,2445 1342,2445 1344,2435 1357,2433 1343,2429 1348,2416 1331,2427 1280,2424 1297,2410 1294,2387 1322,2402 1318,2380 1303,2372 1330,2350 1306,2347 1314,2335 1310,2336 1296,2323 1279,2328 1287,2367 1264,2357 1273,2348 1266,2342 1255,2354 1242,2351 1269,2377 1279,2415 1267,2416 1273,2446 1299,2461 1292,2468 1304,2479 1296,2483 1303,2484 1296,2487 1301,2495 1291,2496 1277,2458 1263,2486 1272,2515 1254,2523 1212,2484 1225,2475 1228,2485 1227,2466 1208,2470 1189,2448 1194,2421 1190,2427 1176,2420 1170,2425 1183,2427 1173,2432 1186,2445 1180,2459 1196,2463 1183,2482 1175,2479 1182,2494 1170,2495 1165,2486 1165,2494 1150,2493 1166,2453 1161,2415 1198,2402 1193,2387 1173,2383 1173,2372 1155,2369 1150,2377 1151,2360 1162,2353 1179,2363 1180,2345 1176,2346 1157,2322 1167,2325 1169,2313 1193,2308 1192,2319 1203,2319 1197,2326 1215,2326 1209,2306 1228,2303 1215,2297 1179,2307 1166,2291 1122,2277 1119,2295 1129,2312 1113,2318 1115,2306 1105,2315 1114,2320 1108,2342 1106,2330 1093,2335 1122,2379 1133,2376 1119,2382 1133,2391 1122,2411 1129,2421 1106,2414 1105,2420 1143,2444 1143,2458 1130,2465 1138,2469 1119,2463 1112,2468 1121,2471 1111,2472 1141,2477 1140,2494 1126,2499 1121,2521 1107,2525 1108,2511 1094,2505 1101,2485 1094,2480 1082,2489 1087,2518 1056,2503 1078,2521 1071,2530 1059,2523 1049,2533 1055,2541 1089,2546 1094,2564 1098,2550 1114,2549 1093,2572 1085,2572 1085,2561 1067,2588 1065,2595 1082,2606 1098,2603 1087,2599 1099,2592 1117,2610 1109,2620 1093,2618 1076,2643 1060,2635 1057,2643 1073,2656 1056,2653 1031,2677 1015,2673 1020,2681 1007,2673 1009,2696 981,2709 974,2705 980,2696 962,2699 957,2680 931,2665 920,2676 928,2694 922,2699 931,2702 888,2709 910,2714 959,2703 945,2724 884,2737 867,2726 863,2734 802,2740 795,2708 803,2705 811,2724 816,2719 796,2690 773,2699 760,2694 780,2688 778,2678 790,2679 787,2661 796,2648 784,2641 801,2619 811,2620 796,2607 797,2592 811,2598 829,2582 871,2569 851,2581 865,2583 877,2569 862,2548 828,2550 813,2536 814,2515 779,2501 794,2490 774,2489 742,2504 750,2513 743,2522 782,2536 785,2527 802,2530 815,2561 797,2585 786,2561 775,2560 786,2570 777,2578 785,2591 739,2567 734,2575 734,2561 750,2564 749,2543 730,2560 725,2554 725,2562 707,2555 717,2573 707,2574 708,2594 717,2588 721,2603 722,2592 728,2619 727,2637 717,2633 719,2625 709,2643 729,2647 711,2659 712,2668 702,2667 703,2660 695,2640 657,2661 651,2676 645,2663 660,2648 653,2643 608,2681 628,2682 613,2701 600,2698 603,2713 587,2719 569,2708 557,2717 570,2740 549,2739 532,2719 508,2736 502,2729 496,2745 480,2746 466,2763 438,2777 430,2771 430,2779 421,2778 422,2791 440,2794 425,2810 433,2839 424,2835 408,2850 400,2827 376,2857 352,2858 328,2875 312,2869 318,2876 300,2891 336,2885 346,2899 377,2884 378,2873 395,2894 394,2908 335,2922 316,2917 312,2929 353,2931 320,2938 322,2948 352,2938 345,2948 337,2945 335,2955 320,2957 306,2943 302,2956 289,2953 277,2964 260,2958 254,2977 238,2984 271,2983 239,3005 207,2989 199,3004 182,2987 263,2949 206,2964 208,2970 186,2975 137,3009 92,3023 107,3030 100,3030 107,3043 93,3051 92,3062 90,3049 79,3049 93,3037 78,3046 72,3038 81,3031 27,3050 35,3027 50,3020 41,3020 41,2992 14,2999 7,2990 24,2962 118,2923 115,2907 104,2905 108,2897 119,2905 117,2884 107,2886 117,2881 114,2869 124,2857 98,2868 95,2852 84,2851 62,2867 47,2865 38,2878 78,2880 68,2893 72,2904 84,2903 81,2928 31,2946 10,2937 -14,2945 -7,2959 -18,2969 -17,2984 -23,2973 -64,2980 -64,2938 -61,2947 -56,2943 -64,2934 -64,2528 -60,2544 -53,2535 -64,2527 -64,2078 -56,2067 -64,2076 -64,1882 -44,1896 -15,1891 22,1867 -18,1875 -30,1863 -43,1890 -54,1885 -51,1875 -64,1881 -64,1675 -55,1681 -51,1715 -37,1710 -28,1721 -18,1756 13,1758 15,1772 18,1766 26,1773 21,1799 34,1796 28,1817 63,1802 63,1813 73,1807 86,1825 97,1787 90,1775 82,1787 62,1755 45,1745 47,1719 41,1739 28,1743 30,1692 21,1694 17,1684 11,1717 -1,1706 4,1672 20,1666 -3,1650 -12,1656 -11,1644 -19,1644 -35,1646 -54,1674 -64,1672 -64,1632 -51,1632 -53,1624 -64,1625 -64,1370 -56,1364 -64,1358 -64,1121 28,1167 34,1157 -22,1126 -35,1102 -58,1103 -55,1086 -63,1091 -39,1056 -58,1062 -41,1046 -23,1044 -49,1020 -57,1025 -52,1040 -64,1048 -64,943 -56,926 -15,950 -6,968 -18,1044 -11,1090 7,1091 86,1174 77,1176 73,1192 89,1194 89,1201 70,1222 79,1224 103,1203 108,1195 100,1185 120,1167 120,1191 135,1189 141,1198 127,1246 140,1253 133,1299 146,1270 157,1266 164,1279 159,1294 169,1281 161,1268 171,1236 180,1236 166,1228 172,1208 147,1203 139,1186 125,1182 126,1162 177,1128 188,1131 204,1173 207,1157 233,1160 243,1152 244,1161 247,1150 264,1143 285,1187 334,1204 357,1195 366,1200 369,1226 393,1260 372,1275 377,1293 378,1277 395,1264 433,1296 434,1307 439,1296 491,1306 496,1296 464,1297 409,1264 402,1252 415,1246 397,1245 378,1223 373,1194 388,1167 373,1189 357,1182 323,1187 330,1174 343,1173 351,1154 329,1157 331,1167 324,1155 321,1185 289,1174 280,1161 307,1157 319,1136 303,1128 277,1141 263,1130 211,1147 199,1122 212,1101 195,1120 165,1120 137,1140 136,1119 145,1130 144,1112 157,1098 125,1116 133,1119 104,1142 108,1149 90,1154 -2,1060 -2,1016 14,974 10,956 26,950 -45,910 -3,869 -18,846 -1,835 23,842 29,818 2,821 6,804 13,794 21,801 19,790 29,782 89,782 100,798 118,790 133,804 141,778 131,781 132,770 122,769 126,756 105,755 121,717 114,714 156,697 176,668 169,667 142,701 118,703 106,717 107,733 99,730 99,757 83,767 31,772 -3,795 -21,771 4,763 -30,754 -45,786 -41,801 -53,802 -56,795 -62,799 -57,808 -64,806 -64,749 -38,742 -64,748 -64,674 -55,672 -64,671 -64,654 -64,463 -38,465 -27,454 -46,436 -47,450 -64,460 -64,313 -54,310 -64,308 -64,253 -63,260 -54,257 -64,252 -64,238 -57,242 -51,229 -20,222 0,227 11,200 -8,197 -23,214 -42,216 -28,209 -35,204 -64,219 -64,171 -54,168 -44,178 -44,159 -33,147 -52,132 -64,148 -64,74 -54,82 -54,101 -51,89 -43,90 -37,82 -29,90 +L 1761,3044 1761,3054 1782,3060 1761,3044 +L 1735,2908 1710,2915 1728,2919 1737,2918 1735,2908 +L 1422,2881 1402,2890 1417,2898 1422,2881 +L 1529,2844 1505,2851 1501,2845 1496,2856 1491,2847 1466,2866 1467,2854 1445,2857 1449,2875 1471,2881 1482,2866 1487,2877 1493,2869 1511,2872 1515,2862 1531,2863 1520,2850 1529,2844 +L 1765,2832 1761,2841 1781,2838 1782,2853 1796,2849 1796,2836 1765,2832 +L 1854,2884 1841,2888 1854,2892 1854,2884 +L 1689,2815 1684,2825 1692,2827 1678,2836 1689,2832 1682,2842 1694,2844 1692,2834 1699,2838 1701,2830 1689,2815 +L 1341,2711 1335,2728 1359,2746 1373,2740 1396,2722 1345,2718 1341,2711 +L 1538,2735 1529,2741 1539,2742 1538,2735 +L 1833,2800 1810,2809 1812,2824 1833,2800 +L 1888,2808 1876,2817 1885,2818 1888,2808 +L 1488,2720 1448,2725 1461,2727 1459,2735 1488,2729 1488,2720 +L 1508,2671 1508,2721 1522,2707 1525,2675 1514,2672 1508,2671 +L 1223,2719 1212,2720 1208,2733 1207,2720 1196,2730 1204,2743 1211,2745 1223,2719 +L 1923,2781 1905,2786 1907,2793 1923,2781 +L 1925,2770 1923,2781 1927,2778 1925,2770 +L 1235,2717 1239,2727 1246,2723 1235,2717 +L 1176,2717 1181,2725 1187,2719 1176,2717 +L 2042,2734 1981,2763 2028,2750 2042,2734 +L 1684,2747 1679,2756 1691,2754 1684,2747 +L 1176,2696 1172,2701 1183,2698 1176,2696 +L 1211,2621 1208,2634 1190,2632 1171,2648 1196,2652 1208,2636 1219,2640 1219,2630 1211,2621 +L 1646,2630 1643,2638 1651,2635 1646,2630 +L 1250,2609 1231,2614 1220,2630 1235,2637 1234,2623 1246,2623 1250,2609 +L 1751,2571 1720,2582 1697,2612 1708,2605 1715,2628 1714,2608 1735,2601 1734,2587 1751,2571 +L 1864,2685 1873,2698 1859,2711 1884,2697 1864,2685 +L 1692,2553 1684,2561 1697,2560 1692,2553 +L 1402,2483 1405,2495 1379,2529 1352,2537 1357,2546 1370,2546 1370,2539 1373,2545 1388,2525 1436,2504 1436,2485 1426,2498 1402,2483 +L 1974,2631 1946,2650 1962,2661 1974,2631 +L 1814,2524 1799,2531 1800,2540 1814,2540 1814,2524 +L 1938,2622 1938,2630 1952,2633 1938,2622 +L 1989,2630 1974,2631 1983,2632 1989,2630 +L 1835,2509 1816,2528 1845,2510 1835,2509 +L 1639,2454 1638,2495 1661,2497 1628,2508 1637,2517 1644,2505 1654,2503 1657,2512 1668,2502 1683,2455 1663,2472 1639,2454 +L 1849,2494 1848,2502 1862,2507 1861,2497 1849,2494 +L 1947,2435 1948,2444 1949,2455 1937,2452 1930,2462 1867,2463 1854,2478 1861,2497 1867,2504 1865,2495 1885,2485 1887,2473 1893,2488 1913,2476 1914,2463 1922,2472 1968,2448 1965,2439 1947,2435 +L 1259,2453 1246,2457 1259,2466 1251,2459 1259,2453 +L 1176,2366 1179,2380 1191,2372 1176,2366 +L 1228,2321 1229,2337 1238,2338 1233,2336 1237,2323 1228,2321 +L 1313,2281 1301,2282 1308,2289 1313,2281 +L 108,2996 99,2997 104,3004 108,2996 +L 1393,2459 1391,2471 1400,2474 1393,2459 +L 124,2989 110,2995 129,2999 124,2989 +L 1468,2447 1455,2470 1479,2467 1478,2448 1468,2447 +L 1511,2459 1507,2464 1520,2465 1511,2459 +L 2026,2448 2023,2457 2032,2462 2038,2453 2026,2448 +L 1428,2442 1401,2451 1417,2452 1428,2442 +L 1970,2439 1978,2448 1983,2441 1970,2439 +L 2009,2422 2012,2432 1999,2434 2026,2447 2034,2433 2009,2422 +L 1552,2446 1569,2438 1546,2438 1552,2446 +L 1357,2433 1353,2440 1363,2438 1357,2433 +L 1463,2404 1434,2438 1477,2423 1482,2407 1472,2405 1463,2404 +L 1417,2364 1388,2385 1395,2400 1377,2403 1376,2415 1368,2410 1388,2437 1405,2433 1410,2422 1400,2399 1412,2375 1428,2368 1417,2364 +L 1619,2414 1573,2436 1586,2437 1619,2414 +L 1775,2284 1772,2308 1755,2313 1758,2298 1749,2299 1751,2318 1733,2330 1676,2335 1659,2357 1636,2361 1634,2369 1643,2367 1623,2386 1615,2384 1616,2402 1646,2385 1647,2395 1630,2408 1640,2415 1655,2389 1663,2396 1663,2388 1671,2393 1678,2386 1670,2382 1677,2368 1687,2362 1695,2369 1686,2378 1697,2381 1697,2366 1706,2374 1730,2348 1751,2342 1753,2332 1764,2337 1779,2317 1804,2307 1807,2295 1814,2298 1809,2291 1819,2285 1775,2284 +L 1334,2390 1328,2398 1354,2414 1353,2403 1365,2407 1334,2390 +L 1738,2405 1733,2411 1748,2413 1738,2405 +L 166,2979 166,2987 173,2980 166,2979 +L 1847,1472 1836,1482 1818,1478 1810,1496 1801,1493 1801,1503 1785,1509 1783,1523 1765,1507 1753,1516 1744,1506 1739,1524 1730,1514 1734,1531 1723,1557 1718,1564 1700,1560 1713,1605 1722,1608 1724,1636 1686,1611 1682,1618 1673,1613 1669,1633 1657,1629 1644,1620 1643,1585 1625,1572 1621,1577 1639,1594 1615,1596 1606,1583 1607,1556 1636,1536 1617,1536 1604,1552 1616,1519 1595,1491 1590,1497 1593,1484 1585,1512 1570,1512 1574,1526 1558,1521 1561,1512 1547,1524 1550,1546 1539,1545 1556,1571 1523,1568 1551,1582 1539,1589 1526,1581 1529,1590 1515,1587 1517,1606 1507,1601 1490,1613 1498,1614 1496,1625 1503,1618 1498,1634 1505,1644 1515,1636 1505,1628 1507,1612 1530,1606 1538,1614 1534,1626 1543,1608 1538,1598 1546,1592 1547,1609 1554,1600 1552,1607 1565,1604 1566,1590 1593,1576 1589,1633 1600,1642 1621,1622 1624,1640 1644,1649 1668,1640 1685,1660 1680,1673 1685,1667 1693,1675 1670,1681 1673,1695 1654,1726 1639,1714 1638,1722 1624,1716 1635,1726 1629,1741 1616,1748 1587,1740 1590,1750 1561,1766 1564,1770 1559,1782 1567,1780 1560,1801 1576,1812 1538,1801 1545,1818 1534,1807 1526,1816 1538,1823 1536,1895 1547,1914 1540,1938 1520,1949 1524,1956 1502,1977 1521,1997 1523,2012 1557,2013 1551,2023 1563,2023 1559,2032 1537,2040 1517,2018 1511,2034 1496,2032 1505,1999 1496,1990 1483,1999 1480,1983 1463,1982 1455,1989 1458,1980 1448,1976 1443,1984 1453,1991 1422,2019 1463,2000 1469,2013 1468,1996 1489,2007 1475,2002 1476,2015 1486,2018 1468,2023 1472,2010 1454,2039 1455,2071 1467,2074 1466,2083 1455,2091 1454,2107 1443,2108 1447,2116 1460,2114 1463,2138 1449,2146 1437,2141 1431,2157 1441,2162 1462,2144 1464,2157 1457,2155 1456,2167 1440,2177 1448,2186 1454,2177 1472,2181 1467,2191 1476,2201 1483,2196 1484,2223 1470,2223 1475,2238 1453,2252 1459,2280 1438,2275 1462,2307 1471,2306 1462,2322 1488,2338 1487,2350 1467,2364 1467,2355 1452,2349 1451,2329 1436,2321 1439,2352 1443,2348 1461,2367 1488,2373 1482,2379 1492,2384 1481,2380 1480,2396 1489,2390 1489,2406 1498,2387 1500,2398 1504,2376 1557,2376 1584,2351 1577,2334 1585,2343 1629,2311 1662,2306 1665,2289 1684,2284 1680,2275 1695,2263 1672,2268 1668,2256 1659,2267 1651,2253 1649,2267 1640,2262 1638,2272 1626,2274 1629,2243 1606,2246 1609,2238 1593,2226 1595,2202 1617,2159 1615,2146 1648,2142 1661,2115 1679,2109 1659,2114 1655,2103 1647,2108 1634,2096 1635,2088 1650,2091 1636,2082 1649,2082 1639,2077 1646,2074 1670,2080 1663,2064 1674,2066 1677,2049 1668,2052 1674,2045 1666,2044 1663,2027 1701,1960 1701,1939 1721,1943 1716,1918 1732,1902 1724,1880 1751,1857 1714,1850 1721,1798 1755,1750 1762,1752 1769,1731 1762,1731 1782,1714 1788,1725 1779,1730 1811,1731 1813,1710 1821,1713 1820,1700 1832,1694 1809,1704 1804,1719 1797,1703 1818,1691 1796,1660 1783,1683 1760,1683 1770,1646 1758,1643 1771,1633 1768,1616 1776,1629 1775,1615 1799,1599 1784,1615 1795,1612 1809,1595 1805,1609 1818,1611 1847,1568 1832,1576 1823,1558 1808,1556 1801,1544 1762,1549 1806,1538 1816,1515 1836,1514 1836,1491 1845,1485 1874,1489 1873,1481 1848,1480 1847,1472 +L 60,2977 51,2979 56,2986 60,2977 +L 78,2969 73,2978 83,2977 78,2969 +L 2062,2365 2044,2387 2038,2377 2026,2378 2027,2389 2047,2399 2061,2380 2068,2383 2062,2365 +L -29,2947 -44,2951 -30,2960 -29,2947 +L 173,2913 155,2915 132,2936 173,2913 +L 223,2880 193,2902 186,2898 173,2913 192,2911 233,2882 223,2880 +L 1517,2382 1505,2385 1522,2396 1517,2382 +L 31,2841 22,2844 39,2857 31,2841 +L 1790,2373 1775,2390 1797,2380 1790,2373 +L 664,2640 660,2648 668,2648 664,2640 +L 669,2617 641,2622 641,2630 651,2627 674,2647 691,2641 669,2617 +L 343,2773 332,2781 332,2801 297,2813 301,2821 263,2843 267,2861 234,2882 244,2885 264,2866 273,2871 269,2865 281,2854 374,2818 360,2834 363,2846 363,2836 387,2827 382,2810 379,2799 363,2802 347,2789 343,2773 +L 1908,2365 1900,2368 1907,2373 1908,2365 +L 878,2692 863,2706 881,2708 881,2699 878,2692 +L 1383,2334 1363,2338 1370,2344 1360,2343 1366,2350 1353,2359 1374,2368 1375,2354 1388,2345 1383,2334 +L 1847,2350 1819,2357 1815,2366 1847,2350 +L 887,2694 881,2699 887,2703 887,2694 +L 2106,2337 2089,2340 2099,2351 2106,2337 +L 2066,2343 2068,2351 2077,2348 2066,2343 +L 1917,2265 1893,2285 1907,2303 1857,2344 1881,2336 1888,2343 1893,2325 1900,2328 1913,2314 1905,2312 1913,2307 1915,2293 1908,2291 1917,2265 +L 287,2816 287,2825 294,2820 287,2816 +L 7,2789 -5,2804 0,2810 20,2804 19,2790 7,2789 +L 1336,2329 1316,2334 1339,2339 1336,2329 +L 34,2747 23,2756 29,2800 53,2782 43,2783 43,2753 34,2747 +L 1970,2314 1953,2334 1968,2334 1970,2314 +L 1665,2314 1666,2324 1675,2332 1682,2317 1665,2314 +L 282,2757 282,2770 299,2782 282,2757 +L 1275,2312 1274,2322 1285,2317 1275,2312 +L 1305,2301 1296,2302 1296,2311 1305,2301 +L 1476,1969 1476,1978 1486,1970 1476,1969 +L 381,2768 389,2781 400,2775 381,2768 +L 366,2750 352,2760 367,2774 378,2765 366,2750 +L 465,2759 466,2744 458,2744 465,2759 +L 442,2562 424,2568 432,2581 423,2596 419,2606 402,2599 400,2594 381,2577 366,2580 385,2605 397,2605 390,2614 397,2633 391,2645 379,2644 356,2619 346,2642 352,2676 368,2666 370,2654 395,2652 406,2625 436,2624 425,2631 437,2632 406,2658 422,2686 395,2698 412,2709 411,2729 397,2716 382,2724 394,2725 401,2735 390,2745 405,2750 447,2729 455,2736 475,2719 457,2726 464,2711 482,2711 481,2700 476,2707 464,2700 458,2715 439,2713 437,2689 424,2681 428,2642 444,2632 441,2617 419,2618 447,2600 461,2620 476,2591 462,2587 461,2568 442,2562 +L 1231,2286 1222,2297 1231,2297 1231,2286 +L 1212,2281 1208,2292 1215,2296 1212,2281 +L 1858,2251 1831,2278 1845,2284 1841,2272 1860,2265 1866,2271 1873,2258 1867,2259 1858,2251 +L 1383,2256 1369,2267 1376,2280 1402,2270 1383,2256 +L 1228,2256 1193,2265 1190,2278 1237,2265 1228,2256 +L 263,2710 250,2721 252,2731 234,2735 252,2744 266,2725 263,2710 +L 163,2574 159,2579 158,2607 146,2616 120,2596 101,2600 144,2628 137,2641 113,2635 116,2654 88,2668 88,2686 101,2690 117,2667 128,2665 120,2668 130,2675 127,2683 113,2684 113,2703 128,2707 135,2697 139,2723 128,2728 127,2740 150,2712 167,2719 181,2699 138,2697 150,2671 133,2666 152,2643 146,2622 164,2604 163,2574 +L 832,2618 827,2626 822,2620 815,2628 825,2635 829,2627 824,2654 807,2653 822,2659 818,2673 827,2673 851,2655 851,2640 842,2639 832,2618 +L 348,2715 345,2729 354,2732 348,2715 +L 504,2718 487,2719 495,2727 504,2718 +L 188,2704 181,2723 187,2716 186,2724 200,2725 198,2707 195,2713 188,2704 +L 802,2631 802,2645 814,2648 802,2631 +L 86,2712 81,2722 90,2718 86,2712 +L 883,2629 886,2638 893,2632 883,2629 +L 312,2691 314,2708 323,2712 328,2700 312,2691 +L 230,2701 227,2707 239,2707 230,2701 +L 857,2626 848,2630 855,2634 857,2626 +L 206,2649 208,2667 219,2663 223,2670 217,2665 212,2675 221,2689 209,2688 211,2705 232,2690 233,2663 246,2671 231,2654 214,2659 206,2649 +L 296,2650 279,2660 285,2664 277,2661 253,2686 279,2690 288,2703 288,2680 306,2686 313,2660 296,2650 +L 15,2694 19,2702 27,2695 15,2694 +L 236,2690 229,2695 249,2699 236,2690 +L 204,2664 196,2667 199,2679 191,2675 191,2696 209,2685 208,2667 206,2679 204,2664 +L 1,2678 2,2691 12,2691 1,2678 +L 1081,2608 1060,2613 1074,2619 1070,2629 1081,2608 +L 604,2609 569,2635 570,2643 569,2653 545,2647 542,2660 527,2660 525,2673 511,2672 521,2687 532,2684 536,2670 570,2664 591,2646 605,2654 623,2643 627,2652 642,2647 641,2630 619,2635 621,2615 604,2609 +L 871,2595 878,2620 879,2602 871,2595 +L 460,2655 452,2676 463,2682 472,2668 460,2655 +L 488,2650 491,2661 478,2672 486,2678 494,2666 488,2650 +L 22,2656 13,2658 18,2677 22,2656 +L 925,2605 916,2612 931,2611 925,2605 +L 958,2595 952,2597 948,2605 958,2595 +L 164,2651 166,2669 176,2660 164,2651 +L 879,2581 874,2592 886,2585 879,2581 +L 515,2645 507,2646 513,2652 506,2660 515,2664 515,2645 +L 943,2569 935,2578 942,2586 943,2569 +L 960,2542 936,2553 934,2572 937,2562 962,2568 960,2542 +L 520,2634 510,2635 518,2638 520,2634 +L 18,2585 -2,2635 10,2637 32,2607 32,2593 18,2585 +L 44,2624 36,2636 49,2633 44,2624 +L 515,2618 520,2634 527,2624 515,2618 +L -23,2615 -22,2633 -16,2622 -23,2615 +L 22,2623 24,2632 31,2627 22,2623 +L 977,2552 971,2555 979,2567 991,2559 977,2552 +L 489,2616 482,2617 487,2628 489,2616 +L 702,2586 689,2600 700,2600 701,2608 690,2616 691,2627 711,2608 702,2606 705,2596 702,2586 +L 921,2538 903,2563 910,2565 921,2538 +L 66,2597 48,2615 60,2614 66,2597 +L 527,2499 500,2509 510,2517 504,2524 516,2549 501,2553 515,2567 507,2585 535,2599 525,2599 527,2612 551,2593 554,2604 553,2596 568,2589 579,2597 588,2585 560,2585 561,2566 540,2559 524,2572 536,2538 532,2524 516,2516 527,2499 +L 179,2592 183,2609 197,2608 204,2597 186,2605 179,2592 +L -38,2596 -43,2603 -30,2609 -38,2596 +L 502,2598 505,2606 513,2603 502,2598 +L 1002,2508 1006,2526 1031,2540 1037,2555 1032,2533 1008,2522 1002,2508 +L 843,2524 837,2529 844,2532 843,2524 +L 653,2577 629,2603 653,2593 653,2577 +L 935,2510 922,2522 931,2522 935,2510 +L -43,2559 -32,2585 -38,2596 -29,2590 -31,2578 -17,2572 -43,2559 +L 885,2509 873,2520 888,2517 885,2509 +L 74,2538 75,2590 83,2588 76,2570 84,2553 74,2538 +L 325,2573 322,2587 334,2587 329,2580 337,2575 325,2573 +L 658,2563 655,2576 675,2581 658,2563 +L 198,2523 191,2543 181,2535 184,2580 200,2569 210,2543 198,2523 +L 323,2570 326,2551 338,2554 334,2549 317,2549 323,2570 +L 160,2570 173,2556 163,2556 160,2570 +L 661,2535 663,2544 634,2557 622,2546 620,2554 583,2555 585,2564 610,2557 635,2563 640,2556 644,2566 652,2556 678,2552 666,2542 682,2540 661,2535 +L 911,2503 903,2504 902,2519 911,2503 +L 1038,2498 1035,2514 1050,2511 1054,2503 1038,2498 +L 843,2475 844,2475 871,2480 875,2472 850,2472 861,2469 850,2451 864,2435 838,2427 829,2423 824,2427 832,2429 822,2432 832,2430 846,2457 832,2454 833,2472 810,2473 805,2503 834,2473 843,2475 +L 277,2516 266,2518 274,2544 286,2552 277,2516 +L 568,2542 581,2551 580,2543 568,2542 +L 712,2487 725,2523 725,2550 729,2540 741,2542 728,2529 740,2517 712,2487 +L -29,2533 -23,2538 -34,2541 -19,2547 -13,2537 -29,2533 +L 551,2536 536,2538 540,2546 551,2536 +L 1045,2467 1023,2494 1044,2494 1045,2485 1056,2498 1077,2492 1074,2480 1055,2485 1058,2469 1045,2467 +L 611,2536 605,2540 619,2544 611,2536 +L 664,2530 639,2531 644,2539 664,2530 +L 575,2509 575,2517 559,2520 566,2522 561,2531 596,2516 580,2517 575,2509 +L 449,2511 460,2526 460,2517 449,2511 +L 250,2499 240,2516 259,2525 258,2503 250,2509 250,2499 +L 623,2514 613,2518 612,2525 623,2523 623,2514 +L 12,2467 4,2484 -4,2484 -4,2471 -11,2481 4,2492 -9,2517 4,2513 6,2501 8,2519 21,2513 21,2484 11,2483 20,2476 12,2467 +L 454,2448 435,2461 423,2491 408,2502 409,2516 434,2511 438,2500 444,2505 441,2465 454,2448 +L -56,2481 -51,2513 -42,2508 -56,2481 +L 614,2492 618,2504 641,2510 654,2502 639,2501 641,2493 630,2501 614,2492 +L 572,2494 576,2504 585,2498 572,2494 +L 547,2491 541,2493 549,2498 547,2491 +L 693,2487 701,2495 704,2488 693,2487 +L 507,2479 509,2492 514,2487 507,2479 +L 1008,2475 1003,2479 1019,2488 1008,2475 +L 653,2355 648,2368 660,2404 642,2440 671,2464 691,2467 712,2487 707,2469 715,2454 697,2469 684,2450 697,2434 671,2448 653,2355 +L 340,2459 353,2487 352,2466 340,2459 +L 951,2474 939,2478 947,2487 951,2474 +L 559,2476 555,2481 561,2485 559,2476 +L 595,2469 593,2482 602,2481 605,2474 595,2469 +L 99,2337 78,2346 78,2359 96,2367 98,2378 72,2389 67,2377 59,2382 61,2404 56,2396 45,2408 31,2389 43,2407 35,2414 44,2419 38,2427 50,2430 24,2481 44,2472 54,2437 70,2433 73,2414 62,2411 64,2404 79,2401 81,2410 93,2399 98,2408 123,2400 115,2367 105,2364 113,2345 114,2338 111,2344 99,2337 +L 945,2467 931,2472 930,2481 939,2478 945,2467 +L 1074,2468 1065,2472 1074,2479 1074,2468 +L 196,2477 188,2478 210,2478 196,2477 +L 802,2466 794,2475 800,2474 802,2466 +L 619,2471 613,2474 626,2475 619,2471 +L 109,2439 122,2454 149,2448 154,2461 194,2474 197,2465 185,2460 195,2450 109,2439 +L 631,2464 630,2472 639,2469 631,2464 +L 969,2455 957,2470 982,2466 972,2442 965,2442 969,2455 +L 422,2460 417,2470 430,2463 422,2460 +L 313,2433 294,2445 311,2450 323,2469 335,2457 331,2446 313,2433 +L 397,2468 414,2461 394,2461 397,2468 +L 1076,2453 1081,2460 1091,2462 1103,2446 1108,2451 1110,2441 1092,2441 1076,2453 +L 693,2444 694,2453 701,2450 693,2444 +L 910,2434 898,2440 911,2450 910,2434 +L 777,2436 779,2450 789,2446 777,2436 +L 1073,2431 1072,2449 1082,2438 1073,2431 +L 377,2369 384,2387 371,2389 382,2406 371,2408 367,2421 398,2422 418,2444 448,2448 424,2431 437,2426 431,2412 450,2400 396,2385 396,2377 387,2385 392,2370 377,2369 +L 1033,2408 1056,2445 1046,2418 1033,2408 +L 452,2414 443,2415 445,2428 465,2443 478,2436 459,2432 452,2414 +L 866,2356 861,2368 876,2374 861,2400 865,2409 856,2411 870,2440 892,2395 931,2386 935,2399 945,2398 928,2379 930,2369 925,2379 911,2372 901,2384 903,2377 893,2375 884,2379 874,2365 880,2354 872,2349 883,2340 856,2340 866,2356 +L 816,2424 798,2425 795,2434 814,2438 816,2424 +L 515,2428 490,2430 511,2437 509,2431 515,2428 +L 960,2422 954,2425 962,2436 970,2423 960,2422 +L 693,2428 698,2433 707,2431 693,2428 +L 746,2417 735,2418 744,2424 752,2420 746,2417 +L 697,2403 699,2413 709,2408 697,2403 +L 486,2386 493,2410 504,2392 486,2386 +L 767,2399 758,2401 757,2407 767,2399 +L 857,2395 846,2403 855,2404 857,2395 +L 273,2359 254,2376 265,2380 266,2394 276,2394 273,2359 +L 520,2362 503,2360 513,2394 542,2370 532,2371 541,2366 527,2347 517,2347 520,2362 +L 837,2379 823,2382 825,2394 837,2379 +L 1051,2352 1041,2362 1060,2388 1065,2380 1061,2367 1049,2364 1057,2354 1051,2352 +L 950,2369 949,2375 993,2380 950,2369 +L 844,2355 841,2376 859,2369 844,2355 +L 561,2355 544,2366 545,2375 561,2370 561,2355 +L 317,2350 311,2352 319,2373 342,2360 317,2350 +L 1446,1848 1436,1846 1441,1861 1451,1859 1442,1871 1437,1858 1427,1866 1424,1852 1403,1846 1401,1833 1399,1841 1367,1839 1363,1825 1363,1846 1343,1842 1348,1851 1338,1864 1350,1854 1367,1863 1371,1896 1360,1904 1368,1915 1354,1925 1344,1919 1344,1939 1331,1953 1344,1962 1338,1973 1350,1988 1358,1976 1349,2007 1360,2011 1359,2020 1334,2021 1320,2010 1324,2025 1315,2015 1288,2032 1300,2080 1267,2116 1251,2118 1253,2096 1232,2097 1231,2110 1212,2115 1199,2134 1200,2152 1182,2155 1177,2146 1146,2183 1115,2179 1058,2155 1060,2149 1034,2165 1032,2154 1032,2169 994,2163 994,2146 1028,2135 1032,2148 1038,2124 1051,2114 1039,2096 1042,2082 1031,2085 1050,2061 1048,2045 1009,2068 1020,2106 1014,2102 1018,2112 1008,2115 1008,2125 998,2121 999,2093 986,2077 999,2074 984,2062 976,2030 986,2020 982,1991 968,1996 984,1962 976,1960 981,1927 972,1931 939,1909 931,1878 938,1869 925,1874 905,1864 926,1881 934,1913 963,1933 971,1951 962,1977 935,1986 928,1999 936,2016 972,2040 983,2091 996,2103 968,2132 964,2153 982,2175 976,2199 939,2240 917,2231 911,2238 907,2230 914,2249 919,2242 938,2248 918,2272 913,2266 908,2304 888,2315 907,2326 912,2320 898,2314 905,2309 950,2313 936,2265 943,2247 966,2268 989,2315 987,2329 951,2356 950,2368 994,2332 1001,2319 949,2236 977,2215 993,2176 995,2182 1063,2165 1086,2169 1104,2197 1127,2209 1131,2196 1153,2190 1160,2176 1170,2205 1182,2210 1161,2212 1167,2241 1144,2237 1128,2256 1140,2246 1166,2245 1174,2268 1200,2257 1206,2235 1210,2249 1211,2236 1220,2242 1217,2234 1230,2239 1242,2232 1257,2253 1251,2292 1240,2301 1298,2297 1345,2309 1343,2298 1361,2299 1350,2288 1332,2300 1325,2293 1326,2302 1300,2290 1282,2265 1272,2276 1261,2271 1267,2258 1257,2233 1270,2225 1245,2214 1247,2203 1225,2195 1225,2205 1210,2194 1196,2204 1181,2192 1186,2182 1245,2189 1252,2173 1271,2207 1279,2205 1272,2217 1284,2210 1293,2216 1297,2229 1287,2236 1311,2245 1304,2250 1318,2259 1316,2270 1339,2261 1321,2258 1329,2251 1346,2257 1363,2247 1369,2219 1352,2217 1329,2243 1337,2250 1316,2249 1315,2227 1330,2228 1274,2176 1258,2147 1263,2138 1271,2143 1266,2134 1295,2096 1307,2093 1322,2105 1321,2087 1313,2085 1361,2070 1376,2090 1388,2081 1378,2070 1383,2061 1364,2068 1346,2046 1348,2063 1335,2059 1340,2039 1370,2049 1354,2033 1393,1965 1404,1962 1410,1971 1429,1953 1442,1954 1461,1929 1415,1932 1468,1896 1464,1877 1474,1849 1479,1858 1467,1832 1455,1849 1446,1848 +L 789,2349 785,2362 797,2351 789,2349 +L 492,2350 479,2356 492,2360 492,2350 +L 458,2340 451,2359 472,2346 458,2340 +L 305,2348 300,2354 310,2352 305,2348 +L 1045,2342 1035,2346 1051,2352 1045,2342 +L 306,2331 304,2342 314,2343 306,2331 +L 300,2319 289,2342 306,2331 300,2319 +L 312,2285 300,2298 303,2310 268,2309 271,2289 250,2290 252,2307 185,2307 208,2311 220,2338 230,2341 231,2320 254,2308 275,2325 295,2314 300,2319 319,2297 324,2309 324,2293 312,2285 +L 650,2319 639,2341 651,2332 650,2319 +L 1053,2332 1047,2337 1066,2339 1053,2332 +L 390,2274 376,2295 379,2306 398,2306 403,2326 417,2337 414,2329 434,2314 420,2313 432,2303 424,2291 382,2301 400,2285 390,2274 +L 1095,2311 1057,2322 1033,2313 1053,2331 1070,2327 1072,2334 1074,2322 1095,2311 +L 678,2318 675,2334 684,2329 678,2318 +L 816,2297 786,2303 779,2330 814,2310 816,2297 +L 102,2318 97,2328 110,2321 102,2318 +L 338,1903 359,1912 360,1905 338,1903 +L 122,2307 119,2316 165,2326 171,2312 147,2310 122,2307 +L 564,2305 535,2308 539,2323 564,2305 +L -8,2304 -17,2318 3,2323 -8,2304 +L 458,2287 451,2295 469,2304 454,2310 478,2319 501,2301 518,2302 502,2290 477,2300 458,2287 +L 446,2303 442,2312 445,2318 446,2303 +L 62,2294 23,2298 41,2301 35,2311 50,2316 59,2298 75,2316 90,2304 62,2294 +L 404,2052 386,2050 394,2018 379,2012 374,2026 363,2018 323,2024 313,2001 312,2014 299,2021 301,2035 329,2049 330,2060 312,2068 308,2112 269,2107 260,2098 251,2104 258,2144 301,2130 337,2106 345,2038 377,2030 385,2049 377,2062 367,2061 348,2109 367,2102 372,2079 382,2083 357,2120 365,2156 380,2130 387,2085 446,2078 456,2088 467,2070 511,2097 495,2105 515,2119 486,2112 470,2122 457,2107 437,2115 433,2137 420,2142 425,2161 412,2165 431,2177 427,2158 437,2139 449,2131 457,2148 467,2139 462,2132 472,2134 487,2146 480,2170 467,2171 457,2149 443,2144 440,2157 429,2160 473,2175 473,2201 504,2179 531,2187 536,2169 545,2167 551,2145 541,2081 593,2081 563,2080 558,2071 570,2052 550,2042 584,2048 562,2029 588,1995 598,1986 603,1997 621,1998 624,2007 614,2016 627,2023 627,2036 636,2011 651,2009 654,2033 674,2039 667,2076 646,2060 639,2080 616,2082 627,2091 641,2115 670,2117 675,2139 662,2144 678,2154 671,2157 678,2170 663,2173 654,2154 656,2179 642,2199 655,2206 635,2218 635,2225 647,2222 645,2233 625,2235 641,2240 621,2254 630,2256 630,2267 640,2253 631,2284 637,2290 612,2283 610,2292 585,2301 581,2314 597,2314 605,2296 629,2291 649,2313 649,2299 666,2287 679,2287 682,2306 685,2290 695,2297 699,2289 708,2303 710,2287 700,2288 697,2277 683,2286 667,2281 672,2263 665,2271 650,2249 656,2232 662,2251 671,2246 671,2229 683,2246 690,2238 679,2222 683,2206 700,2221 713,2212 721,2224 740,2225 736,2214 747,2206 753,2216 749,2198 723,2189 716,2161 704,2164 743,2123 740,2116 714,2135 698,2165 695,2140 674,2129 673,2114 690,2111 692,2090 699,2099 721,2096 740,2112 745,2093 736,2087 745,2085 744,2074 779,2049 749,2032 748,2020 735,2021 742,2027 732,2032 748,2037 741,2055 749,2059 755,2050 753,2062 734,2065 726,2015 690,2017 696,2028 689,2022 683,2029 689,2038 677,2023 702,1977 718,1983 712,1971 723,1965 712,1959 740,1949 735,1941 753,1929 771,1889 756,1897 711,1865 728,1847 723,1841 712,1858 687,1848 690,1859 680,1866 693,1879 700,1909 732,1924 703,1927 688,1941 671,1931 662,1941 658,1933 650,1949 658,1911 648,1912 654,1904 642,1886 630,1885 635,1905 624,1931 641,1954 624,1960 604,1941 592,1946 594,1959 587,1945 611,1923 601,1927 581,1910 597,1908 602,1887 592,1878 605,1878 608,1867 599,1864 608,1846 584,1848 597,1828 590,1822 571,1830 565,1822 553,1837 543,1804 547,1772 566,1793 570,1734 582,1731 588,1736 597,1717 589,1689 603,1703 634,1700 644,1735 668,1723 655,1711 658,1676 645,1675 652,1683 646,1692 633,1676 645,1668 629,1652 615,1678 601,1671 603,1657 613,1650 619,1656 642,1622 637,1610 654,1612 652,1593 680,1591 661,1573 629,1566 662,1550 698,1555 684,1571 675,1568 677,1579 706,1577 713,1566 716,1576 743,1576 739,1557 700,1555 699,1548 708,1546 714,1526 723,1525 725,1540 723,1517 731,1519 736,1506 748,1516 756,1500 740,1490 742,1476 713,1474 705,1454 671,1433 686,1429 691,1388 659,1387 657,1372 648,1392 658,1402 649,1415 665,1421 642,1438 635,1430 632,1449 618,1455 629,1455 615,1460 640,1457 639,1483 631,1484 638,1497 629,1511 615,1504 598,1519 602,1524 592,1523 586,1507 583,1518 577,1511 578,1529 563,1525 581,1547 568,1561 539,1530 559,1565 544,1565 528,1580 517,1569 490,1591 543,1594 575,1611 561,1620 562,1671 548,1691 548,1700 562,1704 546,1717 515,1708 525,1715 538,1758 521,1753 516,1741 508,1745 532,1785 530,1799 518,1796 518,1809 532,1803 515,1815 487,1821 459,1807 442,1782 442,1780 434,1758 436,1771 423,1780 434,1804 421,1817 432,1816 439,1828 422,1831 440,1830 446,1846 444,1828 483,1822 505,1845 504,1861 492,1868 481,1861 489,1870 463,1886 446,1892 442,1885 458,1866 449,1855 448,1858 448,1855 444,1861 446,1865 442,1881 425,1875 421,1890 395,1898 382,1881 386,1867 373,1859 365,1901 376,1908 353,1938 337,1933 347,1923 326,1927 335,1900 323,1924 308,1932 294,1927 302,1902 280,1904 286,1912 275,1914 273,1928 252,1905 264,1900 237,1898 236,1889 224,1900 239,1900 246,1919 270,1932 254,1954 267,1948 284,1972 276,1977 277,1965 264,1968 274,1983 258,1995 277,1993 283,2004 279,1986 323,1941 335,1947 338,1959 354,1957 368,1986 355,1957 370,1959 363,1971 373,1971 372,1959 378,1960 372,1952 380,1930 430,1897 437,1920 402,1925 406,1941 386,1969 380,1962 375,1982 430,1953 456,1964 431,2010 423,2003 396,2018 425,2031 431,2011 448,2019 450,2008 465,2004 475,2010 471,2023 445,2036 452,2038 439,2058 404,2052 +L 665,2291 660,2306 670,2311 665,2291 +L -37,2281 -35,2309 -20,2299 -11,2306 -12,2282 -37,2281 +L 569,2296 564,2305 578,2301 569,2296 +L 822,2149 803,2152 806,2170 793,2166 794,2157 787,2170 775,2161 765,2163 759,2153 766,2185 760,2195 771,2200 774,2184 819,2278 819,2296 833,2298 846,2270 830,2283 839,2252 832,2247 862,2218 842,2219 842,2230 837,2217 826,2225 818,2213 793,2216 793,2187 811,2177 811,2154 822,2149 +L 1048,2286 1034,2292 1039,2297 1048,2286 +L 754,2281 759,2290 750,2294 779,2292 766,2283 754,2281 +L 44,2265 44,2292 76,2281 64,2268 62,2279 48,2276 44,2265 +L 1091,2272 1087,2287 1095,2287 1091,2272 +L 1077,2231 1073,2249 1081,2257 1072,2261 1062,2248 1068,2235 1048,2238 1044,2256 1031,2248 1022,2260 1033,2273 1044,2265 1055,2287 1054,2271 1068,2268 1070,2280 1077,2262 1087,2260 1084,2236 1077,2231 +L 266,2266 258,2268 272,2287 266,2266 +L 570,2234 540,2243 547,2252 535,2263 518,2258 497,2280 524,2275 534,2281 604,2256 570,2234 +L 247,1895 256,1885 243,1885 247,1895 +L 1115,2144 1084,2160 1096,2163 1115,2144 +L 79,2262 81,2276 88,2275 79,2262 +L 1340,2005 1330,2010 1333,2018 1340,2005 +L 356,2252 346,2273 366,2257 356,2252 +L 1762,2267 1755,2272 1764,2273 1762,2267 +L 1162,2109 1152,2111 1153,2124 1166,2131 1162,2109 +L 1218,2095 1185,2111 1212,2113 1218,2095 +L 474,2250 460,2255 448,2270 474,2250 +L 716,2249 701,2256 699,2267 709,2269 720,2256 716,2249 +L 1065,2094 1063,2107 1071,2100 1065,2094 +L 1930,2165 1928,2193 1914,2194 1911,2205 1923,2199 1915,2215 1905,2197 1888,2198 1892,2212 1874,2216 1886,2216 1892,2231 1880,2231 1868,2249 1883,2268 1892,2265 1886,2244 1893,2237 1897,2258 1909,2255 1906,2237 1916,2233 1932,2213 1945,2211 1947,2193 1938,2191 1948,2190 1931,2180 1951,2172 1930,2165 +L 1139,2090 1128,2094 1143,2097 1139,2090 +L 1110,2252 1123,2260 1099,2259 1121,2267 1127,2257 1110,2252 +L 274,2254 266,2266 274,2265 274,2254 +L 452,2205 399,2216 412,2224 398,2236 409,2261 421,2258 433,2237 423,2239 422,2219 429,2226 449,2219 452,2205 +L 317,2172 330,2202 328,2228 295,2239 286,2260 312,2241 328,2243 337,2222 332,2191 317,2172 +L 1088,2056 1082,2064 1099,2068 1095,2079 1105,2088 1118,2080 1103,2077 1106,2066 1088,2056 +L 1077,2080 1070,2084 1080,2087 1077,2080 +L 374,2247 366,2257 378,2252 374,2247 +L 1224,2016 1227,2028 1221,2018 1207,2032 1208,2042 1222,2040 1218,2050 1218,2042 1211,2044 1217,2053 1203,2065 1216,2079 1216,2067 1227,2066 1223,2033 1238,2034 1240,2024 1224,2016 +L 1132,2054 1117,2072 1136,2074 1145,2062 1132,2054 +L 1409,2217 1392,2235 1397,2250 1413,2241 1418,2251 1432,2231 1440,2238 1441,2225 1422,2232 1409,2217 +L 1198,2044 1199,2053 1204,2047 1198,2044 +L 1139,2038 1132,2042 1138,2047 1139,2038 +L 1118,1997 1110,2034 1118,2038 1138,1999 1118,1997 +L 466,2241 457,2242 476,2249 466,2241 +L 2010,2218 1976,2233 1972,2247 2010,2218 +L 1089,2022 1075,2027 1093,2028 1089,2022 +L 1113,2208 1122,2232 1112,2246 1124,2245 1127,2217 1113,2208 +L 1029,2019 1035,2023 1037,2022 1029,2019 +L 1274,2013 1286,2021 1287,2014 1274,2013 +L 1770,2195 1758,2205 1770,2214 1760,2240 1769,2234 1790,2206 1774,2210 1770,2195 +L 1032,2001 1043,2013 1053,2009 1032,2001 +L 1140,1984 1141,1996 1155,1990 1140,1984 +L 468,2230 457,2237 476,2236 468,2230 +L 616,2230 615,2237 622,2233 616,2230 +L 67,2177 27,2207 17,2201 34,2234 49,2214 95,2216 82,2190 68,2202 67,2177 +L 1307,1969 1296,1981 1304,1991 1313,1985 1307,1969 +L 1661,2207 1657,2222 1667,2226 1661,2207 +L 1015,1910 983,1926 1002,1926 997,1922 1015,1910 +L 1131,1916 1125,1917 1132,1926 1131,1916 +L 1119,1917 1103,1920 1120,1923 1119,1917 +L 1454,2201 1435,2212 1443,2221 1457,2216 1454,2201 +L 219,2202 214,2219 234,2220 233,2204 222,2209 219,2202 +L 1030,1890 1026,1907 1040,1892 1030,1890 +L 1302,1566 1301,1560 1283,1588 1254,1589 1264,1618 1257,1627 1299,1642 1292,1675 1276,1677 1281,1664 1274,1663 1260,1685 1274,1700 1285,1684 1299,1690 1291,1705 1299,1712 1288,1715 1285,1729 1254,1724 1263,1735 1276,1731 1278,1739 1264,1741 1278,1751 1262,1756 1264,1768 1253,1768 1223,1799 1201,1808 1179,1800 1153,1814 1175,1818 1167,1829 1180,1836 1189,1825 1201,1837 1196,1844 1209,1847 1210,1860 1188,1872 1186,1890 1206,1906 1204,1894 1223,1889 1216,1858 1235,1864 1244,1899 1256,1900 1250,1888 1260,1874 1241,1869 1227,1840 1237,1837 1232,1831 1244,1838 1257,1831 1256,1818 1269,1828 1282,1825 1254,1804 1280,1768 1297,1776 1306,1769 1308,1776 1337,1746 1357,1749 1365,1769 1374,1765 1373,1756 1365,1758 1404,1725 1422,1735 1415,1754 1440,1746 1420,1770 1441,1770 1438,1800 1457,1789 1475,1793 1480,1781 1468,1774 1485,1779 1486,1767 1500,1783 1513,1762 1542,1765 1531,1740 1554,1717 1548,1689 1519,1717 1520,1734 1496,1767 1476,1762 1491,1696 1518,1676 1511,1676 1522,1652 1530,1654 1533,1633 1534,1641 1544,1639 1534,1627 1504,1659 1497,1687 1480,1686 1489,1697 1475,1710 1469,1700 1457,1702 1461,1709 1449,1703 1433,1731 1399,1703 1403,1694 1384,1692 1362,1703 1362,1692 1377,1685 1374,1681 1366,1670 1354,1684 1341,1678 1343,1663 1332,1668 1327,1650 1336,1655 1342,1644 1340,1640 1328,1644 1329,1635 1346,1629 1330,1617 1341,1607 1341,1591 1318,1615 1309,1602 1307,1614 1305,1601 1298,1616 1285,1601 1303,1571 1302,1566 +L 1104,1888 1094,1890 1098,1904 1104,1888 +L 866,2203 860,2213 868,2213 866,2203 +L 1378,2186 1367,2194 1385,2213 1378,2186 +L 1034,2199 1016,2212 1039,2212 1034,2199 +L 848,2123 829,2128 822,2142 833,2156 827,2172 836,2163 843,2169 836,2182 845,2170 857,2174 855,2195 884,2195 880,2212 885,2196 898,2194 884,2180 881,2159 863,2149 864,2158 852,2158 855,2148 842,2141 852,2132 841,2137 834,2130 848,2123 +L 1068,2200 1060,2211 1072,2209 1068,2200 +L 362,2164 359,2210 368,2196 362,2197 362,2164 +L 972,1890 954,1897 986,1903 990,1893 972,1890 +L 689,1925 688,1932 699,1926 689,1925 +L 1341,2207 1355,2198 1343,2198 1341,2207 +L 929,2178 913,2190 921,2202 925,2191 937,2198 929,2178 +L 1150,1836 1107,1845 1104,1836 1105,1847 1083,1863 1083,1887 1046,1900 1088,1887 1094,1860 1111,1845 1150,1836 +L 1261,1869 1274,1860 1263,1860 1261,1869 +L 1030,1672 1020,1678 1025,1685 1009,1686 1015,1681 1004,1676 1008,1687 995,1683 1004,1703 1001,1736 993,1733 1006,1748 996,1764 1012,1762 1027,1780 1011,1790 1019,1804 1027,1790 1032,1810 1025,1817 1030,1831 1020,1837 1042,1841 1045,1847 1032,1852 1052,1858 1040,1862 1052,1868 1059,1850 1070,1847 1070,1829 1061,1825 1072,1817 1057,1815 1054,1796 1033,1788 1051,1762 1077,1756 1068,1750 1049,1757 1035,1774 1035,1763 1014,1763 1019,1742 1006,1722 1007,1702 1017,1687 1031,1691 1035,1678 1030,1672 +L 1823,2146 1788,2190 1791,2198 1820,2179 1823,2146 +L 616,1841 608,1846 617,1851 616,1841 +L 1339,2098 1325,2116 1338,2135 1343,2126 1355,2130 1359,2157 1372,2155 1366,2173 1353,2176 1351,2193 1376,2172 1392,2175 1389,2189 1408,2186 1408,2162 1400,2167 1392,2153 1372,2148 1403,2135 1381,2129 1370,2140 1371,2123 1333,2114 1345,2101 1339,2098 +L 161,2181 152,2184 155,2193 161,2181 +L 627,1818 617,1840 625,1842 626,1833 641,1843 649,1837 627,1827 627,1818 +L 507,1778 495,1792 502,1796 510,1786 516,1794 519,1784 507,1778 +L 484,1785 477,1789 483,1794 484,1785 +L 454,1772 447,1778 453,1783 442,1780 460,1791 454,1772 +L 481,1751 471,1772 485,1771 493,1775 504,1762 490,1765 481,1751 +L 502,1742 496,1747 488,1756 496,1759 502,1742 +L 210,2139 207,2168 216,2179 210,2139 +L 1424,1700 1413,1707 1424,1709 1424,1700 +L 392,2136 378,2147 389,2152 384,2172 403,2176 411,2158 403,2163 405,2142 392,2136 +L 1456,1671 1469,1699 1471,1675 1456,1671 +L 323,2149 310,2159 316,2170 323,2149 +L 1763,2155 1742,2158 1756,2168 1763,2155 +L 924,2152 912,2168 932,2156 924,2152 +L 630,2160 621,2166 629,2168 630,2160 +L 2142,2098 2122,2110 2114,2107 2107,2154 2116,2154 2117,2145 2122,2155 2142,2149 2152,2164 2153,2155 2184,2152 2175,2140 2182,2132 2142,2098 +L 107,2151 108,2160 128,2164 107,2151 +L -55,2140 -60,2153 -49,2163 -47,2144 -55,2140 +L 1490,1668 1487,1676 1495,1678 1490,1668 +L 1936,2121 1920,2125 1921,2141 1935,2148 1931,2161 1948,2159 1972,2137 1936,2121 +L 1410,1664 1395,1670 1409,1672 1410,1664 +L 1362,1636 1369,1649 1371,1641 1391,1639 1383,1632 1371,1634 1366,1627 1353,1634 1356,1647 1362,1636 +L 1403,667 1396,682 1382,671 1368,677 1343,670 1354,681 1340,703 1353,687 1368,685 1336,718 1316,725 1305,741 1270,736 1248,747 1249,773 1260,788 1277,771 1288,782 1278,778 1280,785 1297,786 1293,804 1268,806 1280,808 1291,825 1276,833 1279,859 1268,849 1272,856 1245,850 1244,864 1228,861 1227,879 1220,874 1222,895 1201,897 1200,908 1224,913 1237,930 1248,917 1237,907 1259,908 1279,934 1266,939 1265,952 1275,947 1293,956 1300,924 1308,927 1305,939 1318,934 1317,946 1308,947 1315,955 1316,953 1316,956 1335,970 1333,979 1325,969 1331,1002 1320,1017 1335,1013 1346,1035 1348,1009 1358,1008 1343,989 1356,988 1361,917 1418,857 1434,863 1439,839 1432,843 1455,814 1466,819 1464,802 1480,783 1498,773 1533,810 1543,790 1557,787 1548,779 1563,774 1547,774 1542,745 1532,751 1500,734 1497,715 1488,713 1494,695 1481,715 1473,705 1453,725 1422,718 1417,706 1405,714 1402,704 1415,698 1406,682 1418,683 1412,670 1405,676 1403,667 +L 2761,2314 2757,2324 2771,2325 2761,2314 +L 634,2129 624,2148 635,2138 634,2129 +L 2757,2220 2750,2227 2760,2229 2757,2220 +L 2847,2203 2849,2219 2856,2209 2847,2203 +L 173,1974 137,1993 139,2004 119,2025 109,2060 125,2077 123,2081 148,2086 159,2073 178,2078 178,2105 128,2117 145,2141 164,2117 179,2116 190,2081 205,2086 215,2054 190,2068 177,2054 181,2033 168,2045 152,2030 152,2029 155,2013 197,1999 173,1974 +L 2288,2104 2255,2118 2260,2136 2276,2141 2283,2134 2288,2104 +L 2751,2209 2752,2217 2758,2210 2751,2209 +L 797,2133 809,2133 812,2124 800,2124 797,2133 +L 938,2101 934,2121 939,2126 946,2118 949,2131 964,2131 938,2101 +L 871,2120 866,2126 876,2128 871,2120 +L 636,2119 626,2123 634,2128 636,2119 +L 2637,2205 2640,2214 2645,2210 2637,2205 +L 1766,2107 1746,2109 1775,2126 1791,2108 1766,2107 +L 2018,2107 2007,2116 2012,2125 2018,2107 +L 2083,2112 2075,2118 2087,2125 2083,2112 +L 761,2080 752,2091 759,2107 748,2109 775,2124 764,2104 777,2098 775,2081 761,2080 +L 114,2102 97,2105 97,2112 123,2120 114,2102 +L 2449,1651 2439,1652 2413,1686 2405,1699 2413,1705 2402,1704 2406,1717 2398,1713 2401,1727 2384,1735 2389,1752 2360,1769 2383,1763 2391,1780 2406,1769 2425,1775 2423,1755 2439,1758 2458,1730 2440,1727 2435,1716 2443,1708 2425,1706 2449,1651 +L -8,2073 -35,2076 -28,2095 -43,2103 -28,2114 -27,2097 -19,2103 -2,2082 -8,2073 +L 1401,2095 1389,2108 1406,2114 1401,2095 +L 2849,2195 2862,2209 2864,2202 2849,2195 +L 1733,2101 1724,2110 1731,2112 1733,2101 +L 2628,1718 2628,1729 2638,1735 2650,1719 2628,1718 +L 581,2082 574,2090 563,2085 584,2101 582,2108 592,2108 592,2086 584,2093 581,2082 +L 2649,2131 2667,2150 2675,2132 2649,2131 +L 2335,2054 2303,2062 2305,2103 2326,2068 2343,2068 2335,2054 +L 2704,1612 2704,1627 2692,1624 2698,1636 2681,1636 2686,1659 2660,1659 2665,1683 2642,1675 2632,1683 2650,1719 2660,1697 2676,1692 2678,1669 2696,1662 2718,1634 2721,1625 2704,1612 +L 821,2059 820,2076 850,2085 851,2100 855,2090 862,2095 858,2064 821,2059 +L 2875,2064 2865,2065 2872,2084 2877,2077 2875,2064 +L 108,2078 90,2080 91,2096 92,2090 106,2098 115,2086 108,2078 +L 2880,2060 2879,2075 2886,2065 2880,2060 +L 2848,2057 2842,2068 2862,2073 2848,2057 +L 2144,2079 2143,2093 2158,2081 2144,2079 +L 787,2082 796,2093 799,2087 787,2082 +L 3032,2062 3028,2069 3036,2065 3032,2062 +L 3023,2055 3020,2062 3032,2062 3023,2055 +L 2562,2018 2553,2054 2564,2041 2572,2034 2562,2018 +L 3077,2035 3066,2044 3079,2045 3077,2035 +L 2970,2027 2961,2036 2969,2038 2970,2027 +L 598,2058 596,2068 616,2082 598,2058 +L 2605,2014 2597,2015 2612,2017 2605,2014 +L 592,2057 570,2062 572,2079 581,2080 592,2057 +L 2187,2063 2196,2067 2211,2042 2183,2036 2193,2061 2187,2063 +L 2833,1950 2834,1958 2840,1953 2833,1950 +L 2652,1911 2648,1917 2656,1920 2652,1911 +L 906,2046 899,2056 916,2066 906,2046 +L 2884,1882 2874,1885 2870,1890 2884,1882 +L 845,2039 826,2049 853,2057 845,2039 +L 1390,2043 1370,2049 1377,2054 1390,2043 +L 596,2045 584,2048 596,2052 596,2045 +L 2403,2006 2393,2017 2395,2030 2386,2027 2401,2051 2420,2009 2403,2006 +L 2919,1764 2916,1785 2929,1782 2934,1792 2942,1778 2947,1784 2955,1777 2919,1764 +L 2918,1724 2912,1730 2913,1748 2919,1739 2934,1747 2928,1732 2919,1736 2918,1724 +L 2343,2032 2347,2042 2357,2033 2343,2032 +L 785,2030 776,2031 780,2041 785,2030 +L 806,2014 790,2023 800,2040 811,2023 806,2014 +L 2899,1648 2882,1663 2879,1691 2899,1648 +L 2349,1655 2338,1671 2352,1667 2349,1655 +L 1992,2016 1993,2034 2003,2029 1998,2017 1992,2016 +L 603,2018 591,2021 594,2028 603,2018 +L -16,2001 -31,2008 -40,2027 -16,2001 +L 832,2013 829,2026 843,2021 832,2013 +L 201,2014 191,2022 197,2025 201,2014 +L 1459,2013 1451,2022 1461,2022 1459,2013 +L 3005,1648 3001,1661 3015,1668 3005,1648 +L 1377,2017 1382,2008 1375,2008 1377,2017 +L 2462,1606 2456,1641 2487,1640 2472,1635 2472,1611 2462,1606 +L 1998,2015 2022,2005 2000,2005 1998,2015 +L 2529,1609 2503,1630 2525,1627 2529,1609 +L 211,2003 203,2013 221,2007 211,2003 +L 1873,2002 1866,2013 1871,2009 1873,2002 +L 831,1988 815,2009 832,2012 831,1988 +L 710,1995 706,2007 713,2010 710,1995 +L 2601,1417 2576,1437 2577,1456 2546,1484 2545,1502 2486,1572 2491,1585 2476,1601 2499,1588 2519,1543 2532,1535 2544,1544 2533,1531 2556,1517 2595,1443 2609,1438 2599,1431 2601,1417 +L 2031,1984 2027,1998 2042,1991 2031,1984 +L 1942,1936 1892,1972 1874,1964 1877,1987 1926,1996 1926,1971 1942,1936 +L 40,1984 32,1992 38,1996 40,1984 +L 2719,1574 2712,1582 2723,1592 2722,1583 2734,1582 2719,1574 +L 2782,1471 2798,1502 2781,1492 2771,1499 2807,1528 2787,1544 2767,1531 2754,1542 2765,1552 2763,1565 2746,1566 2745,1580 2754,1583 2739,1589 2761,1587 2805,1543 2825,1538 2828,1553 2851,1564 2846,1576 2863,1575 2872,1564 2863,1541 2873,1518 2894,1503 2892,1493 2889,1502 2872,1505 2874,1515 2851,1513 2823,1475 2820,1505 2801,1506 2808,1496 2782,1471 +L 403,1977 405,1995 411,1990 403,1977 +L 2353,1985 2346,1990 2358,1994 2353,1985 +L 237,1941 190,1961 202,1969 208,1958 214,1966 208,1979 226,1970 233,1993 235,1970 247,1960 230,1965 237,1941 +L 35,1943 5,1980 12,1988 35,1943 +L 841,1971 835,1985 851,1988 849,1974 847,1980 841,1971 +L 28,1977 26,1988 33,1985 28,1977 +L 1665,1568 1656,1582 1665,1582 1665,1568 +L 1438,1965 1415,1971 1416,1979 1422,1986 1436,1979 1430,1974 1438,1965 +L 2883,1538 2884,1552 2894,1544 2883,1538 +L 1696,1579 1699,1572 1690,1572 1696,1579 +L 1646,1539 1640,1547 1642,1560 1653,1558 1649,1566 1662,1554 1646,1539 +L 1641,1489 1632,1505 1639,1528 1647,1525 1651,1499 1647,1532 1655,1530 1655,1540 1661,1529 1669,1532 1661,1538 1668,1544 1683,1522 1676,1521 1679,1498 1675,1491 1676,1501 1651,1491 1644,1496 1641,1489 +L 849,1960 849,1974 858,1973 849,1960 +L 1630,1471 1623,1476 1632,1485 1630,1471 +L 1379,1096 1374,1113 1365,1115 1378,1116 1379,1096 +L 1446,1971 1457,1962 1449,1962 1446,1971 +L 2466,1954 2460,1966 2480,1970 2487,1958 2463,1962 2466,1954 +L 76,1115 88,1137 92,1129 76,1115 +L 1470,1957 1460,1962 1470,1965 1470,1957 +L 144,1924 125,1942 131,1948 116,1955 132,1964 165,1957 144,1924 +L 1858,1841 1860,1851 1847,1847 1848,1874 1829,1891 1835,1895 1807,1902 1810,1921 1792,1925 1798,1939 1783,1936 1762,1948 1724,1945 1758,1961 1834,1949 1832,1932 1848,1920 1866,1948 1853,1909 1867,1899 1885,1916 1868,1892 1874,1883 1863,1882 1879,1864 1862,1868 1868,1842 1858,1841 +L 118,1100 117,1109 103,1106 105,1123 109,1115 125,1116 118,1100 +L 1051,1045 1044,1052 1045,1071 1070,1069 1061,1062 1067,1052 1051,1045 +L 835,1941 825,1948 833,1958 848,1947 835,1941 +L 2156,985 2152,999 2158,998 2156,985 +L 924,944 917,945 920,961 924,944 +L 870,1935 860,1940 867,1954 886,1944 870,1935 +L 894,940 890,946 900,947 894,940 +L 13,719 -23,737 1,739 14,761 25,762 29,742 13,719 +L 117,663 98,681 86,678 78,695 61,694 58,734 78,733 63,707 92,691 106,693 100,684 117,663 +L 41,1907 37,1940 59,1922 41,1907 +L 936,1929 910,1934 924,1938 936,1929 +L 836,1919 834,1926 820,1924 835,1935 836,1919 +L 2574,1904 2570,1921 2576,1915 2576,1925 2588,1929 2574,1904 +L 243,1913 236,1917 243,1929 243,1913 +L 942,1921 939,1928 946,1928 942,1921 +L 886,1921 877,1927 890,1926 886,1921 +L 835,1857 823,1869 832,1871 832,1887 822,1896 854,1888 846,1905 838,1899 851,1922 858,1899 863,1905 887,1894 857,1890 869,1862 835,1857 +L -14,713 -10,708 -22,708 -14,713 +L -8,700 -10,708 2,709 -8,700 +L 192,1830 184,1851 198,1856 195,1891 217,1918 225,1871 211,1857 220,1850 197,1846 200,1834 192,1830 +L 1485,1911 1483,1917 1491,1915 1485,1911 +L -26,688 -30,696 -15,689 -26,688 +L 3195,483 3199,493 3212,488 3195,483 +L 1529,1844 1517,1850 1505,1888 1487,1889 1480,1903 1522,1903 1535,1864 1529,1844 +L 913,1895 905,1896 902,1903 913,1895 +L 3248,565 3244,574 3257,576 3248,565 +L 3267,444 3264,451 3278,455 3267,444 +L 893,1888 887,1894 898,1896 893,1888 +L 337,1864 324,1870 337,1872 337,1886 346,1865 337,1864 +L 741,215 748,223 743,236 755,216 741,215 +L 291,1863 303,1884 317,1881 324,1866 310,1875 291,1863 +L 243,1861 237,1872 248,1871 243,1861 +L 2784,135 2795,158 2803,141 2784,135 +L 1903,1829 1879,1864 1888,1862 1903,1829 +L 1012,1851 1006,1859 1014,1860 1012,1851 +L 3456,214 3460,205 3453,205 3456,214 +L 872,1838 860,1839 889,1853 872,1838 +L 422,1831 336,1838 320,1831 320,1839 304,1840 373,1844 384,1852 408,1848 422,1831 +L 991,1829 1014,1847 1014,1834 991,1829 +L 289,1829 282,1847 299,1840 288,1839 289,1829 +L 1490,1839 1488,1846 1507,1847 1490,1839 +L 3463,168 3457,175 3464,178 3463,168 +L 768,1839 783,1846 824,1840 768,1839 +L 1498,1808 1489,1809 1485,1839 1490,1839 1499,1839 1502,1821 1515,1819 1498,1808 +L 889,1803 882,1812 893,1811 898,1828 917,1830 913,1839 938,1827 926,1817 900,1816 889,1803 +L 3448,154 3440,157 3446,162 3448,154 +L 736,1721 725,1724 726,1750 711,1759 714,1784 678,1786 671,1794 683,1808 676,1819 632,1811 673,1838 685,1826 686,1809 745,1797 744,1791 748,1803 734,1817 736,1827 759,1801 748,1788 716,1790 719,1759 737,1748 729,1734 736,1721 +L 1869,1820 1859,1828 1866,1837 1869,1820 +L 3479,124 3470,130 3478,132 3479,124 +L 169,1820 158,1830 168,1827 169,1835 178,1829 169,1820 +L 1321,1800 1305,1824 1315,1832 1311,1821 1327,1812 1321,1800 +L 3491,108 3479,124 3481,130 3491,108 +L 1951,-13 1943,-10 1947,-3 1951,-13 +L 1912,1806 1903,1829 1913,1822 1912,1806 +L 4097,37 4091,44 4075,40 4065,56 4097,56 4097,37 +L 2878,-44 2862,-9 2876,-14 2878,-44 +L 4108,32 4102,45 4124,40 4108,32 +L 855,1810 849,1823 864,1814 855,1810 +L 1473,1809 1469,1823 1479,1822 1473,1809 +L 155,1814 169,1820 159,1809 176,1804 160,1804 155,1814 +L 1778,1775 1741,1786 1767,1819 1772,1811 1762,1791 1777,1782 1778,1775 +L 4080,30 4058,37 4075,40 4080,30 +L 4126,10 4123,26 4117,18 4108,24 4123,33 4126,10 +L 257,1679 262,1693 255,1694 254,1715 271,1736 258,1752 283,1745 280,1760 305,1802 305,1817 318,1802 344,1805 336,1782 323,1796 317,1781 312,1791 301,1783 303,1769 288,1745 306,1722 284,1741 277,1727 286,1722 269,1709 296,1694 284,1694 282,1685 267,1693 257,1679 +L 987,1802 985,1817 994,1815 987,1802 +L 1120,1804 1114,1813 1130,1815 1120,1804 +L 4151,-22 4131,-1 4133,8 4151,-4 4151,-22 +L 2208,1801 2200,1813 2212,1806 2208,1801 +L 365,-60 355,-50 333,-58 341,-44 366,-53 365,-60 +L 608,1797 625,1806 620,1810 635,1805 608,1797 +L 2950,371 2948,412 2905,469 2897,468 2898,488 2915,502 2906,532 2895,536 2871,585 2880,591 2857,618 2864,621 2856,627 2859,640 2843,639 2845,650 2836,653 2846,674 2836,673 2829,687 2813,681 2809,688 2820,696 2813,703 2789,693 2784,725 2801,731 2791,730 2795,741 2778,756 2772,785 2743,834 2746,852 2731,860 2736,871 2727,869 2727,883 2705,903 2675,966 2677,980 2659,1009 2659,1028 2668,1034 2692,1012 2692,1004 2673,1006 2678,980 2686,980 2682,992 2695,1005 2699,979 2714,968 2717,938 2725,939 2734,916 2719,909 2733,914 2730,905 2740,909 2744,899 2724,899 2739,875 2754,861 2772,860 2774,850 2762,850 2766,834 2799,830 2842,740 2866,716 2861,709 2888,689 2883,673 2893,681 2913,648 2908,641 2916,645 2912,631 2919,636 2927,627 2927,607 2945,606 2947,596 2930,583 2951,585 2947,570 2957,563 2950,559 2966,551 2960,542 2991,531 2987,517 3001,493 2995,471 3009,451 2996,440 2997,428 2969,415 2971,391 2950,371 +L 853,1768 847,1778 858,1802 878,1805 856,1793 853,1768 +L 1913,1792 1914,1805 1927,1803 1920,1794 1913,1792 +L 1188,590 1175,599 1160,593 1158,604 1172,605 1169,631 1140,648 1126,702 1130,748 1111,782 1102,780 1089,800 1099,798 1091,826 1072,843 1060,829 1042,851 1056,863 1055,892 1041,902 1056,902 1062,917 1061,933 1048,942 1053,953 1038,950 1048,996 1040,993 1035,1004 1021,989 1009,994 1027,1011 1017,1011 1016,1020 1025,1022 1020,1038 1028,1047 1012,1056 997,1083 990,1079 997,1075 996,1042 987,1040 993,1025 981,1031 987,1078 979,1066 972,1075 984,1081 986,1093 978,1091 986,1099 977,1105 973,1097 968,1106 964,1112 960,1085 946,1099 946,1117 921,1108 930,1107 929,1097 918,1082 939,1068 946,1050 939,1039 929,1043 934,1053 923,1068 903,1063 907,1092 879,1097 896,1107 904,1099 899,1108 920,1131 918,1119 940,1119 960,1132 969,1122 980,1137 988,1116 999,1132 992,1136 999,1134 1013,1161 991,1186 1002,1179 1006,1185 1001,1231 988,1228 996,1214 986,1211 979,1216 987,1224 977,1222 986,1229 973,1236 967,1223 959,1235 946,1222 935,1232 940,1237 928,1235 934,1245 956,1259 955,1246 963,1246 960,1257 973,1254 974,1264 985,1259 989,1269 999,1250 1015,1249 1012,1240 1021,1254 1018,1275 1056,1250 1058,1257 1070,1244 1058,1224 1048,1233 1017,1225 1024,1212 1014,1213 1010,1202 1019,1182 1026,1192 1052,1184 1037,1212 1058,1204 1071,1215 1063,1219 1077,1217 1075,1228 1101,1225 1098,1202 1090,1207 1097,1186 1082,1168 1083,1151 1061,1142 1040,1161 1041,1144 1034,1148 1042,1116 1054,1111 1033,1086 1060,1085 1060,1101 1087,1069 1076,1061 1092,1051 1087,1019 1078,1021 1088,1050 1071,1060 1080,1069 1064,1080 1031,1082 1029,1051 1039,1037 1077,1041 1077,1034 1052,1033 1067,1005 1069,961 1080,980 1103,992 1135,963 1103,965 1120,950 1109,940 1131,929 1150,936 1129,919 1148,918 1143,910 1151,904 1164,904 1174,916 1170,899 1155,895 1137,907 1124,896 1117,899 1125,910 1116,911 1124,919 1117,925 1101,922 1103,929 1089,929 1091,938 1071,918 1083,902 1101,898 1088,893 1104,890 1104,868 1075,904 1066,902 1063,882 1071,856 1081,851 1104,858 1142,851 1152,867 1166,868 1147,846 1084,847 1104,831 1103,820 1122,818 1136,802 1148,807 1150,798 1132,800 1113,789 1136,754 1134,706 1151,678 1149,652 1176,635 1175,614 1188,608 1188,590 +L 3146,-34 3177,-19 3113,105 3090,83 3055,112 3050,133 3041,132 3042,149 3058,128 3076,119 3073,111 3085,108 3098,139 3029,234 3015,278 2973,337 2961,341 2966,347 2950,371 2966,364 2987,321 3001,331 2989,359 3011,366 3025,345 3012,327 3037,328 3050,312 3057,316 3051,305 3068,305 3055,280 3074,300 3083,269 3069,242 3087,237 3088,225 3108,231 3110,220 3127,222 3133,201 3148,191 3145,183 3159,168 3133,153 3143,134 3155,131 3149,121 3167,116 3182,134 3201,94 3193,88 3203,89 3203,72 3211,73 3202,57 3215,59 3219,49 3208,32 3224,19 3212,13 3214,-6 3200,-1 3178,29 3177,52 3169,53 3163,73 3150,76 3151,97 3137,100 3116,147 3104,153 3077,220 3057,218 3168,26 3188,-28 3146,-34 +L 150,1791 148,1800 160,1797 150,1791 +L 2093,1027 2107,1035 2108,1042 2098,1041 2114,1062 2101,1070 2118,1075 2128,1090 2118,1102 2128,1103 2126,1132 2108,1155 2097,1139 2081,1147 2076,1135 2068,1144 2078,1158 2079,1185 2064,1196 2070,1210 2062,1222 2055,1217 2061,1211 2046,1203 2039,1222 2026,1204 2021,1222 2009,1217 2005,1228 1993,1208 1995,1223 1986,1219 1981,1231 1951,1230 1958,1249 1944,1256 1941,1245 1919,1251 1924,1261 1911,1268 1902,1296 1914,1301 1913,1312 1933,1320 1935,1311 1950,1312 1957,1325 1971,1325 1988,1301 1992,1309 1999,1299 1993,1286 2000,1291 2001,1277 2017,1289 2021,1311 2033,1274 2023,1274 2061,1269 2049,1261 2053,1253 2076,1230 2091,1228 2100,1210 2086,1185 2091,1192 2090,1182 2090,1176 2129,1172 2129,1133 2131,1151 2138,1133 2154,1128 2152,1138 2166,1136 2155,1134 2168,1128 2156,1110 2151,1121 2141,1118 2152,1092 2181,1108 2199,1104 2150,1088 2140,1058 2144,1025 2162,1018 2164,1024 2177,1007 2188,1040 2198,1041 2207,1022 2201,1010 2215,1010 2218,1027 2223,1012 2233,1019 2238,1008 2242,1029 2255,1029 2242,1016 2251,1006 2226,995 2225,967 2214,979 2198,972 2199,981 2174,1006 2160,992 2166,1012 2134,996 2127,1007 2138,1026 2124,1014 2132,1027 2108,1024 2096,1005 2093,1027 +L 930,1760 927,1767 925,1799 932,1788 932,1796 947,1789 936,1789 937,1772 930,1760 +L 133,1774 124,1785 110,1775 120,1799 133,1774 +L 1334,70 1344,87 1335,100 1345,106 1333,117 1319,106 1314,111 1324,121 1313,123 1312,136 1327,185 1318,181 1317,194 1306,184 1303,207 1290,204 1300,202 1296,197 1277,203 1267,196 1265,209 1253,212 1226,204 1238,221 1287,217 1291,236 1298,236 1279,248 1263,250 1261,243 1228,276 1218,271 1223,280 1195,308 1190,289 1181,287 1165,311 1169,313 1176,301 1211,328 1211,361 1217,328 1230,326 1239,304 1251,312 1249,333 1237,339 1248,347 1238,359 1256,369 1235,441 1235,483 1248,471 1236,472 1241,458 1253,464 1243,453 1253,409 1269,398 1282,413 1289,410 1280,374 1275,381 1257,377 1265,364 1258,353 1261,305 1277,304 1282,321 1297,327 1292,306 1309,297 1323,308 1325,304 1315,292 1292,301 1284,293 1282,310 1278,292 1252,296 1257,277 1276,264 1297,278 1326,269 1335,258 1332,237 1347,239 1355,259 1363,248 1388,257 1386,227 1371,211 1346,209 1400,175 1389,170 1393,163 1360,158 1365,147 1356,142 1355,123 1373,126 1365,122 1371,108 1406,110 1378,96 1381,75 1334,70 +L 2977,660 2964,663 2969,670 2952,682 2936,663 2925,672 2928,690 2920,687 2904,708 2898,703 2898,716 2874,739 2862,733 2870,718 2854,731 2861,754 2855,779 2873,786 2832,839 2816,841 2808,889 2827,861 2831,867 2839,860 2840,868 2840,845 2853,842 2851,825 2890,789 2894,772 2918,769 2932,787 2950,785 2945,778 2956,763 2968,762 2977,748 2968,744 2976,735 2969,729 2988,716 2978,694 2993,666 2982,674 2977,660 +L 167,1581 153,1565 163,1541 156,1537 159,1514 144,1516 144,1493 153,1492 147,1490 154,1481 144,1461 145,1412 134,1421 128,1408 118,1415 123,1403 103,1418 111,1418 109,1427 95,1422 118,1459 98,1441 90,1444 91,1433 58,1437 78,1476 122,1496 118,1509 109,1496 94,1494 96,1504 110,1508 109,1523 143,1520 142,1531 128,1534 130,1547 116,1536 106,1541 142,1559 122,1586 131,1587 122,1601 138,1604 160,1597 165,1586 172,1593 206,1590 202,1574 176,1570 202,1524 202,1508 190,1507 198,1495 169,1486 168,1498 183,1496 187,1506 166,1511 170,1548 161,1562 172,1577 167,1581 +L 1216,1764 1212,1773 1165,1776 1169,1789 1214,1776 1211,1784 1229,1790 1233,1769 1216,1764 +L 2839,146 2814,168 2814,157 2795,158 2794,165 2781,161 2786,147 2772,146 2774,158 2761,161 2753,189 2765,198 2763,214 2755,215 2762,230 2752,226 2750,197 2733,188 2728,215 2736,218 2723,223 2715,248 2718,273 2725,269 2720,297 2729,305 2716,313 2746,314 2758,271 2786,296 2784,282 2761,268 2780,251 2796,203 2831,187 2829,175 2845,163 2839,146 +L 2227,672 2220,697 2210,690 2188,696 2222,701 2201,731 2192,723 2182,743 2172,742 2175,750 2184,745 2182,753 2163,756 2187,765 2188,759 2196,773 2194,756 2224,761 2234,783 2220,802 2224,817 2232,822 2258,837 2274,817 2259,818 2259,830 2232,802 2240,807 2245,780 2238,756 2247,749 2265,757 2274,766 2263,779 2270,795 2288,795 2299,781 2307,728 2331,712 2286,696 2274,720 2242,709 2234,717 2221,708 2230,689 2244,683 2227,672 +L 2255,1729 2260,1740 2235,1762 2242,1773 2231,1783 2261,1768 2260,1761 2265,1734 2255,1729 +L 311,574 321,593 296,589 291,604 306,616 285,620 237,643 230,666 280,646 278,655 296,656 305,651 300,634 329,627 417,674 429,660 427,631 436,634 414,620 400,631 391,608 369,616 367,604 391,586 368,590 368,580 341,585 311,574 +L 1782,1764 1777,1782 1786,1776 1782,1764 +L 26,274 48,274 42,291 54,277 88,310 75,326 52,327 49,318 50,328 37,324 25,337 75,336 90,311 113,325 126,299 104,305 77,276 84,259 93,262 99,253 87,229 69,217 88,209 116,231 122,183 123,164 138,156 119,158 128,129 95,122 87,133 106,147 101,164 65,176 58,190 63,211 48,214 69,241 67,271 42,254 38,234 45,226 20,240 33,267 26,274 +L 1731,568 1712,595 1700,587 1701,598 1715,598 1725,627 1705,640 1678,631 1692,579 1665,597 1666,630 1658,617 1637,617 1656,619 1656,639 1668,653 1649,643 1649,672 1619,693 1605,676 1585,686 1577,699 1587,718 1546,743 1576,734 1582,742 1624,741 1629,718 1641,716 1644,701 1659,691 1649,685 1682,675 1692,658 1708,668 1694,655 1722,634 1728,640 1731,568 +L 2565,638 2545,677 2518,697 2521,710 2503,714 2489,751 2481,744 2462,775 2447,778 2483,781 2494,760 2515,761 2524,777 2540,773 2547,807 2558,806 2550,800 2551,761 2565,753 2574,757 2566,759 2570,767 2605,757 2565,744 2561,727 2571,695 2578,689 2556,678 2584,651 2566,655 2572,646 2565,638 +L 405,1614 405,1626 385,1630 379,1661 352,1663 354,1643 316,1628 310,1634 303,1618 297,1624 307,1635 297,1641 297,1663 305,1659 313,1669 328,1653 340,1657 341,1669 330,1670 335,1681 355,1672 354,1696 391,1702 397,1712 425,1685 433,1744 436,1700 459,1704 455,1694 429,1684 441,1668 439,1650 436,1656 423,1633 427,1626 405,1614 +L 1112,1755 1126,1770 1138,1763 1112,1755 +L 996,247 984,256 992,288 1012,305 989,320 957,316 956,324 969,323 972,341 1011,323 1021,328 1022,345 1006,359 998,355 1002,369 995,371 1049,390 1049,426 1032,436 1041,440 1034,451 1046,448 1041,436 1050,428 1064,433 1066,398 1082,396 1088,407 1095,400 1083,387 1060,387 1038,352 1024,351 1043,348 1051,313 1039,289 1019,275 1019,254 996,247 +L 1755,1761 1751,1767 1771,1769 1755,1761 +L 687,1736 666,1747 657,1739 645,1759 659,1767 686,1748 687,1736 +L 641,457 647,443 641,441 632,446 627,471 592,475 574,453 576,442 560,433 567,428 560,429 559,406 574,373 559,393 554,370 533,390 524,387 517,395 527,415 493,447 500,413 484,424 482,445 451,452 450,465 438,462 412,482 427,472 433,479 435,468 455,468 478,451 490,457 510,448 521,467 542,444 566,449 593,481 625,479 629,498 609,500 598,517 623,519 631,500 643,504 699,481 676,472 669,483 649,487 631,478 638,463 654,461 641,457 +L 843,1382 830,1389 833,1395 787,1395 773,1418 751,1418 783,1444 789,1460 778,1464 797,1473 836,1438 858,1441 881,1472 876,1484 884,1485 889,1503 896,1493 890,1471 913,1474 913,1467 878,1453 877,1442 860,1438 856,1429 865,1432 862,1422 856,1428 853,1422 836,1429 850,1415 877,1408 865,1400 855,1405 860,1396 853,1402 843,1382 +L 1234,1694 1231,1738 1200,1740 1206,1749 1215,1744 1219,1758 1242,1740 1255,1750 1257,1736 1247,1729 1255,1711 1234,1694 +L 1098,1743 1097,1752 1112,1755 1111,1746 1098,1743 +L 537,1211 536,1221 507,1233 510,1268 516,1256 560,1255 564,1285 595,1274 608,1320 623,1326 632,1309 644,1313 671,1340 674,1362 691,1370 696,1389 694,1369 676,1359 674,1340 648,1312 662,1304 665,1289 671,1323 693,1350 697,1313 722,1299 698,1268 699,1282 687,1280 673,1271 680,1258 670,1265 659,1252 664,1279 656,1300 622,1300 605,1279 606,1267 580,1263 588,1267 575,1273 578,1263 571,1264 568,1273 565,1253 537,1229 538,1218 537,1211 +L 2986,186 2977,205 2984,218 2968,222 2952,246 2941,242 2940,258 2949,249 2955,262 2933,281 2915,274 2912,255 2901,310 2915,323 2929,312 2928,333 2935,337 2956,317 2973,285 2967,259 2988,260 2985,248 2998,237 3016,191 2986,186 +L 1272,1141 1238,1246 1242,1256 1230,1260 1222,1243 1227,1230 1219,1240 1211,1235 1210,1213 1199,1232 1212,1278 1205,1299 1220,1285 1222,1264 1241,1296 1225,1313 1233,1327 1213,1334 1233,1352 1237,1373 1256,1305 1244,1258 1265,1255 1274,1264 1269,1225 1273,1218 1273,1223 1280,1218 1274,1216 1283,1201 1274,1169 1282,1145 1272,1141 +L 2318,831 2303,844 2319,855 2309,859 2314,866 2299,869 2304,882 2317,882 2302,906 2285,911 2265,882 2255,883 2259,891 2249,895 2259,906 2246,911 2263,925 2257,933 2264,942 2252,947 2244,938 2259,975 2269,975 2264,950 2294,948 2295,942 2271,945 2274,934 2307,926 2322,917 2325,901 2346,894 2328,860 2342,864 2363,852 2359,845 2350,854 2350,840 2324,846 2318,831 +L 1153,988 1135,1001 1158,1017 1142,1018 1144,1043 1136,1050 1125,1045 1121,1009 1104,1009 1095,1019 1108,1024 1101,1057 1110,1055 1115,1083 1129,1064 1141,1070 1140,1079 1154,1078 1157,1089 1173,1085 1186,1068 1161,1064 1158,1074 1156,1055 1142,1050 1150,1046 1148,1032 1199,1041 1187,1024 1194,1018 1204,1028 1203,1012 1194,1010 1204,1008 1153,988 +L 1071,1731 1071,1748 1081,1735 1071,1731 +L 603,1735 591,1738 602,1746 603,1735 +L 388,1705 383,1715 362,1715 371,1725 359,1733 347,1722 332,1725 352,1735 353,1744 365,1737 367,1745 390,1746 402,1726 386,1725 388,1705 +L 1125,1738 1126,1745 1132,1740 1125,1738 +L 3110,430 3099,467 3083,477 3084,492 3040,552 3045,563 3037,560 3040,566 3032,564 3020,586 3009,588 3005,611 2989,627 2998,627 3013,605 3014,618 3028,618 3015,604 3025,595 3013,603 3021,588 3040,574 3039,585 3051,581 3043,570 3068,550 3071,535 3083,539 3095,505 3152,433 3129,439 3110,430 +L 1077,191 1034,219 1079,221 1078,248 1086,244 1102,280 1107,258 1132,240 1163,262 1180,260 1164,253 1179,238 1188,208 1200,212 1188,201 1124,224 1110,240 1100,224 1081,221 1077,191 +L 1196,1616 1189,1648 1182,1648 1198,1669 1188,1680 1169,1673 1174,1687 1166,1692 1179,1695 1173,1737 1188,1743 1196,1711 1216,1702 1222,1713 1222,1690 1204,1685 1201,1669 1229,1668 1239,1658 1249,1669 1236,1639 1220,1640 1196,1616 +L 923,30 897,57 880,47 883,61 913,78 893,102 886,77 868,83 871,97 856,135 846,143 827,133 826,159 843,154 853,161 853,148 879,146 878,129 892,114 902,133 919,100 951,82 942,71 920,76 903,63 925,40 923,30 +L 2506,461 2480,548 2474,543 2479,555 2471,573 2462,574 2468,583 2451,633 2471,612 2463,611 2464,601 2476,606 2472,584 2484,543 2500,538 2498,528 2489,531 2502,519 2502,503 2519,504 2517,521 2568,524 2574,539 2599,534 2605,547 2619,548 2606,531 2659,501 2673,481 2678,473 2671,471 2660,494 2595,522 2523,506 2534,482 2511,488 2506,461 +L 346,1550 368,1562 368,1573 354,1578 348,1583 364,1583 365,1599 387,1568 437,1601 447,1621 441,1645 468,1635 474,1642 473,1634 489,1630 490,1641 495,1628 510,1635 507,1624 468,1611 442,1560 404,1575 374,1552 346,1550 +L 990,1717 956,1726 924,1722 933,1733 947,1726 951,1734 991,1732 990,1717 +L 421,133 403,137 392,157 398,163 382,167 378,182 390,243 418,218 405,202 435,185 432,167 445,145 429,144 421,133 +L 872,940 861,971 843,961 843,971 828,973 848,1009 843,1021 812,1034 806,1026 788,1044 843,1026 860,1004 877,1013 884,1003 896,1004 910,990 901,986 912,968 942,971 954,1023 970,1015 955,1006 947,972 958,971 973,994 985,989 961,969 968,959 991,960 983,955 992,945 978,954 962,950 944,964 912,961 914,952 901,949 899,959 899,960 910,964 899,968 890,997 861,1001 862,990 871,962 886,956 875,953 872,940 +L 1583,1720 1581,1727 1589,1724 1583,1720 +L 790,1686 764,1687 780,1693 781,1704 739,1720 776,1723 790,1704 790,1686 +L 1171,1708 1157,1719 1170,1720 1171,1708 +L 842,1665 836,1690 854,1681 854,1672 869,1701 866,1716 893,1718 877,1705 880,1684 855,1669 842,1665 +L 189,1709 178,1714 186,1717 189,1709 +L 2172,571 2171,581 2159,577 2181,589 2161,601 2174,627 2166,631 2172,633 2160,669 2196,673 2192,668 2204,666 2211,652 2239,664 2228,635 2213,633 2216,624 2195,615 2195,607 2200,600 2184,598 2200,577 2190,584 2172,571 +L 2249,13 2249,41 2220,23 2230,38 2226,67 2247,59 2260,77 2229,89 2224,95 2233,102 2229,94 2239,90 2269,93 2290,109 2265,106 2249,114 2261,118 2265,109 2292,116 2317,75 2327,74 2325,67 2269,61 2256,47 2261,33 2249,13 +L 265,1518 265,1536 284,1545 269,1543 282,1570 266,1551 265,1578 250,1572 248,1555 240,1559 236,1547 232,1555 222,1536 218,1544 210,1529 200,1537 257,1579 241,1582 243,1600 247,1606 226,1620 233,1625 253,1615 260,1629 271,1587 309,1582 299,1600 305,1603 332,1588 314,1567 298,1573 283,1532 272,1533 265,1518 +L 3244,1077 3196,1127 3191,1111 3184,1126 3163,1125 3168,1139 3158,1138 3160,1157 3123,1158 3121,1173 3113,1168 3108,1176 3130,1172 3135,1183 3142,1177 3140,1203 3162,1203 3189,1144 3217,1139 3208,1121 3231,1107 3244,1077 +L 313,1688 303,1705 313,1712 313,1688 +L 948,1649 951,1665 923,1664 915,1687 934,1683 955,1710 966,1704 956,1691 959,1684 971,1688 962,1672 976,1651 948,1649 +L 499,1697 503,1710 513,1707 499,1697 +L 46,1691 49,1706 55,1694 46,1691 +L 2461,986 2453,997 2436,990 2425,1007 2408,1010 2391,994 2378,998 2376,989 2356,1004 2348,995 2350,1010 2333,1015 2361,1022 2362,1011 2353,1012 2361,1005 2372,1015 2369,1026 2391,1017 2379,1028 2385,1033 2410,1019 2417,1028 2405,1046 2410,1055 2420,1048 2418,1083 2438,1078 2421,1073 2431,1050 2425,1045 2432,1031 2451,1035 2471,1026 2449,1022 2461,986 +L 1643,1696 1646,1704 1653,1700 1643,1696 +L -29,90 -35,97 -5,116 -24,153 -10,150 -11,141 1,156 10,153 9,161 18,156 18,171 32,180 26,184 45,175 36,161 41,151 16,132 18,93 3,63 -9,87 -22,88 -20,79 -29,90 +L 104,1663 109,1686 132,1702 139,1702 134,1694 151,1699 157,1686 131,1679 140,1689 113,1677 104,1663 +L 1602,1691 1600,1699 1616,1702 1602,1691 +L 1044,1691 1037,1699 1046,1701 1044,1691 +L 2230,452 2222,456 2221,504 2205,509 2194,499 2188,509 2155,507 2131,489 2143,468 2132,459 2122,474 2113,468 2121,490 2089,468 2056,482 2069,487 2072,499 2070,485 2095,490 2104,519 2119,492 2140,497 2150,510 2146,521 2163,538 2215,508 2223,529 2232,514 2225,517 2230,452 +L 795,379 779,388 764,415 751,405 743,410 749,388 724,395 732,400 725,406 746,418 712,431 729,430 723,459 730,462 706,480 704,471 703,481 718,491 720,479 734,475 732,462 772,449 785,432 806,433 795,428 829,403 805,408 780,432 766,417 795,379 +L 313,1670 317,1685 332,1699 341,1694 325,1691 324,1676 313,1670 +L 1242,2351 1258,2349 1258,2338 1248,2344 1240,2340 1234,2349 1210,2341 1185,2345 1201,2347 1208,2361 1212,2356 1212,2410 1206,2421 1198,2419 1198,2431 1244,2456 1251,2443 1246,2449 1244,2438 1225,2434 1217,2421 1245,2420 1245,2413 1261,2423 1259,2404 1246,2404 1240,2391 1266,2378 1248,2366 1243,2384 1219,2375 1218,2349 1227,2358 1242,2351 +L 2841,1275 2823,1294 2823,1311 2810,1311 2780,1335 2758,1332 2771,1335 2758,1338 2765,1359 2767,1342 2774,1350 2782,1342 2777,1336 2787,1343 2776,1354 2777,1368 2765,1369 2769,1385 2755,1378 2743,1384 2750,1395 2772,1388 2805,1342 2813,1342 2821,1361 2832,1361 2827,1341 2845,1305 2841,1275 +L 2084,1590 2065,1593 2063,1608 2049,1625 2048,1616 2027,1629 2029,1638 1992,1638 1980,1655 2001,1646 1978,1657 1959,1682 1974,1689 1976,1676 1991,1674 1983,1663 1998,1652 2027,1645 2028,1651 2069,1604 2095,1601 2084,1590 +L 1561,1659 1545,1678 1548,1689 1563,1670 1561,1659 +L 2568,825 2553,828 2545,841 2533,839 2515,863 2519,855 2509,854 2498,864 2508,843 2491,863 2481,867 2477,858 2468,873 2466,893 2478,883 2489,898 2465,936 2473,937 2462,959 2470,960 2477,946 2485,952 2486,938 2502,941 2485,918 2502,905 2497,894 2509,894 2507,883 2527,873 2536,855 2545,858 2546,847 2559,855 2552,842 2568,825 +L 1184,1491 1173,1496 1169,1535 1152,1557 1162,1562 1160,1577 1146,1587 1122,1586 1134,1594 1127,1606 1142,1592 1155,1599 1162,1587 1196,1615 1201,1604 1218,1603 1176,1566 1191,1539 1184,1524 1196,1522 1203,1535 1206,1520 1183,1517 1196,1502 1184,1491 +L 699,1597 705,1617 723,1634 736,1677 751,1682 737,1672 727,1634 699,1597 +L 1481,180 1458,191 1430,188 1441,220 1425,233 1400,233 1413,242 1409,258 1424,235 1449,244 1447,263 1437,268 1464,269 1464,288 1487,283 1465,249 1466,230 1489,217 1476,220 1479,203 1476,216 1466,203 1482,192 1481,180 +L 1918,1671 1892,1674 1905,1681 1918,1671 +L 1942,1654 1923,1666 1941,1664 1948,1676 1942,1654 +L 1956,1325 1938,1331 1944,1351 1937,1361 1954,1367 1937,1385 1931,1381 1925,1338 1913,1361 1915,1379 1909,1352 1900,1396 1889,1396 1886,1408 1895,1409 1889,1415 1908,1407 1917,1431 1935,1441 1922,1409 1940,1417 1951,1406 1939,1407 1947,1396 1941,1395 1965,1372 1946,1341 1956,1325 +L 267,176 244,183 234,197 207,190 210,202 198,212 208,208 216,221 193,216 196,234 164,236 158,222 150,231 176,242 168,248 174,253 189,236 224,253 229,232 254,253 265,237 247,222 248,194 261,182 271,187 267,176 +L 2501,1385 2492,1399 2500,1402 2490,1402 2464,1444 2448,1447 2443,1468 2404,1480 2398,1498 2414,1486 2428,1497 2439,1493 2466,1446 2483,1454 2518,1427 2517,1415 2527,1412 2501,1385 +L 1820,1649 1809,1669 1819,1665 1820,1649 +L 783,213 740,250 734,249 743,236 733,248 723,234 685,237 679,246 692,244 693,257 708,261 698,279 706,288 695,298 708,312 719,315 706,293 721,276 740,293 740,278 722,275 738,255 760,260 762,252 752,250 764,236 783,233 787,241 775,239 777,246 791,241 783,213 +L 395,265 380,267 374,291 398,349 408,351 406,354 432,363 427,343 421,348 413,336 424,335 417,311 443,314 440,296 395,297 393,281 382,278 395,265 +L 1113,1647 1115,1662 1121,1648 1113,1647 +L 1972,1604 1950,1635 1948,1657 1972,1604 +L 1802,1645 1794,1653 1804,1656 1802,1645 +L 2657,6 2656,17 2650,9 2643,16 2683,49 2616,148 2611,171 2628,158 2627,145 2695,52 2690,44 2704,17 2657,6 +L 1981,214 1969,253 1982,318 2004,341 2003,328 1981,304 2008,251 2031,232 2010,222 1991,225 1981,214 +L 1056,1619 1029,1639 1051,1639 1048,1652 1060,1649 1055,1634 1063,1626 1056,1619 +L 3784,13 3784,30 3772,31 3780,40 3769,45 3790,77 3774,82 3775,93 3781,94 3778,84 3792,88 3809,104 3796,99 3793,108 3757,114 3763,120 3753,126 3734,119 3719,140 3738,142 3817,103 3804,94 3792,55 3809,26 3793,22 3784,13 +L 74,1632 74,1650 79,1638 84,1637 74,1632 +L 1580,1631 1569,1649 1580,1649 1580,1631 +L 896,319 886,330 879,326 880,340 863,346 875,374 844,385 836,397 868,397 876,385 895,391 885,394 898,404 896,381 918,383 931,373 932,358 958,352 944,345 903,374 883,376 892,365 883,353 896,323 909,346 905,321 896,319 +L 1808,1631 1820,1649 1826,1634 1808,1631 +L 1141,1638 1137,1647 1148,1642 1141,1638 +L 510,1635 514,1647 521,1641 510,1635 +L 2794,975 2769,992 2751,1038 2741,1038 2750,1041 2737,1058 2743,1069 2734,1069 2741,1075 2734,1084 2724,1078 2729,1085 2715,1088 2717,1095 2711,1089 2702,1119 2659,1169 2665,1177 2717,1122 2741,1126 2719,1106 2739,1088 2752,1047 2765,1035 2771,995 2794,975 +L 2328,1017 2313,1042 2319,1040 2326,1066 2308,1102 2331,1096 2343,1074 2353,1087 2363,1059 2372,1062 2387,1040 2363,1035 2340,1058 2327,1034 2348,1043 2329,1029 2328,1017 +L 2949,1116 2877,1194 2875,1225 2868,1223 2854,1252 2865,1236 2878,1239 2895,1228 2889,1203 2906,1197 2908,1193 2916,1197 2922,1185 2914,1180 2929,1145 2952,1130 2949,1116 +L 2021,960 2006,962 2006,985 2017,979 2049,1021 2070,1015 2086,980 2049,983 2050,974 2043,979 2021,960 +L 1087,483 1075,493 1062,487 1062,508 1078,513 1077,540 1095,533 1101,577 1116,579 1091,610 1105,619 1130,590 1103,562 1105,519 1092,517 1087,483 +L 829,1622 804,1634 817,1638 833,1626 865,1639 853,1623 829,1622 +L 1624,-30 1611,-1 1634,14 1637,46 1625,50 1615,18 1605,15 1615,35 1606,38 1609,59 1627,57 1620,76 1630,54 1666,40 1658,31 1677,13 1667,10 1652,36 1641,36 1650,23 1638,-19 1624,-30 +L -26,1614 -41,1625 -24,1638 -26,1614 +L 96,1624 86,1637 112,1634 97,1632 96,1624 +L 957,1616 939,1626 942,1633 957,1637 957,1616 +L 2604,1085 2586,1104 2579,1099 2586,1107 2560,1153 2550,1156 2549,1138 2537,1156 2547,1171 2505,1208 2508,1218 2478,1254 2466,1298 2520,1204 2580,1150 2580,1132 2604,1085 +L 1227,1617 1235,1635 1237,1623 1227,1617 +L 894,1612 866,1627 870,1634 894,1612 +L 1793,1620 1781,1629 1796,1632 1793,1620 +L 2412,1075 2403,1077 2404,1109 2385,1117 2381,1142 2346,1168 2333,1199 2296,1221 2303,1236 2344,1205 2340,1196 2347,1197 2360,1162 2377,1158 2396,1124 2409,1118 2417,1096 2412,1075 +L 2198,1251 2174,1264 2143,1259 2155,1279 2144,1309 2104,1314 2138,1337 2145,1312 2153,1319 2166,1305 2153,1299 2161,1299 2157,1288 2167,1290 2180,1275 2191,1286 2198,1277 2191,1264 2203,1268 2198,1251 +L 1461,1457 1454,1473 1414,1494 1442,1505 1438,1488 1454,1489 1457,1502 1466,1492 1470,1514 1460,1523 1470,1524 1485,1484 1491,1507 1497,1486 1515,1476 1497,1471 1484,1479 1475,1464 1461,1457 +L 931,1602 930,1614 939,1626 938,1607 953,1608 931,1602 +L 2748,1406 2711,1439 2693,1441 2733,1450 2775,1464 2763,1448 2780,1444 2783,1434 2747,1419 2754,1420 2748,1406 +L 488,656 475,666 470,686 484,705 480,720 467,726 474,738 490,736 490,720 532,709 510,697 505,681 489,684 488,656 +L 41,1605 27,1610 34,1612 28,1625 40,1609 46,1614 41,1605 +L 1389,1610 1382,1614 1390,1622 1389,1610 +L 1081,1575 1072,1588 1073,1599 1065,1594 1068,1616 1072,1605 1080,1611 1086,1599 1079,1592 1091,1582 1081,1575 +L 2844,350 2820,391 2852,405 2872,376 2901,371 2844,350 +L 223,344 217,336 206,345 229,358 239,397 230,401 233,410 246,407 254,418 270,405 273,416 274,402 259,400 261,388 251,384 250,355 235,346 252,334 225,334 223,344 +L 1463,108 1438,149 1401,140 1408,170 1419,164 1430,177 1446,177 1462,135 1480,140 1477,124 1460,131 1463,108 +L 871,1281 863,1295 813,1311 815,1303 803,1296 783,1340 820,1323 837,1358 839,1319 865,1296 887,1293 886,1286 876,1289 871,1281 +L 2375,736 2384,748 2375,771 2358,778 2363,787 2349,794 2382,796 2383,814 2394,807 2416,825 2412,811 2421,809 2399,801 2406,787 2386,754 2391,742 2375,736 +L 1228,1411 1207,1418 1210,1429 1196,1437 1152,1434 1152,1444 1187,1440 1190,1470 1200,1437 1214,1467 1214,1455 1239,1432 1265,1441 1252,1425 1262,1421 1245,1416 1231,1429 1228,1411 +L 3471,22 3462,41 3445,47 3429,76 3437,81 3433,89 3416,92 3420,105 3430,95 3447,98 3448,107 3459,95 3452,90 3459,65 3488,23 3471,22 +L 1482,1352 1472,1366 1480,1378 1450,1384 1447,1410 1436,1415 1446,1421 1459,1394 1475,1396 1471,1411 1485,1400 1476,1397 1501,1388 1566,1410 1495,1375 1496,1361 1482,1352 +L 566,909 537,916 530,927 537,941 554,939 568,965 580,968 582,931 566,909 +L 155,52 152,61 147,52 127,71 137,93 153,89 149,101 156,101 164,70 179,58 182,98 166,93 179,100 176,113 189,97 186,77 194,77 197,90 204,78 185,65 186,53 177,55 163,62 155,52 +L 784,1515 787,1531 778,1556 786,1596 767,1603 782,1605 790,1591 782,1555 792,1527 784,1515 +L 775,1345 737,1359 736,1351 715,1366 719,1374 696,1355 702,1373 709,1371 694,1404 706,1410 700,1401 716,1404 724,1393 724,1405 735,1409 741,1399 728,1393 735,1373 775,1345 +L 2009,1522 1977,1578 1972,1604 2009,1522 +L 926,-4 931,19 923,30 944,28 958,47 979,35 970,9 955,-2 926,-4 +L 2458,844 2423,852 2416,862 2426,893 2414,920 2407,918 2411,924 2431,922 2429,903 2443,908 2433,891 2447,867 2468,873 2451,858 2460,859 2458,844 +L 37,1372 19,1380 29,1400 42,1392 33,1412 38,1423 41,1412 43,1437 65,1434 70,1411 37,1372 +L 1097,1584 1104,1595 1119,1586 1097,1584 +L 1036,1455 975,1460 1003,1464 991,1479 976,1475 981,1483 963,1500 993,1511 1005,1505 1010,1485 1003,1470 1020,1470 1036,1455 +L 1203,1535 1207,1551 1253,1588 1236,1565 1238,1553 1213,1551 1203,1535 +L 2096,1577 2097,1584 2103,1580 2096,1577 +L 37,1561 49,1581 53,1576 37,1561 +L 1473,1567 1462,1576 1467,1581 1473,1567 +L 1818,1431 1811,1447 1791,1442 1773,1450 1791,1467 1788,1482 1799,1484 1798,1475 1840,1458 1821,1448 1835,1434 1818,1431 +L 1144,150 1135,158 1111,151 1108,176 1122,187 1125,170 1138,179 1152,168 1151,188 1170,197 1178,187 1167,170 1154,169 1144,150 +L 906,1556 897,1573 908,1573 906,1556 +L 1065,1568 1059,1573 1073,1570 1065,1568 +L 1391,1554 1386,1563 1397,1571 1406,1571 1408,1555 1397,1563 1391,1554 +L 1237,498 1217,521 1224,536 1209,552 1207,572 1237,545 1268,543 1249,538 1258,522 1243,527 1248,512 1235,510 1237,498 +L 2142,1556 2132,1563 2145,1564 2142,1556 +L 1304,1549 1301,1560 1309,1555 1304,1549 +L -8,1507 -26,1536 -21,1552 -2,1559 5,1527 -10,1500 -18,1500 -8,1507 +L 889,1507 873,1516 893,1521 887,1537 906,1556 905,1533 936,1557 921,1518 900,1521 889,1507 +L 1290,1288 1274,1332 1278,1311 1251,1332 1259,1342 1245,1365 1246,1388 1260,1349 1281,1348 1278,1336 1303,1304 1301,1289 1299,1295 1290,1288 +L 1094,1546 1086,1548 1076,1555 1094,1546 +L 748,1516 747,1550 764,1530 748,1516 +L -2,1504 29,1549 28,1535 -2,1504 +L 1228,1536 1231,1546 1244,1540 1228,1536 +L 1358,1080 1350,1083 1349,1107 1329,1107 1335,1114 1310,1103 1324,1130 1350,1129 1359,1138 1367,1129 1388,1133 1389,1121 1407,1131 1409,1113 1420,1106 1396,1110 1392,1119 1381,1118 1385,1124 1355,1129 1350,1102 1358,1080 +L 2901,1515 2888,1518 2902,1539 2919,1527 2901,1515 +L 2452,1526 2437,1537 2452,1534 2452,1526 +L 479,460 467,486 435,491 445,505 488,505 502,522 516,501 469,487 485,469 479,460 +L 455,1490 468,1498 506,1496 530,1530 539,1530 513,1491 455,1490 +L 980,1514 966,1519 961,1530 980,1514 +L 2273,1505 2256,1521 2265,1529 2273,1505 +L 67,1478 63,1490 90,1518 88,1528 103,1520 86,1499 77,1501 67,1478 +L 3038,1243 3022,1259 3026,1265 3001,1281 3000,1296 2965,1340 2979,1336 2988,1345 3023,1277 3038,1243 +L 2715,622 2709,632 2733,685 2744,669 2779,704 2783,694 2769,688 2772,681 2757,679 2771,661 2756,660 2752,669 2724,644 2723,623 2715,622 +L 2080,55 2081,75 2067,72 2048,91 2059,92 2076,123 2085,119 2082,107 2094,104 2082,78 2090,79 2091,69 2080,55 +L 261,1494 252,1504 265,1518 261,1494 +L 2199,1499 2189,1517 2199,1512 2199,1499 +L 2844,958 2825,964 2827,991 2815,997 2816,1019 2809,1013 2804,1040 2796,1037 2797,1058 2821,1020 2833,1024 2827,1017 2843,1006 2832,986 2844,958 +L 863,1510 858,1514 871,1516 863,1510 +L 1377,1502 1378,1511 1364,1515 1383,1511 1377,1502 +L 1352,1423 1332,1427 1334,1463 1327,1472 1323,1467 1317,1500 1334,1494 1354,1501 1357,1491 1355,1481 1347,1491 1321,1493 1332,1475 1345,1475 1352,1423 +L 1380,1486 1399,1511 1407,1496 1380,1486 +L 2923,1446 2916,1466 2890,1476 2912,1486 2908,1502 2917,1509 2930,1492 2928,1463 2939,1459 2923,1446 +L 1874,1491 1868,1502 1880,1509 1874,1491 +L 752,1436 772,1449 769,1481 783,1508 772,1478 773,1445 752,1436 +L 406,354 385,388 372,388 382,400 379,453 399,443 403,431 385,416 386,404 403,393 406,354 +L 1419,602 1420,616 1411,609 1406,615 1411,627 1398,618 1394,632 1436,665 1431,644 1440,641 1426,629 1433,625 1419,602 +L 104,356 100,374 70,375 68,387 95,382 114,394 140,377 132,379 134,361 119,357 117,372 104,356 +L 1294,964 1277,988 1269,1022 1282,993 1292,1008 1300,1002 1307,1011 1306,1004 1320,1008 1325,999 1316,998 1317,976 1304,983 1294,964 +L 2090,529 2076,530 2080,550 2108,582 2115,578 2106,542 2111,549 2116,540 2090,529 +L 319,1411 290,1429 294,1441 302,1431 302,1443 315,1440 315,1455 304,1456 321,1474 332,1470 319,1411 +L 1548,1280 1560,1281 1562,1304 1549,1303 1582,1325 1575,1317 1590,1313 1583,1311 1601,1286 1596,1275 1590,1294 1589,1279 1576,1294 1576,1281 1566,1286 1572,1275 1554,1275 1548,1280 +L 1384,545 1350,561 1379,567 1365,588 1382,583 1381,571 1404,578 1415,564 1398,550 1386,559 1384,545 +L 3326,358 3314,372 3293,372 3280,389 3293,396 3291,410 3287,421 3335,365 3326,358 +L 1299,1462 1281,1478 1288,1486 1281,1497 1297,1496 1299,1462 +L 616,1492 629,1496 625,1480 616,1480 616,1492 +L 3021,1447 3006,1461 2999,1495 3017,1493 3009,1491 3010,1475 3024,1456 3021,1447 +L 939,1486 932,1489 940,1495 939,1486 +L 3152,736 3133,755 3117,796 3137,789 3154,768 3146,765 3158,764 3162,739 3149,751 3152,736 +L 2718,1462 2707,1475 2709,1489 2726,1478 2718,1462 +L 459,1466 453,1470 467,1489 479,1486 482,1470 470,1475 459,1466 +L 220,1449 207,1460 196,1453 202,1478 218,1488 235,1473 227,1478 218,1470 220,1449 +L 434,1418 421,1430 424,1458 400,1469 423,1468 431,1488 432,1428 446,1423 434,1418 +L 2247,601 2256,624 2245,621 2249,630 2239,630 2249,639 2237,640 2239,655 2262,646 2278,627 2270,606 2264,611 2247,601 +L 503,1460 492,1464 492,1484 511,1466 503,1460 +L 444,1466 434,1468 443,1476 437,1481 450,1484 452,1471 444,1466 +L 1224,1483 1227,1476 1218,1476 1224,1483 +L 1413,1462 1411,1471 1428,1476 1413,1462 +L 598,517 572,536 594,571 611,539 598,517 +L 2004,342 2011,366 2037,392 2049,396 2050,378 2060,385 2067,377 2072,387 2078,374 2049,367 2034,375 2004,342 +L 1770,1457 1765,1466 1752,1462 1753,1474 1777,1468 1770,1457 +L 2922,1036 2915,1051 2892,1047 2901,1058 2893,1058 2887,1088 2875,1089 2888,1100 2926,1046 2942,1042 2922,1036 +L 952,1456 941,1471 967,1461 952,1456 +L 1901,1459 1885,1468 1897,1464 1900,1471 1901,1459 +L 3169,705 3159,714 3160,731 3181,739 3184,754 3194,749 3202,715 3183,723 3189,729 3176,729 3182,713 3169,705 +L 497,28 474,38 477,81 501,69 490,57 503,50 497,28 +L 172,764 159,773 170,782 160,787 163,806 180,815 174,830 189,816 190,794 170,776 172,764 +L 1432,553 1415,564 1429,612 1449,635 1468,636 1457,610 1445,618 1435,611 1424,569 1432,553 +L 1858,1454 1851,1467 1867,1465 1858,1454 +L 1530,1465 1531,1454 1522,1454 1530,1465 +L 450,1454 436,1457 445,1465 450,1454 +L 2288,11 2277,23 2299,52 2316,52 2306,18 2288,11 +L 1167,1451 1162,1460 1169,1462 1167,1451 +L 476,1444 470,1452 493,1461 495,1453 476,1444 +L 3136,1210 3123,1234 3131,1250 3142,1252 3141,1236 3151,1229 3144,1225 3153,1223 3147,1221 3170,1225 3173,1216 3136,1210 +L 2635,1437 2617,1438 2619,1456 2635,1437 +L 1566,1454 1572,1456 1578,1455 1566,1454 +L 2805,1437 2800,1441 2812,1455 2805,1437 +L 2006,135 2000,171 1989,182 2028,198 2006,135 +L 1674,1445 1667,1452 1682,1454 1671,1451 1674,1445 +L 2666,1424 2663,1434 2638,1437 2665,1452 2689,1441 2682,1436 2690,1426 2666,1424 +L 3023,1444 3037,1452 3046,1436 3038,1425 3051,1417 3049,1400 3040,1400 3023,1444 +L 1693,1440 1681,1442 1691,1451 1693,1440 +L -21,1438 -25,1451 -17,1449 -21,1438 +L 1772,624 1765,631 1753,625 1729,645 1731,674 1718,670 1730,687 1742,678 1737,664 1748,649 1746,634 1771,640 1772,624 +L 600,205 592,211 605,243 583,265 571,261 584,271 600,261 606,269 615,255 608,241 618,236 600,205 +L 1009,1431 1001,1441 1012,1443 1009,1431 +L 884,1434 880,1441 892,1441 884,1434 +L 1082,51 1046,55 1053,88 1064,87 1071,71 1085,77 1075,71 1082,51 +L 1177,939 1161,944 1164,953 1152,954 1145,968 1182,969 1188,944 1177,939 +L 2095,-25 2136,48 2137,24 2123,8 2136,-8 2131,-3 2095,-25 +L 1721,1424 1718,1435 1726,1440 1721,1424 +L 273,1421 259,1433 278,1439 273,1421 +L -19,1406 -21,1438 -13,1411 -19,1406 +L 1688,174 1679,186 1701,208 1698,226 1710,234 1717,229 1708,222 1704,178 1688,174 +L 2822,1409 2805,1437 2827,1424 2822,1409 +L 1739,1429 1734,1435 1748,1433 1739,1429 +L 884,1434 888,1429 880,1429 884,1434 +L 38,1423 27,1425 38,1432 38,1423 +L 2638,1025 2615,1074 2634,1079 2645,1064 2645,1042 2635,1041 2638,1025 +L 1484,1416 1484,1428 1507,1427 1484,1416 +L 1526,1409 1543,1426 1548,1410 1526,1409 +L 650,254 636,291 619,289 616,314 661,272 666,255 650,254 +L 1712,17 1691,47 1696,69 1722,42 1713,31 1722,25 1712,17 +L 1227,1135 1225,1153 1208,1146 1211,1158 1189,1138 1192,1155 1175,1166 1195,1159 1212,1169 1226,1158 1229,1166 1246,1151 1230,1149 1227,1135 +L 2687,1410 2697,1420 2696,1413 2687,1410 +L 92,1413 82,1415 89,1420 92,1413 +L 943,126 942,141 973,169 982,151 967,143 973,131 951,135 943,126 +L 1772,260 1742,273 1741,272 1727,287 1723,311 1731,287 1765,290 1772,260 +L 1494,1407 1499,1414 1522,1409 1494,1407 +L 965,478 972,468 967,450 979,460 979,442 988,441 988,425 964,446 964,459 945,460 958,481 965,478 +L 1,289 -9,303 -11,296 -14,309 -4,312 -16,321 -2,332 -6,349 5,335 4,303 21,294 1,289 +L 2670,119 2668,128 2667,136 2676,135 2669,159 2698,146 2701,127 2675,127 2670,119 +L 314,1389 292,1391 297,1398 287,1399 292,1410 318,1396 314,1389 +L 2830,1391 2825,1404 2832,1410 2838,1395 2830,1391 +L 3547,126 3507,218 3519,222 3526,179 3540,177 3547,126 +L 163,1392 157,1402 172,1405 163,1392 +L 3237,1031 3245,1076 3274,1057 3276,1038 3270,1049 3243,1053 3253,1039 3237,1031 +L 1577,1386 1584,1404 1594,1390 1577,1386 +L 645,1396 643,1402 651,1399 645,1396 +L -38,1397 -27,1392 -21,1401 -21,1388 -35,1392 -35,1382 -44,1382 -38,1397 +L 1424,322 1425,348 1415,349 1444,355 1450,387 1463,389 1453,385 1458,372 1441,347 1443,331 1424,322 +L 3067,1362 3039,1397 3057,1400 3063,1375 3073,1373 3067,1362 +L 1828,1372 1818,1380 1819,1394 1829,1399 1828,1372 +L 1860,1388 1849,1389 1855,1398 1860,1388 +L 1094,40 1084,50 1110,79 1120,49 1094,40 +L 2797,1058 2780,1066 2774,1100 2785,1102 2780,1089 2792,1093 2805,1079 2795,1073 2802,1066 2797,1058 +L 2857,1370 2845,1386 2851,1393 2860,1377 2857,1370 +L 1049,128 1035,135 1079,170 1072,140 1049,128 +L 1958,302 1966,315 1963,338 1933,390 1959,375 1955,367 1978,310 1958,302 +L 1002,1375 995,1380 1006,1387 1002,1375 +L 59,1375 53,1384 67,1378 59,1375 +L 2551,1371 2547,1378 2556,1383 2565,1375 2551,1371 +L 991,1339 986,1351 976,1351 974,1381 990,1372 991,1339 +L 2591,1360 2565,1375 2590,1379 2584,1369 2591,1360 +L 835,1363 842,1378 846,1368 835,1363 +L 163,1327 163,1376 174,1362 175,1334 163,1327 +L 2524,1351 2515,1374 2525,1376 2524,1351 +L 1835,1352 1828,1364 1837,1362 1837,1375 1845,1359 1835,1352 +L 769,1358 767,1374 781,1366 769,1358 +L 2899,70 2876,87 2877,96 2862,89 2872,110 2849,121 2857,132 2849,127 2850,147 2899,70 +L 55,111 30,130 50,142 68,128 65,114 55,111 +L 2497,1347 2487,1353 2503,1373 2510,1358 2497,1347 +L 597,1350 605,1372 613,1359 597,1350 +L 1354,1360 1347,1362 1352,1372 1354,1360 +L 1806,1369 1808,1358 1801,1358 1806,1369 +L 54,1345 41,1362 52,1364 54,1345 +L 1590,-1 1575,10 1583,32 1605,15 1608,1 1590,-1 +L 625,1357 614,1359 625,1364 625,1357 +L 224,1327 240,1362 250,1338 240,1320 225,1320 224,1327 +L 2664,1183 2647,1213 2663,1223 2658,1246 2684,1238 2656,1212 2670,1191 2664,1183 +L 210,1209 216,1238 233,1259 231,1218 210,1209 +L 1357,458 1323,470 1322,478 1351,475 1355,486 1367,488 1357,458 +L 3086,1314 3065,1358 3085,1347 3086,1314 +L 1461,1338 1451,1354 1482,1351 1479,1342 1461,1338 +L 2452,1324 2441,1339 2420,1333 2440,1346 2437,1354 2452,1324 +L 1862,1337 1849,1353 1860,1354 1862,1337 +L 714,1341 712,1350 725,1353 714,1341 +L 353,1327 342,1352 350,1349 353,1327 +L 1877,1339 1880,1351 1889,1344 1877,1339 +L 1841,1345 1835,1348 1844,1351 1841,1345 +L 709,337 702,349 717,373 710,376 725,386 731,359 720,358 716,346 709,337 +L 1159,266 1139,286 1128,288 1129,274 1113,289 1109,308 1120,309 1117,292 1139,297 1148,283 1152,292 1151,280 1158,284 1159,266 +L 1539,1329 1534,1340 1570,1350 1567,1340 1539,1329 +L 591,1337 578,1348 594,1344 591,1337 +L 254,1318 256,1347 264,1342 254,1318 +L 2548,1336 2541,1346 2557,1337 2548,1336 +L 911,434 908,451 893,441 910,465 877,483 875,508 883,482 915,481 911,434 +L 1058,284 1047,302 1054,308 1067,321 1076,290 1058,284 +L 2173,-8 2171,23 2179,35 2196,9 2183,-1 2173,-8 +L 974,1332 966,1333 974,1339 974,1332 +L 156,697 143,704 150,714 142,717 170,731 172,711 156,697 +L 989,1314 992,1337 1003,1325 998,1319 989,1314 +L 1986,1326 2020,1333 1998,1327 1986,1326 +L 1425,1302 1402,1307 1400,1315 1428,1331 1442,1329 1415,1315 1425,1302 +L 1885,1313 1880,1329 1897,1318 1885,1313 +L 636,1321 633,1327 645,1328 636,1321 +L 434,1318 430,1327 437,1324 434,1318 +L 2276,1151 2259,1165 2223,1157 2242,1169 2239,1184 2249,1179 2267,1190 2256,1173 2262,1178 2276,1151 +L 733,1317 714,1318 714,1326 733,1317 +L 1527,1029 1520,1043 1503,1069 1505,1081 1541,1034 1527,1029 +L 658,-29 652,-27 668,-13 669,8 685,6 689,28 691,-14 670,-13 658,-29 +L 2339,1304 2334,1324 2341,1310 2339,1304 +L 2446,362 2429,372 2450,376 2459,394 2463,389 2471,398 2465,367 2446,362 +L 1371,1298 1363,1311 1372,1320 1399,1314 1371,1298 +L 447,1162 451,1173 439,1186 444,1201 457,1200 456,1189 477,1178 472,1171 491,1168 466,1165 457,1186 444,1187 455,1170 447,1162 +L 1838,1306 1838,1317 1847,1311 1838,1306 +L 2450,1308 2457,1316 2458,1312 2450,1308 +L 891,1310 875,1314 895,1315 891,1310 +L 2153,95 2170,103 2179,120 2211,116 2188,100 2153,95 +L 1368,631 1360,643 1348,643 1340,661 1365,660 1376,647 1368,631 +L 1127,544 1136,570 1154,575 1166,563 1127,544 +L 1205,368 1189,380 1171,377 1169,385 1187,394 1185,397 1208,413 1204,391 1193,396 1192,386 1205,368 +L 3131,1252 3093,1306 3136,1272 3131,1252 +L 1134,27 1132,55 1120,66 1126,79 1145,44 1169,54 1167,45 1148,43 1134,27 +L 124,572 113,574 125,596 141,594 149,579 124,572 +L 742,1281 744,1295 756,1299 760,1292 742,1281 +L 2384,-55 2369,-44 2362,-7 2372,-18 2373,-9 2389,-14 2374,-25 2385,-38 2379,-37 2384,-55 +L 764,1286 763,1292 776,1297 764,1286 +L 1528,1288 1519,1290 1528,1297 1528,1288 +L -33,247 -42,271 -12,271 7,252 -14,262 -33,247 +L 35,575 11,592 41,615 35,575 +L 804,1275 802,1292 811,1278 804,1275 +L 1507,1095 1507,1106 1488,1116 1495,1118 1450,1120 1466,1136 1476,1123 1516,1116 1507,1095 +L 3148,247 3149,265 3140,264 3147,273 3134,275 3137,289 3130,290 3135,297 3115,306 3144,298 3155,260 3148,247 +L 367,1113 359,1121 345,1117 346,1128 361,1125 357,1140 370,1148 376,1143 365,1133 378,1134 374,1115 367,1128 367,1113 +L 290,97 286,114 275,118 275,139 254,143 267,148 268,173 271,145 289,153 276,140 292,118 290,97 +L 856,1259 836,1275 828,1272 829,1285 860,1266 856,1259 +L 233,1262 224,1282 249,1285 233,1262 +L 1717,1251 1716,1263 1733,1268 1716,1279 1729,1280 1737,1263 1717,1251 +L 746,1270 745,1278 755,1280 746,1270 +L 1152,1279 1161,1272 1149,1272 1152,1279 +L 1864,1259 1856,1262 1863,1278 1864,1259 +L 1902,1256 1887,1257 1890,1276 1902,1256 +L 2112,847 2133,861 2141,911 2149,870 2137,861 2142,857 2112,847 +L 1606,1267 1609,1275 1622,1271 1606,1267 +L 792,1269 778,1270 794,1275 792,1269 +L 818,815 805,828 811,833 792,836 791,845 809,840 815,854 828,847 824,837 817,845 818,815 +L 871,1248 871,1260 874,1269 880,1265 871,1248 +L 2580,-62 2570,-59 2564,-30 2572,-22 2586,-53 2580,-62 +L 625,348 616,382 608,368 600,381 621,387 633,375 625,360 636,357 625,348 +L 829,1254 812,1260 822,1268 829,1254 +L 1600,1240 1586,1263 1578,1260 1589,1267 1600,1240 +L 862,1251 856,1259 869,1266 862,1251 +L 1527,1256 1521,1264 1533,1264 1527,1256 +L 455,232 428,233 427,258 451,252 444,241 455,232 +L 1865,1135 1877,1164 1891,1174 1897,1165 1890,1158 1898,1160 1903,1145 1879,1154 1865,1135 +L 795,1257 787,1259 783,1264 795,1257 +L 1135,1243 1166,1251 1171,1262 1174,1246 1166,1249 1165,1236 1155,1236 1135,1243 +L -5,1244 -21,1248 -23,1260 -9,1251 -13,1262 -5,1244 +L 1691,1251 1683,1255 1687,1262 1691,1251 +L 1188,60 1177,63 1173,78 1175,87 1184,86 1178,100 1189,94 1197,118 1199,103 1185,84 1188,60 +L 809,1254 803,1259 812,1260 809,1254 +L 2814,79 2800,95 2810,104 2802,101 2789,119 2801,117 2820,100 2814,79 +L 2618,-18 2615,-3 2637,15 2635,-17 2618,-18 +L 3112,816 3105,825 3111,833 3103,831 3092,845 3094,859 3085,861 3094,865 3106,848 3116,828 3112,816 +L 1007,649 990,655 999,661 992,680 1017,674 1007,649 +L 457,1231 475,1257 479,1246 457,1231 +L -1,1237 5,1254 7,1239 -1,1237 +L -59,1253 -3,1234 -41,1234 -59,1253 +L 1220,818 1194,823 1204,844 1225,829 1220,818 +L 655,59 619,62 629,66 628,84 636,81 649,81 644,75 655,59 +L 917,1200 923,1214 909,1214 931,1215 924,1232 946,1222 944,1219 949,1206 936,1214 938,1203 934,1212 932,1202 917,1200 +L 879,1212 867,1222 855,1226 855,1246 879,1212 +L 896,1238 887,1242 888,1245 896,1238 +L 2379,441 2383,465 2367,447 2363,452 2369,471 2394,468 2389,459 2399,457 2398,450 2385,457 2379,441 +L 509,243 483,257 480,267 492,280 509,243 +L 768,1218 765,1236 774,1223 768,1218 +L 1716,1232 1710,1235 1722,1236 1716,1232 +L 2604,564 2582,594 2555,586 2581,604 2564,615 2566,629 2588,606 2582,598 2604,564 +L 2764,1221 2765,1232 2772,1227 2764,1221 +L 737,862 700,880 712,879 724,894 738,886 728,871 737,862 +L 1594,817 1580,825 1629,832 1624,819 1594,817 +L 2168,244 2159,247 2158,278 2165,273 2166,286 2184,256 2176,263 2164,256 2168,244 +L 1221,1092 1240,1097 1244,1081 1237,1087 1229,1066 1221,1066 1221,1092 +L 2289,1199 2286,1214 2296,1221 2289,1199 +L 1967,927 1970,972 1977,973 1982,943 1967,927 +L 2773,1210 2767,1216 2777,1219 2773,1210 +L 969,1187 956,1190 964,1201 956,1214 970,1201 969,1187 +L 2785,1184 2787,1213 2791,1188 2785,1184 +L 431,1091 429,1101 436,1113 422,1125 434,1142 430,1121 436,1115 445,1128 450,1112 442,1116 441,1096 431,1091 +L 816,1195 818,1209 820,1201 829,1206 830,1197 816,1195 +L 1217,1192 1211,1202 1218,1207 1242,1208 1217,1192 +L 1193,943 1195,963 1186,968 1204,976 1206,966 1213,976 1215,964 1193,943 +L 1958,1188 1959,1196 1979,1205 1958,1188 +L 2806,1188 2796,1199 2803,1205 2806,1188 +L 2550,1084 2536,1095 2528,1087 2530,1115 2545,1112 2550,1084 +L 521,467 512,492 523,483 548,502 544,479 527,480 521,467 +L 985,1194 978,1197 984,1202 985,1194 +L 3068,988 3056,989 3023,1023 3039,1023 3033,1018 3053,1000 3068,1005 3068,988 +L 1116,1184 1112,1191 1129,1200 1130,1190 1121,1194 1116,1184 +L 926,1188 933,1199 942,1196 926,1188 +L 717,140 692,143 705,166 716,158 717,140 +L 3885,3 3898,25 3892,42 3902,41 3916,17 3896,10 3899,23 3885,3 +L 1305,1189 1301,1196 1320,1194 1305,1189 +L 2313,1182 2306,1194 2318,1186 2313,1182 +L 1526,1184 1530,1193 1535,1187 1526,1184 +L 1208,787 1205,794 1196,789 1188,806 1195,817 1200,810 1209,815 1208,787 +L 1124,408 1095,426 1102,439 1129,413 1124,408 +L 1179,1179 1177,1191 1194,1192 1179,1179 +L 1074,-47 1080,-27 1116,-35 1074,-47 +L 558,1138 559,1153 532,1191 564,1150 558,1138 +L 540,1083 533,1097 540,1121 547,1100 579,1103 564,1095 538,1100 546,1090 540,1083 +L 693,815 689,835 724,846 693,815 +L 1070,92 1074,117 1098,116 1087,110 1084,93 1070,92 +L 3116,1177 3104,1185 3116,1185 3116,1177 +L 2867,1093 2850,1099 2858,1101 2854,1116 2870,1108 2863,1122 2869,1126 2872,1108 2880,1110 2867,1093 +L 1341,272 1341,291 1362,291 1387,310 1386,328 1394,321 1391,308 1373,295 1359,282 1344,289 1341,272 +L 2814,1156 2793,1165 2794,1182 2806,1179 2814,1156 +L 154,1154 129,1168 137,1168 131,1180 154,1154 +L 921,1170 921,1180 929,1178 921,1170 +L 1150,815 1143,825 1137,815 1124,826 1139,828 1135,839 1163,826 1154,818 1148,827 1150,815 +L 3247,59 3240,94 3250,96 3258,76 3247,59 +L 2843,927 2840,936 2844,955 2849,948 2855,957 2862,943 2853,943 2853,928 2843,927 +L 2060,1155 2051,1160 2063,1165 2058,1170 2075,1176 2074,1156 2060,1155 +L 980,1169 976,1176 991,1173 980,1169 +L 412,482 382,511 360,510 381,536 387,531 379,516 412,482 +L 2089,812 2084,820 2102,851 2100,865 2108,846 2089,812 +L 3165,299 3149,301 3155,314 3183,317 3165,299 +L 160,1146 159,1163 168,1169 178,1153 160,1146 +L 904,818 900,843 919,848 928,836 918,840 904,818 +L 1447,1015 1449,1047 1434,1049 1449,1053 1441,1059 1452,1063 1458,1042 1447,1015 +L 892,550 877,557 873,576 889,579 883,566 895,559 892,550 +L 383,1156 388,1166 396,1158 383,1156 +L 2510,785 2499,801 2513,801 2516,810 2528,794 2510,785 +L 475,1142 459,1143 466,1161 475,1159 476,1149 467,1147 475,1142 +L 294,398 321,408 322,390 304,390 294,398 +L 2480,789 2466,826 2484,809 2490,791 2480,789 +L 3222,1139 3215,1143 3229,1154 3222,1139 +L 3018,796 3001,808 3013,825 3022,810 3018,796 +L 1123,1141 1108,1143 1110,1151 1123,1141 +L 2285,1137 2276,1151 2288,1145 2285,1137 +L 405,1125 400,1149 419,1143 412,1138 417,1129 405,1125 +L 1621,109 1607,128 1617,127 1619,136 1627,134 1629,116 1621,109 +L 2882,1134 2874,1143 2881,1147 2882,1134 +L -30,481 -30,508 -20,514 -18,486 -30,481 +L 2367,1125 2349,1140 2358,1142 2367,1125 +L 3611,-7 3584,15 3582,29 3599,26 3599,14 3590,17 3606,1 3611,-7 +L 127,956 122,981 138,984 140,970 128,964 137,962 127,956 +L 1280,1128 1288,1138 1292,1133 1280,1128 +L 762,824 773,836 776,803 766,803 762,824 +L 897,1121 888,1126 891,1137 897,1121 +L 38,454 27,466 36,466 38,481 54,479 38,454 +L 3218,416 3195,443 3213,439 3224,426 3218,416 +L 788,1044 756,1055 753,1079 758,1061 781,1058 788,1044 +L 528,191 518,195 527,212 538,210 539,199 528,191 +L 251,572 220,580 215,599 251,572 +L 2836,1114 2833,1132 2843,1121 2836,1114 +L 1541,543 1532,559 1514,566 1533,570 1545,558 1541,543 +L 1804,333 1777,335 1808,353 1804,333 +L 419,1076 414,1086 401,1086 405,1095 428,1089 430,1080 419,1076 +L 2336,1118 2349,1130 2354,1119 2336,1118 +L 1261,1122 1256,1128 1267,1129 1261,1122 +L -49,301 -55,328 -40,314 -41,323 -27,324 -49,301 +L 1691,233 1666,240 1668,251 1695,240 1691,233 +L 3648,-61 3636,-56 3628,-31 3644,-42 3648,-61 +L 155,872 136,884 157,893 171,884 150,882 155,872 +L 1274,1126 1282,1113 1269,1113 1274,1126 +L 643,361 633,375 664,383 643,361 +L 1421,1088 1427,1101 1419,1112 1450,1120 1430,1110 1429,1091 1421,1088 +L 1408,296 1398,317 1406,311 1424,322 1417,316 1423,306 1416,310 1417,297 1408,296 +L 1025,30 1010,34 1014,50 1028,47 1025,30 +L 1243,1098 1233,1109 1222,1098 1222,1107 1232,1113 1252,1101 1243,1098 +L 2763,1098 2762,1107 2764,1113 2773,1101 2763,1098 +L 609,1095 591,1108 598,1113 609,1095 +L 824,1106 811,1109 823,1113 824,1106 +L 1296,1095 1286,1112 1301,1112 1308,1099 1296,1095 +L 2314,671 2318,681 2338,686 2340,674 2314,671 +L 2352,1090 2348,1109 2358,1102 2352,1090 +L 665,249 673,277 682,267 675,250 665,249 +L 132,219 116,234 121,256 129,228 136,233 132,219 +L 2023,1094 2013,1107 2024,1105 2023,1094 +L 1262,1095 1257,1101 1263,1105 1262,1095 +L -40,277 -57,290 -49,300 -36,291 -40,277 +L 614,1091 634,1103 631,1092 614,1091 +L 1519,360 1501,372 1503,384 1511,368 1542,376 1519,360 +L 1374,1681 1382,1681 1387,1662 1373,1657 1374,1681 +L 1536,595 1533,608 1542,618 1551,599 1536,595 +L 1115,1089 1098,1099 1110,1101 1115,1089 +L 780,533 765,534 758,545 739,541 762,553 766,537 788,542 780,533 +L 2976,1091 2970,1098 2979,1100 2976,1091 +L 184,157 167,166 168,175 193,166 184,157 +L 350,391 352,414 370,393 350,391 +L 2777,925 2762,927 2763,950 2756,953 2765,952 2777,925 +L 885,1074 887,1093 894,1080 885,1074 +L 220,46 214,53 208,73 229,56 220,46 +L 2165,1078 2166,1087 2185,1089 2173,1078 2165,1078 +L 2013,1080 2004,1083 2012,1089 2013,1080 +L 1201,448 1187,468 1205,473 1201,448 +L 97,1075 89,1084 103,1082 97,1075 +L 2961,623 2979,632 2973,635 2987,641 2985,649 2997,642 2997,629 2989,635 2961,623 +L 169,14 177,53 181,19 169,14 +L 1710,367 1717,396 1728,394 1720,383 1735,377 1721,379 1710,367 +L 516,101 509,121 515,127 526,104 516,101 +L 954,300 937,314 943,320 962,307 954,300 +L 1502,483 1494,503 1506,504 1512,494 1502,483 +L 1242,1059 1237,1075 1244,1079 1242,1059 +L 156,549 161,570 179,564 156,549 +L 2209,1071 2204,1076 2215,1078 2209,1071 +L 2948,645 2940,659 2960,660 2959,649 2948,645 +L 869,1062 875,1075 884,1073 869,1062 +L 103,1061 98,1065 112,1071 103,1061 +L 2171,1064 2165,1070 2180,1071 2171,1064 +L 1377,1052 1369,1061 1380,1070 1377,1052 +L 867,1051 855,1067 869,1062 867,1051 +L 837,1039 831,1064 838,1051 837,1039 +L 577,52 569,61 587,69 594,63 577,52 +L 1269,1035 1251,1063 1268,1049 1269,1035 +L 2187,1042 2173,1062 2192,1063 2180,1058 2187,1042 +L 2066,1044 2063,1054 2054,1050 2056,1063 2074,1051 2066,1044 +L 2187,2063 2168,2050 2160,2056 2162,2065 2173,2058 2181,2076 2179,2063 2187,2063 +L 1228,1052 1224,1061 1235,1062 1228,1052 +L 1207,1048 1204,1059 1213,1057 1207,1048 +L 1588,407 1587,430 1603,454 1588,407 +L 3099,918 3079,933 3067,931 3082,938 3083,948 3099,918 +L 1172,1041 1167,1049 1188,1056 1172,1041 +L 667,206 686,234 681,217 687,207 667,206 +L 3005,1048 3002,1054 3010,1054 3005,1048 +L 607,1036 600,1045 607,1047 607,1036 +L 3027,408 3018,437 3040,409 3027,408 +L 2659,1028 2649,1039 2663,1044 2659,1028 +L 278,1036 275,1043 302,1039 278,1036 +L 1384,933 1369,946 1395,949 1384,933 +L 2854,1026 2832,1041 2812,1040 2833,1042 2854,1026 +L 904,-53 924,-33 938,-38 904,-53 +L 1888,160 1881,192 1897,173 1888,160 +L 2054,529 2037,531 2060,542 2067,533 2054,529 +L 242,131 227,150 252,143 242,131 +L 2679,732 2677,753 2685,758 2690,748 2679,732 +L 194,326 194,339 182,343 195,351 199,342 206,345 194,326 +L 1014,382 1016,399 1004,392 1001,403 1016,402 1023,387 1014,382 +L 1585,599 1572,620 1591,617 1585,599 +L 3682,-62 3689,-53 3709,-52 3706,-60 3682,-62 +L 2719,687 2730,713 2742,704 2732,707 2730,690 2719,687 +L 876,1018 873,1027 880,1027 876,1018 +L 2600,185 2592,187 2593,213 2601,200 2600,185 +L 1731,505 1736,485 1719,485 1731,505 +L 1830,190 1831,208 1849,193 1830,190 +L 1792,153 1788,172 1801,169 1799,154 1792,153 +L 2811,905 2797,933 2822,907 2811,905 +L 1446,1848 1453,1837 1432,1822 1446,1848 +L 283,185 282,196 304,205 302,192 294,197 283,185 +L 2511,421 2498,426 2507,448 2511,421 +L 2398,414 2381,423 2378,433 2396,419 2419,424 2398,414 +L 606,1009 610,1021 615,1016 606,1009 +L 3580,33 3574,49 3595,48 3580,33 +L 1211,1019 1231,1017 1224,1009 1209,1009 1211,1019 +L 783,918 764,928 759,918 756,932 780,928 783,918 +L 1260,568 1238,573 1254,584 1260,568 +L 2085,1003 2080,1013 2092,1012 2085,1003 +L 912,1005 906,1008 912,1013 912,1005 +L 2282,559 2275,571 2261,568 2285,582 2282,559 +L 616,711 652,733 660,729 616,711 +L 3115,745 3103,776 3115,776 3108,775 3110,764 3119,766 3115,745 +L 1509,584 1508,597 1519,605 1519,589 1509,584 +L 614,33 612,54 595,63 621,56 614,33 +L 2136,92 2137,118 2148,97 2136,92 +L 2650,988 2644,998 2633,994 2643,1002 2650,988 +L 1086,991 1085,998 1092,992 1086,991 +L 3111,309 3104,338 3121,311 3111,309 +L 1390,642 1375,657 1404,648 1390,642 +L 2705,979 2699,986 2708,986 2705,979 +L 3619,118 3624,147 3613,171 3631,135 3619,118 +L 2193,-19 2185,-3 2209,-14 2193,-19 +L 2670,948 2658,980 2671,964 2670,948 +L 3091,967 3094,978 3104,973 3091,967 +L 2817,954 2803,969 2808,977 2808,967 2823,963 2817,954 +L 2809,941 2792,953 2808,959 2809,941 +L 3134,851 3116,877 3130,873 3134,851 +L 2132,520 2120,529 2143,536 2132,520 +L 3083,948 3071,963 3076,974 3083,948 +L 3068,708 3053,710 3054,729 3068,708 +L 2942,964 2932,965 2926,970 2942,964 +L 2911,212 2901,222 2908,238 2906,220 2916,227 2922,218 2916,223 2911,212 +L 3268,721 3241,753 3270,729 3268,721 +L 1084,435 1083,444 1091,442 1093,426 1084,426 1084,435 +L 1231,952 1234,964 1241,959 1231,952 +L 418,415 409,426 425,437 418,415 +L 857,56 852,75 861,81 869,70 856,69 857,56 +L 1046,466 1040,483 1054,489 1046,466 +L 3827,-6 3818,-5 3825,1 3810,25 3817,17 3830,6 3827,-6 +L 158,243 145,245 147,257 155,257 158,243 +L 3890,48 3880,84 3889,82 3895,92 3895,79 3884,73 3890,48 +L 970,351 963,371 977,369 970,351 +L 339,222 337,244 350,234 339,222 +L 47,937 26,950 59,942 47,937 +L 1836,468 1809,473 1807,483 1836,468 +L 658,388 654,406 658,399 671,410 681,401 666,404 658,388 +L 2405,936 2394,940 2398,950 2405,936 +L 1669,300 1668,310 1648,319 1685,307 1669,300 +L 1558,-57 1555,-49 1564,-43 1573,-50 1558,-57 +L 3125,932 3111,948 3124,943 3125,932 +L 1633,633 1617,641 1633,649 1633,633 +L 216,-49 194,-47 212,-37 216,-49 +L 2814,924 2809,941 2820,929 2814,924 +L 2868,931 2859,938 2865,941 2868,931 +L 3055,926 3057,940 3067,931 3055,926 +L 350,519 333,536 364,520 350,519 +L 2385,141 2393,162 2407,167 2385,141 +L 129,729 129,744 140,744 140,736 129,729 +L 750,903 743,905 745,935 750,903 +L 87,920 70,935 88,930 87,920 +L 183,920 176,922 182,935 183,920 +L 634,887 631,898 630,919 639,896 634,887 +L 1193,917 1180,933 1199,923 1193,917 +L 461,386 458,402 465,403 470,391 461,386 +L 3142,919 3125,928 3138,931 3142,919 +L 2042,285 2028,295 2043,302 2039,293 2047,291 2042,285 +L 931,920 929,930 939,921 931,920 +L 2857,918 2853,928 2862,927 2857,918 +L 1466,920 1468,928 1478,921 1466,920 +L 3157,796 3142,808 3145,822 3157,796 +L 1720,247 1722,261 1741,272 1720,247 +L 3110,891 3100,899 3099,917 3110,891 +L 3045,909 3040,916 3048,917 3045,909 +L 1260,789 1243,793 1244,807 1260,789 +L 3099,360 3085,367 3090,373 3102,369 3099,360 +L 100,905 97,912 106,911 100,905 +L 662,294 646,300 666,307 662,294 +L 11,896 6,911 16,901 11,896 +L 139,896 130,898 148,910 139,896 +L 2688,899 2679,909 2688,909 2688,899 +L 1269,315 1264,348 1271,348 1269,315 +L 756,165 745,169 753,183 761,178 753,174 756,165 +L 3655,84 3644,93 3651,98 3653,95 3662,94 3655,84 +L 215,599 193,627 213,612 215,599 +L 1311,35 1305,67 1312,68 1311,35 +L 3110,891 3115,878 3106,878 3110,891 +L 1704,881 1697,884 1705,890 1704,881 +L 851,409 842,421 855,429 851,409 +L 3057,874 3046,875 3048,886 3060,880 3057,874 +L 1196,869 1194,875 1199,885 1196,869 +L 959,415 974,432 975,418 959,415 +L 695,858 690,877 701,868 695,858 +L 3123,-23 3106,-18 3114,-7 3123,-23 +L 161,749 137,758 146,764 161,749 +L 3094,865 3089,872 3099,872 3094,865 +L 3057,864 3046,871 3057,872 3057,864 +L 1254,811 1242,818 1262,825 1254,811 +L 1030,251 1023,272 1038,259 1030,251 +L 893,853 888,868 903,855 893,853 +L 763,636 765,645 753,649 761,654 772,645 763,636 +L 3063,850 3061,866 3074,857 3063,850 +L 972,492 959,495 957,512 972,492 +L 775,302 770,313 789,314 775,302 +L 654,233 667,230 663,223 652,223 654,233 +L 596,690 580,696 592,695 590,705 602,696 596,690 +L 730,852 719,855 727,861 730,852 +L 2363,344 2358,354 2365,360 2371,352 2363,344 +L 607,850 600,854 596,859 607,850 +L 2444,400 2439,415 2446,413 2453,401 2444,400 +L -44,334 -57,346 -46,352 -44,334 +L 808,843 799,847 811,858 808,843 +L 847,837 838,849 848,857 847,837 +L 1375,36 1375,51 1389,59 1375,36 +L 3565,-24 3565,-16 3569,-1 3573,-22 3565,-24 +L 1630,-54 1627,-40 1642,-41 1630,-54 +L 903,618 896,627 904,646 903,618 +L 1222,604 1196,609 1205,615 1222,604 +L 2302,834 2289,835 2302,844 2302,834 +L 831,417 824,420 835,431 839,423 831,417 +L 63,531 55,550 70,539 63,531 +L 1158,831 1153,841 1163,835 1158,831 +L 2036,152 2026,164 2039,168 2036,152 +L 2232,822 2231,838 2238,836 2232,822 +L 2220,542 2212,545 2218,567 2220,542 +L 850,1 844,18 855,19 850,1 +L 525,820 527,833 532,821 525,820 +L 2163,756 2151,759 2163,772 2163,756 +L 2521,819 2511,826 2513,831 2521,819 +L 2726,79 2719,90 2737,89 2726,79 +L 2507,565 2505,575 2523,580 2507,565 +L 2570,812 2569,825 2580,826 2582,819 2570,823 2570,812 +L 2393,162 2369,165 2384,171 2393,162 +L 1723,311 1711,319 1727,324 1723,311 +L 48,522 35,525 41,538 48,522 +L 929,810 922,824 938,817 929,810 +L 258,88 258,105 269,90 258,88 +L 945,797 930,798 932,808 941,803 945,797 +L 3792,303 3783,314 3822,309 3794,310 3792,303 +L 1667,469 1662,485 1677,474 1667,469 +L 3117,806 3113,815 3122,812 3117,806 +L 645,640 643,646 650,656 655,648 645,640 +L 1710,320 1697,333 1702,342 1710,320 +L 3862,76 3871,92 3879,86 3862,76 +L 264,46 244,64 263,56 264,46 +L 2699,56 2705,79 2710,68 2699,56 +L 1496,194 1489,217 1501,203 1496,194 +L 3027,171 3042,149 3034,149 3027,171 +L 1599,631 1597,643 1612,640 1599,631 +L 2619,796 2611,805 2625,800 2619,796 +L 199,130 213,140 222,134 199,130 +L 660,663 652,673 666,677 660,663 +L 919,562 907,567 915,578 919,562 +L 3205,292 3199,312 3213,294 3205,292 +L 908,158 925,170 928,162 908,158 +L 757,26 734,29 753,34 757,26 +L 26,274 16,271 12,287 26,274 +L 1492,786 1487,791 1497,792 1492,786 +L 447,557 429,567 455,562 447,557 +L 1037,528 1034,544 1045,542 1037,528 +L 622,416 614,422 621,429 627,423 622,416 +L 661,99 659,117 670,103 661,99 +L 633,612 625,619 641,626 633,612 +L 779,504 781,520 790,508 779,504 +L 1603,454 1603,468 1615,466 1603,454 +L 621,183 615,190 625,201 620,192 630,188 621,183 +L 643,545 640,565 651,547 643,545 +L 443,756 439,766 448,766 443,756 +L 3843,-5 3835,2 3846,13 3843,-5 +L 4101,-55 4080,-52 4086,-45 4101,-55 +L 2172,553 2172,571 2181,560 2172,553 +L 2089,755 2095,764 2099,758 2089,755 +L 946,749 936,758 923,755 941,761 946,749 +L 2063,109 2046,118 2047,127 2063,109 +L 2863,215 2872,226 2885,224 2863,215 +L 3460,0 3452,19 3463,13 3460,0 +L 3090,82 3102,62 3094,62 3090,82 +L 434,-50 418,-44 423,-36 434,-50 +L 1297,531 1291,536 1302,553 1297,531 +L 155,628 141,641 152,632 189,629 155,628 +L 3106,42 3106,55 3118,48 3106,42 +L 940,731 927,734 928,742 940,731 +L 1696,276 1696,298 1703,282 1696,276 +L 1175,11 1186,28 1186,14 1175,11 +L 2269,503 2262,507 2272,523 2269,503 +L 1269,157 1274,138 1266,138 1269,157 +L 2413,711 2408,718 2415,721 2413,711 +L 2459,707 2455,714 2464,711 2459,707 +L 618,577 624,589 632,580 618,577 +L 2720,-50 2713,-31 2722,-34 2720,-50 +L 676,697 669,698 684,705 676,697 +L 923,-27 914,-14 922,-9 923,-27 +L 718,36 707,42 717,50 718,36 +L 1434,295 1427,302 1443,307 1434,295 +L 2995,687 2984,696 2989,702 2995,687 +L 2389,688 2375,695 2380,701 2389,688 +L 538,688 545,698 549,697 538,688 +L 2427,413 2422,431 2434,417 2427,413 +L 274,365 268,377 283,371 274,365 +L 691,677 687,678 687,692 691,677 +L 291,78 281,84 290,93 291,78 +L 183,4 183,22 191,5 183,4 +L 645,678 627,681 641,686 645,678 +L 843,2475 833,2483 836,2495 843,2475 +L 1570,569 1557,582 1568,582 1570,569 +L -59,492 -58,505 -47,505 -59,492 +L 1815,602 1836,624 1838,612 1834,617 1815,602 +L 841,570 830,575 834,586 841,570 +L 5,490 -15,502 -10,506 5,490 +L 708,663 706,675 716,675 708,663 +L 1016,481 1030,495 1028,483 1016,481 +L 644,327 631,328 640,338 644,327 +L 741,660 734,665 740,670 741,660 +L 2981,376 2978,389 2990,383 2981,376 +L 831,308 829,330 837,311 831,308 +L 220,75 216,80 222,91 225,83 220,75 +L 1290,-15 1278,-14 1284,-3 1290,-15 +L 2725,607 2721,619 2735,611 2725,607 +L 455,374 452,381 461,383 465,378 455,374 +L 628,650 614,651 625,659 628,650 +L 2484,643 2479,656 2487,659 2484,643 +L 2233,102 2229,109 2246,113 2233,102 +L 966,97 962,82 953,82 966,97 +L 882,412 869,417 893,418 882,412 +L 2803,364 2792,379 2800,380 2803,364 +L 158,393 156,408 166,398 158,393 +L -60,648 -64,654 -56,654 -60,648 +L 2293,483 2297,500 2301,485 2293,483 +L 2679,643 2662,650 2680,652 2673,649 2679,643 +L 714,651 704,646 696,646 714,651 +L 207,-38 201,-28 212,-25 207,-38 +L 3046,-15 3037,-5 3047,-2 3046,-15 +L 943,481 933,489 946,491 943,481 +L 2963,637 2961,646 2969,638 2963,637 +L 3531,467 3521,469 3518,482 3531,467 +L 120,257 114,264 130,266 120,257 +L 2948,632 2954,642 2963,637 2948,632 +L 1503,297 1506,316 1512,313 1503,297 +L 623,519 618,531 629,529 623,519 +L 927,467 923,476 937,475 927,467 +L 308,330 294,333 302,340 308,330 +L 1611,507 1603,510 1606,524 1611,507 +L 285,564 299,571 304,565 285,564 +L 134,110 145,103 128,103 134,110 +L 671,623 669,632 676,631 671,623 +L 2890,40 2898,53 2904,48 2890,40 +L 273,466 274,478 284,481 273,466 +L 1474,152 1465,170 1473,167 1474,152 +L 1295,89 1286,101 1298,98 1295,89 +L 2254,484 2252,498 2261,493 2254,484 +L 657,87 662,96 671,89 657,87 +L -14,348 -25,353 -24,363 -14,348 +L 826,264 828,271 843,266 826,264 +L 1761,608 1756,617 1763,619 1761,608 +L 3620,-26 3611,-12 3623,-18 3620,-26 +L 301,231 299,242 310,238 301,231 +L 652,610 648,618 661,614 652,610 +L 1553,38 1544,43 1561,46 1553,38 +L 1285,418 1290,429 1296,420 1285,418 +L 1023,599 1017,601 1022,608 1023,599 +L 3096,344 3090,353 3099,358 3096,344 +L 2122,590 2114,599 2128,597 2122,590 +L 543,286 543,297 553,299 543,286 +L 1410,266 1407,279 1418,267 1410,266 +L 749,-21 742,-16 749,-6 749,-21 +L 732,584 726,588 733,593 732,584 +L 2255,586 2243,590 2255,590 2255,586 +L 2093,1027 2086,1020 2078,1027 2093,1027 +L 1180,406 1177,423 1184,418 1180,406 +L 2370,381 2379,405 2392,397 2380,401 2370,381 +L 1648,-30 1641,-20 1654,-24 1648,-30 +L 660,119 662,134 667,121 660,119 +L 252,491 243,499 251,503 252,491 +L 247,-10 246,1 255,2 247,-10 +L 1105,473 1112,462 1103,462 1105,473 +L 1564,511 1572,524 1574,515 1564,511 +L 2389,368 2379,372 2391,377 2389,368 +L 2165,1078 2158,1064 2158,1078 2165,1078 +L 1075,440 1064,441 1073,449 1075,440 +L 811,302 799,309 806,313 811,302 +L 626,95 619,97 622,110 626,95 +L 1577,554 1568,556 1571,566 1577,554 +L 939,436 939,444 951,446 939,436 +L 601,21 597,29 610,27 601,21 +L 2868,411 2857,412 2862,420 2868,411 +L 223,156 212,162 220,166 223,156 +L 3555,22 3553,37 3561,23 3555,22 +L 491,287 484,294 490,301 491,287 +L 243,21 233,22 234,31 243,21 +L 222,449 212,459 225,455 222,449 +L 1329,364 1320,374 1329,374 1329,364 +L 508,180 514,192 518,185 508,180 +L 75,555 69,560 80,559 75,555 +L 2263,543 2259,550 2269,554 2263,543 +L 1015,216 1010,228 1017,229 1015,216 +L 2039,-15 2030,-14 2036,-5 2039,-15 +L 1871,541 1870,551 1877,542 1871,541 +L 780,343 771,348 781,352 780,343 +L 660,316 662,324 671,317 660,316 +L 803,213 807,220 817,216 803,213 +L 2187,29 2179,35 2176,48 2187,29 +L 243,305 236,313 244,316 243,305 +L 857,39 859,46 869,40 857,39 +L 3029,-22 3021,-11 3027,-9 3029,-22 +L 808,-51 807,-40 815,-46 808,-51 +L 365,341 372,332 363,332 365,341 +L 1068,321 1077,330 1080,324 1068,321 +L 364,313 364,323 372,323 364,313 +L 1034,219 1026,220 1034,229 1034,219 +L 726,157 722,168 730,166 726,157 +L 3739,-50 3729,-45 3733,-39 3739,-50 +L 310,518 300,526 311,525 310,518 +L 414,238 417,247 424,242 414,238 +L 2090,1182 2097,1187 2100,1178 2090,1182 +L 161,172 162,161 155,161 161,172 +L 35,82 28,91 35,93 35,82 +L 566,319 560,327 568,329 566,319 +L 994,19 997,30 1002,23 994,19 +L 1008,442 999,448 1010,449 1008,442 +L -56,512 -63,518 -56,522 -56,512 +L 246,262 247,274 253,272 246,262 +L 1724,45 1719,54 1727,54 1724,45 +L 3073,-63 3069,-54 3077,-54 3073,-63 +L 2999,394 2994,402 3006,397 2999,394 +L 3374,-52 3372,-41 3379,-44 3374,-52 +L 540,230 532,233 542,238 540,230 +L 2874,122 2873,132 2880,132 2874,122 +L 1302,1566 1315,1568 1310,1562 1302,1566 +L 523,294 517,301 524,304 523,294 +L 502,269 500,279 507,277 502,269 +L 1268,55 1273,64 1277,58 1268,55 +L 744,324 747,334 752,329 744,324 +L 607,417 604,424 614,422 607,417 +L 989,362 984,370 992,370 989,362 +L 1516,271 1518,278 1526,274 1516,271 +L 788,202 784,210 793,208 788,202 +L 2383,494 2381,501 2389,496 2383,494 +L 595,163 592,173 599,171 595,163 +L 1576,30 1574,41 1581,34 1576,30 +L 1285,102 1278,106 1283,112 1285,102 +L 1784,493 1777,498 1792,496 1784,493 +L 213,12 214,23 219,17 213,12 +L 1311,453 1308,460 1317,459 1311,453 +L 2772,311 2767,316 2776,319 2772,311 +L 237,76 234,82 244,82 237,76 +L 3738,314 3730,316 3743,320 3738,314 +L 575,413 578,405 571,405 575,413 +L 678,320 672,325 688,321 678,320 +L 3651,151 3645,157 3658,153 3651,151 +L 3672,44 3669,51 3678,48 3672,44 +L 122,327 115,330 121,335 122,327 +L 1697,470 1691,474 1699,477 1697,470 +L 295,214 291,220 300,219 295,214 +L 3711,-50 3709,-43 3717,-47 3711,-50 +L 896,189 891,195 898,196 896,189 +L 1621,229 1625,236 1628,230 1621,229 +L 520,242 515,246 528,244 520,242 +L 667,171 662,175 670,177 667,171 +L 2191,411 2186,417 2183,427 2191,411 +L 1304,337 1296,340 1292,345 1304,337 +L 3232,450 3227,454 3223,462 3232,450 diff --git a/src/Triangle.Tests/Robustness/Data/Public/earcut-water.txt b/src/Triangle.Tests/Robustness/Data/Public/earcut-water.txt new file mode 100644 index 0000000..c6bcac4 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/earcut-water.txt @@ -0,0 +1,11 @@ +# earcut/water +L 2293,4224 2294,4219 2280,4180 2288,4172 2283,4189 2301,4218 2299,4224 2347,4224 2344,4215 2351,4224 2371,4224 2379,4224 2375,4206 2363,4202 2346,4194 2371,4195 2376,4180 2383,4202 2429,4176 2431,4163 2439,4161 2438,4144 2464,4124 2457,4111 2467,4102 2473,4060 2482,4053 2488,4031 2467,3982 2456,3991 2456,4005 2451,3998 2451,4014 2432,4011 2433,4025 2427,4012 2415,4009 2438,4003 2419,3990 2411,3987 2391,4000 2391,3989 2374,3991 2382,3995 2363,4028 2364,4042 2380,4041 2389,4029 2387,4053 2412,4055 2376,4059 2389,4085 2381,4093 2371,4076 2363,4082 2372,4067 2362,4059 2347,4054 2349,4040 2344,4057 2325,4063 2322,4073 2332,4078 2325,4086 2317,4082 2308,4065 2321,4063 2299,4051 2312,4056 2326,4055 2325,4044 2302,4021 2315,4029 2324,4023 2333,4040 2335,4026 2349,4016 2333,3999 2318,4002 2333,3991 2321,3985 2350,4000 2350,3962 2331,3964 2340,3949 2332,3946 2341,3943 2345,3952 2358,3947 2350,3922 2362,3931 2363,3922 2368,3946 2377,3946 2388,3933 2378,3908 2389,3920 2393,3948 2401,3924 2400,3911 2382,3899 2388,3875 2366,3885 2350,3878 2340,3896 2327,3880 2323,3900 2313,3894 2300,3871 2307,3890 2331,3872 2317,3867 2345,3852 2343,3840 2351,3843 2348,3823 2339,3821 2341,3805 2350,3828 2379,3853 2385,3844 2368,3823 2370,3809 2362,3809 2361,3793 2372,3804 2379,3795 2376,3823 2388,3815 2402,3822 2393,3832 2384,3824 2404,3860 2407,3876 2416,3872 2418,3852 2427,3876 2409,3893 2429,3921 2484,3863 2478,3792 2440,3820 2439,3834 2438,3820 2426,3809 2435,3801 2421,3794 2429,3786 2406,3752 2424,3748 2440,3762 2431,3732 2415,3735 2412,3721 2391,3707 2381,3720 2382,3732 2370,3724 2382,3716 2372,3705 2380,3708 2378,3687 2368,3685 2349,3710 2338,3694 2337,3708 2324,3706 2327,3717 2316,3729 2323,3715 2309,3714 2318,3713 2311,3699 2332,3698 2334,3678 2356,3670 2343,3651 2332,3649 2335,3658 2324,3655 2323,3670 2324,3661 2311,3661 2332,3640 2316,3633 2286,3655 2302,3631 2277,3610 2269,3619 2250,3619 2250,3630 2239,3635 2244,3650 2228,3660 2236,3679 2226,3666 2207,3677 2199,3672 2235,3648 2232,3621 2240,3624 2249,3605 2229,3607 2219,3593 2209,3597 2218,3587 2202,3586 2201,3576 2180,3583 2177,3598 2178,3573 2165,3548 2153,3544 2148,3519 2154,3506 2139,3492 2141,3484 2149,3492 2186,3568 2207,3567 2233,3585 2231,3533 2248,3519 2248,3532 2238,3536 2247,3547 2238,3549 2237,3574 2260,3602 2261,3586 2272,3598 2294,3599 2288,3559 2300,3578 2303,3610 2324,3615 2341,3612 2342,3596 2330,3591 2342,3588 2346,3561 2348,3612 2363,3604 2365,3582 2374,3590 2376,3576 2386,3591 2403,3596 2387,3598 2370,3598 2364,3636 2379,3621 2387,3653 2400,3620 2414,3623 2402,3632 2397,3650 2411,3667 2410,3682 2427,3678 2420,3667 2425,3649 2443,3653 2426,3651 2433,3664 2429,3672 2440,3671 2440,3681 2426,3688 2454,3700 2457,3689 2462,3698 2456,3717 2499,3696 2488,3686 2498,3690 2499,3682 2520,3700 2503,3702 2499,3713 2510,3706 2518,3708 2513,3730 2530,3746 2521,3746 2546,3760 2549,3777 2574,3779 2550,3768 2536,3721 2551,3725 2555,3750 2578,3746 2564,3704 2554,3709 2542,3694 2563,3704 2571,3682 2602,3652 2577,3623 2568,3629 2581,3639 2576,3655 2561,3636 2560,3648 2549,3634 2524,3637 2531,3625 2564,3627 2537,3582 2530,3591 2534,3554 2522,3558 2519,3574 2506,3576 2504,3595 2493,3598 2502,3592 2505,3572 2513,3563 2502,3559 2517,3548 2527,3551 2533,3539 2518,3523 2503,3538 2485,3535 2479,3545 2478,3535 2467,3540 2466,3555 2454,3547 2443,3562 2450,3547 2437,3543 2462,3542 2459,3532 2470,3535 2477,3525 2500,3530 2496,3515 2515,3515 2527,3502 2503,3482 2481,3486 2453,3506 2462,3496 2461,3485 2496,3481 2490,3464 2467,3463 2479,3445 2458,3437 2430,3471 2391,3471 2403,3470 2410,3460 2428,3464 2450,3428 2435,3418 2426,3429 2437,3412 2418,3406 2415,3415 2388,3419 2411,3403 2395,3399 2404,3392 2385,3384 2366,3406 2347,3410 2384,3376 2370,3365 2347,3376 2327,3371 2376,3358 2372,3347 2357,3342 2331,3350 2334,3342 2361,3335 2363,3326 2321,3317 2303,3328 2312,3311 2320,3316 2270,3302 2257,3308 2263,3321 2248,3330 2257,3316 2246,3300 2238,3323 2227,3318 2227,3304 2243,3294 2253,3297 2249,3282 2232,3278 2242,3274 2242,3266 2258,3264 2257,3255 2269,3248 2292,3263 2278,3245 2259,3239 2278,3244 2281,3231 2266,3217 2252,3217 2250,3196 2228,3218 2220,3219 2237,3199 2215,3194 2243,3196 2237,3177 2209,3171 2189,3154 2157,3144 2144,3152 2151,3141 2139,3130 2122,3148 2113,3127 2125,3142 2130,3117 2147,3119 2149,3128 2167,3120 2169,3146 2187,3143 2212,3166 2224,3161 2225,3173 2243,3145 2244,3156 2235,3162 2254,3175 2272,3176 2289,3165 2286,3182 2274,3178 2268,3195 2304,3196 2310,3180 2323,3209 2339,3214 2349,3249 2359,3249 2357,3295 2359,3287 2385,3284 2368,3300 2393,3315 2388,3339 2401,3357 2414,3352 2410,3342 2422,3334 2417,3348 2435,3354 2416,3357 2420,3376 2436,3385 2452,3381 2444,3384 2447,3396 2466,3394 2479,3417 2490,3400 2499,3452 2529,3469 2531,3481 2547,3497 2554,3488 2565,3503 2579,3490 2569,3465 2591,3499 2589,3527 2600,3518 2606,3498 2604,3456 2589,3465 2591,3456 2572,3442 2583,3440 2582,3430 2571,3419 2557,3420 2570,3415 2580,3423 2580,3409 2530,3373 2587,3402 2595,3447 2604,3413 2598,3436 2609,3432 2601,3446 2614,3451 2635,3442 2644,3447 2655,3434 2646,3429 2646,3411 2632,3413 2650,3405 2646,3393 2610,3389 2619,3383 2603,3373 2616,3372 2623,3384 2646,3388 2650,3359 2612,3347 2641,3355 2643,3345 2654,3359 2648,3382 2662,3381 2654,3413 2659,3426 2673,3429 2673,3417 2685,3418 2679,3396 2695,3397 2684,3405 2693,3416 2686,3425 2676,3422 2684,3439 2669,3471 2676,3482 2688,3472 2684,3453 2711,3444 2698,3444 2710,3426 2702,3424 2716,3422 2737,3403 2731,3374 2746,3381 2744,3399 2765,3387 2745,3326 2735,3313 2715,3318 2724,3314 2739,3307 2666,3259 2658,3286 2668,3292 2656,3294 2655,3312 2642,3304 2656,3286 2645,3286 2653,3278 2644,3273 2662,3259 2637,3234 2591,3240 2555,3270 2578,3246 2574,3238 2585,3239 2596,3228 2583,3210 2576,3218 2580,3208 2545,3209 2529,3198 2517,3209 2513,3182 2491,3203 2495,3222 2488,3230 2483,3213 2491,3208 2476,3207 2486,3201 2483,3187 2471,3185 2460,3193 2466,3183 2452,3158 2426,3163 2418,3175 2434,3195 2435,3211 2424,3200 2426,3185 2413,3177 2403,3190 2405,3205 2395,3210 2398,3198 2383,3205 2384,3194 2400,3195 2414,3172 2393,3157 2362,3192 2364,3183 2356,3180 2371,3170 2364,3166 2379,3166 2360,3150 2394,3153 2398,3135 2401,3147 2408,3128 2395,3126 2386,3114 2377,3117 2371,3106 2351,3105 2343,3109 2360,3098 2380,3105 2376,3090 2355,3081 2362,3073 2358,3041 2339,3025 2334,3010 2314,3000 2335,3006 2349,3032 2359,3025 2370,3073 2384,3089 2388,3072 2411,3063 2422,3047 2417,3063 2394,3072 2384,3101 2400,3113 2418,3094 2412,3108 2423,3106 2426,3117 2446,3119 2446,3141 2466,3128 2456,3108 2460,3097 2471,3117 2487,3107 2470,3122 2479,3137 2485,3127 2499,3130 2506,3106 2528,3101 2529,3109 2515,3113 2529,3135 2526,3114 2541,3130 2558,3114 2561,3101 2548,3102 2535,3087 2555,3094 2544,3073 2562,3099 2576,3101 2585,3096 2580,3079 2588,3073 2605,3065 2615,3073 2632,3084 2628,3071 2620,3067 2600,3039 2612,3046 2634,3071 2642,3082 2646,3073 2646,3083 2672,3093 2677,3106 2670,3071 2652,3011 2659,2936 2636,2937 2629,2961 2636,2973 2617,2976 2629,2992 2618,2988 2599,2996 2613,2989 2613,2967 2604,2973 2609,2958 2598,2962 2586,2962 2583,2975 2581,2965 2565,2975 2574,2963 2537,2964 2536,2984 2535,2961 2512,2973 2501,2962 2531,2959 2530,2951 2538,2957 2553,2954 2578,2954 2604,2944 2618,2953 2610,2939 2574,2946 2541,2926 2576,2938 2618,2927 2634,2921 2552,2863 2521,2805 2498,2823 2494,2838 2503,2847 2493,2842 2455,2853 2485,2877 2459,2862 2443,2871 2449,2888 2429,2873 2430,2861 2416,2880 2421,2900 2408,2887 2388,2915 2420,2868 2412,2855 2441,2851 2455,2834 2447,2809 2421,2784 2423,2796 2395,2818 2400,2827 2387,2823 2384,2844 2376,2841 2367,2847 2371,2858 2348,2865 2347,2879 2325,2871 2326,2891 2308,2884 2298,2898 2297,2888 2283,2893 2283,2884 2312,2880 2294,2859 2316,2872 2315,2862 2349,2857 2333,2848 2360,2850 2358,2840 2369,2834 2339,2821 2309,2824 2310,2815 2328,2816 2342,2814 2340,2804 2357,2819 2360,2798 2365,2818 2379,2820 2391,2793 2409,2789 2392,2771 2392,2782 2384,2779 2370,2792 2368,2783 2356,2785 2366,2775 2375,2783 2373,2774 2389,2773 2360,2717 2360,2707 2377,2698 2356,2669 2364,2645 2355,2642 2360,2633 2339,2644 2342,2629 2324,2645 2312,2639 2310,2616 2275,2627 2229,2610 2219,2563 2234,2585 2252,2578 2270,2589 2286,2553 2266,2527 2255,2528 2235,2496 2221,2505 2230,2489 2220,2497 2225,2486 2210,2479 2185,2482 2190,2517 2171,2513 2171,2500 2162,2517 2144,2518 2121,2472 2096,2474 2076,2458 2094,2427 2087,2410 2095,2408 2104,2408 2105,2444 2126,2453 2136,2471 2152,2458 2142,2448 2159,2433 2196,2452 2216,2442 2225,2451 2232,2441 2223,2420 2217,2428 2223,2416 2215,2425 2219,2412 2210,2420 2213,2409 2207,2417 2197,2397 2170,2407 2154,2398 2150,2376 2132,2372 2132,2360 2143,2364 2143,2356 2158,2373 2176,2372 2166,2375 2167,2385 2192,2374 2202,2384 2199,2373 2208,2368 2225,2380 2228,2392 2250,2393 2253,2411 2257,2423 2246,2426 2257,2428 2246,2431 2257,2438 2248,2447 2257,2459 2268,2456 2269,2469 2276,2452 2286,2468 2285,2451 2294,2450 2295,2465 2304,2453 2304,2464 2340,2491 2352,2462 2339,2446 2342,2433 2357,2470 2345,2510 2362,2534 2389,2522 2408,2524 2409,2559 2418,2574 2398,2596 2450,2560 2456,2541 2445,2541 2461,2531 2440,2529 2437,2519 2467,2522 2474,2513 2460,2501 2437,2505 2447,2498 2433,2476 2447,2493 2439,2469 2449,2475 2456,2497 2462,2489 2477,2501 2489,2493 2488,2485 2468,2477 2473,2460 2461,2455 2462,2446 2486,2477 2507,2485 2509,2472 2518,2469 2505,2458 2514,2462 2522,2451 2512,2414 2493,2409 2505,2409 2516,2401 2517,2412 2533,2405 2519,2414 2522,2438 2554,2449 2525,2453 2527,2462 2541,2463 2529,2465 2524,2475 2542,2492 2521,2481 2517,2490 2527,2501 2492,2499 2494,2516 2475,2543 2487,2578 2466,2581 2461,2594 2470,2601 2458,2602 2471,2608 2458,2609 2470,2612 2468,2625 2455,2633 2475,2634 2454,2640 2456,2652 2468,2652 2462,2661 2481,2677 2481,2671 2499,2671 2501,2639 2527,2635 2513,2645 2511,2676 2515,2664 2565,2659 2565,2614 2563,2589 2571,2569 2587,2575 2604,2570 2572,2584 2572,2592 2587,2588 2584,2594 2594,2594 2578,2606 2594,2613 2626,2608 2630,2590 2619,2589 2633,2586 2634,2572 2642,2572 2638,2598 2635,2613 2642,2605 2618,2624 2622,2642 2604,2675 2611,2691 2626,2699 2643,2671 2620,2670 2642,2663 2624,2659 2628,2645 2640,2649 2635,2637 2645,2638 2653,2625 2660,2639 2647,2655 2655,2662 2676,2660 2684,2667 2676,2657 2698,2605 2754,2571 2743,2564 2753,2537 2723,2564 2687,2563 2673,2544 2627,2520 2633,2509 2617,2501 2613,2511 2594,2512 2615,2487 2591,2457 2597,2444 2587,2421 2599,2423 2602,2413 2570,2381 2538,2365 2525,2340 2498,2347 2511,2334 2508,2322 2495,2321 2485,2302 2459,2293 2458,2281 2468,2271 2483,2280 2486,2262 2498,2265 2487,2288 2503,2296 2517,2291 2528,2304 2551,2311 2558,2335 2562,2313 2552,2307 2548,2290 2562,2302 2567,2322 2591,2296 2574,2321 2565,2332 2589,2352 2601,2338 2593,2353 2600,2361 2636,2366 2638,2355 2646,2352 2643,2336 2651,2352 2658,2343 2653,2354 2661,2363 2644,2361 2642,2371 2651,2375 2635,2374 2639,2413 2650,2416 2631,2451 2641,2454 2642,2479 2671,2475 2702,2501 2717,2497 2726,2504 2731,2491 2721,2477 2735,2496 2746,2498 2734,2473 2764,2425 2742,2435 2741,2419 2752,2418 2756,2407 2743,2403 2756,2396 2745,2389 2756,2389 2761,2380 2763,2397 2787,2379 2794,2397 2800,2387 2792,2370 2803,2363 2795,2356 2764,2357 2762,2344 2761,2363 2753,2361 2742,2372 2750,2359 2741,2357 2715,2378 2719,2360 2702,2371 2709,2361 2695,2343 2713,2354 2722,2350 2714,2327 2722,2329 2731,2352 2740,2346 2732,2334 2750,2346 2752,2318 2744,2320 2736,2307 2723,2306 2725,2316 2723,2301 2714,2290 2710,2304 2702,2304 2702,2313 2693,2318 2685,2320 2686,2310 2704,2299 2703,2289 2683,2300 2675,2294 2673,2303 2665,2298 2653,2304 2662,2298 2657,2289 2669,2293 2668,2283 2678,2289 2677,2277 2683,2285 2694,2282 2693,2266 2677,2264 2675,2254 2653,2260 2654,2270 2642,2269 2647,2259 2635,2266 2620,2242 2636,2256 2652,2253 2629,2228 2623,2204 2645,2235 2669,2245 2658,2225 2646,2205 2660,2213 2677,2198 2668,2223 2680,2227 2677,2236 2717,2275 2695,2228 2713,2238 2722,2259 2737,2242 2740,2218 2722,2199 2719,2182 2727,2191 2730,2177 2742,2169 2733,2198 2738,2208 2744,2188 2756,2187 2748,2188 2743,2208 2755,2209 2747,2236 2750,2247 2760,2245 2743,2262 2742,2274 2755,2270 2766,2291 2770,2261 2783,2253 2783,2274 2797,2272 2797,2262 2806,2267 2808,2290 2796,2294 2795,2305 2809,2309 2833,2291 2851,2258 2836,2266 2826,2257 2845,2248 2833,2244 2833,2235 2813,2245 2805,2227 2787,2242 2773,2224 2789,2229 2797,2219 2781,2202 2798,2214 2808,2209 2809,2220 2825,2230 2834,2227 2830,2215 2839,2207 2840,2218 2849,2223 2860,2203 2848,2185 2836,2195 2819,2192 2836,2189 2837,2179 2825,2164 2824,2156 2794,2148 2799,2140 2790,2130 2813,2149 2822,2147 2821,2133 2835,2159 2877,2174 2870,2160 2875,2149 2856,2150 2846,2131 2838,2134 2829,2109 2841,2122 2848,2110 2858,2117 2865,2103 2851,2093 2860,2092 2858,2083 2869,2100 2867,2110 2876,2110 2868,2121 2874,2135 2886,2133 2895,2116 2890,2138 2896,2157 2909,2148 2932,2155 2940,2177 2952,2172 2908,2089 2923,2075 2923,2049 2929,2028 2895,2023 2885,2002 2871,1999 2861,2014 2837,2011 2832,2021 2851,2042 2828,2033 2831,2049 2828,2049 2814,2049 2826,2029 2811,2019 2795,2032 2801,2018 2755,2011 2757,1995 2749,1996 2750,2007 2732,2008 2733,1998 2704,1994 2715,1985 2695,1987 2713,1981 2753,1987 2772,2002 2788,1999 2788,1988 2792,2001 2828,1999 2856,1952 2837,1954 2828,1933 2815,1928 2860,1933 2854,1971 2863,1959 2872,1966 2874,1936 2882,1933 2892,1956 2896,1943 2905,1942 2911,1961 2954,1975 2966,1967 2992,1968 3021,1984 3036,2021 3030,2047 3022,2078 2973,2093 3007,2095 3051,2113 3055,2128 3044,2153 3043,2189 3066,2238 3069,2269 3049,2299 3073,2303 3094,2306 3103,2225 3136,2196 3135,2188 3126,2194 3168,2163 3157,2149 3163,2130 3141,2120 3137,2109 3141,2083 3120,2077 3119,2109 3115,2078 3104,2078 3115,2074 3112,2064 3088,2062 3078,2047 3083,2035 3092,2042 3094,2033 3106,2038 3122,2017 3115,2006 3103,2008 3105,1998 3132,1971 3125,1979 3107,1972 3107,1956 3093,1963 3081,1966 3101,1952 3089,1939 3101,1935 3121,1953 3124,1964 3142,1956 3131,1919 3111,1905 3105,1918 3103,1908 3086,1912 3099,1897 3092,1887 3077,1887 3093,1881 3103,1894 3102,1874 3093,1869 3105,1870 3111,1858 3110,1895 3124,1899 3131,1881 3144,1877 3133,1886 3146,1889 3133,1891 3168,1888 3172,1866 3183,1858 3187,1826 3176,1824 3194,1797 3178,1774 3162,1766 3156,1779 3117,1761 3119,1775 3097,1784 3092,1795 3097,1783 3096,1772 3082,1774 3110,1736 3127,1740 3138,1756 3159,1740 3187,1737 3203,1725 3210,1699 3190,1698 3192,1690 3205,1682 3235,1684 3241,1675 3262,1675 3272,1637 3286,1633 3260,1692 3238,1703 3239,1732 3231,1767 3217,1783 3258,1823 3270,1815 3249,1859 3209,1900 3211,1916 3183,1980 3196,1975 3194,1987 3203,1997 3195,1995 3175,2017 3194,2030 3207,2029 3194,2046 3179,2049 3186,2075 3215,2074 3232,2105 3250,2117 3273,2089 3330,2061 3341,2049 3370,2001 3344,1990 3321,2016 3321,1997 3311,1995 3307,2006 3305,1984 3291,1993 3294,1972 3287,1985 3266,1991 3272,1999 3262,1999 3268,2009 3258,2004 3247,2014 3239,1990 3232,2003 3235,1987 3248,1976 3232,1931 3249,1880 3283,1873 3280,1883 3254,1882 3246,1919 3237,1925 3256,1964 3266,1955 3266,1968 3288,1957 3277,1953 3281,1942 3293,1948 3316,1916 3298,1954 3313,1970 3339,1952 3324,1969 3332,1984 3347,1968 3364,1980 3375,1976 3387,1964 3378,1953 3389,1962 3399,1946 3408,1946 3396,1937 3412,1943 3429,1933 3390,1971 3390,2008 3402,1974 3451,1903 3477,1909 3508,1895 3556,1852 3573,1824 3616,1797 3610,1781 3599,1780 3601,1795 3581,1797 3584,1806 3575,1800 3573,1783 3573,1772 3579,1792 3577,1762 3585,1760 3584,1783 3601,1792 3595,1778 3608,1779 3609,1771 3602,1756 3619,1769 3630,1746 3609,1734 3622,1726 3633,1673 3625,1656 3616,1662 3603,1637 3627,1651 3604,1630 3588,1604 3564,1640 3570,1625 3553,1620 3541,1601 3527,1597 3525,1569 3523,1539 3534,1502 3533,1531 3544,1544 3542,1553 3556,1554 3546,1571 3558,1578 3555,1596 3587,1546 3603,1473 3627,1443 3625,1422 3667,1400 3667,1370 3651,1351 3682,1339 3722,1374 3778,1376 3760,1362 3748,1337 3784,1353 3807,1317 3809,1292 3822,1285 3817,1297 3825,1325 3807,1354 3832,1359 3824,1361 3827,1369 3864,1376 3877,1401 3897,1405 3907,1393 3894,1372 3903,1353 3897,1343 3906,1344 3916,1320 3943,1312 3974,1284 3993,1285 4015,1251 4016,1224 4038,1198 4057,1198 4055,1187 4073,1191 4062,1199 4074,1200 4069,1208 4070,1220 4065,1247 4057,1255 4067,1262 4057,1256 4042,1296 4022,1317 4034,1330 4024,1334 4005,1320 4005,1344 4009,1369 4025,1379 4012,1378 4004,1394 4028,1418 4017,1429 3987,1431 3971,1442 3972,1476 3957,1504 3952,1553 3942,1580 3928,1593 3932,1638 3923,1673 3881,1719 3880,1735 3894,1743 3926,1726 3923,1713 3952,1698 3956,1664 3976,1664 3979,1651 4000,1650 4003,1622 4022,1623 4023,1611 4040,1604 4036,1592 4062,1588 4062,1573 4087,1555 4095,1555 4111,1553 4115,1537 4127,1533 4121,1502 4104,1505 4096,1492 4112,1499 4112,1478 4140,1496 4160,1481 4200,1507 4224,1474 4224,1532 4190,1541 4159,1541 4133,1596 4137,1606 4178,1607 4218,1604 4224,1600 4224,1660 4208,1675 4211,1663 4203,1664 4222,1658 4194,1643 4175,1662 4175,1679 4156,1678 4161,1687 4140,1688 4138,1680 4148,1682 4128,1651 4097,1650 4070,1649 4043,1687 4056,1707 4095,1718 4082,1720 4076,1739 4078,1727 4057,1724 4052,1713 4030,1710 4030,1698 4011,1694 3982,1748 3976,1783 3959,1802 3925,1812 3906,1845 3899,1878 3908,1864 3920,1880 3920,1871 3945,1880 3949,1887 3935,1887 3939,1900 3911,1900 3906,1910 3908,1885 3893,1900 3894,1887 3884,1881 3807,1927 3795,1949 3802,1978 3593,2033 3585,2049 3571,2080 3524,2110 3517,2123 3516,2140 3532,2163 3529,2177 3536,2167 3561,2172 3575,2164 3577,2174 3549,2180 3565,2191 3571,2211 3624,2208 3642,2181 3633,2209 3658,2215 3666,2233 3650,2240 3649,2226 3620,2230 3610,2225 3611,2215 3582,2225 3572,2218 3556,2222 3544,2213 3550,2197 3538,2180 3515,2183 3492,2211 3514,2208 3529,2215 3538,2235 3573,2263 3551,2256 3551,2247 3508,2218 3497,2225 3499,2240 3489,2242 3495,2251 3478,2222 3482,2204 3496,2201 3492,2177 3473,2183 3469,2173 3449,2171 3416,2188 3408,2213 3373,2236 3372,2260 3392,2266 3397,2277 3395,2310 3412,2312 3424,2326 3422,2345 3461,2323 3458,2334 3435,2347 3420,2377 3423,2387 3439,2383 3453,2390 3454,2406 3446,2397 3429,2391 3416,2421 3429,2428 3404,2425 3421,2404 3412,2398 3409,2362 3424,2364 3386,2337 3358,2377 3330,2383 3327,2413 3317,2430 3319,2451 3328,2475 3341,2479 3353,2469 3345,2477 3350,2495 3358,2493 3369,2510 3390,2502 3389,2510 3411,2510 3370,2515 3382,2540 3391,2541 3380,2550 3356,2506 3334,2492 3318,2495 3324,2515 3318,2503 3310,2498 3315,2488 3299,2467 3305,2435 3296,2430 3299,2420 3289,2427 3269,2463 3277,2460 3282,2481 3268,2466 3259,2491 3248,2537 3260,2547 3251,2543 3247,2555 3245,2543 3231,2579 3214,2595 3197,2630 3206,2627 3203,2639 3177,2701 3135,2759 3116,2805 3104,2876 3111,2884 3138,2885 3148,2820 3144,2798 3154,2834 3141,2892 3154,2875 3169,2870 3157,2851 3165,2826 3177,2824 3170,2813 3178,2799 3202,2789 3213,2794 3189,2797 3178,2816 3193,2826 3175,2830 3171,2848 3186,2880 3193,2859 3205,2853 3193,2869 3203,2878 3201,2904 3188,2906 3175,2883 3165,2900 3154,2884 3150,2905 3183,2933 3193,2924 3216,2933 3202,2943 3200,2962 3207,2972 3205,2988 3223,3007 3194,2987 3195,2998 3229,3061 3243,3129 3240,3182 3258,3195 3250,3204 3241,3199 3247,3212 3215,3281 3073,3283 3071,3283 3032,3283 3004,3303 2976,3371 2979,3405 2970,3445 2943,3481 2943,3494 2922,3493 2951,3507 2939,3508 2932,3528 2947,3520 2931,3530 2940,3549 2920,3528 2880,3594 2860,3665 2858,3698 2867,3707 2847,3750 2857,3750 2848,3751 2853,3863 2876,3855 2854,3866 2849,3917 2820,3998 2821,4035 2842,4044 2856,3991 2890,3967 2918,3973 2908,3941 2912,3906 2919,3946 2924,3926 2930,3937 2923,3962 2932,3957 2923,3972 2951,3940 2928,3836 2933,3820 2922,3857 2923,3835 2907,3828 2904,3812 2922,3826 2936,3790 2926,3778 2918,3784 2914,3758 2900,3761 2915,3749 2907,3715 2914,3700 2922,3762 2935,3749 2929,3727 2956,3736 2955,3712 2969,3763 2988,3763 2992,3722 2979,3716 2979,3701 2998,3681 2975,3653 2959,3649 2946,3662 2958,3641 2953,3631 2933,3642 2929,3631 2939,3625 2934,3609 2945,3617 2918,3606 2932,3599 2923,3593 2938,3593 2941,3601 2952,3594 2955,3613 2963,3616 2954,3620 2969,3621 2980,3627 2979,3638 2985,3630 3000,3642 3000,3622 2983,3621 2994,3612 2975,3584 2985,3592 2984,3572 2995,3591 3002,3551 2993,3527 3007,3553 3006,3601 3016,3595 3040,3577 3017,3529 3032,3527 3036,3554 3058,3554 3047,3564 3045,3587 3036,3598 3019,3614 3026,3645 3036,3653 3034,3663 3025,3658 3027,3687 3019,3682 3007,3691 3014,3715 3033,3724 3043,3800 3059,3796 3041,3737 3057,3689 3051,3680 3059,3680 3067,3675 3061,3654 3073,3642 3073,3663 3077,3637 3073,3628 3065,3625 3064,3605 3073,3622 3081,3621 3085,3612 3090,3571 3093,3607 3075,3651 3079,3671 3102,3651 3086,3674 3097,3669 3123,3640 3124,3651 3138,3647 3125,3661 3152,3732 3161,3721 3169,3736 3171,3723 3188,3727 3186,3706 3159,3700 3148,3665 3161,3677 3165,3664 3176,3660 3173,3649 3181,3644 3170,3634 3181,3632 3181,3622 3172,3625 3176,3598 3161,3609 3148,3604 3144,3623 3132,3611 3109,3614 3120,3605 3113,3574 3121,3580 3125,3606 3141,3601 3139,3592 3158,3598 3153,3573 3143,3572 3139,3563 3158,3566 3161,3576 3175,3567 3183,3546 3194,3557 3190,3545 3179,3542 3190,3543 3191,3533 3177,3532 3191,3531 3191,3513 3204,3506 3211,3538 3206,3526 3197,3546 3205,3561 3217,3558 3224,3568 3212,3573 3222,3576 3230,3566 3250,3562 3251,3576 3260,3569 3265,3578 3264,3589 3255,3590 3259,3600 3270,3601 3274,3592 3293,3596 3278,3596 3269,3609 3273,3620 3261,3620 3264,3611 3248,3614 3230,3590 3230,3648 3253,3651 3258,3631 3268,3627 3277,3626 3294,3644 3302,3633 3308,3658 3296,3662 3295,3683 3318,3690 3318,3675 3318,3685 3331,3685 3318,3691 3326,3713 3318,3749 3322,3774 3320,3830 3332,3821 3331,3794 3341,3772 3340,3814 3348,3806 3367,3807 3374,3794 3368,3767 3378,3753 3370,3729 3382,3741 3388,3718 3385,3692 3392,3701 3394,3688 3396,3736 3378,3764 3377,3804 3370,3816 3341,3823 3313,3975 3340,4009 3347,4053 3375,4064 3358,4069 3352,4090 3363,4085 3363,4095 3363,4097 3351,4097 3336,4132 3339,4140 3347,4136 3338,4143 3333,4172 3343,4187 3350,4178 3342,4153 3358,4157 3364,4144 3376,4143 3370,4133 3382,4134 3382,4126 3397,4133 3412,4121 3411,4107 3426,4095 3447,4079 3434,4095 3422,4108 3430,4116 3415,4123 3432,4132 3381,4147 3388,4166 3375,4160 3354,4196 3357,4209 3374,4204 3370,4224 3394,4224 3407,4205 3415,4210 3423,4197 3440,4196 3436,4184 3446,4195 3462,4189 3471,4195 3431,4202 3426,4213 3407,4224 3492,4224 3492,4214 3504,4219 3519,4197 3519,4205 3534,4208 3540,4194 3554,4190 3555,4177 3543,4181 3542,4146 3532,4145 3547,4138 3541,4097 3542,4085 3529,4075 3539,4068 3538,4079 3546,4082 3571,4062 3595,4025 3604,4025 3622,3995 3611,4014 3613,4022 3593,4031 3578,4058 3585,4067 3577,4064 3550,4085 3555,4097 3563,4098 3556,4120 3574,4111 3556,4126 3558,4139 3550,4148 3563,4173 3586,4157 3586,4140 3593,4151 3603,4135 3609,4145 3635,4134 3588,4160 3565,4189 3570,4199 3645,4193 3605,4203 3608,4214 3591,4201 3586,4215 3573,4206 3563,4209 3563,4201 3553,4204 3540,4221 3546,4224 3275,4224 3266,4212 3279,4218 3289,4199 3274,4194 3279,4180 3261,4189 3271,4177 3266,4168 3263,4158 3287,4177 3299,4162 3252,4108 3248,4128 3238,4106 3246,4101 3220,4105 3228,4123 3206,4134 3212,4120 3194,4119 3201,4110 3191,4095 3179,4089 3186,4069 3171,4059 3165,4072 3161,4085 3159,4075 3149,4081 3145,4068 3157,4065 3148,4061 3167,4049 3164,4029 3156,4017 3151,4027 3152,4035 3137,4038 3137,4057 3132,4040 3124,4037 3136,4030 3128,4014 3140,4016 3140,3987 3180,3967 3175,3949 3100,4026 3096,4037 3108,4063 3091,4065 3079,4085 3071,4081 3056,4084 3047,4074 3033,4097 3018,4123 3013,4192 2988,4224 3027,4224 3044,4223 3040,4206 3046,4219 3051,4224 3074,4224 3074,4216 3076,4224 3116,4224 3111,4198 3098,4192 3094,4178 3075,4180 3069,4127 3080,4145 3084,4173 3089,4165 3100,4169 3124,4202 3132,4190 3125,4181 3134,4185 3139,4173 3127,4143 3138,4148 3157,4136 3154,4122 3144,4124 3155,4117 3153,4109 3166,4134 3140,4155 3146,4172 3131,4214 3133,4224 3161,4224 3164,4180 3176,4203 3203,4177 3199,4162 3213,4155 3207,4166 3216,4186 3208,4187 3205,4199 3189,4197 3188,4215 3170,4221 3169,4224 4224,4224 4224,4224 4224,-128 4224,-128 4224,4224 2293,4224 +L 2681,3125 2665,3123 2657,3113 2655,3124 2640,3119 2663,3099 2642,3105 2640,3089 2618,3108 2622,3138 2622,3153 2653,3192 2652,3210 2685,3144 2681,3125 2681,3125 +L 3189,3788 3205,3783 3206,3763 3193,3756 3189,3788 3189,3788 +L 2264,3287 2274,3283 2269,3270 2264,3287 2264,3287 +L 2436,3801 2448,3809 2446,3798 2462,3796 2473,3772 2449,3781 2436,3801 2436,3801 +L 3142,2365 3155,2362 3162,2350 3157,2333 3137,2341 3122,2401 3142,2382 3142,2365 3142,2365 +L 2761,2561 2769,2563 2780,2549 2761,2561 2761,2561 +L 2923,2209 2910,2200 2893,2208 2898,2222 2888,2211 2896,2176 2880,2194 2862,2195 2864,2218 2876,2232 2865,2227 2886,2247 2879,2258 2884,2266 2892,2260 2894,2239 2912,2246 2917,2236 2916,2251 2907,2248 2924,2290 2934,2286 2922,2272 2928,2254 2955,2248 2946,2241 2942,2214 2923,2209 2923,2209 +L 2823,2539 2896,2498 2911,2465 2876,2449 2805,2496 2788,2496 2792,2523 2823,2539 2823,2539 +L 3675,1790 3740,1742 3708,1651 3683,1646 3674,1634 3638,1646 3652,1647 3661,1664 3670,1660 3649,1717 3641,1722 3647,1736 3635,1756 3653,1759 3655,1741 3666,1743 3674,1731 3662,1730 3661,1711 3670,1711 3674,1691 3678,1695 3678,1649 3688,1650 3692,1665 3684,1671 3686,1698 3696,1689 3696,1708 3707,1709 3696,1719 3707,1731 3719,1729 3702,1729 3696,1741 3688,1759 3676,1769 3675,1790 3675,1790 diff --git a/src/Triangle.Tests/Robustness/Data/Public/poly2tri-sketchup.txt b/src/Triangle.Tests/Robustness/Data/Public/poly2tri-sketchup.txt new file mode 100644 index 0000000..f0f5962 --- /dev/null +++ b/src/Triangle.Tests/Robustness/Data/Public/poly2tri-sketchup.txt @@ -0,0 +1,2 @@ +# poly2tri/sketchup +L -112.9393,-5.134218 -115.783,-26.39329 -116.1693,-15.52189 -115.783,-26.39329 -112.9393,-5.134218 -111.8239,-36.52552 -111.8239,-36.52552 -112.9393,-5.134218 -106.4564,3.601217 -111.8239,-36.52552 -106.4564,3.601217 -104.7373,-44.7788 -66.76277,70.05491 -68.21937,53.83701 -68.55863,62.04185 -68.21937,53.83701 -66.76277,70.05491 -65.7681,45.99956 -65.7681,45.99956 -66.76277,70.05491 -62.95416,77.33014 -65.7681,45.99956 -62.95416,77.33014 -61.37187,39.0636 -61.37187,39.0636 -62.95416,77.33014 -57.39237,83.37173 -61.37187,39.0636 -57.39237,83.37173 -55.33028,33.5018 -55.33028,33.5018 -57.39237,83.37173 -50.4564,87.76796 -55.33028,33.5018 -50.4564,87.76796 -54.18848,31.40854 -54.18848,31.40854 -50.4564,87.76796 -52.54381,29.68213 -52.54381,29.68213 -50.4564,87.76796 -50.50835,28.44022 -50.50835,28.44022 -50.4564,87.76796 -48.22082,27.76744 -48.22082,27.76744 -50.4564,87.76796 -42.61895,90.21923 -48.22082,27.76744 -42.61895,90.21923 -45.8371,27.70964 -45.8371,27.70964 -42.61895,90.21923 -43.51965,28.27076 -43.51965,28.27076 -42.61895,90.21923 -41.4264,29.41256 -41.4264,29.41256 -42.61895,90.21923 -34.41412,90.55849 -41.4264,29.41256 -34.41412,90.55849 -38.42946,47.11159 -41.4264,29.41256 -38.42946,47.11159 -39.69999,31.05723 -39.69999,31.05723 -38.42946,47.11159 -38.45807,33.09269 -38.42946,47.11159 -34.41412,90.55849 -36.86605,53.9672 -36.86605,53.9672 -34.41412,90.55849 -33.69118,60.24126 -33.69118,60.24126 -34.41412,90.55849 -26.40105,88.76263 -33.69118,60.24126 -26.40105,88.76263 -29.09332,65.56134 -29.09332,65.56134 -26.40105,88.76263 -23.3454,69.61164 -23.3454,69.61164 -26.40105,88.76263 -19.12582,84.95402 -23.3454,69.61164 -19.12582,84.95402 -16.7886,72.15173 -16.7886,72.15173 -19.12582,84.95402 -13.74167,81.56284 -16.7886,72.15173 -13.74167,81.56284 -9.81216,73.03084 -9.81216,73.03084 -13.74167,81.56284 -8.03964,78.73864 -9.81216,73.03084 -8.03964,78.73864 -2.830188,72.19677 -2.830188,72.19677 -8.03964,78.73864 -2.079244,76.51087 -2.830188,72.19677 -2.079244,76.51087 3.742859,69.69904 3.742859,69.69904 -2.079244,76.51087 4.077324,74.9028 3.742859,69.69904 4.077324,74.9028 9.516804,65.68592 9.516804,65.68592 4.077324,74.9028 10.36582,73.93119 9.516804,65.68592 10.36582,73.93119 14.1489,60.39562 14.1489,60.39562 10.36582,73.93119 16.72063,73.60619 14.1489,60.39562 16.72063,73.60619 17.36419,54.14218 17.36419,54.14218 16.72063,73.60619 23.07544,73.93119 17.36419,54.14218 23.07544,73.93119 19.14039,41.22425 92.15467,80.62257 88.83104,50.24595 88.0531,85.73196 88.83104,50.24595 92.15467,80.62257 92.70476,55.53018 92.70476,55.53018 92.15467,80.62257 94.79408,74.62572 92.70476,55.53018 94.79408,74.62572 95.07883,61.63694 95.07883,61.63694 94.79408,74.62572 95.79146,68.15007 -138.3173,50.47565 -137.432,24.73624 -140.3168,37.52194 -137.432,24.73624 -138.3173,50.47565 -131.7115,61.79639 -137.432,24.73624 -131.7115,61.79639 -130.0639,13.89615 -130.0639,13.89615 -131.7115,61.79639 -121.4177,69.91023 -130.0639,13.89615 -121.4177,69.91023 -119.2369,6.508783 -119.2369,6.508783 -121.4177,69.91023 -108.8671,73.6891 -119.2369,6.508783 -108.8671,73.6891 -106.4564,3.601217 -106.4564,3.601217 -108.8671,73.6891 -95.8047,72.60761 -106.4564,3.601217 -95.8047,72.60761 -104.7373,-44.7788 -104.7373,-44.7788 -95.8047,72.60761 -95.3204,-50.22474 -95.3204,-50.22474 -95.8047,72.60761 -84.0465,66.81613 -95.3204,-50.22474 -84.0465,66.81613 -84.63247,-52.25073 -84.63247,-52.25073 -84.0465,66.81613 -73.87579,-50.62886 -73.87579,-50.62886 -84.0465,66.81613 -75.22729,57.11985 -73.87579,-50.62886 -75.22729,57.11985 -70.57319,44.86685 -73.87579,-50.62886 -70.57319,44.86685 -64.26037,-45.54158 -64.26037,-45.54158 -70.57319,44.86685 -69.61521,31.86262 -64.26037,-45.54158 -69.61521,31.86262 -64.96236,19.68153 -64.26037,-45.54158 -64.96236,19.68153 -57.00677,9.350201 -64.26037,-45.54158 -57.00677,9.350201 -56.86785,-37.56115 -56.86785,-37.56115 -57.00677,9.350201 -51.7342,-16.73615 -51.7342,-16.73615 -57.00677,9.350201 -46.41893,1.739326 -56.86785,-37.56115 -51.7342,-16.73615 -52.52979,-27.58529 -51.7342,-16.73615 -46.41893,1.739326 -43.24859,-39.15101 -43.24859,-39.15101 -46.41893,1.739326 -34.09116,-2.50966 -43.24859,-39.15101 -34.09116,-2.50966 -28.50562,-58.04747 -28.50562,-58.04747 -34.09116,-2.50966 -21.06243,-3.038659 -28.50562,-58.04747 -21.06243,-3.038659 -8.827904,-71.73027 -8.827904,-71.73027 -21.06243,-3.038659 -8.430764,0.1969107 -8.827904,-71.73027 -8.430764,0.1969107 14.01921,-78.97189 14.01921,-78.97189 -8.430764,0.1969107 2.739249,6.924362 14.01921,-78.97189 2.739249,6.924362 11.50623,16.57672 14.01921,-78.97189 11.50623,16.57672 17.1313,28.34049 14.01921,-78.97189 17.1313,28.34049 37.98603,-79.12265 37.98603,-79.12265 17.1313,28.34049 19.14039,41.22425 37.98603,-79.12265 19.14039,41.22425 23.07544,73.93119 37.98603,-79.12265 23.07544,73.93119 29.36394,74.9028 37.98603,-79.12265 29.36394,74.9028 35.52051,76.51087 37.98603,-79.12265 35.52051,76.51087 41.48091,78.73864 37.98603,-79.12265 41.48091,78.73864 60.92244,-72.16905 60.92244,-72.16905 41.48091,78.73864 47.18293,81.56284 60.92244,-72.16905 47.18293,81.56284 52.56709,84.95402 60.92244,-72.16905 52.56709,84.95402 57.67648,89.0556 60.92244,-72.16905 57.67648,89.0556 63.67333,91.69501 60.92244,-72.16905 63.67333,91.69501 80.77074,-58.7349 80.77074,-58.7349 63.67333,91.69501 70.14898,92.69238 80.77074,-58.7349 70.14898,92.69238 76.66211,91.97975 80.77074,-58.7349 76.66211,91.97975 82.76887,89.60568 80.77074,-58.7349 82.76887,89.60568 95.75028,-40.02542 95.75028,-40.02542 82.76887,89.60568 88.83104,50.24595 88.83104,50.24595 82.76887,89.60568 88.0531,85.73196 95.75028,-40.02542 88.83104,50.24595 100.8951,29.53631 95.75028,-40.02542 100.8951,29.53631 104.5172,-17.71909 104.5172,-17.71909 100.8951,29.53631 106.285,6.182927 -38.45807,33.09269 -38.28861,40.08139 -37.78529,35.38022 -38.28861,40.08139 -38.45807,33.09269 -38.42946,47.11159 -37.78529,35.38022 -38.28861,40.08139 -37.72749,37.76394 -112.9393,-5.134218 diff --git a/src/Triangle.Tests/Robustness/Data/README.md b/src/Triangle.Tests/Robustness/Data/README.md index 3d75baf..6cc0fe6 100644 --- a/src/Triangle.Tests/Robustness/Data/README.md +++ b/src/Triangle.Tests/Robustness/Data/README.md @@ -10,3 +10,13 @@ from `Examples/canadian_flag_raw_data.txt` of https://github.com/Samson-Mano/2DTriangle_Mesh_Generator (MIT License, Copyright (c) 2023 Mano). Converted to the corpus format (`L` = polyline). +* `Public/*.txt`: the public test fixtures on which the original Triangle.NET throws, does not + terminate or produces an inconsistent mesh (constrained, with and without quality), used by + `ExternalDataRegressionTest`. Converted to the corpus format (`L` = polyline, `P` = point): + * `earcut-*`: `test/fixtures` of https://github.com/mapbox/earcut (ISC License, Copyright (c) + Mapbox): bad-hole, earcut, infinite-loop-jhl, issue17, issue83, issue142, self-tangent-3, + self-tangent-4, touching-holes6, water, water-huge, water-huge2, water-huge3. + * `delaunator-*`: `test/fixtures` of https://github.com/mapbox/delaunator (ISC License, + Copyright (c) Mapbox): issue43, robustness1 to robustness4. + * `poly2tri-sketchup`: `testbed/data/sketchup.dat` of https://github.com/jhasse/poly2tri + (BSD 3-Clause License, Copyright (c) Poly2Tri Contributors). diff --git a/src/Triangle.Tests/Robustness/ExternalDataRegressionTest.cs b/src/Triangle.Tests/Robustness/ExternalDataRegressionTest.cs new file mode 100644 index 0000000..01dc4bf --- /dev/null +++ b/src/Triangle.Tests/Robustness/ExternalDataRegressionTest.cs @@ -0,0 +1,86 @@ +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using TriangleNet.Tests.Corpus; + +namespace TriangleNet.Tests.Robustness +{ + /// + /// Hard cases found with external data (see ), kept as regression + /// tests so they run without the external data: the public test fixtures of earcut, + /// delaunator and poly2tri on which the original Triangle.NET throws, loops or produces an + /// inconsistent mesh (see Data/README.md), and a nearly coincident back-and-forth border of + /// the Natural Earth US counties. + /// + public class ExternalDataRegressionTest + { + private static readonly string DataDirectory = + Path.Combine(Path.GetDirectoryName(typeof(ExternalDataRegressionTest).Assembly.Location), "Robustness", "Data", "Public"); + + private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(60); + + public static IEnumerable PublicFixtures() + { + foreach (var path in Directory.GetFiles(DataDirectory, "*.txt").OrderBy(p => p, StringComparer.Ordinal)) + { + foreach (double minAngle in new[] { 0.0, 20.0, 30.0 }) + { + yield return new TestCaseData(Path.GetFileName(path), minAngle) + .SetName($"{Path.GetFileNameWithoutExtension(path)} q{minAngle}"); + } + } + } + + /// + /// All polylines as segments, enclosed by a frame: the mesh is consistent, has no + /// inverted triangles, covers the frame and contains all input segments. + /// + [TestCaseSource(nameof(PublicFixtures))] + public void PublicFixtureGivesValidMesh(string file, double minAngle) + { + var c = CorpusCase.Load(Path.Combine(DataDirectory, file)); + + var result = MeshAssert.Terminates(() => CorpusCheck.Run(c, minAngle, 20000), Timeout); + + Assert.That(result, Does.StartWith("OK")); + } + + // From the Natural Earth 10m US counties (Chugach, Alaska): the border runs 5 km from A + // to B and back to C, 5.7e-10 degrees (0.06 mm) from A-B (angle 6.5e-7 degrees at B). + private static CorpusCase BacktrackingBorder() => new CorpusCase + { + Lines = + { + new List<(double X, double Y)> + { + (-148.4572647779999, 60.841009833000044), + (-148.5234268869999, 60.84039948100008), + (-148.47338487789784, 60.84086112405067) + } + } + }; + + [Test] + public void NearlyCoincidentBacktrackingBorderStopsAtTheSteinerLimit() + { + // No refinement can fill the sliver with 20 degree triangles: the Steiner point + // limit has to stop it (the whole counties layer used to run into the corpus timeout). + var result = MeshAssert.Terminates(() => CorpusCheck.Run(BacktrackingBorder(), 20, 20000), Timeout); + + Assert.That(result, Does.StartWith("OK")); + Assert.That(result, Does.Contain(" limit=1 ")); + } + + [Test] + public void NearlyCoincidentBacktrackingBorderIsMergedBySnapTolerance() + { + var result = MeshAssert.Terminates(() => CorpusCheck.Run(BacktrackingBorder(), 20, 20000, snapTolerance: 1e-9), Timeout); + + Assert.That(result, Does.StartWith("OK")); + Assert.That(result, Does.Contain(" bad=0 ")); + Assert.That(result, Does.Contain(" limit=0 ")); + } + } +} diff --git a/src/Triangle.Tests/Triangle.Tests.csproj b/src/Triangle.Tests/Triangle.Tests.csproj index d80134b..853c634 100644 --- a/src/Triangle.Tests/Triangle.Tests.csproj +++ b/src/Triangle.Tests/Triangle.Tests.csproj @@ -22,6 +22,7 @@ + From 0b1b934fed303ec83b7b0f5a2e8b12db29dc91e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 15:07:11 +0000 Subject: [PATCH 50/50] =?UTF-8?q?Pr=C3=A4dikate:=20exakt=20auch=20bei=20Un?= =?UTF-8?q?ter-=20und=20=C3=9Cberlauf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bei sehr kleinen oder sehr großen Koordinaten werden die Produkte subnormal bzw. unendlich; dann gelten Shewchuks Fehlerschranken nicht und das Vorzeichen war falsch (InCircle ab 1e-100 bzw. 1e100 etwa die Hälfte der fast kozirkulären Fälle, Orient ab 1e-160) oder NaN. - Orient: Absicherung nur in den Zweigen, in denen Unterlauf das Vorzeichen ändern kann (Produkt null, Filter bei subnormaler Summe). - InCircle: Filter nur, wenn alle Differenzen 0 oder in [2^-200, 2^200] liegen (ein subnormales Produkt mal großem Lift kann die Schranke sonst überschreiten). - Adaptive Stufen nur für Koordinaten in [2^-100, 2^100] (oder 0), sonst exaktes Vorzeichen mit BigInteger. Idee aus geometry3Sharp (ExactPredicates). Normale Daten: Orient unverändert, InCircle etwa 3 ns langsamer pro Aufruf. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012bnBWGQoVJCM7Rtx2a6Z86 --- .../Robustness/PredicatesTest.cs | 121 ++++++++++++ src/Triangle/RobustPredicates.cs | 172 +++++++++++++++++- 2 files changed, 290 insertions(+), 3 deletions(-) diff --git a/src/Triangle.Tests/Robustness/PredicatesTest.cs b/src/Triangle.Tests/Robustness/PredicatesTest.cs index 0f8b8c6..d05a3c6 100644 --- a/src/Triangle.Tests/Robustness/PredicatesTest.cs +++ b/src/Triangle.Tests/Robustness/PredicatesTest.cs @@ -1,5 +1,6 @@ using NUnit.Framework; using System; +using System.Numerics; using TriangleNet.Geometry; namespace TriangleNet.Tests.Robustness @@ -54,5 +55,125 @@ public void InfiniteSegmentCoordinates() Assert.Throws(() => poly.Triangulate()); } + + [TestCase(1e-100)] + [TestCase(1e-160)] + [TestCase(1e-200)] + [TestCase(1e-300)] + [TestCase(1e-310)] + [TestCase(1e100)] + [TestCase(1e200)] + [TestCase(1e300)] + [Description("Fixed: for very small or very large coordinates the products underflow (subnormal or zero) or overflow, Shewchuk's error bounds don't hold and the sign was wrong (about half of the cases) or NaN.")] + public void ExtremeCoordinatesGiveTheExactSign(double scale) + { + var predicates = new RobustPredicates(); + var random = new Random(1); + int wrongOrient = 0, wrongInCircle = 0; + + for (int i = 0; i < 20000; i++) + { + // Nearly collinear (on a line, last coordinate moved by a few ulps) ... + double t1 = random.NextDouble(), t2 = random.NextDouble(); + var a = new Point(scale, 2 * scale); + var b = new Point(scale * (1 + t1), scale * (2 + 2 * t1)); + var c = new Point(Ulps(scale * (1 + t2), random.Next(-3, 4)), scale * (2 + 2 * t2)); + + if (Sign(predicates.CounterClockwise(a, b, c)) != Orient(a, b, c)) wrongOrient++; + + // ... and nearly cocircular points. + var p = new Point[4]; + + for (int j = 0; j < 4; j++) + { + double angle = random.NextDouble() * 2 * Math.PI; + p[j] = new Point(scale * Math.Cos(angle) + 3 * scale, scale * Math.Sin(angle) - 5 * scale); + } + + if (Orient(p[0], p[1], p[2]) <= 0) continue; + + if (Sign(predicates.InCircle(p[0], p[1], p[2], p[3])) != InCircle(p[0], p[1], p[2], p[3])) wrongInCircle++; + } + + Assert.That((wrongOrient, wrongInCircle), Is.EqualTo((0, 0))); + } + + [Test] + public void MixedMagnitudesGiveTheExactSign() + { + var predicates = new RobustPredicates(); + var random = new Random(2); + var values = new[] { 0.0, 1e-310, 1e-200, 1e-120, 1e-40, 1.0, 3.0, 1e40, 1e120, 1e200 }; + int wrong = 0; + + double V() => (random.Next(2) == 0 ? -1 : 1) * Ulps(values[random.Next(values.Length)], random.Next(-2, 3)); + + for (int i = 0; i < 50000; i++) + { + var a = new Point(V(), V()); + var b = new Point(V(), V()); + var c = new Point(V(), V()); + var d = new Point(V(), V()); + + if (Sign(predicates.CounterClockwise(a, b, c)) != Orient(a, b, c)) wrong++; + if (Sign(predicates.InCircle(a, b, c, d)) != InCircle(a, b, c, d)) wrong++; + } + + Assert.That(wrong, Is.Zero); + } + + private static int Sign(double x) => x > 0 ? 1 : x < 0 ? -1 : double.IsNaN(x) ? 2 : 0; + + private static double Ulps(double x, int k) + { + for (; k > 0; k--) x = Math.BitIncrement(x); + for (; k < 0; k++) x = Math.BitDecrement(x); + return x; + } + + // Exact reference: every double is m * 2^e, with a common power-of-two scale. + private static BigInteger[] Integers(params double[] values) + { + var mantissa = new long[values.Length]; + var exponent = new int[values.Length]; + int emin = int.MaxValue; + + for (int i = 0; i < values.Length; i++) + { + long bits = BitConverter.DoubleToInt64Bits(values[i]); + int e = (int)((bits >> 52) & 0x7FF); + long f = bits & 0xFFFFFFFFFFFFFL; + + if (e == 0) exponent[i] = -1074; + else { f |= 1L << 52; exponent[i] = e - 1075; } + + mantissa[i] = bits < 0 ? -f : f; + if (mantissa[i] != 0) emin = Math.Min(emin, exponent[i]); + } + + var result = new BigInteger[values.Length]; + + for (int i = 0; i < values.Length; i++) + { + result[i] = mantissa[i] == 0 ? BigInteger.Zero : new BigInteger(mantissa[i]) << (exponent[i] - emin); + } + + return result; + } + + private static int Orient(Point a, Point b, Point c) + { + var v = Integers(a.X, a.Y, b.X, b.Y, c.X, c.Y); + return ((v[2] - v[0]) * (v[5] - v[1]) - (v[3] - v[1]) * (v[4] - v[0])).Sign; + } + + private static int InCircle(Point a, Point b, Point c, Point d) + { + var v = Integers(a.X, a.Y, b.X, b.Y, c.X, c.Y, d.X, d.Y); + BigInteger adx = v[0] - v[6], ady = v[1] - v[7], bdx = v[2] - v[6], bdy = v[3] - v[7], cdx = v[4] - v[6], cdy = v[5] - v[7]; + return ((adx * adx + ady * ady) * (bdx * cdy - cdx * bdy) + + (bdx * bdx + bdy * bdy) * (cdx * ady - adx * cdy) + + (cdx * cdx + cdy * cdy) * (adx * bdy - bdx * ady)).Sign; + } } } diff --git a/src/Triangle/RobustPredicates.cs b/src/Triangle/RobustPredicates.cs index b8e01d1..8c01be2 100644 --- a/src/Triangle/RobustPredicates.cs +++ b/src/Triangle/RobustPredicates.cs @@ -121,6 +121,140 @@ static RobustPredicates() #endregion + #region Very small and very large coordinates + + // The adaptive predicates are exact as long as no product (including the error terms) + // underflows or overflows. This holds if all nonzero coordinates have magnitudes in + // [2^-100, 2^100]: the differences are zero or at least 2^-152, the products of the + // in-circle test (degree 4, with their error terms) stay far from subnormal numbers and + // from overflow. Otherwise the sign is computed with integers. + private const double MinCoordinate = 7.888609052210118e-31; // 2^-100 + private const double MaxCoordinate = 1.2676506002282294e30; // 2^100 + + // The orientation filter needs a sum of the products which isn't subnormal (for + // coordinates in range the products are at least 2^-304 or exactly zero). + private const double MinMagnitude = 1e-200; + + private const double MinDifference = 6.223015277861142e-61; // 2^-200 + private const double MaxDifference = 1.6069380442589903e60; // 2^200 + + [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] + private static bool SafeDifference(double d) + { + double a = Math.Abs(d); + return (a >= MinDifference && a <= MaxDifference) || a == 0.0; + } + + private static bool InRange(double x) + { + double a = Math.Abs(x); + return a == 0.0 || (a >= MinCoordinate && a <= MaxCoordinate); + } + + private static bool InRange(Point a, Point b, Point c) + { + return InRange(a.x) && InRange(a.y) && InRange(b.x) && InRange(b.y) && InRange(c.x) && InRange(c.y); + } + + private static bool InRange(Point a, Point b, Point c, Point d) + { + return InRange(a, b, c) && InRange(d.x) && InRange(d.y); + } + + /// + /// The approximation if it has the exact sign, otherwise the sign. + /// + private static double ExactResult(int sign, double approximation) + { + if (sign == 0) return 0.0; + + // NaN (overflow) fails both comparisons. + bool same = sign > 0 ? approximation > 0.0 : approximation < 0.0; + + return same && !double.IsInfinity(approximation) ? approximation : sign; + } + + /// + /// Exact sign of the orientation determinant with integers (every double is m * 2^e). + /// + internal static int CounterClockwiseExact(Point pa, Point pb, Point pc) + { + var v = ToIntegers(pa.x, pa.y, pb.x, pb.y, pc.x, pc.y); + System.Numerics.BigInteger acx = v[0] - v[4], acy = v[1] - v[5], bcx = v[2] - v[4], bcy = v[3] - v[5]; + return (acx * bcy - acy * bcx).Sign; + } + + /// + /// Exact sign of the in-circle determinant with integers. + /// + internal static int InCircleExact(Point pa, Point pb, Point pc, Point pd) + { + var v = ToIntegers(pa.x, pa.y, pb.x, pb.y, pc.x, pc.y, pd.x, pd.y); + System.Numerics.BigInteger adx = v[0] - v[6], ady = v[1] - v[7], bdx = v[2] - v[6], bdy = v[3] - v[7], cdx = v[4] - v[6], cdy = v[5] - v[7]; + return ((adx * adx + ady * ady) * (bdx * cdy - cdx * bdy) + + (bdx * bdx + bdy * bdy) * (cdx * ady - adx * cdy) + + (cdx * cdx + cdy * cdy) * (adx * bdy - bdx * ady)).Sign; + } + + /// + /// All values as integers with a common power-of-two scale. + /// + private static System.Numerics.BigInteger[] ToIntegers(params double[] values) + { + int n = values.Length; + var mantissa = new long[n]; + var exponent = new int[n]; + int emin = int.MaxValue; + + for (int i = 0; i < n; i++) + { + double v = values[i]; + + if (double.IsNaN(v) || double.IsInfinity(v)) + { + throw new ArgumentException("Coordinates must be finite."); + } + + long bits = BitConverter.DoubleToInt64Bits(v); + int e = (int)((bits >> 52) & 0x7FF); + long frac = bits & 0xFFFFFFFFFFFFFL; + + if (e == 0) + { + exponent[i] = -1074; // zero or subnormal + } + else + { + frac |= 1L << 52; + exponent[i] = e - 1075; + } + + mantissa[i] = bits < 0 ? -frac : frac; + + if (mantissa[i] != 0) + { + emin = Math.Min(emin, exponent[i]); + } + } + + if (emin == int.MaxValue) + { + emin = 0; + } + + var result = new System.Numerics.BigInteger[n]; + + for (int i = 0; i < n; i++) + { + result[i] = mantissa[i] == 0 ? System.Numerics.BigInteger.Zero + : new System.Numerics.BigInteger(mantissa[i]) << (exponent[i] - emin); + } + + return result; + } + + #endregion + /// /// Initializes a new instance of the class. /// @@ -145,6 +279,10 @@ public double CounterClockwise(Point pa, Point pb, Point pc) return det; } + // Shewchuk's error bounds don't hold if the products underflow (subnormal or zero) + // or overflow (infinity, NaN). With different signs of the products the sign of + // det is right anyway (rounding never changes the sign of a product, and a product + // rounded to zero is smaller than the other one). NaN fails all comparisons. if (detleft > 0.0) { if (detright <= 0.0) @@ -169,16 +307,30 @@ public double CounterClockwise(Point pa, Point pb, Point pc) } else { - return det; + // detleft is zero (or NaN): det = -detright is right if detleft is exactly zero + // (a factor is zero) and detright isn't a product rounded to zero. + if ((pa.x == pc.x || pb.y == pc.y) && + (detright != 0.0 ? !double.IsNaN(detright) : (pa.y == pc.y || pb.x == pc.x))) + { + return det; + } + + return ExactResult(CounterClockwiseExact(pa, pb, pc), det); } errbound = ccwerrboundA * detsum; - if ((det >= errbound) || (-det >= errbound)) + if (detsum >= MinMagnitude && ((det >= errbound) || (-det >= errbound))) { return det; } Statistic.CounterClockwiseAdaptCount++; + + if (!InRange(pa, pb, pc)) + { + return ExactResult(CounterClockwiseExact(pa, pb, pc), det); + } + return CounterClockwiseAdapt(pa, pb, pc, detsum); } @@ -224,13 +376,27 @@ public double InCircle(Point pa, Point pb, Point pc, Point pd) permanent = (Math.Abs(bdxcdy) + Math.Abs(cdxbdy)) * alift + (Math.Abs(cdxady) + Math.Abs(adxcdy)) * blift + (Math.Abs(adxbdy) + Math.Abs(bdxady)) * clift; + + // Shewchuk's error bound needs products which neither underflow nor overflow: a + // subnormal product, multiplied with a large lift, can exceed the bound. With all + // differences zero or in [2^-200, 2^200] the products of degree 4 are in + // [2^-800, 2^800]. + bool valid = SafeDifference(adx) && SafeDifference(bdx) && SafeDifference(cdx) + && SafeDifference(ady) && SafeDifference(bdy) && SafeDifference(cdy); + errbound = iccerrboundA * permanent; - if ((det > errbound) || (-det > errbound)) + if (valid && ((det > errbound) || (-det > errbound))) { return det; } Statistic.InCircleAdaptCount++; + + if (!InRange(pa, pb, pc, pd)) + { + return ExactResult(InCircleExact(pa, pb, pc, pd), det); + } + return InCircleAdapt(pa, pb, pc, pd, permanent); }