This is a user-maintained reference to the Asymptote markup language. It is intended that this can serve as a useful resource for everyone from new users who wish to learn, to old hands who need a quick reference.

Howto edit

This section should contain recipes for different tasks.

Command reference edit

Please help to make the command pages:

asy -l <module> | grep '('

and add the functions to the command page along with info and examples.

plain edit

This is the default Asymptote base file, which defines key parts of the drawing language (such as the picture structure). By default, an implicit private import plain; occurs before translating a file and before the first command given in interactive mode. This also applies when translating files for module definitions (except when translating plain, of course). This means that the types and functions defined in plain are accessible in almost all Asymptote code. Use the -noautoplain command-line option to disable this feature.

abort abs acos acosh add alias align all angle arc ArcArrow ArcArrows arcarrowsize arcdir arclength arcpoint arctime arrow Arrow arrow2 arrowhead arrowheadbbox Arrows arrowsize asin asinh ask atan atan2 atanh atexit attach AvantGarde axialshade azimuth bar Bar Bars barsize basealign baseline bbox BeginArcArrow BeginArrow BeginBar beginclip BeginDotMargin begingroup BeginMargin BeginPenMargin beginpoint Blank Bookman box cap cast cbrt cd ceil Ceil circle clear clip close cmyk colatitude colors complement concat conj controls copy cos cosh Courier cross csv cubiclength cubicroots curl cycle cyclic deconstruct defaultpen degrees Degrees dimension dir dirtime dot DotMargin DotMargins dotsize Dotted _draw draw Draw ecast ellipse empty EndArcArrow EndArrow EndBar endclip EndDotMargin endgroup endl EndMargin EndPenMargin endpoint eof eol erase erf erfc error _eval eval execute exitfunction exp expi fabs fft fill Fill filldraw fillrule filltype find finite firstcut floor Floor flush fmod font fontcommand fontsize format gamma getc getint getpair getreal getstring gouraudshade graphic gray grestore gsave gui GUI GUIop GUIreset Helvetica hypot identity image init initdefaults input insert inside interact interp intersect intersectionpoint inverse invisible italic J label Label labelmargin labels Landscape lastcut latitude latticeshade layer legend length line linecap linejoin lineskip linetype linewidth log log10 longitude Longitude makedraw makepen map margin Margin Margins marginT Mark marker marknodes markroutine markuniform math max maxbound maxcoords merge MidArcArrow MidArrow midpoint min minbound minipage NewCenturySchoolBook newpage nib NoFill NoMargin none None nullexitfcn orientation output overwrite Palatino pattern pause Pen PenMargin PenMargins point polar polygon Portrait postcontrol postscript pow10 precision precontrol prepend quadraticroots quiet quotient radialshade RadialShade rand read1 read2 read3 readGUI readline realmult rectify reflect relative
Relative - specifies a relative location.
relativedistance reldir relpoint reltime remainder replace resetdefaultpen restore restoredefaults reverse rfind rgb rotate round Round scale scroll search Seascape seek sequence sgn shift shiftless shipout sin single sinh size slant solve sort spec sqrt srand straight subpath substr suffix sum Symbol system tab tan tanh tell tension tex texify TeXify texpreamble time TimesRoman transpose tridiagonal trim TrueMargin unfill UnFill unit uptodate VERSION write xinput xoutput xpart xscale xtrans Y ypart yscale ytrans ZapfChancery ZapfDingbats zpart

simplex edit

This package solves the two-variable linear programming problem using the simplex method. It is used by the module plain for automatic sizing of pictures.

math edit

This package extends Asymptote's mathematical capabilities with point-in-polygon and intersection algorithms and matrix arithmetic.

aCos aSin aTan Cos cot csc determinant drawline extension frac grid interpolate node nonsquare normal partialsum quadrant radians rectangular sec Sin slope square square2 square3 Tan unitnormal value zero zeta

geometry edit

This module provides the beginnings of a geometry package. It currently includes a triangle structure and functions to draw interior arcs of triangles and perpendicular symbols.


perpendicular square

stats edit

This package implements a Gaussian random number generator and a collection of statistics routines, including histogram and leastsquares.

Gaussian Gaussrand Gaussrandpair frequency halfbox histogram kurtosis kurtosisexcess leastsquares mean rms skewness stdev unitrand variance variancebiased

patterns edit

This package implements Postscript tiling patterns and includes several convenient pattern generation routines.

brick checker crosshatch hatch tile tiling

tree edit

This package implements an example of a dynamic binary search tree.

contains lookup newtree

drawtree edit

This is a simple tree drawing module.

drawAll layout makeNode

feynman edit

This package is useful for drawing Feynman diagrams.

currentarrow currentmomarrow do_overpaint drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX fmdefaults gluon momArrowPath momarrowsize photon texshipout

