public static void renderline(line li) { char thechar = usedchar; if (li.spcecialchar != ' ') { thechar = li.spcecialchar; } if ((li.getuper().Y - li.getlower().Y) > (li.getrightmost().X - li.getleftmost().X)) { for (double i = li.getlower().Y; i < li.getuper().Y; i++) { double x = li.gethorizontalintersection(i); int y = (int)(i); int xx = (int)(x); if (xx >= 0 && xx < todisplay.GetLength(0) && y >= 0 && y < todisplay.GetLength(1)) { todisplay[xx, y] = thechar; } } } else { for (double i = li.getleftmost().X; i < li.getrightmost().X; i++) { double y = li.getverticalintersection(i); int yy = (int)(y); int x = (int)(i); if (x >= 0 && x < todisplay.GetLength(0) && yy >= 0 && yy < todisplay.GetLength(1)) { todisplay[x, yy] = thechar; } } } }
static void demo() { frame.initialze(100, 30); float time = analyse.Measure(frame.fullflip); frame.sidelog("elapsed time: " + Convert.ToString(time).PadRight(4)); frame.fill('#'); time = analyse.Measure(frame.flip); frame.sidelog("elapsed time: " + Convert.ToString(time).PadRight(4)); Console.ReadLine(); frame.Clear(); frame.drawcircle(10, 10, 7); time = analyse.Measure(frame.flip); frame.sidelog("elapsed time: " + Convert.ToString(time).PadRight(4)); Console.ReadLine(); frame.Clear(); line firstline = new line(new point(5, 5), new point(5, 10), '|'); line secondline = new line(new point(5, 10), new point(10, 10), '-'); line thirdline = new line(new point(10, 10), new point(10, 5), '|'); line fourthline = new line(new point(10, 5), new point(5, 5), '-'); line diagonal = new line(new point(0, 0), new point(10, 10), '\\'); line seconddiagonal = new line(new point(0, 10), new point(10, 0), '/'); frame.renderline(firstline); frame.renderline(secondline); frame.renderline(thirdline); frame.renderline(fourthline); frame.renderline(diagonal); frame.renderline(seconddiagonal); time = analyse.Measure(frame.flip); frame.sidelog("elapsed time: " + Convert.ToString(time).PadRight(4)); Console.ReadLine(); frame.Clear(); new polygon(5, 3, 10, 10, true); // Noncompliant new polygon(5, 4, 10, 20, true); // Noncompliant new polygon(5, 5, 20, 20, true); // Noncompliant new polygon(5, 6, 20, 10, true); // Noncompliant new polygon(10, 5, 40, 20, true); // Noncompliant frame.renderpolygons(); time = analyse.Measure(frame.flip); frame.sidelog("elapsed time: " + Convert.ToString(time).PadRight(4)); Console.ReadLine(); }