private void Initialize(Point firstPrimaryPoint, Point upperRight, Point lowerLeft) { this.upperRight = upperRight; this.lowerLeft = lowerLeft; Point lowerRight = new Point(upperRight.X, lowerLeft.Y); Point upperLeft = new Point(lowerLeft.X, upperRight.Y); vertexes.Add(lowerLeft); vertexes.Add(lowerRight); vertexes.Add(upperRight); vertexes.Add(upperLeft); QuasiVoronoiCell tempCell = new QuasiVoronoiCell( firstPrimaryPoint, new List <int>( new int[] { lowerLeft.GetHashCode(), lowerRight.GetHashCode(), upperRight.GetHashCode(), upperLeft.GetHashCode() })); tempCell.neighbours.AddRange(new int[] { -1, -1, -1, -1 }); this.polygons.Add(tempCell); }
public VoronoiCell GetPolygon(int polygonCode) { PointCollection collection = new PointCollection(); QuasiVoronoiCell temp = polygons.GetCell(polygonCode); for (int i = 0; i < temp.Vertexes.Count; i++) { collection.Add(vertexes.GetPoint(temp.Vertexes[i])); } return(new VoronoiCell(temp.PrimaryPoint, collection, temp.neighbours)); }