void lazyFill(Polygons polysToWriteTo, IntPoint startPoint, int z, CheckForSupport checkIfSupportNeeded) { Polygon poly = new Polygon(); polysToWriteTo.Add(poly); Polygon tmpPoly = new Polygon(); while (true) { IntPoint endPoint = startPoint; done[endPoint.X + endPoint.Y * supportStorage.gridWidth] = true; while (checkIfSupportNeeded(endPoint + new IntPoint(1, 0), z)) { endPoint.X++; done[endPoint.X + endPoint.Y * supportStorage.gridWidth] = true; } tmpPoly.Add(startPoint * supportStorage.gridScale + supportStorage.gridOffset - new IntPoint(supportStorage.gridScale / 2, 0)); poly.Add(endPoint * supportStorage.gridScale + supportStorage.gridOffset); startPoint.Y++; while (!checkIfSupportNeeded(startPoint, z) && startPoint.X <= endPoint.X) { startPoint.X++; } if (startPoint.X > endPoint.X) { for (int n = 0; n < tmpPoly.Count; n++) { poly.Add(tmpPoly[tmpPoly.Count - n - 1]); } polysToWriteTo.Add(poly); return; } while (checkIfSupportNeeded(startPoint - new IntPoint(1, 0), z) && startPoint.X > 1) { startPoint.X--; } } }
private void lazyFill(Polygons polysToWriteTo, IntPoint startPoint, int z, CheckForSupport checkIfSupportNeeded) { Polygon poly = new Polygon(); polysToWriteTo.Add(poly); Polygon tmpPoly = new Polygon(); while (true) { IntPoint endPoint = startPoint; done[endPoint.X + endPoint.Y * supportStorage.gridWidth] = true; while (checkIfSupportNeeded(endPoint + new IntPoint(1, 0), z)) { endPoint.X++; done[endPoint.X + endPoint.Y * supportStorage.gridWidth] = true; } tmpPoly.Add(startPoint * supportStorage.gridScale + supportStorage.gridOffset - new IntPoint(supportStorage.gridScale / 2, 0)); poly.Add(endPoint * supportStorage.gridScale + supportStorage.gridOffset); startPoint.Y++; while (!checkIfSupportNeeded(startPoint, z) && startPoint.X <= endPoint.X) { startPoint.X++; } if (startPoint.X > endPoint.X) { for (int n = 0; n < tmpPoly.Count; n++) { poly.Add(tmpPoly[tmpPoly.Count - n - 1]); } polysToWriteTo.Add(poly); return; } while (checkIfSupportNeeded(startPoint - new IntPoint(1, 0), z) && startPoint.X > 1) { startPoint.X--; } } }