roundedpath edit

This package is useful for rounding the sharp corners of paths.


pdfanim edit

This module produces portable clickable high-quality PDF movies.

embed edit

This module provides an interface to the LaTeX package for embedding movies, sounds, and 3D objects into a PDF document.

embed hyperlink

slide edit

This package provides a simple yet high-quality facility for making presentation slides, including portable embedded PDF animations.

background center checkposition equation figure incrementposition item newslide nextpage numberpage outline remark skip step subitem title titlepage vbox

MetaPost edit

This package provides some useful routines to help MetaPost users migrate old MetaPost code to Asymptote.

cutafter cutbefore

unicode edit

Import this package at the beginning of the file to instruct LaTeX to accept unicode (UTF-8) standardized international characters.

latin1 edit

If you don't have LaTeX support for unicode installed, you can enable support for Western European languages (ISO 8859-1) by importing the module latin1.

babel edit

This module implements the LaTeX babel package in Asymptote.


annotate edit

This module supports PDF annotations for viewing with Adobe Reader.

CAD edit

This package provides basic pen definitions and measurement functions for simple 2D CAD drawings according to DIN 15.

graph edit

This package implements two-dimensional linear and logarithmic graphs, including automatic scale and tick selection.

Arc Bottom BottomTop Broken Circle Format Left LeftRight LeftTicks Linear Log LogFormat NoTicks Right RightTicks Scale Spline Straight Ticks Top XEquals XZero YEquals YZero autoscale axes axis axiscoverage bool bounds checkaxis conditional crop divisors drawtick errorbar errorbars graph join labelaxis labeltick labelx labely limits linear logaxiscoverage next polargraph scientific secondaryX secondaryY tick tickMax tickMin ticklabel ticklabelshift ticklocate ticks upscale valuetime vector
vectorfield - Draw a vectorfield along a path
xaxis xaxisAt xequals xlimits xtick yaxis yaxisAt yequals ylimits ytick

palette edit

Automatic BWRainbow BWRainbow2 Full Grayscale PaletteTicks Rainbow Range data) palette range transpose

three edit

This module fully extends the notion of guides and paths in Asymptote to three dimensions.

acos1 aim alias aspect bbox3 cast concat controls copy curl3 cycle3 distort init intersection invert lookAt nodes nullpath3 oblique obliqueX obliqueY obliqueZ orthographic perspective plane project projection scale3 spec split splitCubic tension3 theta void xscale3 xypart yscale3 zscale3

light edit

Provides a simple implementation of three-dimensional lighting effects.

defaultshade defaultshading light shade

graph3 edit

Implements three-dimensional versions of the functions in the graph module.

G Spline Straight autolimits dir graph graph3 join perpendicular phi polargraph projecttime surface v xcrop ycrop zaxis zcrop zlimits

solids edit

Defines a structure revolution that can be used to fill and draw surfaces of revolution.

base cone cylinder perp revolution sphere tangent

surfaces edit

Package for drawing Bézier surfaces, the natural two-dimensional generalizations of a Bézier curve.

featpost3D (obsolete) edit

aCos angline anglinen aSin aTan bracket bstr cartaxes cb circleshadowpath coarse_line conorm Cos cot cover crossingpoint crossingpointf csc cstr determinant director_invisible doitnow draw_all_test draw_invisible drawline drawsegment ellipticpath ellipticshadowpath emptyline extension face face_drawfill face_invisible facepath faceraytrace faceshadowpath fieldlinepath fieldlinestep fill_faces fillfacewithlight flip frac generatedirface generatedirline generateonebiax getangle getanglepair getcossine getready goodcirclepath grid head_on_circle hexagonaltrimesh insidedge insidethisface insidethistriangle insideviewsphere insideviewtriangle interpolate kindofcube lineraytrace LinFunc magnetictrajectorypath makeface makeline masscenter maycrossviewplan maycrossviewplanf N ncrossprod nDotprod node nonsquare normal parSurFunc partialsum partrimesh pathofstraightline positivecharge produce_vga_border projectpoint ps quadrant radians rectangular resolvec rigorouscircle rigorouscone rigorousdisc rigorousfearpath rigorousfearshadowpath rp sec setthearena setthestage sharpraytrace signalshadowvertex signalvertex simplecar Sin slope smoothtorus spatialhalfcircle spatialhalfsfear square square2 square3 squareangline SurFunc Tan tdarrow themarkisinview trajectorypath tropicalglobe twocyclestogether unitnormal value VecFunc verygoodcone whatisthis X Z zero zeta

flowchart edit

Provides routines to assist in drawing flowcharts.

bevel diamond path rectangle roundrectangle

contour edit

This package draws contour lines.

addseg case1 case2 case3 checktriangle contour join

slopefield edit

curve func slopefield

Other Reference edit

File input and output

External links edit