public GraphicsPath PathForRectangularMethod(MathFunction func, RectangularMethodType type, double a, double b, int n) { GraphicsPath path = new GraphicsPath(); double difference = (b - a) / n; for (int i = 0; i < n; i++) { double x = 0; switch (type) { case RectangularMethodType.Left: x = a + difference * i; break; case RectangularMethodType.Right: x = a + difference * (i + 1); break; case RectangularMethodType.Central: x = a + difference * (i + 0.5); break; default: break; } path.AddRectangle(new RectangleF((float)FunctionXToScreenX(a + difference * i), (float)FunctionYToScreenY(func.Calculate(x)), (float)FunctionXToScreenX(x + difference) - (float)FunctionXToScreenX(x), (float)FunctionYToScreenY(0) - (float)FunctionYToScreenY(func.Calculate(x)))); } return(path); }
public RectangularMethod(RectangularMethodType type) { this.type = type; }