Last modified on 4 March 2011, at 17:17

Asymptote

Asy logo.gif

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.

HowtoEdit

This section should contain recipes for different tasks.

Command referenceEdit

Please help to make the command pages:

asy -l <module> | grep '('

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

plainEdit

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

simplexEdit

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.

mathEdit

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

geometryEdit

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.

see http://svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/base/geometry.asy?revision=1629&view=markup

perpendicular square

statsEdit

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

patternsEdit

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

brick checker crosshatch hatch tile tiling

treeEdit

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

contains lookup newtree

drawtreeEdit

This is a simple tree drawing module.

drawAll layout makeNode

feynmanEdit

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

roundedpathEdit

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

roundedpath

pdfanimEdit

This module produces portable clickable high-quality PDF movies.

embedEdit

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

embed hyperlink

slideEdit

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

MetaPostEdit

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

cutafter cutbefore

unicodeEdit

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

latin1Edit

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.

babelEdit

This module implements the LaTeX babel package in Asymptote.

babel

annotateEdit

This module supports PDF annotations for viewing with Adobe Reader.

CADEdit

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

graphEdit

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

paletteEdit

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

threeEdit

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

lightEdit

Provides a simple implementation of three-dimensional lighting effects.

defaultshade defaultshading light shade

graph3Edit

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

solidsEdit

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

base cone cylinder perp revolution sphere tangent

surfacesEdit

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

flowchartEdit

Provides routines to assist in drawing flowcharts.

bevel diamond path rectangle roundrectangle

contourEdit

This package draws contour lines.

addseg case1 case2 case3 checktriangle contour join

slopefieldEdit

curve func slopefield

Other ReferenceEdit

File input and output

External linksEdit