private void DrawLine(int i, int j) { double x, y; GLPen pen; float heightVal = (float)(grid.GetCellByIdx(i, j)); if (heightVal >= .01) { grid.GetReals(i, j, out x, out y); pen = new GLPen(ColorFromHeight(heightVal), 20f); pen.GLApplyPen(); Gl.glVertex3f((float)x, (float)y, heightVal); Gl.glVertex3f((float)x, (float)y, 0); } }
private bool FindPolygon(Vector2 initialIndex, bool turnedUpOnce) { int indexX = (int)initialIndex.X; int indexY = (int)initialIndex.Y; // if the cell is invalid, return if (occupancyGrid.GetCellByIdx(indexX, indexY) < polygonThreshold) { return(false); } // if cell is valid, add to the polygon list - if not, quit if (!allPointsInPolygons.ContainsKey(initialIndex)) { double xReal, yReal; occupancyGrid.GetReals(indexX, indexY, out xReal, out yReal); polygonList[numPolygon].Add(new Vector2(xReal, yReal)); allPointsInPolygons.Add(initialIndex, numPolygon); } else { return(false); } // check right cell if (!turnedUpOnce && occupancyGrid.CheckValidIdx(indexX + 1, indexY)) { FindPolygon(new Vector2(indexX + 1, indexY), false); } //// check up cell if (occupancyGrid.CheckValidIdx(indexX, indexY + 1)) { FindPolygon(new Vector2(indexX, indexY + 1), true); } return(false); }