private void assignSTL(int[,] matrix, uint endX, uint endY, DTLDelegate.VoronoiDiagramDelegate function_) { Pair[] point = new Pair[drawValue]; int[] color = new int[drawValue]; CreatePoint(point, color, endX, endY, function_); CreateSites(point, color, matrix, endX, endY); }
private void CreatePoint(Pair[] point, int[] color, uint w, uint h, DTLDelegate.VoronoiDiagramDelegate function_) { for (int arrayNum = 0; arrayNum < this.drawValue; ++arrayNum) { point[arrayNum] = new Pair((int)rand.Next(w), (int)rand.Next(h)); function_(ref point[arrayNum], ref color[arrayNum], startX, startY, w, h); } }
/* Draw */ public bool Draw(int[,] matrix, DTLDelegate.VoronoiDiagramDelegate function_) { var lenX = MatrixUtil.GetX(matrix); var lenY = MatrixUtil.GetY(matrix); return(this.DrawNormal( matrix, this.width == 0 || this.startX + this.width >= ((lenX == 0) ? 0 : lenX) ? ((lenX == 0) ? 0 : lenX) : this.startX + this.width, (this.height == 0 || this.startY + this.height >= lenY) ? lenY : this.startY + this.height, function_)); }
public bool Draw(int[,] matrix) { DTLDelegate.VoronoiDiagramDelegate voronoiDiagramDelegate = (ref Pair point, ref int color, uint startX, uint startY, uint w, uint h) => { if (rand.Probability((this.probabilityValue))) { color = this.trueColor; } else { color = this.falseColor; } }; voronoiDiagram.Draw(matrix, voronoiDiagramDelegate); return(true); }
public bool Draw(int[,] matrix) { DTLDelegate.VoronoiDiagramDelegate voronoiDiagramDelegate = (ref Pair point, ref int color, uint startX, uint startY, uint w, uint h) => { if ((this.isIsland(point, startX, startY, w, h, 2, 5) || this.isIsland(point, startX, startY, w, h, 1, 5)) && rand.Probability((this.probability))) { color = this.landValue; } else { color = this.seaValue; } }; return(this.voronoiDiagram.Draw(matrix, voronoiDiagramDelegate)); }
bool DrawNormal(int[,] matrix, uint endX, uint endY, DTLDelegate.VoronoiDiagramDelegate function_) { this.assignSTL(matrix, endX, endY, function_); return(true); }