public void Test_Includeness() { var hash = new HashSet <(int, int)>(); for (var numberOfTests = 0; numberOfTests < 100; ++numberOfTests) { var numberOfPoints = 20 + numberOfTests * 10; var arr = new IntPoint[numberOfPoints]; hash.Clear(); for (var i = 0; i < numberOfPoints;) { var x = _random.Next(-1000, 1000); var y = _random.Next(-1000, 1000); if (!hash.Contains((x, y))) { hash.Add((x, y)); arr[i] = new IntPoint(x, y); ++i; } } var convexHull = GrahamScan.GetConvexHull(arr); IncludenessTest(convexHull, arr); } }
public void Test1() { const int numberOfPoints = 4; var a = new double[2 * numberOfPoints] { 595, -662, 587, -386, 646, 772, 112, 433, }; var arr = new IntPoint[numberOfPoints]; for (var i = 0; i < numberOfPoints; ++i) { arr[i] = new IntPoint(a[2 * i], a[2 * i + 1]); } var convexHull = GrahamScan.GetConvexHull(arr); IncludenessTest(convexHull, arr); }