namespace CandyboxPlugin.Voronoi { public class VoronoiPoint { /// /// Used only for generating a unique ID for each instance of this class that gets generated /// private static int _counter; /// /// Used for identifying an instance of a class; can be useful in troubleshooting when geometry goes weird /// (e.g. when trying to identify when Triangle objects are being created with the same Point object twice) /// private readonly int _instanceId = _counter++; public double X { get; } public double Y { get; } public HashSet AdjacentTriangles { get; } = new HashSet(); public VoronoiPoint(double x, double y) { X = x; Y = y; } public override string ToString() { // Simple way of seeing what's going on in the debugger when investigating weirdness return $"{nameof(VoronoiPoint)} {_instanceId} {X:0.##}@{Y:0.##}"; } } }