3 define COLORSPRING = orange;
4 define COLORPOLY = magenta;
5 define COLORBOX = blue;
6 define COLORCROSS = lime;
13 void drawPolygon(Vector2D position, MekanoPolygon polygon)
15 List<MekanoPoint> points=polygon.points;
18 MekanoPoint point1, point2 = null, firstpoint = null;
19 Vector2D point_pos1, point_pos2;
22 surface.foreground = COLORPOLY;
28 point2 = firstpoint = p;
35 point_pos1=point1.localPosition;
36 point_pos2=point2.localPosition;
38 surface.DrawLine((int)(position.x+point_pos1.x), (int)(position.y+point_pos1.y),
39 (int)(position.x+point_pos2.x), (int)(position.y+point_pos2.y));
42 point_pos1=point2.localPosition;
43 point_pos2=firstpoint.localPosition;
44 surface.DrawLine((int)(position.x+point_pos1.x), (int)(position.y+point_pos1.y),
45 (int)(position.x+point_pos2.x), (int)(position.y+point_pos2.y));
49 void drawBox(Vector2D position, int width)
51 surface.foreground = COLORBOX;
53 (short)position.x-width/2, (short)position.y-width/2,
54 (short)position.x+width/2, (short)position.y+width/2);
57 void drawCrossHair(Vector2D position, int width)
59 surface.foreground = COLORCROSS;
60 surface.HLine((short)position.x-width/2, (short)position.x+width/2,
62 surface.VLine((short)position.y-width/2, (short)position.y+width/2,
66 void drawSpring(Vector2D pos1, Vector2D pos2, int zigs)
75 surface.foreground = COLORSPRING;
77 o.subtract(pos2, pos1);
83 // a1=u*(lzig*1/4)+n*h;
86 t1.scale(u, lzig*1/4);
91 // a2=u*(lzig*2/4)-n*h*2.0;
94 t1.scale(u, lzig*2/4);
99 for (t=0; t<zigs; t++)
103 surface.DrawLine((int)d.x, (int)d.y, (int)end.x, (int)end.y);
107 surface.DrawLine((int)d.x, (int)d.y, (int)end.x, (int)end.y);
111 surface.DrawLine((int)d.x, (int)d.y, (int)end.x, (int)end.y);