public static void GeneratesMinimumSpacedPoints(float width, float height, float minRadius) { var points = PoissonDiscSampling.BuildSamples(width, height, minRadius); var rSqr = minRadius * minRadius; var smallestDist = float.PositiveInfinity; var point1 = new float2(0f, 0f); var point2 = new float2(0f, 0f); for (var i = 0; i < points.Length; i++) { for (var j = i + 1; j < points.Length; j++) { var dist = math.distancesq(points[i], points[j]); if (dist >= smallestDist) { continue; } smallestDist = dist; point1 = points[i]; point2 = points[j]; } } points.Dispose(); Assert.GreaterOrEqual(smallestDist, rSqr, $"The points { point1 } and { point2 } are spaced less than the minimum square distance allowed"); }
public static void InvalidArguments( float width, float height, float minRadius, uint seed, int samplingResolution) { Assert.Throws <ArgumentException>(delegate { PoissonDiscSampling.BuildSamples(width, height, minRadius, seed, samplingResolution); }); }