static void Main(string[] args) { // List<PlanePoint> points = new List<PlanePoint> { // new PlanePoint(new double[]{0, 0, 0, 0}), // new PlanePoint(new double[]{ 100, 0, 0, 0}), // new PlanePoint(new double[]{100, 100, 0, 0}), // new PlanePoint(new double[]{0, 100, 0, 0}), // new PlanePoint(new double[]{0, 0, 100, 0}), // new PlanePoint(new double[]{ 100, 0, 100, 0}), // new PlanePoint(new double[]{100, 100, 100, 0}), // new PlanePoint(new double[]{0, 100, 100, 0}), // new PlanePoint(new double[]{0, 0, 0, 100}), // new PlanePoint(new double[]{ 100, 0, 0,100}), // new PlanePoint(new double[]{100, 100, 0, 100}), // new PlanePoint(new double[]{0, 100, 0, 100}), // new PlanePoint(new double[]{0, 0, 100, 100}), // new PlanePoint(new double[]{ 100, 0, 100, 100}), // new PlanePoint(new double[]{100, 100, 100, 100}), // new PlanePoint(new double[]{0, 100, 100, 100}), // }; List <PlanePoint> points = new List <PlanePoint> { new PlanePoint(new double[] { 0, 0, 0, 0, 0 }), new PlanePoint(new double[] { 100, 0, 0, 0, 0 }), new PlanePoint(new double[] { 0, 100, 0, 0, 0 }), new PlanePoint(new double[] { 0, 0, 100, 0, 0 }), new PlanePoint(new double[] { 100, 100, 0, 0, 0 }), new PlanePoint(new double[] { 100, 0, 100, 0, 0 }), new PlanePoint(new double[] { 0, 100, 100, 0, 0 }), new PlanePoint(new double[] { 100, 100, 100, 0, 0 }), new PlanePoint(new double[] { 0, 0, 0, 100, 0 }), new PlanePoint(new double[] { 100, 0, 0, 100, 0 }), new PlanePoint(new double[] { 0, 100, 0, 100, 0 }), new PlanePoint(new double[] { 0, 0, 100, 100, 0 }), new PlanePoint(new double[] { 100, 100, 0, 100, 0 }), new PlanePoint(new double[] { 100, 0, 100, 100, 0 }), new PlanePoint(new double[] { 0, 100, 100, 100, 0 }), new PlanePoint(new double[] { 100, 100, 100, 100, 0 }), new PlanePoint(new double[] { 0, 0, 0, 0, 100 }), new PlanePoint(new double[] { 100, 0, 0, 0, 100 }), new PlanePoint(new double[] { 0, 100, 0, 0, 100 }), new PlanePoint(new double[] { 0, 0, 100, 0, 100 }), new PlanePoint(new double[] { 100, 100, 0, 0, 100 }), new PlanePoint(new double[] { 100, 0, 100, 0, 100 }), new PlanePoint(new double[] { 0, 100, 100, 0, 100 }), new PlanePoint(new double[] { 100, 100, 100, 0, 100 }), new PlanePoint(new double[] { 0, 0, 0, 100, 100 }), new PlanePoint(new double[] { 100, 0, 0, 100, 100 }), new PlanePoint(new double[] { 0, 100, 0, 100, 100 }), new PlanePoint(new double[] { 0, 0, 100, 100, 100 }), new PlanePoint(new double[] { 100, 100, 0, 100, 100 }), new PlanePoint(new double[] { 100, 0, 100, 100, 100 }), new PlanePoint(new double[] { 0, 100, 100, 100, 100 }), new PlanePoint(new double[] { 100, 100, 100, 100, 100 }), }; // PlanePoint[] points = new PlanePoint[] { // new PlanePoint(new double[]{1, 1, 1}), // new PlanePoint(new double[]{5, 1, 1}), // new PlanePoint(new double[]{1, 5, 1}), // new PlanePoint(new double[]{5, 5, 1}), // new PlanePoint(new double[]{1, 1, 5}), // new PlanePoint(new double[]{5, 1, 5}), // new PlanePoint(new double[]{1, 5, 5}), // new PlanePoint(new double[]{5, 5, 5}), // new PlanePoint(new double[]{3, 3, 3}), // }; Random r = new Random(); for (int i = 0; i < 1000; i++) { points.Add(new PlanePoint(new double[] { r.Next(1, 80), r.Next(1, 80), r.Next(1, 80), r.Next(1, 80), r.Next(1, 80) })); } GiftWrappingAlgorithm giftWrapping = new GiftWrappingAlgorithm(points); Stopwatch sp = new Stopwatch(); Console.Out.WriteLine("Start"); IConvexHull result = giftWrapping.Create(); sp.Start(); IConvexHull result1 = giftWrapping.Create(); sp.Stop(); Console.Out.WriteLine("Stop"); // ((ConvexHull)result1).Convert(@"D:\", "dode21"); Console.Out.WriteLine("ms = {0}", sp.ElapsedMilliseconds); Console.Out.WriteLine("t = {0}", sp.ElapsedTicks); }
public void FindFirstPlane_ReturnHyperplane() { PlanePoint[] points = new PlanePoint[] { new PlanePoint(new double[] { 1, 1, 1 }), new PlanePoint(new double[] { 5, 1, 1 }), new PlanePoint(new double[] { 1, 5, 1 }), new PlanePoint(new double[] { 5, 5, 1 }), new PlanePoint(new double[] { 1, 1, 5 }), new PlanePoint(new double[] { 5, 1, 5 }), new PlanePoint(new double[] { 1, 5, 5 }), new PlanePoint(new double[] { 5, 5, 5 }), new PlanePoint(new double[] { 3, 3, 3 }), }; // List<PlanePoint> points = new List<PlanePoint> { // new PlanePoint(new double[]{1, 1, 1, 1}), // new PlanePoint(new double[]{5, 1, 1, 1}), // new PlanePoint(new double[]{1, 5, 1, 1}), // new PlanePoint(new double[]{5, 5, 1,1}), // new PlanePoint(new double[]{1, 1, 5,1}), // new PlanePoint(new double[]{5, 1, 5,1}), // new PlanePoint(new double[]{1, 5, 5,1}), // new PlanePoint(new double[]{5, 5, 5,1}), // new PlanePoint(new double[]{1, 1, 1, 5}), // new PlanePoint(new double[]{5, 1, 1, 5}), // new PlanePoint(new double[]{1, 5, 1, 5}), // new PlanePoint(new double[]{5, 5, 1,5}), // new PlanePoint(new double[]{1, 1, 5,5}), // new PlanePoint(new double[]{5, 1, 5,5}), // new PlanePoint(new double[]{1, 5, 5,5}), // new PlanePoint(new double[]{5, 5, 5,5}), // // }; // for (int i = 2; i < 100; i++) // { // double res = 1 + 4.0 / i; // points.Add(new PlanePoint(new double[]{res,res,res,res})); // } // //PlanePoint[] points = new PlanePoint[] //{ // new PlanePoint(new double[] {1, 1, 1, 1, 1}), // new PlanePoint(new double[] {5, 1, 1, 1, 1}), // new PlanePoint(new double[] {1, 5, 1, 1, 1}), // new PlanePoint(new double[] {5, 5, 1, 1, 1}), // new PlanePoint(new double[] {1, 1, 5, 1, 1}), // new PlanePoint(new double[] {5, 1, 5, 1, 1}), // new PlanePoint(new double[] {1, 5, 5, 1, 1}), // new PlanePoint(new double[] {5, 5, 5, 1, 1}), // new PlanePoint(new double[] {1, 1, 1, 5, 1}), // new PlanePoint(new double[] {5, 1, 1, 5, 1}), // new PlanePoint(new double[] {1, 5, 1, 5, 1}), // new PlanePoint(new double[] {5, 5, 1, 5, 1}), // new PlanePoint(new double[] {1, 1, 5, 5, 1}), // new PlanePoint(new double[] {5, 1, 5, 5, 1}), // new PlanePoint(new double[] {1, 5, 5, 5, 1}), // new PlanePoint(new double[] {5, 5, 5, 5, 1}), // new PlanePoint(new double[] {1, 1, 1, 1, 5}), // new PlanePoint(new double[] {5, 1, 1, 1, 5}), // new PlanePoint(new double[] {1, 5, 1, 1, 5}), // new PlanePoint(new double[] {5, 5, 1, 1, 5}), // new PlanePoint(new double[] {1, 1, 5, 1, 5}), // new PlanePoint(new double[] {5, 1, 5, 1, 5}), // new PlanePoint(new double[] {1, 5, 5, 1, 5}), // new PlanePoint(new double[] {5, 5, 5, 1, 5}), // new PlanePoint(new double[] {1, 1, 1, 5, 5}), // new PlanePoint(new double[] {5, 1, 1, 5, 5}), // new PlanePoint(new double[] {1, 5, 1, 5, 5}), // new PlanePoint(new double[] {5, 5, 1, 5, 5}), // new PlanePoint(new double[] {1, 1, 5, 5, 5}), // new PlanePoint(new double[] {5, 1, 5, 5, 5}), // new PlanePoint(new double[] {1, 5, 5, 5, 5}), // new PlanePoint(new double[] {5, 5, 5, 5, 5}), //}; //PlanePoint[] points = new PlanePoint[1000]; //Random rnd = new Random(); //for (int j = 0; j < points.Length; j++) //{ // double[] p = new double[]{rnd.Next(1,500), rnd.Next(250, 500), rnd.Next(500, 600)}; // points[j] = new PlanePoint(p); //} GiftWrappingAlgorithm giftWrapping = new GiftWrappingAlgorithm(points); Stopwatch sp = new Stopwatch(); IConvexHull result = giftWrapping.Create(); sp.Start(); IConvexHull result1 = giftWrapping.Create(); sp.Stop(); long first = sp.ElapsedMilliseconds; //sp.Reset(); //sp.Start(); //IFace result1 = giftWrapping.FindConvexHull(points.ToPlanePoint()); //sp.Stop(); //double sec = sp.ElapsedMilliseconds; // int i = 0; // ((ConvexHull)result1).Convert(@"D:\Projects\GiftWrapping", "test331" + i++); //foreach (ICell cell in result.InnerCells) //{ // ((ConvexHull)cell).Convert(@"D:\Projects\GiftWrapping", "test1"+i++); //} Assert.IsTrue(false); }