Using INKSCAPE for Linux (version 0.39, Inkscape.org) ***************************************************** Marcus R Garvie Jan 19, 2006 Here are some simple instructions for creating polygons, with nodes at the corners, and possibly along the straight line arcs too. The reason I used INKSCAPE instead of GIMP or some other graphics package is that once the figure is complete it allows me to extract the coordinates of the nodes, which can then be exported to some triangulation package, like DISTMESH. Start-up ******** * In a command window type 'inkscape' * Drag window to an appropriate size, and right/middle click (depending on mouse) several times to enlarge figure (or use menu) Create a polygon with nodes at the corners ****************************************** * Click on 'Draw Bezier curves and straight lines (shift + F6)' (default is straight lines) * To create a straight line segment, click the left mouse button and move mouse. Make last node coincide with first to close the polygon. * To delete figure, click on 'Select and transform objects (F1)', left-click and hold to select a square around the whole figure. Press 'Delete' on the key-board. Edit paths ********** * Click on 'Edit path nodes or control handles (F2)', then click on figure to view nodes. * Can select individual nodes (become blue), or click and drag them. Can select more than 1 node by holding down the shift key while clicking on the nodes. To select all the nodes hold the left mouse button down and drag a 'square' round the figure. * To add more nodes between corners first select whole figure as above. Then repeatedly click on the 'Insert new nodes ...' option on the temporary menu bar above (look for '+' sign). Notice that nodes along any straight line segment are equally spaced, and that short segments will have nodes more densely packed than long segments. Can remedy this by deleting individual nodes. Joining figures to make a single path ************************************* * To keep things simple, suppose we wish to join a circle to a square. First create the circle using the 'Create circle, ellipses, and arcs (F5)' button, and an overlapping rectangle using the 'Create rectangles and squares (F4)' button. Notice how they are by default filled with colour. * To remove colour select the individual figures, from the 'Object' menu click on 'Fill and stroke ...', then click on 'x' within the pop-up box. * To join the 2 figures, select the combined figure (as described above using F1), and from the 'Path' menu select 'Union'. At this stage we may wish to add more nodes along curved parts of the figure (see 'Edit paths' above.) * To convert curved arcs to straight line segments, click on 'Edit path nodes or control handles (F2)', select whole figure, and then click on the temporary menu button 'Make selected segments lines' (button has 2 nodes joined by a straight line segment). Exporting the coordinates of nodes in a path ******************************************** * Click on 'Edit path nodes or control handles (F2)', click on figure so nodes visible, and then click on the menu button that looks like '' (XML Editor). * In the pop-up window click on the first 'attrubute' (begins with a 'd'). The node coordinates will appear below on one line, separated by the letter 'L' (except at start and end, where there is an 'M' and then a 'z'. * Copy the whole line of coordinates with letters to a text editor, and manually edit it so that it looks like 34.888 899.443 18.449 143.677 ... ... If anyone finds out how to do this automatically, please let me know! If this is to be imported into Matlab as an array, it will have to be edited a bit more. Problems with islands ********************* * For the triangulation program we may need the coordinates for the perimeter of our domain to be in a separate file to the one with the coordinates of an 'island'. Create separate Inkscape figures for the island and the perimeter (just e.g., select and delete the nodes of the island to leave the perimeter) and save as a .png bitmap. Then proceed as described in 'Exporting the coordinates of nodes in a path' above for each figure.