Asymptote | |
Logo Caption: | The Asymptote logo (SVG file created with Asymptote) |
Paradigm: | imperative, typesetting |
Designer: | Andy Hammerlindl, John C. Bowman, Tom Prince |
Typing: | strong |
Influenced By: | MetaPost |
Programming Language: | C++ |
Operating System: | Cross-platform |
License: | LGPL |
Asymptote is a descriptive vector graphics language - developed by Andy Hammerlindl, John C. Bowman (University of Alberta), and Tom Prince - which provides a natural coordinate-based framework for technical drawing. Asymptote runs on all major platforms (Unix, Mac OS, Microsoft Windows). It is free software, available under the terms of the GNU Lesser General Public License (LGPL).
Asymptote typesets labels and equations with LaTeX, producing high-quality PostScript, PDF, SVG, or 3D PRC output.[1] It is inspired by MetaPost, but has a C-like syntax. It provides a language for typesetting mathematical figures, just as TeX/LaTeX provides a language for typesetting equations. It is mathematically oriented (e.g. rotation of vectors by complex multiplication), and uses the simplex method and deferred drawing to solve overall size constraint issues between fixed-sized objects (labels and arrowheads) and objects that should scale with figure size.
Asymptote fully generalizes MetaPost path construction algorithms to three dimensions,[2] and compiles commands into virtual machine code for speed without sacrificing portability. High-level graphics commands are implemented in the Asymptote language itself, allowing them to be easily tailored to specific applications. It also appears to be the first software package to lift TeX into three dimensions.[3] [4] This allows Asymptote to be used as a 3D vector file format.
Asymptote is also notable for having a graphical interface coded in Python (and the Tk widget set), xasy.py - this allows an inexperienced user to quickly draw up objects and save them as .asy source code which can then be examined or edited by hand.
The program's syntax was originally described by using a Yacc compatible grammar.
The following source code allows you to draw a graph of the Heaviside function by means of the Asymptote language.
size(300,300);
// Function.real[] x1 = ;real[] y1 = ;real[] x2 = ;real[] y2 = ;draw(graph(x1,y1),red+2);draw(graph(x2,y2),red+2);
draw((0,0)--(0,1),red+1.5+linetype("4 4"));fill(circle((0,1),0.035), red);filldraw(circle((0,0),0.03), white, red+1.5);
// Axes.xaxis(Label("$x$"), Ticks(new real[]), Arrow);yaxis(Label("$y$"), Ticks(new real[]), Arrow, ymin=-0.18, ymax=1.25);// Origin.labelx("$O$",0,SW);The code above yields the following pdf output.