/* next version much better. It still works out all the co-ordinates, but this function can draw a triangle of any size at any position */ void draw_triangle(const double x1, const double y1, const double side) { move_to(x1, y1); const double x2 = x1 + side/2, y2 = y1 + side/2*tan(60.0 * pi / 180.0); draw_to(x2, y2); const double x3 = x1 - side/2, y3 = y2; draw_to(x3, y3); draw_to(x1, y1); } void main() { make_window(500,500); set_pen_color(color::red); set_pen_width(3); draw_triangle(250, 50, 300); draw_triangle(250, 100, 150); }