/// <summary> /// I'm not exactly sure the use of this?? /// All it does is create create a file /// </summary> /// <param name="size"></param> public void RandomShape(Sizes size) { Random ran = new Random(); int Max_Height = size.Window_Height; int max_Width = size.Window_Width; int offset = size.OFFSET; using (ReadWriteCsv.CsvFileWriter writer = new ReadWriteCsv.CsvFileWriter("Shape.csv")) { ReadWriteCsv.CsvRow row = new ReadWriteCsv.CsvRow(); int numberOfShapes = ran.Next(15); for (int i = 0; i < numberOfShapes; i++) { row.Add(ran.Next(max_Width).ToString()); row.Add(ran.Next(Max_Height).ToString()); writer.WriteRow(row); row.Clear(); } } }
public List<Point> oneHull(List<Point> coordinates, List<Point> Lupper, List<Point> Llower, int max_Width, int max_Height, int offset, int randomness = 25) { //ConvexHull CH = new ConvexHull(); List<Point> ConvexHull = new List<Point>(); // Creates new random points //if (randomness == 30) //{ // coordinates = squarePoints(coordinates); //} //else //{ coordinates = createPoints(coordinates, max_Width, max_Height, offset, randomness); //} // Calls right turn method to find upper hull ConvexHull.AddRange(rightTurn(coordinates, Lupper)); // Calls left turn method to find lower hull ConvexHull.AddRange(leftTurn(coordinates, Llower)); try { using (ReadWriteCsv.CsvFileWriter writer = new ReadWriteCsv.CsvFileWriter("Blob.csv")) { ReadWriteCsv.CsvRow row = new ReadWriteCsv.CsvRow(); for (int i = 0; i < ConvexHull.Count; i++) { row.Clear(); row.Add(ConvexHull.ElementAt(i).X.ToString()); row.Add(ConvexHull.ElementAt(i).Y.ToString()); writer.WriteRow(row); } } } catch (IOException) { MessageBox.Show("The file you are trying to write to is open\nPlease close the file and try agian", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } return ConvexHull; }