Polygon Maker By: Yogi Girdhar (girdhy@rpi.edu) September 21, 2001 Updated: September 26, 2001 Command Line Arguments ====================== ./polymaker [-w ] [-v ] -v : Sets the viewport dimension.(Default = 100,100) -w : Sets the window dimension.(Default = 500,500) Keyboard commands ================= n : start drawing a new polygon d : display coordinates (same as what goes into the output file) s : save your precious work! p : load a polygon file (generated by the saves of this program) l : load a line file ENTR : finish drawing current polygon ESC : get rid of the last/current polygon q : quit NOTE: These commands only work on the Drawing window. Once you press a key which requires you to type an input like file name(save,load etc..) you need to go to the console window and type the file name. Mouse commands ============== After pressing 'n', mouse button can be used to draw the polygon by clicking and dragging the left button. Once the last vertex is drawn, you can close the polygon by clicking the right mouse button or the ENTER key. Structure of the polygon file: ============================== The first line specifies the number of polygons in the file. This is followed by a description of each polygon. A polygon is simply described by its total number of vertices, followed by the coordinates of each vertex, specified in counterclockwise order. The origin (0, 0) is at the lower left corner of the grid, and the right top corner of the grid is at (100, 100). All points have integer coordinates. --------------------------- x1 y1 x2 y2 .. .. xn yn --------------------------- for example, here is a file that has two triangles: --------------------------- 2 3 24 70 62 64 50 92 3 12 34 44 12 66 48 --------------------------- Structure of the line file: =========================== The first line of the file should be the number of lines in the file. This is followed by the coordinates of the lines. Each line segment is specified on a separate line, and the coordinates are followed by a character specifying line thickness ("r" for regular, "b" for bold+blue). NOTE: All the numbers in the file should be separated by some kind of whitespace (space, tabs, enter, etc..). ------------------- x1 y1 x2 y2 .. .. x1 y1 x2 y2 ------------------- for example, here is a file with 3 lines, where the first two lines are drawn with regular thickness and the last line is drawn bold: ------------------ 3 0 0 100 100 r 0 10 10 0 r 10 10 60 30 b ------------------