Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if x < 0
- new x = (x - xmin) * (250 / (xmax - xmin)) ?
- for (int xcanvas = 0; xcanvas <= 250; i++) {
- double x = ((xmax - xmin) * xcanvas / 250.0) + xmin;
- double y = f(x);
- int ycanvas = 250 * (y - ymin) / (ymax - ymin) + .5;
- // Plot (xcanvas, ycanvas)
- }
- (canvas_x, canvas_y) -> (maths_x, maths_y)
- (maths_x, maths_y) -> (canvas_x, canvas_y)
- maths_x -> maths_y
- maths_x = maths_x_from_canvas_x(canvas_x, min_maths_x, max_maths_x)
- maths_y = maths_y_from_maths_x(maths_x) # this is the function to be plotted.
- canvas_y = canvas_y_from_maths_y(maths_y, min_maths_y, max_maths_y)
- if (canvas_y not out of bounds) plot(canvas_x, canvas_y)
Add Comment
Please, Sign In to add comment