Asymptote, a graphics software

by Willie Wong

Graphcs showing intersection of aligned and anti-aligned light-cones I’ve just discovered the software Asymptote, which purports to be the next generation replacement for MetaPost. A little bit of history: Donald Knuth wrote TeX. To produce pretty output, he wrote the software MetaFont, which is actually a general equation-solver/optimization/interpolation software that is well-adapted to generating fonts from some specified rules. It encapsulates the modern “a font is a program” paradigm. MetaPost was written based upon MetaFont to be a generic vector drawing format, using largely the same instructions as MetaFont. To produce a picture, one writes a program which describes what the picture looks like, with key points noted by coordinates; MetaPost then executes the program and interpolates the points to produce the final output.

Asymptote wants to be an improvement upon them. Like MetaPost, it uses LaTeX to generate labels and texts for inserting into the encapsulated-postscript output. The syntax is slightly changed: unlike MetaPost and MetaFont, Asymptote has a more C/C++ like language structure. But my favourite bit about the software is its native inclusion of 3D capabilities, which is immensely useful for making illustrations for harmonic analysis, general relativity, or differential geometry. (As an example, here I include something I made this evening at home. It is an illustration for the Klainerman-Machedon type bilinear estimates for the wave equation. Once I figured out the programming syntax, it only took 8 commands and a bit of high-school mathematics [to figure out the coordinate points] to compose the image.)

When talking about graphics software, I should of course mention PGF/TiKZ, which is by the same author of the popular LaTeX-beamer software for making PDF presentations. I like TiKZ. It has a decently clean syntax, and has very nice integration with LaTeX. (In particular, it has very nice integration with LaTeX-beamer, for obvious reasons.) Unfortunately, it suffers two problems. First is that it does not have native support of 3D drawing. For most people this is not a problem, but I do envision that a lot of the illustrations that I will draw will end up being in 3D. While there are some hacks to fake perspective/projection in TiKZ, it is a lot more convenient to just program the images in a language that supports 3D natively. The other problem is that TiKZ doesn’t always play well with DVI files. It prefers to be directly compiled into the PDF file. This is in part its design philosophy and in part limitations imposed by the DVI format.

(Asymptote should be able to be embedded directly into the LaTeX source; at least it is so stated in the user’s manual. The problem, of course, would be for collaborations and arXiv: because of the popularity of TiKZ/LaTeX-beamer, I can reasonably expect a collaborator or arXiv to have them installed on the computer. Asymptote, less so. So it will be wiser to stick with separate images from the document.)

Advertisements