Skip to content

rfeng2004/AsyPad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsyPad

A simple drawing tool that can convert diagrams into Asymptote code.

Shapes (as of v2.0)

Points: Free point, Point locked onto another shape, Intersection Point, Midpoint

Lines: Segment, Line, Parallel Line, Perpendicular Line, Angle Bisector, Perpendicular Bisector, Tangent Line

Circles: Center and Point on circle, Circumcircle, Incircle

Valid Point Names

Rename a point by double clicking on it. The following are valid point names:

  • The name is made only of capital letters and numbers, and starts with a capital letter.
  • The name is a capital letter, followed by an underscore, followed by a number or letter.
  • The name is a single capital letter followed by an apostrophe.

Configuring shapes

Open a window to configure a shape's settings (for example, coloring or hiding it) by double clicking on it or right clicking it and selecting the appropriate options in the popup window.

Zooming and Translating

Zoom by scrolling or using a "zoom gesture" (only available on trackpads) and translate the diagram by clicking anywhere on the background and dragging (you should see the mouse icon change from an open hand to a closed hand when the background is being dragged).

Note: Zooming in too much will create issues that stem from the fact that "lines" in AsyPad are not really infinite, just extremely long. Zooming in far enough for this to effect the diagram means that the diagram takes up around 100 times the size of a normal screen; this should not effect normal usage.

Keyboard Shortcuts

Press esc when you want to cancel drawing a shape.

Press ⌘S/Ctrl+S to save as an AsyPad (.apad) file.

Press ⌘Shift+S/Ctrl+Shift+S to save as an asymptote (.asy) file.

Press ⌘O/Ctrl+O to load an AsyPad (.apad) file.

Undo/Redo Functionality

Use ⌘Z/Ctrl+Z for undoing the last command, if there is one.

Use ⌘Y/Ctrl+Y for redoing the command that was undone, if there is one.

Functions that can be undone/redone: coloring a shape, deleting a shape, dragging a label, drawing a shape, hiding a shape, moving a shape, renaming a point, setting the value of a global variable (stroke width and asy unit size), translating, zooming.

Internal Structure

Each shape has a set of dependencies and children. A shape's dependencies are the shapes that define it. For example, a midpoint requires 2 points as its dependencies. A shape's children are the shapes that depend on it. This is important because when deleting a shape its children must also be deleted, since they are not defined anymore, and then the children's children must be deleted, etc.

File I/O

Diagrams can be saved into a .apad file, which can be reopened later by AsyPad. They can also be saved into .asy files containing the Asymptote code for the diagram. The Asymptote code generated by AsyPad is unique because it is organized by dependencies, therefore you can edit the coordinates of the points with dependency level 0 inside the Asymptote code and the diagram will retain all the same properties. You can find sample files in the AsyPad Library folder. The APMO13 .asy files are for comparison of the code generated by Geogebra and by AsyPad.

Live Updating Asymptote Panel

Going to View -> Show Asy Panel opens up a live updating panel containing the Asymptote code for the diagram, which is useful for quickly copy pasting.

Integration with LaTeX using asypad.sty and latexmk

AsyPad diagrams can be included directly into LaTeX documents! Download the asypad.sty file and include the given code snippet into ~/.latemkrc. After including \usepackage{asypad} in the document's preamble, diagrams from .apad files can be directly imported into a LaTeX document using \asypad{path-to-apad-file}. Avoid using tildes (~) as they bug LaTeX, but both absolute and relative file paths are acceptable. For example, \asypad{./diagrams/test.apad} and \asypad{/Users/raymondfeng/Documents/diagrams/test.apad} will both work (assuming the files at those paths exist). Finally, to compile the document, latexmk must be used; the code snippet that is pasted into the ~/.latexmkrc file tells latexmk to execute certain commands during the compilation in order to convert the .apad file into asymptote code that can then be compiled into the final diagram which appears in the document.

On Macs, no setup is required after installing the AsyPad.app from the provided .pkg file, since asypad.sty already points to the .jar file included in the app bundle. On Windows and Linux, the path to the AsyPad.jar file (which may need to be downloaded separately) needs to be changed accordingly in asypad.sty.