summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-20 22:56:10 +0000
committerKarl Berry <karl@freefriends.org>2014-04-20 22:56:10 +0000
commitce5dd4137c8f88f9449e78ea4e02081bb589432e (patch)
tree1482a78c9484fb143211d3c1bb56d6c95f8393a1
parentd7e9f3fbc05b16e08afeb5b2569cb39a9b03e661 (diff)
asy 2.25 sources
git-svn-id: svn://tug.org/texlive/trunk@33565 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/utils/README2
-rw-r--r--Build/source/utils/asymptote/ChangeLog308
-rwxr-xr-xBuild/source/utils/asymptote/GUI/xasyCodeEditor.py8
-rw-r--r--Build/source/utils/asymptote/INSTALL2
-rw-r--r--Build/source/utils/asymptote/Makefile.in11
-rw-r--r--Build/source/utils/asymptote/README8
-rw-r--r--Build/source/utils/asymptote/ReleaseNotes21
-rw-r--r--Build/source/utils/asymptote/application.cc25
-rw-r--r--Build/source/utils/asymptote/asy-keywords.el8
-rw-r--r--Build/source/utils/asymptote/asy.list178
-rw-r--r--Build/source/utils/asymptote/asymptote.spec2
-rw-r--r--Build/source/utils/asymptote/base/contour.asy1705
-rw-r--r--Build/source/utils/asymptote/base/embed.asy18
-rw-r--r--Build/source/utils/asymptote/base/lmfit.asy8
-rw-r--r--Build/source/utils/asymptote/base/math.asy2
-rw-r--r--Build/source/utils/asymptote/base/plain.asy13
-rw-r--r--Build/source/utils/asymptote/base/plain_filldraw.asy2
-rw-r--r--Build/source/utils/asymptote/base/plain_paths.asy31
-rw-r--r--Build/source/utils/asymptote/base/plain_shipout.asy9
-rw-r--r--Build/source/utils/asymptote/base/three.asy6
-rw-r--r--Build/source/utils/asymptote/base/three_surface.asy60
-rw-r--r--Build/source/utils/asymptote/config.guess730
-rw-r--r--Build/source/utils/asymptote/config.h.in2
-rw-r--r--Build/source/utils/asymptote/config.sub105
-rwxr-xr-xBuild/source/utils/asymptote/configure98
-rw-r--r--Build/source/utils/asymptote/configure.ac37
-rw-r--r--Build/source/utils/asymptote/doc/CAD.pdfbin68115 -> 0 bytes
-rw-r--r--Build/source/utils/asymptote/doc/FAQ/asy-faq.bfnn2
-rw-r--r--Build/source/utils/asymptote/doc/FAQ/asy-faq.info1671
-rwxr-xr-xBuild/source/utils/asymptote/doc/FAQ/install-sh356
-rwxr-xr-xBuild/source/utils/asymptote/doc/TeXShopAndAsymptote.pdfbin31686 -> 0 bytes
-rwxr-xr-xBuild/source/utils/asymptote/doc/asy-latex.pdfbin194493 -> 0 bytes
-rwxr-xr-xBuild/source/utils/asymptote/doc/asy.1297
-rw-r--r--Build/source/utils/asymptote/doc/asyRefCard.pdfbin53907 -> 0 bytes
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.pdfbin1234562 -> 0 bytes
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.texi98
-rw-r--r--Build/source/utils/asymptote/doc/externalprc.tex9
-rwxr-xr-xBuild/source/utils/asymptote/doc/install-sh356
-rw-r--r--Build/source/utils/asymptote/doc/latexmkrc_asydir4
-rw-r--r--Build/source/utils/asymptote/doc/png/Makefile.in3
-rw-r--r--Build/source/utils/asymptote/doc/png/asymptote.info9959
-rw-r--r--Build/source/utils/asymptote/drawsurface.cc7
-rw-r--r--Build/source/utils/asymptote/examples/RiemannSphere.asy47
-rw-r--r--Build/source/utils/asymptote/examples/circumcircle.asy9
-rw-r--r--Build/source/utils/asymptote/examples/refs.bib15
-rw-r--r--Build/source/utils/asymptote/examples/sqrtx01y1.asy3
-rw-r--r--Build/source/utils/asymptote/fftw++.cc19
-rw-r--r--Build/source/utils/asymptote/fftw++.h923
-rw-r--r--Build/source/utils/asymptote/guide.cc30
-rw-r--r--Build/source/utils/asymptote/guide.h26
-rw-r--r--Build/source/utils/asymptote/guideflags.h3
-rwxr-xr-xBuild/source/utils/asymptote/install-sh356
-rw-r--r--Build/source/utils/asymptote/interact.cc12
-rw-r--r--Build/source/utils/asymptote/memory.h6
-rw-r--r--Build/source/utils/asymptote/pair.h2
-rw-r--r--Build/source/utils/asymptote/patches/cygwin_glu.patch91
-rw-r--r--Build/source/utils/asymptote/picture.cc3
-rw-r--r--Build/source/utils/asymptote/prc/PRCbitStream.cc3
-rw-r--r--Build/source/utils/asymptote/prc/PRCbitStream.h3
-rw-r--r--Build/source/utils/asymptote/prc/oPRCFile.cc4
-rw-r--r--Build/source/utils/asymptote/prc/oPRCFile.h3
-rw-r--r--Build/source/utils/asymptote/prc/test.cc3
-rw-r--r--Build/source/utils/asymptote/prc/writePRC.cc4
-rw-r--r--Build/source/utils/asymptote/prc/writePRC.h3
-rw-r--r--Build/source/utils/asymptote/runarray.cc68
-rw-r--r--Build/source/utils/asymptote/runarray.in2
-rw-r--r--Build/source/utils/asymptote/runtime.cc867
-rw-r--r--Build/source/utils/asymptote/runtime.in9
-rw-r--r--Build/source/utils/asymptote/settings.cc50
-rw-r--r--Build/source/utils/asymptote/settings.h1
-rw-r--r--Build/source/utils/asymptote/symbol.h2
-rw-r--r--Build/source/utils/asymptote/tests/types/guide.asy16
72 files changed, 3636 insertions, 15108 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README
index 1917a384760..efee76bc59e 100644
--- a/Build/source/utils/README
+++ b/Build/source/utils/README
@@ -4,7 +4,7 @@ Public domain. Originally written 2005 by Karl Berry.
Extra utilities we (optionally) compile for TeX Live.
See comments in ../texk/README.
-asymptote 2.23 - checked 20may13
+asymptote 2.25 - checked 21apr14
update to TL from CTAN, to include prebuilt doc.
see http://tug.org/texlive/build.html#asymptote
and tlpkg/bin/tl-update-asy
diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog
index 747e2d6ee09..b7970cb2cd3 100644
--- a/Build/source/utils/asymptote/ChangeLog
+++ b/Build/source/utils/asymptote/ChangeLog
@@ -1,4 +1,312 @@
------------------------------------------------------------------------
+r5602 | jcbowman | 2014-04-20 00:12:08 -0600 (Sun, 20 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Update SVG documentation.
+
+------------------------------------------------------------------------
+r5601 | jcbowman | 2014-04-19 14:21:13 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/README
+ M /trunk/asymptote/memory.h
+ M /trunk/asymptote/runsystem.in
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/symbol.h
+
+Fix Boehm gc compatibility issue with compact option.
+
+------------------------------------------------------------------------
+r5600 | jcbowman | 2014-04-19 14:19:12 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_paths.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Add brace routine contributed by Charles Staats.
+
+------------------------------------------------------------------------
+r5599 | jcbowman | 2014-04-19 14:12:19 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/GUI/xasyCodeEditor.py
+
+Allow code editor command line options.
+
+------------------------------------------------------------------------
+r5598 | jcbowman | 2014-04-19 11:13:02 -0600 (Sat, 19 Apr 2014) | 4 lines
+Changed paths:
+ M /trunk/asymptote/base/embed.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Apply noplaybutton workaround only to new versions of media9.
+
+Add link to the excellent tutorial written by Charles Staats.
+
+------------------------------------------------------------------------
+r5597 | jcbowman | 2014-04-19 09:50:38 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_filldraw.asy
+
+Fix numerical precision issue in makepen.
+
+------------------------------------------------------------------------
+r5596 | jcbowman | 2014-04-19 09:26:31 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Re-enable mesh lines.
+
+------------------------------------------------------------------------
+r5595 | jcbowman | 2014-04-19 01:32:45 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/patches/cygwin_glu.patch
+
+Update cygwin GLU patch.
+
+------------------------------------------------------------------------
+r5594 | jcbowman | 2014-04-19 00:14:11 -0600 (Sat, 19 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/prc/PRCbitStream.cc
+ M /trunk/asymptote/prc/PRCbitStream.h
+ M /trunk/asymptote/prc/oPRCFile.cc
+ M /trunk/asymptote/prc/oPRCFile.h
+ M /trunk/asymptote/prc/test.cc
+ M /trunk/asymptote/prc/writePRC.cc
+ M /trunk/asymptote/prc/writePRC.h
+
+Acknowledge Michail Vidiassov's extensive contributions to the PRC code.
+
+------------------------------------------------------------------------
+r5593 | jcbowman | 2014-04-18 13:25:55 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Sort vector patches to work around opacity artifacts in many rendering engines.
+
+------------------------------------------------------------------------
+r5592 | jcbowman | 2014-04-18 11:43:49 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/embed.asy
+ M /trunk/asymptote/base/plain.asy
+ M /trunk/asymptote/base/plain_shipout.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Support raw PRC output with outformat="prc".
+
+------------------------------------------------------------------------
+r5591 | jcbowman | 2014-04-18 10:46:40 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/configure.ac
+
+Improve diagnostic when texi2dvi is missing.
+
+------------------------------------------------------------------------
+r5590 | jcbowman | 2014-04-18 10:45:43 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/embed.asy
+ M /trunk/asymptote/doc/externalprc.tex
+
+Fix inlineimage under pdflatex.
+
+------------------------------------------------------------------------
+r5589 | jcbowman | 2014-04-18 09:15:18 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain.asy
+
+Implement workarounds for Adobe Reader transparency artifact.
+
+------------------------------------------------------------------------
+r5588 | jcbowman | 2014-04-18 02:04:26 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/fftw++.cc
+
+Update FFT support file.
+
+------------------------------------------------------------------------
+r5587 | jcbowman | 2014-04-18 01:00:19 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Update documentation.
+
+------------------------------------------------------------------------
+r5586 | jcbowman | 2014-04-18 00:30:23 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/FAQ/asy-faq.bfnn
+
+Update FAQ about changing default arrow size.
+
+------------------------------------------------------------------------
+r5585 | jcbowman | 2014-04-18 00:01:09 -0600 (Fri, 18 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/embed.asy
+
+Avoid unwanted play button starting with media9 version 0.35.
+
+------------------------------------------------------------------------
+r5584 | jcbowman | 2014-04-17 23:29:00 -0600 (Thu, 17 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/README
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/fftw++.h
+
+Update fftw++ header file.
+
+------------------------------------------------------------------------
+r5583 | jcbowman | 2014-04-17 13:32:16 -0600 (Thu, 17 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/contour.asy
+ M /trunk/asymptote/configure.ac
+
+Revert to version r4783 of contour.asy until paraboloid version is fixed.
+
+------------------------------------------------------------------------
+r5582 | jcbowman | 2014-04-16 16:34:54 -0600 (Wed, 16 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+ M /trunk/asymptote/configure.ac
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/runsystem.in
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/settings.h
+ M /trunk/asymptote/symbol.h
+
+Update to Boehm garbage collector gc 7.4.0.
+
+------------------------------------------------------------------------
+r5581 | jcbowman | 2014-04-16 14:42:22 -0600 (Wed, 16 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/guideflags.h
+ M /trunk/asymptote/picture.cc
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/settings.cc
+
+Under MSWindows, look for ghostscript library in both 32 bit and 64 bit registries.
+
+------------------------------------------------------------------------
+r5580 | jcbowman | 2014-04-16 14:40:45 -0600 (Wed, 16 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/math.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/doc/asymptote.texi
+ A /trunk/asymptote/examples/refs.bib
+ M /trunk/asymptote/examples/sqrtx01y1.asy
+
+Update examples and documentation.
+
+------------------------------------------------------------------------
+r5579 | jcbowman | 2014-04-16 14:31:36 -0600 (Wed, 16 Apr 2014) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/lmfit.asy
+
+Test that printout is nonnull.
+
+------------------------------------------------------------------------
+r5578 | hammera | 2013-12-29 16:25:58 -0700 (Sun, 29 Dec 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/application.cc
+ M /trunk/asymptote/pair.h
+
+Fix an exact match bug.
+
+------------------------------------------------------------------------
+r5577 | hammera | 2013-12-28 16:13:18 -0700 (Sat, 28 Dec 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/guide.cc
+ M /trunk/asymptote/guide.h
+ M /trunk/asymptote/tests/types/guide.asy
+
+Change multiguide to avoid deep trees in normal use.
+
+------------------------------------------------------------------------
+r5576 | jcbowman | 2013-07-12 12:55:49 -0600 (Fri, 12 Jul 2013) | 1 line
+Changed paths:
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/configure.ac
+
+Increment version to 2.25svn.
+------------------------------------------------------------------------
+r5575 | jcbowman | 2013-07-12 10:07:05 -0600 (Fri, 12 Jul 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Fix typos in documentation.
+
+------------------------------------------------------------------------
+r5574 | jcbowman | 2013-07-12 10:06:47 -0600 (Fri, 12 Jul 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/drawsurface.cc
+
+Fix segmentation fault in drawSphere.
+
+------------------------------------------------------------------------
+r5573 | jcbowman | 2013-05-31 02:07:49 -0600 (Fri, 31 May 2013) | 2 lines
+Changed paths:
+ A /trunk/asymptote/examples/RiemannSphere.asy
+ A /trunk/asymptote/examples/circumcircle.asy
+
+Add examples.
+
+------------------------------------------------------------------------
+r5572 | jcbowman | 2013-05-30 15:53:24 -0600 (Thu, 30 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/README
+ M /trunk/asymptote/doc/asymptote.texi
+
+Update link to forum.
+
+------------------------------------------------------------------------
+r5571 | jcbowman | 2013-05-30 14:32:04 -0600 (Thu, 30 May 2013) | 2 lines
+Changed paths:
+ A /trunk/asymptote/doc/latexmkrc_asydir
+
+Add latexmkrc example file that stores figures in a subdirectory.
+
+------------------------------------------------------------------------
+r5570 | jcbowman | 2013-05-30 14:30:38 -0600 (Thu, 30 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/INSTALL
+ M /trunk/asymptote/doc/asymptote.texi
+
+Document new SVN repository URL.
+
+------------------------------------------------------------------------
+r5569 | jcbowman | 2013-05-30 13:51:33 -0600 (Thu, 30 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/configure.ac
+
+Remove explicit libglapi dependency.
+
+------------------------------------------------------------------------
+r5568 | jcbowman | 2013-05-27 19:57:17 -0600 (Mon, 27 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/interact.cc
+
+Simplify readpipeline (requires POSIX 2008) again.
+
+------------------------------------------------------------------------
+r5567 | jcbowman | 2013-05-27 19:52:26 -0600 (Mon, 27 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runarray.in
+
+Restore function pointer to allow recursive calls to simpson.
+
+------------------------------------------------------------------------
+r5566 | jcbowman | 2013-05-27 19:51:11 -0600 (Mon, 27 May 2013) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/png/Makefile.in
+
+Support make -n.
+
+------------------------------------------------------------------------
+r5565 | jcbowman | 2013-05-20 10:20:59 -0600 (Mon, 20 May 2013) | 1 line
+Changed paths:
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/configure.ac
+
+Increment version to 2.24svn.
+------------------------------------------------------------------------
r5564 | jcbowman | 2013-05-18 22:38:07 -0600 (Sat, 18 May 2013) | 6 lines
Changed paths:
M /trunk/asymptote/Makefile.in
diff --git a/Build/source/utils/asymptote/GUI/xasyCodeEditor.py b/Build/source/utils/asymptote/GUI/xasyCodeEditor.py
index 93e06e447ee..1f7ad60328f 100755
--- a/Build/source/utils/asymptote/GUI/xasyCodeEditor.py
+++ b/Build/source/utils/asymptote/GUI/xasyCodeEditor.py
@@ -14,6 +14,7 @@ from subprocess import call
from tempfile import mkstemp
from os import remove
from os import fdopen
+from os import path
from string import split
import xasyOptions
@@ -24,7 +25,12 @@ def getText(text=""):
tempf.write(text)
tempf.flush()
try:
- call(split(xasyOptions.options['externalEditor'])+[temp[1]])
+ cmdpath,cmd = path.split(xasyOptions.options['externalEditor'])
+ split_cmd = split(cmd)
+ cmdpart = [path.join(cmdpath,split_cmd[0])]
+ argpart = split_cmd[1:]+[temp[1]]
+ arglist = cmdpart+argpart
+ call(arglist)
except:
raise Exception('Error launching external editor.')
tempf.seek(0)
diff --git a/Build/source/utils/asymptote/INSTALL b/Build/source/utils/asymptote/INSTALL
index ade5ab7eb9e..6c8f1becfc2 100644
--- a/Build/source/utils/asymptote/INSTALL
+++ b/Build/source/utils/asymptote/INSTALL
@@ -30,7 +30,7 @@ Compiling Asymptote from Subversion Developmental Source Code
To compile from Subversion developmental source code:
-svn co http://asymptote.svn.sourceforge.net/svnroot/asymptote/trunk/asymptote
+svn co http://svn.code.sf.net/p/asymptote/code/trunk/asymptote
cd asymptote
./autogen.sh
./configure
diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in
index 3100cb10cd1..28be5fcc2ba 100644
--- a/Build/source/utils/asymptote/Makefile.in
+++ b/Build/source/utils/asymptote/Makefile.in
@@ -3,7 +3,9 @@
ARCH = unix
POLL = poll
-GC = @GCDIR@
+GCVERSION = @GCVERSION@
+GC = gc-$(GCVERSION)
+LIBATOMIC = libatomic_ops-$(GCVERSION)
GCOPTIONS = @GCOPTIONS@
GCLIB = @GCLIB@
GCPPLIB = @GCPPLIB@
@@ -128,8 +130,11 @@ $(GCLIB): $(GC).tar.gz
gunzip -c $(GC).tar.gz > $(GC).tar
tar -xf $(GC).tar
rm -f $(GC).tar
- if test "$(GC)" = "gc6.8"; then \
- cd $(GC)/include && patch < ../../patches/gc6.8_AIX.patch; \
+ if test -e $(LIBATOMIC).tar.gz; then \
+ gunzip -c $(LIBATOMIC).tar.gz > $(LIBATOMIC).tar; \
+ tar -xf $(LIBATOMIC).tar; \
+ rm -f $(LIBATOMIC).tar; \
+ mv $(LIBATOMIC) $(GC)/libatomic_ops; \
fi
if test "$(GC)" = "gc-7.0"; then \
cd $(GC)/include/private && \
diff --git a/Build/source/utils/asymptote/README b/Build/source/utils/asymptote/README
index 8952a059901..2ae52a0ba7e 100644
--- a/Build/source/utils/asymptote/README
+++ b/Build/source/utils/asymptote/README
@@ -1,5 +1,5 @@
ASYMPTOTE
- Copyright 2004-13 Andy Hammerlindl, John Bowman, and Tom Prince
+ Copyright 2004-14 Andy Hammerlindl, John Bowman, and Tom Prince
Asymptote is a powerful descriptive vector graphics language for technical
drawings, inspired by MetaPost but with an improved C++-like
@@ -17,7 +17,7 @@ http://sourceforge.net/projects/asymptote/.
Questions and comments should be sent to the Asymptote Forum:
-http://sourceforge.net/forum/forum.php?forum_id=409349
+http://sourceforge.net/p/asymptote/discussion/409349
All source files in the Asymptote project, unless explicitly noted otherwise,
are released under version 3 (or later) of the GNU Lesser General Public
@@ -48,8 +48,8 @@ the GNU Scientific Library, GNU Readline library, and other GPL
libraries. This version of Asymptote also ships with the dll libraries
noted below.
-The source code for cygwin1.dll is available under the GPL license:
-http://cygwin.com/snapshots/cygwin-src-20110327.tar.bz2
+The source code for the 1.7.29-2 cygwin1.dll is available under the GPL license:
+http://cygwin.com/snapshots/x86/cygwin-src-20140410.tar.xz
The source code for freeglut.dll is available under the X-Consortium license:
http://prdownloads.sourceforge.net/freeglut/freeglut-2.6.0.tar.gz
diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes
index 015fa1d0c1c..80e30b1b638 100644
--- a/Build/source/utils/asymptote/ReleaseNotes
+++ b/Build/source/utils/asymptote/ReleaseNotes
@@ -1,3 +1,24 @@
+Release Notes for Version 2.25
+
+A superfluous play button in rendered 3D images embedded by recent versions of
+media9 is now suppressed. The contour.asy module was reverted to a previous
+stable linearized version. A numerical precision issue in makepen was fixed.
+A routine for drawing braces was added. Deep recursion is now avoided in
+guide flattening. A workaround for an Adobe Reader transparency artifact
+was implemented for the pdflatex and xelatex tex engines. Raw PRC output
+can now be generated with the "-f prc" command-line option. Vector patches
+are now sorted to work around opacity artifacts in many rendering engines.
+The xasy code editor now accepts command-line options. Under MSWindows,
+the ghostscript library is searched for in both the 32 bit and 64 bit
+registries. The FAQ and documentation were updated.
+
+Release Notes for Version 2.24
+
+A segmentation fault in drawSphere was fixed. Recursive calls to simpson
+are now supported. The explicit libglapi dependency was removed.
+A latexmkrc example file that shows how to store figures in a subdirectory
+is now included.
+
Release Notes for Version 2.23
Compilation without the FFTW library is now supported again.
diff --git a/Build/source/utils/asymptote/application.cc b/Build/source/utils/asymptote/application.cc
index 65a4da71ca7..6a3ce6f24d8 100644
--- a/Build/source/utils/asymptote/application.cc
+++ b/Build/source/utils/asymptote/application.cc
@@ -368,7 +368,7 @@ bool namedFormals(signature *sig)
// Tests if arguments in the source signature can be matched to the formals
// in the target signature with no casting or packing.
// This allows overloaded args, but not named args.
-bool exactlyMatchable(signature *target, signature *source)
+bool exactMightMatch(signature *target, signature *source)
{
// Open signatures never exactly match.
if (target->isOpen)
@@ -458,21 +458,34 @@ app_list exactMultimatch(env &e,
function *ft = (function *)*t;
- if (!exactlyMatchable(ft->getSignature(), source))
+ // First we run a test to see if all arguments could be exactly matched.
+ // If this returns false, no such match is possible.
+ // If it returns true, an exact match may or may not be possible.
+ if (!exactMightMatch(ft->getSignature(), source))
continue;
application *a=application::match(e, ft, source, al);
- assert(a);
// Consider calling
+ // void f(A a=new A, int y)
+ // with
+ // f(3)
+ // This matches exactly if there is no implicit cast from int to A.
+ // Otherwise, it does not match.
+ // Thus, there is no way to know if the
+ // match truly is exact without looking at the environment.
+ // In such a case, exactMightMatch() must return true, but there is no
+ // exact match. Such false positives are eliminated here.
+ //
+ // Consider calling
// void f(int x, real y=0.0, int z=0)
// with
// f(1,2)
- // exactlyMatchable will return true, matching 1 to x and 2 to z, but the
+ // exactMightMatch() will return true, matching 1 to x and 2 to z, but the
// application::match will give an inexact match of 1 to x to 2 to y, due
// to the cast from int to real. Therefore, we must test for exactness
// even after matching.
- if (a->exact())
+ if (a && a->exact())
l.push_back(a);
}
@@ -559,6 +572,8 @@ app_list halfExactMultimatch(env &e,
// Simple check if there are too many arguments to match the candidate
// function.
+// A "tooFewArgs" variant was also implemented at some point, but did
+// not give any speed-up.
bool tooManyArgs(types::signature *target, types::signature *source) {
return source->getNumFormals() > target->getNumFormals() &&
!target->hasRest();
diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el
index 02f37ab90ba..f2802d6aecc 100644
--- a/Build/source/utils/asymptote/asy-keywords.el
+++ b/Build/source/utils/asymptote/asy-keywords.el
@@ -2,16 +2,16 @@
;; This file is automatically generated by asy-list.pl.
;; Changes will be overwritten.
;;
-(defvar asy-keywords-version "2.23")
+(defvar asy-keywords-version "2.25")
(defvar asy-keyword-name '(
and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator ))
(defvar asy-type-name '(
-Braid FitResult Label Legend Segment Solution TreeNode abscissa arc arrowhead binarytree binarytreeNode block bool bool3 bounds bqe circle conic coord coordsys cputime ellipse file filltype frame grid3 guide horner hsv hyperbola indexedTransform int inversion key light line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice solution splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triangle trilinear triple vector vertex void ))
+Braid FitResult Label Legend Solution TreeNode abscissa arc arrowhead binarytree binarytreeNode block bool bool3 bounds bqe circle conic coord coordsys cputime ellipse file filltype frame grid3 guide horner hsv hyperbola indexedTransform int inversion key light line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice solution splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triangle trilinear triple vector vertex void ))
(defvar asy-function-name '(
-AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DOSendl DOSnewl DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade RadialShadeDraw Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _begingroup3 _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addpenarc addpenline adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize ascii asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial bins bisector bisectorpoint bispline blend blockconnector box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte calculateScaling canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy copyPairOrTriple cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPRCcylinder drawPRCdisk drawPRCsphere drawPRCtube drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawpixel drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 embedplayer empty enclose end endScript endclip endgroup endgroup3 endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW isDuplicate isnan isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item jobname key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lexorder lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markthin markuniform mass masscenter massformat math max max3 maxAfterTransform maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minAfterTransform minbezier minbound minipage minratio mintimes miterlimit mktemp momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend printBytecode print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment segmentlimits sequence setcontour setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile stripsuffix strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose trembleFuzz triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim truepoint tube uncycle unfill uniform unique unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xlimits xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans ))
+AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DOSendl DOSnewl DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade RadialShadeDraw Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _begingroup3 _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addpenarc addpenline addseg adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize ascii asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial bins bisector bisectorpoint bispline blend blockconnector box bqe brace breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte calculateScaling canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect containmentTree contains contour contour3 controlSpecifier convert coordinates coordsys copy copyPairOrTriple cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPRCcylinder drawPRCdisk drawPRCsphere drawPRCtube drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawpixel drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 embedplayer empty enclose end endScript endclip endgroup endgroup3 endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isDuplicate isnan isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item jobname key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lexorder lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markthin markuniform mass masscenter massformat math max max3 maxAfterTransform maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minAfterTransform minbezier minbound minipage minratio mintimes miterlimit mktemp momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 prconly precision precontrol prepend printBytecode print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment segmentlimits sequence setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile stripsuffix strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose trembleFuzz triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim truepoint tube uncycle unfill uniform unique unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xlimits xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans ))
(defvar asy-variable-name '(
-AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coeff Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill MarkPath Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill Up VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentlight currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen defaultseparator diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz edge ellipsenodesnumberfactor eps epsgeo epsilon evenodd expansionfactor extendcap exterior fermionpen figureborder figuremattpen file3 firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbola hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand inf infinity institutionpen intMax intMin interior invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow line linemargin lm_infmsg lm_shortmsg longdashdotted longdashed magenta magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray ocgindex oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plain_bounds plain_scaling plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfactor stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor swap textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportmargin viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding ))
+AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coeff Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill MarkPath Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill Up VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp bracedefaultratio braceinnerangle bracemidangle braceouterangle brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentlight currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen defaultseparator diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz ellipsenodesnumberfactor eps epsgeo epsilon evenodd expansionfactor extendcap fermionpen figureborder figuremattpen file3 firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand inf infinity institutionpen intMax intMin invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow linemargin lm_infmsg lm_shortmsg longdashdotted longdashed magenta magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray ocgindex oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plain_bounds plain_scaling plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfactor stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor swap textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportmargin viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding ))
diff --git a/Build/source/utils/asymptote/asy.list b/Build/source/utils/asymptote/asy.list
index a6d1da77d06..3504abf635b 100644
--- a/Build/source/utils/asymptote/asy.list
+++ b/Build/source/utils/asymptote/asy.list
@@ -238,9 +238,9 @@ pair min(frame f);
pair min(path p);
pair min(path[] p);
triple min(path3 p);
-pair min(picture pic, bool user=<default>);
real min(... real[] a);
real min(real m, scaling s, coord[] c);
+pair min(picture pic, bool user=<default>);
real min(real m, scaling s, coord[] c);
int min(... int[] a);
filltype RadialShade(pen penc, pen penr);
@@ -252,20 +252,20 @@ int search(real[] a, real key, bool less(real, real));
int search(guide[] a, guide key, bool less(guide, guide));
int search(coord[] a, coord key, bool less(coord, coord));
int search(pair[] a, pair key, bool less(pair, pair));
+int search(coord[] a, coord key, bool less(coord, coord));
int search(object[] a, object key, bool less(object, object));
-int search(Legend[] a, Legend key, bool less(Legend, Legend));
int search(frame[] a, frame key, bool less(frame, frame));
-int search(coord[] a, coord key, bool less(coord, coord));
+int search(Legend[] a, Legend key, bool less(Legend, Legend));
int search(Label[] a, Label key, bool less(Label, Label));
int search(int[] a, int key, bool less(int, int));
int search(bool3[] a, bool3 key, bool less(bool3, bool3));
-int search(picture[] a, picture key, bool less(picture, picture));
int search(marker[] a, marker key, bool less(marker, marker));
int search(string[] a, string key, bool less(string, string));
int search(path[] a, path key, bool less(path, path));
int search(pen[] a, pen key, bool less(pen, pen));
int search(bool[] a, bool key, bool less(bool, bool));
int search(triple[] a, triple key, bool less(triple, triple));
+int search(picture[] a, picture key, bool less(picture, picture));
filltype RadialShadeDraw(real xmargin=<default>, real ymargin=<default>, pen penc, pen penr, pen drawpen=<default>);
real sin(real x);
real[] sin(real[] a);
@@ -340,11 +340,11 @@ pair max(frame f);
pair max(path p);
pair max(path[] p);
triple max(path3 p);
-real max(real M, scaling s, coord[] c);
+pair max(picture pic, bool user=<default>);
real max(real M, scaling s, coord[] c);
int max(... int[] a);
-pair max(picture pic, bool user=<default>);
real max(... real[] a);
+real max(real M, scaling s, coord[] c);
Label Label(Label L, pair position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>);
Label Label(string s, string size=<default>, explicit position position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>);
Label Label(Label L, explicit position position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>);
@@ -518,8 +518,9 @@ bool[] copy(bool[] a, int depth=<default>);
real[][] copy(real[][] a, int depth=<default>);
pen[] copy(pen[] a, int depth=<default>);
coord[] copy(coord[] a, int depth=<default>);
-coord[] copy(coord[] a, int depth=<default>);
+picture[] copy(picture[] a, int depth=<default>);
marker[] copy(marker[] a, int depth=<default>);
+Legend[] copy(Legend[] a, int depth=<default>);
Label[] copy(Label[] a, int depth=<default>);
pen[][] copy(pen[][] a, int depth=<default>);
path[] copy(path[] a, int depth=<default>);
@@ -530,9 +531,8 @@ string[][] copy(string[][] a, int depth=<default>);
frame[] copy(frame[] a, int depth=<default>);
pair[] copy(pair[] a, int depth=<default>);
bool3[] copy(bool3[] a, int depth=<default>);
+coord[] copy(coord[] a, int depth=<default>);
object[] copy(object[] a, int depth=<default>);
-picture[] copy(picture[] a, int depth=<default>);
-Legend[] copy(Legend[] a, int depth=<default>);
pair[][] copy(pair[][] a, int depth=<default>);
real[] abs(pair[] a);
real[] abs(triple[] a);
@@ -565,21 +565,21 @@ pen palered;
real[] map(real f(pair), pair[] a);
int[] map(int f(real), real[] a);
bool3[] map(bool3 f(bool3), bool3[] a);
-picture[] map(picture f(picture), picture[] a);
frame[] map(frame f(frame), frame[] a);
-coord[] map(coord f(coord), coord[] a);
+Legend[] map(Legend f(Legend), Legend[] a);
Label[] map(Label f(Label), Label[] a);
pen[][] map(pen[] f(pen[]), pen[][] a);
triple[] map(triple f(triple), triple[] a);
pen[] map(pen f(pen), pen[] a);
+coord[] map(coord f(coord), coord[] a);
object[] map(object f(object), object[] a);
-Legend[] map(Legend f(Legend), Legend[] a);
pair[] map(pair f(pair), pair[] a);
coord[] map(coord f(coord), coord[] a);
string[] map(string f(string), string[] a);
void()()[] map(void f()()(void()()), void()()[] a);
pair[][] map(pair[] f(pair[]), pair[][] a);
real[] map(real f(real), real[] a);
+picture[] map(picture f(picture), picture[] a);
int[] map(int f(int), int[] a);
string[][] map(string[] f(string[]), string[][] a);
bool[] map(bool f(bool), bool[] a);
@@ -601,8 +601,9 @@ pair minratio(path3 g);
int[] sequence(int n);
pen[][] sequence(pen[] f(int), int n);
coord[] sequence(coord f(int), int n);
-coord[] sequence(coord f(int), int n);
+picture[] sequence(picture f(int), int n);
marker[] sequence(marker f(int), int n);
+Legend[] sequence(Legend f(int), int n);
Label[] sequence(Label f(int), int n);
int[] sequence(int f(int), int n);
string[][] sequence(string[] f(int), int n);
@@ -614,9 +615,8 @@ bool[] sequence(bool f(int), int n);
string[] sequence(string f(int), int n);
pair[][] sequence(pair[] f(int), int n);
bool3[] sequence(bool3 f(int), int n);
+coord[] sequence(coord f(int), int n);
object[] sequence(object f(int), int n);
-picture[] sequence(picture f(int), int n);
-Legend[] sequence(Legend f(int), int n);
real[][] sequence(real[] f(int), int n);
real[] sequence(real f(int), int n);
int[] sequence(int n, int m);
@@ -700,6 +700,7 @@ void add(picture src, bool group=<default>, filltype filltype=<default>, bool ab
void add(picture pic=<default>, void d(frame f, transform t), bool exact=<default>);
void add(picture pic=<default>, void d(picture, real[][]), bool exact=<default>);
void add(picture dest, picture src, bool group=<default>, filltype filltype=<default>, bool above=<default>);
+void add(picture pic=<default>, Label L);
void add(picture dest, picture src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>);
void add(picture dest=<default>, object F, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>);
void add(frame dest, frame src, filltype filltype, bool above=<default>);
@@ -708,7 +709,6 @@ void add(picture pic=<default>, void d(frame f, real[][] t, picture pic, project
void add(frame dest, frame src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>);
void add(picture dest=<default>, frame src, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>);
void add(picture pic=<default>, void d(picture, transform), bool exact=<default>);
-void add(picture pic=<default>, Label L);
void add(frame f, transform t=<default>, Label L);
void add(picture src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>);
plain plain;
@@ -737,9 +737,8 @@ bool[] array(int n, bool value, int depth=<default>);
string[] array(int n, string value, int depth=<default>);
pair[][] array(int n, pair[] value, int depth=<default>);
bool3[] array(int n, bool3 value, int depth=<default>);
+coord[] array(int n, coord value, int depth=<default>);
object[] array(int n, object value, int depth=<default>);
-picture[] array(int n, picture value, int depth=<default>);
-Legend[] array(int n, Legend value, int depth=<default>);
real[][] array(int n, real[] value, int depth=<default>);
real[] array(int n, real value, int depth=<default>);
triple[] array(int n, triple value, int depth=<default>);
@@ -747,8 +746,9 @@ path[] array(int n, path value, int depth=<default>);
frame[] array(int n, frame value, int depth=<default>);
pen[][] array(int n, pen[] value, int depth=<default>);
coord[] array(int n, coord value, int depth=<default>);
-coord[] array(int n, coord value, int depth=<default>);
+picture[] array(int n, picture value, int depth=<default>);
marker[] array(int n, marker value, int depth=<default>);
+Legend[] array(int n, Legend value, int depth=<default>);
Label[] array(int n, Label value, int depth=<default>);
int[] array(int n, int value, int depth=<default>);
string[][] array(int n, string[] value, int depth=<default>);
@@ -872,7 +872,6 @@ void write(file file=<default>, string s=<default>, guide x, void suffix(file)=<
void write(file file=<default>, string s=<default>, pen x, void suffix(file)=<default> ... pen[]);
void write(file file, string s=<default>, explicit guide[] x, void suffix(file)=<default>);
void write(string s=<default>, cputime c, string format=<default>, void suffix(file)=<default>);
-void write(pairOrTriple a);
void write(string s=<default>, explicit path[] x, void suffix(file)=<default>);
void write(file file, void suffix(file)=<default>);
void write(file file=<default>, string s=<default>, pen[] p);
@@ -880,6 +879,7 @@ void write(void suffix(file)=<default>);
void write(file file, string s=<default>, explicit path[] x, void suffix(file)=<default>);
void write(file file=<default>, Label L, void suffix(file)=<default>);
void write(file file, string s=<default>, cputime c, string format=<default>, void suffix(file)=<default>);
+void write(pairOrTriple a);
void write(string s=<default>, bool3 b, void suffix(file)=<default>);
void write(file file, string s=<default>, bool3 b, void suffix(file)=<default>);
void write(string s=<default>, explicit guide[] x, void suffix(file)=<default>);
@@ -935,19 +935,19 @@ pen dotted;
string blend(pen p);
arrowhead HookHead;
arrowhead HookHead(real dir=<default>, real barb=<default>);
+picture[] concat(... picture[][]);
real[] concat(... real[][]);
pair[] concat(... pair[][]);
coord[] concat(... coord[][]);
pen[] concat(... pen[][]);
+coord[] concat(... coord[][]);
object[] concat(... object[][]);
-Legend[] concat(... Legend[][]);
path[] concat(... path[][]);
-coord[] concat(... coord[][]);
+Legend[] concat(... Legend[][]);
Label[] concat(... Label[][]);
int[] concat(... int[][]);
void()()[] concat(... void()()[][]);
bool3[] concat(... bool3[][]);
-picture[] concat(... picture[][]);
string[] concat(... string[][]);
marker[] concat(... marker[][]);
triple[] concat(... triple[][]);
@@ -961,16 +961,16 @@ real infinity;
bool alias(pair[][] a, pair[][] b);
bool alias(guide[] a, guide[] b);
bool alias(marginT a, marginT b);
-bool alias(coord[] a, coord[] b);
bool alias(projection a, projection b);
bool alias(side a, side b);
bool alias(marker a, marker b);
+bool alias(Legend[] a, Legend[] b);
bool alias(Label[] a, Label[] b);
bool alias(pair[] a, pair[] b);
-bool alias(scaling a, scaling b);
+bool alias(coord a, coord b);
bool alias(bounds a, bounds b);
bool alias(scaleT a, scaleT b);
-bool alias(Legend a, Legend b);
+bool alias(pairOrTriple a, pairOrTriple b);
bool alias(object a, object b);
bool alias(cputime a, cputime b);
bool alias(int[] a, int[] b);
@@ -978,40 +978,40 @@ bool alias(string[][] a, string[][] b);
bool alias(slice a, slice b);
bool alias(coord[] a, coord[] b);
bool alias(coords2 a, coords2 b);
-bool alias(pairOrTriple a, pairOrTriple b);
+bool alias(picture a, picture b);
bool alias(framedTransformStack a, framedTransformStack b);
bool alias(real[][] a, real[][] b);
bool alias(bool3 a, bool3 b);
bool alias(bool3[] a, bool3[] b);
bool alias(light a, light b);
-bool alias(picture a, picture b);
bool alias(position a, position b);
-bool alias(picture[] a, picture[] b);
bool alias(arrowhead a, arrowhead b);
bool alias(string[] a, string[] b);
bool alias(frame[] a, frame[] b);
-bool alias(coords2 a, coords2 b);
+bool alias(scaling a, scaling b);
bool alias(coord a, coord b);
bool alias(autoscaleT a, autoscaleT b);
+bool alias(picture[] a, picture[] b);
bool alias(bool[] a, bool[] b);
bool alias(void()()[] a, void()()[] b);
bool alias(pen[][] a, pen[][] b);
bool alias(filltype a, filltype b);
+bool alias(coord[] a, coord[] b);
bool alias(freezableBounds a, freezableBounds b);
bool alias(transformation a, transformation b);
bool alias(align a, align b);
bool alias(object[] a, object[] b);
-bool alias(Legend[] a, Legend[] b);
bool alias(path[] a, path[] b);
bool alias(triple[] a, triple[] b);
-bool alias(coord a, coord b);
bool alias(coords3 a, coords3 b);
+bool alias(Legend a, Legend b);
bool alias(Label a, Label b);
bool alias(marker[] a, marker[] b);
bool alias(processtime a, processtime b);
bool alias(real[] a, real[] b);
bool alias(pen[] a, pen[] b);
bool alias(hsv a, hsv b);
+bool alias(coords2 a, coords2 b);
bool alias(scaling a, scaling b);
bool alias(ScaleT a, ScaleT b);
bool alias(indexedTransform a, indexedTransform b);
@@ -1020,8 +1020,8 @@ int getint(string name=<default>, int default=<default>, string prompt=<default>
bool IgnoreAspect;
void postscript(frame f, string s);
void postscript(frame f, string s, pair min, pair max);
-void postscript(picture pic=<default>, string s);
void postscript(picture pic=<default>, string s, pair min, pair max);
+void postscript(picture pic=<default>, string s);
transform slant(real s);
void breakpoint(code s=<default>);
void breakpoints();
@@ -1041,6 +1041,7 @@ real[][] sort(real[][] a);
string[] sort(string[] a);
string[][] sort(string[][] a);
path[] sort(path[] a, bool less(path, path));
+picture[] sort(picture[] a, bool less(picture, picture));
pair[] sort(pair[] a, bool less(pair, pair));
void()()[] sort(void()()[] a, bool less(void()(), void()()));
real[] sort(real[] a, bool less(real, real));
@@ -1048,18 +1049,17 @@ bool[] sort(bool[] a, bool less(bool, bool));
coord[] sort(coord[] a, bool less(coord, coord));
pen[] sort(pen[] a, bool less(pen, pen));
pen[][] sort(pen[][] a, bool less(pen[], pen[]));
+coord[] sort(coord[] a, bool less(coord, coord));
object[] sort(object[] a, bool less(object, object));
-Legend[] sort(Legend[] a, bool less(Legend, Legend));
guide[] sort(guide[] a, bool less(guide, guide));
real[][] sort(real[][] a, bool less(real[], real[]));
triple[] sort(triple[] a, bool less(triple, triple));
-coord[] sort(coord[] a, bool less(coord, coord));
+Legend[] sort(Legend[] a, bool less(Legend, Legend));
Label[] sort(Label[] a, bool less(Label, Label));
string[] sort(string[] a, bool less(string, string));
int[] sort(int[] a, bool less(int, int));
string[][] sort(string[][] a, bool less(string[], string[]));
bool3[] sort(bool3[] a, bool less(bool3, bool3));
-picture[] sort(picture[] a, bool less(picture, picture));
pair[][] sort(pair[][] a, bool less(pair[], pair[]));
marker[] sort(marker[] a, bool less(marker, marker));
frame[] sort(frame[] a, bool less(frame, frame));
@@ -1347,15 +1347,15 @@ triple operator *(real[][] t, triple v);
triple operator *(real x, triple v);
triple operator *(triple v, real x);
path3 operator *(real[][] t, path3 g);
+picture operator *(transform t, picture orig);
side operator *(real x, side s);
Label operator *(real[][] t, Label L);
-picture operator *(real[][] t, picture orig);
path[] operator *(transform t, explicit path[] p);
bounds operator *(transform t, bounds b);
object operator *(transform t, explicit object F);
pair[] operator *(transform t, pair[] z);
Label operator *(transform t, Label L);
-picture operator *(transform t, picture orig);
+picture operator *(real[][] t, picture orig);
bool operator init();
int operator init();
real operator init();
@@ -1378,28 +1378,28 @@ transformation operator init();
align operator init();
slice operator init();
coords2 operator init();
-pairOrTriple operator init();
+picture operator init();
framedTransformStack operator init();
hsv operator init();
+coords2 operator init();
scaling operator init();
ScaleT operator init();
indexedTransform operator init();
-coords2 operator init();
+scaling operator init();
coord operator init();
autoscaleT operator init();
-scaling operator init();
+coord operator init();
bounds operator init();
scaleT operator init();
-Legend operator init();
+pairOrTriple operator init();
object operator init();
cputime operator init();
-coord operator init();
coords3 operator init();
+Legend operator init();
Label operator init();
processtime operator init();
bool3 operator init();
light operator init();
-picture operator init();
position operator init();
arrowhead operator init();
real operator cast(int);
@@ -1447,6 +1447,8 @@ guide[] operator cast(path[] g);
position operator cast(real x);
hsv operator cast(pen p);
Label operator cast(string s);
+pair operator cast(pairOrTriple a);
+triple operator cast(pairOrTriple a);
frame operator cast(object F);
bool3[] operator cast(bool[] b);
align operator cast(side side);
@@ -1464,8 +1466,6 @@ path[] operator cast(pair[] z);
path[] operator cast(path p);
bool[] operator cast(bool3[] b);
align operator cast(triple dir);
-pair operator cast(pairOrTriple a);
-triple operator cast(pairOrTriple a);
bool3 operator cast(bool b);
pen operator cast(hsv hsv);
position operator cast(int x);
@@ -1571,21 +1571,21 @@ bool operator ==(path a, path b);
bool operator ==(path3 a, path3 b);
bool operator ==(bool3 a, bool3 b);
bool operator ==(light a, light b);
-bool operator ==(picture a, picture b);
bool operator ==(position a, position b);
bool operator ==(arrowhead a, arrowhead b);
-bool operator ==(coords2 a, coords2 b);
+bool operator ==(scaling a, scaling b);
bool operator ==(coord a, coord b);
bool operator ==(autoscaleT a, autoscaleT b);
bool operator ==(filltype a, filltype b);
bool operator ==(freezableBounds a, freezableBounds b);
bool operator ==(transformation a, transformation b);
bool operator ==(align a, align b);
-bool operator ==(coord a, coord b);
bool operator ==(coords3 a, coords3 b);
+bool operator ==(Legend a, Legend b);
bool operator ==(Label a, Label b);
bool operator ==(processtime a, processtime b);
bool operator ==(hsv a, hsv b);
+bool operator ==(coords2 a, coords2 b);
bool operator ==(scaling a, scaling b);
bool operator ==(ScaleT a, ScaleT b);
bool operator ==(indexedTransform a, indexedTransform b);
@@ -1594,16 +1594,16 @@ bool operator ==(marginT a, marginT b);
bool operator ==(projection a, projection b);
bool operator ==(side a, side b);
bool operator ==(marker a, marker b);
-bool operator ==(scaling a, scaling b);
+bool operator ==(coord a, coord b);
bool operator ==(bounds a, bounds b);
bool operator ==(scaleT a, scaleT b);
-bool operator ==(Legend a, Legend b);
+bool operator ==(pairOrTriple a, pairOrTriple b);
bool operator ==(object a, object b);
bool operator ==(cputime a, cputime b);
bool operator ==(bool a, bool3 b);
bool operator ==(slice a, slice b);
bool operator ==(coords2 a, coords2 b);
-bool operator ==(pairOrTriple a, pairOrTriple b);
+bool operator ==(picture a, picture b);
bool operator ==(framedTransformStack a, framedTransformStack b);
bool operator !=(bool a, bool b);
bool[] operator !=(bool a, bool[] b);
@@ -1643,21 +1643,21 @@ bool operator !=(path a, path b);
bool operator !=(path3 a, path3 b);
bool operator !=(bool3 a, bool3 b);
bool operator !=(light a, light b);
-bool operator !=(picture a, picture b);
bool operator !=(position a, position b);
bool operator !=(arrowhead a, arrowhead b);
-bool operator !=(coords2 a, coords2 b);
+bool operator !=(scaling a, scaling b);
bool operator !=(coord a, coord b);
bool operator !=(autoscaleT a, autoscaleT b);
bool operator !=(filltype a, filltype b);
bool operator !=(freezableBounds a, freezableBounds b);
bool operator !=(transformation a, transformation b);
bool operator !=(align a, align b);
-bool operator !=(coord a, coord b);
bool operator !=(coords3 a, coords3 b);
+bool operator !=(Legend a, Legend b);
bool operator !=(Label a, Label b);
bool operator !=(processtime a, processtime b);
bool operator !=(hsv a, hsv b);
+bool operator !=(coords2 a, coords2 b);
bool operator !=(scaling a, scaling b);
bool operator !=(ScaleT a, ScaleT b);
bool operator !=(indexedTransform a, indexedTransform b);
@@ -1666,16 +1666,16 @@ bool operator !=(marginT a, marginT b);
bool operator !=(projection a, projection b);
bool operator !=(side a, side b);
bool operator !=(marker a, marker b);
-bool operator !=(scaling a, scaling b);
+bool operator !=(coord a, coord b);
bool operator !=(bounds a, bounds b);
bool operator !=(scaleT a, scaleT b);
-bool operator !=(Legend a, Legend b);
+bool operator !=(pairOrTriple a, pairOrTriple b);
bool operator !=(object a, object b);
bool operator !=(cputime a, cputime b);
bool operator !=(bool a, bool3 b);
bool operator !=(slice a, slice b);
bool operator !=(coords2 a, coords2 b);
-bool operator !=(pairOrTriple a, pairOrTriple b);
+bool operator !=(picture a, picture b);
bool operator !=(framedTransformStack a, framedTransformStack b);
bool operator <(int a, int b);
bool[] operator <(int a, int[] b);
@@ -1902,6 +1902,7 @@ void abort(string s=<default>);
bool Aspect;
string hex(pen p);
int hex(string s);
+path brace(pair a, pair b, real amplitude=<default>);
void deactivatequote(picture pic=<default>);
string format(string format, int x, string locale=<default>);
string format(string format, string separator, real x, string locale=<default>);
@@ -1919,15 +1920,20 @@ string outname();
void newpage(frame f);
void newpage(picture pic=<default>);
pen fontcommand(string s);
+real bracemidangle;
pair accel(path p, int t, int sign=<default>);
pair accel(path p, real t);
triple accel(path3 p, int t, int sign=<default>);
triple accel(path3 p, real t);
frame Portrait(frame f);
+real braceinnerangle;
+real braceouterangle;
void tex(frame f, string s);
void tex(frame f, string s, pair min, pair max);
-void tex(picture pic=<default>, string s);
void tex(picture pic=<default>, string s, pair min, pair max);
+void tex(picture pic=<default>, string s);
+real bracedefaultratio;
+bool prconly(string format=<default>);
pen Black;
triple size3(frame f);
void size3(picture pic=<default>, real x, real y=<default>, real z=<default>, bool keepAspect=<default>);
@@ -1992,49 +1998,25 @@ bsp operator init();
picture operator cast(face f);
face operator cast(path3 p);
void add(picture pic=<default>, face[] faces, projection P=<default>);
-void searchindex(boxcontour bc, bool forward, void f(int i, int j));
-segment case1(pair p0, pair p1, pair p2, real v0, real v1, real v2);
+segment case1(pair p0, pair p1, int edge);
void draw(picture pic=<default>, Label[] L=<default>, guide[][] g, pen[] p);
void draw(picture pic=<default>, Label[] L=<default>, guide[][] g, pen p=<default>);
-void draw(picture pic=<default>, Label L, guide[] g, pen p=<default>);
-int interior;
pen[][] interior(picture pic=<default>, guide[][] g, pen[] palette);
pen[] extend(pen[] palette, pen below, pen above);
-guide connect(Segment S, pair[][] z, guide join(... guide[]));
-guide[] connect(Segment[] S, pair[][] z, guide join(... guide[]));
-guide[][] connect(Segment[][] S, pair[][] z, guide join(... guide[]));
guide[][] connect(pair[][][] points, real[] c, guide join(... guide[]));
-bool same(gridpoint gp1, gridpoint gp2);
-bool connected(boxcontour bc1, boxcontour bc2);
-int exterior;
-int connectedindex(boxcontour bc, boxcontour[] bca, bool activeonly=<default>);
-int connectedindex(boxcontour[] bca, boxcontour bc, bool activeonly=<default>);
-segment case2(pair p0, pair p1, pair p2, real v0, real v1, real v2);
+segment case2(pair p0, pair p1, pair p2, real v0, real v1, real v2, int edge);
void collect(pair[][][] points, real[] c);
-int hyperbola;
-int edge;
-int line;
-segment case3(pair p0, pair p1, pair p2, real v0, real v1, real v2);
-segment checktriangle(pair p0, pair p1, pair p2, real v0, real v1, real v2);
-gridpoint operator init();
-boxcontour operator init();
-boxdata operator init();
-segment operator init();
-Segment operator init();
+segment case3(pair p0, pair p1, pair p2, real v0, real v1, real v2, int edge=<default>);
+segment checktriangle(pair p0, pair p1, pair p2, real v0, real v1, real v2, int edge=<default>);
segment operator init();
+void addseg(pair[][] gds, segment seg);
void fill(picture pic=<default>, guide[][] g, pen[][] palette);
-guide[][] contour(pair[][] z, real[][] f, real[] c, guide join(... guide[])=<default>, int subsample=<default>);
-guide[][] contour(real[][] f, pair a, pair b, real[] c, guide join(... guide[])=<default>, int subsample=<default>);
-guide[][] contour(real f(real, real), pair a, pair b, real[] c, int nx=<default>, int ny=<default>, guide join(... guide[])=<default>, int subsample=<default>);
-guide[][] contour(real f(pair), pair a, pair b, real[] c, int nx=<default>, int ny=<default>, guide join(... guide[])=<default>, int subsample=<default>);
+guide[][] contour(pair[][] z, real[][] f, real[][] midpoint=<default>, real[] c, guide join(... guide[])=<default>);
+guide[][] contour(real[][] f, real[][] midpoint=<default>, pair a, pair b, real[] c, guide join(... guide[])=<default>);
+guide[][] contour(real f(real, real), pair a, pair b, real[] c, int nx=<default>, int ny=<default>, guide join(... guide[])=<default>);
+guide[][] contour(real f(pair), pair a, pair b, real[] c, int nx=<default>, int ny=<default>, guide join(... guide[])=<default>);
guide[][] contour(pair[] z, real[] f, real[] c, guide join(... guide[])=<default>);
-segment[][] contouredges(real[][] f, real[] c, int subsample=<default>);
-void setcontour(real f00, real f10, real f01, real f11, real epsf, boxdata bd, int i, int j, int index);
-Segment[] Segment(segment[] s);
-Segment[][] Segment(segment[][] s);
real eps;
-segment case4(pair p0, pair p1, pair p2, real v0, real v1, real v2);
-bool isCCW(pair p0, pair p1, pair p2);
surface surface(vertex[][] g);
weighted operator init();
bucket operator init();
@@ -2874,16 +2856,16 @@ void labely(picture pic=<default>, Label L, string format=<default>, explicit pe
pair labeltick(frame d, transform T, path g, ticklocate locate, real val, pair side, int sign, real Size, string ticklabel(real), Label F, real norm=<default>);
void labelaxis(frame f, transform T, Label L, path g, ticklocate locate=<default>, int sign=<default>, bool ticklabels=<default>);
void xaxisAt(picture pic=<default>, Label L=<default>, void axis(picture, axisT), real xmin=<default>, real xmax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool opposite=<default>);
-void yaxisAt(picture pic=<default>, Label L=<default>, void axis(picture, axisT), real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool opposite=<default>);
void xtick(picture pic=<default>, explicit pair z, pair dir=<default>, real size=<default>, pen p=<default>);
void xtick(picture pic=<default>, real x, pair dir=<default>, real size=<default>, pen p=<default>);
void xtick(picture pic=<default>, Label L, explicit pair z, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>);
void xtick(picture pic=<default>, Label L, real x, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>);
-void xaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real xmin=<default>, real xmax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>);
+void yaxisAt(picture pic=<default>, Label L=<default>, void axis(picture, axisT), real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool opposite=<default>);
void ytick(picture pic=<default>, explicit pair z, pair dir=<default>, real size=<default>, pen p=<default>);
void ytick(picture pic=<default>, real y, pair dir=<default>, real size=<default>, pen p=<default>);
void ytick(picture pic=<default>, Label L, explicit pair z, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>);
void ytick(picture pic=<default>, Label L, real y, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>);
+void xaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real xmin=<default>, real xmax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>);
void yaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool autorotate=<default>);
picture secondaryX(picture primary=<default>, void f(picture));
picture secondaryY(picture primary=<default>, void f(picture));
@@ -3123,6 +3105,7 @@ grid3(picture pic)[] XYXgrid(position pos=<default>);
grid3(picture pic)[] XYXgrid;
grid3(picture pic)[] XY_XZgrid(position posa=<default>, position posb=<default>);
grid3(picture pic)[] XY_XZgrid;
+position middle;
grid3(picture pic)[] ZX_ZYgrid(position posa=<default>, position posb=<default>);
grid3(picture pic)[] ZX_ZYgrid;
grid3 XYgrid(picture pic)(position pos=<default>);
@@ -3156,7 +3139,6 @@ grid3 XZgrid(picture pic)(position pos=<default>);
grid3 XZgrid(picture pic);
grid3 YZgrid(picture pic)(position pos=<default>);
grid3 YZgrid(picture pic);
-position middle;
grid3(picture pic)[][] XYZgrid(position pos=<default>);
grid3(picture pic)[][] XYZgrid;
grid3(picture pic)[] ZYZgrid(position pos=<default>);
@@ -3653,8 +3635,8 @@ pen Plum;
pen LemonChiffon;
pen Aquamarine;
pen Blue;
-pen Gold;
pen Sienna;
+pen Gold;
pen BlueViolet;
pen Goldenrod;
pen ForestGreen;
@@ -3684,8 +3666,8 @@ pen OrangeRed;
pen Fuchsia;
pen PeachPuff;
pen Honeydew;
-pen Bisque;
pen Maroon;
+pen Bisque;
pen YellowGreen;
pen RosyBrown;
pen Black;
@@ -3702,8 +3684,8 @@ pen Green;
pen GreenYellow;
pen DarkCyan;
pen FloralWhite;
-pen DarkRed;
pen Violet;
+pen DarkRed;
pen SandyBrown;
pen BlanchedAlmond;
pen PowderBlue;
diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec
index 2185ac4c8a9..fe8b84cd238 100644
--- a/Build/source/utils/asymptote/asymptote.spec
+++ b/Build/source/utils/asymptote/asymptote.spec
@@ -1,7 +1,7 @@
%{!?_texmf: %define _texmf %(eval "echo `kpsewhich -expand-var '$TEXMFLOCAL'`")}
Name: asymptote
-Version: 2.23
+Version: 2.25
Release: 1%{?dist}
Summary: Descriptive vector graphics language
diff --git a/Build/source/utils/asymptote/base/contour.asy b/Build/source/utils/asymptote/base/contour.asy
index 27a79439e2d..fbb4cd1c71a 100644
--- a/Build/source/utils/asymptote/base/contour.asy
+++ b/Build/source/utils/asymptote/base/contour.asy
@@ -1,922 +1,307 @@
-/*
- Contour routines written by Radoslav Marinov, John Bowman, and Chris Savage.
-
- [2009/10/15: C Savage] generate oriented contours
- [2009/10/19: C Savage] use boxes instead of triangles
-*/
-
-/*
- Contours lines/guides are oriented throughout. By convention,
- for a single contour, higher values are to the left and/or lower
- values are to the right along the direction of the lines/guide.
-*/
-
+// Contour routines written by Radoslav Marinov and John Bowman.
+
import graph_settings;
-private real eps=sqrtEpsilon;
-
-/*
- GRID CONTOURS
-
- Contours on a grid of points are determined as follows:
- for each grid square, the function is approximated as the unique
- paraboloid passing through the function values at the four
- corners. The intersection of a paraboloid with the f(x,y)=c
- plane is a line or hyperbola.
-
- Grid data structures:
-
- boxcontour:
- Describes a particular contour segment in a grid square.
-
- boxdata:
- Describes contours in a grid square (holds boxcontours).
-
- segment:
- Describes a contour line. Usually a closed (interior) contour,
- a line that terminates on the border, or a border segment used
- to enclose a region.
-
- Segment:
- Describes a contour line.
-
- Main grid routines:
-
- setcontour:
- Determines the contours in a grid square.
-
- contouredges:
- Determines the contour segments over a grid of function values.
-
- connect:
- Converts contours into guides
-
-*/
-
-private typedef int boxtype;
-private boxtype exterior=-1;
-private boxtype edge = 0;
-private boxtype interior=+1;
+real eps=10000*realEpsilon;
+
+// 1
+// 6 +-------------------+ 5
+// | \ / |
+// | \ / |
+// | \ / |
+// | \ / |
+// 2 | X | 0
+// | / \ |
+// | / \ |
+// | / \ |
+// | / \ |
+// 7 +-------------------+ 4 or 8
+// 3
-private typedef int contourshape;
-private contourshape line =1;
-private contourshape hyperbola=2;
-
-// Describe position by grid square and position in square
-private struct gridpoint {
- int i,j;
- pair z;
- void operator init(int i, int j, pair z) {
- this.i=i;
- this.j=j;
- this.z=z;
- }
- void operator init(gridpoint gp) {
- this.i=gp.i;
- this.j=gp.j;
- this.z=gp.z;
- }
+private struct segment
+{
+ bool active;
+ pair a,b; // Endpoints; a is always an edge point if one exists.
+ int c; // Contour value.
+ int edge; // -1: interior, 0 to 3: edge,
+ // 4-8: single-vertex edge, 9: double-vertex edge.
}
-private bool same(gridpoint gp1, gridpoint gp2)
+// Case 1: line passes through two vertices of a triangle
+private segment case1(pair p0, pair p1, int edge)
{
- return abs(gp2.z-gp1.z+(gp2.i-gp1.i,gp2.j-gp1.j)) < eps;
+ // Will cause a duplicate guide; luckily case1 is rare
+ segment rtrn;
+ rtrn.active=true;
+ rtrn.a=p0;
+ rtrn.b=p1;
+ rtrn.edge=edge;
+ return rtrn;
}
-
-// Describe contour in unit square(scaling to be done later).
-private struct boxcontour {
- bool active;
- contourshape type; // Shape of contour segment(line or hyperbola)
- pair a,b; // Start/end point of contour segment.
- // Higher values to left along a--b.
- real x0,y0,m; // For hyperbola: (x-x0)*(y-y0)=m
- int signx,signy; // Sign of x-x0&y-y0 for hyperbola piece;
- // identifies which direction it opens
- int i,j; // Indices of lower left corner in position or
- // data array.
- int index; // Contour index
-
- void operator init(contourshape type, pair a, pair b,
- real x0, real y0, real m, int signx, int signy,
- int i, int j, int index) {
- this.active=true;
- this.type=type;
- this.a=a;
- this.b=b;
-
- this.x0=x0;
- this.y0=y0;
- this.m=m;
- this.signx=signx;
- this.signy=signy;
-
- this.i=i;
- this.j=j;
- this.index=index;
- }
- // Generate list of points along the line/hyperbola segment
- // representing the contour in the box
- gridpoint[] points(int subsample=1, bool first=true, bool last=true) {
- gridpoint[] gp;
- if(first)
- gp.push(gridpoint(i,j,a));
- if(subsample > 0) {
- // Linear case
- if(type == line) {
- for(int k=1; k <= subsample; ++k) {
- pair z=interp(a,b,k/(subsample+1));
- gp.push(gridpoint(i,j,z));
- }
- } else if(type == hyperbola) {
- // Special hyperbolic case of m=0
- // The contours here are infinite lines at x=x0 and y=y0,
- // but handedness always connects a semi-infinite
- // horizontal segment with a semi-infinite vertical segment
- // connected at (x0,y0).
- // If (x0,y0) is outside the unit box, there is only one
- // line segment to include; otherwise, there are both
- // a horizontal and a vertical line segment to include.
- if(m == 0) {
- // Single line
- if(a.x == b.x || a.y == b.y) {
- for(int k=1; k <= subsample; ++k) {
- pair z=interp(a,b,k/(subsample+1));
- gp.push(gridpoint(i,j,z));
- }
- // Two lines(may get one extra point here)
- } else {
- int nsub=quotient(subsample,2);
- pair mid=(x0,y0);
- for(int k=1; k <= nsub; ++k) {
- pair z=interp(a,mid,k/(nsub+1));
- gp.push(gridpoint(i,j,z));
- }
- gp.push(gridpoint(i,j,mid));
- for(int k=1; k <= nsub; ++k) {
- pair z=interp(mid,b,k/(nsub+1));
- gp.push(gridpoint(i,j,z));
- }
- }
- // General hyperbolic case (m != 0).
- // Parametric equations(m > 0):
- // x(t)=x0 +/- sqrt(m)*exp(t)
- // y(t)=y0 +/- sqrt(m)*exp(-t)
- // Parametric equations (m < 0):
- // x(t)=x0 +/- sqrt(-m)*exp(t)
- // y(t)=y0 -/+ sqrt(-m)*exp(-t)
- // Points will be taken equally spaced in parameter t.
- } else {
- real sqrtm=sqrt(abs(m));
- real ta=log(signx*(a.x-x0)/sqrtm);
- real tb=log(signx*(b.x-x0)/sqrtm);
- real[] t=uniform(ta,tb,subsample+1);
- for(int k=1; k <= subsample; ++k) {
- pair z=(x0+signx*sqrtm*exp(t[k]),
- y0+signy*sqrtm*exp(-t[k]));
- gp.push(gridpoint(i,j,z));
- }
- }
- }
- }
- if(last)
- gp.push(gridpoint(i,j,b));
-
- return gp;
+// Case 2: line passes through a vertex and a side of a triangle
+// (the first vertex passed and the side between the other two)
+private segment case2(pair p0, pair p1, pair p2,
+ real v0, real v1, real v2, int edge)
+{
+ segment rtrn;
+ pair val=interp(p1,p2,abs(v1/(v2-v1)));
+ rtrn.active=true;
+ if(edge < 4) {
+ rtrn.a=val;
+ rtrn.b=p0;
+ } else {
+ rtrn.a=p0;
+ rtrn.b=val;
}
+ rtrn.edge=edge;
+ return rtrn;
}
-// Hold data for a single grid square
-private struct boxdata {
- boxtype type; // Does box contain a contour segment (edge of
- // contour region) or is it entirely interior/
- // exterior to contour region ?
- real min,max; // Smallest/largest corner value
- real max2; // Second-largest corner value
- boxcontour[] data; // Stores actual contour segment data
-
- int count() {return data.length;}
- void operator init(real f00, real f10, real f01, real f11) {
- real[] X={f00,f10,f01,f11};
- min=min(X);
- max=max(X);
- X.delete(find(X == max));
- max2=max(X);
- }
- void settype(real c) {
- // Interior case(f >= c)
- if(min > c-eps) {
- type=interior;
- // Exterior case(f < c)
- } else if(max < c-eps) {
- type=exterior;
- // Special case: only one corner at f=c, f < c elsewhere
- //(no segment in this case)
- } else if((max < c+eps) && (max2 < c-eps)) {
- type=exterior;
- // Edge of contour passes through box
- } else {
- type=edge;
- }
- }
+// Case 3: line passes through two sides of a triangle
+// (through the sides formed by the first & second, and second & third
+// vertices)
+private segment case3(pair p0, pair p1, pair p2,
+ real v0, real v1, real v2, int edge=-1)
+{
+ segment rtrn;
+ rtrn.active=true;
+ rtrn.a=interp(p1,p0,abs(v1/(v0-v1)));
+ rtrn.b=interp(p1,p2,abs(v1/(v2-v1)));
+ rtrn.edge=edge;
+ return rtrn;
}
+// Check if a line passes through a triangle, and draw the required line.
+private segment checktriangle(pair p0, pair p1, pair p2,
+ real v0, real v1, real v2, int edge=-1)
+{
+ // default null return
+ static segment dflt;
-/*
- Determine contours within a unit square box.
-
- Here, we approximate the function on the unit square to be a quadric
- surface passing through the specified values at the four corners:
- f(x,y)=(1-x)(1-y) f00+x(1-y) f10+(1-x)y f01+xy f11
- =a0+ax x+ay y+axy xy
- where f00, f10, f01 and f11 are the function values at the four
- corners of the unit square 0 < x < 1&0 < y < 1 and:
- a0 =f00
- ax =f10-f00
- ay =f01-f00
- axy=f00+f11-f10-f01
- This can also be expressed in paraboloid form as:
- f(x,y)=alpha [(x+y-cp)^2-(x-y-cn)^2]+d
- where:
- alpha=axy/4
- cp =-(ax+ay)/a11
- cn =-(ax-ay)/a11
- d =(a0 axy-ax ay)/axy
- In the procedure below, we take f00 - > f00-c etc. for a contour
- level c and we search for f=0.
+ real eps=eps*max(abs(v0),abs(v1),abs(v2));
- For this surface, there are two possible contour shapes:
- linear: (y-y0)/(x-x0)=m
- hyperbolic: (x-x0)*(y-y0)=m
- The linear case has a single line. The hyperbolic case may have
- zero, one or two segments within the box (there are two sides of
- a hyperbola, each of which may or may not pass through the unit
- square). A hyperbola with m=0 is a special case that is handled
- separately below.
-
- If c0 is the desired contour level, we effectively find the
- contours at c0-epsilon for arbitrarily small epsilon. Flat
- regions equal to c0 are considered to be interior to the
- contour curves. Regions that lie at the contour level are
- considered to be interior to the contour curves. As a result,
- contours are only constructed if they are immediately adjacent
- to some region interior to the square that falls below the
- contour value; in other words, if an edge falls on the contour
- value, but a point within the square arbitrarily close to the
- edge falls above the contour value, that edge (or applicable
- portion) is not included. This requirement gives the following:
- *) ensures contours on an edge are unique (do not appear in
- an adjacent square with the same orientation)
- *) no three line vertices (four line vertices are possible, but
- are not usually an issue)
- *) all segments can be joined into closed curves or curves that
- terminate on the boundary (no unclosed curves terminate in
- the interior region of the grid)
-
- Note the logic below skips cases that have been filtered out
- by the boxdata.settype() routine.
-*/
-private void setcontour(real f00, real f10, real f01, real f11, real epsf,
- boxdata bd, int i, int j, int index) {
- // SPECIAL CASE: two diagonal corners at the contour level with
- // the other two below does not yield any contours within the
- // unit box, but may have been previously misidentified as an
- // edge containing region.
- if(((f00*f11 == 0) && (f10*f01 > 0)) || ((f01*f10 == 0) && (f00*f11 > 0))) {
- bd.type=exterior;
- return;
- }
-
- // NOTE: From this point on, we can assume at least one contour
- // segment exists in the square. This allows several cases to
- // be ignored or simplified below, particularly edge cases.
-
- // Form used to approximate function on unit square
- real F(real x, real y) {
- return interp(interp(f00,f10,x),interp(f01,f11,x),y);
- }
-
- // Write contour as a0+ax*x+ay*y +axy*x*y=0
- real a0 =f00;
- real ax =f10-f00;
- if(abs(ax) < epsf) ax=0;
- real ay =f01-f00;
- if(abs(ay) < epsf) ay=0;
- real axy=f00+f11-f01 -f10;
- if(abs(axy) < epsf) axy=0;
-
- // Linear contour(s)
- if(axy == 0) {
- pair a,b;
- // Horizontal
- if(ax == 0) {
- if(ay == 0) return; // Contour is at most an isolated point; ignore.
- real y0=-a0/ay;
- if(abs(y0-1) < eps) y0=1;
- if((f00 > 0) || (f01 < 0)) {
- a=(1,y0);
- b=(0,y0);
- } else {
- a=(0,y0);
- b=(1,y0);
- }
- // Vertical
- } else if(ay == 0) {
- real x0=-a0/ax;
- if(abs(x0-1) < eps) x0=1;
- if((f00 > 0) || (f10 < 0)) {
- a=(x0,0);
- b=(x0,1);
- } else {
- a=(x0,1);
- b=(x0,0);
- }
- // Angled line
+ if(v0 < -eps) {
+ if(v1 < -eps) {
+ if(v2 < -eps) return dflt; // nothing to do
+ else if(v2 <= eps) return dflt; // nothing to do
+ else return case3(p0,p2,p1,v0,v2,v1);
+ } else if(v1 <= eps) {
+ if(v2 < -eps) return dflt; // nothing to do
+ else if(v2 <= eps) return case1(p1,p2,5+edge);
+ else return case2(p1,p0,p2,v1,v0,v2,5+edge);
} else {
- real x0=-a0/ax;
- if(abs(x0-1) < eps) x0=1;
- real y0=-a0/ay;
- if(abs(y0-1) < eps) y0=1;
- int count=0;
- real[] farr={f00,f10,f11,f01};
- farr.cyclic=true;
- pair[] corners={(0,0),(1,0),(1,1),(0,1)};
- pair[] sidedir={(1,0),(0,1),(-1,0),(0,-1)};
-
- int count=0;
- for(int i=0; i < farr.length; ++i) {
- // Corner
- if(farr[i] == 0) {
- ++count;
- if(farr[i-1] > 0) {
- a=corners[i];
- } else {
- b=corners[i];
- }
- // Side
- } else if(farr[i]*farr[i+1] < 0) {
- ++count;
- if(farr[i] > 0) {
- a=corners[i]-(farr[i]/(farr[i+1]-farr[i]))*sidedir[i];
- } else {
- b=corners[i]-(farr[i]/(farr[i+1]-farr[i]))*sidedir[i];
- }
- }
- }
- // Check(if logic is correct above, this will not happen)
- if(count != 2) {
- abort("Unexpected error in setcontour routine: odd number of"
- +" crossings (linear case)");
- }
- }
- boxcontour bc=boxcontour(line,a,b,0,0,0,1,1,i,j,index);
- bd.data.push(bc);
- return;
- }
-
- // Hyperbolic contour(s)
- // Described in form: (x-x0)*(y-y0)=m
- real x0=-ay/axy;
- if(abs(x0-1) < eps) x0=1;
- real y0=-ax/axy;
- if(abs(y0-1) < eps) y0=1;
- real m =ay*ax-a0*axy;
- m=(abs(m) < eps) ? 0 : m/axy^2;
-
- // Special case here: straight segments (possibly crossing)
- if(m == 0) {
- pair a,b;
- int signx,signy;
- // Assuming at least one corner is below contour level here
- if(x0 == 0) {
- signx=+1;
- if(y0 == 0) {
- a=(1,0);
- b=(0,1);
- signy=+1;
- } else if(y0 == 1) {
- a=(0,0);
- b=(1,1);
- signy=-1;
- } else if(y0 < 0 || y0 > 1) {
- a=(0,0);
- b=(0,1);
- signy=y0 > 0 ? -1 : +1;
- } else {
- if(f10 > 0) {
- a=(1,y0);
- b=(0,1);
- signy=+1;
- } else {
- a=(0,0);
- b=(1,y0);
- signy=-1;
- }
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
- } else if(x0 == 1) {
- signx=-1;
- if(y0 == 0) {
- a=(1,1);
- b=(0,0);
- signy=+1;
- } else if(y0 == 1) {
- a=(0,1);
- b=(1,0);
- signy=-1;
- } else if(y0 < 0 || y0 > 1) {
- a=(1,1);
- b=(1,0);
- signy=y0 > 0 ? -1 : +1;
- } else {
- if(f01 > 0) {
- a=(0,y0);
- b=(1,0);
- signy=-1;
- } else {
- a=(1,1);
- b=(0,y0);
- signy=+1;
- }
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
- } else if(y0 == 0) {
- signy=+1;
- if(x0 < 0 || x0 > 1) {
- a=(1,0);
- b=(0,0);
- signx=x0 > 0 ? -1 : +1;
- } else {
- if(f11 > 0) {
- a=(x0,1);
- b=(0,0);
- signx=-1;
- } else {
- a=(1,0);
- b=(x0,1);
- signx=+1;
- }
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
- } else if(y0 == 1) {
- signy=-1;
- if(x0 < 0 || x0 > 1) {
- a=(0,1);
- b=(1,1);
- signx=x0 > 0 ? -1 : +1;
- } else {
- if(f00 > 0) {
- a=(x0,0);
- b=(1,1);
- signx=+1;
- } else {
- a=(0,1);
- b=(x0,0);
- signx=-1;
- }
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
- } else if(x0 < 0 || x0 > 1) {
- signx=x0 > 0 ? -1 : +1;
- if(f00 > 0) {
- a=(1,y0);
- b=(0,y0);
- signy=+1;
- } else {
- a=(0,y0);
- b=(1,y0);
- signy=-1;
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
- } else if(y0 < 0 || y0 > 1) {
- signy=y0 > 0 ? -1 : +1;
- if(f00 > 0) {
- a=(x0,0);
- b=(x0,1);
- signx=+1;
- } else {
- a=(x0,1);
- b=(x0,0);
- signx=-1;
- }
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,signx,signy,i,j,index);
- bd.data.push(bc);
- return;
+ if(v2 < -eps) return case3(p0,p1,p2,v0,v1,v2,edge);
+ else if(v2 <= eps)
+ return case2(p2,p0,p1,v2,v0,v1,edge);
+ else return case3(p1,p0,p2,v1,v0,v2,edge);
+ }
+ } else if(v0 <= eps) {
+ if(v1 < -eps) {
+ if(v2 < -eps) return dflt; // nothing to do
+ else if(v2 <= eps) return case1(p0,p2,4+edge);
+ else return case2(p0,p1,p2,v0,v1,v2,4+edge);
+ } else if(v1 <= eps) {
+ if(v2 < -eps) return case1(p0,p1,9);
+ else if(v2 <= eps) return dflt; // use finer partitioning.
+ else return case1(p0,p1,9);
} else {
- if(f10 > 0) {
- a=(0,y0);
- b=(x0,0);
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,-1,-1,i,j,index);
- bd.data.push(bc);
- a=(1,y0);
- b=(x0,1);
- bc=boxcontour(hyperbola,a,b,x0,y0,m,+1,+1,i,j,index);
- bd.data.push(bc);
- return;
- } else {
- a=(x0,0);
- b=(1,y0);
- boxcontour bc=boxcontour(hyperbola,a,b,x0,y0,m,+1,-1,i,j,index);
- bd.data.push(bc);
- a=(x0,1);
- b=(0,y0);
- bc=boxcontour(hyperbola,a,b,x0,y0,m,-1,+1,i,j,index);
- bd.data.push(bc);
- return;
- }
- }
- }
-
- // General hyperbola case
- int signc=(F(x0,y0) > 0) ? +1 : -1;
-
- pair[] points;
-
- real xB=(y0 == 0) ? infinity : x0-m/y0;
- if(abs(xB) < eps) xB=0;
- if(xB >= 0 && xB <= 1-eps) points.push((xB,0));
-
- real xT=(y0 == 1) ? infinity : x0+m/(1-y0);
- if(abs(xT-1) < eps) xT=1;
- if(xT >= eps && xT <= 1) points.push((xT,1));
-
- real yL=(x0 == 0) ? infinity : y0-m/x0;
- if(abs(yL-1) < eps) yL=1;
-
- if(yL > eps && yL <= 1) points.push((0,yL));
-
- real yR=(x0 == 1) ? infinity : y0+m/(1-x0);
- if(abs(yR) < eps) yR=0;
- if(yR >= 0 && yR <= 1-eps) points.push((1,yR));
-
- // Check (if logic is correct above, this will not happen)
- if(!(points.length == 2 || points.length == 4)) {
- abort("Unexpected error in setcontour routine: odd number of"
- +" crossings (hyperbolic case)");
- }
-
- // Lower left side
- if((x0 > 0) && (y0 > 0) && (f00*signc < 0)) {
- pair[] pts0;
- for(int i=0; i < points.length; ++i) {
- if((points[i].x < x0) && (points[i].y < y0)) {
- pts0.push(points[i]);
- }
- }
- if(pts0.length == 2) {
- pair a0,b0;
- if((f00 > 0) ^(pts0[0].x < pts0[1].x)) {
- a0=pts0[0];
- b0=pts0[1];
- } else {
- a0=pts0[1];
- b0=pts0[0];
- }
- boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,-1,-1,i,j,index);
- bd.data.push(bc);
- }
- }
-
- // Lower right side
- if((x0 < 1) && (y0 > 0) && (f10*signc < 0)) {
- pair[] pts0;
- for(int i=0; i < points.length; ++i) {
- if((points[i].x > x0) && (points[i].y < y0)) {
- pts0.push(points[i]);
- }
- }
- if(pts0.length == 2) {
- pair a0,b0;
- if((f10 > 0) ^(pts0[0].x < pts0[1].x)) {
- a0=pts0[0];
- b0=pts0[1];
- } else {
- a0=pts0[1];
- b0=pts0[0];
- }
- boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,+1,-1,i,j,index);
- bd.data.push(bc);
- }
- }
-
- // Upper right side
- if((x0 < 1) && (y0 < 1) && (f11*signc < 0)) {
- pair[] pts0;
- for(int i=0; i < points.length; ++i) {
- if((points[i].x > x0) && (points[i].y > y0)) {
- pts0.push(points[i]);
- }
- }
- if(pts0.length == 2) {
- pair a0,b0;
- if((f11 > 0) ^(pts0[0].x > pts0[1].x)) {
- a0=pts0[0];
- b0=pts0[1];
- } else {
- a0=pts0[1];
- b0=pts0[0];
- }
- boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,+1,+1,i,j,index);
- bd.data.push(bc);
- }
- }
-
- // Upper left side
- if((x0 > 0) && (y0 < 1) && (f01*signc < 0)) {
- pair[] pts0;
- for(int i=0; i < points.length; ++i) {
- if((points[i].x < x0) && (points[i].y > y0)) {
- pts0.push(points[i]);
- }
- }
- if(pts0.length == 2) {
- pair a0,b0;
- if((f01 > 0) ^(pts0[0].x > pts0[1].x)) {
- a0=pts0[0];
- b0=pts0[1];
- } else {
- a0=pts0[1];
- b0=pts0[0];
- }
- boxcontour bc=boxcontour(hyperbola,a0,b0,x0,y0,m,-1,+1,i,j,index);
- bd.data.push(bc);
- }
- }
- return;
-}
-
-
-// Checks if end of first contour segment matches the beginning of
-// the second.
-private bool connected(boxcontour bc1, boxcontour bc2) {
- return abs(bc2.a-bc1.b+(bc2.i-bc1.i,bc2.j-bc1.j)) < eps;
-}
-
-// Returns index of first active element in bca that with beginning
-// that connects to the end of bc, or -1 if no such element.
-private int connectedindex(boxcontour bc, boxcontour[] bca,
- bool activeonly=true) {
- for(int i=0; i < bca.length; ++i) {
- if(!bca[i].active) continue;
- if(connected(bc,bca[i])) {
- return i;
- }
- }
- return -1;
-}
-
-// Returns index of first active element in bca with end that connects
-// to the start of bc, or -1 if no such element.
-private int connectedindex(boxcontour[] bca, boxcontour bc,
- bool activeonly=true) {
- for(int i=0; i < bca.length; ++i) {
- if(!bca[i].active) continue;
- if(connected(bca[i],bc)) {
- return i;
- }
- }
- return -1;
+ if(v2 < -eps) return case2(p0,p1,p2,v0,v1,v2,4+edge);
+ else if(v2 <= eps) return case1(p0,p2,4+edge);
+ else return dflt; // nothing to do
+ }
+ } else {
+ if(v1 < -eps) {
+ if(v2 < -eps) return case3(p1,p0,p2,v1,v0,v2,edge);
+ else if(v2 <= eps)
+ return case2(p2,p0,p1,v2,v0,v1,edge);
+ else return case3(p0,p1,p2,v0,v1,v2,edge);
+ } else if(v1 <= eps) {
+ if(v2 < -eps) return case2(p1,p0,p2,v1,v0,v2,5+edge);
+ else if(v2 <= eps) return case1(p1,p2,5+edge);
+ else return dflt; // nothing to do
+ } else {
+ if(v2 < -eps) return case3(p0,p2,p1,v0,v2,v1);
+ else if(v2 <= eps) return dflt; // nothing to do
+ else return dflt; // nothing to do
+ }
+ }
}
-
-// Processes indices for grid regions touching the
-// end/start (forward=true/false) of the contour segment
-private void searchindex(boxcontour bc, bool forward, void f(int i, int j)) {
- pair z=forward ? bc.b : bc.a;
+// Collect connecting path segments.
+private void collect(pair[][][] points, real[] c)
+{
+ // use to reverse an array, omitting the first point
+ int[] reverseF(int n) {return sequence(new int(int x){return n-1-x;},n-1);}
+ // use to reverse an array, omitting the last point
+ int[] reverseL(int n) {return sequence(new int(int x){return n-2-x;},n-1);}
- int i=bc.i;
- int j=bc.j;
-
- if(z == (0,0)) f(i-1,j-1);
- if(z.y == 0) f(i,j-1);
- if(z == (1,0)) f(i+1,j-1);
- if(z.x == 1) f(i+1,j);
- if(z == (1,1)) f(i+1,j+1);
- if(z.y == 1) f(i,j+1);
- if(z == (0,1)) f(i-1,j+1);
- if(z.x == 0) f(i-1,j);
-}
-
-// Contour segment
-private struct segment {
- gridpoint[] data;
- void operator init() {
- }
- void operator init(boxcontour bc, int subsample=1) {
- bc.active=false;
- this.data.append(bc.points(subsample,first=true,last=true));
- }
- void operator init(int i, int j, pair z) {
- gridpoint gp=gridpoint(i,j,z);
- data.push(gp);
- }
- void operator init(gridpoint[] gp) {
- this.data.append(gp);
- }
- gridpoint start() {
- if(data.length == 0) {
- return gridpoint(-1,-1,(-infinity,-infinity));
- }
- gridpoint gp=data[0];
- return gridpoint(gp.i,gp.j,gp.z);
- }
- gridpoint end() {
- if(data.length == 0) {
- return gridpoint(-1,-1,(-infinity,-infinity));
- }
- gridpoint gp=data[data.length-1];
- return gridpoint(gp.i,gp.j,gp.z);
- }
- bool closed() {
- return same(this.start(),this.end());
- }
- void append(boxcontour bc, int subsample=1) {
- bc.active=false;
- data.append(bc.points(subsample,first=false,last=true));
- }
- void prepend(boxcontour bc, int subsample=1) {
- bc.active=false;
- data.insert(0 ... bc.points(subsample,first=true,last=false));
- }
- void append(int i, int j, pair z) {
- gridpoint gp=gridpoint(i,j,z);
- data.push(gp);
- }
- void prepend(int i, int j, pair z) {
- gridpoint gp=gridpoint(i,j,z);
- data.insert(0,gp);
- }
- segment copy() {
- segment seg=new segment;
- seg.data=new gridpoint[data.length];
- for(int i=0; i < data.length; ++i) {
- seg.data[i]=gridpoint(data[i].i,data[i].j,data[i].z);
- }
- return seg;
- }
- segment reversecopy() {
- segment seg=new segment;
- seg.data=new gridpoint[data.length];
- for(int i=0; i < data.length; ++i) {
- seg.data[data.length-i-1]=gridpoint(data[i].i,data[i].j,data[i].z);
+ for(int cnt=0; cnt < c.length; ++cnt) {
+ pair[][] gdscnt=points[cnt];
+ for(int i=0; i < gdscnt.length; ++i) {
+ pair[] gig=gdscnt[i];
+ int Li=gig.length;
+ for(int j=i+1; j < gdscnt.length; ++j) {
+ pair[] gjg=gdscnt[j];
+ int Lj=gjg.length;
+ if(abs(gig[0]-gjg[0]) < eps) {
+ gdscnt[j]=gjg[reverseF(Lj)];
+ gdscnt[j].append(gig);
+ gdscnt.delete(i);
+ --i;
+ break;
+ } else if(abs(gig[0]-gjg[Lj-1]) < eps) {
+ gig.delete(0);
+ gdscnt[j].append(gig);
+ gdscnt.delete(i);
+ --i;
+ break;
+ } else if(abs(gig[Li-1]-gjg[0]) < eps) {
+ gjg.delete(0);
+ gig.append(gjg);
+ gdscnt[j]=gig;
+ gdscnt.delete(i);
+ --i;
+ break;
+ } else if(abs(gig[Li-1]-gjg[Lj-1]) < eps) {
+ gig.append(gjg[reverseL(Lj)]);
+ gdscnt[j]=gig;
+ gdscnt.delete(i);
+ --i;
+ break;
+ }
+ }
}
- return seg;
}
}
-// Container to hold edge and border segments that form one continuous line
-private struct Segment {
- segment[] edges;
- segment[] borders;
- void operator init() {
- }
- void operator init(segment seg) {
- edges.push(seg);
- }
- void operator init(gridpoint[] gp) {
- segment seg=segment(gp);
- edges.push(seg);
- }
- gridpoint start() {
- if(edges.length == 0) {
- if(borders.length > 0) {
- return borders[0].start();
+// Join path segments.
+private guide[][] connect(pair[][][] points, real[] c, interpolate join)
+{
+ // set up return value
+ guide[][] result=new guide[c.length][];
+ for(int cnt=0; cnt < c.length; ++cnt) {
+ pair[][] pointscnt=points[cnt];
+ guide[] resultcnt=result[cnt]=new guide[pointscnt.length];
+ for(int i=0; i < pointscnt.length; ++i) {
+ pair[] pts=pointscnt[i];
+ guide gd;
+ if(pts.length > 0) {
+ if(pts.length > 1 && abs(pts[0]-pts[pts.length-1]) < eps) {
+ guide[] g=sequence(new guide(int i) {
+ return pts[i];
+ },pts.length-1);
+ g.push(cycle);
+ gd=join(...g);
+ } else
+ gd=join(...sequence(new guide(int i) {
+ return pts[i];
+ },pts.length));
}
- return gridpoint(-1,-1,(-infinity,-infinity));
- }
- return edges[0].start();
- }
- gridpoint end() {
- if(edges.length == 0 && borders.length == 0) {
- return gridpoint(-1,-1,(-infinity,-infinity));
- }
- if(edges.length > borders.length) {
- return edges[edges.length-1].end();
- } else {
- return borders[borders.length-1].end();
+ resultcnt[i]=gd;
}
}
- bool closed() {
- return same(this.start(),this.end());
- }
- void addedge(segment seg) {
- edges.push(seg);
- }
- void addedge(gridpoint[] gp) {
- segment seg=segment(gp);
- edges.push(seg);
- }
- void addborder(segment seg) {
- borders.push(seg);
- }
- void addborder(gridpoint[] gp) {
- segment seg=segment(gp);
- borders.push(seg);
- }
- void append(Segment S) {
- edges.append(S.edges);
- borders.append(S.borders);
- }
-}
-
-private Segment[] Segment(segment[] s)
-{
- return sequence(new Segment(int i) {return Segment(s[i]);},s.length);
+ return result;
}
-private Segment[][] Segment(segment[][] s)
-{
- Segment[][] S=new Segment[s.length][];
- for(int i=0; i < s.length; ++i)
- S[i]=Segment(s[i]);
- return S;
-}
-// Return contour points for a 2D data array.
+// Return contour guides for a 2D data array.
+// z: two-dimensional array of nonoverlapping mesh points
// f: two-dimensional array of corresponding f(z) data values
+// midpoint: optional array containing values of f at cell midpoints
// c: array of contour values
-// subsample: number of points to use in each box in addition to endpoints
-segment[][] contouredges(real[][] f, real[] c, int subsample=1)
+// join: interpolation operator (e.g. operator -- or operator ..)
+guide[][] contour(pair[][] z, real[][] f,
+ real[][] midpoint=new real[][], real[] c,
+ interpolate join=operator --)
{
- int nx=f.length-1;
- if(nx <= 0)
- abort("array f must have length >= 2");
- int ny=f[0].length-1;
- if(ny <= 0)
- abort("array f[0] must have length >= 2");
+ int nx=z.length-1;
+ if(nx == 0)
+ abort("array z must have length >= 2");
+ int ny=z[0].length-1;
+ if(ny == 0)
+ abort("array z[0] must have length >= 2");
c=sort(c);
- boxdata[][] bd=new boxdata[nx][ny];
-
- segment[][] result=new segment[c.length][];
+ bool midpoints=midpoint.length > 0;
+ segment segments[][][]=new segment[nx][ny][];
+
+ // go over region a rectangle at a time
for(int i=0; i < nx; ++i) {
- boxdata[] bdi=bd[i];
+ pair[] zi=z[i];
+ pair[] zp=z[i+1];
real[] fi=f[i];
real[] fp=f[i+1];
-
+ real[] midpointi;
+ if(midpoints) midpointi=midpoint[i];
+ segment[][] segmentsi=segments[i];
for(int j=0; j < ny; ++j) {
- boxdata bdij=bdi[j]=boxdata(fi[j],fp[j],fi[j+1],fp[j+1]);
-
+ segment[] segmentsij=segmentsi[j];
+
+ // define points
+ pair bleft=zi[j];
+ pair bright=zp[j];
+ pair tleft=zi[j+1];
+ pair tright=zp[j+1];
+ pair middle=0.25*(bleft+bright+tleft+tright);
+
+ real f00=fi[j];
+ real f01=fi[j+1];
+ real f10=fp[j];
+ real f11=fp[j+1];
+ real fmm=midpoints ? midpoint[i][j] : 0.25*(f00+f01+f10+f11);
+
+ // optimization: we make sure we don't work with empty rectangles
int checkcell(int cnt) {
real C=c[cnt];
-
- real f00=fi[j];
- real f10=fp[j];
- real f01=fi[j+1];
- real f11=fp[j+1];
-
- real epsf=eps*max(abs(f00),abs(f10),abs(f01),abs(f11),abs(C));
-
- f00=f00-C;
- f10=f10-C;
- f01=f01-C;
- f11=f11-C;
-
- if(abs(f00) < epsf) f00=0;
- if(abs(f10) < epsf) f10=0;
- if(abs(f01) < epsf) f01=0;
- if(abs(f11) < epsf) f11=0;
-
+ real vertdat0=f00-C; // bottom-left vertex
+ real vertdat1=f10-C; // bottom-right vertex
+ real vertdat2=f01-C; // top-left vertex
+ real vertdat3=f11-C; // top-right vertex
+ // optimization: we make sure we don't work with empty rectangles
int countm=0;
int countz=0;
int countp=0;
-
+
void check(real vertdat) {
- if(vertdat < -eps)++countm;
+ if(vertdat < -eps) ++countm;
else {
- if(vertdat <= eps)++countz;
- else++countp;
+ if(vertdat <= eps) ++countz;
+ else ++countp;
}
}
- check(f00);
- check(f10);
- check(f01);
- check(f11);
+ check(vertdat0);
+ check(vertdat1);
+ check(vertdat2);
+ check(vertdat3);
if(countm == 4) return 1; // nothing to do
if(countp == 4) return -1; // nothing to do
if((countm == 3 || countp == 3) && countz == 1) return 0;
- // Calculate individual box contours
- bdij.settype(C);
- if(bdij.type == edge)
- setcontour(f00,f10,f01,f11,epsf,bdij,i,j,cnt);
+ // go through the triangles
+
+ void addseg(segment seg) {
+ if(seg.active) {
+ seg.c=cnt;
+ segmentsij.push(seg);
+ }
+ }
+ real vertdat4=fmm-C;
+ addseg(checktriangle(bright,tright,middle,
+ vertdat1,vertdat3,vertdat4,0));
+ addseg(checktriangle(tright,tleft,middle,
+ vertdat3,vertdat2,vertdat4,1));
+ addseg(checktriangle(tleft,bleft,middle,
+ vertdat2,vertdat0,vertdat4,2));
+ addseg(checktriangle(bleft,bright,middle,
+ vertdat0,vertdat1,vertdat4,3));
return 0;
}
-
+
void process(int l, int u) {
if(l >= u) return;
int i=quotient(l+u,2);
@@ -928,171 +313,150 @@ segment[][] contouredges(real[][] f, real[] c, int subsample=1)
process(i+1,u);
}
}
-
+
process(0,c.length);
}
}
-
- // Find contours and follow them
+
+ // set up return value
+ pair[][][] points=new pair[c.length][][];
+
for(int i=0; i < nx; ++i) {
- boxdata[] bdi=bd[i];
+ segment[][] segmentsi=segments[i];
for(int j=0; j < ny; ++j) {
- boxdata bd0=bdi[j];
- if(bd0.count() == 0) continue;
- for(int k=0; k < bd0.count(); ++k) {
- boxcontour bc0=bd0.data[k];
-
- if(!bc0.active) continue;
-
- // Note: boxcontour set inactive when added to segment
- segment seg=segment(bc0,subsample);
-
- // Forward direction
- bool foundnext=true;
- while(foundnext) {
- foundnext=false;
- searchindex(bc0,true,new void(int i, int j) {
- if((i >= 0) && (i < nx) && (j >= 0) && (j < ny)) {
- boxcontour[] data=bd[i][j].data;
- int k0=connectedindex(bc0,data);
- if(k0 >= 0) {
- bc0=data[k0];
- seg.append(bc0,subsample);
- foundnext=true;
- }
+ segment[] segmentsij=segmentsi[j];
+ for(int k=0; k < segmentsij.length; ++k) {
+ segment C=segmentsij[k];
+
+ if(!C.active) continue;
+
+ pair[] g=new pair[] {C.a,C.b};
+ segmentsij[k].active=false;
+
+ int forward(int I, int J, bool first=true) {
+ if(I >= 0 && I < nx && J >= 0 && J < ny) {
+ segment[] segmentsIJ=segments[I][J];
+ for(int l=0; l < segmentsIJ.length; ++l) {
+ segment D=segmentsIJ[l];
+ if(!D.active) continue;
+ if(abs(D.a-g[g.length-1]) < eps) {
+ g.push(D.b);
+ segmentsIJ[l].active=false;
+ if(D.edge >= 0 && !first) return D.edge;
+ first=false;
+ l=-1;
+ } else if(abs(D.b-g[g.length-1]) < eps) {
+ g.push(D.a);
+ segmentsIJ[l].active=false;
+ if(D.edge >= 0 && !first) return D.edge;
+ first=false;
+ l=-1;
}
- });
+ }
+ }
+ return -1;
+ }
+
+ int backward(int I, int J, bool first=true) {
+ if(I >= 0 && I < nx && J >= 0 && J < ny) {
+ segment[] segmentsIJ=segments[I][J];
+ for(int l=0; l < segmentsIJ.length; ++l) {
+ segment D=segmentsIJ[l];
+ if(!D.active) continue;
+ if(abs(D.a-g[0]) < eps) {
+ g.insert(0,D.b);
+ segmentsIJ[l].active=false;
+ if(D.edge >= 0 && !first) return D.edge;
+ first=false;
+ l=-1;
+ } else if(abs(D.b-g[0]) < eps) {
+ g.insert(0,D.a);
+ segmentsIJ[l].active=false;
+ if(D.edge >= 0 && !first) return D.edge;
+ first=false;
+ l=-1;
+ }
+ }
+ }
+ return -1;
}
-
- // Backward direction
- bc0=bd0.data[k];
- bool foundprev=true;
- while(foundprev) {
- foundprev=false;
- searchindex(bc0,false,new void(int i, int j) {
- if((i >= 0) && (i < nx) && (j >= 0) && (j < ny)) {
- boxcontour[] data=bd[i][j].data;
- int k0=connectedindex(data,bc0);
- if(k0 >= 0) {
- bc0=data[k0];
- seg.prepend(bc0,subsample);
- foundprev=true;
+
+ void follow(int f(int, int, bool first=true), int edge) {
+ int I=i;
+ int J=j;
+ while(true) {
+ static int ix[]={1,0,-1,0};
+ static int iy[]={0,1,0,-1};
+ if(edge >= 0 && edge < 4) {
+ I += ix[edge];
+ J += iy[edge];
+ edge=f(I,J);
+ } else {
+ if(edge == -1) break;
+ if(edge < 9) {
+ int edge0=(edge-5) % 4;
+ int edge1=(edge-4) % 4;
+ int ix0=ix[edge0];
+ int iy0=iy[edge0];
+ I += ix0;
+ J += iy0;
+ // Search all 3 corner cells
+ if((edge=f(I,J)) == -1) {
+ I += ix[edge1];
+ J += iy[edge1];
+ if((edge=f(I,J)) == -1) {
+ I -= ix0;
+ J -= iy0;
+ edge=f(I,J);
+ }
+ }
+ } else {
+ // Double-vertex edge: search all 8 surrounding cells
+ void search() {
+ for(int i=-1; i <= 1; ++i) {
+ for(int j=-1; j <= 1; ++j) {
+ if((edge=f(I+i,J+j,false)) >= 0) {
+ I += i;
+ J += j;
+ return;
+ }
+ }
+ }
}
+ search();
}
- });
+ }
+ }
}
- result[bc0.index].push(seg);
- }
- }
- }
-
- // Note: every segment here _should_ be cyclic or terminate on the
- // boundary
- return result;
-}
-
-// Connect contours into guides.
-// Same initial/final points indicates a closed path.
-// Borders are always joined using--.
-private guide connect(Segment S, pair[][] z, interpolate join)
-{
- pair loc(gridpoint gp) {
- pair offset=z[gp.i][gp.j];
- pair size=z[gp.i+1][gp.j+1]-z[gp.i][gp.j];
- return offset+(size.x*gp.z.x,size.y*gp.z.y);
- }
- pair[] loc(gridpoint[] gp) {
- pair[] result=new pair[gp.length];
- for(int i; i < gp.length; ++i) {
- result[i]=loc(gp[i]);
- }
- return result;
- }
-
- bool closed=S.closed();
-
- pair[][] edges=new pair[S.edges.length][];
- for(int i; i < S.edges.length; ++i) {
- edges[i]=loc(S.edges[i].data);
- }
- pair[][] borders=new pair[S.borders.length][];
- for(int i; i < S.borders.length; ++i) {
- borders[i]=loc(S.borders[i].data);
- }
-
- if(edges.length == 0 && borders.length == 1) {
- guide g=operator--(...borders[0]);
- if(closed) g=g--cycle;
- return g;
- }
-
- if(edges.length == 1 && borders.length == 0) {
- pair[] pts=edges[0];
- if(closed) pts.delete(pts.length-1);
- guide g=join(...pts);
- if(closed) g=join(g,cycle);
- return g;
- }
-
- guide[] ge=new guide[edges.length];
- for(int i=0; i < ge.length; ++i)
- ge[i]=join(...edges[i]);
+ // Follow contour in cell
+ int edge=forward(i,j,first=false);
- guide[] gb=new guide[borders.length];
- for(int i=0; i < gb.length; ++i)
- gb[i]=operator--(...borders[i]);
-
- guide g=ge[0];
- if(0 < gb.length) g=g&gb[0];
- for(int i=1; i < ge.length; ++i) {
- g=g&ge[i];
- if(i < gb.length) g=g&gb[i];
- }
- if(closed) g=g&cycle;
- return g;
-}
+ // Follow contour forward outside of cell
+ follow(forward,edge);
-// Connect contours into guides.
-private guide[] connect(Segment[] S, pair[][] z, interpolate join)
-{
- return sequence(new guide(int i) {return connect(S[i],z,join);},S.length);
-}
+ // Follow contour backward outside of cell
+ follow(backward,C.edge);
-// Connect contours into guides.
-private guide[][] connect(Segment[][] S, pair[][] z, interpolate join)
-{
- guide[][] result=new guide[S.length][];
- for(int i=0; i < S.length; ++i) {
- result[i]=connect(S[i],z,join);
+ points[C.c].push(g);
+ }
+ }
}
- return result;
-}
-// Return contour guides for a 2D data array.
-// z: two-dimensional array of nonoverlapping mesh points
-// f: two-dimensional array of corresponding f(z) data values
-// c: array of contour values
-// join: interpolation operator (e.g. operator--or operator ..)
-// subsample: number of interior points to include in each grid square
-// (in addition to points on edge)
-guide[][] contour(pair[][] z, real[][] f, real[] c,
- interpolate join=operator--, int subsample=1)
-{
- segment[][] seg=contouredges(f,c,subsample);
- Segment[][] Seg=Segment(seg);
- return connect(Seg,z,join);
+ collect(points,c); // Required to join remaining case1 cycles.
+
+ return connect(points,c,join);
}
// Return contour guides for a 2D data array on a uniform lattice
// f: two-dimensional array of real data values
+// midpoint: optional array containing data values at cell midpoints
// a,b: diagonally opposite vertices of rectangular domain
// c: array of contour values
-// join: interpolation operator (e.g. operator--or operator ..)
-// subsample: number of interior points to include in each grid square
-// (in addition to points on edge)
-guide[][] contour(real[][] f, pair a, pair b, real[] c,
- interpolate join=operator--, int subsample=1)
+// join: interpolation operator (e.g. operator -- or operator ..)
+guide[][] contour(real[][] f, real[][] midpoint=new real[][],
+ pair a, pair b, real[] c,
+ interpolate join=operator --)
{
int nx=f.length-1;
if(nx == 0)
@@ -1109,43 +473,37 @@ guide[][] contour(real[][] f, pair a, pair b, real[] c,
zi[j]=(xi,interp(a.y,b.y,j/ny));
}
}
- return contour(z,f,c,join,subsample);
+ return contour(z,f,midpoint,c,join);
}
// return contour guides for a real-valued function
-// f: real-valued function of two real variables
-// a,b: diagonally opposite vertices of rectangular domain
-// c: array of contour values
-// nx,ny: number of subdivisions in x and y directions(determines accuracy)
-// join: interpolation operator (e.g. operator--or operator ..)
-// subsample: number of interior points to include in each grid square
-// (in addition to points on edge)
+// f: real-valued function of two real variables
+// a,b: diagonally opposite vertices of rectangular domain
+// c: array of contour values
+// nx,ny: number of subdivisions in x and y directions (determines accuracy)
+// join: interpolation operator (e.g. operator -- or operator ..)
guide[][] contour(real f(real, real), pair a, pair b,
real[] c, int nx=ngraph, int ny=nx,
- interpolate join=operator--, int subsample=1)
+ interpolate join=operator --)
{
- // evaluate function at points and subsample
+ // evaluate function at points and midpoints
real[][] dat=new real[nx+1][ny+1];
+ real[][] midpoint=new real[nx+1][ny+1];
for(int i=0; i <= nx; ++i) {
real x=interp(a.x,b.x,i/nx);
+ real x2=interp(a.x,b.x,(i+0.5)/nx);
real[] dati=dat[i];
+ real[] midpointi=midpoint[i];
for(int j=0; j <= ny; ++j) {
dati[j]=f(x,interp(a.y,b.y,j/ny));
+ midpointi[j]=f(x2,interp(a.y,b.y,(j+0.5)/ny));
}
}
- return contour(dat,a,b,c,join,subsample);
+ return contour(dat,midpoint,a,b,c,join);
}
-
-guide[][] contour(real f(pair), pair a, pair b,
- real[] c, int nx=ngraph, int ny=nx,
- interpolate join=operator--, int subsample=1)
-{
- return contour(new real(real x, real y) {return f((x,y));},
- a,b,c,nx,ny,join,subsample);
-}
-
+
void draw(picture pic=currentpicture, Label[] L=new Label[],
guide[][] g, pen[] p)
{
@@ -1172,239 +530,6 @@ void draw(picture pic=currentpicture, Label[] L=new Label[],
draw(pic,L,g,sequence(new pen(int) {return p;},g.length));
}
-// Draw the contour
-void draw(picture pic=currentpicture, Label L,
- guide[] g, pen p=currentpen)
-{
- draw(pic,g,p);
- for(int i=0; i < g.length; ++i) {
- if(L.s != "" && size(g[i]) > 1) {
- label(pic,L,g[i],p);
- }
- }
-}
-
-/* CONTOURS FOR IRREGULARLY SPACED POINTS */
-//
-// +---------+
-// |\ /|
-// | \ / |
-// | \ / |
-// | \ / |
-// | X |
-// | / \ |
-// | / \ |
-// | / \ |
-// |/ \|
-// +---------+
-//
-
-// Is triangle p0--p1--p2--cycle counterclockwise ?
-private bool isCCW(pair p0, pair p1, pair p2) {return side(p0,p1,p2) < 0;}
-
-private struct segment
-{
- bool active;
- bool reversed; // True if lower values are to the left along line a--b.
- pair a,b; // Endpoints; a is always an edge point if one exists.
- int c; // Contour value.
-}
-
-// Case 1: line passes through two vertices of a triangle
-private segment case1(pair p0, pair p1, pair p2,
- real v0, real v1, real v2)
-{
- // Will cause a duplicate guide; luckily case1 is rare
- segment rtrn;
- rtrn.active=true;
- rtrn.a=p0;
- rtrn.b=p1;
- rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0));
- return rtrn;
-}
-
-// Cases 2 and 3: line passes through a vertex and a side of a triangle
-//(the first vertex passed and the side between the other two)
-private segment case2(pair p0, pair p1, pair p2,
- real v0, real v1, real v2)
-{
- segment rtrn;
- rtrn.active=true;
- pair val=interp(p1,p2,abs(v1/(v2-v1)));
- rtrn.a=val;
- rtrn.b=p0;
- rtrn.reversed=!(isCCW(p0,p1,p2) ^(v2 > 0));
- return rtrn;
-}
-
-private segment case3(pair p0, pair p1, pair p2,
- real v0, real v1, real v2)
-{
- segment rtrn;
- rtrn.active=true;
- pair val=interp(p1,p2,abs(v1/(v2-v1)));
- rtrn.a=p0;
- rtrn.b=val;
- rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0));
- return rtrn;
-}
-
-// Case 4: line passes through two sides of a triangle
-//(through the sides formed by the first&second, and second&third vertices)
-private segment case4(pair p0, pair p1, pair p2,
- real v0, real v1, real v2)
-{
- segment rtrn;
- rtrn.active=true;
- rtrn.a=interp(p1,p0,abs(v1/(v0-v1)));
- rtrn.b=interp(p1,p2,abs(v1/(v2-v1)));
- rtrn.reversed=(isCCW(p0,p1,p2) ^(v2 > 0));
- return rtrn;
-}
-
-// Check if a line passes through a triangle, and draw the required line.
-private segment checktriangle(pair p0, pair p1, pair p2,
- real v0, real v1, real v2)
-{
- // default null return
- static segment dflt;
-
- real eps=eps*max(abs(v0),abs(v1),abs(v2),1);
-
- if(v0 < -eps) {
- if(v1 < -eps) {
- if(v2 < -eps) return dflt; // nothing to do
- else if(v2 <= eps) return dflt; // nothing to do
- else return case4(p0,p2,p1,v0,v2,v1);
- } else if(v1 <= eps) {
- if(v2 < -eps) return dflt; // nothing to do
- else if(v2 <= eps) return case1(p1,p2,p0,v1,v2,v0);
- else return case3(p1,p0,p2,v1,v0,v2);
- } else {
- if(v2 < -eps) return case4(p0,p1,p2,v0,v1,v2);
- else if(v2 <= eps)
- return case2(p2,p0,p1,v2,v0,v1);
- else return case4(p1,p0,p2,v1,v0,v2);
- }
- } else if(v0 <= eps) {
- if(v1 < -eps) {
- if(v2 < -eps) return dflt; // nothing to do
- else if(v2 <= eps) return case1(p0,p2,p1,v0,v2,v1);
- else return case2(p0,p1,p2,v0,v1,v2);
- } else if(v1 <= eps) {
- if(v2 < -eps) return case1(p0,p1,p2,v0,v1,v2);
- else if(v2 <= eps) return dflt; // use finer partitioning.
- else return case1(p0,p1,p2,v0,v1,v2);
- } else {
- if(v2 < -eps) return case2(p0,p1,p2,v0,v1,v2);
- else if(v2 <= eps) return case1(p0,p2,p1,v0,v2,v1);
- else return dflt; // nothing to do
- }
- } else {
- if(v1 < -eps) {
- if(v2 < -eps) return case4(p1,p0,p2,v1,v0,v2);
- else if(v2 <= eps)
- return case2(p2,p0,p1,v2,v0,v1);
- else return case4(p0,p1,p2,v0,v1,v2);
- } else if(v1 <= eps) {
- if(v2 < -eps) return case3(p1,p0,p2,v1,v0,v2);
- else if(v2 <= eps) return case1(p1,p2,p0,v1,v2,v0);
- else return dflt; // nothing to do
- } else {
- if(v2 < -eps) return case4(p0,p2,p1,v0,v2,v1);
- else if(v2 <= eps) return dflt; // nothing to do
- else return dflt; // nothing to do
- }
- }
-}
-
-// Collect connecting path segments.
-private void collect(pair[][][] points, real[] c)
-{
- for(int cnt=0; cnt < c.length; ++cnt) {
- pair[][] gdscnt=points[cnt];
- for(int i=0; i < gdscnt.length; ++i) {
- pair[] gig=gdscnt[i];
- int Li=gig.length;
- for(int j=i+1; j < gdscnt.length; ++j) {
- pair[] gjg=gdscnt[j];
- int Lj=gjg.length;
- if(abs(gig[0]-gjg[Lj-1]) < eps) {
- gig.delete(0);
- gdscnt[j].append(gig);
- gdscnt.delete(i);
- --i;
- break;
- } else if(abs(gig[Li-1]-gjg[0]) < eps) {
- gjg.delete(0);
- gig.append(gjg);
- gdscnt[j]=gig;
- gdscnt.delete(i);
- --i;
- break;
- }
- }
- }
- }
-}
-
-// Join path segments.
-private guide[][] connect(pair[][][] points, real[] c, interpolate join)
-{
- // set up return value
- guide[][] result=new guide[c.length][];
- for(int cnt=0; cnt < c.length; ++cnt) {
- pair[][] pointscnt=points[cnt];
- guide[] resultcnt=result[cnt]=new guide[pointscnt.length];
- for(int i=0; i < pointscnt.length; ++i) {
- pair[] pts=pointscnt[i];
- guide gd;
- if(pts.length > 0) {
- if(pts.length > 1 && abs(pts[0]-pts[pts.length-1]) < eps) {
- guide[] g=sequence(new guide(int i) {
- return pts[i];
- },pts.length-1);
- g.push(cycle);
- gd=join(...g);
- } else
- gd=join(...sequence(new guide(int i) {
- return pts[i];
- },pts.length));
- }
- resultcnt[i]=gd;
- }
- }
- return result;
-}
-
-guide[][] contour(pair[] z, real[] f, real[] c, interpolate join=operator--)
-{
- if(z.length != f.length)
- abort("z and f arrays have different lengths");
-
- int[][] trn=triangulate(z);
-
- // array to store guides found so far
- pair[][][] points=new pair[c.length][][];
-
- for(int cnt=0; cnt < c.length; ++cnt) {
- pair[][] pointscnt=points[cnt];
- real C=c[cnt];
- for(int i=0; i < trn.length; ++i) {
- int[] trni=trn[i];
- int i0=trni[0], i1=trni[1], i2=trni[2];
- segment seg=checktriangle(z[i0],z[i1],z[i2],f[i0]-C,f[i1]-C,f[i2]-C);
- if(seg.active)
- pointscnt.push(seg.reversed ? new pair[] {seg.b,seg.a} :
- new pair[] {seg.a,seg.b});
- }
- }
-
- collect(points,c);
-
- return connect(points,c,join);
-}
-
// Extend palette by the colors below and above at each end.
pen[] extend(pen[] palette, pen below, pen above) {
pen[] p=copy(palette);
@@ -1489,3 +614,69 @@ void fill(picture pic=currentpicture, guide[][] g, pen[][] palette)
}
}
}
+
+// routines for irregularly spaced points:
+
+// check existing guides and adds new segment to them if possible,
+// or otherwise store segment as a new guide
+private void addseg(pair[][] gds, segment seg)
+{
+ if(!seg.active) return;
+ // search for a path to extend
+ for(int i=0; i < gds.length; ++i) {
+ pair[] gd=gds[i];
+ if(abs(gd[0]-seg.b) < eps) {
+ gd.insert(0,seg.a);
+ return;
+ } else if(abs(gd[gd.length-1]-seg.b) < eps) {
+ gd.push(seg.a);
+ return;
+ } else if(abs(gd[0]-seg.a) < eps) {
+ gd.insert(0,seg.b);
+ return;
+ } else if(abs(gd[gd.length-1]-seg.a) < eps) {
+ gd.push(seg.b);
+ return;
+ }
+ }
+
+ // in case nothing is found
+ pair[] segm;
+ segm=new pair[] {seg.a,seg.b};
+ gds.push(segm);
+
+ return;
+}
+
+guide[][] contour(real f(pair), pair a, pair b,
+ real[] c, int nx=ngraph, int ny=nx,
+ interpolate join=operator --)
+{
+ return contour(new real(real x, real y) {return f((x,y));},a,b,c,nx,ny,join);
+}
+
+guide[][] contour(pair[] z, real[] f, real[] c, interpolate join=operator --)
+{
+ if(z.length != f.length)
+ abort("z and f arrays have different lengths");
+
+ int[][] trn=triangulate(z);
+
+ // array to store guides found so far
+ pair[][][] points=new pair[c.length][][];
+
+ for(int cnt=0; cnt < c.length; ++cnt) {
+ pair[][] pointscnt=points[cnt];
+ real C=c[cnt];
+ for(int i=0; i < trn.length; ++i) {
+ int[] trni=trn[i];
+ int i0=trni[0], i1=trni[1], i2=trni[2];
+ addseg(pointscnt,checktriangle(z[i0],z[i1],z[i2],
+ f[i0]-C,f[i1]-C,f[i2]-C));
+ }
+ }
+
+ collect(points,c);
+
+ return connect(points,c,join);
+}
diff --git a/Build/source/utils/asymptote/base/embed.asy b/Build/source/utils/asymptote/base/embed.asy
index 8f982332d86..30f2881da04 100644
--- a/Build/source/utils/asymptote/base/embed.asy
+++ b/Build/source/utils/asymptote/base/embed.asy
@@ -1,11 +1,16 @@
-if(latex()) {
+if(latex() && !settings.inlineimage) {
usepackage("hyperref");
texpreamble("\hypersetup{"+settings.hyperrefOptions+"}");
usepackage("media9","bigfiles");
+ texpreamble("\makeatletter%
+\newif\ifnoplaybutton
+\@ifpackagelater{media9}{2013/11/15}{%
+\noplaybuttontrue}{}%
+\makeatother%");
}
-// See http://www.ctan.org/tex-archive/macros/latex/contrib/media9/doc/media9.pdf
-// for documentation of the options.
+// For documentation of the options see
+// http://www.ctan.org/tex-archive/macros/latex/contrib/media9/doc/media9.pdf
// Embed PRC or SWF content in pdf file
string embedplayer(string name, string text="", string options="",
@@ -13,7 +18,12 @@ string embedplayer(string name, string text="", string options="",
{
if(width != 0) options += ",width="+(string) (width/pt)+"pt";
if(height != 0) options += ",height="+(string) (height/pt)+"pt";
- return "\includemedia["+options+"]{"+text+"}{"+name+"}";
+ return "%
+\ifnoplaybutton%
+\includemedia[noplaybutton,"+options+"]{"+text+"}{"+name+"}%
+\else%
+\includemedia["+options+"]{"+text+"}{"+name+"}%
+\fi";
}
// Embed media in pdf file
diff --git a/Build/source/utils/asymptote/base/lmfit.asy b/Build/source/utils/asymptote/base/lmfit.asy
index e70421074e5..c3dfddce061 100644
--- a/Build/source/utils/asymptote/base/lmfit.asy
+++ b/Build/source/utils/asymptote/base/lmfit.asy
@@ -566,7 +566,7 @@ void lm_lmdif(int m, int n, real[] x, real[] fvec, real ftol, real xtol, real gt
info.val = 0;
evaluate(x, m, fvec, data, info);
- printout(n, x, m, fvec, data, 0, 0, ++nfev.val);
+ if(printout != null) printout(n, x, m, fvec, data, 0, 0, ++nfev.val);
if (info.val < 0)
return;
fnorm = lm_enorm(m, fvec);
@@ -580,7 +580,7 @@ void lm_lmdif(int m, int n, real[] x, real[] fvec, real ftol, real xtol, real gt
x[j] = temp + step;
info.val = 0;
evaluate(x, m, wa4, data, info);
- printout(n, x, m, wa4, data, 1, iter, ++nfev.val);
+ if(printout != null) printout(n, x, m, wa4, data, 1, iter, ++nfev.val);
if (info.val < 0)
return;
for (i = 0; i < m; ++i)
@@ -659,7 +659,7 @@ void lm_lmdif(int m, int n, real[] x, real[] fvec, real ftol, real xtol, real gt
info.val = 0;
evaluate(wa2, m, wa4, data, info);
- printout(n, x, m, wa4, data, 2, iter, ++nfev.val);
+ if(printout != null) printout(n, x, m, wa4, data, 2, iter, ++nfev.val);
if (info.val < 0)
return;
@@ -751,7 +751,7 @@ void lm_minimize(int m_dat, int n_par, real[] par, lm_evaluate_ftype evaluate, l
lm_lmdif(m, n, par, fvec, control.ftol, control.xtol, control.gtol, control.maxcall * (n + 1), control.epsilon, diag, 1, control.stepbound, control.info, control.nfev, fjac, ipvt, qtf, wa1, wa2, wa3, wa4, evaluate, printout, data);
- printout(n, par, m, fvec, data, -1, 0, control.nfev.val);
+ if(printout != null) printout(n, par, m, fvec, data, -1, 0, control.nfev.val);
control.fnorm = lm_enorm(m, fvec);
if (control.info.val < 0)
control.info.val = 10;
diff --git a/Build/source/utils/asymptote/base/math.asy b/Build/source/utils/asymptote/base/math.asy
index 46d663d3181..69863634210 100644
--- a/Build/source/utils/asymptote/base/math.asy
+++ b/Build/source/utils/asymptote/base/math.asy
@@ -185,7 +185,6 @@ int unique(real[] a, real x) {
if(i == -1 || x != a[i]) {
++i;
a.insert(i,x);
- return i;
}
return i;
}
@@ -195,7 +194,6 @@ int unique(string[] a, string x) {
if(i == -1 || x != a[i]) {
++i;
a.insert(i,x);
- return i;
}
return i;
}
diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy
index 14715bad918..e6097408194 100644
--- a/Build/source/utils/asymptote/base/plain.asy
+++ b/Build/source/utils/asymptote/base/plain.asy
@@ -280,3 +280,16 @@ if(settings.autoimport != "") {
}
cputime();
+
+// Workaround Adobe Reader transparency artifact:
+if(pdf()) {
+ if(settings.tex == "xelatex") {
+ texpreamble("\usepackage{everypage}");
+ tex("\AddEverypageHook{%
+\makeatletter%
+\special{pdf: put @thispage <</Group << /S /Transparency /I true /CS /DeviceRGB>> >>}%
+\makeatother%
+}%");
+ } else
+ tex("\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}");
+}
diff --git a/Build/source/utils/asymptote/base/plain_filldraw.asy b/Build/source/utils/asymptote/base/plain_filldraw.asy
index a5eea35ef25..026f2cee6c5 100644
--- a/Build/source/utils/asymptote/base/plain_filldraw.asy
+++ b/Build/source/utils/asymptote/base/plain_filldraw.asy
@@ -18,7 +18,7 @@ void makedraw(frame f, path g, pen p, int depth=mantissaBits)
for(int i=0; i < N; ++i) {
pair n1=point(n,i+1);
pair dir=unit(n1-n0);
- real t=dirtime(g,-dir);
+ real t=dirtime(g,-dir)-epsilon;
if(straight(g,(int) t)) t=ceil(t);
if(t > epsilon && t < stop) {
makedraw(f,subpath(g,0,t),p,depth);
diff --git a/Build/source/utils/asymptote/base/plain_paths.asy b/Build/source/utils/asymptote/base/plain_paths.asy
index dad0d13be8e..8bb5250db5d 100644
--- a/Build/source/utils/asymptote/base/plain_paths.asy
+++ b/Build/source/utils/asymptote/base/plain_paths.asy
@@ -364,3 +364,34 @@ path[] strokepath(path g, pen p=currentpen)
pair center(path[] g) {return 0.5*(min(g)+max(g));}
return shift(center(g)-center(G))*G;
}
+
+real braceinnerangle=radians(60);
+real braceouterangle=radians(70);
+real bracemidangle=radians(0);
+real bracedefaultratio=0.14;
+path brace(pair a, pair b, real amplitude=bracedefaultratio*length(b-a))
+{
+ real length=length(b-a);
+ real sign=sgn(amplitude);
+ real hamplitude=0.5*amplitude;
+ real hlength=0.5*length;
+ path brace;
+ if(abs(amplitude) < bracedefaultratio*length) {
+ real slope=2*bracedefaultratio;
+ real controldist=(abs(hamplitude))/slope;
+ brace=(0,0){expi(sign*braceouterangle)}::
+ {expi(sign*bracemidangle)}(controldist,hamplitude)::
+ {expi(sign*bracemidangle)}(hlength-controldist,hamplitude)::
+ {expi(sign*braceinnerangle)}(hlength,amplitude) {expi(-sign*braceinnerangle)}::
+ {expi(-sign*bracemidangle)}(hlength+controldist,hamplitude)::
+ {expi(-sign*bracemidangle)}(length-controldist,hamplitude)::
+ {expi(-sign*braceouterangle)}(length,0);
+ } else {
+ brace=(0,0){expi(sign*braceouterangle)}::
+ {expi(sign*bracemidangle)}(0.25*length,hamplitude)::
+ {expi(sign*braceinnerangle)}(hlength,amplitude){expi(-sign*braceinnerangle)}::
+ {expi(-sign*bracemidangle)}(0.75*length,hamplitude)::
+ {expi(-sign*braceouterangle)}(length,0);
+ }
+ return shift(a)*rotate(degrees(b-a,warn=false))*brace;
+}
diff --git a/Build/source/utils/asymptote/base/plain_shipout.asy b/Build/source/utils/asymptote/base/plain_shipout.asy
index 9b30e6e1947..972f44963c3 100644
--- a/Build/source/utils/asymptote/base/plain_shipout.asy
+++ b/Build/source/utils/asymptote/base/plain_shipout.asy
@@ -30,9 +30,14 @@ object embed3(string, frame, string, string, string, light, projection);
string Embed(string name, string text="", string options="", real width=0,
real height=0);
+bool prconly(string format="")
+{
+ return outformat(format) == "prc";
+}
+
bool prc0(string format="")
{
- return settings.prc && (outformat(format) == "pdf" || settings.inlineimage);
+ return settings.prc && (outformat(format) == "pdf" || prconly() || settings.inlineimage );
}
bool prc(string format="") {
@@ -106,7 +111,7 @@ void shipout(string prefix=defaultfilename, picture pic=currentpicture,
settings.inlinetex=settings.inlineimage;
}
frame f=pic.fit(prefix,format,view=view,options,script,light,P);
- if(!pic.empty2() || settings.render == 0 || prc || empty3)
+ if(!prconly() && (!pic.empty2() || settings.render == 0 || prc || empty3))
shipout(prefix,orientation(f),format,wait,view);
settings.inlinetex=inlinetex;
}
diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy
index ceb8cf89574..1c3716173d3 100644
--- a/Build/source/utils/asymptote/base/three.asy
+++ b/Build/source/utils/asymptote/base/three.asy
@@ -2630,7 +2630,7 @@ string embed3D(string prefix, string label=prefix, string text=label,
if(lightscript)
writeJavaScript(name,lightscript(light),script);
- if(!settings.inlinetex)
+ if(!settings.inlinetex && !prconly())
file3.push(prefix+".prc");
static transform3 flipxz=xscale3(-1)*zscale3(-1);
@@ -2867,13 +2867,13 @@ object embed(string prefix=outprefix(), string label=prefix,
if(prefix == "") prefix=outprefix();
bool prc=prc(format);
- bool preview=settings.render > 0;
+ bool preview=settings.render > 0 && !prconly();
if(prc) {
// The media9.sty package cannot handle spaces or dots in filenames.
string dir=stripfile(prefix);
prefix=dir+replace(stripdirectory(prefix),
new string[][]{{" ","_"},{".","_"}});
- if(settings.embed || nativeformat() == "pdf")
+ if((settings.embed || nativeformat() == "pdf") && !prconly())
prefix += "+"+(string) file3.length;
} else
preview=false;
diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy
index 85d32b08eb6..fc09ac798d9 100644
--- a/Build/source/utils/asymptote/base/three_surface.asy
+++ b/Build/source/utils/asymptote/base/three_surface.asy
@@ -348,6 +348,18 @@ patch reverse(patch s)
return S;
}
+// Return the tensor product patch control points corresponding to path p
+// and points internal.
+pair[][] tensor(path p, pair[] internal)
+{
+ return new pair[][] {
+ {point(p,0),precontrol(p,0),postcontrol(p,3),point(p,3)},
+ {postcontrol(p,0),internal[0],internal[3],precontrol(p,3)},
+ {precontrol(p,1),internal[1],internal[2],postcontrol(p,2)},
+ {point(p,1),postcontrol(p,1),precontrol(p,2),point(p,2)}
+ };
+}
+
// Return the Coons patch control points corresponding to path p.
pair[][] coons(path p)
{
@@ -367,13 +379,7 @@ pair[][] coons(path p)
+3*(precontrol(p,j-1)+postcontrol(p,j+1))
-point(p,j+2));
}
-
- return new pair[][] {
- {point(p,0),precontrol(p,0),postcontrol(p,3),point(p,3)},
- {postcontrol(p,0),internal[0],internal[3],precontrol(p,3)},
- {precontrol(p,1),internal[1],internal[2],postcontrol(p,2)},
- {point(p,1),postcontrol(p,1),precontrol(p,2),point(p,2)}
- };
+ return tensor(p,internal);
}
// Decompose a possibly nonconvex cyclic path into an array of paths that
@@ -1367,12 +1373,34 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
bool group=name != "" || render.defaultnames;
if(group)
begingroup3(f,name == "" ? "surface" : name,render);
- for(int i=0; i < s.s.length; ++i)
- draw3D(f,s.s[i],surfacepen[i],light);
+
+ // Sort patches by mean distance from camera
+ triple camera=P.camera;
+ if(P.infinity) {
+ triple m=min(s);
+ triple M=max(s);
+ camera=P.target+camerafactor*(abs(M-m)+abs(m-P.target))*unit(P.vector());
+ }
+
+ real[][] depth=new real[s.s.length][];
+ for(int i=0; i < depth.length; ++i)
+ depth[i]=new real[] {abs(camera-s.s[i].cornermean()),i};
+
+ depth=sort(depth);
+
+ for(int p=depth.length-1; p >= 0; --p) {
+ real[] a=depth[p];
+ int k=round(a[1]);
+ draw3D(f,s.s[k],surfacepen[k],light);
+ }
+
if(group)
endgroup3(f);
+
pen modifiers=thin()+squarecap;
- for(int k=0; k < s.s.length; ++k) {
+ for(int p=depth.length-1; p >= 0; --p) {
+ real[] a=depth[p];
+ int k=round(a[1]);
pen meshpen=meshpen[k];
if(!invisible(meshpen)) {
if(group)
@@ -1410,13 +1438,13 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
light.T=shiftless(P.T.modelview);
// Draw from farthest to nearest
- while(depth.length > 0) {
- real[] a=depth.pop();
- int i=round(a[1]);
- tensorshade(t,f,s.s[i],surfacepen[i],light,P);
- pen meshpen=meshpen[i];
+ for(int p=depth.length-1; p >= 0; --p) {
+ real[] a=depth[p];
+ int k=round(a[1]);
+ tensorshade(t,f,s.s[k],surfacepen[k],light,P);
+ pen meshpen=meshpen[k];
if(!invisible(meshpen))
- draw(f,t*project(s.s[i].external(),P),meshpen);
+ draw(f,t*project(s.s[k].external(),P),meshpen);
}
endgroup(f);
}
diff --git a/Build/source/utils/asymptote/config.guess b/Build/source/utils/asymptote/config.guess
index 1f5c50c0d15..f32079abda6 100644
--- a/Build/source/utils/asymptote/config.guess
+++ b/Build/source/utils/asymptote/config.guess
@@ -1,12 +1,14 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
-timestamp='2014-03-23'
+timestamp='2008-01-23'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@@ -15,22 +17,26 @@ timestamp='2014-03-23'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner.
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
#
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
-
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -132,33 +139,12 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -184,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
+ | grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -194,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
- os=netbsd
+ os=netbsd
;;
esac
# The OS release
@@ -215,10 +201,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -241,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -287,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -316,12 +295,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
+ echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
+ arm:riscos:*:*|arm:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -345,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -415,23 +375,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@@ -501,8 +461,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -515,7 +475,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@@ -572,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
- *:AIX:*:[4567])
+ *:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -615,52 +575,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
+ esac ;;
+ esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ sed 's/^ //' << EOF >$dummy.c
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -680,7 +640,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@@ -751,22 +711,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@@ -790,14 +750,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -809,39 +769,34 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- authenticamd | genuineintel | EM64T)
+ EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -851,9 +806,6 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -874,157 +826,210 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo cris-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ echo frv-unknown-linux-gnu
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
+ mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ CPU=mips
#else
CPU=
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1032,11 +1037,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
+ # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@@ -1053,7 +1058,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1068,7 +1073,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@@ -1096,13 +1101,10 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@@ -1137,18 +1139,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1161,7 +1153,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1181,10 +1173,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -1210,11 +1202,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ echo mips-nec-sysv${UNAME_RELEASE}
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@@ -1224,12 +1216,6 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1256,31 +1242,9 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1294,10 +1258,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
+ NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1342,13 +1303,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
+ echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1363,13 +1324,158 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
exit ;;
-esac
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
cat >&2 <<EOF
$0: unable to guess system type
diff --git a/Build/source/utils/asymptote/config.h.in b/Build/source/utils/asymptote/config.h.in
index 00322f17611..e59e301b2f6 100644
--- a/Build/source/utils/asymptote/config.h.in
+++ b/Build/source/utils/asymptote/config.h.in
@@ -63,7 +63,7 @@
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
-/* Define if you have the `OSMesa' library (-lOSMesa). */
+/* Define to 1 if you have the `OSMesa' library (-lOSMesa). */
#undef HAVE_LIBOSMESA
/* Define to 1 if you have the `readline' library (-lreadline). */
diff --git a/Build/source/utils/asymptote/config.sub b/Build/source/utils/asymptote/config.sub
index 6acbfacd58b..59bb593f109 100644
--- a/Build/source/utils/asymptote/config.sub
+++ b/Build/source/utils/asymptote/config.sub
@@ -1,18 +1,24 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2014-04-03'
+timestamp='2012-04-18'
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
@@ -20,12 +26,11 @@ timestamp='2014-04-03'
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
+# the same distribution terms that you use for the rest of that program.
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@@ -68,7 +73,9 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -116,7 +123,7 @@ esac
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
@@ -149,7 +156,7 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
+ -apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
@@ -252,12 +259,10 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | be32 | be64 \
| bfin \
- | c4x | c8051 | clipper \
+ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
@@ -265,11 +270,10 @@ case $basic_machine in
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
- | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -287,16 +291,16 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
+ | nios | nios2 \
| ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
+ | open8 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
@@ -324,7 +328,7 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -366,13 +370,13 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -381,13 +385,11 @@ case $basic_machine in
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
- | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -405,16 +407,14 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
+ | nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
- | or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
@@ -788,15 +788,11 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze*)
+ microblaze)
basic_machine=microblaze-xilinx
;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
mingw32)
- basic_machine=i686-pc
+ basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
@@ -832,7 +828,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i686-pc
+ basic_machine=i386-pc
os=-msys
;;
mvs)
@@ -1023,11 +1019,7 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
+ rdos)
basic_machine=i386-pc
os=-rdos
;;
@@ -1354,21 +1346,21 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
+ | -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
+ | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -mingw32* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1376,7 +1368,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1500,6 +1492,9 @@ case $os in
-aros*)
os=-aros
;;
+ -kaos*)
+ os=-kaos
+ ;;
-zvmoe)
os=-zvmoe
;;
@@ -1548,12 +1543,6 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
tic54x-*)
os=-coff
;;
diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure
index 9a95356caa3..fa56ba5da44 100755
--- a/Build/source/utils/asymptote/configure
+++ b/Build/source/utils/asymptote/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for Asymptote 2.23.
+# Generated by GNU Autoconf 2.69 for Asymptote 2.25.
#
# Report bugs to <http://sourceforge.net/projects/asymptote>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='Asymptote'
PACKAGE_TARNAME='asymptote'
-PACKAGE_VERSION='2.23'
-PACKAGE_STRING='Asymptote 2.23'
+PACKAGE_VERSION='2.25'
+PACKAGE_STRING='Asymptote 2.25'
PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote'
PACKAGE_URL=''
@@ -641,7 +641,7 @@ INCL
GCPPLIB
GCLIB
GCOPTIONS
-GCDIR
+GCVERSION
getopt
CXXCPP
YFLAGS
@@ -1281,7 +1281,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures Asymptote 2.23 to adapt to many kinds of systems.
+\`configure' configures Asymptote 2.25 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1346,7 +1346,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Asymptote 2.23:";;
+ short | recursive ) echo "Configuration of Asymptote 2.25:";;
esac
cat <<\_ACEOF
@@ -1459,7 +1459,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Asymptote configure 2.23
+Asymptote configure 2.25
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2045,7 +2045,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by Asymptote $as_me 2.23, which was
+It was created by Asymptote $as_me 2.25, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -4117,7 +4117,7 @@ fi
test -n "$TEXI2DVI" && break
done
-test -n "$TEXI2DVI" || TEXI2DVI="echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory and touch doc/asymptote.pdf; exit 1;"
+test -n "$TEXI2DVI" || TEXI2DVI="echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory, touch doc/asymptote.pdf, and run configure again; exit 1;"
@@ -5750,17 +5750,18 @@ fi
-GCVERSION=gc-7.2d
+GCVERSION=7.4.0
+GCFILE=gc-$GCVERSION
-as_ac_File=`$as_echo "ac_cv_file_$GCVERSION.tar.gz" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GCVERSION.tar.gz" >&5
-$as_echo_n "checking for $GCVERSION.tar.gz... " >&6; }
+as_ac_File=`$as_echo "ac_cv_file_$GCFILE.tar.gz" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GCFILE.tar.gz" >&5
+$as_echo_n "checking for $GCFILE.tar.gz... " >&6; }
if eval \${$as_ac_File+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
-if test -r "$GCVERSION.tar.gz"; then
+if test -r "$GCFILE.tar.gz"; then
eval "$as_ac_File=yes"
else
eval "$as_ac_File=no"
@@ -5772,7 +5773,7 @@ $as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
ac_cv_use_gc=$GCVERSION
else
- GC_SYSTEM="$GCVERSION.tar.gz not found: using system Boehm garbage collector"
+ GC_SYSTEM="$GCFILE.tar.gz not found: using system Boehm garbage collector"
ac_cv_use_gc="system"
fi
@@ -5850,7 +5851,7 @@ if test "x$ac_cv_lib_gc_GC_malloc" = xyes; then :
$as_echo "$as_me: enabling system $GCNAME" >&6;}
else
- GCDIR=$GCVERSION
+ GCDIR=$GCFILE
INCL="-I\$(GC)/include"
GCLIB="\$(GC)/.libs/libgc.a"
{ $as_echo "$as_me:${as_lineno-$LINENO}: $GCNAME library not found" >&5
@@ -5858,7 +5859,7 @@ $as_echo "$as_me: $GCNAME library not found" >&6;}
fi
else
- GCDIR=$GCVERSION
+ GCDIR=$GCFILE
GCLIB="\$(GC)/.libs/libgc.a"
INCL="-I\$(GC)/include"
{ $as_echo "$as_me:${as_lineno-$LINENO}: $GCNAME header file not found" >&5
@@ -5869,7 +5870,8 @@ fi
CPPFLAGS=$CPPFLAGS_SAVE
;;
*)
- GCDIR=$ac_cv_use_gc
+ GCVERSION=$ac_cv_use_gc
+ GCDIR=gc-$GCVERSION
{ $as_echo "$as_me:${as_lineno-$LINENO}: enabling local $GCNAME $GCDIR" >&5
$as_echo "$as_me: enabling local $GCNAME $GCDIR" >&6;}
GCLIB="\$(GC)/.libs/libgc.a"
@@ -6113,7 +6115,7 @@ _ACEOF
LIBS="-lz $LIBS"
else
- as_fn_error $? "*** Please install libz on your system ***" "$LINENO" 5
+ as_fn_error $? "*** Please install libz or zlib-devel on your system ***" "$LINENO" 5
fi
# Make sure we can run config.sub.
@@ -7359,51 +7361,11 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OSMesa_OSMesaCreateContext" >&5
$as_echo "$ac_cv_lib_OSMesa_OSMesaCreateContext" >&6; }
if test "x$ac_cv_lib_OSMesa_OSMesaCreateContext" = xyes; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _glapi_get_context in -lglapi" >&5
-$as_echo_n "checking for _glapi_get_context in -lglapi... " >&6; }
-if ${ac_cv_lib_glapi__glapi_get_context+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lglapi $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char _glapi_get_context ();
-int
-main ()
-{
-return _glapi_get_context ();
- ;
- return 0;
-}
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBOSMESA 1
_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- ac_cv_lib_glapi__glapi_get_context=yes
-else
- ac_cv_lib_glapi__glapi_get_context=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_glapi__glapi_get_context" >&5
-$as_echo "$ac_cv_lib_glapi__glapi_get_context" >&6; }
-if test "x$ac_cv_lib_glapi__glapi_get_context" = xyes; then :
-$as_echo "#define HAVE_LIBOSMESA 1" >>confdefs.h
-
- LIBS=$LIBS"-lOSMesa -lglapi"
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: *** Could not find libglapi: will compile without offscreen rendering support ***" >&5
-$as_echo "$as_me: *** Could not find libglapi: will compile without offscreen rendering support ***" >&6;}
-fi
+ LIBS="-lOSMesa $LIBS"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: *** Could not find libOSMesa: will compile without offscreen rendering support ***" >&5
@@ -8535,7 +8497,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by Asymptote $as_me 2.23, which was
+This file was extended by Asymptote $as_me 2.25, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8597,7 +8559,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-Asymptote config.status 2.23
+Asymptote config.status 2.25
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -9333,10 +9295,12 @@ if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
else
echo
- echo Please put the Boehm garbage collector tar.gz file in the current directory.
- echo FOR EXAMPLE, USE THE COMMAND:
+ echo Please put the Boehm garbage collector tar.gz files in the current directory.
+ echo FOR EXAMPLE, USE THE COMMANDS:
+ echo
+ echo wget http://hboehm.info/gc/gc_source/$GCFILE.tar.gz
+ echo wget http://hboehm.info/gc/gc_source/libatomic_ops-$GCVERSION.tar.gz
echo
- echo wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/$GCDIR.tar.gz
exit 1
fi
diff --git a/Build/source/utils/asymptote/configure.ac b/Build/source/utils/asymptote/configure.ac
index 91ed875ff1d..94d3f622ff6 100644
--- a/Build/source/utils/asymptote/configure.ac
+++ b/Build/source/utils/asymptote/configure.ac
@@ -3,7 +3,7 @@
# this file.
AC_PREREQ(2)
-AC_INIT([Asymptote],[2.23],[http://sourceforge.net/projects/asymptote])
+AC_INIT([Asymptote],[2.25],[http://sourceforge.net/projects/asymptote])
VERSION=$PACKAGE_VERSION
AC_SUBST(VERSION)
m4_include([ax_pthread.m4])
@@ -52,7 +52,7 @@ fi
])
AC_CHECK_PROGS(TEXI2DVI,[texi2dvi texi2dvi4a2ps],
-[echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory and touch doc/asymptote.pdf; exit 1;])
+[echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory, touch doc/asymptote.pdf, and run configure again; exit 1;])
AC_SUBST(TEXI2DVI)
@@ -118,11 +118,12 @@ fi
AC_CHECK_HEADER(tr1/unordered_map,,
[AC_CHECK_HEADER(ext/hash_map,,OPTIONS=$OPTIONS"-DNOHASH ")])
-GCVERSION=gc-7.2d
+GCVERSION=7.4.0
+GCFILE=gc-$GCVERSION
-AC_CHECK_FILE($GCVERSION.tar.gz,
+AC_CHECK_FILE($GCFILE.tar.gz,
ac_cv_use_gc=$GCVERSION,
-[GC_SYSTEM="$GCVERSION.tar.gz not found: using system Boehm garbage collector"
+[GC_SYSTEM="$GCFILE.tar.gz not found: using system Boehm garbage collector"
ac_cv_use_gc="system"])
AC_ARG_ENABLE(gc,
[AS_HELP_STRING(--enable-gc[[[=system]]],
@@ -158,18 +159,19 @@ if test "x$ac_cv_use_gc" != "xno" ; then
AC_CHECK_LIB([gc],[GC_malloc],[
LIBS=$LIBS"-lgc "
AC_MSG_NOTICE([enabling system $GCNAME])],[
- GCDIR=$GCVERSION
+ GCDIR=$GCFILE
INCL="-I\$(GC)/include"
GCLIB="\$(GC)/.libs/libgc.a"
AC_MSG_NOTICE($GCNAME library not found)]),
- GCDIR=$GCVERSION
+ GCDIR=$GCFILE
GCLIB="\$(GC)/.libs/libgc.a"
INCL="-I\$(GC)/include"
AC_MSG_NOTICE($GCNAME header file not found))
CPPFLAGS=$CPPFLAGS_SAVE
;;
*)
- GCDIR=$ac_cv_use_gc
+ GCVERSION=$ac_cv_use_gc
+ GCDIR=gc-$GCVERSION
AC_MSG_NOTICE([enabling local $GCNAME $GCDIR])
GCLIB="\$(GC)/.libs/libgc.a"
INCL="-I\$(GC)/include"
@@ -211,7 +213,7 @@ AC_CHECK_FUNC(getopt_long_only, AC_DEFINE(HAVE_GNU_GETOPT_H, 1,
getopt="getopt getopt1",)
AC_SUBST(getopt)
-AC_SUBST(GCDIR)
+AC_SUBST(GCVERSION)
AC_SUBST(GCOPTIONS)
AC_SUBST(GCLIB)
AC_SUBST(GCPPLIB)
@@ -225,7 +227,7 @@ AC_CHECK_LIB([ncurses], [setupterm], [AC_DEFINE(HAVE_LIBCURSES)
AC_CHECK_LIB([m], [sqrt],,
AC_MSG_ERROR([*** Please install libm on your system ***]))
AC_CHECK_LIB([z], [deflate],,
-AC_MSG_ERROR([*** Please install libz on your system ***]))
+AC_MSG_ERROR([*** Please install libz or zlib-devel on your system ***]))
AX_PTHREAD
AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler])
AC_CHECK_LIB([rt], [sched_yield])
@@ -331,12 +333,7 @@ void f(void) {
AC_MSG_NOTICE([*** Could not find libglut: will compile without GLUT support ***]))
esac
if test "x$enable_offscreen" != "xno"; then
- AC_CHECK_LIB([OSMesa],OSMesaCreateContext,
- AC_CHECK_LIB([glapi],_glapi_get_context,
- [AC_DEFINE(HAVE_LIBOSMESA, 1,
- [Define if you have the `OSMesa' library (-lOSMesa).])
- LIBS=$LIBS"-lOSMesa -lglapi"],
- AC_MSG_NOTICE([*** Could not find libglapi: will compile without offscreen rendering support ***])),
+ AC_CHECK_LIB([OSMesa],OSMesaCreateContext,,
AC_MSG_NOTICE([*** Could not find libOSMesa: will compile without offscreen rendering support ***]))
fi
fi
@@ -371,10 +368,12 @@ AC_OUTPUT
if test "x$GCDIR" != "x" ; then
AC_CHECK_FILE($GCDIR.tar.gz,,[
echo
- echo Please put the Boehm garbage collector tar.gz file in the current directory.
- echo FOR EXAMPLE, USE THE COMMAND:
+ echo Please put the Boehm garbage collector tar.gz files in the current directory.
+ echo FOR EXAMPLE, USE THE COMMANDS:
+ echo
+ echo wget http://hboehm.info/gc/gc_source/$GCFILE.tar.gz
+ echo wget http://hboehm.info/gc/gc_source/libatomic_ops-$GCVERSION.tar.gz
echo
- echo wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/$GCDIR.tar.gz
exit 1
])
fi
diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf
deleted file mode 100644
index 2fcce4251e6..00000000000
--- a/Build/source/utils/asymptote/doc/CAD.pdf
+++ /dev/null
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.bfnn b/Build/source/utils/asymptote/doc/FAQ/asy-faq.bfnn
index 26fcd14b628..21fb57233f0 100644
--- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.bfnn
+++ b/Build/source/utils/asymptote/doc/FAQ/asy-faq.bfnn
@@ -421,7 +421,7 @@ size argument. If you want to do this globally, you can override the
pen-dependent arrowsize function like this:
\verbatim
-arrowsize=new real(pen p=currentpen) {return 2mm;};
+DefaultHead.size=new real(pen p=currentpen) {return 2mm;};
\endverbatim
\question 26jun:arrowhead Can I create other arrowhead styles?
diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
deleted file mode 100644
index aec3cabfcd0..00000000000
--- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
+++ /dev/null
@@ -1,1671 +0,0 @@
-Info file: asy-faq.info, -*-Text-*-
-produced by bfnnconv.pl from the Bizarre Format With No Name.
-
-INFO-DIR-SECTION Languages
-START-INFO-DIR-ENTRY
-* asymptote FAQ: (asy-faq). Asymptote Frequently Asked Questions.
-END-INFO-DIR-ENTRY
-
-
-File: asy-faq.info, Node: Top, Next: Question 1.1, Up: (dir)
-
- ASYMPTOTE FREQUENTLY ASKED QUESTIONS
- 20 May 2013
-
-This is the list of Frequently Asked Questions about Asymptote (asy).
-
-Index
-
-* Menu:
-* Section 1:: About Asymptote
-* Section 2:: Questions about installation and setup
-* Section 3:: Questions about paths
-* Section 4:: Questions about labels
-* Section 5:: Questions about arrows
-* Section 6:: Questions about 2D graphs
-* Section 7:: Questions about programming
-* Section 8:: Questions about differences between Asymptote and
- MetaPost
-* Section 9:: Questions about output
-
-Section 1, About Asymptote
-* Question 1.1:: What is Asymptote?
-* Question 1.2:: How do I obtain Asymptote?
-* Question 1.3:: Where can I ask questions about Asymptote?
-* Question 1.4:: Why was the name Asymptote chosen?
-* Question 1.5:: In the internal Asymptote source code, what does the
- name camp refer to?
-
-Section 2, Questions about installation and setup
-* Question 2.1:: Is it possible to install Asymptote on Mac OS X?
-* Question 2.2:: Why do I get the error Bad CPU type in executable on
- installing Asymptote from the MAC OS binary?
-* Question 2.3:: What do I do if I get the error: Error: pdfetex (file
- pdftex.cfg): cannot open config file...texinfo.tex
- appears to be broken?
-* Question 2.4:: What do I do if I get the error: ! Undefined control
- sequence. l.6 @copying?
-* Question 2.5:: Is it possible to integrate Asymptote into LaTeX?
-* Question 2.6:: Is it possible to integrate Asymptote into latex or
- pdflatex?
-* Question 2.7:: Do I need the tkinter package to install an Asymptote
- rpm binary?
-* Question 2.8:: What does the path %USERPROFILE%\.asy\config.asy mean?
-* Question 2.9:: Why do I get the error "string not terminated" when I
- try to set settings.dir="C:\asymptote\";?
-* Question 2.10:: How do I change environment variables in Microsoft
- Windows, for example, in order to change the default
- PostScript viewer?
-* Question 2.11:: Under Microsoft Windows XP, why do I get an error like
- "Invalid Parameter - 432x432"?
-* Question 2.12:: Why does Asymptote freeze upon trying to draw a label
- with my MikTex installation under Microsoft Windows?
-
-Section 3, Questions about paths
-* Question 3.1:: Why do I get a syntax error message when I specify an
- integer value for the path tension?
-* Question 3.2:: Shouldn't dots always be the same size?
-
-Section 4, Questions about labels
-* Question 4.1:: How do I get Greek letters like omega to show up in my
- labels?
-* Question 4.2:: Can Asymptote use matrices as labels?
-* Question 4.3:: How do I tell Asymptote to load a particular LaTeX
- package, like mathptmx?
-* Question 4.4:: How can I use international fonts in Asymptote labels?
-* Question 4.5:: How can I use Fourier fonts?
-* Question 4.6:: Is there any way to change the default appearance of
- the decimal separator, using a comma instead of a dot?
-* Question 4.7:: How can I get a rotated label with the filled box
- rotated as well so that it fits the text?
-* Question 4.8:: How can I rotate labels in a 3D figure?
-* Question 4.9:: How can I draw some squares and circles of a fixed
- size and put a label in the middle of them?
-* Question 4.10:: The binary operator * can be used to scale the color
- of a pen by a real number. Does this scaling factor
- have to be less than 1?
-* Question 4.11:: Why is the space after the comma decimal separator in
- my locale so large?
-* Question 4.12:: How can I prevent
- texpreamble("\usepackage[pdftex]{hyperref}") from
- changing the page size?
-
-Section 5, Questions about arrows
-* Question 5.1:: How do I draw two arrows at arbitrary positions along
- a path?
-* Question 5.2:: How do I reverse the direction of an arrowhead?
-* Question 5.3:: How do I change the size of all arrows?
-* Question 5.4:: Can I create other arrowhead styles?
-
-Section 6, Questions about 2D graphs
-* Question 6.1:: How can I draw x axis ticks on the right side, with
- the tick labels on the left side (relative to the axis
- path)?
-* Question 6.2:: How can I reposition the x axis label to
- three-quarters along the axis length?
-* Question 6.3:: How can I move the x axis label down 10bp?
-* Question 6.4:: Can I use different pens for the axis, the axis label,
- and the tick labels?
-* Question 6.5:: How can I change the font type of the axes label?
-* Question 6.6:: How can I change the font type of the tick labels on
- an axis?
-* Question 6.7:: How can I prevent axes tick labels from rendering on
- top of each other?
-* Question 6.8:: How do I make the plot region of a graph, ignoring
- labels and legends, have a fixed size?
-* Question 6.9:: How can I plot a function f(x) within [0,1]x[0,2]
- without explicitly calculating the x values for which
- f(x) hits the boundary?
-* Question 6.10:: Is it possible to define customized palettes?
-* Question 6.11:: Is there an easy way to graph factorial functions
- nicely?
-* Question 6.12:: How do I indicate that a certain length should be
- exactly the size I prescribe with no rescaling, within
- a picture which has its own size?
-* Question 6.13:: How can I make the y axis display base-2 logarithmic
- values?
-* Question 6.14:: How can I align the x axes of two graphs on the same
- figure?
-* Question 6.15:: How can I change the direction of the y-axis, such
- that negatives values are on the upper y-axis?
-* Question 6.16:: How can I fill a path with a function that defines the
- color of each location?
-* Question 6.17:: Is there a way to draw a function that is not
- explicitly given, such as (y - 2)^2 = x - 1 ?
-* Question 6.18:: Is it possible to reverse or stretch an axis?
-* Question 6.19:: Why can't I use the UnFill option to draw graphs with
- empty markers?
-* Question 6.20:: How can I force several images to use the same palette
- range (e.g. the entire 0-255 grayscale range)?
-
-Section 7, Questions about programming
-* Question 7.1:: Is Asymptote an interpreter or a compiler?
-* Question 7.2:: What is the difference between a frame and a picture?
-* Question 7.3:: What is the difference between a path and a guide?
-* Question 7.4:: What is a convenient way to declare and initialize an
- array of pictures?
-* Question 7.5:: Is there a way to define functions that act on arrays
- in general (i.e. work for arrays of any type)?
-* Question 7.6:: Is there any way to declare structures ahead of their
- definition, e.g. where struct A performs some
- operation on struct B, but B contains an A member?
-* Question 7.7:: Where are static variables in for loops allocated?
-* Question 7.8:: Is there a debugger for asy?
-* Question 7.9:: Do you accept patches for Asymptote?
-
-Section 8, Questions about differences between Asymptote and
- MetaPost
-* Question 8.1:: What is the equivalent of the MetaPost c[a,b]
- interpolation operator?
-* Question 8.2:: How does picture scaling differ in Asymptote and
- MetaPost?
-* Question 8.3:: How can I avoid automatic scaling of a picture?
-* Question 8.4:: What is the equivalent of MetaPost ... command?
-* Question 8.5:: What is the equivalent of the MetaPost pickup command?
-* Question 8.6:: What is the equivalent of the MetaPost whatever
- command?
-* Question 8.7:: What is the equivalent for the MetaPost command for
- lray - horiz*v - verti*u = whatever*(LightSource - R),
- a system of three linear equations for three unknowns:
- horiz, verti, whatever?
-* Question 8.8:: In MetaPost, it is possible to have a drawing remain
- the same size in different pictures by defining a unit
- u and explicitly multiply all the coordinates by u. Is
- there a better way to do this in Asymptote?
-* Question 8.9:: In MetaPost, one could produce tiling pictures by
- generating a picture, and then clipping the picture to
- a rectangle of fixed dimensions around the center of
- the picture. How is that done in Asymptote?
-
-Section 9, Questions about output
-* Question 9.1:: How can I disable automatic invocation of the PS
- viewer after an asy file is done processing?
-* Question 9.2:: How do I output jpeg images?
-* Question 9.3:: Can I embed bitmaps (photos) into my drawings and
- position and scale them?
-* Question 9.4:: Does Asymptote support direct PDF output?
-* Question 9.5:: How to I produce large pictures of high quality in
- raster format (e.g. png, giff etc).
-* Question 9.6:: Is it possible to produce multi-page documents with
- asymptote?
-
-
-
-File: asy-faq.info, Node: Section 1, Next: Section 2, Previous: Top, Up: Top
-
-About Asymptote
-
-* Menu:
-* Question 1.1:: What is Asymptote?
-* Question 1.2:: How do I obtain Asymptote?
-* Question 1.3:: Where can I ask questions about Asymptote?
-* Question 1.4:: Why was the name Asymptote chosen?
-* Question 1.5:: In the internal Asymptote source code, what does the
- name camp refer to?
-
-
-
-File: asy-faq.info, Node: Question 1.1, Next: Question 1.2, Previous: Top, Up: Section 1
-
-Question 1.1. What is Asymptote?
-
-Asymptote is a vector graphics language designed for technical graphics,
-inspired by MetaPost but with IEEE floating-point numerics, native
-three-dimensional graphics, Grayscale/RGB/CMYK colourspaces, and a
-C++-like syntax. Unlike MetaPost, it natively supports multiple-segment
-paths (and hence regions other than simply connected ones), tiling
-patterns, Gouraud shading, tensor patch shading, and PostScript images.
-
-
-File: asy-faq.info, Node: Question 1.2, Next: Question 1.3, Previous: Question 1.1, Up: Section 1
-
-Question 1.2. How do I obtain Asymptote?
-
-Binary releases are available for Linux, MacOS X, and Microsoft Windows
-platforms, in addition to full source code, from the website
-http://asymptote.sourceforge.net/. Many Linux distributions (such as
-RedHat and Debian) now include an Asymptote package (check your
-distribution's documentation for further information about this).
-
-
-File: asy-faq.info, Node: Question 1.3, Next: Question 1.4, Previous: Question 1.2, Up: Section 1
-
-Question 1.3. Where can I ask questions about Asymptote?
-
-If you have a question, please try to find an answer in this FAQ, in the
-extensive Asymptote documentation at
-http://asymptote.sourceforge.net/doc/, or search the forum:
-http://sourceforge.net/forum/forum.php?forum_id=409349.
-
-
-File: asy-faq.info, Node: Question 1.4, Next: Question 1.5, Previous: Question 1.3, Up: Section 1
-
-Question 1.4. Why was the name Asymptote chosen?
-
-Well, it isn't the perfect graphics package, but we do think it is getting
-there asymptotically...
-
-
-File: asy-faq.info, Node: Question 1.5, Next: Question 2.1, Previous: Question 1.4, Up: Section 1
-
-Question 1.5. In the internal Asymptote source code, what does the name camp refer to?
-
-That was our original tentative name for this project, which stood for
-"C's Answer to MetaPost" (the language that inspired Asymptote). However,
-we eventually decided that the name Asymptote better emphasizes the
-mathematical and graphical nature of this language.
-
-
-File: asy-faq.info, Node: Section 2, Next: Section 3, Previous: Section 1, Up: Top
-
-Questions about installation and setup
-
-* Menu:
-* Question 2.1:: Is it possible to install Asymptote on Mac OS X?
-* Question 2.2:: Why do I get the error Bad CPU type in executable on
- installing Asymptote from the MAC OS binary?
-* Question 2.3:: What do I do if I get the error: Error: pdfetex (file
- pdftex.cfg): cannot open config file...texinfo.tex
- appears to be broken?
-* Question 2.4:: What do I do if I get the error: ! Undefined control
- sequence. l.6 @copying?
-* Question 2.5:: Is it possible to integrate Asymptote into LaTeX?
-* Question 2.6:: Is it possible to integrate Asymptote into latex or
- pdflatex?
-* Question 2.7:: Do I need the tkinter package to install an Asymptote
- rpm binary?
-* Question 2.8:: What does the path %USERPROFILE%\.asy\config.asy mean?
-* Question 2.9:: Why do I get the error "string not terminated" when I
- try to set settings.dir="C:\asymptote\";?
-* Question 2.10:: How do I change environment variables in Microsoft
- Windows, for example, in order to change the default
- PostScript viewer?
-* Question 2.11:: Under Microsoft Windows XP, why do I get an error like
- "Invalid Parameter - 432x432"?
-* Question 2.12:: Why does Asymptote freeze upon trying to draw a label
- with my MikTex installation under Microsoft Windows?
-
-
-
-File: asy-faq.info, Node: Question 2.1, Next: Question 2.2, Previous: Question 1.5, Up: Section 2
-
-Question 2.1. Is it possible to install Asymptote on Mac OS X?
-
-It is easy to compile Asymptote directly from the source code at
-http://sourceforge.net/project/showfiles.php?group_id=120000 We recommend
-first upgrading to the latest GNU readline library, unless you don't care
-about interactive readline support (in which case configure will
-automatically detect and disable obsolete versions of the readline
-library). Marius Schamschula also maintains a binary package for various
-MacOS X platforms
-http://www.hmug.org/pub/MacOS_X/X/Applications/Publishing/asymptote.
-
-
-File: asy-faq.info, Node: Question 2.2, Next: Question 2.3, Previous: Question 2.1, Up: Section 2
-
-Question 2.2. Why do I get the error Bad CPU type in executable on installing Asymptote from the MAC OS binary?
-
-This means either that you have a binary distribution for another MAC
-architecture, or (according to Marius Schamschula) that you may have a
-missing library. The simplest solution is to compile Asymptote directly
-from the official source:
-http://sourceforge.net/project/showfiles.php?group_id=120000.
-
-
-File: asy-faq.info, Node: Question 2.3, Next: Question 2.4, Previous: Question 2.2, Up: Section 2
-
-Question 2.3. What do I do if I get the error: Error: pdfetex (file pdftex.cfg): cannot open config file...texinfo.tex appears to be broken?
-
-Simply put http://asymptote.sourceforge.net/asymptote.pdf in the directory
-doc and repeat the command make all. Or, if you don't want to build a
-local copy of the documentation, simply proceed with make install-asy.
-
-
-File: asy-faq.info, Node: Question 2.4, Next: Question 2.5, Previous: Question 2.3, Up: Section 2
-
-Question 2.4. What do I do if I get the error: ! Undefined control sequence. l.6 @copying?
-
-Either upgrade your texinfo package or follow one of the easy work arounds
-in *Note Question 2.3:: `What do I do if I get the error: Error: pdfetex
-(file pdftex.cfg): cannot open config file...texinfo.tex appears to be
-broken?'.
-
-
-File: asy-faq.info, Node: Question 2.5, Next: Question 2.6, Previous: Question 2.4, Up: Section 2
-
-Question 2.5. Is it possible to integrate Asymptote into LaTeX?
-
-Yes, see the example latexusage.tex. Dario Teixeira has also written a
-detailed guide on the topic. You can download it from
-http://dario.dse.nl/projects/asylatex/.
-
-Philippe Ivaldi has contributed an Asymptote mode for Emacs users
-http://asymptote.sourceforge.net/doc/Editing-modes.html, which includes a
-lasy-mode that allows one to compile and view the output of one
-\begin{asy}...\end{asy} section at a time.
-
-
-File: asy-faq.info, Node: Question 2.6, Next: Question 2.7, Previous: Question 2.5, Up: Section 2
-
-Question 2.6. Is it possible to integrate Asymptote into latex or pdflatex?
-
-Yes, as of version 1.14, Asymptote supports latex and pdflatex (both in
-EPS/PDF and inline mode), as illustrated by the example latexusage.tex:
-
-pdflatex latexusage
-asy latexusage
-pdflatex latexusage
-
-File: asy-faq.info, Node: Question 2.7, Next: Question 2.8, Previous: Question 2.6, Up: Section 2
-
-Question 2.7. Do I need the tkinter package to install an Asymptote rpm binary?
-
-No, you don't need tkinter unless you want to try out the GUI xasy. Try
-
-rpm -Uvh --nodeps asymptote-x.xx-1.i386.rpm
-where x.xx represents the version number.
-
-
-File: asy-faq.info, Node: Question 2.8, Next: Question 2.9, Previous: Question 2.7, Up: Section 2
-
-Question 2.8. What does the path %USERPROFILE%\.asy\config.asy mean?
-
-That is the way that Microsoft Windows refers to the user profile
-directory. There's nothing really to understand here, just put your
-configuration commands in the file config.asy in a new folder
-%USERPROFILE%\.asy.
-
-
-File: asy-faq.info, Node: Question 2.9, Next: Question 2.10, Previous: Question 2.8, Up: Section 2
-
-Question 2.9. Why do I get the error "string not terminated" when I try to set settings.dir="C:\asymptote\";?
-
-The backslash is an escape character here, so \" is interpreted as a
-verbatim quotation mark, leaving the string without a terminating
-quotation mark. Fortunately, this is the only escaped character in
-double-quoted strings. A final backslash isn't needed here anyway, but
-should you really want one somewhere, you can say:
-settings.dir="C:\asymptote"+'\\';.
-
-
-File: asy-faq.info, Node: Question 2.10, Next: Question 2.11, Previous: Question 2.9, Up: Section 2
-
-Question 2.10. How do I change environment variables in Microsoft Windows, for example, in order to change the default PostScript viewer?
-
-While it is easier to set the corresponding Asymptote configuration
-variable in your config.asy file, here is the procedure for changing
-Microsoft Windows environment variables:
-
-Click on the [Start] button
-
-* RIGHT-click on 'My Computer'
-
-* Choose 'Properties' from the popup menu
-
-* Click the 'Advanced' tab
-
-* Click the 'Environment Variables' button.
-
-
-File: asy-faq.info, Node: Question 2.11, Next: Question 2.12, Previous: Question 2.10, Up: Section 2
-
-Question 2.11. Under Microsoft Windows XP, why do I get an error like "Invalid Parameter - 432x432"?
-
-This means that ImageMagick wasn't properly installed and you are using
-the MSDOS convert program rather than the ImageMagick one. Or you may have
-installed ImageMagick but ran Asymptote from an existing MSDOS window. In
-that case, simply open a new window and try again. If that doesn't work,
-check that
-
-convert --version
-returns something like
-
-Version: ImageMagick 6.2.8 06/27/06 Q16 http://www.imagemagick.org
-
-File: asy-faq.info, Node: Question 2.12, Next: Question 3.1, Previous: Question 2.11, Up: Section 2
-
-Question 2.12. Why does Asymptote freeze upon trying to draw a label with my MikTex installation under Microsoft Windows?
-
-Likely, this means that latex and dvips are not in your default path. Try
-adding the appropriate paths in your config.asy file, for example:
-
-import settings;
-latex="C:\Program Files\MiKTeX 2.7\miktex\bin\latex.exe";
-dvips="C:\Program Files\MiKTeX 2.7\miktex\bin\dvips.exe";
-
-File: asy-faq.info, Node: Section 3, Next: Section 4, Previous: Section 2, Up: Top
-
-Questions about paths
-
-* Menu:
-* Question 3.1:: Why do I get a syntax error message when I specify an
- integer value for the path tension?
-* Question 3.2:: Shouldn't dots always be the same size?
-
-
-
-File: asy-faq.info, Node: Question 3.1, Next: Question 3.2, Previous: Question 2.12, Up: Section 3
-
-Question 3.1. Why do I get a syntax error message when I specify an integer value for the path tension?
-
-What is happening here is that
-
-draw((0,0)..tension 2..(0,50)..(100,100));
-is read as
-
-draw((0,0)..tension 2. .(0,50)..(100,100));
-So the first . after the two is treated as a decimal point. Just put a
-space after the integer tension value:
-
-draw((0,0)..tension 2 ..(0,50)..(100,100));
-
-File: asy-faq.info, Node: Question 3.2, Next: Question 4.1, Previous: Question 3.1, Up: Section 3
-
-Question 3.2. Shouldn't dots always be the same size?
-
-From the documentation:
-
-"The dot command defined in the module plain draws a dot having a diameter
-equal to an explicit pen linewidth or the default linewidth magnified by
-dotfactor (6 by default)."
-
-Thus, when you use the default pen, the dot will have size 6*linewidth,
-but when you give a pen with an explicit width specified, you will have a
-dot of size linewidth. If you want the first case to behave like the
-second, you may set dotfactor=1.
-
-
-File: asy-faq.info, Node: Section 4, Next: Section 5, Previous: Section 3, Up: Top
-
-Questions about labels
-
-* Menu:
-* Question 4.1:: How do I get Greek letters like omega to show up in my
- labels?
-* Question 4.2:: Can Asymptote use matrices as labels?
-* Question 4.3:: How do I tell Asymptote to load a particular LaTeX
- package, like mathptmx?
-* Question 4.4:: How can I use international fonts in Asymptote labels?
-* Question 4.5:: How can I use Fourier fonts?
-* Question 4.6:: Is there any way to change the default appearance of
- the decimal separator, using a comma instead of a dot?
-* Question 4.7:: How can I get a rotated label with the filled box
- rotated as well so that it fits the text?
-* Question 4.8:: How can I rotate labels in a 3D figure?
-* Question 4.9:: How can I draw some squares and circles of a fixed
- size and put a label in the middle of them?
-* Question 4.10:: The binary operator * can be used to scale the color
- of a pen by a real number. Does this scaling factor
- have to be less than 1?
-* Question 4.11:: Why is the space after the comma decimal separator in
- my locale so large?
-* Question 4.12:: How can I prevent
- texpreamble("\usepackage[pdftex]{hyperref}") from
- changing the page size?
-
-
-
-File: asy-faq.info, Node: Question 4.1, Next: Question 4.2, Previous: Question 3.2, Up: Section 4
-
-Question 4.1. How do I get Greek letters like omega to show up in my labels?
-
-In (La)TeX, Greek letters can be obtained in math mode by prepending a
-backslash to the letter name. So for a omega symbol, use "$\omega$".
-Everything between the dollar signs is considered to be a math formula.
-Uppercase Greek letters can be used by capitalizing the first letter of
-the name:
-
-label("$\omega$",(0,0));
-label("$\Omega$",(20,0));
-
-File: asy-faq.info, Node: Question 4.2, Next: Question 4.3, Previous: Question 4.1, Up: Section 4
-
-Question 4.2. Can Asymptote use matrices as labels?
-
-Yes:
-usepackage("amsmath");
-label("$\begin{matrix} 1 & 2 \\\ 1 & 1 \end{matrix}$",(0,0));
-
-File: asy-faq.info, Node: Question 4.3, Next: Question 4.4, Previous: Question 4.2, Up: Section 4
-
-Question 4.3. How do I tell Asymptote to load a particular LaTeX package, like mathptmx?
-
-Put
-
-usepackage("mathptmx");
-at the beginning of your file. Note: to enable the Adobe Times Roman font
-for text, you will also need to say:
-defaultpen(TimesRoman());
-
-File: asy-faq.info, Node: Question 4.4, Next: Question 4.5, Previous: Question 4.3, Up: Section 4
-
-Question 4.4. How can I use international fonts in Asymptote labels?
-
-See http://asymptote.sourceforge.net/doc/unicode.html.
-
-
-File: asy-faq.info, Node: Question 4.5, Next: Question 4.6, Previous: Question 4.4, Up: Section 4
-
-Question 4.5. How can I use Fourier fonts?
-
-usepackage("fourier");
-defaultpen(font("T1","fut\textfamilyextension","m","n"));
-
-File: asy-faq.info, Node: Question 4.6, Next: Question 4.7, Previous: Question 4.5, Up: Section 4
-
-Question 4.6. Is there any way to change the default appearance of the decimal separator, using a comma instead of a dot?
-
-Just set your locale appropriately:
-
-locale("it_IT");
-usepackage("icomma");
-label(format(0.5));
-
-File: asy-faq.info, Node: Question 4.7, Next: Question 4.8, Previous: Question 4.6, Up: Section 4
-
-Question 4.7. How can I get a rotated label with the filled box rotated as well so that it fits the text?
-
-frame f;
-label(f,"This is some text",white,Fill(blue));
-add(rotate(65)*f);
-
-File: asy-faq.info, Node: Question 4.8, Next: Question 4.9, Previous: Question 4.7, Up: Section 4
-
-Question 4.8. How can I rotate labels in a 3D figure?
-
-You need to first project the triple to a pair like this:
-
-import three;
-size(100,100);
-
-draw(rotate(90,project(Z))*"A",O--X);
-
-File: asy-faq.info, Node: Question 4.9, Next: Question 4.10, Previous: Question 4.8, Up: Section 4
-
-Question 4.9. How can I draw some squares and circles of a fixed size and put a label in the middle of them?
-
-Fixed-size objects should be drawn on a separate picture and then added to
-currentpicture. Here is one way (see also
-http://asymptote.sourceforge.net/gallery/subpictures.asy and
-http://asymptote.sourceforge.net/gallery/mosquito.asy):
-
-real u=2cm;
-
-picture square;
-draw(square,scale(u)*shift(-0.5,-0.5)*unitsquare);
-
-picture circle;
-draw(circle,scale(0.5u)*unitcircle);
-
-void add(picture pic=currentpicture, Label L, picture object, pair z) {
-add(pic,object,z);
-label(pic,L,z);
-}
-
-add("square",square,(0,0));
-add("circle",circle,(5cm,0));
-
-File: asy-faq.info, Node: Question 4.10, Next: Question 4.11, Previous: Question 4.9, Up: Section 4
-
-Question 4.10. The binary operator * can be used to scale the color of a pen by a real number. Does this scaling factor have to be less than 1?
-
-The scaling factor can be greater than 1. But keep in mind that the rgb
-color components saturate at 1.
-
-Try
-write(cyan); write(0.8*cyan); write(1.5*cyan);
-and you will quickly see what is going on.
-
-To get a lighter cyan you can say white+cyan, which yields rgb(0.5,1,1).
-If you want something even lighter specify the rgb colors directly, for
-example, rgb(0.9,1,1).
-
-Alternatively, work in cmyk colour space, which is nicer in that it
-handles saturation separately from hue:
-
-0.1*Cyan is light and 0.9*Cyan is dark. You can also say 0.1*cmyk(red).
-
-
-File: asy-faq.info, Node: Question 4.11, Next: Question 4.12, Previous: Question 4.10, Up: Section 4
-
-Question 4.11. Why is the space after the comma decimal separator in my locale so large?
-
-LaTeX is treating the comma as punctuation and not as a decimal separator.
-The solution is to load the icomma package near the beginning of your
-file:
-usepackage("icomma");
-
-File: asy-faq.info, Node: Question 4.12, Next: Question 5.1, Previous: Question 4.11, Up: Section 4
-
-Question 4.12. How can I prevent texpreamble("\usepackage[pdftex]{hyperref}") from changing the page size?
-
-texpreamble("\usepackage[pdftex,setpagesize=false]{hyperref}");
-
-File: asy-faq.info, Node: Section 5, Next: Section 6, Previous: Section 4, Up: Top
-
-Questions about arrows
-
-* Menu:
-* Question 5.1:: How do I draw two arrows at arbitrary positions along
- a path?
-* Question 5.2:: How do I reverse the direction of an arrowhead?
-* Question 5.3:: How do I change the size of all arrows?
-* Question 5.4:: Can I create other arrowhead styles?
-
-
-
-File: asy-faq.info, Node: Question 5.1, Next: Question 5.2, Previous: Question 4.12, Up: Section 5
-
-Question 5.1. How do I draw two arrows at arbitrary positions along a path?
-
-Assuming that at least one of the arrowheads is to be filled, you can do
-this:
-
-size(200);
-path g = (0,0)..(1,3)..(3,0);
-draw(g,Arrow(Relative(0.9)));
-add(arrow(g,invisible,FillDraw(black),Relative(0.5)));
-add(arrow(reverse(g),invisible,FillDraw(white,black),Relative(0.9)));
-If both of the arrowheads are to be drawn with filltype NoFill, one will
-need to create a specialized version of the arrow routine in
-plain_arrows.asy:
-
-void arrow(frame f, arrowhead arrowhead=DefaultHead,
- path g, pen p=currentpen, real size=0,
- real angle=arrowangle, filltype filltype=arrowhead.defaultfilltype,
- position position=EndPoint, bool forwards=true,
- margin margin=NoMargin, bool center=false);
-
-File: asy-faq.info, Node: Question 5.2, Next: Question 5.3, Previous: Question 5.1, Up: Section 5
-
-Question 5.2. How do I reverse the direction of an arrowhead?
-
-Simply reverse the direction of the path.
-
-path g=((0,0)--(5cm,0));
-draw(reverse(g),Arrow(Relative(0.55)));
-
-File: asy-faq.info, Node: Question 5.3, Next: Question 5.4, Previous: Question 5.2, Up: Section 5
-
-Question 5.3. How do I change the size of all arrows?
-
-To override the arrowsize you can give every Arrow drawing attribute a
-real size argument. If you want to do this globally, you can override the
-pen-dependent arrowsize function like this:
-
-arrowsize=new real(pen p=currentpen) {return 2mm;};
-
-File: asy-faq.info, Node: Question 5.4, Next: Question 6.1, Previous: Question 5.3, Up: Section 5
-
-Question 5.4. Can I create other arrowhead styles?
-
-Yes, you can build custom arrowheads like this (see the predefined
-arrowhead styles in plain_arrows.asy for further examples):
-
-arrowhead DotHead;
-DotHead.head=new path(path g, position position=EndPoint, pen p=currentpen,
- real size=0, real angle=arrowangle) {
- if(size == 0) size=DotHead.size(p);
- bool relative=position.relative;
- real position=position.position.x;
- if(relative) position=reltime(g,position);
- path r=subpath(g,position,0);
- pair x=point(r,0);
- real t=arctime(r,size);
- pair y=point(r,t);
- return circle(0.5(x+y),0.5size);
-};
-
-size(100);
-draw((0,0)..(1,1)..(2,0),Arrow(DotHead));
-dot((2,0),red);
-If you submit your alternate arrowheads to the Forum or the Patch
-Tracking System, we'll consider including them in a future release.
-
-
-File: asy-faq.info, Node: Section 6, Next: Section 7, Previous: Section 5, Up: Top
-
-Questions about 2D graphs
-
-* Menu:
-* Question 6.1:: How can I draw x axis ticks on the right side, with
- the tick labels on the left side (relative to the axis
- path)?
-* Question 6.2:: How can I reposition the x axis label to
- three-quarters along the axis length?
-* Question 6.3:: How can I move the x axis label down 10bp?
-* Question 6.4:: Can I use different pens for the axis, the axis label,
- and the tick labels?
-* Question 6.5:: How can I change the font type of the axes label?
-* Question 6.6:: How can I change the font type of the tick labels on
- an axis?
-* Question 6.7:: How can I prevent axes tick labels from rendering on
- top of each other?
-* Question 6.8:: How do I make the plot region of a graph, ignoring
- labels and legends, have a fixed size?
-* Question 6.9:: How can I plot a function f(x) within [0,1]x[0,2]
- without explicitly calculating the x values for which
- f(x) hits the boundary?
-* Question 6.10:: Is it possible to define customized palettes?
-* Question 6.11:: Is there an easy way to graph factorial functions
- nicely?
-* Question 6.12:: How do I indicate that a certain length should be
- exactly the size I prescribe with no rescaling, within
- a picture which has its own size?
-* Question 6.13:: How can I make the y axis display base-2 logarithmic
- values?
-* Question 6.14:: How can I align the x axes of two graphs on the same
- figure?
-* Question 6.15:: How can I change the direction of the y-axis, such
- that negatives values are on the upper y-axis?
-* Question 6.16:: How can I fill a path with a function that defines the
- color of each location?
-* Question 6.17:: Is there a way to draw a function that is not
- explicitly given, such as (y - 2)^2 = x - 1 ?
-* Question 6.18:: Is it possible to reverse or stretch an axis?
-* Question 6.19:: Why can't I use the UnFill option to draw graphs with
- empty markers?
-* Question 6.20:: How can I force several images to use the same palette
- range (e.g. the entire 0-255 grayscale range)?
-
-
-
-File: asy-faq.info, Node: Question 6.1, Next: Question 6.2, Previous: Question 5.4, Up: Section 6
-
-Question 6.1. How can I draw x axis ticks on the right side, with the tick labels on the left side (relative to the axis path)?
-
-import graph;
-
-size(250,200,IgnoreAspect);
-
-draw(graph(exp,-1,1),red);
-
-xaxis("$x$",RightTicks(Label(align=left)));
-yaxis("$y$",RightTicks);
-
-File: asy-faq.info, Node: Question 6.2, Next: Question 6.3, Previous: Question 6.1, Up: Section 6
-
-Question 6.2. How can I reposition the x axis label to three-quarters along the axis length?
-
-import graph;
-
-size(250,200,IgnoreAspect);
-
-draw(graph(exp,-1,1),red);
-
-xaxis(Label("$x$",0.75),LeftTicks);
-yaxis("$y$",RightTicks);
-
-File: asy-faq.info, Node: Question 6.3, Next: Question 6.4, Previous: Question 6.2, Up: Section 6
-
-Question 6.3. How can I move the x axis label down 10bp?
-
-import graph;
-size(250,200,IgnoreAspect);
-
-draw(graph(exp,-1,1),red);
-
-xaxis(shift(0,-10)*"$x$",LeftTicks);
-yaxis("$y$",RightTicks);
-
-File: asy-faq.info, Node: Question 6.4, Next: Question 6.5, Previous: Question 6.3, Up: Section 6
-
-Question 6.4. Can I use different pens for the axis, the axis label, and the tick labels?
-
-Yes:
-
-import graph;
-size(300,200,IgnoreAspect);
-
-xlimits(-50,50);
-ylimits(0,100);
-
-xaxis(Label("$x$",MidPoint,red),Bottom,blue,LeftTicks(green));
-yaxis("$y$",Left,RightTicks);
-
-File: asy-faq.info, Node: Question 6.5, Next: Question 6.6, Previous: Question 6.4, Up: Section 6
-
-Question 6.5. How can I change the font type of the axes label?
-
-import graph;
-size(300,200,IgnoreAspect);
-
-xlimits(-50,50);
-ylimits(0,100);
-
-xaxis("x",Bottom,Courier("m","n"),LeftTicks);
-yaxis("$y$",Left,RightTicks);
-
-File: asy-faq.info, Node: Question 6.6, Next: Question 6.7, Previous: Question 6.5, Up: Section 6
-
-Question 6.6. How can I change the font type of the tick labels on an axis?
-
-Tick labels are by default typeset in (TeX) math mode, so to use other
-fonts you need to override the default tick format:
-
-import graph;
-size(300,200,IgnoreAspect);
-
-xlimits(-50,50);
-ylimits(0,100);
-
-xaxis("$x$",Bottom,LeftTicks("%.4g",Courier("m","n")+fontsize(12)));
-yaxis("$y$",Left,RightTicks);
-
-File: asy-faq.info, Node: Question 6.7, Next: Question 6.8, Previous: Question 6.6, Up: Section 6
-
-Question 6.7. How can I prevent axes tick labels from rendering on top of each other?
-
-Either:
-
-(i) give LeftTicks/RightTicks/Ticks the arguments beginlabel=false and/or
-endlabel=false;
-
-(ii) explicitly remove specific ticks and their labels (drawing them
-manually; see
-http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/base/graph.asy
-for the definition of NoZero):
-
-import graph;
-
-size(10cm);
-
-real f(real x) {return x^2;}
-
-draw(graph(f,-2,2));
-
-xaxis(Ticks(NoZero));
-yaxis(Ticks(NoZero));
-
-label("$0$",(0,0),SW);
-(iii) explicitly remove specific tick labels and draw them manually (see
-http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/base/graph.asy
-for the definition of NoZeroFormat):
-
-import graph;
-
-size(10cm);
-
-real f(real x) {return x^2;}
-
-draw(graph(f,-2,2));
-
-xaxis(Ticks(NoZeroFormat));
-yaxis(Ticks(NoZeroFormat));
-
-label("$0$",(0,0),SW);
-(iv) use the xasy GUI to move overlapping labels;
-
-(v) change the Label argument of LeftTicks, RightTicks, or Ticks to:
-
-Label(currentpen+overwrite(Move))
-Solution (v) will move labels that might otherwise overwrite a previous
-label. Other possible overwrite arguments are Allow (allows overlapping
-labels; the default), Suppress (an overlapping label will not be written
-at all), SuppressQuiet, and MoveQuiet. The last two achieve the same
-result as the non-quiet types, but will not notify you which labels are
-overlapping. See: http://asymptote.sourceforge.net/doc/Pens.html.
-
-In the case of a user-specified tick array, you can change which labels
-get suppressed/moved by changing the order of array entries.
-
-
-File: asy-faq.info, Node: Question 6.8, Next: Question 6.9, Previous: Question 6.7, Up: Section 6
-
-Question 6.8. How do I make the plot region of a graph, ignoring labels and legends, have a fixed size?
-
-Either:
-
-i) Specify an explicit unitsize, which overrides any call to size:
-unitsize(x=1cm,y=2cm);
-ii) Explicitly tell Asymptote to map the plot region to a specific size:
-import graph;
-real[] x={0,1,2,3};
-real[] y=x^2;
-draw(graph(x,y),red);
-xaxis("$x$",BottomTop,LeftTicks);
-yaxis("$y$",LeftRight,RightTicks);
-
-size(5cm,5cm,point(SW),point(NE));
-
-label("$f_\mathrm{T}$",point(N),2N);
-iii) Specify the points in user coordinates that should correspond to a
-given picture size:
-
-import graph;
-
-size(250,200,IgnoreAspect);
-
-draw(graph(exp,-1,1),red);
-
-xaxis("$x$",BottomTop,LeftTicks);
-yaxis("$y$",LeftRight,RightTicks);
-
-fixedscaling((-1.5,-0.5),(1.5,3.5));
-In this example, the user coordinate (-1.5,-0.5) will end up being the
-lower left corner of the figure and (1.5,3.5) will be the upper right
-corner. You can use this option to ensure multiple figures have the same
-scaling and same resulting figure size (just ensure the two coordinates
-given to fixedscaling() leaves room for any labels).
-
-See also http://asymptote.sourceforge.net/doc/Frames-and-pictures.html.
-
-
-File: asy-faq.info, Node: Question 6.9, Next: Question 6.10, Previous: Question 6.8, Up: Section 6
-
-Question 6.9. How can I plot a function f(x) within [0,1]x[0,2] without explicitly calculating the x values for which f(x) hits the boundary?
-
-Call limits with the Crop option before drawing the graph:
-import graph;
-
-size(250,200,IgnoreAspect);
-
-draw(graph(exp,-1,1),red);
-
-limits((0,0),(1,2),Crop);
-
-xaxis("$x$",BottomTop,LeftTicks);
-yaxis("$y$",LeftRight,RightTicks);
-See also http://asymptote.sourceforge.net/doc/graph.html.
-
-
-File: asy-faq.info, Node: Question 6.10, Next: Question 6.11, Previous: Question 6.9, Up: Section 6
-
-Question 6.10. Is it possible to define customized palettes?
-
-Yes, you may generate your own pen[] array. For example:
-
-int NColors=32768;
-pen[] MyPalette=new pen[NColors];
-real step=1/(NColors-1.0);
-// Start at black: rgb(0,0,0)
-// End at yellow: rgb(1,1,0)
-for(int i=0; i < NColors; ++i) {
- real rgval=i*step;
- MyPalette[i]=rgb(rgval,rgval,0.0);
-}
-
-File: asy-faq.info, Node: Question 6.11, Next: Question 6.12, Previous: Question 6.10, Up: Section 6
-
-Question 6.11. Is there an easy way to graph factorial functions nicely?
-
-The example below shows a continuous function and two methods for placing
-markers at integer values of x:
-
-import graph;
-
-size(200,200,IgnoreAspect);
-
-real factorial(real t) {return gamma(t+1);}
-
-scale(Linear,Log);
-
-// Graph the factorial function.
-draw(graph(factorial,0,10));
-
-// Method 1: Draw nodes, but hide line
-pair F(int t) {return (t,factorial(t));}
-// Graph of factorial function from 0 to 10
-pair[] z=sequence(F,11);
-draw(graph(z),invisible,marker(scale(0.8mm)*unitcircle,blue,Fill));
-
-// Method 2: Nongraphing routines require explicit scaling:
-pair dotloc(int t) {return Scale(F(t));}
-pair[] dotlocs=sequence(dotloc,11);
-dot(dotlocs);
-
-xaxis("$x$",BottomTop,LeftTicks);
-yaxis("$y$",LeftRight,RightTicks);
-
-File: asy-faq.info, Node: Question 6.12, Next: Question 6.13, Previous: Question 6.11, Up: Section 6
-
-Question 6.12. How do I indicate that a certain length should be exactly the size I prescribe with no rescaling, within a picture which has its own size?
-
-Here's an easy way to do this.
-
-size(12cm,0);
-
-void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0,
- pen p=currentpen)
-{
- real d=3mm;
- path g=A--B;
- transform T=shift(-n*d*unit(B-A)*I);
- pic.add(new void(frame f, transform t) {
- picture opic;
- path G=T*t*g;
- draw(opic,Label(L,Center,UnFill(1)),G,p,Arrows(NoFill),Bars,PenMargins);
- add(f,opic.fit());
- });
- pic.addBox(min(g),max(g),T*min(p),T*max(p));
-}
-
-pair A=(0,0), B=(3,3);
-
-dot(A);
-dot(B);
-
-distance(A,B,"$\ell$",1);
-
-File: asy-faq.info, Node: Question 6.13, Next: Question 6.14, Previous: Question 6.12, Up: Section 6
-
-Question 6.13. How can I make the y axis display base-2 logarithmic values?
-
-See the example http://asymptote.sourceforge.net/gallery/2D
-graphs/log2graph.asy.
-
-
-File: asy-faq.info, Node: Question 6.14, Next: Question 6.15, Previous: Question 6.13, Up: Section 6
-
-Question 6.14. How can I align the x axes of two graphs on the same figure?
-
-An easy way to do this, if the axes to be aligned have the same scaling
-and size, is illustrated in the example
-http://asymptote.sourceforge.net/gallery/2D graphs/alignedaxis.asy.
-
-Here is a more general solution to the problem of aligning two arbitrary
-axes. One fits the second picture to a frame based on the horizontal
-scaling for the first picture:
-
-import graph;
-
-real width=15cm;
-real aspect=0.3;
-
-picture pic1,pic2;
-
-size(pic1,width,aspect*width,IgnoreAspect);
-size(pic2,width,aspect*width,IgnoreAspect);
-
-scale(pic1,false);
-scale(pic2,false);
-
-real xmin1=6;
-real xmax1=9;
-real xmin2=8;
-real xmax2=16;
-
-real a1=1;
-real a2=0.001;
-
-real f1(real x) {return a1*sin(x/2*pi);}
-real f2(real x) {return a2*sin(x/4*pi);}
-
-draw(pic1,graph(pic1,f1,xmin1,xmax1));
-draw(pic2,graph(pic2,f2,xmin2,xmax2));
-
-xaxis(pic1,Bottom,LeftTicks());
-yaxis(pic1,"$f_1(x)$",Left,RightTicks);
-
-xaxis(pic2,"$x$",Bottom,LeftTicks(Step=4));
-yaxis(pic2,"$f_2(x)$",Left,RightTicks);
-
-yequals(pic1,0,Dotted);
-yequals(pic2,0,Dotted);
-
-pair min1=point(pic1,SW);
-pair max1=point(pic1,NE);
-
-pair min2=point(pic2,SW);
-pair max2=point(pic2,NE);
-
-real scale=(max1.x-min1.x)/(max2.x-min2.x);
-real shift=min1.x/scale-min2.x;
-
-transform t1=pic1.calculateTransform();
-transform t2=pic2.calculateTransform();
-transform T=xscale(scale*t1.xx)*yscale(t2.yy);
-
-add(pic1.fit());
-real height=truepoint(N,user=false).y-truepoint(S,user=false).y;
-add(shift(0,-height)*(shift(shift)*pic2).fit(T));
-
-File: asy-faq.info, Node: Question 6.15, Next: Question 6.16, Previous: Question 6.14, Up: Section 6
-
-Question 6.15. How can I change the direction of the y-axis, such that negatives values are on the upper y-axis?
-
-Here is a simple example (see also the example
-http://asymptote.sourceforge.net/gallery/2D graphs/diatom.asy or the
-discussion of Linear(-1) in the documentation):
-
-import graph;
-size(250,200,IgnoreAspect);
-
-scale(Linear,Linear(-1));
-
-draw(graph(log,0.1,10),red);
-
-xaxis("$x$",LeftTicks);
-yaxis("$y$",RightTicks);
-
-File: asy-faq.info, Node: Question 6.16, Next: Question 6.17, Previous: Question 6.15, Up: Section 6
-
-Question 6.16. How can I fill a path with a function that defines the color of each location?
-
-Use functionshade with a PDF tex engine, as illustrated by the example
-{functionshading.asy}.
-
-If you want to produce PostScript output, an approximate solution for now
-would be to superimpose a fine grid and specify colors to latticeshade
-that depend on position as a single pen[][] lattice. Alternatively, it may
-be more efficient to use tensorshade}.
-
-
-File: asy-faq.info, Node: Question 6.17, Next: Question 6.18, Previous: Question 6.16, Up: Section 6
-
-Question 6.17. Is there a way to draw a function that is not explicitly given, such as (y - 2)^2 = x - 1 ?
-
-Yes, use the parametric form
-
-y=t
-x=(t-2)^2+1
-See the example http://asymptote.sourceforge.net/gallery/2D
-graphs/parametricgraph.asy.
-
-
-File: asy-faq.info, Node: Question 6.18, Next: Question 6.19, Previous: Question 6.17, Up: Section 6
-
-Question 6.18. Is it possible to reverse or stretch an axis?
-
-The real scaling argument to Linear is used to stretch (or reverse) the
-axis. To see the effect of axis stretching, be sure not to specify
-IgnoreAspect in the picture size command.
-
-A secondary axis has the same length as the primary axis, so stretching
-cannot have any effect. But one can still reverse the axis, with
-Linear(-1).
-
-
-File: asy-faq.info, Node: Question 6.19, Next: Question 6.20, Previous: Question 6.18, Up: Section 6
-
-Question 6.19. Why can't I use the UnFill option to draw graphs with empty markers?
-
-UnFill won't work here because it only affects the local frame the markers
-are initially drawn on, before being added to currentpicture. Here is a
-way of achieving the desired effect (assuming a white background):
-
-import graph;
-size(10cm,0);
-pair[] z={(0,0),(0.5,0.5),(1,1)};
-path g=graph(z);
-
-draw(shift(0,.5)*g,marker(scale(5)*unitcircle,FillDraw(white)));
-
-xaxis(BottomTop,LeftTicks);
-yaxis(LeftRight,RightTicks);
-
-File: asy-faq.info, Node: Question 6.20, Next: Question 7.1, Previous: Question 6.19, Up: Section 6
-
-Question 6.20. How can I force several images to use the same palette range (e.g. the entire 0-255 grayscale range)?
-
-The palette color space corresponds to a range of values specified by the
-argument range, which can be Full, Automatic or an explicit range
-Range(pair min, pair max). Here Full} specifies a range varying from the
-minimum to maximum values of the function over the sampling interval,
-while Automatic selects "nice" limits.
-
-
-File: asy-faq.info, Node: Section 7, Next: Section 8, Previous: Section 6, Up: Top
-
-Questions about programming
-
-* Menu:
-* Question 7.1:: Is Asymptote an interpreter or a compiler?
-* Question 7.2:: What is the difference between a frame and a picture?
-* Question 7.3:: What is the difference between a path and a guide?
-* Question 7.4:: What is a convenient way to declare and initialize an
- array of pictures?
-* Question 7.5:: Is there a way to define functions that act on arrays
- in general (i.e. work for arrays of any type)?
-* Question 7.6:: Is there any way to declare structures ahead of their
- definition, e.g. where struct A performs some
- operation on struct B, but B contains an A member?
-* Question 7.7:: Where are static variables in for loops allocated?
-* Question 7.8:: Is there a debugger for asy?
-* Question 7.9:: Do you accept patches for Asymptote?
-
-
-
-File: asy-faq.info, Node: Question 7.1, Next: Question 7.2, Previous: Question 6.20, Up: Section 7
-
-Question 7.1. Is Asymptote an interpreter or a compiler?
-
-Asymptote compiles Asymptote commands into its own virtual machine code.
-It then runs this pseudocode on a virtual machine to produce PostScript
-code.
-
-
-File: asy-faq.info, Node: Question 7.2, Next: Question 7.3, Previous: Question 7.1, Up: Section 7
-
-Question 7.2. What is the difference between a frame and a picture?
-
-Frames are canvases for drawing in PostScript coordinates. While working
-with frames directly is occasionally necessary for constructing deferred
-drawing routines, pictures are usually more convenient to work with. See
-*Note Question 8.8:: `In MetaPost, it is possible to have a drawing remain
-the same size in different pictures by defining a unit u and explicitly
-multiply all the coordinates by u. Is there a better way to do this in
-Asymptote?'.
-
-
-File: asy-faq.info, Node: Question 7.3, Next: Question 7.4, Previous: Question 7.2, Up: Section 7
-
-Question 7.3. What is the difference between a path and a guide?
-
-A path is a cubic spline with fixed endpoint conditions.
-
-A guide is an unresolved cubic spline (list of cubic-spline nodes and
-control points). A guide is like a path except that the computation of the
-cubic spline is deferred until drawing time (when it is resolved into a
-path); this allows two guides with free endpoint conditions to be joined
-together smoothly.
-
-
-File: asy-faq.info, Node: Question 7.4, Next: Question 7.5, Previous: Question 7.3, Up: Section 7
-
-Question 7.4. What is a convenient way to declare and initialize an array of pictures?
-
-You could write yourself a routine such as:
-picture[] picture(int n) {
- picture[] pic;
- for(int i=0; i < n; ++i) {
- pic[i]=new picture;
- size(pic[i],19cm,0);
- }
- return pic;
-}
-
-picture[] pic=picture(6);
-
-File: asy-faq.info, Node: Question 7.5, Next: Question 7.6, Previous: Question 7.4, Up: Section 7
-
-Question 7.5. Is there a way to define functions that act on arrays in general (i.e. work for arrays of any type)?
-
-Generic types aren't yet implemented.
-
-But for now you can at least say
-typedef string T;
-include F;
-
-typedef real T;
-include F;
-where F.asy contains some type-dependent code like
-T[] operator $(T A, T B) {return new T[] {A,B};}
-
-File: asy-faq.info, Node: Question 7.6, Next: Question 7.7, Previous: Question 7.5, Up: Section 7
-
-Question 7.6. Is there any way to declare structures ahead of their definition, e.g. where struct A performs some operation on struct B, but B contains an A member?
-
-Asymptote does not support forward declaration of types. You can, however,
-nest structures, so that both types are visible for parts of the bodies of
-both structure definitions. For example:
-
-struct B {
- typedef void someroutine(B b);
-
- static struct A {
- someroutine routine;
- void operator init(someroutine routine) {
- this.routine=routine;
- }
- }
-
- string test="Testing";
-}
-
-typedef B.A A;
-
-A a=B.A(new void(B b){write(b.test);});
-
-B b;
-a.routine(b);
-
-File: asy-faq.info, Node: Question 7.7, Next: Question 7.8, Previous: Question 7.6, Up: Section 7
-
-Question 7.7. Where are static variables in for loops allocated?
-
-In the example
-
-void f() {
- for(int i=0; i < 3; ++i) {
- static int n;
- ++n;
- write(n);
- }
-}
-
-f(); // Writes 1, 2, 3
-the static qualifier means that n is allocated not just outside of the for
-loop, but also outside the function. This is clear if you call f multiple
-times; there is still only one instance of n.
-
-The "level" of a variable (where it is allocated) has nothing to do with
-the "scope" of a variable (how long it can be referred to by name). The
-curly braces enclosing a block affect only a variable's scope, not its
-level.
-
-Static modifiers are meaningless at the top level; they generate a warning
-and are simply ignored:
-
-for(int i=0; i < 3; ++i) {
- static int n;
- ++n;
- write(n);
-}
-// Writes warning about top-level static modifier and then 1, 1, 1
-Since version 1.22, non-static variables allocated in a loop body are
-allocated anew every iteration. This is only noticable in obscure cases
-where a variable in a loop is accessed in the closure of a function
-defined in the loop:
-
-int f();
-
-for(int i=0; i < 10; ++i) {
- int j=10*i;
- if(i == 5)
- f=new int() {return j;};
-}
-
-write(f()); // Writes 50
-Variables in the body of a loop last as long as that iteration of the
-loop, unless they are kept alive by a function closure as in the example
-above. In a function body, variables will last at least as long as the
-function call, though because of closures and garbage collection, they may
-last longer than that. If defined at the top level of a file or at the
-interactive prompt, they will last at least until the end of the file or
-prompt's run.
-
-
-File: asy-faq.info, Node: Question 7.8, Next: Question 7.9, Previous: Question 7.7, Up: Section 7
-
-Question 7.8. Is there a debugger for asy?
-
-Yes, Asymptote includes a line-based debugger:
-
-http://asymptote.sourceforge.net/doc/Debugger.html
-
-
-File: asy-faq.info, Node: Question 7.9, Next: Question 8.1, Previous: Question 7.8, Up: Section 7
-
-Question 7.9. Do you accept patches for Asymptote?
-
-Yes, in fact we would prefer that users submit patches for customized
-features (to http://sourceforge.net/tracker/?atid=685685&group_id=120000)
-instead of relying on us to do all of the coding. Development will proceed
-faster that way.
-
-
-File: asy-faq.info, Node: Section 8, Next: Section 9, Previous: Section 7, Up: Top
-
-Questions about differences between Asymptote and MetaPost
-
-* Menu:
-* Question 8.1:: What is the equivalent of the MetaPost c[a,b]
- interpolation operator?
-* Question 8.2:: How does picture scaling differ in Asymptote and
- MetaPost?
-* Question 8.3:: How can I avoid automatic scaling of a picture?
-* Question 8.4:: What is the equivalent of MetaPost ... command?
-* Question 8.5:: What is the equivalent of the MetaPost pickup command?
-* Question 8.6:: What is the equivalent of the MetaPost whatever
- command?
-* Question 8.7:: What is the equivalent for the MetaPost command for
- lray - horiz*v - verti*u = whatever*(LightSource - R),
- a system of three linear equations for three unknowns:
- horiz, verti, whatever?
-* Question 8.8:: In MetaPost, it is possible to have a drawing remain
- the same size in different pictures by defining a unit
- u and explicitly multiply all the coordinates by u. Is
- there a better way to do this in Asymptote?
-* Question 8.9:: In MetaPost, one could produce tiling pictures by
- generating a picture, and then clipping the picture to
- a rectangle of fixed dimensions around the center of
- the picture. How is that done in Asymptote?
-
-
-
-File: asy-faq.info, Node: Question 8.1, Next: Question 8.2, Previous: Question 7.9, Up: Section 8
-
-Question 8.1. What is the equivalent of the MetaPost c[a,b] interpolation operator?
-
-interp(a,b,c);
-
-File: asy-faq.info, Node: Question 8.2, Next: Question 8.3, Previous: Question 8.1, Up: Section 8
-
-Question 8.2. How does picture scaling differ in Asymptote and MetaPost?
-
-Asymptote includes an optional facility to do automatic scaling of
-pictures to achieve a given overall picture size, whereas Metapost only
-supports manual scaling. Asymptote defers drawing of objects drawn to
-pictures and distinguishes between true-size objects and objects that
-should scale with the picture size. The resulting linear programming
-problem is solved via the Simplex method.
-
-See the http://asymptote.sourceforge.net/gallery/dimension.asy example for
-an example of how deferred drawing is used to accomodate both user and
-true-size (PostScript) coordinates.
-
-
-File: asy-faq.info, Node: Question 8.3, Next: Question 8.4, Previous: Question 8.2, Up: Section 8
-
-Question 8.3. How can I avoid automatic scaling of a picture?
-
-If you really like Metapost-style manual (hard-wired) scaling either:
-
-(i) use the default size(0,0) for the entire picture and do all of the
-scaling by hand, just like in MetaPost;
-
-(ii) draw to a separate picture pic and add(pic.fit());
-
-(iii) use frames.
-
-
-File: asy-faq.info, Node: Question 8.4, Next: Question 8.5, Previous: Question 8.3, Up: Section 8
-
-Question 8.4. What is the equivalent of MetaPost ... command?
-
-The connector :: is a macro for tension atleast 1:
-
-size(100);
-pair z0=(0,0);
-pair z1=(1,0.25);
-pair z2=(2,0);
-draw(z0{up}::z1{right}::z2{down});
-
-File: asy-faq.info, Node: Question 8.5, Next: Question 8.6, Previous: Question 8.4, Up: Section 8
-
-Question 8.5. What is the equivalent of the MetaPost pickup command?
-
-Just say, for example:
-
-currentpen=red;
-
-File: asy-faq.info, Node: Question 8.6, Next: Question 8.7, Previous: Question 8.5, Up: Section 8
-
-Question 8.6. What is the equivalent of the MetaPost whatever command?
-
-Asymptote does not implicitly solve linear equations and therefore does
-not have the notion of a whatever unknown. Such a facility could certainly
-be added (perhaps using the notation ?= since = means assignment).
-However, the most common uses of whatever in MetaPost are covered by
-functions like extension in math.asy:
-pair extension(pair P, pair Q, pair p, pair q);
-this returns the intersection point of the extensions of the line segments
-PQ and pq. We find using routines like extension more explicit and less
-confusing to new users. But we could be persuaded to add something similar
-if someone can justify the need. In the meantime, one can always use the
-explicit built-in linear solver solve (see
-http://asymptote.sourceforge.net/doc/solve.html), which uses LU
-decomposition.
-
-
-File: asy-faq.info, Node: Question 8.7, Next: Question 8.8, Previous: Question 8.6, Up: Section 8
-
-Question 8.7. What is the equivalent for the MetaPost command for lray - horiz*v - verti*u = whatever*(LightSource - R), a system of three linear equations for three unknowns: horiz, verti, whatever?
-
-Since horiz*v+verti*u spans a plane, you could use
-real intersect(vector P, vector Q, vector n, vector Z);
-to find the intersection time for the line lray-whatever*(LightSource -
-R) and then extract the three desired values from there. (You'll still
-need to use the built-in explicit linear solver to solve a 2x2 system to
-get horiz and verti.)
-
-
-File: asy-faq.info, Node: Question 8.8, Next: Question 8.9, Previous: Question 8.7, Up: Section 8
-
-Question 8.8. In MetaPost, it is possible to have a drawing remain the same size in different pictures by defining a unit u and explicitly multiply all the coordinates by u. Is there a better way to do this in Asymptote?
-
-Yes, Asymptote has a better way: you definitely don't want to manually
-scale all of your coordinates. To make the user coordinates represent
-multiples of exactly 1cm:
-
-unitsize(1cm);
-draw(unitsquare);
-One can also specify different x and y unit sizes:
-
-unitsize(x=1cm,y=2cm);
-draw(unitsquare);
-Another way is to draw your fixed size object to a frame and add it to
-currentpicture like this:
-
-path p=(0,0)--(1,0);
-frame object;
-draw(object,scale(100)*p);
-
-add(object);
-add(object,(0,-10));
-To understand the difference between frames and pictures, try this:
-
-size(300,300);
-
-path p=(0,0)--(1,0);
-picture object;
-draw(object,scale(100)*p);
-
-add(object);
-add(object,(0,-10)); // Adds truesize object to currentpicture
-
-File: asy-faq.info, Node: Question 8.9, Next: Question 9.1, Previous: Question 8.8, Up: Section 8
-
-Question 8.9. In MetaPost, one could produce tiling pictures by generating a picture, and then clipping the picture to a rectangle of fixed dimensions around the center of the picture. How is that done in Asymptote?
-
-If you are using currentpicture the way one would in MetaPost (drawing in
-raw PostScript coordinates), you can simply do something like:
-
-fill((0,0)--(100,100)--(200,0)--cycle);
-
-pair center(picture pic=currentpicture) {return 0.5*(pic.min()+pic.max());}
-
-real height=100;
-real width=100;
-pair delta=0.5(width,height);
-pair c=center();
-clip(box(c-delta,c+delta));
-However, drawing in PostScript coordinates is often inconvenient. Here's
-the Asymptote way of doing the same thing, using deferred drawing:
-
-size(200,100);
-fill((0,0)--(1,1)--(2,0)--cycle);
-
-void clip(picture pic=currentpicture, real width, real height)
-{
- pic.clip(new void (frame f, transform) {
- pair center=0.5(min(f)+max(f));
- pair delta=0.5(width,height);
- clip(f,box(center-delta,center+delta));
- });
-}
-
-clip(100,100);
-See also the discussion of tilings in the documentation:
-http://asymptote.sourceforge.net/doc/Pens.html.
-
-
-File: asy-faq.info, Node: Section 9, Previous: Section 8, Up: Top
-
-Questions about output
-
-* Menu:
-* Question 9.1:: How can I disable automatic invocation of the PS
- viewer after an asy file is done processing?
-* Question 9.2:: How do I output jpeg images?
-* Question 9.3:: Can I embed bitmaps (photos) into my drawings and
- position and scale them?
-* Question 9.4:: Does Asymptote support direct PDF output?
-* Question 9.5:: How to I produce large pictures of high quality in
- raster format (e.g. png, giff etc).
-* Question 9.6:: Is it possible to produce multi-page documents with
- asymptote?
-
-
-
-File: asy-faq.info, Node: Question 9.1, Next: Question 9.2, Previous: Question 8.9, Up: Section 9
-
-Question 9.1. How can I disable automatic invocation of the PS viewer after an asy file is done processing?
-
-It's actually not on by default, unless you happen to be using Microsoft
-Windows (because that is what most Microsoft Windows users expect).
-Microsoft Windows users can turn this feature off with the command-line
-option -noV or by putting
-
-import settings;
-interactiveView=false;
-batchView=false;
-in their config.asy file. See
-http://asymptote.sourceforge.net/doc/Options.html.
-
-
-File: asy-faq.info, Node: Question 9.2, Next: Question 9.3, Previous: Question 9.1, Up: Section 9
-
-Question 9.2. How do I output jpeg images?
-
-If you have the ImageMagick convert program installed, simply type
-
-asy -f jpg test.asy
-
-File: asy-faq.info, Node: Question 9.3, Next: Question 9.4, Previous: Question 9.2, Up: Section 9
-
-Question 9.3. Can I embed bitmaps (photos) into my drawings and position and scale them?
-
-Convert them to eps format and use the graphic(string) function just like
-a Label:
-
-label(graphic("file"),(0,0));
-See the example http://asymptote.sourceforge.net/gallery/orthocenter.asy
-and http://asymptote.sourceforge.net/doc/label.html.
-
-
-File: asy-faq.info, Node: Question 9.4, Next: Question 9.5, Previous: Question 9.3, Up: Section 9
-
-Question 9.4. Does Asymptote support direct PDF output?
-
-Yes, PDF output can be produced by the -f pdf option or -tex pdflatex
-option. This supports transparency, annotations, embedded movies, and
-U3D/PRC content.
-
-
-File: asy-faq.info, Node: Question 9.5, Next: Question 9.6, Previous: Question 9.4, Up: Section 9
-
-Question 9.5. How to I produce large pictures of high quality in raster format (e.g. png, giff etc).
-
-Try using some of the options to convert, mainly -geometry and -density.
-For example:
-convert -geometry 1000x3000 example.eps example.png
-You can also change the default resolution of the image with:
-convert -geometry 1000x3000 -density 300 -units PixelsPerInch example.eps example.png
-This does not change the number of pixels in the image, but just gives a
-hint as to how large each pixel should be displayed.
-
-If you include the -density option without the -geometry option, convert
-will keep the image size constant (so a 4cm x 3cm eps figure will
-generate a 4cm x 3cm png image).
-
-
-File: asy-faq.info, Node: Question 9.6, Previous: Question 9.5, Up: Section 9
-
-Question 9.6. Is it possible to produce multi-page documents with asymptote?
-
-Yes, simply call the newpage() function. This is used by the slide.asy
-package to produce high-quality slide presentations (easier to use than
-Prosper).
-
diff --git a/Build/source/utils/asymptote/doc/FAQ/install-sh b/Build/source/utils/asymptote/doc/FAQ/install-sh
index 04367377519..6781b987bdb 100755
--- a/Build/source/utils/asymptote/doc/FAQ/install-sh
+++ b/Build/source/utils/asymptote/doc/FAQ/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2013-10-30.23; # UTC
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,21 +35,25 @@ scriptversion=2013-10-30.23; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
+# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
-tab=' '
nl='
'
-IFS=" $tab$nl"
+IFS=" "" $nl"
-# Set DOITPROG to "echo" to test this script.
+# set DOITPROG to echo to test this script
+# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-doit_exec=${doit:-exec}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -64,6 +68,17 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
posix_mkdir=
# Desired mode of installed file.
@@ -122,39 +137,36 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
+ shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
@@ -174,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
done
fi
@@ -186,17 +194,13 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call 'install-sh -d' without argument.
+ # It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
- do_exit='(exit $ret); exit $ret'
- trap "ret=129; $do_exit" 1
- trap "ret=130; $do_exit" 2
- trap "ret=141; $do_exit" 13
- trap "ret=143; $do_exit" 15
+ trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@@ -207,16 +211,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -224,9 +228,9 @@ fi
for src
do
- # Protect names problematic for 'test' and other utilities.
+ # Protect names starting with `-'.
case $src in
- -* | [=\(\)!]) src=./$src;;
+ -*) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -248,20 +252,51 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
+
dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
- dstdir=`dirname "$dst"`
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
test -d "$dstdir"
dstdir_status=$?
fi
@@ -272,74 +307,74 @@ do
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
@@ -349,51 +384,53 @@ do
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
esac
+ eval "$initialize_posix_glob"
+
oIFS=$IFS
IFS=/
- set -f
+ $posix_glob set -f
set fnord $dstdir
shift
- set +f
+ $posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
- test X"$d" = X && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -428,12 +465,15 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
- set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- set +f &&
+ $posix_glob set +f &&
+
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -446,24 +486,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
diff --git a/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf b/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf
deleted file mode 100755
index 9abdc656892..00000000000
--- a/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf
+++ /dev/null
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asy-latex.pdf b/Build/source/utils/asymptote/doc/asy-latex.pdf
deleted file mode 100755
index a91f302ce02..00000000000
--- a/Build/source/utils/asymptote/doc/asy-latex.pdf
+++ /dev/null
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asy.1 b/Build/source/utils/asymptote/doc/asy.1
deleted file mode 100755
index 979fd50ee38..00000000000
--- a/Build/source/utils/asymptote/doc/asy.1
+++ /dev/null
@@ -1,297 +0,0 @@
-.\" Hey, EMACS: -*- nroff -*-
-.TH ASY 1 "1 Dec 2004"
-.SH NAME
-asy \- Asymptote: a script-based vector graphics language
-.SH SYNOPSIS
-.B asy
-.RI [ options ]
-.RI [ file \ ...]
-.SH DESCRIPTION
-\fBAsymptote\fP is a powerful descriptive vector graphics language for
-technical drawings, inspired by MetaPost but with an improved C++-like syntax.
-Asymptote provides for figures the same high-quality level of typesetting that
-LaTeX does for scientific text.
-.SH OPTIONS
-If no arguments are given, Asymptote runs in interactive mode.
-.PP
-If "\-" is given as the file argument, Asymptote reads from standard input.
-.PP
-A summary of options is included below. The effect of most options
-can be negated by prepending
-.B no
-to the option name.
-Default values for most options may also be entered in the
-file
-.B .asy/config.asy
-in the user's home directory using the long form:
-.PP
- import settings;
- batchView=true;
-.PP
-For a complete
-description, see the Info files.
-.TP
-.B \-V,\-View
-View output; command-line only.
-.TP
-.B \-a,\-align C|B|T|Z
-Center, Bottom, Top, or Zero page alignment [C].
-.TP
-.B \-antialias n
-Antialiasing width for rasterized output [2].
-.TP
-.B \-arcballradius pixels
-Arcball radius [750].
-.TP
-.B \-auto3D
-Automatically activate 3D scene [true].
-.TP
-.B \-autobillboard
-3D labels always face viewer by default [true].
-.TP
-.B \-autoimport string
-Module to automatically import.
-.TP
-.B \-autoplain
-Enable automatic importing of plain [true].
-.TP
-.B \-autoplay
-Autoplay 3D animations [false].
-.TP
-.B \-autorotate
-Enable automatic PDF page rotation [false].
-.TP
-.B \-axes3
-Show 3D axes in PDF output [true].
-.TP
-.B \-batchMask
-Mask fpu exceptions in batch mode [false].
-.TP
-.B \-batchView
-View output in batch mode [false].
-.TP
-.B \-bw
-Convert all colors to black and white [false].
-.TP
-.B \-cd directory
-Set current directory; command-line only.
-.TP
-.B \-cmyk
-Convert rgb colors to cmyk [false].
-.TP
-.B \-c,\-command string
-Command to autoexecute.
-.TP
-.B \-compact
-Conserve memory at the expense of speed [false].
-.TP
-.B \-d,\-debug
-Enable debugging messages [false].
-.TP
-.B \-divisor n
-Garbage collect using purge(divisor=n) [2].
-.TP
-.B \-doubleclick ms
-Emulated double-click timeout [200].
-.TP
-.B \-embed
-Embed rendered preview image [true].
-.TP
-.B \-exitonEOF
-Exit interactive mode on EOF [true].
-.TP
-.B \-fitscreen
-Fit rendered image to screen [true].
-.TP
-.B \-framedelay ms
-Additional frame delay [0].
-.TP
-.B \-framerate frames/s
-Animation speed [30].
-.TP
-.B \-globalwrite
-Allow write to other directory [false].
-.TP
-.B \-gray
-Convert all colors to grayscale [false].
-.TP
-.B \-h,\-help
-Show summary of options; command-line only.
-.TP
-.B \-historylines n
-Retain n lines of history [1000].
-.TP
-.B \-iconify
-Iconify rendering window [false].
-.TP
-.B \-inlineimage
-Generate inline embedded image [false].
-.TP
-.B \-inlinetex
-Generate inline TeX code [false].
-.TP
-.B \-interactiveMask
-Mask fpu exceptions in interactive mode [true].
-.TP
-.B \-interactiveView
-View output in interactive mode [true].
-.TP
-.B \-interactiveWrite
-Write expressions entered at the prompt to stdout [true].
-.TP
-.B \-k,\-keep
-Keep intermediate files [false].
-.TP
-.B \-keepaux
-Keep intermediate LaTeX .aux files [false].
-.TP
-.B \-level n
-Postscript level [3].
-.TP
-.B \-l,\-listvariables
-List available global functions and variables [false].
-.TP
-.B \-localhistory
-Use a local interactive history file [false].
-.TP
-.B \-loop
-Loop 3D animations [false].
-.TP
-.B \-m,\-mask
-Mask fpu exceptions; command-line only.
-.TP
-.B \-maxtile pair
-Maximum rendering tile size [(1024,768)].
-.TP
-.B \-maxviewport pair
-Maximum viewport size [(2048,2048)].
-.TP
-.B \-multiline
-Input code over multiple lines at the prompt [false].
-.TP
-.B \-multipleView
-View output from multiple batch-mode files [false].
-.TP
-.B \-multisample n
-Multisampling width for screen images [4].
-.TP
-.B \-offscreen
-Use offscreen rendering [false].
-.TP
-.B \-O,\-offset pair
-PostScript offset [(0,0)].
-.TP
-.B \-f,\-outformat format
-Convert each output file to specified format.
-.TP
-.B \-o,\-outname name
-Alternative output directory/filename.
-.TP
-.B \-p,\-parseonly
-Parse file [false].
-.TP
-.B \-pdfreload
-Automatically reload document in pdfviewer [false].
-.TP
-.B \-pdfreloaddelay usec
-Delay before attempting initial pdf reload [750000].
-.TP
-.B \-position pair
-Initial 3D rendering screen position [(0,0)].
-.TP
-.B \-prc
-Embed 3D PRC graphics in PDF output [true].
-.TP
-.B \-prompt string
-Prompt [> ].
-.TP
-.B \-prompt2 string
-Continuation prompt for multiline input [..].
-.TP
-.B \-q,\-quiet
-Suppress welcome message [false].
-.TP
-.B \-render n
-Render 3D graphics using n pixels per bp (-1=auto) [-1].
-.TP
-.B \-resizestep step
-Resize step [1.2].
-.TP
-.B \-reverse
-reverse 3D animations [false].
-.TP
-.B \-rgb
-Convert cmyk colors to rgb [false].
-.TP
-.B \-safe
-Disable system call [true].
-.TP
-.B \-scroll n
-Scroll standard output n lines at a time [0].
-.TP
-.B \-spinstep deg/s
-Spin speed [60].
-.TP
-.B \-svgemulation
-Emulate unimplemented SVG shading [false].
-.TP
-.B \-tabcompletion
-Interactive prompt auto-completion [true].
-.TP
-.B \-tex engine
-latex|pdflatex|xelatex|tex|pdftex|context|none [latex].
-.TP
-.B \-thick
-Render thick 3D lines [true].
-.TP
-.B \-thin
-Render thin 3D lines [true].
-.TP
-.B \-threads
-Use POSIX threads for 3D rendering [true].
-.TP
-.B \-toolbar
-Show 3D toolbar in PDF output [true].
-.TP
-.B \-s,\-translate
-Show translated virtual machine code [false].
-.TP
-.B \-twice
-Run LaTeX twice (to resolve references) [false].
-.TP
-.B \-twosided
-Use two-sided 3D lighting model for rendering [true].
-.TP
-.B \-u,\-user string
-General purpose user string.
-.TP
-.B \-v,\-verbose
-Increase verbosity level (can specify multiple times) [0].
-.TP
-.B \-version
-Show version; command-line only.
-.TP
-.B \-wait
-Wait for child processes to finish before exiting [false].
-.TP
-.B \-warn string
-Enable warning; command-line only.
-.TP
-.B \-where
-Show where listed variables are declared [false].
-.TP
-.B \-zoomfactor factor
-Zoom step factor [1.05].
-.TP
-.B \-zoomstep step
-Mouse motion zoom step [0.1].
-
-.SH SEE ALSO
-Asymptote is documented fully in the asymptote Info page.
-The manual can also be accessed in interactive mode with the "help" command.
-
-.SH AUTHOR
-Asymptote was written by Andy Hammerlindl, John Bowman, and Tom Prince.
-.PP
-This manual page was written by Hubert Chan for the Debian project (but may
-be used by others).
diff --git a/Build/source/utils/asymptote/doc/asyRefCard.pdf b/Build/source/utils/asymptote/doc/asyRefCard.pdf
deleted file mode 100644
index 549deab1579..00000000000
--- a/Build/source/utils/asymptote/doc/asyRefCard.pdf
+++ /dev/null
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf
deleted file mode 100644
index fc83a4c44a6..00000000000
--- a/Build/source/utils/asymptote/doc/asymptote.pdf
+++ /dev/null
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi
index ff038453b10..9fabe5d813d 100644
--- a/Build/source/utils/asymptote/doc/asymptote.texi
+++ b/Build/source/utils/asymptote/doc/asymptote.texi
@@ -9,7 +9,7 @@ This file documents @code{Asymptote}, version @value{VERSION}.
@url{http://asymptote.sourceforge.net}
-Copyright @copyright{} 2004-13 Andy Hammerlindl, John Bowman, and Tom Prince.
+Copyright @copyright{} 2004-14 Andy Hammerlindl, John Bowman, and Tom Prince.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -89,7 +89,7 @@ Drawing commands
Programming
* Data types:: void, bool, int, real, pair, triple, string
-* Paths and guides::
+* Paths and guides:: Bezier curves
* Pens:: Colors, line types, line widths, font sizes
* Transforms:: Affine transforms
* Frames and pictures:: Canvases for immediate and deferred drawing
@@ -289,7 +289,7 @@ We recommend subscribing to new release announcements at
@noindent
Users may also wish to monitor the @code{Asymptote} forum:
@quotation
-@url{http://sourceforge.net/projects/asymptote/forums/forum/409349}
+@url{http://sourceforge.net/p/asymptote/discussion/409349}
@end quotation
@noindent
@@ -491,6 +491,7 @@ configuration variables @code{paperwidth} and @code{paperheight}.
@cindex @code{texcommand}
@cindex @code{dvips}
@cindex @code{dvisvgm}
+@cindex @code{libgs}
@cindex @code{convert}
@cindex @code{display}
@cindex @code{animate}
@@ -501,6 +502,7 @@ texpath
texcommand
dvips
dvisvgm
+libgs
convert
display
animate
@@ -584,7 +586,8 @@ cd asymptote-x.xx
@end verbatim
By default the system version of the Boehm garbage collector will be
used; if it is old we recommend first putting
-@url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2d.tar.gz}
+@url{http://hboehm.info/gc/gc_source/gc-7.4.0.tar.gz}
+@url{http://hboehm.info/gc/gc_source/libatomic_ops-7.4.0.tar.gz}
in the @code{Asymptote} source directory.
On @code{UNIX} platforms (other than @code{MacOS X}), we recommend
@@ -739,7 +742,7 @@ can be enabled by running @code{asy-kate.sh} in the
The following commands are needed to install the latest development version of
@code{Asymptote} using @code{Subversion}:
@verbatim
-svn co http://asymptote.svn.sourceforge.net/svnroot/asymptote/trunk/asymptote
+svn co http://svn.code.sf.net/p/asymptote/code/trunk/asymptote
cd asymptote
./autogen.sh
./configure
@@ -974,10 +977,11 @@ external links posted at @url{http://asymptote.sourceforge.net}) for
further examples, including two-dimensional and interactive
three-dimensional scientific graphs. Additional examples have been
posted by Philippe Ivaldi at @url{http://www.piprime.fr/asymptote}.
-A user-written @code{Asymptote} tutorial is available at
-@verbatim
-http://www.artofproblemsolving.com/Wiki/index.php/Asymptote:_Basics
-@end verbatim
+Excellent user-written @code{Asymptote} tutorials are also available:
+
+@url{http://www.artofproblemsolving.com/Wiki/index.php/Asymptote:_Basics}
+
+@url{http://math.uchicago.edu/~cstaats/Charles_Staats_III/Notes_and_papers_files/asymptote_tutorial.pdf}
@node Drawing commands
@chapter Drawing commands
@@ -1329,7 +1333,7 @@ using the vertex colors specified in the @math{n \times 4} pen array
@code{p} and internal control points in the @math{n \times 4}
array @code{z}, is implemented with
@verbatim
-void tensorshade(picture pic=currentpicture, path g, bool stroke=false,
+void tensorshade(picture pic=currentpicture, path[] g, bool stroke=false,
pen fillrule=currentpen, pen[][] p, path[] b=g,
pair[][] z=new pair[][]);
@end verbatim
@@ -1737,7 +1741,7 @@ In addition, it supports many features beyond the ones found in those languages.
@menu
* Data types:: void, bool, int, real, pair, triple, string
-* Paths and guides::
+* Paths and guides:: Bezier curves
* Pens:: Colors, line types, line widths, font sizes
* Transforms:: Affine transforms
* Frames and pictures:: Canvases for immediate and deferred drawing
@@ -2283,6 +2287,12 @@ path ellipse(pair c, real a, real b)
}
@end verbatim
+A brace can be constructed between pairs @code{a} and @code{b} with
+@cindex @code{brace}
+@verbatim
+path brace(pair a, pair b, real amplitude=bracedefaultratio*length(b-a));
+@end verbatim
+
This example illustrates the use of all five guide connectors discussed
in @ref{Tutorial} and @ref{Bezier curves}:
@verbatiminclude join.asy
@@ -2565,6 +2575,16 @@ otherwise.
returns an arbitrary point strictly inside a cyclic path @code{p}
according to the fill rule @code{fillrule} (@pxref{fillrule}).
+@cindex @code{side}
+@item real side(pair a, pair b, pair c);
+determines the side of @code{a--b} that c lies on (negative=left,
+zero=on @code{a--b}, positive=right).
+
+@cindex @code{incircle}
+@item real incircle(pair a, pair b, pair c, pair d);
+determines the side of the counterclockwise circle through @code{a,b,c} that
+@code{d} lies on (negative=inside, 0=on circle, positive=right).
+
@cindex @code{strokepath}
@item path[] strokepath(path g, pen p=currentpen);
returns the path array that @code{PostScript} would fill in drawing path
@@ -4023,7 +4043,7 @@ struct T {
int x;
}
-T foo=new T;
+T foo;
T bar=foo;
bar.x=5;
@end verbatim
@@ -4044,7 +4064,7 @@ struct T {
++Tcount;
}
-T foo=new T;
+T foo;
@end verbatim
Here, the expression @code{new T} will produce a new instance of the class, but
@@ -4111,7 +4131,7 @@ struct Person {
string lastname;
}
-Person joe=new Person;
+Person joe;
joe.firstname="Joe";
joe.lastname="Jones";
@end verbatim
@@ -4128,7 +4148,7 @@ struct Person {
string lastname;
static Person Person(string firstname, string lastname) {
- Person p=new Person;
+ Person p;
p.firstname=firstname;
p.lastname=lastname;
return p;
@@ -4164,7 +4184,7 @@ structure is called @code{Foo}):
@example
static Foo Foo(@var{args}) @{
- Foo instance=new Foo;
+ Foo instance;
instance.operator init(@var{args});
return instance;
@}
@@ -5441,7 +5461,7 @@ The virtual members @code{dimension}, @code{line}, @code{csv},
@code{word}, and @code{read} of a file are useful for reading arrays.
@cindex @code{line}
For example, if line mode is set with @code{file line(bool b=true)}, then
-reading will stop once the end of the line is reached instead
+reading will stop once the end of the line is reached instead:
@verbatim
file fin=input("test.txt");
real[] A=fin.line();
@@ -6468,7 +6488,6 @@ This module provides an interface to the @code{LaTeX} package
@end quotation
@noindent
for embedding movies, sounds, and 3D objects into a @acronym{PDF} document.
-Version 0.13 (2012/09/12) of @code{media9} or later is required.
@cindex @code{external}
A more portable method for embedding movie files, which should work on any
@@ -7861,7 +7880,7 @@ In addition to the default @code{settings.prc=true}, this requires
@code{settings.outformat="pdf"}, which can be specified by the command
line option @code{-f pdf}, put in the @code{Asymptote} configuration
file (@pxref{configuration file}), or specified in the script before
-@code{three.asy} (or @code{graph3.asy}) is imported.
+@code{three.asy} (or @code{graph3.asy}) is imported.
The @code{media9} LaTeX package is also required (@pxref{embed}).
The example @code{pdb.asy} illustrates
how one can generate a list of predefined views (see @code{100d.views}).
@@ -7872,6 +7891,8 @@ file @code{externalprc.tex} illustrates how the resulting @acronym{PRC} and
rendered image files can be extracted and processed in a separate
@code{LaTeX} file. However, see @ref{LaTeX usage} for an easier way
to embed three-dimensional @code{Asymptote} pictures within @code{LaTeX}.
+For specialized applications where only the raw @acronym{PRC} file is
+required, specify @code{settings.outformat="prc"}.
The open-source @acronym{PRC} specification is available from
@url{http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/API_References/PRCReference/PRC_Format_Specification/}.
@@ -8288,7 +8309,7 @@ real[][] intersections(path3 p, surface s, real fuzz=-1);
@end verbatim
@noindent
returns the intersection times of a path @code{p} with a surface
-@code{s} as a sorted array of real arrays of length 2, and
+@code{s} as a sorted array of real arrays of length 3, and
@cindex @code{intersectionpoints}
@verbatim
triple[] intersectionpoints(path3 p, surface s, real fuzz=-1);
@@ -9008,13 +9029,13 @@ variables may also be changed at runtime.
@cindex @code{gsOptions}
@cindex @code{psviewerOptions}
@cindex @code{pdfviewerOptions}
+@cindex @code{pdfreloadOptions}
@cindex @code{glOptions}
+@cindex @code{dvisvgmOptions}
The advanced configuration variables @code{dvipsOptions},
@code{hyperrefOptions}, @code{convertOptions}, @code{gsOptions},
-@code{psviewerOptions}, @code{pdfviewerOptions}, and @code{glOptions}
-allow specialized options to be passed as a string to the respective
-applications or libraries. The default value of @code{hyperrefOptions}
-is @code{setpagesize=false,unicode,pdfborder=0 0 0}.
+@code{psviewerOptions}, @code{pdfviewerOptions}, @code{pdfreloadOptions},
+@code{glOptions}, and @code{dvisvgmOptions} allow specialized options to be passed as a string to the respective applications or libraries. The default value of @code{hyperrefOptions} is @code{setpagesize=false,unicode,pdfborder=0 0 0}.
If you insert
@verbatim
@@ -9039,16 +9060,17 @@ at the beginning of the configuration file, it can contain arbitrary
@cindex @code{context}
@cindex @code{EPS}
@cindex @code{PDF}
-@cindex @code{SVG}
@anchor{convert}
The default output format is @acronym{EPS} for the (default)
@code{latex} and @code{tex} tex engine and @acronym{PDF} for the
@code{pdflatex}, @code{xelatex}, and @code{context} tex engines.
Alternative output formats may be produced using the @code{-f} option
-(or @code{outformat} setting). To produce @acronym{SVG} output,
-first install @code{dvisvgm} (version 0.8.7 or later) from
-@url{http://dvisvgm.sourceforge.net/down.html} and be sure to use the
-@code{latex} or @code{tex} tex engine.
+(or @code{outformat} setting).
+
+@cindex @code{SVG}
+@cindex @code{dvisvgm}
+@cindex @code{libgs}
+To produce @acronym{SVG} output, you will need @code{dvisvgm} (version 0.8.7 or later) from @url{http://dvisvgm.sourceforge.net} and must use the @code{latex} or @code{tex} tex engine. You might need to adjust the configuration variable @code{libgs} to point to the location of your ghostscript library @code{libgs.so} (or to an empty string, depending on how @code{dvisvgm} was configured).
@code{Asymptote} can also produce any output format supported
by the @code{ImageMagick} @code{convert} program (version 6.3.5 or
@@ -9358,7 +9380,7 @@ Questions on installing and using @code{Asymptote} that are not
addressed in the @acronym{FAQ} should be sent to the
@code{Asymptote} forum:
@quotation
-@url{http://sourceforge.net/projects/asymptote/forums/forum/409349}
+@url{http://sourceforge.net/p/asymptote/discussion/409349}
@end quotation
@noindent
Including an example that illustrates what you are trying to do will help
@@ -9700,16 +9722,20 @@ Mark Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr.
@c LocalWords: lineargraph0 scalings log2 log2graph 5cm BWRainbow2
@c LocalWords: guide3 path3 unitcircle3 2E 2n noV 100d PostScript3D
@c LocalWords: size3 fit3 theta1 phi1 theta2 phi2 v1 v2 unitsquare3
-@c LocalWords: t1 t2 5z 5y transform3 identity4 xscale3 yscale3
-@c LocalWords: zscale3 scale3 join3 BeginBar3 EndBar3 Bar3 Bars3
+@c LocalWords: t1 t2 5z 5y transform3 identity4 xscale3 yscale3 0pt
+@c LocalWords: zscale3 scale3 join3 BeginBar3 EndBar3 Bar3 Bars3 's
@c LocalWords: BeginArrow3 MidArrow3 EndArrow3 Arrow3 Arrows3 axes3
-@c LocalWords: BeginArcArrow3 MidArcArrow3 EndArcArrow3 ArcArrow3
+@c LocalWords: BeginArcArrow3 MidArcArrow3 EndArcArrow3 ArcArrow3 '
@c LocalWords: ArcArrows3 DefaultHead3 HookHead3 TeXHead3 HookHead2
@c LocalWords: DefaultHead2 TeXHead2 arrows3 NoMargin3 BeginMargin3
@c LocalWords: EndMargin3 Margin3 Margins3 BeginPenMargin2 xaxis3
@c LocalWords: EndPenMargin2 PenMargin2 PenMargins2 BeginPenMargin3
@c LocalWords: EndPenMargin3 PenMargin3 PenMargins3 BeginDotMargin3
-@c LocalWords: EndDotMargin3 DotMargin3 DotMargins3 TrueMargin3
+@c LocalWords: EndDotMargin3 DotMargin3 DotMargins3 TrueMargin3 3D
@c LocalWords: yaxis3 zaxis3 ticks3 NoTicks3 arrowbar3 type2 axis3
-@c LocalWords: generalaxis3 vectorfield3 margin3 grid3xyz 5unit
-@c LocalWords: slopefield1 144x144
+@c LocalWords: generalaxis3 vectorfield3 margin3 grid3xyz 5unit 2D
+@c LocalWords: slopefield1 144x144 1filll 'load 'asy 'lasy 'auto 4g
+@c LocalWords: 5bp 1cm 2S 100pt 3t bracedefaultratio incircle 12pt
+@c LocalWords: 5mm 25cm 3x 5x 3y 602e 2x 2y 3sin 10cm 204e 10x Ai
+@c LocalWords: Ai Ai Ai Ai Ai Ai Ai 5E 5cm 2N 2E 2n 100d 5z 5y
+@c LocalWords: 5unit 144x144
diff --git a/Build/source/utils/asymptote/doc/externalprc.tex b/Build/source/utils/asymptote/doc/externalprc.tex
index e6d4ade1dcf..d131eebd426 100644
--- a/Build/source/utils/asymptote/doc/externalprc.tex
+++ b/Build/source/utils/asymptote/doc/externalprc.tex
@@ -1,12 +1,13 @@
% Generate inline PRC images for latex with
-% asy -inlineimage teapot -render=4
+% asy -inlineimage cube -render=4
%
% Generate inline PRC images for pdflatex with
-% asy -inlineimage teapot -render=4 -tex pdflatex
+% asy -inlineimage cube -render=4 -tex pdflatex
%
\documentclass[12pt]{article}
-\input teapot.pre
+\input cube.pre
+\usepackage[bigfiles,noplaybutton]{media9}
\RequirePackage{color,graphicx}
\begin{document}
-\input teapot.tex
+\input cube.tex
\end{document}
diff --git a/Build/source/utils/asymptote/doc/install-sh b/Build/source/utils/asymptote/doc/install-sh
index 04367377519..6781b987bdb 100755
--- a/Build/source/utils/asymptote/doc/install-sh
+++ b/Build/source/utils/asymptote/doc/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2013-10-30.23; # UTC
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,21 +35,25 @@ scriptversion=2013-10-30.23; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
+# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
-tab=' '
nl='
'
-IFS=" $tab$nl"
+IFS=" "" $nl"
-# Set DOITPROG to "echo" to test this script.
+# set DOITPROG to echo to test this script
+# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-doit_exec=${doit:-exec}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -64,6 +68,17 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
posix_mkdir=
# Desired mode of installed file.
@@ -122,39 +137,36 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
+ shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
@@ -174,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
done
fi
@@ -186,17 +194,13 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call 'install-sh -d' without argument.
+ # It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
- do_exit='(exit $ret); exit $ret'
- trap "ret=129; $do_exit" 1
- trap "ret=130; $do_exit" 2
- trap "ret=141; $do_exit" 13
- trap "ret=143; $do_exit" 15
+ trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@@ -207,16 +211,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -224,9 +228,9 @@ fi
for src
do
- # Protect names problematic for 'test' and other utilities.
+ # Protect names starting with `-'.
case $src in
- -* | [=\(\)!]) src=./$src;;
+ -*) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -248,20 +252,51 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
+
dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
- dstdir=`dirname "$dst"`
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
test -d "$dstdir"
dstdir_status=$?
fi
@@ -272,74 +307,74 @@ do
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
@@ -349,51 +384,53 @@ do
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
esac
+ eval "$initialize_posix_glob"
+
oIFS=$IFS
IFS=/
- set -f
+ $posix_glob set -f
set fnord $dstdir
shift
- set +f
+ $posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
- test X"$d" = X && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -428,12 +465,15 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
- set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- set +f &&
+ $posix_glob set +f &&
+
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -446,24 +486,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
diff --git a/Build/source/utils/asymptote/doc/latexmkrc_asydir b/Build/source/utils/asymptote/doc/latexmkrc_asydir
new file mode 100644
index 00000000000..043084e8e6d
--- /dev/null
+++ b/Build/source/utils/asymptote/doc/latexmkrc_asydir
@@ -0,0 +1,4 @@
+sub asy {return system("asy -o asy/ '$_[0]'");}
+add_cus_dep("asy","eps",0,"asy");
+add_cus_dep("asy","pdf",0,"asy");
+add_cus_dep("asy","tex",0,"asy");
diff --git a/Build/source/utils/asymptote/doc/png/Makefile.in b/Build/source/utils/asymptote/doc/png/Makefile.in
index 38b92bc03d1..6ca327d1fe9 100644
--- a/Build/source/utils/asymptote/doc/png/Makefile.in
+++ b/Build/source/utils/asymptote/doc/png/Makefile.in
@@ -26,6 +26,9 @@ asymptote.info: $(SOURCE)
info: $(SOURCE) $(ASYFILES:.asy=.png) latexusage.png
makeinfo --no-split ../asymptote
+../options:
+ cd .. && $(MAKE) options
+
html: index.html
clean: FORCE
diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info
deleted file mode 100644
index 8cf9caabdac..00000000000
--- a/Build/source/utils/asymptote/doc/png/asymptote.info
+++ /dev/null
@@ -1,9959 +0,0 @@
-This is asymptote.info, produced by makeinfo version 4.13 from
-../asymptote.texi.
-
-This file documents `Asymptote', version 2.23.
-
- `http://asymptote.sourceforge.net'
-
- Copyright (C) 2004-13 Andy Hammerlindl, John Bowman, and Tom Prince.
-
- Permission is granted to copy, distribute and/or modify this
- document under the terms of the GNU Lesser General Public License
- (see the file LICENSE in the top-level source directory).
-
-
-INFO-DIR-SECTION Languages
-START-INFO-DIR-ENTRY
-* asymptote: (asymptote/asymptote). Vector graphics language.
-END-INFO-DIR-ENTRY
-
-
-File: asymptote.info, Node: Top, Next: Description, Up: (dir)
-
-Asymptote
-*********
-
-This file documents `Asymptote', version 2.23.
-
- `http://asymptote.sourceforge.net'
-
- Copyright (C) 2004-13 Andy Hammerlindl, John Bowman, and Tom Prince.
-
- Permission is granted to copy, distribute and/or modify this
- document under the terms of the GNU Lesser General Public License
- (see the file LICENSE in the top-level source directory).
-
-
-* Menu:
-
-* Description:: What is `Asymptote'?
-* Installation:: Downloading and installing
-* Tutorial:: Getting started
-* Drawing commands:: Four primitive graphics commands
-* Bezier curves:: Path connectors and direction specifiers
-* Programming:: The `Asymptote' vector graphics language
-* LaTeX usage:: Embedding `Asymptote' commands within `LaTeX'
-* Base modules:: Base modules shipped with `Asymptote'
-* Options:: Command-line options
-* Interactive mode:: Typing `Asymptote' commands interactively
-* GUI:: Graphical user interface
-* PostScript to Asymptote:: `Asymptote' backend to `pstoedit'
-* Help:: Where to get help and submit bug reports
-* Debugger:: Squish those bugs!
-* Credits:: Contributions and acknowledgments
-* Index:: General index
-
- --- The Detailed Node Listing ---
-
-Installation
-
-* UNIX binary distributions:: Prebuilt `UNIX' binaries
-* MacOS X binary distributions:: Prebuilt `MacOS X' binaries
-* Microsoft Windows:: Prebuilt `Microsoft Windows' binary
-* Configuring:: Configuring `Asymptote' for your system
-* Search paths:: Where `Asymptote' looks for your files
-* Compiling from UNIX source:: Building `Asymptote' from scratch
-* Editing modes:: Convenient `emacs' and `vim' modes
-* Subversion:: Getting the latest development source
-* Uninstall:: Goodbye, `Asymptote'!
-
-Drawing commands
-
-* draw:: Draw a path on a picture or frame
-* fill:: Fill a cyclic path on a picture or frame
-* clip:: Clip a picture or frame to a cyclic path
-* label:: Label a point on a picture
-
-Programming
-
-* Data types:: void, bool, int, real, pair, triple, string
-* Paths and guides::
-* Pens:: Colors, line types, line widths, font sizes
-* Transforms:: Affine transforms
-* Frames and pictures:: Canvases for immediate and deferred drawing
-* Files:: Reading and writing your data
-* Variable initializers:: Initialize your variables
-* Structures:: Organize your data
-* Operators:: Arithmetic and logical operators
-* Implicit scaling:: Avoiding those ugly *s
-* Functions:: Traditional and high-order functions
-* Arrays:: Dynamic vectors
-* Casts:: Implicit and explicit casts
-* Import:: Importing external `Asymptote' modules
-* Static:: Where to allocate your variable?
-
-Operators
-
-* Arithmetic & logical:: Basic mathematical operators
-* Self & prefix operators:: Increment and decrement
-* User-defined operators:: Overloading operators
-
-Functions
-
-* Default arguments:: Default values can appear anywhere
-* Named arguments:: Assigning function arguments by keyword
-* Rest arguments:: Functions with a variable number of arguments
-* Mathematical functions:: Standard libm functions
-
-
-Arrays
-
-* Slices:: Python-style array slices
-
-Base modules
-
-* plain:: Default `Asymptote' base file
-* simplex:: Linear programming: simplex method
-* math:: Extend `Asymptote''s math capabilities
-* interpolate:: Interpolation routines
-* geometry:: Geometry routines
-* trembling:: Wavy lines
-* stats:: Statistics routines and histograms
-* patterns:: Custom fill and draw patterns
-* markers:: Custom path marker routines
-* tree:: Dynamic binary search tree
-* binarytree:: Binary tree drawing module
-* drawtree:: Tree drawing module
-* syzygy:: Syzygy and braid drawing module
-* feynman:: Feynman diagrams
-* roundedpath:: Round the sharp corners of paths
-* animation:: Embedded PDF and MPEG movies
-* embed:: Embedding movies, sounds, and 3D objects
-* slide:: Making presentations with `Asymptote'
-* MetaPost:: `MetaPost' compatibility routines
-* unicode:: Accept `unicode' (UTF-8) characters
-* latin1:: Accept `ISO 8859-1' characters
-* babel:: Interface to `LaTeX' `babel' package
-* labelpath:: Drawing curved labels
-* labelpath3:: Drawing curved labels in 3D
-* annotate:: Annotate your PDF files
-* CAD:: 2D CAD pen and measurement functions (DIN 15)
-* graph:: 2D linear & logarithmic graphs
-* palette:: Color density images and palettes
-* three:: 3D vector graphics
-* obj:: 3D obj files
-* graph3:: 3D linear & logarithmic graphs
-* grid3:: 3D grids
-* solids:: 3D solid geometry
-* tube:: 3D rotation minimizing tubes
-* flowchart:: Flowchart drawing routines
-* contour:: Contour lines
-* contour3:: Contour surfaces
-* slopefield:: Slope fields
-* ode:: Ordinary differential equations
-
-Graphical User Interface
-
-* GUI installation:: Installing `xasy'
-* GUI usage::
-
-
-File: asymptote.info, Node: Description, Next: Installation, Prev: Top, Up: Top
-
-1 Description
-*************
-
-`Asymptote' is a powerful descriptive vector graphics language that
-provides a mathematical coordinate-based framework for technical
-drawings. Labels and equations are typeset with `LaTeX', for overall
-document consistency, yielding the same high-quality level of
-typesetting that `LaTeX' provides for scientific text. By default it
-produces `PostScript' output, but it can also generate any format that
-the `ImageMagick' package can produce.
-
- A major advantage of `Asymptote' over other graphics packages is
-that it is a high-level programming language, as opposed to just a
-graphics program: it can therefore exploit the best features of the
-script (command-driven) and graphical-user-interface (GUI) methods for
-producing figures. The rudimentary GUI `xasy' included with the package
-allows one to move script-generated objects around. To make `Asymptote'
-accessible to the average user, this GUI is currently being developed
-into a full-fledged interface that can generate objects directly.
-However, the script portion of the language is now ready for general
-use by users who are willing to learn a few simple `Asymptote' graphics
-commands (*note Drawing commands::).
-
- `Asymptote' is mathematically oriented (e.g. one can use complex
-multiplication to rotate a vector) and uses `LaTeX' to do the
-typesetting of labels. This is an important feature for scientific
-applications. It was inspired by an earlier drawing program (with a
-weaker syntax and capabilities) called `MetaPost'.
-
- The `Asymptote' vector graphics language provides:
-
- * a standard for typesetting mathematical figures, just as
- TeX/`LaTeX' is the de-facto standard for typesetting equations.
-
- * `LaTeX' typesetting of labels, for overall document consistency;
-
- * the ability to generate and embed 3D vector PRC graphics within
- PDF files;
-
- * a natural coordinate-based framework for technical drawings,
- inspired by `MetaPost', with a much cleaner, powerful C++-like
- programming syntax;
-
- * compilation of figures into virtual machine code for speed, without
- sacrificing portability;
-
- * the power of a script-based language coupled to the convenience of
- a GUI;
-
- * customization using its own C++-like graphics programming language;
-
- * sensible defaults for graphical features, with the ability to
- override;
-
- * a high-level mathematically oriented interface to the `PostScript'
- language for vector graphics, including affine transforms and
- complex variables;
-
- * functions that can create new (anonymous) functions;
-
- * deferred drawing that uses the simplex method to solve overall size
- constraint issues between fixed-sized objects (labels and
- arrowheads) and objects that should scale with figure size;
-
-
- Many of the features of `Asymptote' are written in the `Asymptote'
-language itself. While the stock version of `Asymptote' is designed for
-mathematics typesetting needs, one can write `Asymptote' modules that
-tailor it to specific applications. A scientific graphing module has
-already been written (*note graph::). Examples of `Asymptote' code and
-output, including animations, are available at
-
- `http://asymptote.sourceforge.net/gallery/'.
- Links to many external resources, including an excellent user-written
-`Asymptote' tutorial can be found at
-
- `http://asymptote.sourceforge.net/links.html'.
- A quick reference card for `Asymptote' is available at
-
- `http://asymptote.sourceforge.net/asyRefCard.pdf'.
-
-
-File: asymptote.info, Node: Installation, Next: Tutorial, Prev: Description, Up: Top
-
-2 Installation
-**************
-
-* Menu:
-
-* UNIX binary distributions:: Prebuilt `UNIX' binaries
-* MacOS X binary distributions:: Prebuilt `MacOS X' binaries
-* Microsoft Windows:: Prebuilt `Microsoft Windows' binary
-* Configuring:: Configuring `Asymptote' for your system
-* Search paths:: Where `Asymptote' looks for your files
-* Compiling from UNIX source:: Building `Asymptote' from scratch
-* Editing modes:: Convenient `emacs' and `vim' modes
-* Subversion:: Getting the latest development source
-* Uninstall:: Goodbye, `Asymptote'!
-
- After following the instructions for your specific distribution,
-please see also *note Configuring::.
-
-We recommend subscribing to new release announcements at
-
- `http://freshmeat.net/projects/asy'
- Users may also wish to monitor the `Asymptote' forum:
-
- `http://sourceforge.net/projects/asymptote/forums/forum/409349'
-
-
-File: asymptote.info, Node: UNIX binary distributions, Next: MacOS X binary distributions, Up: Installation
-
-2.1 UNIX binary distributions
-=============================
-
-We release both `tgz' and RPM binary distributions of `Asymptote'. The
-root user can install the `Linux i386' `tgz' distribution of version
-`x.xx' of `Asymptote' with the commands:
-tar -C / -zxf asymptote-x.xx.i386.tgz
-texhash
- The `texhash' command, which installs LaTeX style files, is optional.
-The executable file will be `/usr/local/bin/asy') and example code will
-be installed by default in `/usr/local/share/doc/asymptote/examples'.
-
-Fedora users can easily install the most recent version of `Asymptote'
-with the command
-yum --enablerepo=rawhide install asymptote
-
-To install the latest version of `Asymptote' on a Debian-based
-distribution (e.g. Ubuntu, Mepis, Linspire) follow the instructions for
-compiling from `UNIX' source (*note Compiling from UNIX source::).
-Alternatively, Debian users can install one of Hubert Chan's prebuilt
-`Asymptote' binaries from
-
- `http://ftp.debian.org/debian/pool/main/a/asymptote'
-
-
-File: asymptote.info, Node: MacOS X binary distributions, Next: Microsoft Windows, Prev: UNIX binary distributions, Up: Installation
-
-2.2 MacOS X binary distributions
-================================
-
-`MacOS X' users can either compile the `UNIX' source code (*note
-Compiling from UNIX source::) or install the contributed `Asymptote'
-binary available at
-
-`http://www.hmug.org/pub/MacOS_X/X/Applications/Publishing/asymptote/'
-
-Because these preconfigured binary distributions have strict
-architecture and library dependencies that many installations do not
-satisfy, we recommend installing `Asymptote' directly from the official
-source:
-
- `http://sourceforge.net/project/showfiles.php?group_id=120000'
-
-Note that many `MacOS X' (and FreeBSD) systems lack the GNU `readline'
-library. For full interactive functionality, GNU `readline' version 4.3
-or later must be installed.
-
-
-File: asymptote.info, Node: Microsoft Windows, Next: Configuring, Prev: MacOS X binary distributions, Up: Installation
-
-2.3 Microsoft Windows
-=====================
-
-Users of the `Microsoft Windows' operating system can install the
-self-extracting `Asymptote' executable `asymptote-x.xx-setup.exe',
-where `x.xx' denotes the latest version.
-
- A working TeX implementation (such as the one available at
-`http://www.miktex.org') will be required to typeset labels. You will
-also need to install `GPL Ghostscript' from
-`http://sourceforge.net/projects/ghostscript/'.
-
- To view the default `PostScript' output, you can install the program
-`gsview' available from `http://www.cs.wisc.edu/~ghost/gsview/'. A
-better (and free) `PostScript' viewer available at
-`http://psview.sourceforge.net/' (which in particular works properly in
-interactive mode) unfortunately currently requires some manual
-configuration. Specifically, if version `x.xx' of `psview' is extracted
-to the directory `c:\Program Files' one needs to put
-import settings;
-psviewer="c:\Program Files\psview-x.xx\psv.exe";
- in the optional `Asymptote' configuration file; *note configuration
-file::).
-
- The `ImageMagick' package from
-
- `http://www.imagemagick.org/script/binary-releases.php'
-
-is required to support output formats other than EPS, PDF, SVG, and PNG
-(*note convert::). The `Python 2' interpreter from
-`http://www.python.org' is only required if you wish to try out the
-graphical user interface (*note GUI::).
-
-Example code will be installed by default in the `examples'
-subdirectory of the installation directory (by default, `C:\Program
-Files\Asymptote').
-
-
-File: asymptote.info, Node: Configuring, Next: Search paths, Prev: Microsoft Windows, Up: Installation
-
-2.4 Configuring
-===============
-
-In interactive mode, or when given the `-V' option (the default when
-running `Asymptote' on a single file under `MSDOS'), `Asymptote' will
-automatically invoke the `PostScript' viewer `gv' (under `UNIX') or
-`gsview' (under `MSDOS' to display graphical output. These defaults may
-be overridden with the configuration variable `psviewer'. The
-`PostScript' viewer should be capable of automatically redrawing
-whenever the output file is updated. The default `UNIX' `PostScript'
-viewer `gv' supports this (via a `SIGHUP' signal). Version `gv-3.6.3'
-or later (from `http://ftp.gnu.org/gnu/gv/') is required for
-interactive mode to work properly. Users of `ggv' will need to enable
-`Watch file' under `Edit/Postscript Viewer Preferences'. Users of
-`gsview' will need to enable `Options/Auto Redisplay' (however, under
-`MSDOS' it is still necessary to click on the `gsview' window; under
-`UNIX' one must manually redisplay by pressing the `r' key). A better
-(and free) multiplatform alternative to `gsview' is `psview' (*note
-psview::).
-
- Configuration variables are most easily set as `Asymptote' variables
-in an optional configuration file `config.asy' *note configuration
-file::). Here are the default values of several important configuration
-variables under `UNIX':
-
-
-import settings;
-psviewer="gv";
-pdfviewer="acroread";
-gs="gs";
-
-Under `MSDOS', the (installation-dependent) default values of these
-configuration variables are determined automatically from the
-`Microsoft Windows' registry. Viewer settings (such as `psviewer' and
-`pdfviewer') can be set to the string `cmd' to request the application
-normally associated with the corresponding file type.
-
- For PDF format output, the `gs' setting specifies the location of
-the `PostScript'-to-PDF processor `Ghostscript', available from
-`http://sourceforge.net/projects/ghostscript/'.
-
- The setting `pdfviewer' specifies the location of the PDF viewer. On
-`UNIX' systems, to support automatic document reloading in `Adobe
-Reader', we recommend copying the file `reload.js' from the `Asymptote'
-system directory (by default, `/usr/local/share/asymptote' under `UNIX'
-to `~/.adobe/Acrobat/x.x/JavaScripts/', where `x.x' represents the
-appropriate `Adobe Reader' version number. The automatic document
-reload feature must then be explicitly enabled by putting
-import settings;
-pdfreload=true;
-pdfreloadOptions="-tempFile";
- in the `Asymptote' configuration file. This reload feature is not
-useful under `MSDOS' since the document cannot be updated anyway on
-that operating system until it is first closed by `Adobe Reader'.
-
- The configuration variable `dir' can be used to adjust the search
-path (*note Search paths::).
-
- By default, `Asymptote' attempts to center the figure on the page,
-assuming that the paper type is `letter'. The default paper type may be
-changed to `a4' with the configuration variable `papertype'. Alignment
-to other paper sizes can be obtained by setting the configuration
-variables `paperwidth' and `paperheight'.
-
- The following configuration variables normally do not require
-adjustment:
-texpath
-texcommand
-dvips
-dvisvgm
-convert
-display
-animate
- Warnings (such as "writeoverloaded") may be enabled or disabled with
-the functions
-warn(string s);
-nowarn(string s);
- or by directly modifying the string array `settings.suppress', which
-lists all disabled warnings.
-
- Configuration variables may also be set or overwritten with a
-command-line option:
-asy -psviewer=gsview -V venn
-
- Alternatively, system environment versions of the above configuration
-variables may be set in the conventional way. The corresponding
-environment variable name is obtained by converting the configuration
-variable name to upper case and prepending `ASYMPTOTE_': for example,
-to set the environment variable
-ASYMPTOTE_PSVIEWER="C:\Program Files\Ghostgum\gsview\gsview32.exe";
- under `Microsoft Windows XP':
- 1. Click on the `Start' button;
-
- 2. Right-click on `My Computer';
-
- 3. Choose `View system information';
-
- 4. Click the `Advanced' tab;
-
- 5. Click the `Environment Variables' button.
-
-
-File: asymptote.info, Node: Search paths, Next: Compiling from UNIX source, Prev: Configuring, Up: Installation
-
-2.5 Search paths
-================
-
-In looking for `Asymptote' system files, `asy' will search the
-following paths, in the order listed:
- 1. The current directory;
-
- 2. A list of one or more directories specified by the configuration
- variable `dir' or environment variable `ASYMPTOTE_DIR' (separated
- by `:' under UNIX and `;' under `MSDOS');
-
- 3. The directory specified by the environment variable
- `ASYMPTOTE_HOME'; if this variable is not set, the directory
- `.asy' in the user's home directory (`%USERPROFILE%\.asy' under
- `MSDOS') is used;
-
- 4. The `Asymptote' system directory (by default,
- `/usr/local/share/asymptote' under `UNIX' and `C:\Program
- Files\Asymptote' under `MSDOS').
-
-
-File: asymptote.info, Node: Compiling from UNIX source, Next: Editing modes, Prev: Search paths, Up: Installation
-
-2.6 Compiling from UNIX source
-==============================
-
-To compile and install a `UNIX' executable from a source release
-`x.xx', first execute the commands:
-gunzip asymptote-x.xx.src.tgz
-tar -xf asymptote-x.xx.src.tar
-cd asymptote-x.xx
- By default the system version of the Boehm garbage collector will be
-used; if it is old we recommend first putting
-`http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2d.tar.gz'
-in the `Asymptote' source directory.
-
- On `UNIX' platforms (other than `MacOS X'), we recommend using
-version `2.8.1' of the `freeglut' library. To compile `freeglut',
-download
-
- `http://prdownloads.sourceforge.net/freeglut/freeglut-2.8.1.tar.gz'
- and type (as the root user):
-gunzip freeglut-2.8.1.tar.gz
-tar -xf freeglut-2.8.1.tar
-cd freeglut-2.8.1
-./configure --prefix=/usr
-make install
-cd ..
- Then compile `Asymptote' with the commands
-./configure
-make all
-make install
- Be sure to use GNU `make' (on non-GNU systems this command may be
-called `gmake'). To build the documentation, you may need to install
-the `texinfo-tex' package. If you get errors from a broken `texinfo' or
-`pdftex' installation, simply put
-
- `http://asymptote.sourceforge.net/asymptote.pdf'
- in the directory `doc' and repeat the command `make all'.
-
-For a (default) system-wide installation, the last command should be
-done as the root user. To install without root privileges, change the
-`./configure' command to
-./configure --prefix=$HOME/asymptote
- One can disable use of the Boehm garbage collector by configuring with
-`./configure --disable-gc'. For a list of other configuration options,
-say `./configure --help'. For example, one can tell configure to look
-for header files and libraries in nonstandard locations:
-./configure CFLAGS=-I/opt/usr/include LDFLAGS=-L/opt/usr/lib
-
- If you are compiling `Asymptote' with `gcc', you will need a
-relatively recent version (e.g. 3.4.4 or later). For full interactive
-functionality, you will need version 4.3 or later of the GNU `readline'
-library. The file `gcc3.3.2curses.patch' in the `patches' directory can
-be used to patch the broken curses.h header file (or a local copy
-thereof in the current directory) on some `AIX' and `IRIX' systems.
-
- The `FFTW' library is only required if you want `Asymptote' to be
-able to take Fourier transforms of data (say, to compute an audio power
-spectrum). The `GSL' library is only required if you require the
-special functions that it supports.
-
- If you don't want to install `Asymptote' system wide, just make sure
-the compiled binary `asy' and GUI script `xasy' are in your path and
-set the configuration variable `dir' to point to the directory `base'
-(in the top level directory of the `Asymptote' source code).
-
-
-File: asymptote.info, Node: Editing modes, Next: Subversion, Prev: Compiling from UNIX source, Up: Installation
-
-2.7 Editing modes
-=================
-
-Users of `emacs' can edit `Asymptote' code with the mode `asy-mode',
-after enabling it by putting the following lines in their `.emacs'
-initialization file, replacing `ASYDIR' with the location of the
-`Asymptote' system directory (by default, `/usr/local/share/asymptote'
-or `C:\Program Files\Asymptote' under `MSDOS'):
-(add-to-list 'load-path "ASYDIR")
-(autoload 'asy-mode "asy-mode.el" "Asymptote major mode." t)
-(autoload 'lasy-mode "asy-mode.el" "hybrid Asymptote/Latex major mode." t)
-(autoload 'asy-insinuate-latex "asy-mode.el" "Asymptote insinuate LaTeX." t)
-(add-to-list 'auto-mode-alist '("\\.asy$" . asy-mode))
-
- Particularly useful key bindings in this mode are `C-c C-c', which
-compiles and displays the current buffer, and the key binding `C-c ?',
-which shows the available function prototypes for the command at the
-cursor. For full functionality you should also install the Apache
-Software Foundation package `two-mode-mode':
-
- `http://www.dedasys.com/freesoftware/files/two-mode-mode.el'
- Once installed, you can use the hybrid mode `lasy-mode' to edit a
-LaTeX file containing embedded `Asymptote' code (*note LaTeX usage::).
-This mode can be enabled within `latex-mode' with the key sequence `M-x
-lasy-mode <RET>'. On `UNIX' systems, additional keywords will be
-generated from all `asy' files in the space-separated list of
-directories specified by the environment variable `ASYMPTOTE_SITEDIR'.
-Further documentation of `asy-mode' is available within `emacs' by
-pressing the sequence keys `C-h f asy-mode <RET>'.
-
- Fans of `vim' can customize `vim' for `Asymptote' with
-
-`cp /usr/local/share/asymptote/asy.vim ~/.vim/syntax/asy.vim'
-
-and add the following to their `~/.vimrc' file:
-augroup filetypedetect
-au BufNewFile,BufRead *.asy setf asy
-augroup END
-filetype plugin on
-
- If any of these directories or files don't exist, just create them.
-To set `vim' up to run the current asymptote script using `:make' just
-add to `~/.vim/ftplugin/asy.vim':
-setlocal makeprg=asy\ %
-setlocal errorformat=%f:\ %l.%c:\ %m
-
- Syntax highlighting support for the KDE editor `Kate' can be enabled
-by running `asy-kate.sh' in the `/usr/local/share/asymptote' directory
-and putting the generated `asymptote.xml' file in
-`~/.kde/share/apps/katepart/syntax/'.
-
-
-File: asymptote.info, Node: Subversion, Next: Uninstall, Prev: Editing modes, Up: Installation
-
-2.8 Subversion (SVN)
-====================
-
-The following commands are needed to install the latest development
-version of `Asymptote' using `Subversion':
-svn co http://asymptote.svn.sourceforge.net/svnroot/asymptote/trunk/asymptote
-cd asymptote
-./autogen.sh
-./configure
-make all
-make install
-
-To compile without optimization, use the command `make CFLAGS=-g'.
-
-
-File: asymptote.info, Node: Uninstall, Prev: Subversion, Up: Installation
-
-2.9 Uninstall
-=============
-
-To uninstall an `Linux i386' binary distribution, use the commands
-tar -zxvf asymptote-x.xx.i386.tgz | xargs --replace=% rm /%
-texhash
-
-To uninstall all `Asymptote' files installed from a source
-distribution, use the command
-make uninstall
-
-
-File: asymptote.info, Node: Tutorial, Next: Drawing commands, Prev: Installation, Up: Top
-
-3 Tutorial
-**********
-
-3.1 Drawing in batch mode
-=========================
-
-To draw a line from coordinate (0,0) to coordinate (100,100), create a
-text file `test.asy' containing
-
-draw((0,0)--(100,100));
- Then execute the command
-asy -V test
- Alternatively, `MSDOS' users can drag and drop `test.asy' onto the
-Desktop `asy' icon (or make `Asymptote' the default application for the
-extension `asy').
-
-This method, known as _batch mode_, outputs a `PostScript' file
-`test.eps'. If you prefer PDF output, use the command line
-asy -V -f pdf test
- In either case, the `-V' option opens up a viewer window so you can
-immediately view the result:
-
-
-Here, the `--' connector joins the two points `(0,0)' and `(100,100)'
-with a line segment.
-
-3.2 Drawing in interactive mode
-===============================
-
-Another method is _interactive mode_, where `Asymptote' reads
-individual commands as they are entered by the user. To try this out,
-enter `Asymptote''s interactive mode by clicking on the `Asymptote'
-icon or typing the command `asy'. Then type
-draw((0,0)--(100,100));
- followed by `Enter', to obtain the above image. At this point you can
-type further `draw' commands, which will be added to the displayed
-figure, `erase' to clear the canvas,
-input test;
- to execute all of the commands contained in the file `test.asy', or
-`quit' to exit interactive mode. You can use the arrow keys in
-interactive mode to edit previous lines. The tab key will
-automatically complete unambiguous words; otherwise, hitting tab again
-will show the possible choices. Further commands specific to
-interactive mode are described in *note Interactive mode::.
-
-3.3 Figure size
-===============
-
-In `Asymptote', coordinates like `(0,0)' and `(100,100)', called
-_pairs_, are expressed in `PostScript' "big points" (1 `bp' = 1/72
-`inch') and the default line width is `0.5bp'. However, it is often
-inconvenient to work directly in `PostScript' coordinates. The next
-example produces identical output to the previous example, by scaling
-the line `(0,0)--(1,1)' to fit a rectangle of width `100.5 bp' and
-height `100.5 bp' (the extra `0.5bp' accounts for the line width):
-size(100.5,100.5);
-draw((0,0)--(1,1));
-
-
-
-One can also specify the size in `pt' (1 `pt' = 1/72.27 `inch'), `cm',
-`mm', or `inches'. Two nonzero size arguments (or a single size
-argument) restrict the size in both directions, preserving the aspect
-ratio. If 0 is given as a size argument, no restriction is made in
-that direction; the overall scaling will be determined by the other
-direction (*note size::):
-
-size(0,100.5);
-draw((0,0)--(2,1),Arrow);
-
-
-
-To connect several points and create a cyclic path, use the `cycle'
-keyword:
-
-size(3cm);
-draw((0,0)--(1,0)--(1,1)--(0,1)--cycle);
-
-
-For convenience, the path `(0,0)--(1,0)--(1,1)--(0,1)--cycle' may be
-replaced with the predefined variable `unitsquare', or equivalently,
-`box((0,0),(1,1))'.
-
- To make the user coordinates represent multiples of exactly `1cm':
-unitsize(1cm);
-draw(unitsquare);
-
-3.4 Labels
-==========
-
-Adding labels is easy in `Asymptote'; one specifies the label as a
-double-quoted `LaTeX' string, a coordinate, and an optional alignment
-direction:
-
-size(3cm);
-draw(unitsquare);
-label("$A$",(0,0),SW);
-label("$B$",(1,0),SE);
-label("$C$",(1,1),NE);
-label("$D$",(0,1),NW);
-
-
-
-`Asymptote' uses the standard compass directions `E=(1,0)', `N=(0,1)',
-`NE=unit(N+E)', and `ENE=unit(E+NE)', etc., which along with the
-directions `up', `down', `right', and `left' are defined as pairs in
-the `Asymptote' base module `plain' (a user who has a local variable
-named `E' may access the compass direction `E' by prefixing it with the
-name of the module where it is defined: `plain.E').
-
-3.5 Paths
-=========
-
-This example draws a path that approximates a quarter circle,
-terminated with an arrowhead:
-
-size(100,0);
-draw((1,0){up}..{left}(0,1),Arrow);
-
-
-Here the directions `up' and `left' in braces specify the incoming and
-outgoing directions at the points `(1,0)' and `(0,1)', respectively.
-
- In general, a path is specified as a list of points (or other paths)
-interconnected with `--', which denotes a straight line segment, or
-`..', which denotes a cubic spline (*note Bezier curves::). Specifying
-a final `..cycle' creates a cyclic path that connects smoothly back to
-the initial node, as in this approximation (accurate to within 0.06%)
-of a unit circle:
-path unitcircle=E..N..W..S..cycle;
-
-An `Asymptote' path, being connected, is equivalent to a `Postscript
-subpath'. The `^^' binary operator, which requests that the pen be
-moved (without drawing or affecting endpoint curvatures) from the final
-point of the left-hand path to the initial point of the right-hand
-path, may be used to group several `Asymptote' paths into a `path[]'
-array (equivalent to a `PostScript' path):
-
-size(0,100);
-path unitcircle=E..N..W..S..cycle;
-path g=scale(2)*unitcircle;
-filldraw(unitcircle^^g,evenodd+yellow,black);
-
-
-
-The `PostScript' even-odd fill rule here specifies that only the region
-bounded between the two unit circles is filled (*note fillrule::). In
-this example, the same effect can be achieved by using the default zero
-winding number fill rule, if one is careful to alternate the
-orientation of the paths:
-filldraw(unitcircle^^reverse(g),yellow,black);
-
- The `^^' operator is used by the `box(triple, triple)' function in
-the module `three.asy' to construct the edges of a cube `unitbox'
-without retracing steps (*note three::):
-
-import three;
-
-currentprojection=orthographic(5,4,2,center=true);
-
-size(5cm);
-size3(3cm,5cm,8cm);
-
-draw(unitbox);
-
-dot(unitbox,red);
-
-label("$O$",(0,0,0),NW);
-label("(1,0,0)",(1,0,0),S);
-label("(0,1,0)",(0,1,0),E);
-label("(0,0,1)",(0,0,1),Z);
-
-
-
-See section *note graph:: (or the online `Asymptote' gallery and
-external links posted at `http://asymptote.sourceforge.net') for
-further examples, including two-dimensional and interactive
-three-dimensional scientific graphs. Additional examples have been
-posted by Philippe Ivaldi at `http://www.piprime.fr/asymptote'. A
-user-written `Asymptote' tutorial is available at
-http://www.artofproblemsolving.com/Wiki/index.php/Asymptote:_Basics
-
-
-File: asymptote.info, Node: Drawing commands, Next: Bezier curves, Prev: Tutorial, Up: Top
-
-4 Drawing commands
-******************
-
-All of `Asymptote''s graphical capabilities are based on four primitive
-commands. The three `PostScript' drawing commands `draw', `fill', and
-`clip' add objects to a picture in the order in which they are
-executed, with the most recently drawn object appearing on top. The
-labeling command `label' can be used to add text labels and external
-EPS images, which will appear on top of the `PostScript' objects (since
-this is normally what one wants), but again in the relative order in
-which they were executed. After drawing objects on a picture, the
-picture can be output with the `shipout' function (*note shipout::).
-
- If you wish to draw `PostScript' objects on top of labels (or
-verbatim `tex' commands; *note tex::), the `layer' command may be used
-to start a new `PostScript/LaTeX' layer:
-void layer(picture pic=currentpicture);
-
- The `layer' function gives one full control over the order in which
-objects are drawn. Layers are drawn sequentially, with the most recent
-layer appearing on top. Within each layer, labels, images, and verbatim
-`tex' commands are always drawn after the `PostScript' objects in that
-layer.
-
- While some of these drawing commands take many options, they all
-have sensible default values (for example, the picture argument
-defaults to currentpicture).
-
-* Menu:
-
-* draw:: Draw a path on a picture or frame
-* fill:: Fill a cyclic path on a picture or frame
-* clip:: Clip a picture or frame to a cyclic path
-* label:: Label a point on a picture
-
-
-File: asymptote.info, Node: draw, Next: fill, Up: Drawing commands
-
-4.1 draw
-========
-
-void draw(picture pic=currentpicture, Label L="", path g,
- align align=NoAlign, pen p=currentpen,
- arrowbar arrow=None, arrowbar bar=None, margin margin=NoMargin,
- Label legend="", marker marker=nomarker);
-
-Draw the path `g' on the picture `pic' using pen `p' for drawing, with
-optional drawing attributes (Label `L', explicit label alignment
-`align', arrows and bars `arrow' and `bar', margins `margin', legend,
-and markers `marker'). Only one parameter, the path, is required. For
-convenience, the arguments `arrow' and `bar' may be specified in either
-order. The argument `legend' is a Label to use in constructing an
-optional legend entry.
-
- Bars are useful for indicating dimensions. The possible values of
-`bar' are `None', `BeginBar', `EndBar' (or equivalently `Bar'), and
-`Bars' (which draws a bar at both ends of the path). Each of these bar
-specifiers (except for `None') will accept an optional real argument
-that denotes the length of the bar in `PostScript' coordinates. The
-default bar length is `barsize(pen)'.
-
- The possible values of `arrow' are `None', `Blank' (which draws no
-arrows or path), `BeginArrow', `MidArrow', `EndArrow' (or equivalently
-`Arrow'), and `Arrows' (which draws an arrow at both ends of the path).
-All of the arrow specifiers except for `None' and `Blank' may be given
-the optional arguments arrowhead `arrowhead' (one of the predefined
-arrowhead styles `DefaultHead', `SimpleHead', `HookHead', `TeXHead'),
-real `size' (arrowhead size in `PostScript' coordinates), real `angle'
-(arrowhead angle in degrees), filltype `filltype' (one of `FillDraw',
-`Fill', `NoFill', `UnFill', `Draw') and (except for `MidArrow' and
-`Arrows') a real `position' (in the sense of `point(path p, real t)')
-along the path where the tip of the arrow should be placed. The default
-arrowhead size when drawn with a pen `p' is `arrowsize(p)'. There are
-also arrow versions with slightly modified default values of `size' and
-`angle' suitable for curved arrows: `BeginArcArrow', `EndArcArrow' (or
-equivalently `ArcArrow'), `MidArcArrow', and `ArcArrows'.
-
- Margins can be used to shrink the visible portion of a path by
-`labelmargin(p)' to avoid overlap with other drawn objects. Typical
-values of `margin' are `NoMargin', `BeginMargin', `EndMargin' (or
-equivalently `Margin'), and `Margins' (which leaves a margin at both
-ends of the path). One may use `Margin(real begin, real end)' to
-specify the size of the beginning and ending margin, respectively, in
-multiples of the units `labelmargin(p)' used for aligning labels.
-Alternatively, `BeginPenMargin', `EndPenMargin' (or equivalently
-`PenMargin'), `PenMargins', `PenMargin(real begin, real end)' specify a
-margin in units of the pen line width, taking account of the pen line
-width when drawing the path or arrow. For example, use `DotMargin', an
-abbreviation for `PenMargin(-0.5*dotfactor,0.5*dotfactor)', to draw
-from the usual beginning point just up to the boundary of an end dot of
-width `dotfactor*linewidth(p)'. The qualifiers `BeginDotMargin',
-`EndDotMargin', and `DotMargins' work similarly. The qualifier
-`TrueMargin(real begin, real end)' allows one to specify a margin
-directly in `PostScript' units, independent of the pen line width.
-
- The use of arrows, bars, and margins is illustrated by the examples
-`Pythagoras.asy', `sqrtx01.asy', and `triads.asy'.
-
- The legend for a picture `pic' can be fit and aligned to a frame
-with the routine:
-frame legend(picture pic=currentpicture, int perline=1,
- real xmargin=legendmargin, real ymargin=xmargin,
- real linelength=legendlinelength,
- real hskip=legendhskip, real vskip=legendvskip,
- real maxwidth=0, real maxheight=0,
- bool hstretch=false, bool vstretch=false, pen p=currentpen);
- Here `xmargin' and `ymargin' specify the surrounding x and y margins,
-`perline' specifies the number of entries per line (default 1; 0 means
-choose this number automatically), `linelength' specifies the length of
-the path lines, `hskip' and `vskip' specify the line skip (as a
-multiple of the legend entry size), `maxwidth' and `maxheight' specify
-optional upper limits on the width and height of the resulting legend
-(0 means unlimited), `hstretch' and `vstretch' allow the legend to
-stretch horizontally or vertically, and `p' specifies the pen used to
-draw the bounding box. The legend frame can then be added and aligned
-about a point on a picture `dest' using `add' or `attach' (*note add
-about::).
-
- To draw a dot, simply draw a path containing a single point. The
-`dot' command defined in the module `plain' draws a dot having a
-diameter equal to an explicit pen line width or the default line width
-magnified by `dotfactor' (6 by default), using the specified filltype
-(*note filltype::):
-void dot(picture pic=currentpicture, pair z, pen p=currentpen,
- filltype filltype=Fill);
-void dot(picture pic=currentpicture, Label L, pair z, align align=NoAlign,
- string format=defaultformat, pen p=currentpen, filltype filltype=Fill);
-void dot(picture pic=currentpicture, Label[] L=new Label[], pair[] z,
- align align=NoAlign, string format=defaultformat, pen p=currentpen,
- filltype filltype=Fill)
-void dot(picture pic=currentpicture, Label L, pen p=currentpen,
- filltype filltype=Fill);
-
- If the variable `Label' is given as the `Label' argument to the
-second routine, the `format' argument will be used to format a string
-based on the dot location (here `defaultformat' is `"$%.4g$"'). The
-third routine draws a dot at every point of a pair array `z'. One can
-also draw a dot at every node of a path:
-void dot(picture pic=currentpicture, Label[] L=new Label[],
- path g, align align=RightSide, string format=defaultformat,
- pen p=currentpen, filltype filltype=Fill);
- See *note pathmarkers:: and *note markers:: for more general methods
-for marking path nodes.
-
- To draw a fixed-sized object (in `PostScript' coordinates) about the
-user coordinate `origin', use the routine
-void draw(pair origin, picture pic=currentpicture, Label L="", path g,
- align align=NoAlign, pen p=currentpen, arrowbar arrow=None,
- arrowbar bar=None, margin margin=NoMargin, Label legend="",
- marker marker=nomarker);
-
-
-File: asymptote.info, Node: fill, Next: clip, Prev: draw, Up: Drawing commands
-
-4.2 fill
-========
-
-void fill(picture pic=currentpicture, path g, pen p=currentpen);
-
-Fill the interior region bounded by the cyclic path `g' on the picture
-`pic', using the pen `p'.
-
- There is also a convenient `filldraw' command, which fills the path
-and then draws in the boundary. One can specify separate pens for each
-operation:
-void filldraw(picture pic=currentpicture, path g, pen fillpen=currentpen,
- pen drawpen=currentpen);
-
- This fixed-size version of `fill' allows one to fill an object
-described in `PostScript' coordinates about the user coordinate
-`origin':
-void fill(pair origin, picture pic=currentpicture, path g, pen p=currentpen);
-
-This is just a convenient abbreviation for the commands:
-picture opic;
-fill(opic,g,p);
-add(pic,opic,origin);
-
- The routine
-void filloutside(picture pic=currentpicture, path g, pen p=currentpen);
- fills the region exterior to the path `g', out to the current boundary
-of picture `pic'.
-
- Lattice gradient shading varying smoothly over a two-dimensional
-array of pens `p', using fill rule `fillrule', can be produced with
-void latticeshade(picture pic=currentpicture, path g, bool stroke=false,
- pen fillrule=currentpen, pen[][] p)
- If `stroke=true', the region filled is the same as the region that
-would be drawn by `draw(pic,g,fillrule+zerowinding)'; in this case the
-path `g' need not be cyclic. The pens in `p' must belong to the same
-color space. One can use the functions `rgb(pen)' or `cmyk(pen)' to
-promote pens to a higher color space, as illustrated in the example file
-`latticeshading.asy'.
-
- Axial gradient shading varying smoothly from `pena' to `penb' in the
-direction of the line segment `a--b' can be achieved with
-void axialshade(picture pic=currentpicture, path g, bool stroke=false,
- pen pena, pair a, bool extenda=true,
- pen penb, pair b, bool extendb=true);
- The boolean parameters `extenda' and `extendb' indicate whether the
-shading should extend beyond the axis endpoints `a' and `b'.
-
- Radial gradient shading varying smoothly from `pena' on the circle
-with center `a' and radius `ra' to `penb' on the circle with center `b'
-and radius `rb' is similar:
-void radialshade(picture pic=currentpicture, path g, bool stroke=false,
- pen pena, pair a, real ra, bool extenda=true,
- pen penb, pair b, real rb, bool extendb=true);
- The boolean parameters `extenda' and `extendb' indicate whether the
-shading should extend beyond the radii `a' and `b'. Illustrations of
-radial shading are provided in the example files `shade.asy',
-`ring.asy', and `shadestroke.asy'.
-
- Gouraud shading using fill rule `fillrule' and the vertex colors in
-the pen array `p' on a triangular lattice defined by the vertices `z'
-and edge flags `edges' is implemented with
-void gouraudshade(picture pic=currentpicture, path g, bool stroke=false,
- pen fillrule=currentpen, pen[] p, pair[] z,
- int[] edges);
-void gouraudshade(picture pic=currentpicture, path g, bool stroke=false,
- pen fillrule=currentpen, pen[] p, int[] edges);
- In the second form, the elements of `z' are taken to be successive
-nodes of path `g'. The pens in `p' must belong to the same color space.
-Illustrations of Gouraud shading are provided in the example file
-`Gouraud.asy' and in the solid geometry module `solids.asy'. The edge
-flags used in Gouraud shading are documented here:
-
- `http://partners.adobe.com/public/developer/en/ps/sdk/TN5600.SmoothShading.pdf'.
-
- Tensor product shading using fill rule `fillrule' on patches bounded
-by the n cyclic paths of length 4 in path array `b', using the vertex
-colors specified in the n \times 4 pen array `p' and internal control
-points in the n \times 4 array `z', is implemented with
-void tensorshade(picture pic=currentpicture, path g, bool stroke=false,
- pen fillrule=currentpen, pen[][] p, path[] b=g,
- pair[][] z=new pair[][]);
- If the array `z' is empty, Coons shading, in which the color control
-points are calculated automatically, is used. The pens in `p' must
-belong to the same color space. A simpler interface for the case of a
-single patch (n=1) is also available:
-void tensorshade(picture pic=currentpicture, path g, bool stroke=false,
- pen fillrule=currentpen, pen[] p, path b=g,
- pair[] z=new pair[]);
- One can also smoothly shade the regions between consecutive paths of a
-sequence using a given array of pens:
-void draw(picture pic=currentpicture, pen fillrule=currentpen, path[] g,
- pen[] p);
- Illustrations of tensor product and Coons shading are provided in the
-example files `tensor.asy', `Coons.asy', `BezierSurface.asy', and
-`rainbow.asy'.
-
- More general shading possibilities are available with the `pdflatex',
-`context', and `pdftex' TeX engines: the routine
-void functionshade(picture pic=currentpicture, path[] g, bool stroke=false,
- pen fillrule=currentpen, string shader);
- shades on picture `pic' the interior of path `g' according to fill
-rule `fillrule' using the `PostScript' calculator routine specified by
-the string `shader'; this routine takes 2 arguments, each in [0,1], and
-returns `colors(fillrule).length' color components. Function shading
-is illustrated in the example `functionshading.asy'.
-
- The following routine uses `evenodd' clipping together with the `^^'
-operator to unfill a region:
-
-void unfill(picture pic=currentpicture, path g);
-
-
-File: asymptote.info, Node: clip, Next: label, Prev: fill, Up: Drawing commands
-
-4.3 clip
-========
-
-void clip(picture pic=currentpicture, path g, stroke=false,
- pen fillrule=currentpen);
-
-Clip the current contents of picture `pic' to the region bounded by the
-path `g', using fill rule `fillrule' (*note fillrule::). If
-`stroke=true', the clipped portion is the same as the region that would
-be drawn with `draw(pic,g,fillrule+zerowinding)'; in this case the path
-`g' need not be cyclic. For an illustration of picture clipping, see
-the first example in *note LaTeX usage::.
-
-
-File: asymptote.info, Node: label, Prev: clip, Up: Drawing commands
-
-4.4 label
-=========
-
-void label(picture pic=currentpicture, Label L, pair position,
- align align=NoAlign, pen p=currentpen, filltype filltype=NoFill)
-
-Draw Label `L' on picture `pic' using pen `p'. If `align' is `NoAlign',
-the label will be centered at user coordinate `position'; otherwise it
-will be aligned in the direction of `align' and displaced from
-`position' by the `PostScript' offset `align*labelmargin(p)'. The
-constant `Align' can be used to align the bottom-left corner of the
-label at `position'. The Label `L' can either be a string or the
-structure obtained by calling one of the functions
-Label Label(string s="", pair position, align align=NoAlign,
- pen p=nullpen, embed embed=Rotate, filltype filltype=NoFill);
-Label Label(string s="", align align=NoAlign,
- pen p=nullpen, embed embed=Rotate, filltype filltype=NoFill);
-Label Label(Label L, pair position, align align=NoAlign,
- pen p=nullpen, embed embed=L.embed, filltype filltype=NoFill);
-Label Label(Label L, align align=NoAlign,
- pen p=nullpen, embed embed=L.embed, filltype filltype=NoFill);
- The text of a Label can be scaled, slanted, rotated, or shifted by
-multiplying it on the left by an affine transform (*note Transforms::).
-For example, `rotate(45)*xscale(2)*L' first scales `L' in the x
-direction and then rotates it counterclockwise by 45 degrees. The final
-position of a Label can also be shifted by a `PostScript' coordinate
-translation: `shift(10,0)*L'. An explicit pen specified within the
-Label overrides other pen arguments. The `embed' argument determines
-how the Label should transform with the embedding picture:
-`Shift'
- only shift with embedding picture;
-
-`Rotate'
- only shift and rotate with embedding picture (default);
-
-`Rotate(pair z)'
- rotate with (picture-transformed) vector `z'.
-
-`Slant'
- only shift, rotate, slant, and reflect with embedding picture;
-
-`Scale'
- shift, rotate, slant, reflect, and scale with embedding picture.
-
-
- To add a label to a path, use
-void label(picture pic=currentpicture, Label L, path g, align align=NoAlign,
- pen p=currentpen, filltype filltype=NoFill);
- By default the label will be positioned at the midpoint of the path.
-An alternative label position (in the sense of `point(path p, real t)')
-may be specified as a real value for `position' in constructing the
-Label. The position `Relative(real)' specifies a location relative to
-the total arclength of the path. These convenient abbreviations are
-predefined:
-position BeginPoint=Relative(0);
-position MidPoint=Relative(0.5);
-position EndPoint=Relative(1);
-
- Path labels are aligned in the direction `align', which may be
-specified as an absolute compass direction (pair) or a direction
-`Relative(pair)' measured relative to a north axis in the local
-direction of the path. For convenience `LeftSide', `Center', and
-`RightSide' are defined as `Relative(W)', `Relative((0,0))', and
-`Relative(E)', respectively. Multiplying `LeftSide', `Center',
-`RightSide' on the left by a real scaling factor will move the label
-further away from or closer to the path.
-
- A label with a fixed-size arrow of length `arrowlength' pointing to
-`b' from direction `dir' can be produced with the routine
-void arrow(picture pic=currentpicture, Label L="", pair b, pair dir,
- real length=arrowlength, align align=NoAlign,
- pen p=currentpen, arrowbar arrow=Arrow, margin margin=EndMargin);
- If no alignment is specified (either in the Label or as an explicit
-argument), the optional Label will be aligned in the direction `dir',
-using margin `margin'.
-
- The function `string graphic(string name, string options="")'
-returns a string that can be used to include an encapsulated
-`PostScript' (EPS) file. Here, `name' is the name of the file to
-include and `options' is a string containing a comma-separated list of
-optional bounding box (`bb=llx lly urx ury'), width (`width=value'),
-height (`height=value'), rotation (`angle=value'), scaling
-(`scale=factor'), clipping (`clip=bool'), and draft mode (`draft=bool')
-parameters. The `layer()' function can be used to force future objects
-to be drawn on top of the included image:
-label(graphic("file.eps","width=1cm"),(0,0),NE);
-layer();
-
- The `string baseline(string s, string template="\strut")' function
-can be used to enlarge the bounding box of labels to match a given
-template, so that their baselines will be typeset on a horizontal line.
-See `Pythagoras.asy' for an example.
-
- One can prevent labels from overwriting one another with the
-`overwrite' pen attribute (*note overwrite::).
-
- The structure `object' defined in `plain_Label.asy' allows Labels
-and frames to be treated in a uniform manner. A group of objects may
-be packed together into single frame with the routine
-frame pack(pair align=2S ... object inset[]);
- To draw or fill a box (or ellipse or other path) around a Label and
-return the bounding object, use one of the routines
-object draw(picture pic=currentpicture, Label L, envelope e,
- real xmargin=0, real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill, bool above=true);
-object draw(picture pic=currentpicture, Label L, envelope e, pair position,
- real xmargin=0, real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill, bool above=true);
- Here `envelope' is a boundary-drawing routine such as `box',
-`roundbox', or `ellipse' defined in `plain_boxes.asy' (*note
-envelope::).
-
- The function `path[] texpath(Label L)' returns the path array that
-TeX would fill to draw the Label `L'.
-
- The `string minipage(string s, width=100pt)' function can be used to
-format string `s' into a paragraph of width `width'. This example uses
-`minipage', `clip', and `graphic' to produce a CD label:
-
-
-size(11.7cm,11.7cm);
-asy(nativeformat(),"logo");
-fill(unitcircle^^(scale(2/11.7)*unitcircle),
- evenodd+rgb(124/255,205/255,124/255));
-label(scale(1.1)*minipage(
-"\centering\scriptsize \textbf{\LARGE {\tt Asymptote}\\
-\smallskip
-\small The Vector Graphics Language}\\
-\smallskip
-\textsc{Andy Hammerlindl, John Bowman, and Tom Prince}
-http://asymptote.sourceforge.net\\
-",8cm),(0,0.6));
-label(graphic("logo."+nativeformat(),"height=7cm"),(0,-0.22));
-clip(unitcircle^^(scale(2/11.7)*unitcircle),evenodd);
-
-
-File: asymptote.info, Node: Bezier curves, Next: Programming, Prev: Drawing commands, Up: Top
-
-5 Bezier curves
-***************
-
-Each interior node of a cubic spline may be given a direction prefix or
-suffix `{dir}': the direction of the pair `dir' specifies the direction
-of the incoming or outgoing tangent, respectively, to the curve at that
-node. Exterior nodes may be given direction specifiers only on their
-interior side.
-
- A cubic spline between the node z_0, with postcontrol point c_0, and
-the node z_1, with precontrol point c_1, is computed as the Bezier curve
-
-
-
-As illustrated in the diagram below, the third-order midpoint (m_5)
-constructed from two endpoints z_0 and z_1 and two control points c_0
-and c_1, is the point corresponding to t=1/2 on the Bezier curve formed
-by the quadruple (z_0, c_0, c_1, z_1). This allows one to recursively
-construct the desired curve, by using the newly extracted third-order
-midpoint as an endpoint and the respective second- and first-order
-midpoints as control points:
-
-
-
-Here m_0, m_1 and m_2 are the first-order midpoints, m_3 and m_4 are
-the second-order midpoints, and m_5 is the third-order midpoint. The
-curve is then constructed by recursively applying the algorithm to
-(z_0, m_0, m_3, m_5) and (m_5, m_4, m_2, z_1).
-
- In fact, an analogous property holds for points located at any
-fraction t in [0,1] of each segment, not just for midpoints (t=1/2).
-
- The Bezier curve constructed in this manner has the following
-properties:
- * It is entirely contained in the convex hull of the given four
- points.
-
- * It starts heading from the first endpoint to the first control
- point and finishes heading from the second control point to the
- second endpoint.
-
-
- The user can specify explicit control points between two nodes like
-this:
-draw((0,0)..controls (0,100) and (100,100)..(100,0));
-
- However, it is usually more convenient to just use the `..'
-operator, which tells `Asymptote' to choose its own control points
-using the algorithms described in Donald Knuth's monograph, The
-MetaFontbook, Chapter 14. The user can still customize the guide (or
-path) by specifying direction, tension, and curl values.
-
- The higher the tension, the straighter the curve is, and the more it
-approximates a straight line. One can change the spline tension from
-its default value of 1 to any real value greater than or equal to 0.75
-(cf. John D. Hobby, Discrete and Computational Geometry 1, 1986):
-draw((100,0)..tension 2 ..(100,100)..(0,100));
-draw((100,0)..tension 3 and 2 ..(100,100)..(0,100));
-draw((100,0)..tension atleast 2 ..(100,100)..(0,100));
-
- In these examples there is a space between `2' and `..'. This is
-needed as `2.' is interpreted as a numerical constant.
-
- The curl parameter specifies the curvature at the endpoints of a path
-(0 means straight; the default value of 1 means approximately circular):
-draw((100,0){curl 0}..(100,100)..{curl 0}(0,100));
-
- The `MetaPost ...' path connector, which requests, when possible, an
-inflection-free curve confined to a triangle defined by the endpoints
-and directions, is implemented in `Asymptote' as the convenient
-abbreviation `::' for `..tension atleast 1 ..' (the ellipsis `...' is
-used in `Asymptote' to indicate a variable number of arguments; *note
-Rest arguments::). For example, compare
-
-draw((0,0){up}..(100,25){right}..(200,0){down});
-
-
-with
-
-draw((0,0){up}::(100,25){right}::(200,0){down});
-
-
-
-The `---' connector is an abbreviation for `..tension atleast
-infinity..' and the `&' connector concatenates two paths, after first
-stripping off the last node of the first path (which normally should
-coincide with the first node of the second path).
-
-
-File: asymptote.info, Node: Programming, Next: LaTeX usage, Prev: Bezier curves, Up: Top
-
-6 Programming
-*************
-
-Here is a short introductory example to the `Asymptote' programming
-language that highlights the similarity of its control structures with
-those of C, C++, and Java:
-// This is a comment.
-
-// Declaration: Declare x to be a real variable;
-real x;
-
-// Assignment: Assign the real variable x the value 1.
-x=1.0;
-
-// Conditional: Test if x equals 1 or not.
-if(x == 1.0) {
- write("x equals 1.0");
-} else {
- write("x is not equal to 1.0");
-}
-
-// Loop: iterate 10 times
-for(int i=0; i < 10; ++i) {
- write(i);
-}
-
- `Asymptote' supports `while', `do', `break', and `continue'
-statements just as in C/C++. It also supports the Java-style shorthand
-for iterating over all elements of an array:
-
-// Iterate over an array
-int[] array={1,1,2,3,5};
-for(int k : array) {
- write(k);
-}
- In addition, it supports many features beyond the ones found in those
-languages.
-
-* Menu:
-
-* Data types:: void, bool, int, real, pair, triple, string
-* Paths and guides::
-* Pens:: Colors, line types, line widths, font sizes
-* Transforms:: Affine transforms
-* Frames and pictures:: Canvases for immediate and deferred drawing
-* Files:: Reading and writing your data
-* Variable initializers:: Initialize your variables
-* Structures:: Organize your data
-* Operators:: Arithmetic and logical operators
-* Implicit scaling:: Avoiding those ugly *s
-* Functions:: Traditional and high-order functions
-* Arrays:: Dynamic vectors
-* Casts:: Implicit and explicit casts
-* Import:: Importing external `Asymptote' modules
-* Static:: Where to allocate your variable?
-
-
-File: asymptote.info, Node: Data types, Next: Paths and guides, Up: Programming
-
-6.1 Data types
-==============
-
-`Asymptote' supports the following data types (in addition to
-user-defined types):
-
-`void'
- The void type is used only by functions that take or return no
- arguments.
-
-`bool'
- a boolean type that can only take on the values `true' or `false'.
- For example: bool b=true;
-
- defines a boolean variable `b' and initializes it to the value
- `true'. If no initializer is given: bool b;
-
- the value `false' is assumed.
-
-`bool3'
- an extended boolean type that can take on the values `true',
- `default', or `false'. A bool3 type can be cast to or from a bool.
- The default initializer for bool3 is `default'.
-
-`int'
- an integer type; if no initializer is given, the implicit value `0'
- is assumed. The minimum allowed value of an integer is `intMin'
- and the maximum value is `intMax'.
-
-`real'
- a real number; this should be set to the highest-precision native
- floating-point type on the architecture. The implicit initializer
- for reals is `0.0'. Real numbers have precision `realEpsilon',
- with `realDigits' significant digits. The smallest positive real
- number is `realMin' and the largest positive real number is
- `realMax'. The variable `inf' and function `bool isnan(real x)'
- are useful when floating-point exceptions are masked with the
- `-mask' command-line option (the default in interactive mode).
-
-`pair'
- complex number, that is, an ordered pair of real components
- `(x,y)'. The real and imaginary parts of a pair `z' can read as
- `z.x' and `z.y'. We say that `x' and `y' are virtual members of
- the data element pair; they cannot be directly modified, however.
- The implicit initializer for pairs is `(0.0,0.0)'.
-
- There are a number of ways to take the complex conjugate of a pair:
- pair z=(3,4);
- z=(z.x,-z.y);
- z=z.x-I*z.y;
- z=conj(z);
-
- Here `I' is the pair `(0,1)'. A number of built-in functions are
- defined for pairs:
-
- `pair conj(pair z)'
- returns the conjugate of `z';
-
- `real length(pair z)'
- returns the complex modulus `|z|' of its argument `z'. For
- example,
- pair z=(3,4);
- length(z);
- returns the result 5. A synonym for `length(pair)' is
- `abs(pair)';
-
- `real angle(pair z, bool warn=true)'
- returns the angle of `z' in radians in the interval
- [-`pi',`pi'] or `0' if `warn' is `false' and `z=(0,0)'
- (rather than producing an error);
-
- `real degrees(pair z, bool warn=true)'
- returns the angle of `z' in degrees in the interval [0,360)
- or `0' if `warn' is `false' and `z=(0,0)' (rather than
- producing an error);
-
- `pair unit(pair z)'
- returns a unit vector in the direction of the pair `z';
-
- `pair expi(real angle)'
- returns a unit vector in the direction `angle' measured in
- radians;
-
- `pair dir(real degrees)'
- returns a unit vector in the direction `degrees' measured in
- degrees;
-
- `real xpart(pair z)'
- returns `z.x';
-
- `real ypart(pair z)'
- returns `z.y';
-
- `pair realmult(pair z, pair w)'
- returns the element-by-element product `(z.x*w.x,z.y*w.y)';
-
- `real dot(explicit pair z, explicit pair w)'
- returns the dot product `z.x*w.x+z.y*w.y';
-
- `pair minbound(pair z, pair w)'
- returns `(min(z.x,w.x),min(z.y,w.y))';
-
- `pair maxbound(pair z, pair w)'
- returns `(max(z.x,w.x),max(z.y,w.y))'.
-
-
-`triple'
- an ordered triple of real components `(x,y,z)' used for
- three-dimensional drawings. The respective components of a triple
- `v' can read as `v.x', `v.y', and `v.z'. The implicit initializer
- for triples is `(0.0,0.0,0.0)'.
-
- Here are the built-in functions for triples:
- `real length(triple v)'
- returns the length `|v|' of the vector `v'. A synonym for
- `length(triple)' is `abs(triple)';
-
- `real polar(triple v, bool warn=true)'
- returns the colatitude of `v' measured from the z axis in
- radians or `0' if `warn' is `false' and `v=O' (rather than
- producing an error);
-
- `real azimuth(triple v, bool warn=true)'
- returns the longitude of `v' measured from the x axis in
- radians or `0' if `warn' is `false' and `v.x=v.y=0' (rather
- than producing an error);
-
- `real colatitude(triple v, bool warn=true)'
- returns the colatitude of `v' measured from the z axis in
- degrees or `0' if `warn' is `false' and `v=O' (rather than
- producing an error);
-
- `real latitude(triple v, bool warn=true)'
- returns the latitude of `v' measured from the xy plane in
- degrees or `0' if `warn' is `false' and `v=O' (rather than
- producing an error);
-
- `real longitude(triple v, bool warn=true)'
- returns the longitude of `v' measured from the x axis in
- degrees or `0' if `warn' is `false' and `v.x=v.y=0' (rather
- than producing an error);
-
- `triple unit(triple v)'
- returns a unit triple in the direction of the triple `v';
-
- `triple expi(real polar, real azimuth)'
- returns a unit triple in the direction `(polar,azimuth)'
- measured in radians;
-
- `triple dir(real colatitude, real longitude)'
- returns a unit triple in the direction
- `(colatitude,longitude)' measured in degrees;
-
- `real xpart(triple v)'
- returns `v.x';
-
- `real ypart(triple v)'
- returns `v.y';
-
- `real zpart(triple v)'
- returns `v.z';
-
- `real dot(triple u, triple v)'
- returns the dot product `u.x*v.x+u.y*v.y+u.z*v.z';
-
- `triple cross(triple u, triple v)'
- returns the cross product
-
- `(u.y*v.z-u.z*v.y,u.z*v.x-u.x*v.z,u.x*v.y-v.x*u.y)';
-
- `triple minbound(triple u, triple v)'
- returns `(min(u.x,v.x),min(u.y,v.y),min(u.z,v.z))';
-
- `triple maxbound(triple u, triple v)'
- returns `(max(u.x,v.x),max(u.y,v.y),max(u.z,v.z)').
-
-
-`string'
- a character string, implemented using the STL `string' class.
-
- Strings delimited by double quotes (`"') are subject to the
- following mappings to allow the use of double quotes in TeX (e.g.
- for using the `babel' package, *note babel::):
-
- * \" maps to "
-
- * \\ maps to \\
-
- Strings delimited by single quotes (`'') have the same mappings as
- character strings in ANSI `C':
-
- * \' maps to '
-
- * \" maps to "
-
- * \? maps to ?
-
- * \\ maps to backslash
-
- * \a maps to alert
-
- * \b maps to backspace
-
- * \f maps to form feed
-
- * \n maps to newline
-
- * \r maps to carriage return
-
- * \t maps to tab
-
- * \v maps to vertical tab
-
- * \0-\377 map to corresponding octal byte
-
- * \x0-\xFF map to corresponding hexadecimal byte
-
- The implicit initializer for strings is the empty string `""'.
- Strings may be concatenated with the `+' operator. In the following
- string functions, position `0' denotes the start of the string:
- `int length(string s)'
- returns the length of the string `s';
-
- `int find(string s, string t, int pos=0)'
- returns the position of the first occurrence of string `t' in
- string `s' at or after position `pos', or -1 if `t' is not a
- substring of `s';
-
- `int rfind(string s, string t, int pos=-1)'
- returns the position of the last occurrence of string `t' in
- string `s' at or before position `pos' (if `pos'=-1, at the
- end of the string `s'), or -1 if `t' is not a substring of
- `s';
-
- `string insert(string s, int pos, string t)'
- returns the string formed by inserting string `t' at position
- `pos' in `s';
-
- `string erase(string s, int pos, int n)'
- returns the string formed by erasing the string of length `n'
- (if `n'=-1, to the end of the string `s') at position `pos'
- in `s';
-
- `string substr(string s, int pos, int n=-1)'
- returns the substring of `s' starting at position `pos' and
- of length `n' (if `n'=-1, until the end of the string `s');
-
- `string reverse(string s)'
- returns the string formed by reversing string `s';
-
- `string replace(string s, string before, string after)'
- returns a string with all occurrences of the string `before'
- in the string `s' changed to the string `after';
-
- `string replace(string s, string[][] table)'
- returns a string constructed by translating in string `s' all
- occurrences of the string `before' in an array `table' of
- string pairs {`before',`after'} to the corresponding string
- `after';
-
- `string[] split(string s, string delimiter="")'
- returns an array of strings obtained by splitting `s' into
- substrings delimited by `delimiter' (an empty delimiter
- signifies a space, but with duplicate delimiters discarded);
-
- `string format(string s, int n, string locale="")'
- returns a string containing `n' formatted according to the
- C-style format string `s' using locale `locale' (or the
- current locale if an empty string is specified);
-
- `string format(string s=defaultformat, string s=defaultseparator, real x, string locale="")'
- returns a string containing `x' formatted according to the
- C-style format string `s' using locale `locale' (or the
- current locale if an empty string is specified), following
- the behaviour of the C function `fprintf'), except that only
- one data field is allowed, trailing zeros are removed by
- default (unless `#' is specified), and (if the format string
- specifies math mode) TeX is used to typeset scientific
- notation using the `defaultseparator="\!\times\!";';
-
- `int hex(string s);'
- casts a hexidecimal string `s' to an integer;
-
- `int ascii(string s);'
- returns the ASCII code for the first character of string `s';
-
- `string string(real x, int digits=realDigits)'
- casts `x' to a string using precision `digits' and the C
- locale;
-
- `string locale(string s="")'
- sets the locale to the given string, if nonempty, and returns
- the current locale;
-
- `string time(string format="%a %b %d %T %Z %Y")'
- returns the current time formatted by the ANSI C routine
- `strftime' according to the string `format' using the current
- locale. Thus time();
- time("%a %b %d %H:%M:%S %Z %Y");
-
- are equivalent ways of returning the current time in the
- default format used by the `UNIX' `date' command;
-
- `int seconds(string t="", string format="")'
- returns the time measured in seconds after the Epoch (Thu Jan
- 01 00:00:00 UTC 1970) as determined by the ANSI C routine
- `strptime' according to the string `format' using the current
- locale, or the current time if `t' is the empty string. Note
- that the `"%Z"' extension to the POSIX `strptime'
- specification is ignored by the current GNU C Library. If an
- error occurs, the value -1 is returned. Here are some
- examples: seconds("Mar 02 11:12:36 AM PST 2007","%b %d %r PST %Y");
- seconds(time("%b %d %r %z %Y"),"%b %d %r %z %Y");
- seconds(time("%b %d %r %Z %Y"),"%b %d %r "+time("%Z")+" %Y");
- 1+(seconds()-seconds("Jan 1","%b %d"))/(24*60*60);
- The last example returns today's ordinal date, measured from
- the beginning of the year.
-
- `string time(int seconds, string format="%a %b %d %T %Z %Y")'
- returns the time corresponding to `seconds' seconds after the
- Epoch (Thu Jan 01 00:00:00 UTC 1970) formatted by the ANSI C
- routine `strftime' according to the string `format' using the
- current locale. For example, to return the date corresponding
- to 24 hours ago: time(seconds()-24*60*60);
-
- `int system(string s)'
-
- `int system(string[] s)'
- if the setting `safe' is false, call the arbitrary system
- command `s';
-
- `void asy(string format, bool overwrite=false ... string[] s)'
- conditionally process each file name in array `s' in a new
- environment, using format `format', overwriting the output
- file only if `overwrite' is true;
-
- `void abort(string s="")'
- aborts execution (with a non-zero return code in batch mode);
- if string `s' is nonempty, a diagnostic message constructed
- from the source file, line number, and `s' is printed;
-
- `void assert(bool b, string s="")'
- aborts execution with an error message constructed from `s' if
- `b=false';
-
- `void exit()'
- exits (with a zero error return code in batch mode);
-
- `void sleep(int seconds)'
- pauses for the given number of seconds;
-
- `void usleep(int microseconds)'
- pauses for the given number of microseconds;
-
- `void beep()'
- produces a beep on the console;
-
-
-
- As in C/C++, complicated types may be abbreviated with `typedef'
-(see the example in *note Functions::).
-
-
-File: asymptote.info, Node: Paths and guides, Next: Pens, Prev: Data types, Up: Programming
-
-6.2 Paths and guides
-====================
-
-`path'
- a cubic spline resolved into a fixed path. The implicit
- initializer for paths is `nullpath'.
-
- For example, the routine `circle(pair c, real r)', which returns a
- Bezier curve approximating a circle of radius `r' centered on `c',
- is based on `unitcircle' (*note unitcircle::): path circle(pair c, real r)
- {
- return shift(c)*scale(r)*unitcircle;
- }
- If high accuracy is needed, a true circle may be produced with the
- routine `Circle' defined in the module `graph.asy': import graph;
- path Circle(pair c, real r, int n=nCircle);
-
- A circular arc consistent with `circle' centered on `c' with
- radius `r' from `angle1' to `angle2' degrees, drawing
- counterclockwise if `angle2 >= angle1', can be constructed with path arc(pair c, real r, real angle1, real angle2);
- One may also specify the direction explicitly: path arc(pair c, real r, real angle1, real angle2, bool direction);
- Here the direction can be specified as CCW (counter-clockwise) or
- CW (clockwise). For convenience, an arc centered at `c' from pair
- `z1' to `z2' (assuming `|z2-c|=|z1-c|') in the may also be
- constructed with path arc(pair c, explicit pair z1, explicit pair z2,
- bool direction=CCW)
-
- If high accuracy is needed, true arcs may be produced with routines
- in the module `graph.asy' that produce Bezier curves with `n'
- control points: import graph;
- path Arc(pair c, real r, real angle1, real angle2, bool direction,
- int n=nCircle);
- path Arc(pair c, real r, real angle1, real angle2, int n=nCircle);
- path Arc(pair c, explicit pair z1, explicit pair z2,
- bool direction=CCW, int n=nCircle);
-
- An ellipse can be drawn with the routine path ellipse(pair c, real a, real b)
- {
- return shift(c)*scale(a,b)*unitcircle;
- }
-
- This example illustrates the use of all five guide connectors
- discussed in *note Tutorial:: and *note Bezier curves::: size(300,0);
- pair[] z=new pair[10];
-
- z[0]=(0,100); z[1]=(50,0); z[2]=(180,0);
-
- for(int n=3; n <= 9; ++n)
- z[n]=z[n-3]+(200,0);
-
- path p=z[0]..z[1]---z[2]::{up}z[3]
- &z[3]..z[4]--z[5]::{up}z[6]
- &z[6]::z[7]---z[8]..{up}z[9];
-
- draw(p,grey+linewidth(4mm));
-
- dot(z);
-
-
-
- Here are some useful functions for paths:
-
- `int length(path p);'
- This is the number of (linear or cubic) segments in path `p'.
- If `p' is cyclic, this is the same as the number of nodes in
- `p'.
-
- `int size(path p);'
- This is the number of nodes in the path `p'. If `p' is
- cyclic, this is the same as `length(p)'.
-
- `bool cyclic(path p);'
- returns `true' iff path `p' is cyclic.
-
- `bool straight(path p, int i);'
- returns `true' iff the segment of path `p' between node `i'
- and node `i+1' is straight.
-
- `bool piecewisestraight(path p)'
- returns `true' iff the path `p' is piecewise straight.
-
- `pair point(path p, int t);'
- If `p' is cyclic, return the coordinates of node `t' mod
- `length(p)'. Otherwise, return the coordinates of node `t',
- unless `t' < 0 (in which case `point(0)' is returned) or `t'
- > `length(p)' (in which case `point(length(p))' is returned).
-
- `pair point(path p, real t);'
- This returns the coordinates of the point between node
- `floor(t)' and `floor(t)+1' corresponding to the cubic spline
- parameter `t-floor(t)' (*note Bezier curves::). If `t' lies
- outside the range [0,`length(p)'], it is first reduced modulo
- `length(p)' in the case where `p' is cyclic or else converted
- to the corresponding endpoint of `p'.
-
- `pair dir(path p, int t, int sign=0, bool normalize=true);'
- If `sign < 0', return the direction (as a pair) of the
- incoming tangent to path `p' at node `t'; if `sign > 0',
- return the direction of the outgoing tangent. If `sign=0',
- the mean of these two directions is returned.
-
- `pair dir(path p, real t, bool normalize=true);'
- returns the direction of the tangent to path `p' at the point
- between node `floor(t)' and `floor(t)+1' corresponding to the
- cubic spline parameter `t-floor(t)' (*note Bezier curves::).
-
- `pair dir(path p)'
- returns dir(p,length(p)).
-
- `pair dir(path p, path q)'
- returns unit(dir(p)+dir(q)).
-
- `pair accel(path p, int t, int sign=0);'
- If `sign < 0', return the acceleration of the incoming path
- `p' at node `t'; if `sign > 0', return the acceleration of
- the outgoing path. If `sign=0', the mean of these two
- accelerations is returned.
-
- `pair accel(path p, real t);'
- returns the acceleration of the path `p' at the point `t'.
-
- `real radius(path p, real t);'
- returns the radius of curvature of the path `p' at the point
- `t'.
-
- `pair precontrol(path p, int t);'
- returns the precontrol point of `p' at node `t'.
-
- `pair precontrol(path p, real t);'
- returns the effective precontrol point of `p' at parameter
- `t'.
-
- `pair postcontrol(path p, int t);'
- returns the postcontrol point of `p' at node `t'.
-
- `pair postcontrol(path p, real t);'
- returns the effective postcontrol point of `p' at parameter
- `t'.
-
- `real arclength(path p);'
- returns the length (in user coordinates) of the piecewise
- linear or cubic curve that path `p' represents.
-
- `real arctime(path p, real L);'
- returns the path "time", a real number between 0 and the
- length of the path in the sense of `point(path p, real t)',
- at which the cumulative arclength (measured from the
- beginning of the path) equals `L'.
-
- `real arcpoint(path p, real L);'
- returns `point(p,arctime(p,L))'.
-
- `real dirtime(path p, pair z);'
- returns the first "time", a real number between 0 and the
- length of the path in the sense of `point(path, real)', at
- which the tangent to the path has the direction of pair `z',
- or -1 if this never happens.
-
- `real reltime(path p, real l);'
- returns the time on path `p' at the relative fraction `l' of
- its arclength.
-
- `pair relpoint(path p, real l);'
- returns the point on path `p' at the relative fraction `l' of
- its arclength.
-
- `pair midpoint(path p);'
- returns the point on path `p' at half of its arclength.
-
- `path reverse(path p);'
- returns a path running backwards along `p'.
-
- `path subpath(path p, int a, int b);'
- returns the subpath of `p' running from node `a' to node `b'.
- If `a' < `b', the direction of the subpath is reversed.
-
- `path subpath(path p, real a, real b);'
- returns the subpath of `p' running from path time `a' to path
- time `b', in the sense of `point(path, real)'. If `a' < `b',
- the direction of the subpath is reversed.
-
- `real[] intersect(path p, path q, real fuzz=-1);'
- If `p' and `q' have at least one intersection point, return a
- real array of length 2 containing the times representing the
- respective path times along `p' and `q', in the sense of
- `point(path, real)', for one such intersection point (as
- chosen by the algorithm described on page 137 of `The
- MetaFontbook'). The computations are performed to the
- absolute error specified by `fuzz', or if `fuzz < 0', to
- machine precision. If the paths do not intersect, return a
- real array of length 0.
-
- `real[][] intersections(path p, path q, real fuzz=-1);'
- Return all (unless there are infinitely many) intersection
- times of paths `p' and `q' as a sorted array of real arrays
- of length 2 (*note sort::). The computations are performed to
- the absolute error specified by `fuzz', or if `fuzz < 0', to
- machine precision.
-
- `real[] intersections(path p, explicit pair a, explicit pair b, real fuzz=-1);'
- Return all (unless there are infinitely many) intersection
- times of path `p' with the (infinite) line through points `a'
- and `b' as a sorted array. The intersections returned are
- guaranteed to be correct to within the absolute error
- specified by `fuzz', or if `fuzz < 0', to machine precision.
-
- `real[] times(path p, real x)'
- returns all intersection times of path `p' with the vertical
- line through `(x,0)'.
-
- `real[] times(path p, explicit pair z)'
- returns all intersection times of path `p' with the
- horizontal line through `(0,z.y)'.
-
- `real[] mintimes(path p)'
- returns an array of length 2 containing times at which path
- `p' reaches its minimal horizontal and vertical extents,
- respectively.
-
- `real[] maxtimes(path p)'
- returns an array of length 2 containing times at which path
- `p' reaches its maximal horizontal and vertical extents,
- respectively.
-
- `pair intersectionpoint(path p, path q, real fuzz=-1);'
- returns the intersection point
- `point(p,intersect(p,q,fuzz)[0])'.
-
- `pair[] intersectionpoints(path p, path q, real fuzz=-1);'
- returns an array containing all intersection points of the
- paths `p' and `q'.
-
- `pair extension(pair P, pair Q, pair p, pair q);'
- returns the intersection point of the extensions of the line
- segments `P--Q' and `p--q', or if the lines are parallel,
- `(infinity,infinity)'.
-
- `slice cut(path p, path knife, int n);'
- returns the portions of path `p' before and after the `n'th
- intersection of `p' with path `knife' as a structure `slice'
- (if no intersection exist is found, the entire path is
- considered to be `before' the intersection): struct slice {
- path before,after;
- }
- The argument `n' is treated as modulo the number of
- intersections.
-
- `slice firstcut(path p, path knife);'
- equivalent to `cut(p,knife,0);' Note that `firstcut.after'
- plays the role of the `MetaPost cutbefore' command.
-
- `slice lastcut(path p, path knife);'
- equivalent to `cut(p,knife,-1);' Note that `lastcut.before'
- plays the role of the `MetaPost cutafter' command.
-
- `path buildcycle(... path[] p);'
- This returns the path surrounding a region bounded by a list
- of two or more consecutively intersecting paths, following
- the behaviour of the `MetaPost buildcycle' command.
-
- `pair min(path p);'
- returns the pair (left,bottom) for the path bounding box of
- path `p'.
-
- `pair max(path p);'
- returns the pair (right,top) for the path bounding box of
- path `p'.
-
- `int windingnumber(path p, pair z);'
- returns the winding number of the cyclic path `p' relative to
- the point `z'. The winding number is positive if the path
- encircles `z' in the counterclockwise direction. If `z' lies
- on `p' the constant `undefined' (defined to be the largest
- odd integer) is returned.
-
- `bool interior(int windingnumber, pen fillrule)'
- returns true if `windingnumber' corresponds to an interior
- point according to `fillrule'.
-
- `bool inside(path p, pair z, pen fillrule=currentpen);'
- returns `true' iff the point `z' lies inside or on the edge of
- the region bounded by the cyclic path `p' according to the
- fill rule `fillrule' (*note fillrule::).
-
- `int inside(path p, path q, pen fillrule=currentpen);'
- returns `1' if the cyclic path `p' strictly contains `q'
- according to the fill rule `fillrule' (*note fillrule::), `-1'
- if the cyclic path `q' strictly contains `p', and `0'
- otherwise.
-
- `pair inside(path p, pen fillrule=currentpen);'
- returns an arbitrary point strictly inside a cyclic path `p'
- according to the fill rule `fillrule' (*note fillrule::).
-
- `path[] strokepath(path g, pen p=currentpen);'
- returns the path array that `PostScript' would fill in
- drawing path `g' with pen `p'.
-
-
-`guide'
- an unresolved cubic spline (list of cubic-spline nodes and control
- points). The implicit initializer for a guide is `nullpath'; this
- is useful for building up a guide within a loop.
-
- A guide is similar to a path except that the computation of the
- cubic spline is deferred until drawing time (when it is resolved
- into a path); this allows two guides with free endpoint conditions
- to be joined together smoothly. The solid curve in the following
- example is built up incrementally as a guide, but only resolved at
- drawing time; the dashed curve is incrementally resolved at each
- iteration, before the entire set of nodes (shown in red) is known:
-
- size(200);
-
- real mexican(real x) {return (1-8x^2)*exp(-(4x^2));}
-
- int n=30;
- real a=1.5;
- real width=2a/n;
-
- guide hat;
- path solved;
-
- for(int i=0; i < n; ++i) {
- real t=-a+i*width;
- pair z=(t,mexican(t));
- hat=hat..z;
- solved=solved..z;
- }
-
- draw(hat);
- dot(hat,red);
- draw(solved,dashed);
-
-
-
- We point out an efficiency distinction in the use of guides and
- paths: guide g;
- for(int i=0; i < 10; ++i)
- g=g--(i,i);
- path p=g;
-
- runs in linear time, whereas path p;
- for(int i=0; i < 10; ++i)
- p=p--(i,i);
-
- runs in quadratic time, as the entire path up to that point is
- copied at each step of the iteration.
-
- The following routines can be used to examine the individual
- elements of a guide without actually resolving the guide to a
- fixed path (except for internal cycles, which are resolved):
-
- `int size(guide g);'
- Analogous to `size(path p)'.
-
- `int length(guide g);'
- Analogous to `length(path p)'.
-
- `bool cyclic(path p);'
- Analogous to `cyclic(path p)'.
-
- `pair point(guide g, int t);'
- Analogous to `point(path p, int t)'.
-
- `guide reverse(guide g);'
- Analogous to `reverse(path p)'. If `g' is cyclic and also
- contains a secondary cycle, it is first solved to a path,
- then reversed. If `g' is not cyclic but contains an internal
- cycle, only the internal cycle is solved before reversal. If
- there are no internal cycles, the guide is reversed but not
- solved to a path.
-
- `pair[] dirSpecifier(guide g, int i);'
- This returns a pair array of length 2 containing the outgoing
- (in element 0) and incoming (in element 1) direction
- specifiers (or `(0,0)' if none specified) for the segment of
- guide `g' between nodes `i' and `i+1'.
-
- `pair[] controlSpecifier(guide g, int i);'
- If the segment of guide `g' between nodes `i' and `i+1' has
- explicit outgoing and incoming control points, they are
- returned as elements 0 and 1, respectively, of a two-element
- array. Otherwise, an empty array is returned.
-
- `tensionSpecifier tensionSpecifier(guide g, int i);'
- This returns the tension specifier for the segment of guide
- `g' between nodes `i' and `i+1'. The individual components of
- the `tensionSpecifier' type can be accessed as the virtual
- members `in', `out', and `atLeast'.
-
- `real[] curlSpecifier(guide g);'
- This returns an array containing the initial curl specifier
- (in element 0) and final curl specifier (in element 1) for
- guide `g'.
-
-
- As a technical detail we note that a direction specifier given to
- `nullpath' modifies the node on the other side: the guides a..{up}nullpath..b;
- c..nullpath{up}..d;
- e..{up}nullpath{down}..f;
- are respectively equivalent to a..nullpath..{up}b;
- c{up}..nullpath..d;
- e{down}..nullpath..{up}f;
-
-
-
-File: asymptote.info, Node: Pens, Next: Transforms, Prev: Paths and guides, Up: Programming
-
-6.3 Pens
-========
-
-In `Asymptote', pens provide a context for the four basic drawing
-commands (*note Drawing commands::). They are used to specify the
-following drawing attributes: color, line type, line width, line cap,
-line join, fill rule, text alignment, font, font size, pattern,
-overwrite mode, and calligraphic transforms on the pen nib. The default
-pen used by the drawing routines is called `currentpen'. This provides
-the same functionality as the `MetaPost' command `pickup'. The
-implicit initializer for pens is `defaultpen'.
-
- Pens may be added together with the nonassociative binary operator
-`+'. This will add the colors of the two pens. All other non-default
-attributes of the rightmost pen will override those of the leftmost
-pen. Thus, one can obtain a yellow dashed pen by saying
-`dashed+red+green' or `red+green+dashed' or `red+dashed+green'. The
-binary operator `*' can be used to scale the color of a pen by a real
-number, until it saturates with one or more color components equal to 1.
-
- * Colors are specified using one of the following colorspaces:
- `pen gray(real g);'
- This produces a grayscale color, where the intensity `g' lies
- in the interval [0,1], with 0.0 denoting black and 1.0
- denoting white.
-
- `pen rgb(real r, real g, real b);'
- This produces an RGB color, where each of the red, green, and
- blue intensities `r', `g', `b', lies in the interval [0,1].
-
- `pen cmyk(real c, real m, real y, real k);'
- This produces a CMYK color, where each of the cyan, magenta,
- yellow, and black intensities `c', `m', `y', `k', lies in the
- interval [0,1].
-
- `pen invisible;'
- This special pen writes in invisible ink, but adjusts the
- bounding box as if something had been drawn (like the
- `\phantom' command in TeX). The function `bool
- invisible(pen)' can be used to test whether a pen is
- invisible.
-
-
- The default color is `black'; this may be changed with the routine
- `defaultpen(pen)'. The function `colorspace(pen p)' returns the
- colorspace of pen `p' as a string (`"gray"', `"rgb"', `"cmyk"', or
- `""').
-
- The function `real[] colors(pen)' returns the color components of
- a pen. The functions `pen gray(pen)', `pen rgb(pen)', and `pen
- cmyk(pen)' return new pens obtained by converting their arguments
- to the respective color spaces. The function
- `colorless(pen=currentpen)' returns a copy of its argument with
- the color attributes stripped (to avoid color mixing).
-
- A 6-character RGB hexidecimal string can be converted to a pen with
- the routine pen rgb(string s);
- A pen can be converted to a hexidecimal string with
-
- * string hex(pen p);
-
- Various shades and mixtures of the grayscale primary colors
- `black' and `white', RGB primary colors `red', `green', and
- `blue', and RGB secondary colors `cyan', `magenta', and `yellow'
- are defined as named colors, along with the CMYK primary colors
- `Cyan', `Magenta', `Yellow', and `Black', in the module `plain':
-
-
-
- The standard 140 RGB `X11' colors can be imported with the command import x11colors;
- and the standard 68 CMYK TeX colors can be imported with the
- command import texcolors;
- Note that there is some overlap between these two standards and
- the definitions of some colors (e.g. `Green') actually disagree.
-
- `Asymptote' also comes with a `asycolors.sty' `LaTeX' package that
- defines to `LaTeX' CMYK versions of `Asymptote''s predefined
- colors, so that they can be used directly within `LaTeX' strings.
- Normally, such colors are passed to `LaTeX' via a pen argument;
- however, to change the color of only a portion of a string, say
- for a slide presentation, (*note slide::) it may be desirable to
- specify the color directly to `LaTeX'. This file can be passed to
- `LaTeX' with the `Asymptote' command usepackage("asycolors");
-
- The structure `hsv' defined in `plain_pens.asy' may be used to
- convert between HSV and RGB spaces, where the hue `h' is an angle
- in [0,360) and the saturation `s' and value `v' lie in `[0,1]': pen p=hsv(180,0.5,0.75);
- write(p); // ([default], red=0.375, green=0.75, blue=0.75)
- hsv q=p;
- write(q.h,q.s,q.v); // 180 0.5 0.75
-
- * Line types are specified with the function `pen linetype(real[] a,
- real offset=0, bool scale=true, bool adjust=true)', where `a' is
- an array of real array numbers. The optional parameter `offset'
- specifies where in the pattern to begin. The first number
- specifies how far (if `scale' is `true', in units of the pen line
- width; otherwise in `PostScript' units) to draw with the pen on,
- the second number specifies how far to draw with the pen off, and
- so on. If `adjust' is `true', these spacings are automatically
- adjusted by `Asymptote' to fit the arclength of the path. Here are
- the predefined line types: pen solid=linetype(new real[]);
- pen dotted=linetype(new real[] {0,4});
- pen dashed=linetype(new real[] {8,8});
- pen longdashed=linetype(new real[] {24,8});
- pen dashdotted=linetype(new real[] {8,8,0,8});
- pen longdashdotted=linetype(new real[] {24,8,0,8});
- pen Dotted(pen p=currentpen) {return linetype(new real[] {0,3})+2*linewidth(p);}
- pen Dotted=Dotted();
-
-
-
- The default line type is `solid'; this may be changed with
- `defaultpen(pen)'. The line type of a pen can be determined with
- the functions `real[] linetype(pen p=currentpen)', `real
- offset(pen p)', `bool scale(pen p)', and `bool adjust(pen p)'.
-
- * The pen line width is specified in `PostScript' units with `pen
- linewidth(real)'. The default line width is 0.5 bp; this value may
- be changed with `defaultpen(pen)'. The line width of a pen is
- returned by `real linewidth(pen p=currentpen)'. For convenience,
- in the module `plain_pens' we define void defaultpen(real w) {defaultpen(linewidth(w));}
- pen operator +(pen p, real w) {return p+linewidth(w);}
- pen operator +(real w, pen p) {return linewidth(w)+p;}
- so that one may set the line width like this: defaultpen(2);
- pen p=red+0.5;
-
- * A pen with a specific `PostScript' line cap is returned on calling
- `linecap' with an integer argument: pen squarecap=linecap(0);
- pen roundcap=linecap(1);
- pen extendcap=linecap(2);
-
- The default line cap, `roundcap', may be changed with
- `defaultpen(pen)'. The line cap of a pen is returned by `int
- linecap(pen p=currentpen)'.
-
- * A pen with a specific `PostScript' join style is returned on
- calling `linejoin' with an integer argument: pen miterjoin=linejoin(0);
- pen roundjoin=linejoin(1);
- pen beveljoin=linejoin(2);
-
- The default join style, `roundjoin', may be changed with
- `defaultpen(pen)'.The join style of a pen is returned by `int
- linejoin(pen p=currentpen)'.
-
- * A pen with a specific `PostScript' miter limit is returned by
- calling `miterlimit(real)'. The default miterlimit, `10.0', may
- be changed with `defaultpen(pen)'. The miter limit of a pen is
- returned by `real miterlimit(pen p=currentpen)'.
-
- * A pen with a specific `PostScript' fill rule is returned on
- calling `fillrule' with an integer argument: pen zerowinding=fillrule(0);
- pen evenodd=fillrule(1);
-
- The fill rule, which identifies the algorithm used to determine the
- insideness of a path or array of paths, only affects the `clip',
- `fill', and `inside' functions. For the `zerowinding' fill rule, a
- point `z' is outside the region bounded by a path if the number of
- upward intersections of the path with the horizontal line
- `z--z+infinity' minus the number of downward intersections is
- zero. For the `evenodd' fill rule, `z' is considered to be outside
- the region if the total number of such intersections is even. The
- default fill rule, `zerowinding', may be changed with
- `defaultpen(pen)'. The fill rule of a pen is returned by `int
- fillrule(pen p=currentpen)'.
-
- * A pen with a specific text alignment setting is returned on
- calling `basealign' with an integer argument: pen nobasealign=basealign(0);
- pen basealign=basealign(1);
-
- The default setting, `nobasealign',which may be changed with
- `defaultpen(pen)', causes the label alignment routines to use the
- full label bounding box for alignment. In contrast, `basealign'
- requests that the TeX baseline be respected. The base align
- setting of a pen is returned by `int basealigin(pen p=currentpen)'.
-
- * The font size is specified in TeX points (1 pt = 1/72.27 inches)
- with the function `pen fontsize(real size, real
- lineskip=1.2*size)'. The default font size, 12pt, may be changed
- with `defaultpen(pen)'. Nonstandard font sizes may require
- inserting import fontsize;
- at the beginning of the file (this requires the `type1cm' package
- available from
-
- `http://www.ctan.org/tex-archive/macros/latex/contrib/type1cm/'
- and included in recent `LaTeX' distributions). The font size and
- line skip of a pen can be examined with the routines `real
- fontsize(pen p=currentpen)' and `real lineskip(pen p=currentpen)',
- respectively.
-
- * A pen using a specific `LaTeX' `NFSS' font is returned by calling
- the function `pen font(string encoding, string family, string
- series, string shape)'. The default setting,
- `font("OT1","cmr","m","n")', corresponds to 12pt Computer Modern
- Roman; this may be changed with `defaultpen(pen)'. The font
- setting of a pen is returned by `string font(pen p=currentpen)'.
- Support for standardized international characters is provided by
- the `unicode' package (*note unicode::).
-
- Alternatively, one may select a fixed-size TeX font (on which
- `fontsize' has no effect) like `"cmr12"' (12pt Computer Modern
- Roman) or `"pcrr"' (Courier) using the function `pen font(string
- name)'. An optional size argument can also be given to scale the
- font to the requested size: `pen font(string name, real size)'.
-
- A nonstandard font command can be generated with `pen
- fontcommand(string)'.
-
- A convenient interface to the following standard `PostScript'
- fonts is also provided: pen AvantGarde(string series="m", string shape="n");
- pen Bookman(string series="m", string shape="n");
- pen Courier(string series="m", string shape="n");
- pen Helvetica(string series="m", string shape="n");
- pen NewCenturySchoolBook(string series="m", string shape="n");
- pen Palatino(string series="m", string shape="n");
- pen TimesRoman(string series="m", string shape="n");
- pen ZapfChancery(string series="m", string shape="n");
- pen Symbol(string series="m", string shape="n");
- pen ZapfDingbats(string series="m", string shape="n");
-
- * The transparency of a pen can be changed with the command: pen opacity(real opacity=1, string blend="Compatible");
- The opacity can be varied from `0' (fully transparent) to the
- default value of `1' (opaque), and `blend' specifies one of the
- following foreground-background blending operations: "Compatible","Normal","Multiply","Screen","Overlay","SoftLight",
- "HardLight","ColorDodge","ColorBurn","Darken","Lighten","Difference",
- "Exclusion","Hue","Saturation","Color","Luminosity",
- as described in
-
- `http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf'.
- Since `PostScript' does not support transparency, this feature is
- only effective with the `-f pdf' output format option; other
- formats can be produced from the resulting PDF file with the
- `ImageMagick' `convert' program. Labels are always drawn with an
- `opacity' of 1. A simple example of transparent filling is
- provided in the example file `transparency.asy'.
-
- * `PostScript' commands within a `picture' may be used to create a
- tiling pattern, identified by the string `name', for `fill' and
- `draw' operations by adding it to the global `PostScript' frame
- `currentpatterns', with optional left-bottom margin `lb' and
- right-top margin `rt'. import patterns;
- void add(string name, picture pic, pair lb=0, pair rt=0);
-
- To `fill' or `draw' using pattern `name', use the pen
- `pattern("name")'. For example, rectangular tilings can be
- constructed using the routines `picture tile(real Hx=5mm, real
- Hy=0, pen p=currentpen, filltype filltype=NoFill)', `picture
- checker(real Hx=5mm, real Hy=0, pen p=currentpen)', and `picture
- brick(real Hx=5mm, real Hy=0, pen p=currentpen)' defined in
- `patterns.asy': size(0,90);
- import patterns;
-
- add("tile",tile());
- add("filledtilewithmargin",tile(6mm,4mm,red,Fill),(1mm,1mm),(1mm,1mm));
- add("checker",checker());
- add("brick",brick());
-
- real s=2.5;
- filldraw(unitcircle,pattern("tile"));
- filldraw(shift(s,0)*unitcircle,pattern("filledtilewithmargin"));
- filldraw(shift(2s,0)*unitcircle,pattern("checker"));
- filldraw(shift(3s,0)*unitcircle,pattern("brick"));
-
-
-
- Hatch patterns can be generated with the routines `picture
- hatch(real H=5mm, pair dir=NE, pen p=currentpen)', `picture
- crosshatch(real H=5mm, pen p=currentpen)': size(0,100);
- import patterns;
-
- add("hatch",hatch());
- add("hatchback",hatch(NW));
- add("crosshatch",crosshatch(3mm));
-
- real s=1.25;
- filldraw(unitsquare,pattern("hatch"));
- filldraw(shift(s,0)*unitsquare,pattern("hatchback"));
- filldraw(shift(2s,0)*unitsquare,pattern("crosshatch"));
-
-
-
- You may need to turn off aliasing in your `PostScript' viewer for
- patterns to appear correctly. Custom patterns can easily be
- constructed, following the examples in `patterns.asy'. The tiled
- pattern can even incorporate shading (*note gradient shading::),
- as illustrated in this example (not included in the manual because
- not all printers support `PostScript' 3): size(0,100);
- import patterns;
-
- real d=4mm;
- picture tiling;
- path square=scale(d)*unitsquare;
- axialshade(tiling,square,white,(0,0),black,(d,d));
- fill(tiling,shift(d,d)*square,blue);
- add("shadedtiling",tiling);
-
- filldraw(unitcircle,pattern("shadedtiling"));
-
-
-
- * One can specify a custom pen nib as an arbitrary polygonal path
- with `pen makepen(path)'; this path represents the mark to be
- drawn for paths containing a single point. This pen nib path can be
- recovered from a pen with `path nib(pen)'. Unlike in `MetaPost',
- the path need not be convex:
-
- size(200);
- pen convex=makepen(scale(10)*polygon(8))+grey;
- draw((1,0.4),convex);
- draw((0,0)---(1,1)..(2,0)--cycle,convex);
-
- pen nonconvex=scale(10)*
- makepen((0,0)--(0.25,-1)--(0.5,0.25)--(1,0)--(0.5,1.25)--cycle)+red;
- draw((0.5,-1.5),nonconvex);
- draw((0,-1.5)..(1,-0.5)..(2,-1.5),nonconvex);
-
-
-
- The value `nullpath' represents a circular pen nib (the default);
- an elliptical pen can be achieved simply by multiplying the pen by
- a transform: `yscale(2)*currentpen'.
-
- * One can prevent labels from overwriting one another by using the
- pen attribute `overwrite', which takes a single argument:
-
- `Allow'
- Allow labels to overwrite one another. This is the default
- behaviour (unless overridden with `defaultpen(pen)'.
-
- `Suppress'
- Suppress, with a warning, each label that would overwrite
- another label.
-
- `SuppressQuiet'
- Suppress, without warning, each label that would overwrite
- another label.
-
- `Move'
- Move a label that would overwrite another out of the way and
- issue a warning. As this adjustment is during the final
- output phase (in `PostScript' coordinates) it could result in
- a larger figure than requested.
-
- `MoveQuiet'
- Move a label that would overwrite another out of the way,
- without warning. As this adjustment is during the final
- output phase (in `PostScript' coordinates) it could result in
- a larger figure than requested.
-
-
-
- The routine `defaultpen()' returns the current default pen
-attributes. Calling the routine `resetdefaultpen()' resets all pen
-default attributes to their initial values.
-
-
-File: asymptote.info, Node: Transforms, Next: Frames and pictures, Prev: Pens, Up: Programming
-
-6.4 Transforms
-==============
-
-`Asymptote' makes extensive use of affine transforms. A pair `(x,y)' is
-transformed by the transform `t=(t.x,t.y,t.xx,t.xy,t.yx,t.yy)' to
-`(x',y')', where
-x' = t.x + t.xx * x + t.xy * y
-y' = t.y + t.yx * x + t.yy * y
- This is equivalent to the `PostScript' transformation `[t.xx t.yx t.xy
-t.yy t.x t.y]'.
-
- Transforms can be applied to pairs, guides, paths, pens, strings,
-transforms, frames, and pictures by multiplication (via the binary
-operator `*') on the left (*note circle:: for an example). Transforms
-can be composed with one another and inverted with the function
-`transform inverse(transform t)'; they can also be raised to any
-integer power with the `^' operator.
-
- The built-in transforms are:
-
-`transform identity();'
- the identity transform;
-
-`transform shift(pair z);'
- translates by the pair `z';
-
-`transform shift(real x, real y);'
- translates by the pair `(x,y)';
-
-`transform xscale(real x);'
- scales by `x' in the x direction;
-
-`transform yscale(real y);'
- scales by `y' in the y direction;
-
-`transform scale(real s);'
- scale by `s' in both x and y directions;
-
-`transform scale(real x, real y);'
- scale by `x' in the x direction and by `y' in the y direction;
-
-`transform slant(real s);'
- maps `(x,y)' -> `(x+s*y,y)';
-
-`transform rotate(real angle, pair z=(0,0));'
- rotates by `angle' in degrees about `z';
-
-`transform reflect(pair a, pair b);'
- reflects about the line `a--b'.
-
- The implicit initializer for transforms is `identity()'. The
-routines `shift(transform t)' and `shiftless(transform t)' return the
-transforms `(t.x,t.y,0,0,0,0)' and `(0,0,t.xx,t.xy,t.yx,t.yy)'
-respectively.
-
-
-File: asymptote.info, Node: Frames and pictures, Next: Files, Prev: Transforms, Up: Programming
-
-6.5 Frames and pictures
-=======================
-
-`frame'
- Frames are canvases for drawing in `PostScript' coordinates. While
- working with frames directly is occasionally necessary for
- constructing deferred drawing routines, pictures are usually more
- convenient to work with. The implicit initializer for frames is
- `newframe'. The function `bool empty(frame f)' returns `true' only
- if the frame `f' is empty. A frame may be erased with the
- `erase(frame)' routine. The functions `pair min(frame)' and `pair
- max(frame)' return the (left,bottom) and (right,top) coordinates
- of the frame bounding box, respectively. The contents of frame
- `src' may be appended to frame `dest' with the command void add(frame dest, frame src);
- or prepended with void prepend(frame dest, frame src);
- A frame obtained by aligning frame `f' in the direction `align',
- in a manner analogous to the `align' argument of `label' (*note
- label::), is returned by frame align(frame f, pair align);
-
- To draw or fill a box or ellipse around a label or frame and
- return the boundary as a path, use one of the predefined
- `envelope' routines path box(frame f, Label L="", real xmargin=0,
- real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill, bool above=true);
- path roundbox(frame f, Label L="", real xmargin=0,
- real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill, bool above=true);
- path ellipse(frame f, Label L="", real xmargin=0,
- real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill, bool above=true);
-
-`picture'
- Pictures are high-level structures (*note Structures::) defined in
- the module `plain' that provide canvases for drawing in user
- coordinates. The default picture is called `currentpicture'. A
- new picture can be created like this: picture pic;
- Anonymous pictures can be made by the expression `new picture'.
-
- The `size' routine specifies the dimensions of the desired picture:
-
- void size(picture pic=currentpicture, real x, real y=x,
- bool keepAspect=Aspect);
-
- If the `x' and `y' sizes are both 0, user coordinates will be
- interpreted as `PostScript' coordinates. In this case, the
- transform mapping `pic' to the final output frame is `identity()'.
-
- If exactly one of `x' or `y' is 0, no size restriction is imposed
- in that direction; it will be scaled the same as the other
- direction.
-
- If `keepAspect' is set to `Aspect' or `true', the picture will be
- scaled with its aspect ratio preserved such that the final width
- is no more than `x' and the final height is no more than `y'.
-
- If `keepAspect' is set to `IgnoreAspect' or `false', the picture
- will be scaled in both directions so that the final width is `x'
- and the height is `y'.
-
- To make the user coordinates of picture `pic' represent multiples
- of `x' units in the x direction and `y' units in the y direction,
- use void unitsize(picture pic=currentpicture, real x, real y=x);
- When nonzero, these `x' and `y' values override the corresponding
- size parameters of picture `pic'.
-
- The routine void size(picture pic=currentpicture, real xsize, real ysize,
- pair min, pair max);
- forces the final picture scaling to map the user coordinates
- `box(min,max)' to a region of width `xsize' and height `ysize'
- (when these parameters are nonzero).
-
- Alternatively, calling the routine transform fixedscaling(picture pic=currentpicture, pair min,
- pair max, pen p=nullpen, bool warn=false);
- will cause picture `pic' to use a fixed scaling to map user
- coordinates in `box(min,max)' to the (already specified) picture
- size, taking account of the width of pen `p'. A warning will be
- issued if the final picture exceeds the specified size.
-
- A picture `pic' can be fit to a frame and output to a file
- `prefix'.`format' using image format `format' by calling the
- `shipout' function: void shipout(string prefix=defaultfilename, picture pic=currentpicture,
- orientation orientation=orientation,
- string format="", bool wait=false, bool view=true,
- string options="", string script="",
- light light=currentlight, projection P=currentprojection)
- The default output format, `PostScript', may be changed with the
- `-f' or `-tex' command-line options. The `options', `script', and
- `projection' parameters are only relevant for 3D pictures. If
- `defaultfilename' is an empty string, the prefix `outprefix()'
- will be used.
-
- A `shipout()' command is added implicitly at file exit if no
- previous `shipout' commands have been executed. The default page
- orientation is `Portrait'; this may be modified by changing the
- variable `orientation'. To output in landscape mode, simply set
- the variable `orientation=Landscape' or issue the command shipout(Landscape);
-
- To rotate the page by -90 degrees, use the orientation `Seascape'. The
- orientation `UpsideDown' rotates the page by 180 degrees.
-
- A picture `pic' can be explicitly fit to a frame by calling frame pic.fit(real xsize=pic.xsize, real ysize=pic.ysize,
- bool keepAspect=pic.keepAspect);
- The default size and aspect ratio settings are those given to the
- `size' command (which default to `0', `0', and `true',
- respectively). The transformation that would currently be used to
- fit a picture `pic' to a frame is returned by the member function
- `pic.calculateTransform()'.
-
- In certain cases (e.g. 2D graphs) where only an approximate size
- estimate for `pic' is available, the picture fitting routine frame pic.scale(real xsize=this.xsize, real ysize=this.ysize,
- bool keepAspect=this.keepAspect);
- (which scales the resulting frame, including labels and fixed-size
- objects) will enforce perfect compliance with the requested size
- specification, but should not normally be required.
-
- To draw a bounding box with margins around a picture, fit the
- picture to a frame using the function frame bbox(picture pic=currentpicture, real xmargin=0,
- real ymargin=xmargin, pen p=currentpen,
- filltype filltype=NoFill);
- Here `filltype' specifies one of the following fill types:
- `FillDraw'
- Fill the interior and draw the boundary.
-
- `FillDraw(real xmargin=0, real ymargin=xmargin, pen fillpen=nullpen,'
- `pen drawpen=nullpen)' If `fillpen' is `nullpen', fill with
- the drawing pen; otherwise fill with pen `fillpen'. If
- `drawpen' is `nullpen', draw the boundary with `fillpen';
- otherwise with `drawpen'. An optional margin of `xmargin' and
- `ymargin' can be specified.
-
- `Fill'
- Fill the interior.
-
- `Fill(real xmargin=0, real ymargin=xmargin, pen p=nullpen)'
- If `p' is `nullpen', fill with the drawing pen; otherwise
- fill with pen `p'. An optional margin of `xmargin' and
- `ymargin' can be specified.
-
- `NoFill'
- Do not fill.
-
- `Draw'
- Draw only the boundary.
-
- `Draw(real xmargin=0, real ymargin=xmargin, pen p=nullpen)'
- If `p' is `nullpen', draw the boundary with the drawing pen;
- otherwise draw with pen `p'. An optional margin of `xmargin'
- and `ymargin' can be specified.
-
- `UnFill'
- Clip the region.
-
- `UnFill(real xmargin=0, real ymargin=xmargin)'
- Clip the region and surrounding margins `xmargin' and
- `ymargin'.
-
- `RadialShade(pen penc, pen penr)'
- Fill varying radially from `penc' at the center of the
- bounding box to `penr' at the edge.
-
- `RadialShadeDraw(real xmargin=0, real ymargin=xmargin, pen penc,'
- `pen penr, pen drawpen=nullpen)' Fill with RadialShade and
- draw the boundary.
-
-
- For example, to draw a bounding box around a picture with a 0.25 cm
- margin and output the resulting frame, use the command: shipout(bbox(0.25cm));
- A `picture' may be fit to a frame with the background color pen
- `p', using the function `bbox(p,Fill)'.
-
- The functions pair min(picture pic, user=false);
- pair max(picture pic, user=false);
- pair size(picture pic, user=false);
- calculate the bounds that picture `pic' would have if it were
- currently fit to a frame using its default size specification. If
- `user' is `false' the returned value is in `PostScript'
- coordinates, otherwise it is in user coordinates.
-
- The function pair point(picture pic=currentpicture, pair dir, bool user=true);
- is a convenient way of determining the point on the bounding box
- of `pic' in the direction `dir' relative to its center, ignoring
- the contributions from fixed-size objects (such as labels and
- arrowheads). If `user' is `true' the returned value is in user
- coordinates, otherwise it is in `PostScript' coordinates.
-
- The function pair truepoint(picture pic=currentpicture, pair dir, bool user=true);
- is identical to `point', except that it also accounts for
- fixed-size objects, using the scaling transform that picture `pic'
- would have if currently fit to a frame using its default size
- specification. If `user' is `true' the returned value is in user
- coordinates, otherwise it is in `PostScript' coordinates.
-
- Sometimes it is useful to draw objects on separate pictures and
- add one picture to another using the `add' function: void add(picture src, bool group=true,
- filltype filltype=NoFill, bool above=true);
- void add(picture dest, picture src, bool group=true,
- filltype filltype=NoFill, bool above=true);
- The first example adds `src' to `currentpicture'; the second one
- adds `src' to `dest'. The `group' option specifies whether or not
- the graphical user interface `xasy' should treat all of the
- elements of `src' as a single entity (*note GUI::), `filltype'
- requests optional background filling or clipping, and `above'
- specifies whether to add `src' above or below existing objects.
-
- There are also routines to add a picture or frame `src' specified
- in postscript coordinates to another picture `dest' (or
- `currentpicture') about the user coordinate `position': void add(picture src, pair position, bool group=true,
- filltype filltype=NoFill, bool above=true);
- void add(picture dest, picture src, pair position,
- bool group=true, filltype filltype=NoFill, bool above=true);
- void add(picture dest=currentpicture, frame src, pair position=0,
- bool group=true, filltype filltype=NoFill, bool above=true);
- void add(picture dest=currentpicture, frame src, pair position,
- pair align, bool group=true, filltype filltype=NoFill,
- bool above=true);
-
- The optional `align' argument in the last form specifies a
- direction to use for aligning the frame, in a manner analogous to
- the `align' argument of `label' (*note label::). However, one key
- difference is that when `align' is not specified, labels are
- centered, whereas frames and pictures are aligned so that their
- origin is at `position'. Illustrations of frame alignment can be
- found in the examples *note errorbars:: and *note image::. If you
- want to align three or more subpictures, group them two at a time:
-
- picture pic1;
- real size=50;
- size(pic1,size);
- fill(pic1,(0,0)--(50,100)--(100,0)--cycle,red);
-
- picture pic2;
- size(pic2,size);
- fill(pic2,unitcircle,green);
-
- picture pic3;
- size(pic3,size);
- fill(pic3,unitsquare,blue);
-
- picture pic;
- add(pic,pic1.fit(),(0,0),N);
- add(pic,pic2.fit(),(0,0),10S);
-
- add(pic.fit(),(0,0),N);
- add(pic3.fit(),(0,0),10S);
-
-
-
- Alternatively, one can use `attach' to automatically increase the
- size of picture `dest' to accommodate adding a frame `src' about
- the user coordinate `position': void attach(picture dest=currentpicture, frame src,
- pair position=0, bool group=true,
- filltype filltype=NoFill, bool above=true);
- void attach(picture dest=currentpicture, frame src,
- pair position, pair align, bool group=true,
- filltype filltype=NoFill, bool above=true);
-
- To erase the contents of a picture (but not the size
- specification), use the function void erase(picture pic=currentpicture);
-
- To save a snapshot of `currentpicture', `currentpen', and
- `currentprojection', use the function `save()'.
-
- To restore a snapshot of `currentpicture', `currentpen', and
- `currentprojection', use the function `restore()'.
-
- Many further examples of picture and frame operations are provided
- in the base module `plain'.
-
- It is possible to insert verbatim `PostScript' commands in a
- picture with one of the routines void postscript(picture pic=currentpicture, string s);
- void postscript(picture pic=currentpicture, string s, pair min,
- pair max)
- Here `min' and `max' can be used to specify explicit bounds
- associated with the resulting `PostScript' code.
-
- Verbatim TeX commands can be inserted in the intermediate `LaTeX'
- output file with one of the functions void tex(picture pic=currentpicture, string s);
- void tex(picture pic=currentpicture, string s, pair min, pair max)
- Here `min' and `max' can be used to specify explicit bounds
- associated with the resulting TeX code.
-
- To issue a global TeX command (such as a TeX macro definition) in
- the TeX preamble (valid for the remainder of the top-level module)
- use: void texpreamble(string s);
-
- The TeX environment can be reset to its initial state, clearing all
- macro definitions, with the function void texreset();
-
- The routine void usepackage(string s, string options="");
- provides a convenient abbreviation for texpreamble("\usepackage["+options+"]{"+s+"}");
- that can be used for importing `LaTeX' packages.
-
-
-
-File: asymptote.info, Node: Files, Next: Variable initializers, Prev: Frames and pictures, Up: Programming
-
-6.6 Files
-=========
-
-`Asymptote' can read and write text files (including comma-separated
-value) files and portable XDR (External Data Representation) binary
-files.
-
- An input file must first be opened with
-input(string name="", bool check=true, string comment="#", string mode="");
- reading is then done by assignment:
-file fin=input("test.txt");
-real a=fin;
-
- If the optional boolean argument `check' is `false', no check will
-be made that the file exists. If the file does not exist or is not
-readable, the function `bool error(file)' will return `true'. The
-first character of the string `comment' specifies a comment character.
-If this character is encountered in a data file, the remainder of the
-line is ignored. When reading strings, a comment character followed
-immediately by another comment character is treated as a single literal
-comment character.
-
- One can change the current working directory for read operations to
-the contents of the string `s' with the function `string cd(string s)',
-which returns the new working directory. If `string s' is empty, the
-path is reset to the value it had at program startup.
-
- When reading pairs, the enclosing parenthesis are optional. Strings
-are also read by assignment, by reading characters up to but not
-including a newline. In addition, `Asymptote' provides the function
-`string getc(file)' to read the next character (treating the comment
-character as an ordinary character) and return it as a string.
-
- A file named `name' can be open for output with
-file output(string name="", bool update=false, string comment="#", string mode="");
- If `update=false', any existing data in the file will be erased and
-only write operations can be used on the file. If `update=true', any
-existing data will be preserved, the position will be set to the
-end-of-file, and both reading and writing operations will be enabled.
-For security reasons, writing to files in directories other than the
-current directory is allowed only if the `-globalwrite' (or `-nosafe')
-command-line option is specified. The function `string mktemp(string
-s)' may be used to create and return the name of a unique temporary
-file in the current directory based on the string `s'.
-
- There are two special files: `stdin', which reads from the keyboard,
-and `stdout', which writes to the terminal. The implicit initializer
-for files is `null'.
-
- Data of a built-in type `T' can be written to an output file by
-calling one of the functions
-write(string s="", T x, suffix suffix=endl ... T[]);
-write(file file, string s="", T x, suffix suffix=none ... T[]);
-write(file file=stdout, string s="", explicit T[] x ... T[][]);
-write(file file=stdout, T[][]);
-write(file file=stdout, T[][][]);
-write(suffix suffix=endl);
-write(file file, suffix suffix=none);
- If `file' is not specified, `stdout' is used and terminated by default
-with a newline. If specified, the optional identifying string `s' is
-written before the data `x'. An arbitrary number of data values may be
-listed when writing scalars or one-dimensional arrays. The `suffix' may
-be one of the following: `none' (do nothing), `flush' (output buffered
-data), `endl' (terminate with a newline and flush), `newl' (terminate
-with a newline), `DOSendl' (terminate with a DOS newline and flush),
-`DOSnewl' (terminate with a DOS newline), `tab' (terminate with a tab),
-or `comma' (terminate with a comma). Here are some simple examples of
-data output:
-file fout=output("test.txt");
-write(fout,1); // Writes "1"
-write(fout); // Writes a new line
-write(fout,"List: ",1,2,3); // Writes "List: 1 2 3"
- A file may be opened with `mode="xdr"', to read or write double
-precision (64-bit) reals and single precision (32-bit) integers in Sun
-Microsystem's XDR (External Data Representation) portable binary format
-(available on all `UNIX' platforms). Alternatively, a file may also be
-opened with `mode="binary"' to read or write double precision reals and
-single precision integers in the native (nonportable) machine binary
-format. The virtual member functions `file singlereal(bool b=true)'
-and `file singleint(bool b=true)' be used to change the precision of
-real and integer I/O operations, respectively, for an XDR or binary
-file `f'. Similarly, the function `file signedint(bool b=true)' can be
-used to modify the signedness of integer reads and writes for an XDR or
-binary file `f'.
-
- The virtual members `name', `mode', `singlereal', `singleint', and
-`signedint' may be used to query the respective parameters for a given
-file.
-
- One can test a file for end-of-file with the boolean function
-`eof(file)', end-of-line with `eol(file)', and for I/O errors with
-`error(file)'. One can flush the output buffers with `flush(file)',
-clear a previous I/O error with `clear(file)', and close the file with
-`close(file)'. The function `int precision(file file=stdout, int
-digits=0)' sets the number of digits of output precision for `file' to
-`digits', provided `digits' is nonzero, and returns the previous
-precision setting. The function `int tell(file)' returns the current
-position in a file relative to the beginning. The routine `seek(file
-file, int pos)' can be used to change this position, where a negative
-value for the position `pos' is interpreted as relative to the
-end-of-file. For example, one can rewind a file `file' with the command
-`seek(file,0)' and position to the final character in the file with
-`seek(file,-1)'. The command `seekeof(file)' sets the position to the
-end of the file.
-
- Assigning `settings.scroll=n' for a positive integer `n' requests a
-pause after every `n' output lines to `stdout'. One may then press
-`Enter' to continue to the next `n' output lines, `s' followed by
-`Enter' to scroll without further interruption, or `q' followed by
-`Enter' to quit the current output operation. If `n' is negative, the
-output scrolls a page at a time (i.e. by one less than the current
-number of display lines). The default value, `settings.scroll=0',
-specifies continuous scrolling.
-
- The routines
-string getstring(string name="", string default="", string prompt="",
- bool store=true);
-int getint(string name="", int default=0, string prompt="",
- bool store=true);
-real getreal(string name="", real default=0, string prompt="",
- bool store=true);
-pair getpair(string name="", pair default=0, string prompt="",
- bool store=true);
-triple gettriple(string name="", triple default=(0,0,0), string prompt="",
- bool store=true);
- defined in the module `plain' may be used to prompt for a value from
-`stdin' using the GNU `readline' library. If `store=true', the history
-of values for `name' is stored in the file `".asy_history_"+name'
-(*note history::). The most recent value in the history will be used to
-provide a default value for subsequent runs. The default value
-(initially `default') is displayed after `prompt'. These functions are
-based on the internal routines
-string readline(string prompt="", string name="", bool tabcompletion=false);
-void saveline(string name, string value, bool store=true);
- Here, `readline' prompts the user with the default value formatted
-according to `prompt', while `saveline' is used to save the string
-`value' in a local history named `name', optionally storing the local
-history in a file `".asy_history_"+name'.
-
- The routine `history(string name, int n=1)' can be used to look up
-the `n' most recent values (or all values up to `historylines' if
-`n=0') entered for string `name'. The routine `history(int n=0)'
-returns the interactive history. For example,
-write(output("transcript.asy"),history());
- outputs the interactive history to the file `transcript.asy'.
-
- The function `int delete(string s)' deletes the file named by the
-string `s'. Unless the `-globalwrite' (or `-nosafe') option is enabled,
-the file must reside in the current directory. The function `int
-rename(string from, string to)' may be used to rename file `from' to
-file `to'. Unless the `-globalwrite' (or `-nosafe') option is enabled,
-this operation is restricted to the current directory. The functions
-int convert(string args="", string file="", string format="");
-int animate(string args="", string file="", string format="");
- call the `ImageMagick' commands `convert' and `animate', respectively,
-with the arguments `args' and the file name constructed from the
-strings `file' and `format'.
-
-
-File: asymptote.info, Node: Variable initializers, Next: Structures, Prev: Files, Up: Programming
-
-6.7 Variable initializers
-=========================
-
-A variable can be assigned a value when it is declared, as in `int
-x=3;' where the variable `x' is assigned the value `3'. As well as
-literal constants such as `3', arbitary expressions can be used as
-initializers, as in `real x=2*sin(pi/2);'.
-
- A variable is not added to the namespace until after the initializer
-is evaluated, so for example, in
-int x=2;
-int x=5*x;
- the `x' in the initializer on the second line refers to the variable
-`x' declared on the first line. The second line, then, declares a
-variable `x' shadowing the original `x' and initializes it to the value
-`10'.
-
- Variables of most types can be declared without an explicit
-initializer and they will be initialized by the default initializer of
-that type:
-
- * Variables of the numeric types `int', `real', and `pair' are all
- initialized to zero; variables of type `triple' are initialized to
- `O=(0,0,0)'.
-
- * `boolean' variables are initialized to `false'.
-
- * `string' variables are initialized to the empty string.
-
- * `transform' variables are initialized to the identity
- transformation.
-
- * `path' and `guide' variables are initialized to `nullpath'.
-
- * `pen' variables are initialized to the default pen.
-
- * `frame' and `picture' variables are initialized to empty frames
- and pictures, respectively.
-
- * `file' variables are initialized to `null'.
-
- The default initializers for user-defined array, structure, and
-function types are explained in their respective sections. Some types,
-such as `code', do not have default initializers. When a variable of
-such a type is introduced, the user must initialize it by explicitly
-giving it a value.
-
- The default initializer for any type `T' can be redeclared by
-defining the function `T operator init()'. For instance, `int'
-variables are usually initialized to zero, but in
-int operator init() {
- return 3;
-}
-int y;
-
-the variable `y' is initialized to `3'. This example was given for
-illustrative purposes; redeclaring the initializers of built-in types
-is not recommended. Typically, `operator init' is used to define
-sensible defaults for user-defined types.
-
- The special type `var' may be used to infer the type of a variable
-from its initializer. If the initializer is an expression of a unique
-type, then the variable will be defined with that type. For instance,
-var x=5;
-var y=4.3;
-var reddash=red+dashed;
- is equivalent to
-int x=5;
-real y=4.3;
-pen reddash=red+dashed;
-
- `var' may also be used with the extended `for' loop syntax.
-
-int[] a = {1,2,3};
-for (var x : a)
- write(x);
-
-
-File: asymptote.info, Node: Structures, Next: Operators, Prev: Variable initializers, Up: Programming
-
-6.8 Structures
-==============
-
-Users may also define their own data types as structures, along with
-user-defined operators, much as in C++. By default, structure members
-are `public' (may be read and modified anywhere in the code), but may be
-optionally declared `restricted' (readable anywhere but writeable only
-inside the structure where they are defined) or `private' (readable and
-writable only inside the structure). In a structure definition, the
-keyword `this' can be used as an expression to refer to the enclosing
-structure. Any code at the top-level scope within the structure is
-executed on initialization.
-
- Variables hold references to structures. That is, in the example:
-struct T {
- int x;
-}
-
-T foo=new T;
-T bar=foo;
-bar.x=5;
-
- The variable `foo' holds a reference to an instance of the structure
-`T'. When `bar' is assigned the value of `foo', it too now holds a
-reference to the same instance as `foo' does. The assignment `bar.x=5'
-changes the value of the field `x' in that instance, so that `foo.x'
-will also be equal to `5'.
-
- The expression `new T' creates a new instance of the structure `T'
-and returns a reference to that instance. In creating the new
-instance, any code in the body of the record definition is executed.
-For example:
-int Tcount=0;
-struct T {
- int x;
- ++Tcount;
-}
-
-T foo=new T;
-
- Here, the expression `new T' will produce a new instance of the
-class, but will also cause `Tcount' to be incremented, so that it keeps
-track of the number of instances produced.
-
- The expression `null' can be cast to any structure type to yield a
-null reference, a reference that does not actually refer to any
-instance of the structure. Trying to use a field of a null reference
-will cause an error.
-
- The function `bool alias(T,T)' checks to see if two structure
-references refer to the same instance of the structure (or both to
-`null'). For example, in the example code at the start of the section,
-`alias(foo,bar)' would return true, but `alias(foo,new T)' would return
-false, as `new T' creates a new instance of the structure `T'. The
-boolean operators `==' and `!=' are by default equivalent to `alias' and
-`!alias' respectively, but may be overwritten for a particular type
-(for example, to do a deep comparison).
-
- After the definition of a structure `T', a variable of type `T' is
-initialized to a new instance (`new T') by default. During the
-definition of the structure, however, variables of type `T' are
-initialized to `null' by default. This special behaviour is to avoid
-infinite recursion of creating new instances in code such as
-struct tree {
- int value;
- tree left;
- tree right;
-}
-
- Here is a simple example that illustrates the use of structures:
-struct S {
- real a=1;
- real f(real a) {return a+this.a;}
-}
-
-S s; // Initializes s with new S;
-
-write(s.f(2)); // Outputs 3
-
-S operator + (S s1, S s2)
-{
- S result;
- result.a=s1.a+s2.a;
- return result;
-}
-
-write((s+s).f(0)); // Outputs 2
-
- It is often convenient to have functions that construct new
-instances of a structure. Say we have a `Person' structure:
-struct Person {
- string firstname;
- string lastname;
-}
-
-Person joe=new Person;
-joe.firstname="Joe";
-joe.lastname="Jones";
- Creating a new Person is a chore; it takes three lines to create a new
-instance and to initialize its fields (that's still considerably less
-effort than creating a new person in real life, though).
-
- We can reduce the work by defining a constructor function
-`Person(string,string)':
-struct Person {
- string firstname;
- string lastname;
-
- static Person Person(string firstname, string lastname) {
- Person p=new Person;
- p.firstname=firstname;
- p.lastname=lastname;
- return p;
- }
-}
-
-Person joe=Person.Person("Joe", "Jones");
-
- While it is now easier than before to create a new instance, we still
-have to refer to the constructor by the qualified name `Person.Person'.
-If we add the line
-from Person unravel Person;
- immediately after the structure definition, then the constructor can
-be used without qualification: `Person joe=Person("Joe", "Jones");'.
-
- The constructor is now easy to use, but it is quite a hassle to
-define. If you write a lot of constructors, you will find that you are
-repeating a lot of code in each of them. Fortunately, your friendly
-neighbourhood Asymptote developers have devised a way to automate much
-of the process.
-
- If, in the body of a structure, Asymptote encounters the definition
-of a function of the form `void operator init(ARGS)', it implicitly
-defines a constructor function of the arguments `ARGS' that uses the
-`void operator init' function to initialize a new instance of the
-structure. That is, it essentially defines the following constructor
-(assuming the structure is called `Foo'):
-
- static Foo Foo(ARGS) {
- Foo instance=new Foo;
- instance.operator init(ARGS);
- return instance;
- }
-
- This constructor is also implicitly copied to the enclosing scope
-after the end of the structure definition, so that it can used
-subsequently without qualifying it by the structure name. Our `Person'
-example can thus be implemented as:
-struct Person {
- string firstname;
- string lastname;
-
- void operator init(string firstname, string lastname) {
- this.firstname=firstname;
- this.lastname=lastname;
- }
-}
-
-Person joe=Person("Joe", "Jones");
-
- The use of `operator init' to implicitly define constructors should
-not be confused with its use to define default values for variables
-(*note Variable initializers::). Indeed, in the first case, the return
-type of the `operator init' must be `void' while in the second, it must
-be the (non-`void') type of the variable.
-
- The function `cputime()' returns a structure `cputime' with
-cumulative CPU times broken down into the fields `parent.user',
-`parent.system', `child.user', and `child.system'. For convenience, the
-incremental fields `change.user' and `change.system' indicate the
-change in the corresponding total parent and child CPU times since the
-last call to `cputime()'. The function
-void write(file file=stdout, string s="", cputime c,
- string format=cputimeformat, suffix suffix=none);
- displays the incremental user cputime followed by "u", the incremental
-system cputime followed by "s", the total user cputime followed by "U",
-and the total system cputime followed by "S".
-
- Much like in C++, casting (*note Casts::) provides for an elegant
-implementation of structure inheritance, including virtual functions:
-struct parent {
- real x;
- void operator init(int x) {this.x=x;}
- void virtual(int) {write(0);}
- void f() {virtual(1);}
-}
-
-void write(parent p) {write(p.x);}
-
-struct child {
- parent parent;
- real y=3;
- void operator init(int x) {parent.operator init(x);}
- void virtual(int x) {write(x);}
- parent.virtual=virtual;
- void f()=parent.f;
-}
-
-parent operator cast(child child) {return child.parent;}
-
-parent p=parent(1);
-child c=child(2);
-
-write(c); // Outputs 2;
-
-p.f(); // Outputs 0;
-c.f(); // Outputs 1;
-
-write(c.parent.x); // Outputs 2;
-write(c.y); // Outputs 3;
-
- For further examples of structures, see `Legend' and `picture' in
-the `Asymptote' base module `plain'.
-
-
-File: asymptote.info, Node: Operators, Next: Implicit scaling, Prev: Structures, Up: Programming
-
-6.9 Operators
-=============
-
-* Menu:
-
-* Arithmetic & logical:: Basic mathematical operators
-* Self & prefix operators:: Increment and decrement
-* User-defined operators:: Overloading operators
-
-
-File: asymptote.info, Node: Arithmetic & logical, Next: Self & prefix operators, Up: Operators
-
-6.9.1 Arithmetic & logical operators
-------------------------------------
-
-`Asymptote' uses the standard binary arithmetic operators. However,
-when one integer is divided by another, both arguments are converted to
-real values before dividing and a real quotient is returned (since this
-is usually what is intended). The function `int quotient(int x, int y)'
-returns the greatest integer less than or equal to `x/y'. In all other
-cases both operands are promoted to the same type, which will also be
-the type of the result:
-`+'
- addition
-
-`-'
- subtraction
-
-`*'
- multiplication
-
-`/'
- division
-
-`%'
- modulo; the result always has the same sign as the divisor. In
- particular, this makes `q*quotient(p,q)+p%q == p' for all integers
- `p' and nonzero integers `q'.
-
-`^'
- power; if the exponent (second argument) is an int, recursive
- multiplication is used; otherwise, logarithms and exponentials are
- used (`**' is a synonym for `^').
-
-
- The usual boolean operators are also defined:
-`=='
- equals
-
-`!='
- not equals
-
-`<'
- less than
-
-`<='
- less than or equals
-
-`>='
- greater than or equals
-
-`>'
- greater than
-
-`&&'
- and (with conditional evaluation of right-hand argument)
-
-`&'
- and
-
-`||'
- or (with conditional evaluation of right-hand argument)
-
-`|'
- or
-
-`^'
- xor
-
-`!'
- not
-
- `Asymptote' also supports the C-like conditional syntax:
-bool positive=(pi > 0) ? true : false;
-
- The function `T interp(T a, T b, real t)' returns `(1-t)*a+t*b' for
-nonintegral built-in arithmetic types `T'. If `a' and `b' are pens,
-they are first promoted to the same color space.
-
- `Asymptote' also defines bitwise functions `int AND(int,int)', `int
-OR(int,int)', `int XOR(int,int)', `int NOT(int)', `int CLZ(int)' (count
-leading zeros), and `int CTZ(int)' (count trailing zeros).
-
-
-File: asymptote.info, Node: Self & prefix operators, Next: User-defined operators, Prev: Arithmetic & logical, Up: Operators
-
-6.9.2 Self & prefix operators
------------------------------
-
-As in C, each of the arithmetic operators `+', `-', `*', `/', `%', and
-`^' can be used as a self operator. The prefix operators `++'
-(increment by one) and `--' (decrement by one) are also defined. For
-example,
-int i=1;
-i += 2;
-int j=++i;
-
-is equivalent to the code
-int i=1;
-i=i+2;
-int j=i=i+1;
-
- However, postfix operators like `i++' and `i--' are not defined
-(because of the inherent ambiguities that would arise with the `--'
-path-joining operator). In the rare instances where `i++' and `i--' are
-really needed, one can substitute the expressions `(++i-1)' and
-`(--i+1)', respectively.
-
-
-File: asymptote.info, Node: User-defined operators, Prev: Self & prefix operators, Up: Operators
-
-6.9.3 User-defined operators
-----------------------------
-
-The following symbols may be used with `operator' to define or redefine
-operators on structures and built-in types:
-- + * / % ^ ! < > == != <= >= & | ^^ .. :: -- --- ++
-<< >> $ $$ @ @@
- The operators on the second line have precedence one higher than the
-boolean operators `<', `>', `<=', and `>='.
-
- Guide operators like `..' may be overloaded, say, to write a user
-function that produces a new guide from a given guide:
-guide dots(... guide[] g)=operator ..;
-
-guide operator ..(... guide[] g) {
- guide G;
- if(g.length > 0) {
- write(g[0]);
- G=g[0];
- }
- for(int i=1; i < g.length; ++i) {
- write(g[i]);
- write();
- G=dots(G,g[i]);
- }
- return G;
-}
-
-guide g=(0,0){up}..{SW}(100,100){NE}..{curl 3}(50,50)..(10,10);
-write("g=",g);
-
-
-File: asymptote.info, Node: Implicit scaling, Next: Functions, Prev: Operators, Up: Programming
-
-6.10 Implicit scaling
-=====================
-
-If a numeric literal is in front of certain types of expressions, then
-the two are multiplied:
-int x=2;
-real y=2.0;
-real cm=72/2.540005;
-
-write(3x);
-write(2.5x);
-write(3y);
-write(-1.602e-19 y);
-write(0.5(x,y));
-write(2x^2);
-write(3x+2y);
-write(3(x+2y));
-write(3sin(x));
-write(3(sin(x))^2);
-write(10cm);
-
- This produces the output
-6
-5
-6
--3.204e-19
-(1,1)
-8
-10
-18
-2.72789228047704
-2.48046543129542
-283.464008929116
-
-
-File: asymptote.info, Node: Functions, Next: Arrays, Prev: Implicit scaling, Up: Programming
-
-6.11 Functions
-==============
-
-`Asymptote' functions are treated as variables with a signature
-(non-function variables have null signatures). Variables with the same
-name are allowed, so long as they have distinct signatures.
-
- Functions arguments are passed by value. To pass an argument by
-reference, simply enclose it in a structure (*note Structures::).
-
- Here are some significant features of `Asymptote' functions:
-
- 1. Variables with signatures (functions) and without signatures
- (nonfunction variables) are distinct: int x, x();
- x=5;
- x=new int() {return 17;};
- x=x(); // calls x() and puts the result, 17, in the scalar x
-
- 2. Traditional function definitions are allowed: int sqr(int x)
- {
- return x*x;
- }
- sqr=null; // but the function is still just a variable.
-
- 3. Casting can be used to resolve ambiguities: int a, a(), b, b(); // Valid: creates four variables.
- a=b; // Invalid: assignment is ambiguous.
- a=(int) b; // Valid: resolves ambiguity.
- (int) (a=b); // Valid: resolves ambiguity.
- (int) a=b; // Invalid: cast expressions cannot be L-values.
-
- int c();
- c=a; // Valid: only one possible assignment.
-
- 4. Anonymous (so-called "high-order") functions are also allowed: typedef int intop(int);
- intop adder(int m)
- {
- return new int(int n) {return m+n;};
- }
- intop addby7=adder(7);
- write(addby7(1)); // Writes 8.
-
- 5. One may redefine a function `f', even for calls to `f' in
- previously declared functions, by assigning another (anonymous or
- named) function to it. However, if `f' is overloaded by a new
- function definition, previous calls will still access the original
- version of `f', as illustrated in this example: void f() {
- write("hi");
- }
-
- void g() {
- f();
- }
-
- g(); // writes "hi"
-
- f=new void() {write("bye");};
-
- g(); // writes "bye"
-
- void f() {write("overloaded");};
-
- f(); // writes "overloaded"
- g(); // writes "bye"
-
- 6. Anonymous functions can be used to redefine a function variable
- that has been declared (and implicitly initialized to the null
- function) but not yet explicitly defined: void f(bool b);
-
- void g(bool b) {
- if(b) f(b);
- else write(b);
- }
-
- f=new void(bool b) {
- write(b);
- g(false);
- };
-
- g(true); // Writes true, then writes false.
-
-
- `Asymptote' is the only language we know of that treats functions as
-variables, but allows overloading by distinguishing variables based on
-their signatures.
-
- Functions are allowed to call themselves recursively. As in C++,
-infinite nested recursion will generate a stack overflow (reported as a
-segmentation fault, unless a fully working version of the GNU library
-`libsigsegv' (e.g. 2.4 or later) is installed at configuration time).
-
-* Menu:
-
-* Default arguments:: Default values can appear anywhere
-* Named arguments:: Assigning function arguments by keyword
-* Rest arguments:: Functions with a variable number of arguments
-* Mathematical functions:: Standard libm functions
-
-
-File: asymptote.info, Node: Default arguments, Next: Named arguments, Up: Functions
-
-6.11.1 Default arguments
-------------------------
-
-`Asymptote' supports a more flexible mechanism for default function
-arguments than C++: they may appear anywhere in the function prototype.
-Because certain data types are implicitly cast to more sophisticated
-types (*note Casts::) one can often avoid ambiguities by ordering
-function arguments from the simplest to the most complicated. For
-example, given
-real f(int a=1, real b=0) {return a+b;}
- then `f(1)' returns 1.0, but `f(1.0)' returns 2.0.
-
- The value of a default argument is determined by evaluating the
-given `Asymptote' expression in the scope where the called function is
-defined.
-
-
-File: asymptote.info, Node: Named arguments, Next: Rest arguments, Prev: Default arguments, Up: Functions
-
-6.11.2 Named arguments
-----------------------
-
-It is sometimes difficult to remember the order in which arguments
-appear in a function declaration. Named (keyword) arguments make calling
-functions with multiple arguments easier. Unlike in the C and C++
-languages, an assignment in a function argument is interpreted as an
-assignment to a parameter of the same name in the function signature,
-_not within the local scope_. The command-line option `-d' may be used
-to check `Asymptote' code for cases where a named argument may be
-mistaken for a local assignment.
-
- When matching arguments to signatures, first all of the keywords are
-matched, then the arguments without names are matched against the
-unmatched formals as usual. For example,
-int f(int x, int y) {
- return 10x+y;
-}
-write(f(4,x=3));
- outputs 34, as `x' is already matched when we try to match the unnamed
-argument `4', so it gets matched to the next item, `y'.
-
- For the rare occasions where it is desirable to assign a value to
-local variable within a function argument (generally _not_ a good
-programming practice), simply enclose the assignment in parentheses.
-For example, given the definition of `f' in the previous example,
-int x;
-write(f(4,(x=3)));
- is equivalent to the statements
-int x;
-x=3;
-write(f(4,3));
- and outputs 43.
-
- Parameters can be specified as "keyword-only" by putting `keyword'
-immediately before the parameter name, as in `int f(int keyword x)' or
-`int f(int keyword x=77)'. This forces the caller of the function to
-use a named argument to give a value for this parameter. That is,
-`f(x=42)' is legal, but `f(25)' is not. Keyword-only parameters must
-be listed after normal parameters in a function definition.
-
- As a technical detail, we point out that, since variables of the same
-name but different signatures are allowed in the same scope, the code
-int f(int x, int x()) {
- return x+x();
-}
-int seven() {return 7;}
- is legal in `Asymptote', with `f(2,seven)' returning 9. A named
-argument matches the first unmatched formal of the same name, so
-`f(x=2,x=seven)' is an equivalent call, but `f(x=seven,2)' is not, as
-the first argument is matched to the first formal, and `int ()' cannot
-be implicitly cast to `int'. Default arguments do not affect which
-formal a named argument is matched to, so if `f' were defined as
-int f(int x=3, int x()) {
- return x+x();
-}
- then `f(x=seven)' would be illegal, even though `f(seven)' obviously
-would be allowed.
-
-
-File: asymptote.info, Node: Rest arguments, Next: Mathematical functions, Prev: Named arguments, Up: Functions
-
-6.11.3 Rest arguments
----------------------
-
-Rest arguments allow one to write functions that take a variable number
-of arguments:
-// This function sums its arguments.
-int sum(... int[] nums) {
- int total=0;
- for(int i=0; i < nums.length; ++i)
- total += nums[i];
- return total;
-}
-
-sum(1,2,3,4); // returns 10
-sum(); // returns 0
-
-// This function subtracts subsequent arguments from the first.
-int subtract(int start ... int[] subs) {
- for(int i=0; i < subs.length; ++i)
- start -= subs[i];
- return start;
-}
-
-subtract(10,1,2); // returns 7
-subtract(10); // returns 10
-subtract(); // illegal
-
- Putting an argument into a rest array is called _packing_. One can
-give an explicit list of arguments for the rest argument, so `subtract'
-could alternatively be implemented as
-int subtract(int start ... int[] subs) {
- return start - sum(... subs);
-}
-
- One can even combine normal arguments with rest arguments:
-sum(1,2,3 ... new int[] {4,5,6}); // returns 21
- This builds a new six-element array that is passed to `sum' as `nums'.
-The opposite operation, _unpacking_, is not allowed:
-subtract(... new int[] {10, 1, 2});
- is illegal, as the start formal is not matched.
-
- If no arguments are packed, then a zero-length array (as opposed to
-`null') is bound to the rest parameter. Note that default arguments are
-ignored for rest formals and the rest argument is not bound to a
-keyword.
-
- In some cases, keyword-only parameters are helpful to avoid
-arguments intended for the rest parameter to be assigned to other
-parameters. For example, here the use of `keyword' is to avoid
-`pnorm(1.0,2.0,0.3)' matching `1.0' to `p'.
-real pnorm(real keyword p=2.0 ... real[] v)
-{
- return sum(v^p)^(1/p);
-}
-
- The overloading resolution in `Asymptote' is similar to the function
-matching rules used in C++. Every argument match is given a score.
-Exact matches score better than matches with casting, and matches with
-formals (regardless of casting) score better than packing an argument
-into the rest array. A candidate is maximal if all of the arguments
-score as well in it as with any other candidate. If there is one
-unique maximal candidate, it is chosen; otherwise, there is an
-ambiguity error.
-
-int f(path g);
-int f(guide g);
-f((0,0)--(100,100)); // matches the second; the argument is a guide
-
-int g(int x, real y);
-int g(real x, int x);
-
-g(3,4); // ambiguous; the first candidate is better for the first argument,
- // but the second candidate is better for the second argument
-
-int h(... int[] rest);
-int h(real x ... int[] rest);
-
-h(1,2); // the second definition matches, even though there is a cast,
- // because casting is preferred over packing
-
-int i(int x ... int[] rest);
-int i(real x, real y ... int[] rest);
-
-i(3,4); // ambiguous; the first candidate is better for the first argument,
- // but the second candidate is better for the second one
-
-
-File: asymptote.info, Node: Mathematical functions, Prev: Rest arguments, Up: Functions
-
-6.11.4 Mathematical functions
------------------------------
-
-`Asymptote' has built-in versions of the standard `libm' mathematical
-real(real) functions `sin', `cos', `tan', `asin', `acos', `atan',
-`exp', `log', `pow10', `log10', `sinh', `cosh', `tanh', `asinh',
-`acosh', `atanh', `sqrt', `cbrt', `fabs', `expm1', `log1p', as well as
-the identity function `identity'. `Asymptote' also defines the order
-`n' Bessel functions of the first kind `Jn(int n, real)' and second kind
-`Yn(int n, real)', as well as the gamma function `gamma', the error
-function `erf', and the complementary error function `erfc'. The
-standard real(real, real) functions `atan2', `hypot', `fmod',
-`remainder' are also included.
-
- The functions `degrees(real radians)' and `radians(real degrees)'
-can be used to convert between radians and degrees. The function
-`Degrees(real radians)' returns the angle in degrees in the interval
-[0,360). For convenience, `Asymptote' defines variants `Sin', `Cos',
-`Tan', `aSin', `aCos', and `aTan' of the standard trigonometric
-functions that use degrees rather than radians. We also define complex
-versions of the `sqrt', `sin', `cos', `exp', `log', and `gamma'
-functions.
-
- The functions `floor', `ceil', and `round' differ from their usual
-definitions in that they all return an int value rather than a real
-(since that is normally what one wants). The functions `Floor',
-`Ceil', and `Round' are respectively similar, except that if the result
-cannot be converted to a valid int, they return `intMax' for positive
-arguments and `intMin' for negative arguments, rather than generating
-an integer overflow. We also define a function `sgn', which returns
-the sign of its real argument as an integer (-1, 0, or 1).
-
- There is an `abs(int)' function, as well as an `abs(real)' function
-(equivalent to `fabs(real)'), an `abs(pair)' function (equivalent to
-`length(pair)').
-
- Random numbers can be seeded with `srand(int)' and generated with
-the `int rand()' function, which returns a random integer between 0 and
-the integer `randMax'. The `unitrand()' function returns a random
-number uniformly distributed in the interval [0,1]. A Gaussian random
-number generator `Gaussrand' and a collection of statistics routines,
-including `histogram', are provided in the base file `stats.asy'. The
-functions `factorial(int n)', which returns n!, and `choose(int n, int
-k)', which returns n!/(k!(n-k)!), are also defined.
-
- When configured with the GNU Scientific Library (GSL), available from
-`http://www.gnu.org/software/gsl/', `Asymptote' contains an internal
-module `gsl' that defines the airy functions `Ai(real)', `Bi(real)',
-`Ai_deriv(real)', `Bi_deriv(real)', `zero_Ai(int)', `zero_Bi(int)',
-`zero_Ai_deriv(int)', `zero_Bi_deriv(int)', the Bessel functions
-`I(int, real)', `K(int, real)', `j(int, real)', `y(int, real)',
-`i_scaled(int, real)', `k_scaled(int, real)', `J(real, real)', `Y(real,
-real)', `I(real, real)', `K(real, real)', `zero_J(real, int)', the
-elliptic functions `F(real, real)', `E(real, real)', and `P(real,
-real)', the Jacobi elliptic functions `real[] sncndn(real,real)', the
-exponential/trigonometric integrals `Ei', `Si', and `Ci', the Legendre
-polynomials `Pl(int, real)', and the Riemann zeta function
-`zeta(real)'. For example, to compute the sine integral `Si' of 1.0:
-import gsl;
-write(Si(1.0));
-
- `Asymptote' also provides a few general purpose numerical routines:
-
-``real newton(int iterations=100, real f(real), real fprime(real), real x, bool verbose=false);''
- Use Newton-Raphson iteration to solve for a root of a real-valued
- differentiable function `f', given its derivative `fprime' and an
- initial guess `x'. Diagnostics for each iteration are printed if
- `verbose=true'. If the iteration fails after the maximum allowed
- number of loops (`iterations'), `realMax' is returned.
-
-``real newton(int iterations=100, real f(real), real fprime(real), real x1, real x2, bool verbose=false);''
- Use bracketed Newton-Raphson bisection to solve for a root of a
- real-valued differentiable function `f' within an interval
- [`x1',`x2'] (on which the endpoint values of `f' have opposite
- signs), given its derivative `fprime'. Diagnostics for each
- iteration are printed if `verbose=true'. If the iteration fails
- after the maximum allowed number of loops (`iterations'),
- `realMax' is returned.
-
-``real simpson(real f(real), real a, real b, real acc=realEpsilon, real dxmax=b-a)''
- returns the integral of `f' from `a' to `b' using adaptive Simpson
- integration.
-
-
-
-File: asymptote.info, Node: Arrays, Next: Casts, Prev: Functions, Up: Programming
-
-6.12 Arrays
-===========
-
-* Menu:
-
-* Slices:: Python-style array slices
-
- Appending `[]' to a built-in or user-defined type yields an array.
-The array element `i' of an array `A' can be accessed as `A[i]'. By
-default, attempts to access or assign to an array element using a
-negative index generates an error. Reading an array element with an
-index beyond the length of the array also generates an error; however,
-assignment to an element beyond the length of the array causes the
-array to be resized to accommodate the new element. One can also index
-an array `A' with an integer array `B': the array `A[B]' is formed by
-indexing array `A' with successive elements of array `B'. A convenient
-Java-style shorthand exists for iterating over all elements of an
-array; see *note array iteration::.
-
- The declaration
-real[] A;
-
-initializes `A' to be an empty (zero-length) array. Empty arrays should
-be distinguished from null arrays. If we say
-real[] A=null;
-
-then `A' cannot be dereferenced at all (null arrays have no length and
-cannot be read from or assigned to).
-
- Arrays can be explicitly initialized like this:
-real[] A={0,1,2};
-
- Array assignment in `Asymptote' does a shallow copy: only the
-pointer is copied (if one copy if modified, the other will be too).
-The `copy' function listed below provides a deep copy of an array.
-
- Every array `A' of type `T[]' has the virtual members
- * `int length',
-
- * `int cyclic',
-
- * `int[] keys',
-
- * `T push(T x)',
-
- * `void append(T[] a)',
-
- * `T pop()',
-
- * `void insert(int i ... T[] x)',
-
- * `void delete(int i, int j=i)',
-
- * `void delete()', and
-
- * `bool initialized(int n)'.
-
- The member `A.length' evaluates to the length of the array. Setting
-`A.cyclic=true' signifies that array indices should be reduced modulo
-the current array length. Reading from or writing to a nonempty cyclic
-array never leads to out-of-bounds errors or array resizing.
-
- The member `A.keys' evaluates to an array of integers containing the
-indices of initialized entries in the array in ascending order. Hence,
-for an array of length `n' with all entries initialized, `A.keys'
-evaluates to `{0,1,...,n-1}'. A new keys array is produced each time
-`A.keys' is evaluated.
-
- The functions `A.push' and `A.append' append their arguments onto
-the end of the array, while `A.insert(int i ... T[] x)' inserts `x'
-into the array at index `i'. For convenience `A.push' returns the
-pushed item. The function `A.pop()' pops and returns the last element,
-while `A.delete(int i, int j=i)' deletes elements with indices in the
-range [`i',`j'], shifting the position of all higher-indexed elements
-down. If no arguments are given, `A.delete()' provides a convenient way
-of deleting all elements of `A'. The routine `A.initialized(int n)' can
-be used to examine whether the element at index `n' is initialized.
-Like all `Asymptote' functions, `push', `append', `pop', `insert',
-`delete', and `initialized' can be "pulled off" of the array and used
-on their own. For example,
-int[] A={1};
-A.push(2); // A now contains {1,2}.
-A.append(A); // A now contains {1,2,1,2}.
-int f(int)=A.push;
-f(3); // A now contains {1,2,1,2,3}.
-int g()=A.pop;
-write(g()); // Outputs 3.
-A.delete(0); // A now contains {2,1,2}.
-A.delete(0,1); // A now contains {2}.
-A.insert(1,3); // A now contains {2,3}.
-A.insert(1 ... A); // A now contains {2,2,3,3}
-A.insert(2,4,5); // A now contains {2,2,4,5,3,3}.
-
- The `[]' suffix can also appear after the variable name; this is
-sometimes convenient for declaring a list of variables and arrays of
-the same type:
-real a,A[];
- This declares `a' to be `real' and implicitly declares `A' to be of
-type `real[]'.
-
- In the following list of built-in array functions, `T' represents a
-generic type. Note that the internal functions `alias', `array',
-`copy', `concat', `sequence', `map', and `transpose', which depend on
-type `T[]', are defined only after the first declaration of a variable
-of type `T[]'.
-
-`new T[]'
- returns a new empty array of type `T[]';
-
-`new T[] {list}'
- returns a new array of type `T[]' initialized with `list' (a comma
- delimited list of elements).
-
-`new T[n]'
- returns a new array of `n' elements of type `T[]'. These `n'
- array elements are not initialized unless they are arrays
- themselves (in which case they are each initialized to empty
- arrays).
-
-`T[] array(int n, T value, int depth=intMax)'
- returns an array consisting of `n' copies of `value'. If `value'
- is itself an array, a deep copy of `value' is made for each entry.
- If `depth' is specified, this deep copying only recurses to the
- specified number of levels.
-
-`int[] sequence(int n)'
- if `n >= 1' returns the array `{0,1,...,n-1}' (otherwise returns a
- null array);
-
-`int[] sequence(int n, int m)'
- if `m >= n' returns an array `{n,n+1,...,m}' (otherwise returns a
- null array);
-
-`T[] sequence(T f(int), int n)'
- if `n >= 1' returns the sequence `{f_i :i=0,1,...n-1}' given a
- function `T f(int)' and integer `int n' (otherwise returns a null
- array);
-
-`T[] map(T f(T), T[] a)'
- returns the array obtained by applying the function `f' to each
- element of the array `a'. This is equivalent to `sequence(new
- T(int i) {return f(a[i]);},a.length)'.
-
-`int[] reverse(int n)'
- if `n >= 1' returns the array `{n-1,n-2,...,0}' (otherwise returns
- a null array);
-
-`int[] complement(int[] a, int n)'
- returns the complement of the integer array `a' in
- `{0,1,2,...,n-1}', so that `b[complement(a,b.length)]' yields the
- complement of `b[a]'.
-
-`real[] uniform(real a, real b, int n)'
- if `n >= 1' returns a uniform partition of `[a,b]' into `n'
- subintervals (otherwise returns a null array);
-
-`int find(bool[], int n=1)'
- returns the index of the `n'th `true' value or -1 if not found.
- If `n' is negative, search backwards from the end of the array for
- the `-n'th value;
-
-`int search(T[] a, T key)'
- For built-in ordered types `T', searches a sorted array `a' of `n'
- elements for k, returning the index `i' if `a[i] <= key < a[i+1]',
- `-1' if `key' is less than all elements of `a', or `n-1' if `key'
- is greater than or equal to the last element of `a'.
-
-`int search(T[] a, T key, bool less(T i, T j))'
- searches an array `a' sorted in ascending order such that element
- `i' precedes element `j' if `less(i,j)' is true;
-
-`T[] copy(T[] a)'
- returns a deep copy of the array `a';
-
-`T[] concat(... T[][] a)'
- returns a new array formed by concatenating the given
- one-dimensional arrays given as arguments;
-
-`bool alias(T[] a, T[] b)'
- returns `true' if the arrays `a' and `b' are identical;
-
-`T[] sort(T[] a)'
- For built-in ordered types `T', returns a copy of `a' sorted in
- ascending order;
-
-`T[][] sort(T[][] a)'
- For built-in ordered types `T', returns a copy of `a' with the rows
- sorted by the first column, breaking ties with successively higher
- columns. For example: string[][] a={{"bob","9"},{"alice","5"},{"pete","7"},
- {"alice","4"}};
- // Row sort (by column 0, using column 1 to break ties):
- write(sort(a));
-
- produces alice 4
- alice 5
- bob 9
- pete 7
-
-`T[] sort(T[] a, bool less(T i, T j))'
- returns a copy of `a' stably sorted in ascending order such that
- element `i' precedes element `j' if `less(i,j)' is true.
-
-`T[][] transpose(T[][] a)'
- returns the transpose of `a'.
-
-`T[][][] transpose(T[][][] a, int[] perm)'
- returns the 3D transpose of `a' obtained by applying the
- permutation `perm' of `new int[]{0,1,2}' to the indices of each
- entry.
-
-`T sum(T[] a)'
- For arithmetic types `T', returns the sum of `a'. In the case
- where `T' is `bool', the number of true elements in `a' is
- returned.
-
-`T min(T[] a)'
-
-`T min(T[][] a)'
-
-`T min(T[][][] a)'
- For built-in ordered types `T', returns the minimum element of `a'.
-
-`T max(T[] a)'
-
-`T max(T[][] a)'
-
-`T max(T[][][] a)'
- For built-in ordered types `T', returns the maximum element of `a'.
-
-`T[] min(T[] a, T[] b)'
- For built-in ordered types `T', and arrays `a' and `b' of the same
- length, returns an array composed of the minimum of the
- corresponding elements of `a' and `b'.
-
-`T[] max(T[] a, T[] b)'
- For built-in ordered types `T', and arrays `a' and `b' of the same
- length, returns an array composed of the maximum of the
- corresponding elements of `a' and `b'.
-
-`pair[] pairs(real[] x, real[] y);'
- For arrays `x' and `y' of the same length, returns the pair array
- `sequence(new pair(int i) {return (x[i],y[i]);},x.length)'.
-
-`pair[] fft(pair[] a, int sign=1)'
- returns the Fast Fourier Transform of `a' (if the optional `FFTW'
- package is installed), using the given `sign'. Here is a simple
- example: int n=4;
- pair[] f=sequence(n);
- write(f);
- pair[] g=fft(f,-1);
- write();
- write(g);
- f=fft(g,1);
- write();
- write(f/n);
-
-`real dot(real[] a, real[] b)'
- returns the dot product of the vectors `a' and `b'.
-
-`pair dot(pair[] a, pair[] b)'
- returns the complex dot product `sum(a*conj(b))' of the vectors
- `a' and `b'.
-
-`real[] tridiagonal(real[] a, real[] b, real[] c, real[] f);'
- Solve the periodic tridiagonal problem L`x'=`f' and return the
- solution `x', where `f' is an n vector and L is the n \times n
- matrix [ b[0] c[0] a[0] ]
- [ a[1] b[1] c[1] ]
- [ a[2] b[2] c[2] ]
- [ ... ]
- [ c[n-1] a[n-1] b[n-1] ]
- For Dirichlet boundary conditions (denoted here by `u[-1]' and
- `u[n]'), replace `f[0]' by `f[0]-a[0]u[-1]' and
- `f[n-1]-c[n-1]u[n]'; then set `a[0]=c[n-1]=0'.
-
-`real[] solve(real[][] a, real[] b, bool warn=true)'
- Solve the linear equation `a'x=`b' by LU decomposition and return
- the solution x, where `a' is an n \times n matrix and `b' is an
- array of length n. For example: import math;
- real[][] a={{1,-2,3,0},{4,-5,6,2},{-7,-8,10,5},{1,50,1,-2}};
- real[] b={7,19,33,3};
- real[] x=solve(a,b);
- write(a); write();
- write(b); write();
- write(x); write();
- write(a*x);
- If `a' is a singular matrix and `warn' is `false', return an
- empty array. If the matrix `a' is tridiagonal, the routine
- `tridiagonal' provides a more efficient algorithm (*note
- tridiagonal::).
-
-`real[][] solve(real[][] a, real[][] b, bool warn=true)'
- Solve the linear equation `a'x=`b' and return the solution x,
- where `a' is an n \times n matrix and `b' is an n \times m matrix.
- If `a' is a singular matrix and `warn' is `false', return an empty
- matrix.
-
-`real[][] identity(int n);'
- returns the n \times n identity matrix.
-
-`real[][] diagonal(... real[] a)'
- returns the diagonal matrix with diagonal entries given by a.
-
-`real[][] inverse(real[][] a)'
- returns the inverse of a square matrix `a'.
-
-``real[] quadraticroots(real a, real b, real c);''
- This numerically robust solver returns the real roots of the
- quadratic equation ax^2+bx+c=0, in ascending order. Multiple roots
- are listed separately.
-
-``pair[] quadraticroots(explicit pair a, explicit pair b, explicit pair c);''
- This numerically robust solver returns the complex roots of the
- quadratic equation ax^2+bx+c=0.
-
-``real[] cubicroots(real a, real b, real c, real d);''
- This numerically robust solver returns the real roots of the cubic
- equation ax^3+bx^2+cx+d=0. Multiple roots are listed separately.
-
-
- `Asymptote' includes a full set of vectorized array instructions for
-arithmetic (including self) and logical operations. These
-element-by-element instructions are implemented in C++ code for speed.
-Given
-real[] a={1,2};
-real[] b={3,2};
- then `a == b' and `a >= 2' both evaluate to the vector `{false, true}'. To
-test whether all components of `a' and `b' agree, use the boolean
-function `all(a == b)'. One can also use conditionals like `(a >= 2) ?
-a : b', which returns the array `{3,2}', or `write((a >= 2) ? a :
-null', which returns the array `{2}'.
-
- All of the standard built-in `libm' functions of signature
-`real(real)' also take a real array as an argument, effectively like an
-implicit call to `map'.
-
- As with other built-in types, arrays of the basic data types can be
-read in by assignment. In this example, the code
-file fin=input("test.txt");
-real[] A=fin;
-
-reads real values into `A' until the end-of-file is reached (or an I/O
-error occurs).
-
- The virtual members `dimension', `line', `csv', `word', and `read'
-of a file are useful for reading arrays. For example, if line mode is
-set with `file line(bool b=true)', then reading will stop once the end
-of the line is reached instead
-file fin=input("test.txt");
-real[] A=fin.line();
-
- Since string reads by default read up to the end of line anyway,
-line mode normally has no effect on string array reads. However, there
-is a white-space delimiter mode for reading strings, `file word(bool
-b=true)', which causes string reads to respect white-space delimiters,
-instead of the default end-of-line delimiter:
-file fin=input("test.txt").line().word();
-real[] A=fin;
-
- Another useful mode is comma-separated-value mode, `file csv(bool
-b=true)', which causes reads to respect comma delimiters:
-file fin=csv(input("test.txt"));
-real[] A=fin;
-
- To restrict the number of values read, use the `file dimension(int)'
-function:
-file fin=input("test.txt");
-real[] A=dimension(fin,10);
-
- This reads 10 values into A, unless end-of-file (or end-of-line in
-line mode) occurs first. Attempting to read beyond the end of the file
-will produce a runtime error message. Specifying a value of 0 for the
-integer limit is equivalent to the previous example of reading until
-end-of-file (or end-of-line in line mode) is encountered.
-
- Two- and three-dimensional arrays of the basic data types can be read
-in like this:
-file fin=input("test.txt");
-real[][] A=fin.dimension(2,3);
-real[][][] B=fin.dimension(2,3,4);
- Again, an integer limit of zero means no restriction.
-
- Sometimes the array dimensions are stored with the data as integer
-fields at the beginning of an array. Such 1, 2, or 3 dimensional arrays
-can be read in with the virtual member functions `read(1)', `read(2)',
-or `read(3)', respectively:
-file fin=input("test.txt");
-real[] A=fin.read(1);
-real[][] B=fin.read(2);
-real[][][] C=fin.read(3);
-
- One, two, and three-dimensional arrays of the basic data types can be
-output with the functions `write(file,T[])', `write(file,T[][])',
-`write(file,T[][][])', respectively.
-
-
-File: asymptote.info, Node: Slices, Up: Arrays
-
-6.12.1 Slices
--------------
-
-Asymptote allows a section of an array to be addressed as a slice using
-a Python-like syntax. If `A' is an array, the expression `A[m:n]'
-returns a new array consisting of the elements of `A' with indices from
-`m' up to but not including `n'. For example,
-int[] x={0,1,2,3,4,5,6,7,8,9};
-int[] y=x[2:6]; // y={2,3,4,5};
-int[] z=x[5:10]; // z={5,6,7,8,9};
-
- If the left index is omitted, it is taken be `0'. If the right
-index is omitted it is taken to be the length of the array. If both
-are omitted, the slice then goes from the start of the array to the
-end, producing a non-cyclic deep copy of the array. For example:
-int[] x={0,1,2,3,4,5,6,7,8,9};
-int[] y=x[:4]; // y={0,1,2,3}
-int[] z=x[5:]; // z={5,6,7,8,9}
-int[] w=x[:]; // w={0,1,2,3,4,5,6,7,8,9}, distinct from array x.
-
- If A is a non-cyclic array, it is illegal to use negative values for
-either of the indices. If the indices exceed the length of the array,
-however, they are politely truncated to that length.
-
- For cyclic arrays, the slice `A[m:n]' still consists of the cells
-with indices in the set [`m',`n'), but now negative values and values
-beyond the length of the array are allowed. The indices simply wrap
-around. For example:
-
-int[] x={0,1,2,3,4,5,6,7,8,9};
-x.cyclic=true;
-int[] y=x[8:15]; // y={8,9,0,1,2,3,4}.
-int[] z=x[-5:5]; // z={5,6,7,8,9,0,1,2,3,4}
-int[] w=x[-3:17]; // w={7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6}
-
- Notice that with cyclic arrays, it is possible to include the same
-element of the original array multiple times within a slice.
-Regardless of the original array, arrays produced by slices are always
-non-cyclic.
-
- If the left and right indices of a slice are the same, the result is
-an empty array. If the array being sliced is empty, the result is an
-empty array. Any slice with a left index greater than its right index
-will yield an error.
-
- Slices can also be assigned to, changing the value of the original
-array. If the array being assigned to the slice has a different length
-than the slice itself, elements will be inserted or removed from the
-array to accommodate it. For instance:
-string[] toppings={"mayo", "salt", "ham", "lettuce"};
-toppings[0:2]=new string[] {"mustard", "pepper"};
- // Now toppings={"mustard", "pepper", "ham", "lettuce"}
-toppings[2:3]=new string[] {"turkey", "bacon" };
- // Now toppings={"mustard", "pepper", "turkey", "bacon", "lettuce"}
-toppings[0:3]=new string[] {"tomato"};
- // Now toppings={"tomato", "bacon", "lettuce"}
-
- If an array is assigned to a slice of itself, a copy of the original
-array is assigned to the slice. That is, code such as `x[m:n]=x' is
-equivalent to `x[m:n]=copy(x)'. One can use the shorthand `x[m:m]=y'
-to insert the contents of the array `y' into the array `x' starting at
-the location just before `x[m]'.
-
- For a cyclic array, a slice is bridging if it addresses cells up to
-the end of the array and then continues on to address cells at the
-start of the array. For instance, if `A' is a cyclic array of length
-10, `A[8:12]', `A[-3:1]', and `A[5:25]' are bridging slices whereas
-`A[3:7]', `A[7:10]', `A[-3:0]' and `A[103:107]' are not. Bridging
-slices can only be assigned to if the number of elements in the slice
-is exactly equal to the number of elements we are assigning to it.
-Otherwise, there is no clear way to decide which of the new entries
-should be `A[0]' and an error is reported. Non-bridging slices may be
-assigned an array of any length.
-
- For a cyclic array `A' an expression of the form
-`A[A.length:A.length]' is equivalent to the expression `A[0:0]' and so
-assigning to this slice will insert values at the start of the array.
-`A.append()' can be used to insert values at the end of the array.
-
- It is illegal to assign to a slice of a cyclic array that repeats
-any of the cells.
-
-
-File: asymptote.info, Node: Casts, Next: Import, Prev: Arrays, Up: Programming
-
-6.13 Casts
-==========
-
-`Asymptote' implicitly casts `int' to `real', `int' to `pair', `real'
-to `pair', `pair' to `path', `pair' to `guide', `path' to `guide',
-`guide' to `path', `real' to `pen', `pair[]' to `guide[]', `pair[]' to
-`path[]', `path' to `path[]', and `guide' to `path[]', along with
-various three-dimensional casts defined in `three.asy'. Implicit casts
-are automatically attempted on assignment and when trying to match
-function calls with possible function signatures. Implicit casting can
-be inhibited by declaring individual arguments `explicit' in the
-function signature, say to avoid an ambiguous function call in the
-following example, which outputs 0:
-int f(pair a) {return 0;}
-int f(explicit real x) {return 1;}
-
-write(f(0));
-
- Other conversions, say `real' to `int' or `real' to `string',
-require an explicit cast:
-int i=(int) 2.5;
-string s=(string) 2.5;
-
-real[] a={2.5,-3.5};
-int[] b=(int []) a;
-write(stdout,b); // Outputs 2,-3
-
- Casting to user-defined types is also possible using `operator cast':
-struct rpair {
- real radius;
- real angle;
-}
-
-pair operator cast(rpair x) {
- return (x.radius*cos(x.angle),x.radius*sin(x.angle));
-}
-
-rpair x;
-x.radius=1;
-x.angle=pi/6;
-
-write(x); // Outputs (0.866025403784439,0.5)
-
- One must use care when defining new cast operators. Suppose that in
-some code one wants all integers to represent multiples of 100. To
-convert them to reals, one would first want to multiply them by 100.
-However, the straightforward implementation
-real operator cast(int x) {return x*100;}
- is equivalent to an infinite recursion, since the result `x*100' needs
-itself to be cast from an integer to a real. Instead, we want to use
-the standard conversion of int to real:
-real convert(int x) {return x*100;}
-real operator cast(int x)=convert;
-
- Explicit casts are implemented similarly, with `operator ecast'.
-
-
-File: asymptote.info, Node: Import, Next: Static, Prev: Casts, Up: Programming
-
-6.14 Import
-===========
-
-While `Asymptote' provides many features by default, some applications
-require specialized features contained in external `Asymptote' modules.
-For instance, the lines
-access graph;
-graph.axes();
- draw x and y axes on a two-dimensional graph. Here, the command looks
-up the module under the name `graph' in a global dictionary of modules
-and puts it in a new variable named `graph'. The module is a
-structure, and we can refer to its fields as we usually would with a
-structure.
-
- Often, one wants to use module functions without having to specify
-the module name. The code
-from graph access axes;
- adds the `axes' field of `graph' into the local name space, so that
-subsequently, one can just write `axes()'. If the given name is
-overloaded, all types and variables of that name are added. To add
-more than one name, just use a comma-separated list:
-from graph access axes, xaxis, yaxis;
- Wild card notation can be used to add all non-private fields and types
-of a module to the local name space:
-
-from graph access *;
-
- Similarly, one can add the non-private fields and types of a
-structure to the local environment with the `unravel' keyword:
-struct matrix {
- real a,b,c,d;
-}
-
-real det(matrix m) {
- unravel m;
- return a*d-b*c;
-}
- Alternatively, one can unravel selective fields:
-real det(matrix m) {
- from m unravel a,b,c as C,d;
- return a*d-b*C;
-}
-
- The command
-import graph;
- is a convenient abbreviation for the commands
-access graph;
-unravel graph;
- That is, `import graph' first loads a module into a structure called
-`graph' and then adds its non-private fields and types to the local
-environment. This way, if a member variable (or function) is
-overwritten with a local variable (or function of the same signature),
-the original one can still be accessed by qualifying it with the module
-name.
-
- Wild card importing will work fine in most cases, but one does not
-usually know all of the internal types and variables of a module, which
-can also change as the module writer adds or changes features of the
-module. As such, it is prudent to add `import' commands at the start
-of an `Asymptote' file, so that imported names won't shadow locally
-defined functions. Still, imported names may shadow other imported
-names, depending on the order in which they were imported, and imported
-functions may cause overloading resolution problems if they have the
-same name as local functions defined later.
-
- To rename modules or fields when adding them to the local
-environment, use `as':
-access graph as graph2d;
-from graph access xaxis as xline, yaxis as yline;
-
- The command
-import graph as graph2d;
- is a convenient abbreviation for the commands
-access graph as graph2d;
-unravel graph2d;
-
- Except for a few built-in modules, such as `settings', all modules
-are implemented as `Asymptote' files. When looking up a module that
-has not yet been loaded, `Asymptote' searches the standard search paths
-(*note Search paths::) for the matching file. The file corresponding
-to that name is read and the code within it is interpreted as the body
-of a structure defining the module.
-
- If the file name contains nonalphanumeric characters, enclose it
-with quotation marks:
-
-`access "/usr/local/share/asymptote/graph.asy" as graph;'
-
-`from "/usr/local/share/asymptote/graph.asy" access axes;'
-
-`import "/usr/local/share/asymptote/graph.asy" as graph;'
-
- It is an error if modules import themselves (or each other in a
-cycle). The module name to be imported must be known at compile time.
-
- However, you can import an `Asymptote' module determined by the
-string `s' at runtime like this:
-eval("import "+s,true);
-
- To conditionally execute an array of asy files, use
-void asy(string format, bool overwrite ... string[] s);
- The file will only be processed, using output format `format', if
-overwrite is `true' or the output file is missing.
-
- One can evaluate an `Asymptote' expression (without any return
-value, however) contained in the string `s' with:
-void eval(string s, bool embedded=false);
- It is not necessary to terminate the string `s' with a semicolon. If
-`embedded' is `true', the string will be evaluated at the top level of
-the current environment. If `embedded' is `false' (the default), the
-string will be evaluated in an independent environment, sharing the same
-`settings' module (*note settings::).
-
- One can evaluate arbitrary `Asymptote' code (which may contain
-unescaped quotation marks) with the command
-void eval(code s, bool embedded=false);
- Here `code' is a special type used with `quote {}' to enclose
-`Asymptote code' like this:
-real a=1;
-code s=quote {
- write(a);
-};
-eval(s,true); // Outputs 1
-
- To include the contents of an existing file `graph' verbatim (as if
-the contents of the file were inserted at that point), use one of the
-forms:
-include graph;
-
-`include "/usr/local/share/asymptote/graph.asy";'
-
- To list all global functions and variables defined in a module named
-by the contents of the string `s', use the function
-void list(string s, bool imports=false);
- Imported global functions and variables are also listed if `imports'
-is `true'.
-
-
-File: asymptote.info, Node: Static, Prev: Import, Up: Programming
-
-6.15 Static
-===========
-
-Static qualifiers allocate the memory address of a variable in a higher
-enclosing level.
-
- For a function body, the variable is allocated in the block where the
-function is defined; so in the code
-struct s {
- int count() {
- static int c=0;
- ++c;
- return c;
- }
-}
-
-there is one instance of the variable `c' for each object `s' (as
-opposed to each call of `count').
-
- Similarly, in
-int factorial(int n) {
- int helper(int k) {
- static int x=1;
- x *= k;
- return k == 1 ? x : helper(k-1);
- }
- return helper(n);
-}
-
-there is one instance of `x' for every call to `factorial' (and not for
-every call to `helper'), so this is a correct, but ugly, implementation
-of factorial.
-
- Similarly, a static variable declared within a structure is
-allocated in the block where the structure is defined. Thus,
-struct A {
- struct B {
- static pair z;
- }
-}
-
-creates one object `z' for each object of type `A' created.
-
- In this example,
-int pow(int n, int k) {
- struct A {
- static int x=1;
- void helper() {
- x *= n;
- }
- }
- for(int i=0; i < k; ++i) {
- A a;
- a.helper();
- }
- return A.x;
-}
-
-there is one instance of `x' for each call to `pow', so this is an ugly
-implementation of exponentiation.
-
- Loop constructs allocate a new frame in every iteration. This is so
-that higher-order functions can refer to variables of a specific
-iteration of a loop:
-void f();
-for(int i=0; i < 10; ++i) {
- int x=i;
- if(x==5) {
- f=new void () { write(x); }
- }
-}
-f();
-
- Here, every iteration of the loop has its own variable `x', so `f()'
-will write `5'. If a variable in a loop is declared static, it will be
-allocated where the enclosing function or structure was defined (just
-as if it were declared static outside of the loop). For instance, in:
-void f() {
- static int x;
- for(int i=0; i < 10; ++i) {
- static int y;
- }
-}
- both `x' and `y' will be allocated in the same place, which is also
-where `f' is also allocated.
-
- Statements may also be declared static, in which case they are run
-at the place where the enclosing function or structure is defined.
-Declarations or statements not enclosed in a function or structure
-definition are already at the top level, so static modifiers are
-meaningless. A warning is given in such a case.
-
- Since structures can have static fields, it is not always clear for
-a qualified name whether the qualifier is a variable or a type. For
-instance, in:
-
-struct A {
- static int x;
-}
-pair A;
-
-int y=A.x;
- does the `A' in `A.x' refer to the structure or to the pair variable.
-It is the convention in Asymptote that, if there is a non-function
-variable with the same name as the qualifier, the qualifier refers to
-that variable, and not to the type. This is regardless of what fields
-the variable actually possesses.
-
-
-File: asymptote.info, Node: LaTeX usage, Next: Base modules, Prev: Programming, Up: Top
-
-7 `LaTeX' usage
-***************
-
-`Asymptote' comes with a convenient `LaTeX' style file `asymptote.sty'
-that makes `LaTeX' `Asymptote'-aware. Entering `Asymptote' code
-directly into the `LaTeX' source file, at the point where it is needed,
-keeps figures organized and avoids the need to invent new file names
-for each figure. Simply add the line `\usepackage{asymptote}' at the
-beginning of your file and enclose your `Asymptote' code within a
-`\begin{asy}...\end{asy}' environment. As with the `LaTeX' `comment'
-environment, the `\end{asy}' command must appear on a line by itself,
-with no trailing commands/comments. A blank line is not allowed after
-`\begin{asy}'.
-
- The sample `LaTeX' file below, named `latexusage.tex', can be run as
-follows:
-latex latexusage
-asy latexusage-*.asy
-latex latexusage
-
-or
-pdflatex latexusage
-asy latexusage-*.asy
-pdflatex latexusage
- To switch between using inline Asymptote code with `latex' and
-`pdflatex' you may first need to remove the files `latexusage-*.tex'.
-
- An even better method for processing a `LaTeX' file with embedded
-`Asymptote' code is to use the `latexmk' utility from
-
- `http://www.ctan.org/tex-archive/support/latexmk/'
- after putting the contents of
-`http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/doc/latexmkrc'
-in a file `latexmkrc' in the same directory. The command
-latexmk -pdf latexusage
- will then call `Asymptote' automatically, recompiling only the figures
-that have changed. Since each figure is compiled in a separate system
-process, this method also tends to use less memory. To store the
-figures in a separate directory named `asy', one can define
-\def\asydir{asy}
- in `latexusage.tex' and put the contents of
-`http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/doc/latexmkrc_asydir'
-in a file `latexmkrc' in the same directory. External `Asymptote' code
-in `filename.asy' should be included with
-\asyinclude[<options>]{<filename.asy>}
- so that `latexmk' will recognize when the code is changed. Note that
-`latemk' requires `perl', available from `http://www.perl.org/'.
-
- One can specify `width', `height', `keepAspect', `viewportwidth',
-`viewportheight', `attach', and `inline'. `keyval'-style options to
-the `asy' and `asyinclude' environments. Three-dimensional PRC files
-may either be embedded within the page (the default) or attached as
-annotated (but printable) attachments, using the `attach' option and
-the `attachfile2' (or older `attachfile') `LaTeX' package. The
-`inline' option generates inline `LaTeX' code instead of EPS or PDF
-files. This makes 2D LaTeX symbols visible to the
-`\begin{asy}...\end{asy}' environment. In this mode, Asymptote
-correctly aligns 2D LaTeX symbols defined outside of
-`\begin{asy}...\end{asy}', but treats their size as zero; an optional
-second string can be given to `Label' to provide an estimate of the
-unknown label size.
-
- Note that if the `latex' TeX engine is used with the `inline'
-option, labels might not show up in DVI viewers that cannot handle raw
-`PostScript' code. One can use `dvips'/`dvipdf' to produce
-`PostScript'/PDF output (we recommend using the modified version of
-`dvipdf' in the `Asymptote' patches directory, which accepts the `dvips
--z' hyperdvi option).
-
- Here now is `latexusage.tex':
-
-\documentclass[12pt]{article}
-
-% Use this form to include EPS (latex) or PDF (pdflatex) files:
-\usepackage{asymptote}
-
-% Use this form with latex or pdflatex to include inline LaTeX code by default:
-%\usepackage[inline]{asymptote}
-
-% Use this form with latex or pdflatex to create PDF attachments by default:
-%\usepackage[attach]{asymptote}
-
-% Enable this line to support the attach option:
-%\usepackage[dvips]{attachfile2}
-
-\begin{document}
-
-% Optional subdirectory for asy files (no spaces):
-\def\asydir{}
-
-\begin{asydef}
-// Global Asymptote definitions can be put here.
-import three;
-usepackage("bm");
-texpreamble("\def\V#1{\bm{#1}}");
-// One can globally override the default toolbar settings here:
-// settings.toolbar=true;
-\end{asydef}
-
-Here is a venn diagram produced with Asymptote, drawn to width 4cm:
-
-\def\A{A}
-\def\B{\V{B}}
-
-%\begin{figure}
-\begin{center}
-\begin{asy}
-size(4cm,0);
-pen colour1=red;
-pen colour2=green;
-
-pair z0=(0,0);
-pair z1=(-1,0);
-pair z2=(1,0);
-real r=1.5;
-path c1=circle(z1,r);
-path c2=circle(z2,r);
-fill(c1,colour1);
-fill(c2,colour2);
-
-picture intersection=new picture;
-fill(intersection,c1,colour1+colour2);
-clip(intersection,c2);
-
-add(intersection);
-
-draw(c1);
-draw(c2);
-
-//draw("$\A$",box,z1); // Requires [inline] package option.
-//draw(Label("$\B$","$B$"),box,z2); // Requires [inline] package option.
-draw("$A$",box,z1);
-draw("$\V{B}$",box,z2);
-
-pair z=(0,-2);
-real m=3;
-margin BigMargin=Margin(0,m*dot(unit(z1-z),unit(z0-z)));
-
-draw(Label("$A\cap B$",0),conj(z)--z0,Arrow,BigMargin);
-draw(Label("$A\cup B$",0),z--z0,Arrow,BigMargin);
-draw(z--z1,Arrow,Margin(0,m));
-draw(z--z2,Arrow,Margin(0,m));
-
-shipout(bbox(0.25cm));
-\end{asy}
-%\caption{Venn diagram}\label{venn}
-\end{center}
-%\end{figure}
-
-Each graph is drawn in its own environment. One can specify the width
-and height to \LaTeX\ explicitly. This 3D example can be viewed
-interactively either with Adobe Reader or Asymptote's fast OpenGL-based
-renderer. To support {\tt latexmk}, 3D figures should specify
-\verb+inline=true+. It is sometimes desirable to embed 3D files as annotated
-attachments; this requires the \verb+attach=true+ option as well as the
-\verb+attachfile2+ \LaTeX\ package.
-\begin{center}
-\begin{asy}[height=4cm,inline=true,attach=false,viewportwidth=\linewidth]
-currentprojection=orthographic(5,4,2);
-draw(unitcube,blue);
-label("$V-E+F=2$",(0,1,0.5),3Y,blue+fontsize(17pt));
-\end{asy}
-\end{center}
-
-One can also scale the figure to the full line width:
-\begin{center}
-\begin{asy}[width=\the\linewidth,inline=true]
-pair z0=(0,0);
-pair z1=(2,0);
-pair z2=(5,0);
-pair zf=z1+0.75*(z2-z1);
-
-draw(z1--z2);
-dot(z1,red+0.15cm);
-dot(z2,darkgreen+0.3cm);
-label("$m$",z1,1.2N,red);
-label("$M$",z2,1.5N,darkgreen);
-label("$\hat{\ }$",zf,0.2*S,fontsize(24pt)+blue);
-
-pair s=-0.2*I;
-draw("$x$",z0+s--z1+s,N,red,Arrows,Bars,PenMargins);
-s=-0.5*I;
-draw("$\bar{x}$",z0+s--zf+s,blue,Arrows,Bars,PenMargins);
-s=-0.95*I;
-draw("$X$",z0+s--z2+s,darkgreen,Arrows,Bars,PenMargins);
-\end{asy}
-\end{center}
-\end{document}
-
-
-File: asymptote.info, Node: Base modules, Next: Options, Prev: LaTeX usage, Up: Top
-
-8 Base modules
-**************
-
-`Asymptote' currently ships with the following base modules:
-
-* Menu:
-
-* plain:: Default `Asymptote' base file
-* simplex:: Linear programming: simplex method
-* math:: Extend `Asymptote''s math capabilities
-* interpolate:: Interpolation routines
-* geometry:: Geometry routines
-* trembling:: Wavy lines
-* stats:: Statistics routines and histograms
-* patterns:: Custom fill and draw patterns
-* markers:: Custom path marker routines
-* tree:: Dynamic binary search tree
-* binarytree:: Binary tree drawing module
-* drawtree:: Tree drawing module
-* syzygy:: Syzygy and braid drawing module
-* feynman:: Feynman diagrams
-* roundedpath:: Round the sharp corners of paths
-* animation:: Embedded PDF and MPEG movies
-* embed:: Embedding movies, sounds, and 3D objects
-* slide:: Making presentations with `Asymptote'
-* MetaPost:: `MetaPost' compatibility routines
-* unicode:: Accept `unicode' (UTF-8) characters
-* latin1:: Accept `ISO 8859-1' characters
-* babel:: Interface to `LaTeX' `babel' package
-* labelpath:: Drawing curved labels
-* labelpath3:: Drawing curved labels in 3D
-* annotate:: Annotate your PDF files
-* CAD:: 2D CAD pen and measurement functions (DIN 15)
-* graph:: 2D linear & logarithmic graphs
-* palette:: Color density images and palettes
-* three:: 3D vector graphics
-* obj:: 3D obj files
-* graph3:: 3D linear & logarithmic graphs
-* grid3:: 3D grids
-* solids:: 3D solid geometry
-* tube:: 3D rotation minimizing tubes
-* flowchart:: Flowchart drawing routines
-* contour:: Contour lines
-* contour3:: Contour surfaces
-* slopefield:: Slope fields
-* ode:: Ordinary differential equations
-
-
-File: asymptote.info, Node: plain, Next: simplex, Up: Base modules
-
-8.1 `plain'
-===========
-
-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.
-
-
-File: asymptote.info, Node: simplex, Next: math, Prev: plain, Up: Base modules
-
-8.2 `simplex'
-=============
-
-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.
-
-
-File: asymptote.info, Node: math, Next: interpolate, Prev: simplex, Up: Base modules
-
-8.3 `math'
-==========
-
-This package extends `Asymptote''s mathematical capabilities with
-useful functions such as
-
-`void drawline(picture pic=currentpicture, pair P, pair Q, pen p=currentpen);'
- draw the visible portion of the (infinite) line going through `P'
- and `Q', without altering the size of picture `pic', using pen `p'.
-
-`real intersect(triple P, triple Q, triple n, triple Z);'
- returns the intersection time of the extension of the line segment
- `PQ' with the plane perpendicular to `n' and passing through `Z'.
-
-`triple intersectionpoint(triple n0, triple P0, triple n1, triple P1);'
- Return any point on the intersection of the two planes with normals
- `n0' and `n1' passing through points `P0' and `P1', respectively.
- If the planes are parallel, return `(infinity,infinity,infinity)'.
-
-`pair[] quarticroots(real a, real b, real c, real d, real e);'
- returns the four complex roots of the quartic equation
- ax^4+bx^3+cx^2+dx+e=0.
-
-`pair[][] fft(pair[][] a, int sign=1)'
- returns the two-dimensional Fourier transform of a using the given
- `sign'.
-
-`real time(path g, real x, int n=0)'
- returns the `n'th intersection time of path `g' with the vertical
- line through x.
-
-`real time(path g, explicit pair z, int n=0)'
- returns the `n'th intersection time of path `g' with the horizontal
- line through `(0,z.y)'.
-
-`real value(path g, real x, int n=0)'
- returns the `n'th `y' value of `g' at `x'.
-
-`real value(path g, real x, int n=0)'
- returns the `n'th `x' value of `g' at `y=z.y'.
-
-`real slope(path g, real x, int n=0)'
- returns the `n'th slope of `g' at `x'.
-
-`real slope(path g, explicit pair z, int n=0)'
- returns the `n'th slope of `g' at `y=z.y'.
-
- int[][] segment(bool[] b) returns the indices of consecutive
- true-element segments of bool[] `b'.
-
-`real[] partialsum(real[] a)'
- returns the partial sums of a real array `a'.
-
-`real[] partialsum(real[] a, real[] dx)'
- returns the partial `dx'-weighted sums of a real array `a'.
-
-`bool increasing(real[] a, bool strict=false)'
- returns, if `strict=false', whether `i > j' implies `a[i] >=
- a[j]', or if `strict=true', whether `i > j' implies implies `a[i]
- > a[j]'.
-
-`int unique(real[] a, real x)'
- if the sorted array `a' does not contain `x', insert it
- sequentially, returning the index of `x' in the resulting array.
-
-`bool lexorder(pair a, pair b)'
- returns the strict lexicographical partial order of `a' and `b'.
-
-`bool lexorder(triple a, triple b)'
- returns the strict lexicographical partial order of `a' and `b'.
-
-
-File: asymptote.info, Node: interpolate, Next: geometry, Prev: math, Up: Base modules
-
-8.4 `interpolate'
-=================
-
-This module implements Lagrange, Hermite, and standard cubic spline
-interpolation in `Asymptote', as illustrated in the example
-`interpolate1.asy'.
-
-
-File: asymptote.info, Node: geometry, Next: trembling, Prev: interpolate, Up: Base modules
-
-8.5 `geometry'
-==============
-
-This module, written by Philippe Ivaldi, provides an extensive set of
-geometry routines, including `perpendicular' symbols and a `triangle'
-structure. Link to the documentation for the `geometry' module are
-posted here: `http://asymptote.sourceforge.net/links.html', including
-an extensive set of examples,
-`http://www.piprime.fr/files/asymptote/geometry/', and an index:
-
- `http://www.piprime.fr/files/asymptote/geometry/modules/geometry.asy.index.type.html'
-
-
-File: asymptote.info, Node: trembling, Next: stats, Prev: geometry, Up: Base modules
-
-8.6 `trembling'
-===============
-
-This module, written by Philippe Ivaldi and illustrated in the example
-`floatingdisk.asy', allows one to draw wavy lines, as if drawn by hand.
-
-
-File: asymptote.info, Node: stats, Next: patterns, Prev: trembling, Up: Base modules
-
-8.7 `stats'
-===========
-
-This package implements a Gaussian random number generator and a
-collection of statistics routines, including `histogram' and
-`leastsquares'.
-
-
-File: asymptote.info, Node: patterns, Next: markers, Prev: stats, Up: Base modules
-
-8.8 `patterns'
-==============
-
-This package implements `Postscript' tiling patterns and includes
-several convenient pattern generation routines.
-
-
-File: asymptote.info, Node: markers, Next: tree, Prev: patterns, Up: Base modules
-
-8.9 `markers'
-=============
-
-This package implements specialized routines for marking paths and
-angles. The principal mark routine provided by this package is
-markroutine markinterval(int n=1, frame f, bool rotated=false);
- which centers `n' copies of frame `f' within uniformly space intervals
-in arclength along the path, optionally rotated by the angle of the
-local tangent.
-
- The `marker' (*note marker::) routine can be used to construct new
-markers from these predefined frames:
-
-frame stickframe(int n=1, real size=0, pair space=0, real angle=0,
- pair offset=0, pen p=currentpen);
-
-frame circlebarframe(int n=1, real barsize=0,
- real radius=0,real angle=0,
- pair offset=0, pen p=currentpen,
- filltype filltype=NoFill, bool above=false);
-
-frame crossframe(int n=3, real size=0, pair space=0,
- real angle=0, pair offset=0, pen p=currentpen);
-
-frame tildeframe(int n=1, real size=0, pair space=0,
- real angle=0, pair offset=0, pen p=currentpen);
-
- For convenience, this module also constructs the markers
-`StickIntervalMarker', `CrossIntervalMarker',
-`CircleBarIntervalMarker', and `TildeIntervalMarker' from the above
-frames. The example `markers1.asy' illustrates the use of these markers:
-
-
-
-
-This package also provides a routine for marking an angle AOB:
-void markangle(picture pic=currentpicture, Label L="",
- int n=1, real radius=0, real space=0,
- pair A, pair O, pair B, arrowbar arrow=None,
- pen p=currentpen, margin margin=NoMargin,
- marker marker=nomarker);
- as illustrated in the example `markers2.asy'.
-
-
-
-
-
-File: asymptote.info, Node: tree, Next: binarytree, Prev: markers, Up: Base modules
-
-8.10 `tree'
-===========
-
-This package implements an example of a dynamic binary search tree.
-
-
-File: asymptote.info, Node: binarytree, Next: drawtree, Prev: tree, Up: Base modules
-
-8.11 `binarytree'
-=================
-
-This module can be used to draw an arbitrary binary tree and includes an
-input routine for the special case of a binary search tree, as
-illustrated in the example `binarytreetest.asy':
-
-import binarytree;
-
-picture pic,pic2;
-
-binarytree bt=binarytree(1,2,4,nil,5,nil,nil,0,nil,nil,3,6,nil,nil,7);
-draw(pic,bt,condensed=false);
-
-binarytree st=searchtree(10,5,2,1,3,4,7,6,8,9,15,13,12,11,14,17,16,18,19);
-draw(pic2,st,blue,condensed=true);
-
-add(pic.fit(),(0,0),10N);
-add(pic2.fit(),(0,0),10S);
-
-
-
-
-File: asymptote.info, Node: drawtree, Next: syzygy, Prev: binarytree, Up: Base modules
-
-8.12 `drawtree'
-===============
-
-This is a simple tree drawing module used by the example `treetest.asy'.
-
-
-File: asymptote.info, Node: syzygy, Next: feynman, Prev: drawtree, Up: Base modules
-
-8.13 `syzygy'
-=============
-
-This module automates the drawing of braids, relations, and syzygies,
-along with the corresponding equations, as illustrated in the example
-`knots.asy'.
-
-
-File: asymptote.info, Node: feynman, Next: roundedpath, Prev: syzygy, Up: Base modules
-
-8.14 `feynman'
-==============
-
-This package, contributed by Martin Wiebusch, is useful for drawing
-Feynman diagrams, as illustrated by the examples `eetomumu.asy' and
-`fermi.asy'.
-
-
-File: asymptote.info, Node: roundedpath, Next: animation, Prev: feynman, Up: Base modules
-
-8.15 `roundedpath'
-==================
-
-This package, contributed by Stefan Knorr, is useful for rounding the
-sharp corners of paths, as illustrated in the example file
-`roundpath.asy'.
-
-
-File: asymptote.info, Node: animation, Next: embed, Prev: roundedpath, Up: Base modules
-
-8.16 `animation'
-================
-
-This module allows one to generate animations, as illustrated by the
-files `wheel.asy', `wavepacket.asy', and `cube.asy' in the `animations'
-subdirectory of the examples directory. These animations use the
-`ImageMagick' `convert' program to merge multiple images into a GIF or
-MPEG movie.
-
- The related `animate' module, derived from the `animation' module,
-generates higher-quality portable clickable PDF movies, with optional
-controls. This requires installing the package
-
- `http://www.ctan.org/tex-archive/macros/latex/contrib/animate/animate.sty'
- (version 2007/11/30 or later) in a new directory `animate' in the
-local `LaTeX' directory (for example, in
-`/usr/local/share/texmf/tex/latex/animate'). On `UNIX' systems, one
-must then execute the command `texhash'.
-
- The example `pdfmovie.asy' in the `animations' directory, along with
-the slide presentations `slidemovies.asy' and `intro.asy', illustrate
-the use of embedded PDF movies. The examples `inlinemovie.tex' and
-`inlinemovie3.tex' show how to generate and embed PDF movies directly
-within a `LaTeX' file (*note LaTeX usage::). The member function
-string pdf(fit fit=NoBox, real delay=animationdelay, string options="",
- bool keep=settings.keep, bool multipage=true);
- of the `animate' structure accepts any of the `animate.sty' options,
-as described here:
-
- `http://www.ctan.org/tex-archive/macros/latex/contrib/animate/doc/animate.pdf'
-
-
-File: asymptote.info, Node: embed, Next: slide, Prev: animation, Up: Base modules
-
-8.17 `embed'
-============
-
-This module provides an interface to the `LaTeX' package (included with
-`MikTeX')
-
- `http://www.ctan.org/tex-archive/macros/latex/contrib/media9'
- for embedding movies, sounds, and 3D objects into a PDF document.
-Version 0.13 (2012/09/12) of `media9' or later is required.
-
- A more portable method for embedding movie files, which should work
-on any platform and does not require the `media9' package, is provided
-by using the `external' module instead of `embed'.
-
- Examples of the above two interfaces is provided in the file
-`embeddedmovie.asy' and `externalmovie.asy' in the `animations'
-subdirectory of the examples directory. For a higher quality embedded
-movie generated directly by `Asymptote', use the `animate' module along
-with the `animate.sty' package to embed a portable PDF animation (*note
-animate::).
-
- An example of embedding `U3D' code is provided in the file
-`embeddedu3d.asy'.
-
-
-File: asymptote.info, Node: slide, Next: MetaPost, Prev: embed, Up: Base modules
-
-8.18 `slide'
-============
-
-This package provides a simple yet high-quality facility for making
-presentation slides, including portable embedded PDF animations (see
-the file `slidemovies.asy'). A simple example is provided in the file
-`slidedemo.asy'.
-
-
-File: asymptote.info, Node: MetaPost, Next: unicode, Prev: slide, Up: Base modules
-
-8.19 `MetaPost'
-===============
-
-This package provides some useful routines to help `MetaPost' users
-migrate old `MetaPost' code to `Asymptote'. Further contributions here
-are welcome.
-
- Unlike `MetaPost', `Asymptote' does not implicitly solve linear
-equations and therefore does not have the notion of a `whatever'
-unknown. The routine `extension' (*note extension::) provides a useful
-replacement for a common use of `whatever': finding the intersection
-point of the lines through `P', `Q' and `p', `q'. For less common
-occurrences of `whatever', one can use the built-in explicit linear
-equation solver `solve' instead.
-
-
-File: asymptote.info, Node: unicode, Next: latin1, Prev: MetaPost, Up: Base modules
-
-8.20 `unicode'
-==============
-
-Import this package at the beginning of the file to instruct `LaTeX' to
-accept `unicode' (UTF-8) standardized international characters. To use
-Cyrillic fonts, you will need to change the font encoding:
-import unicode;
-texpreamble("\usepackage{mathtext}\usepackage[russian]{babel}");
-defaultpen(font("T2A","cmr","m","n"));
- Support for Chinese, Japanese, and Korean fonts is provided by the CJK
-package:
-
- `http://www.ctan.org/tex-archive/languages/chinese/CJK/'
- The following commands enable the CJK song family (within a label,
-you can also temporarily switch to another family, say kai, by
-prepending `"\CJKfamily{kai}"' to the label string):
-texpreamble("\usepackage{CJK}
-\AtBeginDocument{\begin{CJK*}{GBK}{song}}
-\AtEndDocument{\clearpage\end{CJK*}}");
-
-
-File: asymptote.info, Node: latin1, Next: babel, Prev: unicode, Up: Base modules
-
-8.21 `latin1'
-=============
-
-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'. This module can be used as a template for
-providing support for other ISO 8859 alphabets.
-
-
-File: asymptote.info, Node: babel, Next: labelpath, Prev: latin1, Up: Base modules
-
-8.22 `babel'
-============
-
-This module implements the `LaTeX' `babel' package in `Asymptote'. For
-example:
-import babel;
-babel("german");
-
-
-File: asymptote.info, Node: labelpath, Next: labelpath3, Prev: babel, Up: Base modules
-
-8.23 `labelpath'
-================
-
-This module uses the `PSTricks' `pstextpath' macro to fit labels along
-a path (properly kerned, as illustrated in the example file
-`curvedlabel.asy'), using the command
-void labelpath(picture pic=currentpicture, Label L, path g,
- string justify=Centered, pen p=currentpen);
- Here `justify' is one of `LeftJustified', `Centered', or
-`RightJustified'. The x component of a shift transform applied to the
-Label is interpreted as a shift along the curve, whereas the y
-component is interpreted as a shift away from the curve. All other
-Label transforms are ignored. This package requires the `latex' tex
-engine and inherits the limitations of the `PSTricks' `\pstextpath'
-macro.
-
-
-File: asymptote.info, Node: labelpath3, Next: annotate, Prev: labelpath, Up: Base modules
-
-8.24 `labelpath3'
-=================
-
-This module, contributed by Jens Schwaiger, implements a 3D version of
-`labelpath' that does not require the `PSTricks' package. An example
-is provided in `curvedlabel3.asy'.
-
-
-File: asymptote.info, Node: annotate, Next: CAD, Prev: labelpath3, Up: Base modules
-
-8.25 `annotate'
-===============
-
-This module supports PDF annotations for viewing with `Adobe Reader',
-via the function
-void annotate(picture pic=currentpicture, string title, string text,
- pair position);
- Annotations are illustrated in the example file `annotation.asy'.
-Currently, annotations are only implemented for the `latex' (default)
-and `tex' TeX engines.
-
-
-File: asymptote.info, Node: CAD, Next: graph, Prev: annotate, Up: Base modules
-
-8.26 `CAD'
-==========
-
-This package, contributed by Mark Henning, provides basic pen
-definitions and measurement functions for simple 2D CAD drawings
-according to DIN 15. It is documented separately, in the file `CAD.pdf'.
-
-
-File: asymptote.info, Node: graph, Next: palette, Prev: CAD, Up: Base modules
-
-8.27 `graph'
-============
-
-This package implements two-dimensional linear and logarithmic graphs,
-including automatic scale and tick selection (with the ability to
-override manually). A graph is a `guide' (that can be drawn with the
-draw command, with an optional legend) constructed with one of the
-following routines:
-
- * guide graph(picture pic=currentpicture, real f(real), real a, real b,
- int n=ngraph, real T(real)=identity,
- interpolate join=operator --);
- guide[] graph(picture pic=currentpicture, real f(real), real a, real b,
- int n=ngraph, real T(real)=identity, bool3 cond(real),
- interpolate join=operator --);
-
- Returns a graph using the scaling information for picture `pic'
- (*note automatic scaling::) of the function `f' on the interval
- [`T'(`a'),`T'(`b')], sampling at `n' points evenly spaced in
- [`a',`b'], optionally restricted by the bool3 function `cond' on
- [`a',`b']. If `cond' is:
- * `true', the point is added to the existing guide;
-
- * `default', the point is added to a new guide;
-
- * `false', the point is omitted and a new guide is begun.
- The points are connected using the interpolation specified by
- `join':
- * `operator --' (linear interpolation; the abbreviation
- `Straight' is also accepted);
-
- * `operator ..' (piecewise Bezier cubic spline interpolation;
- the abbreviation `Spline' is also accepted);
-
- * `Hermite' (standard cubic spline interpolation using boundary
- condition `notaknot', `natural', `periodic', `clamped(real
- slopea, real slopeb)'), or `monotonic'. The abbreviation
- `Hermite' is equivalent to `Hermite(notaknot)' for
- nonperiodic data and `Hermite(periodic)' for periodic data).
-
-
- * guide graph(picture pic=currentpicture, real x(real), real y(real),
- real a, real b, int n=ngraph, real T(real)=identity,
- interpolate join=operator --);
- guide[] graph(picture pic=currentpicture, real x(real), real y(real),
- real a, real b, int n=ngraph, real T(real)=identity,
- bool3 cond(real), interpolate join=operator --);
-
- Returns a graph using the scaling information for picture `pic' of
- the parametrized function (`x'(t),`y'(t)) for t in the interval
- [`T'(`a'),`T'(`b')], sampling at `n' points evenly spaced in
- [`a',`b'], optionally restricted by the bool3 function `cond' on
- [`a',`b'], using the given interpolation type.
-
- * guide graph(picture pic=currentpicture, pair z(real), real a, real b,
- int n=ngraph, real T(real)=identity,
- interpolate join=operator --);
- guide[] graph(picture pic=currentpicture, pair z(real), real a, real b,
- int n=ngraph, real T(real)=identity, bool3 cond(real),
- interpolate join=operator --);
-
- Returns a graph using the scaling information for picture `pic' of
- the parametrized function `z'(t) for t in the interval
- [`T'(`a'),`T'(`b')], sampling at `n' points evenly spaced in
- [`a',`b'], optionally restricted by the bool3 function `cond' on
- [`a',`b'], using the given interpolation type.
-
- * guide graph(picture pic=currentpicture, pair[] z,
- interpolate join=operator --);
- guide[] graph(picture pic=currentpicture, pair[] z, bool3[] cond,
- interpolate join=operator --);
-
- Returns a graph using the scaling information for picture `pic' of
- the elements of the array `z', optionally restricted to those
- indices for which the elements of the boolean array `cond' are
- `true', using the given interpolation type.
-
- * guide graph(picture pic=currentpicture, real[] x, real[] y,
- interpolate join=operator --);
- guide[] graph(picture pic=currentpicture, real[] x, real[] y,
- bool3[] cond, interpolate join=operator --);
-
- Returns a graph using the scaling information for picture `pic' of
- the elements of the arrays (`x',`y'), optionally restricted to
- those indices for which the elements of the boolean array `cond'
- are `true', using the given interpolation type.
-
- * guide polargraph(picture pic=currentpicture, real f(real), real a,
- real b, int n=ngraph, interpolate join=operator --);
-
- Returns a polar-coordinate graph using the scaling information for
- picture `pic' of the function `f' on the interval [`a',`b'],
- sampling at `n' evenly spaced points, with the given interpolation
- type.
-
- * guide polargraph(picture pic=currentpicture, real[] r, real[] theta,
- interpolate join=operator--);
- Returns a polar-coordinate graph using the scaling information for
- picture `pic' of the elements of the arrays (`r',`theta'), using
- the given interpolation type.
-
-
-
-
- An axis can be drawn on a picture with one of the following commands:
-
- * void xaxis(picture pic=currentpicture, Label L="", axis axis=YZero,
- real xmin=-infinity, real xmax=infinity, pen p=currentpen,
- ticks ticks=NoTicks, arrowbar arrow=None, bool above=false);
-
- Draw an x axis on picture `pic' from x=`xmin' to x=`xmax' using
- pen `p', optionally labelling it with Label `L'. The relative
- label location along the axis (a real number from [0,1]) defaults
- to 1 (*note Label::), so that the label is drawn at the end of the
- axis. An infinite value of `xmin' or `xmax' specifies that the
- corresponding axis limit will be automatically determined from the
- picture limits. The optional `arrow' argument takes the same
- values as in the `draw' command (*note arrows::). The axis is
- drawn before any existing objects in `pic' unless `above=true'.
- The axis placement is determined by one of the following `axis'
- types:
-
- `YZero(bool extend=true)'
- Request an x axis at y=0 (or y=1 on a logarithmic axis)
- extending to the full dimensions of the picture, unless
- `extend'=false.
-
- `YEquals(real Y, bool extend=true)'
- Request an x axis at y=`Y' extending to the full dimensions
- of the picture, unless `extend'=false.
-
- `Bottom(bool extend=false)'
- Request a bottom axis.
-
- `Top(bool extend=false)'
- Request a top axis.
-
- `BottomTop(bool extend=false)'
- Request a bottom and top axis.
-
-
- Custom axis types can be created by following the examples in
- `graph.asy'. One can easily override the default values for the
- standard axis types: import graph;
-
- YZero=new axis(bool extend=true) {
- return new void(picture pic, axisT axis) {
- real y=pic.scale.x.scale.logarithmic ? 1 : 0;
- axis.value=I*pic.scale.y.T(y);
- axis.position=1;
- axis.side=right;
- axis.align=2.5E;
- axis.value2=Infinity;
- axis.extend=extend;
- };
- };
- YZero=YZero();
-
- The default tick option is `NoTicks'. The options `LeftTicks',
- `RightTicks', or `Ticks' can be used to draw ticks on the left,
- right, or both sides of the path, relative to the direction in
- which the path is drawn. These tick routines accept a number of
- optional arguments: ticks LeftTicks(Label format="", ticklabel ticklabel=null,
- bool beginlabel=true, bool endlabel=true,
- int N=0, int n=0, real Step=0, real step=0,
- bool begin=true, bool end=true, tickmodifier modify=None,
- real Size=0, real size=0, bool extend=false,
- pen pTick=nullpen, pen ptick=nullpen);
-
- If any of these parameters are omitted, reasonable defaults will
- be chosen:
- `Label format'
- override the default tick label format (`defaultformat',
- initially "$%.4g$"), rotation, pen, and alignment (for
- example, `LeftSide', `Center', or `RightSide') relative to
- the axis. To enable `LaTeX' math mode fonts, the format
- string should begin and end with `$' *note format::. If the
- format string is `trailingzero', trailing zeros will be added
- to the tick labels; if the format string is `"%"', the tick
- label will be suppressed;
-
- `ticklabel'
- is a function `string(real x)' returning the label (by
- default, format(format.s,x)) for each major tick value `x';
-
- `bool beginlabel'
- include the first label;
-
- `bool endlabel'
- include the last label;
-
- `int N'
- when automatic scaling is enabled (the default; *note
- automatic scaling::), divide a linear axis evenly into this
- many intervals, separated by major ticks; for a logarithmic
- axis, this is the number of decades between labelled ticks;
-
- `int n'
- divide each interval into this many subintervals, separated
- by minor ticks;
-
- `real Step'
- the tick value spacing between major ticks (if `N'=`0');
-
- `real step'
- the tick value spacing between minor ticks (if `n'=`0');
-
- `bool begin'
- include the first major tick;
-
- `bool end'
- include the last major tick;
-
- `tickmodifier modify;'
- an optional function that takes and returns a `tickvalue'
- structure having real[] members `major' and `minor'
- consisting of the tick values (to allow modification of the
- automatically generated tick values);
-
- `real Size'
- the size of the major ticks (in `PostScript' coordinates);
-
- `real size'
- the size of the minor ticks (in `PostScript' coordinates);
-
- `bool extend;'
- extend the ticks between two axes (useful for drawing a grid
- on the graph);
-
- `pen pTick'
- an optional pen used to draw the major ticks;
-
- `pen ptick'
- an optional pen used to draw the minor ticks.
-
-
- For convenience, the predefined tickmodifiers `OmitTick(... real[]
- x)', `OmitTickInterval(real a, real b)', and
- `OmitTickIntervals(real[] a, real[] b)' can be used to remove
- specific auto-generated ticks and their labels. The
- `OmitFormat(string s=defaultformat ... real[] x)' ticklabel can be
- used to remove specific tick labels but not the corresponding
- ticks. The tickmodifier `NoZero' is an abbreviation for
- `OmitTick(0)' and the ticklabel `NoZeroFormat' is an abbrevation
- for `OmitFormat(0)'.
-
- It is also possible to specify custom tick locations with
- `LeftTicks', `RightTicks', and `Ticks' by passing explicit real
- arrays `Ticks' and (optionally) `ticks' containing the locations
- of the major and minor ticks, respectively: ticks LeftTicks(Label format="", ticklabel ticklabel=null,
- bool beginlabel=true, bool endlabel=true,
- real[] Ticks, real[] ticks=new real[],
- real Size=0, real size=0, bool extend=false,
- pen pTick=nullpen, pen ptick=nullpen)
-
- * void yaxis(picture pic=currentpicture, Label L="", axis axis=XZero,
- real ymin=-infinity, real ymax=infinity, pen p=currentpen,
- ticks ticks=NoTicks, arrowbar arrow=None, bool above=false,
- bool autorotate=true);
-
- Draw a y axis on picture `pic' from y=`ymin' to y=`ymax' using pen
- `p', optionally labelling it with a Label `L' that is autorotated
- unless `autorotate=false'. The relative location of the label (a
- real number from [0,1]) defaults to 1 (*note Label::). An infinite
- value of `ymin' or `ymax' specifies that the corresponding axis
- limit will be automatically determined from the picture limits.
- The optional `arrow' argument takes the same values as in the
- `draw' command (*note arrows::). The axis is drawn before any
- existing objects in `pic' unless `above=true'. The tick type is
- specified by `ticks' and the axis placement is determined by one
- of the following `axis' types:
-
- `XZero(bool extend=true)'
- Request a y axis at x=0 (or x=1 on a logarithmic axis)
- extending to the full dimensions of the picture, unless
- `extend'=false.
-
- `XEquals(real X, bool extend=true)'
- Request a y axis at x=`X' extending to the full dimensions of
- the picture, unless `extend'=false.
-
- `Left(bool extend=false)'
- Request a left axis.
-
- `Right(bool extend=false)'
- Request a right axis.
-
- `LeftRight(bool extend=false)'
- Request a left and right axis.
-
-
- * For convenience, the functions void xequals(picture pic=currentpicture, Label L="", real x,
- bool extend=false, real ymin=-infinity, real ymax=infinity,
- pen p=currentpen, ticks ticks=NoTicks, bool above=true,
- arrowbar arrow=None);
- and void yequals(picture pic=currentpicture, Label L="", real y,
- bool extend=false, real xmin=-infinity, real xmax=infinity,
- pen p=currentpen, ticks ticks=NoTicks, bool above=true,
- arrowbar arrow=None);
- can be respectively used to call `yaxis' and `xaxis' with the
- appropriate axis types `XEquals(x,extend)' and
- `YEquals(y,extend)'. This is the recommended way of drawing
- vertical or horizontal lines and axes at arbitrary locations.
-
- * void axes(picture pic=currentpicture, Label xlabel="", Label ylabel="",
- bool extend=true,
- pair min=(-infinity,-infinity), pair max=(infinity,infinity),
- pen p=currentpen, arrowbar arrow=None, bool above=false);
- This convenience routine draws both x and y axes on picture `pic'
- from `min' to `max', with optional labels `xlabel' and `ylabel'
- and any arrows specified by `arrow'. The axes are drawn on top of
- existing objects in `pic' only if `above=true'.
-
- * void axis(picture pic=currentpicture, Label L="", path g,
- pen p=currentpen, ticks ticks, ticklocate locate,
- arrowbar arrow=None, int[] divisor=new int[],
- bool above=false, bool opposite=false);
-
- This routine can be used to draw on picture `pic' a general axis
- based on an arbitrary path `g', using pen `p'. One can optionally
- label the axis with Label `L' and add an arrow `arrow'. The tick
- type is given by `ticks'. The optional integer array `divisor'
- specifies what tick divisors to try in the attempt to produce
- uncrowded tick labels. A `true' value for the flag `opposite'
- identifies an unlabelled secondary axis (typically drawn opposite
- a primary axis). The axis is drawn before any existing objects in
- `pic' unless `above=true'. The tick locator `ticklocate' is
- constructed by the routine ticklocate ticklocate(real a, real b, autoscaleT S=defaultS,
- real tickmin=-infinity, real tickmax=infinity,
- real time(real)=null, pair dir(real)=zero);
- where `a' and `b' specify the respective tick values at
- `point(g,0)' and `point(g,length(g))', `S' specifies the
- autoscaling transformation, the function `real time(real v)'
- returns the time corresponding to the value `v', and `pair
- dir(real t)' returns the absolute tick direction as a function of
- `t' (zero means draw the tick perpendicular to the axis).
-
- * These routines are useful for manually putting ticks and labels on
- axes (if the variable `Label' is given as the `Label' argument,
- the `format' argument will be used to format a string based on the
- tick location): void xtick(picture pic=currentpicture, Label L="", explicit pair z,
- pair dir=N, string format="",
- real size=Ticksize, pen p=currentpen);
- void xtick(picture pic=currentpicture, Label L="", real x,
- pair dir=N, string format="",
- real size=Ticksize, pen p=currentpen);
- void ytick(picture pic=currentpicture, Label L="", explicit pair z,
- pair dir=E, string format="",
- real size=Ticksize, pen p=currentpen);
- void ytick(picture pic=currentpicture, Label L="", real y,
- pair dir=E, string format="",
- real size=Ticksize, pen p=currentpen);
- void tick(picture pic=currentpicture, pair z,
- pair dir, real size=Ticksize, pen p=currentpen);
- void labelx(picture pic=currentpicture, Label L="", explicit pair z,
- align align=S, string format="", pen p=currentpen);
- void labelx(picture pic=currentpicture, Label L="", real x,
- align align=S, string format="", pen p=currentpen);
- void labelx(picture pic=currentpicture, Label L,
- string format="", explicit pen p=currentpen);
- void labely(picture pic=currentpicture, Label L="", explicit pair z,
- align align=W, string format="", pen p=currentpen);
- void labely(picture pic=currentpicture, Label L="", real y,
- align align=W, string format="", pen p=currentpen);
- void labely(picture pic=currentpicture, Label L,
- string format="", explicit pen p=currentpen);
-
- Here are some simple examples of two-dimensional graphs:
-
- 1. This example draws a textbook-style graph of y= exp(x), with the y
- axis starting at y=0: import graph;
- size(150,0);
-
- real f(real x) {return exp(x);}
- pair F(real x) {return (x,f(x));}
-
- xaxis("$x$");
- yaxis("$y$",0);
-
- draw(graph(f,-4,2,operator ..),red);
-
- labely(1,E);
- label("$e^x$",F(1),SE);
-
-
-
- 2. The next example draws a scientific-style graph with a legend.
- The position of the legend can be adjusted either explicitly or by
- using the graphical user interface `xasy' (*note GUI::). If an
- `UnFill(real xmargin=0, real ymargin=xmargin)' or `Fill(pen)'
- option is specified to `add', the legend will obscure any
- underlying objects. Here we illustrate how to clip the portion of
- the picture covered by a label:
-
- import graph;
-
- size(400,200,IgnoreAspect);
-
- real Sin(real t) {return sin(2pi*t);}
- real Cos(real t) {return cos(2pi*t);}
-
- draw(graph(Sin,0,1),red,"$\sin(2\pi x)$");
- draw(graph(Cos,0,1),blue,"$\cos(2\pi x)$");
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks(trailingzero));
-
- label("LABEL",point(0),UnFill(1mm));
-
- add(legend(),point(E),20E,UnFill);
-
-
-
- To specify a fixed size for the graph proper, use `attach': import graph;
-
- size(250,200,IgnoreAspect);
-
- real Sin(real t) {return sin(2pi*t);}
- real Cos(real t) {return cos(2pi*t);}
-
- draw(graph(Sin,0,1),red,"$\sin(2\pi x)$");
- draw(graph(Cos,0,1),blue,"$\cos(2\pi x)$");
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks(trailingzero));
-
- label("LABEL",point(0),UnFill(1mm));
-
- attach(legend(),truepoint(E),20E,UnFill);
- A legend can have multiple entries per line: import graph;
- size(8cm,6cm,IgnoreAspect);
-
- typedef real realfcn(real);
- realfcn F(real p) {
- return new real(real x) {return sin(p*x);};
- };
-
- for(int i=1; i < 5; ++i)
- draw(graph(F(i*pi),0,1),Pen(i),
- "$\sin("+(i == 1 ? "" : (string) i)+"\pi x)$");
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks(trailingzero));
-
- attach(legend(2),(point(S).x,truepoint(S).y),10S,UnFill);
-
-
-
- 3. This example draws a graph of one array versus another (both of
- the same size) using custom tick locations and a smaller font size
- for the tick labels on the y axis. import graph;
-
- size(200,150,IgnoreAspect);
-
- real[] x={0,1,2,3};
- real[] y=x^2;
-
- draw(graph(x,y),red);
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,
- RightTicks(Label(fontsize(8pt)),new real[]{0,4,9}));
-
-
-
- 4. This example shows how to graph columns of data read from a file. import graph;
-
- size(200,150,IgnoreAspect);
-
- file in=input("filegraph.dat").line();
- real[][] a=in.dimension(0,0);
- a=transpose(a);
-
- real[] x=a[0];
- real[] y=a[1];
-
- draw(graph(x,y),red);
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks);
-
-
-
- 5. The next example draws two graphs of an array of coordinate pairs,
- using frame alignment and data markers. In the left-hand graph, the
- markers, constructed with marker marker(path g, markroutine markroutine=marknodes,
- pen p=currentpen, filltype filltype=NoFill,
- bool above=true);
- using the path `unitcircle' (*note filltype::), are drawn below
- each node. Any frame can be converted to a marker, using marker marker(frame f, markroutine markroutine=marknodes,
- bool above=true);
- In the right-hand graph, the unit n-sided regular polygon
- `polygon(int n)' and the unit n-point cyclic cross `cross(int n,
- bool round=true, real r=0)' (where `r' is an optional "inner"
- radius) are used to build a custom marker frame. Here
- `markuniform(bool centered=false, int n, bool rotated=false)' adds
- this frame at `n' uniformly spaced points along the arclength of
- the path, optionally rotated by the angle of the local tangent to
- the path (if centered is true, the frames will be centered within
- `n' evenly spaced arclength intervals). Alternatively, one can use
- markroutine `marknodes' to request that the marks be placed at each
- Bezier node of the path, or markroutine `markuniform(pair z(real
- t), real a, real b, int n)' to place marks at points `z(t)' for n
- evenly spaced values of `t' in `[a,b]'.
-
- These markers are predefined: marker[] Mark={
- marker(scale(circlescale)*unitcircle),
- marker(polygon(3)),marker(polygon(4)),
- marker(polygon(5)),marker(invert*polygon(3)),
- marker(cross(4)),marker(cross(6))
- };
-
- marker[] MarkFill={
- marker(scale(circlescale)*unitcircle,Fill),marker(polygon(3),Fill),
- marker(polygon(4),Fill),marker(polygon(5),Fill),
- marker(invert*polygon(3),Fill)
- };
-
- The example also illustrates the `errorbar' routines:
-
- void errorbars(picture pic=currentpicture, pair[] z, pair[] dp,
- pair[] dm={}, bool[] cond={}, pen p=currentpen,
- real size=0);
-
- void errorbars(picture pic=currentpicture, real[] x, real[] y,
- real[] dpx, real[] dpy, real[] dmx={}, real[] dmy={},
- bool[] cond={}, pen p=currentpen, real size=0);
-
- Here, the positive and negative extents of the error are given by
- the absolute values of the elements of the pair array `dp' and the
- optional pair array `dm'. If `dm' is not specified, the positive
- and negative extents of the error are assumed to be equal. import graph;
-
- picture pic;
- real xsize=200, ysize=140;
- size(pic,xsize,ysize,IgnoreAspect);
-
- pair[] f={(5,5),(50,20),(90,90)};
- pair[] df={(0,0),(5,7),(0,5)};
-
- errorbars(pic,f,df,red);
- draw(pic,graph(pic,f),"legend",
- marker(scale(0.8mm)*unitcircle,red,FillDraw(blue),above=false));
-
- scale(pic,true);
-
- xaxis(pic,"$x$",BottomTop,LeftTicks);
- yaxis(pic,"$y$",LeftRight,RightTicks);
- add(pic,legend(pic),point(pic,NW),20SE,UnFill);
-
- picture pic2;
- size(pic2,xsize,ysize,IgnoreAspect);
-
- frame mark;
- filldraw(mark,scale(0.8mm)*polygon(6),green,green);
- draw(mark,scale(0.8mm)*cross(6),blue);
-
- draw(pic2,graph(pic2,f),marker(mark,markuniform(5)));
-
- scale(pic2,true);
-
- xaxis(pic2,"$x$",BottomTop,LeftTicks);
- yaxis(pic2,"$y$",LeftRight,RightTicks);
-
- yequals(pic2,55.0,red+Dotted);
- xequals(pic2,70.0,red+Dotted);
-
- // Fit pic to W of origin:
- add(pic.fit(),(0,0),W);
-
- // Fit pic2 to E of (5mm,0):
- add(pic2.fit(),(5mm,0),E);
-
-
-
- 6. A custom mark routine can be also be specified: import graph;
-
- size(200,100,IgnoreAspect);
-
- markroutine marks() {
- return new void(picture pic=currentpicture, frame f, path g) {
- path p=scale(1mm)*unitcircle;
- for(int i=0; i <= length(g); ++i) {
- pair z=point(g,i);
- frame f;
- if(i % 4 == 0) {
- fill(f,p);
- add(pic,f,z);
- } else {
- if(z.y > 50) {
- pic.add(new void(frame F, transform t) {
- path q=shift(t*z)*p;
- unfill(F,q);
- draw(F,q);
- });
- } else {
- draw(f,p);
- add(pic,f,z);
- }
- }
- }
- };
- }
-
- pair[] f={(5,5),(40,20),(55,51),(90,30)};
-
- draw(graph(f),marker(marks()));
-
- scale(true);
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks);
-
-
-
- 7. This example shows how to label an axis with arbitrary strings. import graph;
-
- size(400,150,IgnoreAspect);
-
- real[] x=sequence(12);
- real[] y=sin(2pi*x/12);
-
- scale(false);
-
- string[] month={"Jan","Feb","Mar","Apr","May","Jun",
- "Jul","Aug","Sep","Oct","Nov","Dec"};
-
- draw(graph(x,y),red,MarkFill[0]);
-
- xaxis(BottomTop,LeftTicks(new string(real x) {
- return month[round(x % 12)];}));
- yaxis("$y$",LeftRight,RightTicks(4));
-
-
-
- 8. The next example draws a graph of a parametrized curve. The calls
- to xlimits(picture pic=currentpicture, real min=-infinity,
- real max=infinity, bool crop=NoCrop);
- and the analogous function `ylimits' can be uncommented to set
- the respective axes limits for picture `pic' to the specified
- `min' and `max' values. Alternatively, the function void limits(picture pic=currentpicture, pair min, pair max, bool crop=NoCrop);
- can be used to limit the axes to the box having opposite vertices
- at the given pairs). Existing objects in picture `pic' will be
- cropped to lie within the given limits if `crop'=`Crop'. The
- function `crop(picture pic)' can be used to crop a graph to the
- current graph limits. import graph;
-
- size(0,200);
-
- real x(real t) {return cos(2pi*t);}
- real y(real t) {return sin(2pi*t);}
-
- draw(graph(x,y,0,1));
-
- //limits((0,-1),(1,0),Crop);
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks(trailingzero));
-
-
-
- The next example illustrates how one can extract a common axis
- scaling factor. import graph;
-
- axiscoverage=0.9;
- size(200,IgnoreAspect);
-
- real[] x={-1e-11,1e-11};
- real[] y={0,1e6};
-
- real xscale=round(log10(max(x)));
- real yscale=round(log10(max(y)))-1;
-
- draw(graph(x*10^(-xscale),y*10^(-yscale)),red);
-
- xaxis("$x/10^{"+(string) xscale+"}$",BottomTop,LeftTicks);
- yaxis("$y/10^{"+(string) yscale+"}$",LeftRight,RightTicks(trailingzero));
-
-
-
- Axis scaling can be requested and/or automatic selection of the
- axis limits can be inhibited with one of these `scale' routines: void scale(picture pic=currentpicture, scaleT x, scaleT y);
-
- void scale(picture pic=currentpicture, bool xautoscale=true,
- bool yautoscale=xautoscale, bool zautoscale=yautoscale);
-
- This sets the scalings for picture `pic'. The `graph' routines
- accept an optional `picture' argument for determining the
- appropriate scalings to use; if none is given, it uses those set
- for `currentpicture'.
-
- Two frequently used scaling routines `Linear' and `Log' are
- predefined in `graph'.
-
- All picture coordinates (including those in paths and those given
- to the `label' and `limits' functions) are always treated as linear
- (post-scaled) coordinates. Use pair Scale(picture pic=currentpicture, pair z);
- to convert a graph coordinate into a scaled picture coordinate.
-
- The x and y components can be individually scaled using the
- analogous routines real ScaleX(picture pic=currentpicture, real x);
- real ScaleY(picture pic=currentpicture, real y);
-
- The predefined scaling routines can be given two optional boolean
- arguments: `automin=false' and `automax=automin'. These default to
- `false' but can be respectively set to `true' to enable automatic
- selection of "nice" axis minimum and maximum values. The `Linear'
- scaling can also take as optional final arguments a multiplicative
- scaling factor and intercept (e.g. for a depth axis, `Linear(-1)'
- requests axis reversal).
-
- For example, to draw a log/log graph of a function, use
- `scale(Log,Log)': import graph;
-
- size(200,200,IgnoreAspect);
-
- real f(real t) {return 1/t;}
-
- scale(Log,Log);
-
- draw(graph(f,0.1,10));
-
- //limits((1,0.1),(10,0.5),Crop);
-
- dot(Label("(3,5)",align=S),Scale((3,5)));
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$y$",LeftRight,RightTicks);
-
-
-
- By extending the ticks, one can easily produce a logarithmic grid: import graph;
- size(200,200,IgnoreAspect);
-
- real f(real t) {return 1/t;}
-
- scale(Log,Log);
- draw(graph(f,0.1,10),red);
- pen thin=linewidth(0.5*linewidth());
- xaxis("$x$",BottomTop,LeftTicks(begin=false,end=false,extend=true,
- ptick=thin));
- yaxis("$y$",LeftRight,RightTicks(begin=false,end=false,extend=true,
- ptick=thin));
-
-
-
- One can also specify custom tick locations and formats for
- logarithmic axes: import graph;
-
- size(300,175,IgnoreAspect);
- scale(Log,Log);
- draw(graph(identity,5,20));
- xlimits(5,20);
- ylimits(1,100);
- xaxis("$M/M_\odot$",BottomTop,LeftTicks(DefaultFormat,
- new real[] {6,10,12,14,16,18}));
- yaxis("$\nu_{\rm upp}$ [Hz]",LeftRight,RightTicks(DefaultFormat));
-
-
-
- It is easy to draw logarithmic graphs with respect to other bases: import graph;
- size(200,IgnoreAspect);
-
- // Base-2 logarithmic scale on y-axis:
-
- real log2(real x) {static real log2=log(2); return log(x)/log2;}
- real pow2(real x) {return 2^x;}
-
- scaleT yscale=scaleT(log2,pow2,logarithmic=true);
- scale(Linear,yscale);
-
- real f(real x) {return 1+x^2;}
-
- draw(graph(f,-4,4));
-
- yaxis("$y$",ymin=1,ymax=f(5),RightTicks(Label(Fill(white))),EndArrow);
- xaxis("$x$",xmin=-5,xmax=5,LeftTicks,EndArrow);
-
-
-
- Here is an example of "broken" linear x and logarithmic y axes
- that omit the segments [3,8] and [100,1000], respectively. In the
- case of a logarithmic axis, the break endpoints are automatically
- rounded to the nearest integral power of the base. import graph;
-
- size(200,150,IgnoreAspect);
-
- // Break the x axis at 3; restart at 8:
- real a=3, b=8;
-
- // Break the y axis at 100; restart at 1000:
- real c=100, d=1000;
-
- scale(Broken(a,b),BrokenLog(c,d));
-
- real[] x={1,2,4,6,10};
- real[] y=x^4;
-
- draw(graph(x,y),red,MarkFill[0]);
-
- xaxis("$x$",BottomTop,LeftTicks(Break(a,b)));
- yaxis("$y$",LeftRight,RightTicks(Break(c,d)));
-
- label(rotate(90)*Break,(a,point(S).y));
- label(rotate(90)*Break,(a,point(N).y));
- label(Break,(point(W).x,ScaleY(c)));
- label(Break,(point(E).x,ScaleY(c)));
-
-
-
- 9. `Asymptote' can draw secondary axes with the routines picture secondaryX(picture primary=currentpicture, void f(picture));
- picture secondaryY(picture primary=currentpicture, void f(picture));
-
- In this example, `secondaryY' is used to draw a secondary linear y
- axis against a primary logarithmic y axis: import graph;
- texpreamble("\def\Arg{\mathop {\rm Arg}\nolimits}");
-
- size(10cm,5cm,IgnoreAspect);
-
- real ampl(real x) {return 2.5/(1+x^2);}
- real phas(real x) {return -atan(x)/pi;}
-
- scale(Log,Log);
- draw(graph(ampl,0.01,10));
- ylimits(0.001,100);
-
- xaxis("$\omega\tau_0$",BottomTop,LeftTicks);
- yaxis("$|G(\omega\tau_0)|$",Left,RightTicks);
-
- picture q=secondaryY(new void(picture pic) {
- scale(pic,Log,Linear);
- draw(pic,graph(pic,phas,0.01,10),red);
- ylimits(pic,-1.0,1.5);
- yaxis(pic,"$\Arg G/\pi$",Right,red,
- LeftTicks("$% #.1f$",
- begin=false,end=false));
- yequals(pic,1,Dotted);
- });
- label(q,"(1,0)",Scale(q,(1,0)),red);
- add(q);
-
-
-
- A secondary logarithmic y axis can be drawn like this: import graph;
-
- size(9cm,6cm,IgnoreAspect);
- string data="secondaryaxis.csv";
-
- file in=input(data).line().csv();
-
- string[] titlelabel=in;
- string[] columnlabel=in;
-
- real[][] a=in.dimension(0,0);
- a=transpose(a);
- real[] t=a[0], susceptible=a[1], infectious=a[2], dead=a[3], larvae=a[4];
- real[] susceptibleM=a[5], exposed=a[6],infectiousM=a[7];
-
- scale(true);
-
- draw(graph(t,susceptible,t >= 10 & t <= 15));
- draw(graph(t,dead,t >= 10 & t <= 15),dashed);
-
- xaxis("Time ($\tau$)",BottomTop,LeftTicks);
- yaxis(Left,RightTicks);
-
- picture secondary=secondaryY(new void(picture pic) {
- scale(pic,Linear(true),Log(true));
- draw(pic,graph(pic,t,infectious,t >= 10 & t <= 15),red);
- yaxis(pic,Right,red,LeftTicks(begin=false,end=false));
- });
-
- add(secondary);
- label(shift(5mm*N)*"Proportion of crows",point(NW),E);
-
-
-
- 10. Here is a histogram example, which uses the `stats' module. import graph;
- import stats;
-
- size(400,200,IgnoreAspect);
-
- int n=10000;
- real[] a=new real[n];
- for(int i=0; i < n; ++i) a[i]=Gaussrand();
-
- draw(graph(Gaussian,min(a),max(a)),blue);
-
- // Optionally calculate "optimal" number of bins a la Shimazaki and Shinomoto.
- int N=bins(a);
-
- histogram(a,min(a),max(a),N,normalize=true,low=0,lightred,black,bars=false);
-
- xaxis("$x$",BottomTop,LeftTicks);
- yaxis("$dP/dx$",LeftRight,RightTicks(trailingzero));
-
-
-
- 11. Here is an example of reading column data in from a file and a
- least-squares fit, using the `stats' module. size(400,200,IgnoreAspect);
-
- import graph;
- import stats;
-
- file fin=input("leastsquares.dat").line();
-
- real[][] a=fin.dimension(0,0);
- a=transpose(a);
-
- real[] t=a[0], rho=a[1];
-
- // Read in parameters from the keyboard:
- //real first=getreal("first");
- //real step=getreal("step");
- //real last=getreal("last");
-
- real first=100;
- real step=50;
- real last=700;
-
- // Remove negative or zero values of rho:
- t=rho > 0 ? t : null;
- rho=rho > 0 ? rho : null;
-
- scale(Log(true),Linear(true));
-
- int n=step > 0 ? ceil((last-first)/step) : 0;
-
- real[] T,xi,dxi;
-
- for(int i=0; i <= n; ++i) {
- real first=first+i*step;
- real[] logrho=(t >= first & t <= last) ? log(rho) : null;
- real[] logt=(t >= first & t <= last) ? -log(t) : null;
-
- if(logt.length < 2) break;
-
- // Fit to the line logt=L.m*logrho+L.b:
- linefit L=leastsquares(logt,logrho);
-
- T.push(first);
- xi.push(L.m);
- dxi.push(L.dm);
- }
-
- draw(graph(T,xi),blue);
- errorbars(T,xi,dxi,red);
-
- crop();
-
- ylimits(0);
-
- xaxis("$T$",BottomTop,LeftTicks);
- yaxis("$\xi$",LeftRight,RightTicks);
-
-
-
- 12. Here is an example that illustrates the general `axis' routine. import graph;
- size(0,100);
-
- path g=ellipse((0,0),1,2);
-
- scale(true);
-
- axis(Label("C",align=10W),g,LeftTicks(endlabel=false,8,end=false),
- ticklocate(0,360,new real(real v) {
- path h=(0,0)--max(abs(max(g)),abs(min(g)))*dir(v);
- return intersect(g,h)[0];}));
-
-
-
- 13. To draw a vector field of `n' arrows evenly spaced along the
- arclength of a path, use the routine picture vectorfield(path vector(real), path g, int n, bool truesize=false,
- pen p=currentpen, arrowbar arrow=Arrow);
- as illustrated in this simple example of a flow field: import graph;
- defaultpen(1.0);
-
- size(0,150,IgnoreAspect);
-
- real arrowsize=4mm;
- real arrowlength=2arrowsize;
-
- typedef path vector(real);
-
- // Return a vector interpolated linearly between a and b.
- vector vector(pair a, pair b) {
- return new path(real x) {
- return (0,0)--arrowlength*interp(a,b,x);
- };
- }
-
- real f(real x) {return 1/x;}
-
- real epsilon=0.5;
- path g=graph(f,epsilon,1/epsilon);
-
- int n=3;
- draw(g);
- xaxis("$x$");
- yaxis("$y$");
-
- add(vectorfield(vector(W,W),g,n,true));
- add(vectorfield(vector(NE,NW),(0,0)--(point(E).x,0),n,true));
- add(vectorfield(vector(NE,NE),(0,0)--(0,point(N).y),n,true));
-
-
-
- 14. To draw a vector field of `nx'\times`ny' arrows in `box(a,b)', use
- the routine picture vectorfield(path vector(pair), pair a, pair b,
- int nx=nmesh, int ny=nx, bool truesize=false,
- real maxlength=truesize ? 0 : maxlength(a,b,nx,ny),
- bool cond(pair z)=null, pen p=currentpen,
- arrowbar arrow=Arrow, margin margin=PenMargin)
- as illustrated in this example: import graph;
- size(100);
-
- pair a=(0,0);
- pair b=(2pi,2pi);
-
- path vector(pair z) {return (0,0)--(sin(z.x),cos(z.y));}
-
- add(vectorfield(vector,a,b));
-
-
-
- 15. The following scientific graphs, which illustrate many features of
- `Asymptote''s graphics routines, were generated from the examples
- `diatom.asy' and `westnile.asy', using the comma-separated data in
- `diatom.csv' and `westnile.csv'.
-
-
-
-File: asymptote.info, Node: palette, Next: three, Prev: graph, Up: Base modules
-
-8.28 `palette'
-==============
-
-`Asymptote' can also generate color density images and palettes. The
-following palettes are predefined in `palette.asy':
-
-`pen[] Grayscale(int NColors=256)'
- a grayscale palette;
-
-`pen[] Rainbow(int NColors=32766)'
- a rainbow spectrum;
-
-`pen[] BWRainbow(int NColors=32761)'
- a rainbow spectrum tapering off to black/white at the ends;
-
-`pen[] BWRainbow2(int NColors=32761)'
- a double rainbow palette tapering off to black/white at the ends,
- with a linearly scaled intensity.
-
-`pen[] Wheel(int NColors=32766)'
- a full color wheel palette;
-
-`pen[] Gradient(int NColors=256 ... pen[] p)'
- a palette varying linearly over the specified array of pens, using
- NColors in each interpolation interval;
-
-
- The function `cmyk(pen[] Palette)' may be used to convert any of
-these palettes to the CMYK colorspace.
-
- A color density plot using palette `palette' can be generated from a
-function `f'(x,y) and added to a picture `pic':
-bounds image(picture pic=currentpicture, real f(real, real),
- range range=Full, pair initial, pair final,
- int nx=ngraph, int ny=nx, pen[] palette, bool antialias=false)
- The function `f' will be sampled at `nx' and `ny' evenly spaced points
-over a rectangle defined by the points `initial' and `final',
-respecting the current graphical scaling of `pic'. The color space is
-scaled according to the z axis scaling (*note automatic scaling::). A
-bounds structure for the function values is returned:
-struct bounds {
- real min;
- real max;
- // Possible tick intervals:
- int[] divisor;
-}
- This information can be used for generating an optional palette bar.
-The palette color space corresponds to a range of values specified by
-the argument `range', which can be `Full', `Automatic', or an explicit
-range `Range(real min, real max)'. Here `Full' specifies a range
-varying from the minimum to maximum values of the function over the
-sampling interval, while `Automatic' selects "nice" limits. The
-example `imagecontour.asy' illustrates how level sets (contour lines)
-can be drawn on a color density plot (*note contour::).
-
- A color density plot can also be generated from an explicit real[][]
-array `data':
-bounds image(picture pic=currentpicture, real[][] f, range range=Full,
- pair initial, pair final, pen[] palette,
- bool transpose=(initial.x < final.x && initial.y < final.y),
- bool copy=true, bool antialias=false);
- If the initial point is to the left and below the final point, by
-default the array indices are interpreted according to the Cartesian
-convention (first index: x, second index: y) rather than the usual
-matrix convention (first index: -y, second index: x).
-
- To construct an image from an array of irregularly spaced points and
-an array of values `f' at these points, use one of the routines
-bounds image(picture pic=currentpicture, pair[] z, real[] f,
- range range=Full, pen[] palette)
-bounds image(picture pic=currentpicture, real[] x, real[] y, real[] f,
- range range=Full, pen[] palette)
-
- An optionally labelled palette bar may be generated with the routine
-void palette(picture pic=currentpicture, Label L="", bounds bounds,
- pair initial, pair final, axis axis=Right, pen[] palette,
- pen p=currentpen, paletteticks ticks=PaletteTicks,
- bool copy=true, bool antialias=false);
- The color space of `palette' is taken to be over bounds `bounds' with
-scaling given by the z scaling of `pic'. The palette orientation is
-specified by `axis', which may be one of `Right', `Left', `Top', or
-`Bottom'. The bar is drawn over the rectangle from `initial' to
-`final'. The argument `paletteticks' is a special tick type (*note
-ticks::) that takes the following arguments:
-paletteticks PaletteTicks(Label format="", ticklabel ticklabel=null,
- bool beginlabel=true, bool endlabel=true,
- int N=0, int n=0, real Step=0, real step=0,
- pen pTick=nullpen, pen ptick=nullpen);
-
- The image and palette bar can be fit to a frame and added and
-optionally aligned to a picture at the desired location:
-
-size(12cm,12cm);
-
-import graph;
-import palette;
-
-int n=256;
-real ninv=2pi/n;
-real[][] v=new real[n][n];
-
-for(int i=0; i < n; ++i)
- for(int j=0; j < n; ++j)
- v[i][j]=sin(i*ninv)*cos(j*ninv);
-
-pen[] Palette=BWRainbow();
-
-picture bar;
-
-bounds range=image(v,(0,0),(1,1),Palette);
-palette(bar,"$A$",range,(0,0),(0.5cm,8cm),Right,Palette,
- PaletteTicks("$%+#.1f$"));
-add(bar.fit(),point(E),30E);
-
-
-
-Here is an example that uses logarithmic scaling of the function values:
-
-import graph;
-import palette;
-
-size(10cm,10cm,IgnoreAspect);
-
-real f(real x, real y) {
- return 0.9*pow10(2*sin(x/5+2*y^0.25)) + 0.1*(1+cos(10*log(y)));
-}
-
-scale(Linear,Log,Log);
-
-pen[] Palette=BWRainbow();
-
-bounds range=image(f,Automatic,(0,1),(100,100),nx=200,Palette);
-
-xaxis("$x$",BottomTop,LeftTicks,above=true);
-yaxis("$y$",LeftRight,RightTicks,above=true);
-
-palette("$f(x,y)$",range,(0,200),(100,250),Top,Palette,
- PaletteTicks(ptick=linewidth(0.5*linewidth())));
-
-
-
-One can also draw an image directly from a two-dimensional pen array or
-a function `pen f(int, int)':
-void image(picture pic=currentpicture, pen[][] data,
- pair initial, pair final,
- bool transpose=(initial.x < final.x && initial.y < final.y),
- bool copy=true, bool antialias=false);
-void image(picture pic=currentpicture, pen f(int, int), int width, int height,
- pair initial, pair final,
- bool transpose=(initial.x < final.x && initial.y < final.y),
- bool antialias=false);
- as illustrated in the following examples:
-
-size(200);
-
-import palette;
-
-int n=256;
-real ninv=2pi/n;
-pen[][] v=new pen[n][n];
-
-for(int i=0; i < n; ++i)
- for(int j=0; j < n; ++j)
- v[i][j]=rgb(0.5*(1+sin(i*ninv)),0.5*(1+cos(j*ninv)),0);
-
-image(v,(0,0),(1,1));
-
-
-
-import palette;
-
-size(200);
-
-real fracpart(real x) {return (x-floor(x));}
-
-pair pws(pair z) {
- pair w=(z+exp(pi*I/5)/0.9)/(1+z/0.9*exp(-pi*I/5));
- return exp(w)*(w^3-0.5*I);
-}
-
-int N=512;
-
-pair a=(-1,-1);
-pair b=(0.5,0.5);
-real dx=(b-a).x/N;
-real dy=(b-a).y/N;
-
-pen f(int u, int v) {
- pair z=a+(u*dx,v*dy);
- pair w=pws(z);
- real phase=degrees(w,warn=false);
- real modulus=w == 0 ? 0: fracpart(log(abs(w)));
- return hsv(phase,1,sqrt(modulus));
-}
-
-image(f,N,N,(0,0),(300,300),antialias=true);
-
-
-
-For convenience, the module `palette' also defines functions that may
-be used to construct a pen array from a given function and palette:
-pen[] palette(real[] f, pen[] palette);
-pen[][] palette(real[][] f, pen[] palette);
-
-
-File: asymptote.info, Node: three, Next: obj, Prev: palette, Up: Base modules
-
-8.29 `three'
-============
-
-This module fully extends the notion of guides and paths in `Asymptote'
-to three dimensions. It introduces the new types guide3, path3, and
-surface. Guides in three dimensions are specified with the same syntax
-as in two dimensions except that triples `(x,y,z)' are used in place of
-pairs `(x,y)' for the nodes and direction specifiers. This
-generalization of John Hobby's spline algorithm is shape-invariant under
-three-dimensional rotation, scaling, and shifting, and reduces in the
-planar case to the two-dimensional algorithm used in `Asymptote',
-`MetaPost', and `MetaFont' [cf. J. C. Bowman, Proceedings in Applied
-Mathematics and Mechanics, 7:1, 2010021-2010022 (2007)].
-
- For example, a unit circle in the XY plane may be filled and drawn
-like this:
-
-import three;
-
-size(100);
-
-path3 g=(1,0,0)..(0,1,0)..(-1,0,0)..(0,-1,0)..cycle;
-draw(g);
-draw(O--Z,red+dashed,Arrow3);
-draw(((-1,-1,0)--(1,-1,0)--(1,1,0)--(-1,1,0)--cycle));
-dot(g,red);
-
-
-and then distorted into a saddle:
-
-import three;
-
-size(100,0);
-path3 g=(1,0,0)..(0,1,1)..(-1,0,0)..(0,-1,1)..cycle;
-draw(g);
-draw(((-1,-1,0)--(1,-1,0)--(1,1,0)--(-1,1,0)--cycle));
-dot(g,red);
-
-
-Module `three' provides constructors for converting two-dimensional
-paths to three-dimensional ones, and vice-versa:
-path3 path3(path p, triple plane(pair)=XYplane);
-path path(path3 p, pair P(triple)=xypart);
-
- A Bezier surface, the natural two-dimensional generalization of
-Bezier curves, is defined in `three_surface.asy' as a structure
-containing an array of Bezier patches. Surfaces may drawn with one of
-the routines
-void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
- material surfacepen=currentpen, pen meshpen=nullpen,
- light light=currentlight, light meshlight=light, string name="",
- render render=defaultrender);
-void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
- material[] surfacepen, pen meshpen,
- light light=currentlight, light meshlight=light, string name="",
- render render=defaultrender);
-void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
- material[] surfacepen, pen[] meshpen=nullpens,
- light light=currentlight, light meshlight=light, string name="",
- render render=defaultrender);
-
- The parameters `nu' and `nv' specify the number of subdivisions for
-drawing optional mesh lines for each Bezier patch. The optional `name'
-parameter is used as a prefix for naming the surface patches in the PRC
-model tree. Here material is a structure defined in `three_light.asy':
-struct material {
- pen[] p; // diffusepen,ambientpen,emissivepen,specularpen
- real opacity;
- real shininess;
-...
-}
- These material properties are used to implement `OpenGL'-style
-lighting, based on the Phong-Blinn specular model. Sample Bezier
-surfaces are contained in the example files `BezierSurface.asy',
-`teapot.asy', and `parametricsurface.asy'. The structure `render'
-contains specialized rendering options documented at the beginning of
-module `three.asy'.
-
- The examples `elevation.asy' and `sphericalharmonic.asy' illustrate
-how to draw a surface with patch-dependent colors. The examples
-`vertexshading' and `smoothelevation' illustrate vertex-dependent
-colors, which is supported for both `Asymptote''s native `OpenGL'
-renderer and two-dimensional projections. Since the PRC output format
-does not currently support vertex shading of Bezier surfaces, PRC
-patches are shaded with the mean of the four vertex colors.
-
- A surface can be constructed from a cyclic `path3' with the
-constructor
-surface surface(path3 external, triple[] internal=new triple[],
- triple[] normals=new triple[], pen[] colors=new pen[],
- bool3 planar=default);
- and then filled:
-draw(surface(path3(polygon(5))),red,nolight);
-draw(surface(unitcircle3),red,nolight);
-draw(surface(unitcircle3,new pen[] {red,green,blue,black}),nolight);
- The last example constructs a patch with vertex-specific colors. A
-three-dimensional planar surface in the plane `plane' can be
-constructed from a two-dimensional cyclic path `g' with the constructor
-surface surface(path p, triple plane(pair)=XYplane);
- and then filled:
-draw(surface((0,0)--E+2N--2E--E+N..0.2E..cycle),red);
- Planar Bezier surfaces patches are constructed using Orest Shardt's
-`bezulate' routine, which decomposes (possibly nonsimply connected)
-regions bounded (according to the `zerowinding' fill rule) by simple
-cyclic paths (intersecting only at the endpoints) into subregions
-bounded by cyclic paths of length `4' or less.
-
- A more efficient routine also exists for drawing tessellations
-composed of many 3D triangles, with specified vertices, and optional
-normals or vertex colors:
-void draw(picture pic=currentpicture, triple[] v, int[][] vi,
- triple[] n={}, int[][] ni={}, material m=currentpen, pen[] p={},
- int[][] pi={}, light light=currentlight);
- Here, the triple array `v' lists the distinct vertices, while the
-array `vi' lists integer arrays of length 3 containing the indices of
-`v' corresponding to the vertices of each triangle. Similarly, the
-arguments `n' and `ni' contain optional normal data and `p' and `pi'
-contain optional pen vertex data. An example of this tessellation
-facility is given in `triangles.asy'.
-
- Arbitrary thick three-dimensional curves and line caps (which the
-`OpenGL' standard does not require implementations to provide) are
-constructed with
-tube tube(path3 p, real width, render render=defaultrender);
- this returns a tube structure representing a tube of diameter `width'
-centered approximately on `g'. The tube structure consists of a surface
-`s' and the actual tube center, path3 `center'. Drawing thick lines as
-tubes can be slow to render, especially with the `Adobe Reader'
-renderer. The setting `thick=false' can be used to disable this feature
-and force all lines to be drawn with `linewidth(0)' (one pixel wide,
-regardless of the resolution). By default, mesh and contour lines in
-three-dimensions are always drawn thin, unless an explicit line width
-is given in the pen parameter or the setting `thin' is set to `false'.
-The pens `thin()' and `thick()' defined in plain_pens.asy can also be
-used to override these defaults for specific draw commands.
-
-There are four choices for viewing 3D `Asymptote' output:
- 1. Use the native `Asymptote' adaptive `OpenGL'-based renderer (with
- the command-line option `-V' and the default settings
- `outformat=""' and `render=-1'). If you encounter warnings from
- your graphics card driver, try specifying `-glOptions=-indirect'
- on the command line. On `UNIX' systems with graphics support for
- multisampling, the sample width can be controlled with the setting
- `multisample'. An initial screen position can be specified with
- the pair setting `position', where negative values are interpreted
- as relative to the corresponding maximum screen dimension. The
- default settings import settings;
- leftbutton=new string[] {"rotate","zoom","shift","pan"};
- middlebutton=new string[] {"menu"};
- rightbutton=new string[] {"zoom/menu","rotateX","rotateY","rotateZ"};
- wheelup=new string[] {"zoomin"};
- wheeldown=new string[] {"zoomout"};
- bind the mouse buttons as follows:
- * Left: rotate
-
- * Shift Left: zoom
-
- * Ctrl Left: shift viewport
-
- * Alt Left: pan
-
- * Middle: menu (must be unmodified; ignores Shift, Ctrl, and
- Alt)
-
- * Wheel Up: zoom in
-
- * Wheel Down: zoom out
-
- * Right: zoom/menu (must be unmodified)
-
- * Right double click: menu
-
- * Shift Right: rotate about the X axis
-
- * Ctrl Right: rotate about the Y axis
-
- * Alt Right: rotate about the Z axis
-
- The keyboard shortcuts are:
- * h: home
-
- * f: toggle fitscreen
-
- * x: spin about the X axis
-
- * y: spin about the Y axis
-
- * z: spin about the Z axis
-
- * s: stop spinning
-
- * m: rendering mode (solid/mesh/patch)
-
- * e: export
-
- * c: show camera parameters
-
- * p: play animation
-
- * r: reverse animation
-
- * : step animation
-
- * +: expand
-
- * =: expand
-
- * >: expand
-
- * -: shrink
-
- * _: shrink
-
- * <: shrink
-
- * q: exit
-
- * Ctrl-q: exit
-
- 2. Render the scene to a specified rasterized format `outformat' at
- the resolution of `n' pixels per `bp', as specified by the setting
- `render=n'. A negative value of `n' is interpreted as `|2n|' for
- EPS and PDF formats and `|n|' for other formats. The default value
- of `render' is -1. By default, the scene is internally rendered
- at twice the specified resolution; this can be disabled by setting
- `antialias=1'. High resolution rendering is done by tiling the
- image. If your graphics card allows it, the rendering can be made
- more efficient by increasing the maximum tile size `maxtile' to
- your screen dimensions (indicated by `maxtile=(0,0)'. If your
- video card generates unwanted black stripes in the output, try
- setting the horizontal and vertical components of `maxtiles' to
- something less than your screen dimensions. The tile size is also
- limited by the setting `maxviewport', which restricts the maximum
- width and height of the viewport. On `UNIX' systems some graphics
- drivers support batch mode (`-noV') rendering in an iconified
- window; this can be enabled with the setting `iconify=true'. Some
- (broken) `UNIX' graphics drivers may require the command line
- setting `-glOptions=-indirect', which requests (slower) indirect
- rendering.
-
- 3. Embed the 3D PRC format in a PDF file and view the resulting PDF
- file with version `9.0' or later of `Adobe Reader'. In addition
- to the default `settings.prc=true', this requires
- `settings.outformat="pdf"', which can be specified by the command
- line option `-f pdf', put in the `Asymptote' configuration file
- (*note configuration file::), or specified in the script before
- `three.asy' (or `graph3.asy') is imported. The `media9' LaTeX
- package is also required (*note embed::). The example `pdb.asy'
- illustrates how one can generate a list of predefined views (see
- `100d.views'). A stationary preview image with a resolution of
- `n' pixels per `bp' can be embedded with the setting `render=n';
- this allows the file to be viewed with other `PDF' viewers.
- Alternatively, the file `externalprc.tex' illustrates how the
- resulting PRC and rendered image files can be extracted and
- processed in a separate `LaTeX' file. However, see *note LaTeX
- usage:: for an easier way to embed three-dimensional `Asymptote'
- pictures within `LaTeX'. The open-source PRC specification is
- available from
- `http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/API_References/PRCReference/PRC_Format_Specification/'.
-
- 4. Project the scene to a two-dimensional vector (EPS or PDF) format
- with `render=0'. Only limited hidden surface removal facilities
- are currently available with this approach (*note PostScript3D::).
-
-
- Automatic picture sizing in three dimensions is accomplished with
-double deferred drawing. The maximal desired dimensions of the scene in
-each of the three dimensions can optionally be specified with the
-routine
-void size3(picture pic=currentpicture, real x, real y=x, real z=y,
- bool keepAspect=pic.keepAspect);
- The resulting simplex linear programming problem is then solved to
-produce a 3D version of a frame (actually implemented as a 3D picture).
-The result is then fit with another application of deferred drawing to
-the viewport dimensions corresponding to the usual two-dimensional
-picture `size' parameters. The global pair `viewportmargin' may be used
-to add horizontal and vertical margins to the viewport dimensions.
-Alternatively, a minimum `viewportsize' may be specified. A 3D picture
-`pic' can be explicitly fit to a 3D frame by calling
-frame pic.fit3(projection P=currentprojection);
- and then added to picture `dest' about `position' with
-void add(picture dest=currentpicture, frame src, triple position=(0,0,0));
-
- For convenience, the `three' module defines `O=(0,0,0)',
-`X=(1,0,0)', `Y=(0,1,0)', and `Z=(0,0,1)', along with a unitcircle in
-the XY plane:
-path3 unitcircle3=X..Y..-X..-Y..cycle;
-
- A general (approximate) circle can be drawn perpendicular to the
-direction `normal' with the routine
-path3 circle(triple c, real r, triple normal=Z);
-
- A circular arc centered at `c' with radius `r' from
-`c+r*dir(theta1,phi1)' to `c+r*dir(theta2,phi2)', drawing
-counterclockwise relative to the normal vector
-`cross(dir(theta1,phi1),dir(theta2,phi2))' if `theta2 > theta1' or if
-`theta2 == theta1' and `phi2 >= phi1', can be constructed with
-path3 arc(triple c, real r, real theta1, real phi1, real theta2, real phi2,
- triple normal=O);
- The normal must be explicitly specified if `c' and the endpoints are
-colinear. If `r' < 0, the complementary arc of radius `|r|' is
-constructed. For convenience, an arc centered at `c' from triple `v1'
-to `v2' (assuming `|v2-c|=|v1-c|') in the direction CCW
-(counter-clockwise) or CW (clockwise) may also be constructed with
-path3 arc(triple c, triple v1, triple v2, triple normal=O,
- bool direction=CCW);
- When high accuracy is needed, the routines `Circle' and `Arc' defined
-in `graph3' may be used instead. See *note GaussianSurface:: for an
-example of a three-dimensional circular arc.
-
- The representation `O--O+u--O+u+v--O+v--cycle' of the plane passing
-through point `O' with normal `cross(u,v)' is returned by
-path3 plane(triple u, triple v, triple O=O);
- A three-dimensional box with opposite vertices at triples `v1' and
-`v2' may be drawn with the function
-path3[] box(triple v1, triple v2);
- For example, a unit box is predefined as
-path3[] unitbox=box(O,(1,1,1));
- `Asymptote' also provides optimized definitions for the
-three-dimensional paths `unitsquare3' and `unitcircle3', along with the
-surfaces `unitdisk', `unitplane', `unitcube', `unitcylinder',
-`unitcone', `unitsolidcone', `unitfrustum(real t1, real t2)',
-`unitsphere', and `unithemisphere'.
-
-These projections to two dimensions are predefined:
-`oblique'
-
-`oblique(real angle)'
- The point `(x,y,z)' is projected to `(x-0.5z,y-0.5z)'. If an
- optional real argument is given, the negative z axis is drawn at
- this angle in degrees. The projection `obliqueZ' is a synonym for
- `oblique'.
-
-`obliqueX'
-
-`obliqueX(real angle)'
- The point `(x,y,z)' is projected to `(y-0.5x,z-0.5x)'. If an
- optional real argument is given, the negative x axis is drawn at
- this angle in degrees.
-
-`obliqueY'
-
-`obliqueY(real angle)'
- The point `(x,y,z)' is projected to `(x+0.5y,z+0.5y)'. If an
- optional real argument is given, the positive y axis is drawn at
- this angle in degrees.
-
-`orthographic(triple camera, triple up=Z, triple target=O,
- real zoom=1, pair viewportshift=0, bool showtarget=true,
- bool center=false)'
- This projects from three to two dimensions using the view as seen
- at a point infinitely far away in the direction `unit(camera)',
- orienting the camera so that, if possible, the vector `up' points
- upwards. Parallel lines are projected to parallel lines. The
- bounding volume is expanded to include `target' if
- `showtarget=true'. If `center=true', the target will be adjusted
- to the center of the bounding volume.
-
-`orthographic(real x, real y, real z, triple up=Z, triple target=O,
- real zoom=1, pair viewportshift=0, bool showtarget=true,
- bool center=false)'
- This is equivalent to orthographic((x,y,z),up,target,zoom,viewportshift,showtarget,center)
-
- The routine triple camera(real alpha, real beta);
- can be used to compute the camera position with the x axis below
- the horizontal at angle `alpha', the y axis below the horizontal
- at angle `beta', and the z axis up.
-
-`perspective(triple camera, triple up=Z, triple target=O,
- real zoom=1, real angle=0, pair viewportshift=0,
- bool showtarget=true, bool autoadjust=true,
- bool center=autoadjust)'
- This projects from three to two dimensions, taking account of
- perspective, as seen from the location `camera' looking at
- `target', orienting the camera so that, if possible, the vector
- `up' points upwards. If `render=0', projection of
- three-dimensional cubic Bezier splines is implemented by
- approximating a two-dimensional nonuniform rational B-spline
- (NURBS) with a two-dimensional Bezier curve containing additional
- nodes and control points. If `autoadjust=true', the camera will
- automatically be adjusted to lie outside the bounding volume for
- all possible interactive rotations about `target'. If
- `center=true', the target will be adjusted to the center of the
- bounding volume.
-
-`perspective(real x, real y, real z, triple up=Z, triple target=O,
- real zoom=1, real angle=0, pair viewportshift=0,
- bool showtarget=true, bool autoadjust=true,
- bool center=autoadjust)'
- This is equivalent to perspective((x,y,z),up,target,zoom,angle,viewportshift,showtarget,
- autoadjust,center)
-
-The default projection, `currentprojection', is initially set to
-`perspective(5,4,2)'.
-
- We also define standard orthographic views used in technical drawing:
-projection LeftView=orthographic(-X,showtarget=true);
-projection RightView=orthographic(X,showtarget=true);
-projection FrontView=orthographic(-Y,showtarget=true);
-projection BackView=orthographic(Y,showtarget=true);
-projection BottomView=orthographic(-Z,showtarget=true);
-projection TopView=orthographic(Z,showtarget=true);
- The function
-void addViews(picture dest=currentpicture, picture src,
- projection[][] views=SixViewsUS,
- bool group=true, filltype filltype=NoFill);
- adds to picture `dest' an array of views of picture `src' using the
-layout projection[][] `views'. The default layout `SixViewsUS' aligns
-the projection `FrontView' below `TopView' and above `BottomView', to
-the right of `LeftView' and left of `RightView' and `BackView'. The
-predefined layouts are:
-projection[][] ThreeViewsUS={{TopView},
- {FrontView,RightView}};
-
-projection[][] SixViewsUS={{null,TopView},
- {LeftView,FrontView,RightView,BackView},
- {null,BottomView}};
-
-projection[][] ThreeViewsFR={{RightView,FrontView},
- {null,TopView}};
-
-projection[][] SixViewsFR={{null,BottomView},
- {RightView,FrontView,LeftView,BackView},
- {null,TopView}};
-
-projection[][] ThreeViews={{FrontView,TopView,RightView}};
-
-projection[][] SixViews={{FrontView,TopView,RightView},
- {BackView,BottomView,LeftView}};
-
- A triple or path3 can be projected to a pair or path, with
-`project(triple, projection P=currentprojection)' or `project(path3,
-projection P=currentprojection)'.
-
- It is occasionally useful to be able to invert a projection, sending
-a pair `z' onto the plane perpendicular to `normal' and passing through
-`point':
-triple invert(pair z, triple normal, triple point,
- projection P=currentprojection);
- A pair `z' on the projection plane can be inverted to a triple with
-the routine
-triple invert(pair z, projection P=currentprojection);
- A pair direction `dir' on the projection plane can be inverted to a
-triple direction relative to a point `v' with the routine
-triple invert(pair dir, triple v, projection P=currentprojection).
-
- Three-dimensional objects may be transformed with one of the
-following built-in transform3 types (the identity transformation is
-`identity4'):
-
-`shift(triple v)'
- translates by the triple `v';
-
-`xscale3(real x)'
- scales by `x' in the x direction;
-
-`yscale3(real y)'
- scales by `y' in the y direction;
-
-`zscale3(real z)'
- scales by `z' in the z direction;
-
-`scale3(real s)'
- scales by `s' in the x, y, and z directions;
-
-`scale(real x, real y, real z)'
- scales by `x' in the x direction, by `y' in the y direction, and
- by `z' in the z direction;
-
-`rotate(real angle, triple v)'
- rotates by `angle' in degrees about an axis `v' through the origin;
-
-`rotate(real angle, triple u, triple v)'
- rotates by `angle' in degrees about the axis `u--v';
-
-`reflect(triple u, triple v, triple w)'
- reflects about the plane through `u', `v', and `w'.
-
- When not multiplied on the left by a transform3, three-dimensional
-TeX Labels are drawn as Bezier surfaces directly on the projection
-plane:
-void label(picture pic=currentpicture, Label L, triple position,
- align align=NoAlign, pen p=currentpen,
- light light=nolight, string name="",
- render render=defaultrender, interaction interaction=
- settings.autobillboard ? Billboard : Embedded)
- The optional `name' parameter is used as a prefix for naming the label
-patches in the PRC model tree. The default interaction is `Billboard',
-which means that labels are rotated interactively so that they always
-face the camera. The interaction `Embedded' means that the label
-interacts as a normal `3D' surface, as illustrated in the example
-`billboard.asy'. Alternatively, a label can be transformed from the
-`XY' plane by an explicit transform3 or mapped to a specified
-two-dimensional plane with the predefined transform3 types `XY', `YZ',
-`ZX', `YX', `ZY', `ZX'. There are also modified versions of these
-transforms that take an optional argument `projection
-P=currentprojection' that rotate and/or flip the label so that it is
-more readable from the initial viewpoint.
-
- A transform3 that projects in the direction `dir' onto the plane
-with normal `n' through point `O' is returned by
-transform3 planeproject(triple n, triple O=O, triple dir=n);
- One can use
-triple normal(path3 p);
- to find the unit normal vector to a planar three-dimensional path `p'.
-As illustrated in the example `planeproject.asy', a transform3 that
-projects in the direction `dir' onto the plane defined by a planar path
-`p' is returned by
-transform3 planeproject(path3 p, triple dir=normal(p));
-
- The functions
-surface extrude(path p, triple axis=Z);
-surface extrude(Label L, triple axis=Z);
- return the surface obtained by extruding path `p' or Label `L' along
-`axis'.
-
- Three-dimensional versions of the path functions `length', `size',
-`point', `dir', `accel', `radius', `precontrol', `postcontrol',
-`arclength', `arctime', `reverse', `subpath', `intersect',
-`intersections', `intersectionpoint', `intersectionpoints', `min',
-`max', `cyclic', and `straight' are also defined.
-
- The routine
-real[][] intersections(path3 p, surface s, real fuzz=-1);
- returns the intersection times of a path `p' with a surface `s' as a
-sorted array of real arrays of length 2, and
-triple[] intersectionpoints(path3 p, surface s, real fuzz=-1);
- returns the corresponding intersection points. Here, the computations
-are performed to the absolute error specified by `fuzz', or if `fuzz <
-0', to machine precision.
-
- Here is an example showing all five guide3 connectors:
-
-import graph3;
-
-size(200);
-
-currentprojection=orthographic(500,-500,500);
-
-triple[] z=new triple[10];
-
-z[0]=(0,100,0); z[1]=(50,0,0); z[2]=(180,0,0);
-
-for(int n=3; n <= 9; ++n)
- z[n]=z[n-3]+(200,0,0);
-
-path3 p=z[0]..z[1]---z[2]::{Y}z[3]
-&z[3]..z[4]--z[5]::{Y}z[6]
-&z[6]::z[7]---z[8]..{Y}z[9];
-
-draw(p,grey+linewidth(4mm),currentlight);
-
-xaxis3(Label(XY()*"$x$",align=-3Y),red,above=true);
-yaxis3(Label(XY()*"$y$",align=-3X),red,above=true);
-
-
-
-Three-dimensional versions of bars or arrows can be drawn with one of
-the specifiers `None', `Blank', `BeginBar3', `EndBar3' (or equivalently
-`Bar3'), `Bars3', `BeginArrow3', `MidArrow3', `EndArrow3' (or
-equivalently `Arrow3'), `Arrows3', `BeginArcArrow3', `EndArcArrow3' (or
-equivalently `ArcArrow3'), `MidArcArrow3', and `ArcArrows3'.
-Three-dimensional bars accept the optional arguments `(real size=0,
-triple dir=O)'. If `size=O', the default bar length is used; if
-`dir=O', the bar is drawn perpendicular to the path and the initial
-viewing direction. The predefined three-dimensional arrowhead styles
-are `DefaultHead3', `HookHead3', `TeXHead3'. Versions of the
-two-dimensional arrowheads lifted to three-dimensional space and
-aligned according to the initial viewpoint (or an optionally specified
-`normal' vector) are also defined: `DefaultHead2(triple normal=O)',
-`HookHead2(triple normal=O)', `TeXHead2(triple normal=O)'. These are
-illustrated in the example `arrows3.asy'.
-
- Module `three' also defines the three-dimensional margins
-`NoMargin3', `BeginMargin3', `EndMargin3', `Margin3', `Margins3',
-`BeginPenMargin2', `EndPenMargin2', `PenMargin2', `PenMargins2',
-`BeginPenMargin3', `EndPenMargin3', `PenMargin3', `PenMargins3',
-`BeginDotMargin3', `EndDotMargin3', `DotMargin3', `DotMargins3',
-`Margin3', and `TrueMargin3'.
-
- The routine
-void pixel(picture pic=currentpicture, triple v, pen p=currentpen,
- real width=1);
- can be used to draw on picture `pic' a pixel of width `width' at
-position `v' using pen `p'.
-
- Further three-dimensional examples are provided in the files
-`near_earth.asy', `conicurv.asy', and (in the `animations'
-subdirectory) `cube.asy'.
-
- Limited support for projected vector graphics (effectively
-three-dimensional nonrendered `PostScript') is available with the
-setting `render=0'. This currently only works for piecewise planar
-surfaces, such as those produced by the parametric `surface' routines
-in the `graph3' module. Surfaces produced by the `solids' package will
-also be properly rendered if the parameter `nslices' is sufficiently
-large.
-
- In the module `bsp', hidden surface removal of planar pictures is
-implemented using a binary space partition and picture clipping. A
-planar path is first converted to a structure `face' derived from
-`picture'. A `face' may be given to a two-dimensional drawing routine
-in place of any `picture' argument. An array of such faces may then be
-drawn, removing hidden surfaces:
-void add(picture pic=currentpicture, face[] faces,
- projection P=currentprojection);
- Labels may be projected to two dimensions, using projection `P', onto
-the plane passing through point `O' with normal `cross(u,v)' by
-multiplying it on the left by the transform
-transform transform(triple u, triple v, triple O=O,
- projection P=currentprojection);
-
- Here is an example that shows how a binary space partition may be
-used to draw a two-dimensional vector graphics projection of three
-orthogonal intersecting planes:
-
-size(6cm,0);
-import bsp;
-
-real u=2.5;
-real v=1;
-
-currentprojection=oblique;
-
-path3 y=plane((2u,0,0),(0,2v,0),(-u,-v,0));
-path3 l=rotate(90,Z)*rotate(90,Y)*y;
-path3 g=rotate(90,X)*rotate(90,Y)*y;
-
-face[] faces;
-filldraw(faces.push(y),project(y),yellow);
-filldraw(faces.push(l),project(l),lightgrey);
-filldraw(faces.push(g),project(g),green);
-
-add(faces);
-
-
-
-
-File: asymptote.info, Node: obj, Next: graph3, Prev: three, Up: Base modules
-
-8.30 `obj'
-==========
-
-This module allows one to construct surfaces from simple obj files, as
-illustrated in the example files `galleon.asy' and `triceratops.asy'.
-
-
-File: asymptote.info, Node: graph3, Next: grid3, Prev: obj, Up: Base modules
-
-8.31 `graph3'
-=============
-
-This module implements three-dimensional versions of the functions in
-`graph.asy'. To draw an x axis in three dimensions, use the routine
-void xaxis3(picture pic=currentpicture, Label L="", axis axis=YZZero,
- real xmin=-infinity, real xmax=infinity, pen p=currentpen,
- ticks3 ticks=NoTicks3, arrowbar3 arrow=None, bool above=false);
- Analogous routines `yaxis' and `zaxis' can be used to draw y and z
-axes in three dimensions. There is also a routine for drawing all
-three axis:
-void axes3(picture pic=currentpicture,
- Label xlabel="", Label ylabel="", Label zlabel="",
- bool extend=false,
- triple min=(-infinity,-infinity,-infinity),
- triple max=(infinity,infinity,infinity),
- pen p=currentpen, arrowbar3 arrow=None);
-
-The predefined three-dimensional axis types are
-axis YZEquals(real y, real z, triple align=O, bool extend=false);
-axis XZEquals(real x, real z, triple align=O, bool extend=false);
-axis XYEquals(real x, real y, triple align=O, bool extend=false);
-axis YZZero(triple align=O, bool extend=false);
-axis XZZero(triple align=O, bool extend=false);
-axis XYZero(triple align=O, bool extend=false);
-axis Bounds(int type=Both, int type2=Both, triple align=O, bool extend=false);
- The optional `align' parameter to these routines can be used to
-specify the default axis and tick label alignments. The `Bounds' axis
-accepts two type parameters, each of which must be one of `Min', `Max',
-or `Both'. These parameters specify which of the four possible
-three-dimensional bounding box edges should be drawn.
-
- The three-dimensional tick options are `NoTicks3', `InTicks',
-`OutTicks', and `InOutTicks'. These specify the tick directions for the
-`Bounds' axis type; other axis types inherit the direction that would
-be used for the `Bounds(Min,Min)' axis.
-
- Here is an example of a helix and bounding box axes with ticks and
-axis labels, using orthographic projection:
-
-import graph3;
-
-size(0,200);
-size3(200,IgnoreAspect);
-
-currentprojection=orthographic(4,6,3);
-
-real x(real t) {return cos(2pi*t);}
-real y(real t) {return sin(2pi*t);}
-real z(real t) {return t;}
-
-path3 p=graph(x,y,z,0,2.7,operator ..);
-
-draw(p,Arrow3);
-
-scale(true);
-
-xaxis3(XZ()*"$x$",Bounds,red,InTicks(Label,2,2));
-yaxis3(YZ()*"$y$",Bounds,red,InTicks(beginlabel=false,Label,2,2));
-zaxis3(XZ()*"$z$",Bounds,red,InTicks);
-
-
-
-The next example illustrates three-dimensional x, y, and z axes,
-without autoscaling of the axis limits:
-
-import graph3;
-
-size(0,200);
-size3(200,IgnoreAspect);
-
-currentprojection=perspective(5,2,2);
-
-scale(Linear,Linear,Log);
-
-xaxis3("$x$",0,1,red,OutTicks(2,2));
-yaxis3("$y$",0,1,red,OutTicks(2,2));
-zaxis3("$z$",1,30,red,OutTicks(beginlabel=false));
-
-
-
-One can also place ticks along a general three-dimensional axis:
-
-import graph3;
-
-size(0,100);
-
-path3 g=yscale3(2)*unitcircle3;
-currentprojection=perspective(10,10,10);
-
-axis(Label("C",position=0,align=15X),g,InTicks(endlabel=false,8,end=false),
- ticklocate(0,360,new real(real v) {
- path3 h=O--max(abs(max(g)),abs(min(g)))*dir(90,v);
- return intersect(g,h)[0];},
- new triple(real t) {return cross(dir(g,t),Z);}));
-
-
-
-Surface plots of matrices and functions over the region `box(a,b)' in
-the XY plane are also implemented:
-surface surface(real[][] f, pair a, pair b, bool[][] cond={});
-surface surface(real[][] f, pair a, pair b, splinetype xsplinetype,
- splinetype ysplinetype=xsplinetype, bool[][] cond={});
-surface surface(real[][] f, real[] x, real[] y,
- splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
- bool[][] cond={})
-surface surface(triple[][] f, bool[][] cond={});
-surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
- bool cond(pair z)=null);
-surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
- splinetype xsplinetype, splinetype ysplinetype=xsplinetype,
- bool cond(pair z)=null);
-surface surface(triple f(pair z), real[] u, real[] v,
- splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
- bool cond(pair z)=null);
-surface surface(triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu,
- bool cond(pair z)=null);
-surface surface(triple f(pair z), pair a, pair b, int nu=nmesh, int nv=nu,
- splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
- bool cond(pair z)=null);
- The final two versions draw parametric surfaces for a function f(u,v)
-over the parameter space `box(a,b)', as illustrated in the example
-`parametricsurface.asy'. An optional splinetype `Spline' may be
-specified. The boolean array or function `cond' can be used to control
-which surface mesh cells are actually drawn (by default all mesh cells
-over `box(a,b)' are drawn). Surface lighting is illustrated in the
-example files `parametricsurface.asy' and `sinc.asy'. Lighting can be
-disabled by setting `light=nolight', as in this example of a Gaussian
-surface:
-
-import graph3;
-
-size(200,0);
-
-currentprojection=perspective(10,8,4);
-
-real f(pair z) {return 0.5+exp(-abs(z)^2);}
-
-draw((-1,-1,0)--(1,-1,0)--(1,1,0)--(-1,1,0)--cycle);
-
-draw(arc(0.12Z,0.2,90,60,90,25),ArcArrow3);
-
-surface s=surface(f,(-1,-1),(1,1),nx=5,Spline);
-
-xaxis3(Label("$x$"),red,Arrow3);
-yaxis3(Label("$y$"),red,Arrow3);
-zaxis3(XYZero(extend=true),red,Arrow3);
-
-draw(s,lightgray,meshpen=black+thick(),nolight,render(merge=true));
-
-label("$O$",O,-Z+Y,red);
-
-
-A mesh can be drawn without surface filling by specifying `nullpen' for
-the surfacepen.
-
- A vector field of `nu'\times`nv' arrows on a parametric surface `f'
-over `box(a,b)' can be drawn with the routine
-picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b,
- int nu=nmesh, int nv=nu, bool truesize=false,
- real maxlength=truesize ? 0 : maxlength(f,a,b,nu,nv),
- bool cond(pair z)=null, pen p=currentpen,
- arrowbar3 arrow=Arrow3, margin3 margin=PenMargin3)
- as illustrated in the examples `vectorfield3.asy' and
-`vectorfieldsphere.asy'.
-
-
-File: asymptote.info, Node: grid3, Next: solids, Prev: graph3, Up: Base modules
-
-8.32 `grid3'
-============
-
-This module, contributed by Philippe Ivaldi, can be used for drawing 3D
-grids. Here is an example (further examples can be found in `grid3.asy'
-and at `http://www.piprime.fr/files/asymptote/grid3/'):
-
-import grid3;
-
-size(8cm,0,IgnoreAspect);
-currentprojection=orthographic(0.5,1,0.5);
-
-scale(Linear, Linear, Log);
-
-limits((-2,-2,1),(0,2,100));
-
-grid3(XYZgrid);
-
-xaxis3(Label("$x$",position=EndPoint,align=S),Bounds(Min,Min),
- OutTicks());
-yaxis3(Label("$y$",position=EndPoint,align=S),Bounds(Min,Min),OutTicks());
-zaxis3(Label("$z$",position=EndPoint,align=(-1,0.5)),Bounds(Min,Min),
- OutTicks(beginlabel=false));
-
-
-
-
-File: asymptote.info, Node: solids, Next: tube, Prev: grid3, Up: Base modules
-
-8.33 `solids'
-=============
-
-This solid geometry package defines a structure `revolution' that can
-be used to fill and draw surfaces of revolution. The following example
-uses it to display the outline of a circular cylinder of radius 1 with
-axis `O--1.5unit(Y+Z)' with perspective projection:
-
-import solids;
-
-size(0,100);
-
-revolution r=cylinder(O,1,1.5,Y+Z);
-draw(r,heavygreen);
-
-
-
-Further illustrations are provided in the example files `cylinder.asy',
-`cones.asy', `hyperboloid.asy', and `torus.asy'.
-
- The structure `skeleton' contains the three-dimensional wireframe
-used to visualize a volume of revolution:
-struct skeleton {
- struct curve {
- path3[] front;
- path3[] back;
- }
- // transverse skeleton (perpendicular to axis of revolution)
- curve transverse;
- // longitudinal skeleton (parallel to axis of revolution)
- curve longitudinal;
-}
-
-
-File: asymptote.info, Node: tube, Next: flowchart, Prev: solids, Up: Base modules
-
-8.34 `tube'
-===========
-
-This package extends the `tube' surfaces constructed in
-`three_arrows.asy' to arbitrary cross sections, colors, and spine
-transformations. The routine
-surface tube(path3 g, coloredpath section,
- transform T(real)=new transform(real t) {return identity();},
- real corner=1, real relstep=0);
- draws a tube along `g' with cross section `section', after applying
-the transformation `T(t)' at `relpoint(g,t)'. The parameter `corner'
-controls the number of elementary tubes at the angular points of `g'. A
-nonzero value of `relstep' specifies a fixed relative time step (in the
-sense of `relpoint(g,t)') to use in constructing elementary tubes along
-`g'. The type `coloredpath' is a generalization of `path' to which a
-`path' can be cast:
-struct coloredpath
-{
- path p;
- pen[] pens(real);
- int colortype=coloredSegments;
-}
- Here `p' defines the cross section and the method `pens(real t)'
-returns an array of pens (interpreted as a cyclic array) used for
-shading the tube patches at `relpoint(g,t)'. If
-`colortype=coloredSegments', the tube patches are filled as if each
-segment of the section was colored with the pen returned by `pens(t)',
-whereas if `colortype=coloredNodes', the tube components are vertex
-shaded as if the nodes of the section were colored.
-
- A `coloredpath' can be constructed with one of the routines:
-coloredpath coloredpath(path p, pen[] pens(real),
- int colortype=coloredSegments);
-coloredpath coloredpath(path p, pen[] pens=new pen[] {currentpen},
- int colortype=coloredSegments);
-coloredpath coloredpath(path p, pen pen(real));
- In the second case, the pens are independent of the relative time. In
-the third case, the array of pens contains only one pen, which depends
-of the relative time.
-
- The casting of `path' to `coloredpath' allows the use of a `path'
-instead of a `coloredpath'; in this case the shading behaviour is the
-default shading behavior for a surface.
-
- An example of `tube' is provided in the file `trefoilknot.asy'.
-Further examples can be found at
-`http://www.piprime.fr/files/asymptote/tube/'.
-
-
-File: asymptote.info, Node: flowchart, Next: contour, Prev: tube, Up: Base modules
-
-8.35 `flowchart'
-================
-
-This package provides routines for drawing flowcharts. The primary
-structure is a `block', which represents a single block on the
-flowchart. The following eight functions return a position on the
-appropriate edge of the block, given picture transform `t':
-
-pair block.top(transform t=identity());
-pair block.left(transform t=identity());
-pair block.right(transform t=identity());
-pair block.bottom(transform t=identity());
-pair block.topleft(transform t=identity());
-pair block.topright(transform t=identity());
-pair block.bottomleft(transform t=identity());
-pair block.bottomright(transform t=identity());
-
-
-To obtain an arbitrary position along the boundary of the block in user
-coordinates, use:
-pair block.position(real x, transform t=identity());
-
-
-The center of the block in user coordinates is stored in `block.center'
-and the block size in `PostScript' coordinates is given by `block.size'.
-
-A frame containing the block is returned by
-frame block.draw(pen p=currentpen);
-
-
- The following block generation routines accept a Label, string, or
-frame for their object argument:
-
-"rectangular block with an optional header (and padding `dx' around header and body):"
- block rectangle(object header, object body, pair center=(0,0),
- pen headerpen=mediumgray, pen bodypen=invisible,
- pen drawpen=currentpen,
- real dx=3, real minheaderwidth=minblockwidth,
- real minheaderheight=minblockwidth,
- real minbodywidth=minblockheight,
- real minbodyheight=minblockheight);
- block rectangle(object body, pair center=(0,0),
- pen fillpen=invisible, pen drawpen=currentpen,
- real dx=3, real minwidth=minblockwidth,
- real minheight=minblockheight);
-
-"parallelogram block:"
- block parallelogram(object body, pair center=(0,0),
- pen fillpen=invisible, pen drawpen=currentpen,
- real dx=3, real slope=2,
- real minwidth=minblockwidth,
- real minheight=minblockheight);
-
-"diamond-shaped block:"
- block diamond(object body, pair center=(0,0),
- pen fillpen=invisible, pen drawpen=currentpen,
- real ds=5, real dw=1,
- real height=20, real minwidth=minblockwidth,
- real minheight=minblockheight);
-
-"circular block:"
- block circle(object body, pair center=(0,0), pen fillpen=invisible,
- pen drawpen=currentpen, real dr=3,
- real mindiameter=mincirclediameter);
-
-"rectangular block with rounded corners:"
- block roundrectangle(object body, pair center=(0,0),
- pen fillpen=invisible, pen drawpen=currentpen,
- real ds=5, real dw=0, real minwidth=minblockwidth,
- real minheight=minblockheight);
-
-"rectangular block with beveled edges:"
- block bevel(object body, pair center=(0,0), pen fillpen=invisible,
- pen drawpen=currentpen, real dh=5, real dw=5,
- real minwidth=minblockwidth, real minheight=minblockheight);
-
-
- To draw paths joining the pairs in `point' with right-angled lines,
-use the routine:
-path path(pair point[] ... flowdir dir[]);
- The entries in `dir' identify whether successive segments between the
-pairs specified by `point' should be drawn in the `Horizontal' or
-`Vertical' direction.
-
- Here is a simple flowchart example (see also the example
-`controlsystem.asy'):
-
-size(0,300);
-
-import flowchart;
-
-block block1=rectangle(Label("Example",magenta),
- pack(Label("Start:",heavygreen),"",Label("$A:=0$",blue),
- "$B:=1$"),(-0.5,3),palegreen,paleblue,red);
-block block2=diamond(Label("Choice?",blue),(0,2),palegreen,red);
-block block3=roundrectangle("Do something",(-1,1));
-block block4=bevel("Don't do something",(1,1));
-block block5=circle("End",(0,0));
-
-draw(block1);
-draw(block2);
-draw(block3);
-draw(block4);
-draw(block5);
-
-add(new void(picture pic, transform t) {
- blockconnector operator --=blockconnector(pic,t);
- // draw(pic,block1.right(t)--block2.top(t));
- block1--Right--Down--Arrow--block2;
- block2--Label("Yes",0.5,NW)--Left--Down--Arrow--block3;
- block2--Right--Label("No",0.5,NE)--Down--Arrow--block4;
- block4--Down--Left--Arrow--block5;
- block3--Down--Right--Arrow--block5;
- });
-
-
-
-
-File: asymptote.info, Node: contour, Next: contour3, Prev: flowchart, Up: Base modules
-
-8.36 `contour'
-==============
-
-This package draws contour lines. To construct contours corresponding
-to the values in a real array `c' for a function `f' on `box(a,b)', use
-the routine
-guide[][] contour(real f(real, real), pair a, pair b,
- real[] c, int nx=ngraph, int ny=nx,
- interpolate join=operator --, int subsample=1);
- The integers `nx' and `ny' define the resolution. The default
-resolution, `ngraph x ngraph' (here `ngraph' defaults to `100') can be
-increased for greater accuracy. The default interpolation operator is
-`operator --' (linear). Spline interpolation (`operator ..') may
-produce smoother contours but it can also lead to overshooting. The
-`subsample' parameter indicates the number of interior points that
-should be used to sample contours within each `1 x 1' box; the default
-value of `1' is usually sufficient.
-
- To construct contours for an array of data values on a uniform
-two-dimensional lattice on `box(a,b)', use
-guide[][] contour(real[][] f, pair a, pair b, real[] c,
- interpolate join=operator --, int subsample=1);
-
- To construct contours for an array of data values on a nonoverlapping
-regular mesh specified by the two-dimensional array `z',
-guide[][] contour(pair[][] z, real[][] f, real[] c,
- interpolate join=operator --, int subsample=1);
-
- To construct contours for an array of values `f' specified at
-irregularly positioned points `z', use the routine
-guide[][] contour(pair[] z, real[] f, real[] c, interpolate join=operator --);
- The contours themselves can be drawn with one of the routines
-void draw(picture pic=currentpicture, Label[] L=new Label[],
- guide[][] g, pen p=currentpen);
-
-void draw(picture pic=currentpicture, Label[] L=new Label[],
- guide[][] g, pen[] p);
-
- The following simple example draws the contour at value `1' for the
-function z=x^2+y^2, which is a unit circle:
-
-import contour;
-size(75);
-
-real f(real a, real b) {return a^2+b^2;}
-draw(contour(f,(-1,-1),(1,1),new real[] {1}));
-
-
-
-The next example draws and labels multiple contours for the function
-z=x^2-y^2 with the resolution `100 x 100', using a dashed pen for
-negative contours and a solid pen for positive (and zero) contours:
-
-import contour;
-
-size(200);
-
-real f(real x, real y) {return x^2-y^2;}
-int n=10;
-real[] c=new real[n];
-for(int i=0; i < n; ++i) c[i]=(i-n/2)/n;
-
-pen[] p=sequence(new pen(int i) {
- return (c[i] >= 0 ? solid : dashed)+fontsize(6pt);
- },c.length);
-
-Label[] Labels=sequence(new Label(int i) {
- return Label(c[i] != 0 ? (string) c[i] : "",Relative(unitrand()),(0,0),
- UnFill(1bp));
- },c.length);
-
-draw(Labels,contour(f,(-1,-1),(1,1),c),p);
-
-
-
-The next example illustrates how contour lines can be drawn on color
-density images:
-
-import graph;
-import palette;
-import contour;
-
-size(10cm,10cm,IgnoreAspect);
-
-pair a=(0,0);
-pair b=(2pi,2pi);
-
-real f(real x, real y) {return cos(x)*sin(y);}
-
-int N=200;
-int Divs=10;
-int divs=2;
-
-defaultpen(1bp);
-pen Tickpen=black;
-pen tickpen=gray+0.5*linewidth(currentpen);
-pen[] Palette=BWRainbow();
-
-bounds range=image(f,Automatic,a,b,N,Palette);
-
-// Major contours
-
-real[] Cvals=uniform(range.min,range.max,Divs);
-draw(contour(f,a,b,Cvals,N,operator --),Tickpen);
-
-// Minor contours
-real[] cvals;
-for(int i=0; i < Cvals.length-1; ++i)
- cvals.append(uniform(Cvals[i],Cvals[i+1],divs)[1:divs]);
-draw(contour(f,a,b,cvals,N,operator --),tickpen);
-
-xaxis("$x$",BottomTop,LeftTicks,above=true);
-yaxis("$y$",LeftRight,RightTicks,above=true);
-
-palette("$f(x,y)$",range,point(NW)+(0,0.5),point(NE)+(0,1),Top,Palette,
- PaletteTicks(N=Divs,n=divs,Tickpen,tickpen));
-
-
-
-Finally, here is an example that illustrates the construction of
-contours from irregularly spaced data:
-
-import contour;
-
-size(200);
-
-int n=100;
-
-real f(real a, real b) {return a^2+b^2;}
-
-srand(1);
-
-real r() {return 1.1*(rand()/randMax*2-1);}
-
-pair[] points=new pair[n];
-real[] values=new real[n];
-
-for(int i=0; i < n; ++i) {
- points[i]=(r(),r());
- values[i]=f(points[i].x,points[i].y);
-}
-
-draw(contour(points,values,new real[]{0.25,0.5,1},operator ..),blue);
-
-
-
-In the above example, the contours of irregularly spaced data are
-constructed by first creating a triangular mesh from an array `z' of
-pairs:
-
-int[][] triangulate(pair[] z);
-
-size(200);
-int np=100;
-pair[] points;
-
-real r() {return 1.2*(rand()/randMax*2-1);}
-
-for(int i=0; i < np; ++i)
- points.push((r(),r()));
-
-int[][] trn=triangulate(points);
-
-for(int i=0; i < trn.length; ++i) {
- draw(points[trn[i][0]]--points[trn[i][1]]);
- draw(points[trn[i][1]]--points[trn[i][2]]);
- draw(points[trn[i][2]]--points[trn[i][0]]);
-}
-
-for(int i=0; i < np; ++i)
- dot(points[i],red);
-
-
-
-The example `Gouraudcontour' illustrates how to produce color density
-images over such irregular triangular meshes. `Asymptote' uses a
-robust version of Paul Bourke's Delaunay triangulation algorithm based
-on the public-domain exact arithmetic predicates written by Jonathan
-Shewchuk.
-
-
-File: asymptote.info, Node: contour3, Next: slopefield, Prev: contour, Up: Base modules
-
-8.37 `contour3'
-===============
-
-This package draws surfaces described as the null space of real-valued
-functions of (x,y,z) or real[][][] matrices. Its usage is illustrated
-in the example file `magnetic.asy'.
-
-
-File: asymptote.info, Node: slopefield, Next: ode, Prev: contour3, Up: Base modules
-
-8.38 `slopefield'
-=================
-
-To draw a slope field for the differential equation dy/dx=f(x,y) (or
-dy/dx=f(x)), use:
-picture slopefield(real f(real,real), pair a, pair b,
- int nx=nmesh, int ny=nx,
- real tickfactor=0.5, pen p=currentpen,
- arrowbar arrow=None);
- Here, the points `a' and `b' are the lower left and upper right
-corners of the rectangle in which the slope field is to be drawn, `nx'
-and `ny' are the respective number of ticks in the x and y directions,
-`tickfactor' is the fraction of the minimum cell dimension to use for
-drawing ticks, and `p' is the pen to use for drawing the slope fields.
-The return value is a picture that can be added to `currentpicture' via
-the `add(picture)' command.
-
- The function
-path curve(pair c, real f(real,real), pair a, pair b);
- takes a point (`c') and a slope field-defining function `f' and
-returns, as a path, the curve passing through that point. The points
-`a' and `b' represent the rectangular boundaries over which the curve
-is interpolated.
-
- Both `slopefield' and `curve' alternatively accept a function `real
-f(real)' that depends on x only, as seen in this example:
-
-import slopefield;
-
-size(200);
-
-real func(real x) {return 2x;}
-add(slopefield(func,(-3,-3),(3,3),20,Arrow));
-draw(curve((0,0),func,(-3,-3),(3,3)),red);
-
-
-
-
-File: asymptote.info, Node: ode, Prev: slopefield, Up: Base modules
-
-8.39 `ode'
-==========
-
-The `ode' module, illustrated in the example `odetest.asy', implements
-a number of explicit numerical integration schemes for ordinary
-differential equations.
-
-
-File: asymptote.info, Node: Options, Next: Interactive mode, Prev: Base modules, Up: Top
-
-9 Command-line options
-**********************
-
-Type `asy -h' to see the full list of command-line options supported by
-`Asymptote':
-
-Usage: ../asy [options] [file ...]
-
-Options (negate by replacing - with -no):
-
--V,-View View output; command-line only
--a,-align C|B|T|Z Center, Bottom, Top, or Zero page alignment [C]
--antialias n Antialiasing width for rasterized output [2]
--arcballradius pixels Arcball radius [750]
--auto3D Automatically activate 3D scene [true]
--autobillboard 3D labels always face viewer by default [true]
--autoimport string Module to automatically import
--autoplain Enable automatic importing of plain [true]
--autoplay Autoplay 3D animations [false]
--autorotate Enable automatic PDF page rotation [false]
--axes3 Show 3D axes in PDF output [true]
--batchMask Mask fpu exceptions in batch mode [false]
--batchView View output in batch mode [false]
--bw Convert all colors to black and white [false]
--cd directory Set current directory; command-line only
--cmyk Convert rgb colors to cmyk [false]
--c,-command string Command to autoexecute
--compact Conserve memory at the expense of speed [false]
--d,-debug Enable debugging messages [false]
--divisor n Garbage collect using purge(divisor=n) [2]
--doubleclick ms Emulated double-click timeout [200]
--embed Embed rendered preview image [true]
--exitonEOF Exit interactive mode on EOF [true]
--fitscreen Fit rendered image to screen [true]
--framedelay ms Additional frame delay [0]
--framerate frames/s Animation speed [30]
--globalwrite Allow write to other directory [false]
--gray Convert all colors to grayscale [false]
--h,-help Show summary of options; command-line only
--historylines n Retain n lines of history [1000]
--iconify Iconify rendering window [false]
--inlineimage Generate inline embedded image [false]
--inlinetex Generate inline TeX code [false]
--interactiveMask Mask fpu exceptions in interactive mode [true]
--interactiveView View output in interactive mode [true]
--interactiveWrite Write expressions entered at the prompt to stdout [true]
--k,-keep Keep intermediate files [false]
--keepaux Keep intermediate LaTeX .aux files [false]
--level n Postscript level [3]
--l,-listvariables List available global functions and variables [false]
--localhistory Use a local interactive history file [false]
--loop Loop 3D animations [false]
--m,-mask Mask fpu exceptions; command-line only
--maxtile pair Maximum rendering tile size [(1024,768)]
--maxviewport pair Maximum viewport size [(2048,2048)]
--multiline Input code over multiple lines at the prompt [false]
--multipleView View output from multiple batch-mode files [false]
--multisample n Multisampling width for screen images [4]
--offscreen Use offscreen rendering [false]
--O,-offset pair PostScript offset [(0,0)]
--f,-outformat format Convert each output file to specified format
--o,-outname name Alternative output directory/filename
--p,-parseonly Parse file [false]
--pdfreload Automatically reload document in pdfviewer [false]
--pdfreloaddelay usec Delay before attempting initial pdf reload [750000]
--position pair Initial 3D rendering screen position [(0,0)]
--prc Embed 3D PRC graphics in PDF output [true]
--prompt string Prompt [> ]
--prompt2 string Continuation prompt for multiline input [..]
--q,-quiet Suppress welcome message [false]
--render n Render 3D graphics using n pixels per bp (-1=auto) [-1]
--resizestep step Resize step [1.2]
--reverse reverse 3D animations [false]
--rgb Convert cmyk colors to rgb [false]
--safe Disable system call [true]
--scroll n Scroll standard output n lines at a time [0]
--spinstep deg/s Spin speed [60]
--svgemulation Emulate unimplemented SVG shading [false]
--tabcompletion Interactive prompt auto-completion [true]
--tex engine latex|pdflatex|xelatex|tex|pdftex|context|none [latex]
--thick Render thick 3D lines [true]
--thin Render thin 3D lines [true]
--threads Use POSIX threads for 3D rendering [true]
--toolbar Show 3D toolbar in PDF output [true]
--s,-translate Show translated virtual machine code [false]
--twice Run LaTeX twice (to resolve references) [false]
--twosided Use two-sided 3D lighting model for rendering [true]
--u,-user string General purpose user string
--v,-verbose Increase verbosity level (can specify multiple times) [0]
--version Show version; command-line only
--wait Wait for child processes to finish before exiting [false]
--warn string Enable warning; command-line only
--where Show where listed variables are declared [false]
--zoomfactor factor Zoom step factor [1.05]
--zoomstep step Mouse motion zoom step [0.1]
-
- All boolean options can be negated by prepending `no' to the option
-name.
-
- If no arguments are given, `Asymptote' runs in interactive mode
-(*note Interactive mode::). In this case, the default output file is
-`out.eps'.
-
- If `-' is given as the file argument, `Asymptote' reads from
-standard input.
-
- If multiple files are specified, they are treated as separate
-`Asymptote' runs.
-
- If the string `autoimport' is nonempty, a module with this name is
-automatically imported for each run as the final step in loading module
-`plain'.
-
- Default option values may be entered as `Asymptote' code in a
-configuration file named `config.asy' (or the file specified by the
-environment variable `ASYMPTOTE_CONFIG' or `-config' option).
-`Asymptote' will look for this file in its usual search path (*note
-Search paths::). Typically the configuration file is placed in the
-`.asy' directory in the user's home directory (`%USERPROFILE%\.asy'
-under `MSDOS'). Configuration variables are accessed using the long
-form of the option names:
-import settings;
-outformat="pdf";
-batchView=false;
-interactiveView=true;
-batchMask=false;
-interactiveMask=true;
- Command-line options override these defaults. Most configuration
-variables may also be changed at runtime. The advanced configuration
-variables `dvipsOptions', `hyperrefOptions', `convertOptions',
-`gsOptions', `psviewerOptions', `pdfviewerOptions', and `glOptions'
-allow specialized options to be passed as a string to the respective
-applications or libraries. The default value of `hyperrefOptions' is
-`setpagesize=false,unicode,pdfborder=0 0 0'.
-
- If you insert
-import plain;
-settings.autoplain=true;
- at the beginning of the configuration file, it can contain arbitrary
-`Asymptote' code.
-
- The default output format is EPS for the (default) `latex' and `tex'
-tex engine and PDF for the `pdflatex', `xelatex', and `context' tex
-engines. Alternative output formats may be produced using the `-f'
-option (or `outformat' setting). To produce SVG output, first install
-`dvisvgm' (version 0.8.7 or later) from
-`http://dvisvgm.sourceforge.net/down.html' and be sure to use the
-`latex' or `tex' tex engine.
-
- `Asymptote' can also produce any output format supported by the
-`ImageMagick' `convert' program (version 6.3.5 or later recommended; an
-`Invalid Parameter' error message indicates that the `MSDOS' utility
-`convert' is being used instead of the one that comes with
-`ImageMagick'). The optional setting `-render n' requests an output
-resolution of `n' pixels per `bp'. Antialiasing is controlled by the
-parameter `antialias', which by default specifies a sampling width of 2
-pixels. To give other options to `convert', use the `convertOptions'
-setting or call convert manually. This example emulates how `Asymptote'
-produces antialiased `tiff' output at one pixel per `bp':
-asy -o - venn | convert -alpha Off -density 144x144 -geometry 50%x eps:- venn.tiff
-
- If the option `-nosafe' is given, `Asymptote' runs in unsafe mode.
-This enables the `int system(string s)' and `int system(string[] s)'
-calls, allowing one to execute arbitrary shell commands. The default
-mode, `-safe', disables this call.
-
- A `PostScript' offset may be specified as a pair (in `bp' units)
-with the `-O' option:
-asy -O 0,0 file
- The default offset is zero. The default value of the page alignment
-setting `align' is `Center'.
-
- The `-c' (`command') option may be used to execute arbitrary
-`Asymptote' code on the command line as a string. It is not necessary
-to terminate the string with a semicolon. Multiple `-c' options are
-executed in the order they are given. For example
-asy -c 2+2 -c "sin(1)" -c "size(100); draw(unitsquare)"
- produces the output
-4
-0.841470984807897
- and draws a unitsquare of size `100'.
-
- The `-u' (`user') option may be used to specify arbitrary
-`Asymptote' settings on the command line as a string. It is not
-necessary to terminate the string with a semicolon. Multiple `-u'
-options are executed in the order they are given. Command-line code like
-`-u x=sqrt(2)' can be executed within a module like this:
-real x;
-usersetting();
-write(x);
-
- When the `-l' (`listvariables') option is used with file arguments,
-only global functions and variables defined in the specified file(s)
-are listed.
-
- Additional debugging output is produced with each additional `-v'
-option:
-`-v'
- Display top-level module and final output file names.
-
-`-vv'
- Also display imported and included module names and final `LaTeX'
- and `dvips' processing information.
-
-`-vvv'
- Also output `LaTeX' bidirectional pipe diagnostics.
-
-`-vvvv'
- Also output knot guide solver diagnostics.
-
-`-vvvvv'
- Also output `Asymptote' traceback diagnostics.
-
-
-File: asymptote.info, Node: Interactive mode, Next: GUI, Prev: Options, Up: Top
-
-10 Interactive mode
-*******************
-
-Interactive mode is entered by executing the command `asy' with no file
-arguments. When the `-multiline' option is disabled (the default), each
-line must be a complete `Asymptote' statement (unless explicitly
-continued by a final backslash character `\'); it is not necessary to
-terminate input lines with a semicolon. If one assigns
-`settings.multiline=true', interactive code can be entered over
-multiple lines; in this mode, the automatic termination of interactive
-input lines by a semicolon is inhibited. Multiline mode is useful for
-cutting and pasting `Asymptote' code directly into the interactive
-input buffer.
-
- Interactive mode can be conveniently used as a calculator:
-expressions entered at the interactive prompt (for which a
-corresponding `write' function exists) are automatically evaluated and
-written to `stdout'. If the expression is non-writable, its type
-signature will be printed out instead. In either case, the expression
-can be referred to using the symbol `%' in the next line input at the
-prompt. For example:
-> 2+3
-5
-> %*4
-20
-> 1/%
-0.05
-> sin(%)
-0.0499791692706783
-> currentpicture
-<picture currentpicture>
-> %.size(200,0)
->
-
- The `%' symbol, when used as a variable, is shorthand for the
-identifier `operator answer', which is set by the prompt after each
-written expression evaluation.
-
- The following special commands are supported only in interactive mode
-and must be entered immediately after the prompt:
-
-`help'
- view the manual;
-
-`erase'
- erase `currentpicture';
-
-`reset'
- reset the `Asymptote' environment to its initial state, except for
- changes to the settings module (*note settings::), the current
- directory (*note cd::), and breakpoints (*note Debugger::);
-
-`input FILE'
- does an interactive reset, followed by the command `include FILE'.
- If the file name `FILE' contains nonalphanumeric characters,
- enclose it with quotation marks. A trailing semi-colon followed
- by optional `Asymptote' commands may be entered on the same line.
-
-`quit'
- exit interactive mode (`exit' is a synonym; the abbreviation `q'
- is also accepted unless there exists a top-level variable named
- `q'). A history of the most recent 1000 (this number can be
- changed with the `historylines' configuration variable) previous
- commands will be retained in the file `.asy/history' in the user's
- home directory (unless the command-line option `-localhistory' was
- specified, in which case the history will be stored in the file
- `.asy_history' in the current directory).
-
-
- Typing `ctrl-C' interrupts the execution of `Asymptote' code and
-returns control to the interactive prompt.
-
- Interactive mode is implemented with the GNU `readline' library,
-with command history and auto-completion. To customize the key
-bindings, see:
-`http://cnswww.cns.cwru.edu/php/chet/readline/readline.html'
-
- The file `asymptote.py' in the `Asymptote' system directory provides
-an alternative way of entering `Asymptote' commands interactively,
-coupled with the full power of `Python'. Copy this file to your `Python
-path' and then execute from within `Python' the commands
-from asymptote import *
-g=asy()
-g.size(200)
-g.draw("unitcircle")
-g.send("draw(unitsquare)")
-g.fill("unitsquare, blue")
-g.clip("unitcircle")
-g.label("\"$O$\", (0,0), SW")
-
-
-File: asymptote.info, Node: GUI, Next: PostScript to Asymptote, Prev: Interactive mode, Up: Top
-
-11 Graphical User Interface
-***************************
-
-In the event that adjustments to the final figure are required, the
-preliminary Graphical User Interface (GUI) `xasy' included with
-`Asymptote' allows you to move graphical objects and draw new ones.
-The modified figure can then be saved as a normal `Asymptote' file.
-
-* Menu:
-
-* GUI installation:: Installing `xasy'
-* GUI usage::
-
-
-File: asymptote.info, Node: GUI installation, Next: GUI usage, Up: GUI
-
-11.1 GUI installation
-=====================
-
-As `xasy' is written in the interactive scripting language `Python/TK',
-it requires `Python' (`http://www.python.org'), the `Python Imaging
-Library' (`http://www.pythonware.com/products/pil/'), and the `tkinter'
-package (included with `Python' under `Microsoft Windows') be
-installed. `Fedora Linux' users can either install `tkinter' with the
-commands
-yum install tkinter
-yum install tk-devel
- or manually install the `tkinter', `tix', `tk', and `tk-devel'
-packages.
-
- Pictures are deconstructed into the PNG image format, which supports
-full alpha channel transparency. Under `Microsoft Windows', this
-requires `Python 2.7.4' and the `Python Imaging Library':
-
- `http://www.python.org/ftp/python/2.7.4/python-2.7.4.msi'
-
- `http://effbot.org/downloads/PIL-1.1.7.win32-py2.7.exe'.
- On `UNIX' systems, place
-`http://effbot.org/downloads/Imaging-1.1.7.tar.gz' in the `Asymptote'
-source directory, and type (as the root user):
-tar -zxf Imaging-1.1.7.tar.gz
-cd Imaging-1.1.7
-python setup.py install
-
-
-File: asymptote.info, Node: GUI usage, Prev: GUI installation, Up: GUI
-
-11.2 GUI usage
-==============
-
-A wheel mouse is convenient for raising and lowering objects within
-`xasy', to expose the object to be moved. If a wheel mouse is not
-available, mouse `Button-2' can be used to repeatedly lower an object
-instead. When run from the command line, `xasy' accepts a command line
-option `-x n', which sets the initial magnification to `n'.
-
- Deconstruction of compound objects (such as arrows) can be prevented
-by enclosing them within the commands
-void begingroup(picture pic=currentpicture);
-void endgroup(picture pic=currentpicture);
- By default, the elements of a picture or frame will be grouped
-together on adding them to a picture. However, the elements of a frame
-added to another frame are not grouped together by default: their
-elements will be individually deconstructed (*note add::).
-
-
-File: asymptote.info, Node: PostScript to Asymptote, Next: Help, Prev: GUI, Up: Top
-
-12 `PostScript' to `Asymptote'
-******************************
-
-The excellent `PostScript' editor `pstoedit' (version 3.50 or later;
-available from `http://sourceforge.net/projects/pstoedit/') includes an
-`Asymptote' backend. Unlike virtually all other `pstoedit' backends,
-this driver includes native clipping, even-odd fill rule, `PostScript'
-subpath, and full image support. Here is an example: `asy -V
-/usr/local/share/doc/asymptote/examples/venn.asy'
-pstoedit -f asy venn.eps test.asy
-asy -V test
-
-If the line widths aren't quite correct, try giving `pstoedit' the
-`-dis' option. If the fonts aren't typeset correctly, try giving
-`pstoedit' the `-dt' option.
-
-
-File: asymptote.info, Node: Help, Next: Debugger, Prev: PostScript to Asymptote, Up: Top
-
-13 Help
-*******
-
-A list of frequently asked questions (FAQ) is maintained at
-
- `http://asymptote.sourceforge.net/FAQ'
- Questions on installing and using `Asymptote' that are not addressed
-in the FAQ should be sent to the `Asymptote' forum:
-
- `http://sourceforge.net/projects/asymptote/forums/forum/409349'
- Including an example that illustrates what you are trying to do will
-help you get useful feedback. `LaTeX' problems can often be diagnosed
-with the `-vv' or `-vvv' command-line options. Contributions in the
-form of patches or `Asymptote' modules can be posted here:
-
- `http://sourceforge.net/tracker/?atid=685685&group_id=120000'
- To receive announcements of upcoming releases, please subscribe to
-`Asymptote' at
-
- `http://freshmeat.net/projects/asy'
- If you find a bug in `Asymptote', please check (if possible) whether
-the bug is still present in the latest `Subversion' developmental code
-(*note Subversion::) before submitting a bug report. New bugs can be
-submitted using the Bug Tracking System at
-
- `http://sourceforge.net/projects/asymptote'
- To see if the bug has already been fixed, check bugs with Status
-`Closed' and recent lines in
-
- `http://asymptote.sourceforge.net/ChangeLog'
- `Asymptote' can be configured with the optional GNU library
-`libsigsegv', available from `http://libsigsegv.sourceforge.net', which
-allows one to distinguish user-generated `Asymptote' stack overflows
-(*note stack overflow::) from true segmentation faults (due to internal
-C++ programming errors; please submit the `Asymptote' code that
-generates such segmentation faults along with your bug report).
-
-
-File: asymptote.info, Node: Debugger, Next: Credits, Prev: Help, Up: Top
-
-14 Debugger
-***********
-
-Asymptote now includes a line-based (as opposed to code-based) debugger
-that can assist the user in following flow control. To set a break
-point in file `file' at line `line', use the command
-
-void stop(string file, int line, code s=quote{});
- The optional argument `s' may be used to conditionally set the variable
-`ignore' in `plain_debugger.asy' to `true'. For example, the first 10
-instances of this breakpoint will be ignored (the variable `int
-count=0' is defined in `plain_debugger.asy'):
-stop("test",2,quote{ignore=(++count <= 10);});
-
- To set a break point in file `file' at the first line containing the
-string `text', use
-
-void stop(string file, string text, code s=quote{});
- To list all breakpoints, use:
-void breakpoints();
- To clear a breakpoint, use:
-void clear(string file, int line);
- To clear all breakpoints, use:
-void clear();
-
- The following commands may be entered at the debugging prompt:
-
-``h''
- help;
-
-``c''
- continue execution;
-
-``i''
- step to the next instruction;
-
-``s''
- step to the next executable line;
-
-``n''
- step to the next executable line in the current file;
-
-``f''
- step to the next file;
-
-``r''
- return to the file associated with the most recent breakpoint;
-
-``t''
- toggle tracing (`-vvvvv') mode;
-
-``q''
- quit debugging and end execution;
-
-``x''
- exit the debugger and run to completion.
-
- Arbitrary `Asymptote' code may also be entered at the debugging
-prompt; however, since the debugger is implemented with `eval',
-currently only top-level (global) variables can be displayed or
-modified.
-
- The debugging prompt may be entered manually with the call
-void breakpoint(code s=quote{});
-
-
-File: asymptote.info, Node: Credits, Next: Index, Prev: Debugger, Up: Top
-
-15 Acknowledgments
-******************
-
-Financial support for the development of `Asymptote' was generously
-provided by the Natural Sciences and Engineering Research Council of
-Canada, the Pacific Institute for Mathematical Sciences, and the
-University of Alberta Faculty of Science.
-
- We also would like to acknowledge the previous work of John D. Hobby,
-author of the program `MetaPost' that inspired the development of
-`Asymptote', and Donald E. Knuth, author of TeX and `MetaFont' (on
-which `MetaPost' is based).
-
- The authors of `Asymptote' are Andy Hammerlindl, John Bowman, and
-Tom Prince. Sean Healy designed the `Asymptote' logo. Other
-contributors include Michail Vidiassov, Radoslav Marinov, Orest Shardt,
-Chris Savage, Philippe Ivaldi, Olivier Guibe', Jacques Pienaar, Mark
-Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr.
-
-
-File: asymptote.info, Node: Index, Prev: Credits, Up: Top
-
-Index
-*****
-
-
-* Menu:
-
-* !: Arithmetic & logical.
- (line 68)
-* != <1>: Arithmetic & logical.
- (line 38)
-* !=: Structures. (line 52)
-* % <1>: Interactive mode. (line 17)
-* %: Arithmetic & logical.
- (line 23)
-* %=: Self & prefix operators.
- (line 6)
-* & <1>: Arithmetic & logical.
- (line 56)
-* &: Bezier curves. (line 86)
-* &&: Arithmetic & logical.
- (line 53)
-* * <1>: Arithmetic & logical.
- (line 17)
-* *: Pens. (line 15)
-* **: Arithmetic & logical.
- (line 31)
-* *=: Self & prefix operators.
- (line 6)
-* + <1>: Arithmetic & logical.
- (line 13)
-* +: Pens. (line 15)
-* ++: Self & prefix operators.
- (line 6)
-* +=: Self & prefix operators.
- (line 6)
-* -: Arithmetic & logical.
- (line 14)
-* -- <1>: Self & prefix operators.
- (line 6)
-* --: Tutorial. (line 127)
-* ---: Bezier curves. (line 86)
-* -=: Self & prefix operators.
- (line 6)
-* -c: Options. (line 175)
-* -l: Options. (line 194)
-* -u: Options. (line 185)
-* -V <1>: Tutorial. (line 19)
-* -V: Configuring. (line 6)
-* ..: Tutorial. (line 127)
-* .asy: Search paths. (line 14)
-* /: Arithmetic & logical.
- (line 20)
-* /=: Self & prefix operators.
- (line 6)
-* 2D graphs: graph. (line 6)
-* 3D graphs: graph3. (line 6)
-* 3D grids: grid3. (line 6)
-* 3D PostScript: three. (line 593)
-* :: Arithmetic & logical.
- (line 73)
-* ::: Bezier curves. (line 70)
-* <: Arithmetic & logical.
- (line 41)
-* <=: Arithmetic & logical.
- (line 44)
-* == <1>: Arithmetic & logical.
- (line 37)
-* ==: Structures. (line 52)
-* >: Arithmetic & logical.
- (line 50)
-* >=: Arithmetic & logical.
- (line 47)
-* ?: Arithmetic & logical.
- (line 73)
-* ^: Arithmetic & logical.
- (line 28)
-* ^=: Self & prefix operators.
- (line 6)
-* ^^: Tutorial. (line 134)
-* a4: Configuring. (line 61)
-* abort: Data types. (line 339)
-* abs <1>: Mathematical functions.
- (line 35)
-* abs: Data types. (line 62)
-* accel <1>: three. (line 519)
-* accel: Paths and guides. (line 115)
-* access: Import. (line 6)
-* acknowledgments: Credits. (line 6)
-* aCos: Mathematical functions.
- (line 20)
-* acos: Mathematical functions.
- (line 6)
-* acosh: Mathematical functions.
- (line 6)
-* add <1>: three. (line 283)
-* add: Frames and pictures. (line 196)
-* addViews: three. (line 405)
-* adjust: Pens. (line 115)
-* Ai: Mathematical functions.
- (line 48)
-* Ai_deriv: Mathematical functions.
- (line 48)
-* Airy: Mathematical functions.
- (line 48)
-* alias <1>: Arrays. (line 181)
-* alias: Structures. (line 52)
-* align: Options. (line 169)
-* Align: label. (line 12)
-* all: Arrays. (line 329)
-* Allow: Pens. (line 327)
-* AND: Arithmetic & logical.
- (line 80)
-* and: Bezier curves. (line 56)
-* angle: Data types. (line 70)
-* animate <1>: animation. (line 12)
-* animate <2>: Files. (line 154)
-* animate: Configuring. (line 67)
-* animation: animation. (line 6)
-* annotate: annotate. (line 6)
-* antialias <1>: Options. (line 144)
-* antialias: three. (line 222)
-* append <1>: Arrays. (line 39)
-* append: Files. (line 36)
-* arc: three. (line 295)
-* Arc: Paths and guides. (line 32)
-* arc: Paths and guides. (line 22)
-* ArcArrow: draw. (line 26)
-* ArcArrow3: three. (line 560)
-* ArcArrows: draw. (line 26)
-* ArcArrows3: three. (line 560)
-* arclength <1>: three. (line 519)
-* arclength: Paths and guides. (line 142)
-* arcpoint: Paths and guides. (line 152)
-* arctime <1>: three. (line 519)
-* arctime: Paths and guides. (line 146)
-* arguments: Default arguments. (line 6)
-* arithmetic operators: Arithmetic & logical.
- (line 6)
-* array: Arrays. (line 122)
-* array iteration: Programming. (line 33)
-* arrays: Arrays. (line 6)
-* arrow: label. (line 71)
-* Arrow: draw. (line 26)
-* arrow: Drawing commands. (line 31)
-* arrow keys: Tutorial. (line 37)
-* Arrow3: three. (line 560)
-* Arrows: draw. (line 26)
-* arrows: draw. (line 26)
-* Arrows3: three. (line 560)
-* as: Import. (line 68)
-* ascii: Data types. (line 286)
-* aSin: Mathematical functions.
- (line 20)
-* asin: Mathematical functions.
- (line 6)
-* asinh: Mathematical functions.
- (line 6)
-* Aspect: Frames and pictures. (line 54)
-* assert: Data types. (line 344)
-* assignment: Programming. (line 8)
-* asy <1>: Import. (line 102)
-* asy: Data types. (line 334)
-* asy-mode: Editing modes. (line 6)
-* asy.vim: Editing modes. (line 33)
-* asyinclude: LaTeX usage. (line 46)
-* asymptote.sty: LaTeX usage. (line 6)
-* asymptote.xml: Editing modes. (line 49)
-* ASYMPTOTE_CONFIG: Options. (line 116)
-* aTan: Mathematical functions.
- (line 20)
-* atan: Mathematical functions.
- (line 6)
-* atan2: Mathematical functions.
- (line 6)
-* atanh: Mathematical functions.
- (line 6)
-* atleast: Bezier curves. (line 56)
-* attach <1>: graph. (line 416)
-* attach <2>: LaTeX usage. (line 51)
-* attach: Frames and pictures. (line 252)
-* autoadjust: three. (line 371)
-* autoimport: Options. (line 112)
-* automatic scaling: graph. (line 682)
-* axialshade: fill. (line 43)
-* axis <1>: graph3. (line 67)
-* axis: graph. (line 879)
-* azimuth: Data types. (line 126)
-* babel: babel. (line 6)
-* background color: Frames and pictures. (line 168)
-* BackView: three. (line 398)
-* Bar: draw. (line 19)
-* Bar3: three. (line 560)
-* Bars: draw. (line 19)
-* Bars3: three. (line 560)
-* barsize: draw. (line 19)
-* base modules: Base modules. (line 6)
-* basealign: Pens. (line 168)
-* baseline: label. (line 91)
-* batch mode: Tutorial. (line 6)
-* beep: Data types. (line 357)
-* BeginArcArrow: draw. (line 26)
-* BeginArcArrow3: three. (line 560)
-* BeginArrow: draw. (line 26)
-* BeginArrow3: three. (line 560)
-* BeginBar: draw. (line 19)
-* BeginBar3: three. (line 560)
-* BeginDotMargin: draw. (line 42)
-* BeginDotMargin3: three. (line 576)
-* BeginMargin: draw. (line 42)
-* BeginMargin3: three. (line 576)
-* BeginPenMargin: draw. (line 42)
-* BeginPenMargin2: three. (line 576)
-* BeginPenMargin3: three. (line 576)
-* BeginPoint: label. (line 56)
-* Bessel: Mathematical functions.
- (line 48)
-* bevel: flowchart. (line 75)
-* beveljoin: Pens. (line 138)
-* Bezier curves: Bezier curves. (line 6)
-* bezulate: three. (line 104)
-* Bi: Mathematical functions.
- (line 48)
-* Bi_deriv: Mathematical functions.
- (line 48)
-* Billboard: three. (line 489)
-* binary: Files. (line 75)
-* binary format: Files. (line 75)
-* binary operators: Arithmetic & logical.
- (line 6)
-* binarytree: binarytree. (line 6)
-* black stripes: three. (line 222)
-* Blank: draw. (line 26)
-* block.bottom: flowchart. (line 19)
-* block.bottomleft: flowchart. (line 19)
-* block.bottomright: flowchart. (line 19)
-* block.center: flowchart. (line 26)
-* block.draw: flowchart. (line 31)
-* block.left: flowchart. (line 19)
-* block.position: flowchart. (line 24)
-* block.right: flowchart. (line 19)
-* block.top: flowchart. (line 19)
-* block.topleft: flowchart. (line 19)
-* block.topright: flowchart. (line 19)
-* bool: Data types. (line 14)
-* bool3: Data types. (line 23)
-* boolean operators: Arithmetic & logical.
- (line 6)
-* Bottom: graph. (line 134)
-* BottomTop: graph. (line 140)
-* BottomView: three. (line 398)
-* bounding box: Frames and pictures. (line 168)
-* Bounds: graph3. (line 21)
-* box <1>: three. (line 317)
-* box: Frames and pictures. (line 22)
-* bp: Tutorial. (line 26)
-* break: Programming. (line 29)
-* breakpoints: Debugger. (line 21)
-* brick: Pens. (line 251)
-* broken axis: graph. (line 782)
-* bug reports: Help. (line 23)
-* buildcycle: Paths and guides. (line 258)
-* Button-1: GUI. (line 6)
-* Button-2: GUI. (line 6)
-* BWRainbow: palette. (line 15)
-* BWRainbow2: palette. (line 18)
-* C string: Data types. (line 191)
-* CAD: CAD. (line 6)
-* calculateTransform: Frames and pictures. (line 107)
-* camera: three. (line 366)
-* casts: Casts. (line 6)
-* cbrt: Mathematical functions.
- (line 6)
-* cd: Files. (line 25)
-* ceil: Mathematical functions.
- (line 26)
-* center: three. (line 350)
-* Center: label. (line 61)
-* checker: Pens. (line 251)
-* Chinese: unicode. (line 12)
-* choose: Mathematical functions.
- (line 39)
-* Ci: Mathematical functions.
- (line 48)
-* circle <1>: flowchart. (line 64)
-* circle: three. (line 291)
-* Circle: Paths and guides. (line 17)
-* circle: Paths and guides. (line 10)
-* circlebarframe: markers. (line 18)
-* CJK: unicode. (line 12)
-* clamped: graph. (line 37)
-* clear <1>: Debugger. (line 23)
-* clear: Files. (line 92)
-* clip: fill. (line 115)
-* CLZ: Arithmetic & logical.
- (line 80)
-* cm: Tutorial. (line 63)
-* cmd: Configuring. (line 34)
-* cmyk: Pens. (line 34)
-* colatitude: Data types. (line 131)
-* color: Pens. (line 23)
-* coloredNodes: tube. (line 25)
-* coloredpath: tube. (line 18)
-* coloredSegments: tube. (line 25)
-* colorless: Pens. (line 54)
-* colors: Pens. (line 51)
-* comma: Files. (line 61)
-* comma-separated-value mode: Arrays. (line 362)
-* command-line options <1>: Options. (line 6)
-* command-line options: Configuring. (line 83)
-* comment character: Files. (line 16)
-* compass directions: Tutorial. (line 106)
-* Compiling from UNIX source: Compiling from UNIX source.
- (line 6)
-* complement: Arrays. (line 150)
-* concat: Arrays. (line 177)
-* conditional <1>: Arithmetic & logical.
- (line 73)
-* conditional: Programming. (line 8)
-* config: Options. (line 116)
-* configuration file <1>: Options. (line 116)
-* configuration file: Configuring. (line 23)
-* configuring: Configuring. (line 6)
-* conj: Data types. (line 59)
-* constructors: Structures. (line 91)
-* context: Options. (line 144)
-* continue <1>: Debugger. (line 31)
-* continue: Programming. (line 29)
-* contour: contour. (line 9)
-* contour3: contour3. (line 6)
-* controls <1>: three. (line 6)
-* controls: Bezier curves. (line 45)
-* controlSpecifier: Paths and guides. (line 382)
-* convert <1>: Options. (line 144)
-* convert <2>: animation. (line 6)
-* convert <3>: Files. (line 154)
-* convert: Configuring. (line 67)
-* convertOptions: Options. (line 131)
-* Coons shading: fill. (line 78)
-* copy: Arrays. (line 174)
-* Cos: Mathematical functions.
- (line 20)
-* cos: Mathematical functions.
- (line 6)
-* cosh: Mathematical functions.
- (line 6)
-* cputime: Structures. (line 169)
-* crop: graph. (line 637)
-* cropping graphs: graph. (line 637)
-* cross <1>: graph. (line 485)
-* cross: Data types. (line 169)
-* crossframe: markers. (line 23)
-* crosshatch: Pens. (line 267)
-* csv: Arrays. (line 362)
-* CTZ: Arithmetic & logical.
- (line 80)
-* cubicroots: Arrays. (line 318)
-* curl <1>: three. (line 6)
-* curl: Bezier curves. (line 66)
-* curlSpecifier: Paths and guides. (line 394)
-* currentpen: Pens. (line 6)
-* currentprojection: three. (line 395)
-* curve: slopefield. (line 20)
-* custom axis types: graph. (line 144)
-* custom mark routine: graph. (line 577)
-* custom tick locations: graph. (line 249)
-* cut: Paths and guides. (line 240)
-* cycle <1>: three. (line 6)
-* cycle: Tutorial. (line 75)
-* cyclic <1>: three. (line 519)
-* cyclic <2>: Arrays. (line 39)
-* cyclic: Paths and guides. (line 74)
-* Cyrillic: unicode. (line 7)
-* dashdotted: Pens. (line 95)
-* dashed: Pens. (line 95)
-* data types: Data types. (line 6)
-* date: Data types. (line 298)
-* Debian: UNIX binary distributions.
- (line 19)
-* debugger: Debugger. (line 6)
-* declaration: Programming. (line 8)
-* deconstruct: GUI usage. (line 6)
-* default arguments: Default arguments. (line 6)
-* defaultformat: graph. (line 175)
-* DefaultHead: draw. (line 26)
-* DefaultHead3: three. (line 560)
-* defaultpen: Pens. (line 46)
-* defaultrender: three. (line 47)
-* deferred drawing: simplex. (line 6)
-* Degrees: Mathematical functions.
- (line 17)
-* degrees <1>: Mathematical functions.
- (line 17)
-* degrees: Data types. (line 75)
-* delete <1>: Arrays. (line 39)
-* delete: Files. (line 149)
-* description: Description. (line 6)
-* diagonal: Arrays. (line 303)
-* diamond: flowchart. (line 57)
-* dimension: Arrays. (line 367)
-* dir <1>: three. (line 519)
-* dir <2>: Paths and guides. (line 98)
-* dir <3>: Data types. (line 87)
-* dir: Search paths. (line 10)
-* direction specifier: Bezier curves. (line 6)
-* directory: Files. (line 25)
-* dirSpecifier: Paths and guides. (line 376)
-* dirtime: Paths and guides. (line 155)
-* display: Configuring. (line 67)
-* do: Programming. (line 29)
-* DOSendl: Files. (line 61)
-* DOSnewl: Files. (line 61)
-* dot <1>: Arrays. (line 259)
-* dot <2>: Data types. (line 100)
-* dot: draw. (line 83)
-* DotMargin: draw. (line 42)
-* DotMargin3: three. (line 576)
-* DotMargins: draw. (line 42)
-* DotMargins3: three. (line 576)
-* dotted: Pens. (line 95)
-* double deferred drawing: three. (line 268)
-* double precision: Files. (line 75)
-* draw: three. (line 112)
-* Draw: Frames and pictures. (line 147)
-* draw: draw. (line 110)
-* Draw: draw. (line 26)
-* draw: Drawing commands. (line 31)
-* drawing commands: Drawing commands. (line 6)
-* drawline: math. (line 9)
-* drawtree: drawtree. (line 9)
-* dvips: Configuring. (line 67)
-* dvipsOptions: Options. (line 131)
-* dvisvgm: Configuring. (line 67)
-* E <1>: Mathematical functions.
- (line 48)
-* E: Tutorial. (line 106)
-* Editing modes: Editing modes. (line 6)
-* Ei: Mathematical functions.
- (line 48)
-* ellipse <1>: Frames and pictures. (line 22)
-* ellipse: Paths and guides. (line 39)
-* elliptic functions: Mathematical functions.
- (line 48)
-* else: Programming. (line 8)
-* emacs: Editing modes. (line 6)
-* embed: embed. (line 6)
-* Embedded: three. (line 489)
-* empty: Frames and pictures. (line 7)
-* EndArcArrow: draw. (line 26)
-* EndArcArrow3: three. (line 560)
-* EndArrow: draw. (line 26)
-* EndArrow3: three. (line 560)
-* EndBar: draw. (line 19)
-* EndBar3: three. (line 560)
-* EndDotMargin: draw. (line 42)
-* EndDotMargin3: three. (line 576)
-* endl: Files. (line 61)
-* EndMargin: draw. (line 42)
-* EndMargin3: three. (line 576)
-* EndPenMargin: draw. (line 42)
-* EndPenMargin2: three. (line 576)
-* EndPenMargin3: three. (line 576)
-* EndPoint: label. (line 56)
-* envelope: Frames and pictures. (line 22)
-* environment variables: Configuring. (line 87)
-* eof <1>: Arrays. (line 344)
-* eof: Files. (line 92)
-* eol <1>: Arrays. (line 344)
-* eol: Files. (line 92)
-* EPS <1>: Options. (line 144)
-* EPS: label. (line 79)
-* erase <1>: Frames and pictures. (line 7)
-* erase <2>: Data types. (line 241)
-* erase: Tutorial. (line 37)
-* erf: Mathematical functions.
- (line 6)
-* erfc: Mathematical functions.
- (line 6)
-* error: Files. (line 16)
-* error bars: graph. (line 533)
-* errorbars: graph. (line 485)
-* eval: Import. (line 98)
-* evenodd <1>: Pens. (line 152)
-* evenodd: Tutorial. (line 148)
-* exit <1>: Debugger. (line 57)
-* exit <2>: Interactive mode. (line 59)
-* exit: Data types. (line 348)
-* exp: Mathematical functions.
- (line 6)
-* expi: Data types. (line 83)
-* explicit: Casts. (line 6)
-* explicit casts: Casts. (line 21)
-* expm1: Mathematical functions.
- (line 6)
-* exponential integral: Mathematical functions.
- (line 48)
-* extendcap: Pens. (line 129)
-* extension <1>: MetaPost. (line 10)
-* extension: Paths and guides. (line 235)
-* external: embed. (line 13)
-* extrude: three. (line 513)
-* F: Mathematical functions.
- (line 48)
-* fabs: Mathematical functions.
- (line 6)
-* face: three. (line 601)
-* factorial: Mathematical functions.
- (line 39)
-* Fedora: UNIX binary distributions.
- (line 15)
-* feynman: feynman. (line 6)
-* fft <1>: math. (line 26)
-* fft: Arrays. (line 246)
-* FFTW: Compiling from UNIX source.
- (line 57)
-* file <1>: Debugger. (line 45)
-* file: Files. (line 6)
-* Fill: Frames and pictures. (line 133)
-* fill <1>: fill. (line 17)
-* fill: draw. (line 116)
-* Fill: draw. (line 26)
-* FillDraw: Frames and pictures. (line 123)
-* filldraw: fill. (line 11)
-* FillDraw: draw. (line 26)
-* filloutside: fill. (line 27)
-* fillrule: Pens. (line 152)
-* find <1>: Arrays. (line 159)
-* find: Data types. (line 226)
-* firstcut: Paths and guides. (line 250)
-* fit: Frames and pictures. (line 103)
-* fit3: three. (line 281)
-* fixedscaling: Frames and pictures. (line 74)
-* floor: Mathematical functions.
- (line 26)
-* flowchart: flowchart. (line 6)
-* flush: Files. (line 61)
-* fmod: Mathematical functions.
- (line 6)
-* font: Pens. (line 192)
-* font command: Pens. (line 192)
-* fontcommand: Pens. (line 207)
-* fontsize: Pens. (line 178)
-* for: Programming. (line 8)
-* format <1>: Options. (line 144)
-* format: Data types. (line 269)
-* forum: Help. (line 6)
-* frame: Frames and pictures. (line 7)
-* from: Import. (line 17)
-* FrontView: three. (line 398)
-* function declarations: Functions. (line 67)
-* function shading: fill. (line 100)
-* Function shading: fill. (line 100)
-* functions <1>: Mathematical functions.
- (line 6)
-* functions: Functions. (line 6)
-* functionshade: fill. (line 100)
-* gamma: Mathematical functions.
- (line 6)
-* Gaussrand: Mathematical functions.
- (line 39)
-* geometry: geometry. (line 6)
-* getc: Files. (line 30)
-* getpair: Files. (line 117)
-* getreal: Files. (line 117)
-* getstring: Files. (line 117)
-* gettriple: Files. (line 117)
-* glOptions <1>: Options. (line 131)
-* glOptions: three. (line 222)
-* GNU Scientific Library: Mathematical functions.
- (line 48)
-* gouraudshade: fill. (line 62)
-* Gradient: palette. (line 25)
-* gradient shading: fill. (line 32)
-* graph: graph. (line 6)
-* graph3: graph3. (line 6)
-* graphic: label. (line 79)
-* graphical user interface: GUI. (line 6)
-* gray: Pens. (line 25)
-* Grayscale: palette. (line 9)
-* grayscale: Pens. (line 25)
-* grid <1>: graph. (line 733)
-* grid: Pens. (line 251)
-* grid3: grid3. (line 6)
-* gs: Configuring. (line 6)
-* gsl: Mathematical functions.
- (line 48)
-* GSL: Compiling from UNIX source.
- (line 57)
-* gsOptions: Options. (line 131)
-* GUI: GUI. (line 6)
-* GUI installation: GUI installation. (line 6)
-* GUI usage: GUI usage. (line 6)
-* guide: Paths and guides. (line 303)
-* guide3: three. (line 6)
-* hatch: Pens. (line 267)
-* height: LaTeX usage. (line 51)
-* help <1>: Debugger. (line 30)
-* help <2>: Help. (line 6)
-* help: Interactive mode. (line 44)
-* Hermite: graph. (line 37)
-* Hermite(splinetype splinetype: graph. (line 37)
-* hex <1>: Pens. (line 60)
-* hex: Data types. (line 283)
-* hexidecimal <1>: Pens. (line 59)
-* hexidecimal: Data types. (line 283)
-* hidden surface removal: three. (line 601)
-* histogram: Mathematical functions.
- (line 39)
-* history <1>: Interactive mode. (line 59)
-* history: Files. (line 142)
-* historylines: Interactive mode. (line 64)
-* HookHead: draw. (line 26)
-* HookHead3: three. (line 560)
-* Horizontal: flowchart. (line 81)
-* hyperrefOptions: Options. (line 131)
-* hypot: Mathematical functions.
- (line 6)
-* I: Mathematical functions.
- (line 48)
-* i_scaled: Mathematical functions.
- (line 48)
-* iconic: three. (line 222)
-* identity <1>: Arrays. (line 300)
-* identity <2>: Mathematical functions.
- (line 6)
-* identity: Transforms. (line 24)
-* identity4: three. (line 449)
-* if: Programming. (line 8)
-* IgnoreAspect: Frames and pictures. (line 58)
-* image: palette. (line 34)
-* ImageMagick <1>: Options. (line 144)
-* ImageMagick <2>: animation. (line 6)
-* ImageMagick: Configuring. (line 67)
-* images: palette. (line 6)
-* implicit casts: Casts. (line 6)
-* implicit linear solver: MetaPost. (line 10)
-* implicit scaling: Implicit scaling. (line 6)
-* import: Import. (line 46)
-* inches: Tutorial. (line 63)
-* include: Import. (line 127)
-* including images: label. (line 79)
-* increasing: math. (line 59)
-* inf: Data types. (line 33)
-* inheritance: Structures. (line 181)
-* initialized: Arrays. (line 39)
-* initializers: Variable initializers.
- (line 6)
-* inline: LaTeX usage. (line 51)
-* InOutTicks: graph3. (line 35)
-* input <1>: Interactive mode. (line 48)
-* input: Files. (line 10)
-* insert <1>: Arrays. (line 39)
-* insert: Data types. (line 237)
-* inside: Paths and guides. (line 282)
-* inst: Debugger. (line 36)
-* installation: Installation. (line 6)
-* int: Data types. (line 28)
-* integer division: Arithmetic & logical.
- (line 6)
-* interactive mode: Interactive mode. (line 6)
-* interior: Paths and guides. (line 278)
-* international characters: unicode. (line 6)
-* interp: Arithmetic & logical.
- (line 76)
-* interpolate: interpolate. (line 6)
-* intersect <1>: three. (line 519)
-* intersect <2>: math. (line 13)
-* intersect: Paths and guides. (line 184)
-* intersectionpoint <1>: three. (line 519)
-* intersectionpoint <2>: math. (line 17)
-* intersectionpoint: Paths and guides. (line 227)
-* intersectionpoints <1>: three. (line 519)
-* intersectionpoints: Paths and guides. (line 231)
-* intersections <1>: three. (line 519)
-* intersections: Paths and guides. (line 195)
-* InTicks: graph3. (line 35)
-* intMax: Data types. (line 28)
-* intMin: Data types. (line 28)
-* inverse <1>: Arrays. (line 306)
-* inverse: Transforms. (line 16)
-* invert: three. (line 439)
-* invisible: Pens. (line 39)
-* isnan: Data types. (line 33)
-* J: Mathematical functions.
- (line 6)
-* Japanese: unicode. (line 12)
-* K: Mathematical functions.
- (line 48)
-* k_scaled: Mathematical functions.
- (line 48)
-* Kate: Editing modes. (line 49)
-* KDE editor: Editing modes. (line 49)
-* keepAspect <1>: LaTeX usage. (line 51)
-* keepAspect: Frames and pictures. (line 54)
-* keyboard bindings:: three. (line 181)
-* keys: Arrays. (line 39)
-* keyword: Named arguments. (line 37)
-* keyword-only: Named arguments. (line 37)
-* keywords: Named arguments. (line 6)
-* Korean: unicode. (line 12)
-* label: three. (line 483)
-* Label <1>: graph. (line 343)
-* Label: label. (line 14)
-* label: clip. (line 16)
-* Label: draw. (line 98)
-* labelpath: labelpath. (line 6)
-* labelpath3: labelpath3. (line 6)
-* labelx: graph. (line 343)
-* labely: graph. (line 343)
-* Landscape: Frames and pictures. (line 95)
-* lastcut: Paths and guides. (line 254)
-* lasy-mode: Editing modes. (line 6)
-* latex: Options. (line 144)
-* LaTeX fonts: Pens. (line 192)
-* LaTeX usage: LaTeX usage. (line 6)
-* latexmk: LaTeX usage. (line 30)
-* latin1: latin1. (line 6)
-* latitude: Data types. (line 136)
-* latticeshade: fill. (line 32)
-* layer: Drawing commands. (line 16)
-* leastsquares <1>: graph. (line 901)
-* leastsquares: stats. (line 6)
-* Left: graph. (line 284)
-* LeftRight: graph. (line 290)
-* LeftSide: label. (line 61)
-* LeftTicks: graph. (line 161)
-* LeftView: three. (line 398)
-* legend <1>: graph. (line 432)
-* legend <2>: draw. (line 64)
-* legend: Drawing commands. (line 31)
-* Legendre: Mathematical functions.
- (line 48)
-* length <1>: three. (line 519)
-* length <2>: Arrays. (line 39)
-* length <3>: Paths and guides. (line 65)
-* length: Data types. (line 62)
-* letter: Configuring. (line 61)
-* lexorder: math. (line 68)
-* libm routines: Mathematical functions.
- (line 6)
-* libsigsegv <1>: Help. (line 33)
-* libsigsegv: Functions. (line 88)
-* limits: graph. (line 637)
-* line: Arrays. (line 344)
-* line mode: Arrays. (line 344)
-* Linear: graph. (line 682)
-* linecap: Pens. (line 129)
-* linejoin: Pens. (line 138)
-* lineskip: Pens. (line 178)
-* linetype: Pens. (line 115)
-* linewidth: Pens. (line 119)
-* locale: Data types. (line 293)
-* Log: graph. (line 682)
-* log: Mathematical functions.
- (line 6)
-* log-log graph: graph. (line 713)
-* log10: Mathematical functions.
- (line 6)
-* log1p: Mathematical functions.
- (line 6)
-* log2 graph: graph. (line 762)
-* logarithmic graph: graph. (line 713)
-* logical operators: Arithmetic & logical.
- (line 6)
-* longdashdotted: Pens. (line 95)
-* longdashed: Pens. (line 95)
-* longitude: Data types. (line 141)
-* loop: Programming. (line 8)
-* MacOS X binary distributions: MacOS X binary distributions.
- (line 6)
-* makepen: Pens. (line 300)
-* map: Arrays. (line 141)
-* Margin: draw. (line 42)
-* Margin3: three. (line 576)
-* margins: three. (line 274)
-* Margins: draw. (line 42)
-* Margins3: three. (line 576)
-* mark: graph. (line 485)
-* markangle: markers. (line 38)
-* marker: graph. (line 485)
-* markers: markers. (line 6)
-* marknodes: graph. (line 485)
-* markuniform: graph. (line 485)
-* mask: Data types. (line 33)
-* math: math. (line 6)
-* mathematical functions: Mathematical functions.
- (line 6)
-* max <1>: three. (line 519)
-* max <2>: Arrays. (line 225)
-* max <3>: Frames and pictures. (line 7)
-* max: Paths and guides. (line 267)
-* maxbound: Data types. (line 106)
-* maxtile: three. (line 222)
-* maxtimes: Paths and guides. (line 222)
-* maxviewport: three. (line 222)
-* MetaPost: MetaPost. (line 6)
-* MetaPost ... : Bezier curves. (line 70)
-* MetaPost cutafter: Paths and guides. (line 255)
-* MetaPost cutbefore: Paths and guides. (line 251)
-* MetaPost pickup: Pens. (line 6)
-* MetaPost whatever: MetaPost. (line 10)
-* Microsoft Windows: Microsoft Windows. (line 6)
-* MidArcArrow: draw. (line 26)
-* MidArcArrow3: three. (line 560)
-* MidArrow: draw. (line 26)
-* MidArrow3: three. (line 560)
-* midpoint: Paths and guides. (line 169)
-* MidPoint: label. (line 56)
-* min <1>: three. (line 519)
-* min <2>: Arrays. (line 218)
-* min <3>: Frames and pictures. (line 7)
-* min: Paths and guides. (line 263)
-* minbound: Data types. (line 103)
-* minipage: label. (line 118)
-* mintimes: Paths and guides. (line 217)
-* miterjoin: Pens. (line 138)
-* miterlimit: Pens. (line 147)
-* mktemp: Files. (line 44)
-* mm: Tutorial. (line 63)
-* mode: Files. (line 75)
-* monotonic: graph. (line 37)
-* mouse: GUI. (line 6)
-* mouse bindings: three. (line 149)
-* Move: Pens. (line 339)
-* MoveQuiet: Pens. (line 345)
-* multisample: three. (line 140)
-* N: Tutorial. (line 106)
-* name: Files. (line 88)
-* named arguments: Named arguments. (line 6)
-* natural: graph. (line 37)
-* new <1>: Arrays. (line 109)
-* new: Structures. (line 6)
-* newframe: Frames and pictures. (line 7)
-* newl: Files. (line 61)
-* newton: Mathematical functions.
- (line 66)
-* next: Debugger. (line 42)
-* NFSS: Pens. (line 192)
-* nobasealign: Pens. (line 168)
-* NoFill <1>: Frames and pictures. (line 141)
-* NoFill: draw. (line 26)
-* NoMargin: draw. (line 42)
-* NoMargin3: three. (line 576)
-* none: Files. (line 61)
-* None: draw. (line 19)
-* normal: three. (line 505)
-* nosafe: Options. (line 164)
-* NOT: Arithmetic & logical.
- (line 80)
-* notaknot: graph. (line 37)
-* NoTicks: graph. (line 161)
-* NoTicks3: graph3. (line 35)
-* null: Structures. (line 6)
-* nullpen <1>: Frames and pictures. (line 127)
-* nullpen: label. (line 14)
-* NURBS: three. (line 375)
-* O: three. (line 286)
-* obj: obj. (line 9)
-* oblique: three. (line 331)
-* obliqueX: three. (line 339)
-* obliqueY: three. (line 346)
-* obliqueZ: three. (line 331)
-* ode: ode. (line 9)
-* offset <1>: Options. (line 169)
-* offset: Pens. (line 115)
-* OmitTick: graph. (line 239)
-* OmitTickInterval: graph. (line 239)
-* OmitTickIntervals: graph. (line 239)
-* opacity: Pens. (line 222)
-* open: Files. (line 12)
-* OpenGL: three. (line 140)
-* operator: User-defined operators.
- (line 6)
-* operator --: graph. (line 31)
-* operator ..: graph. (line 34)
-* operator answer: Interactive mode. (line 37)
-* operator cast: Casts. (line 30)
-* operator ecast: Casts. (line 57)
-* operator init <1>: Structures. (line 134)
-* operator init: Variable initializers.
- (line 6)
-* operators: Operators. (line 6)
-* options: Options. (line 6)
-* OR: Arithmetic & logical.
- (line 80)
-* orientation: Frames and pictures. (line 95)
-* orthographic: three. (line 350)
-* outformat: three. (line 140)
-* outprefix: Frames and pictures. (line 83)
-* output <1>: Options. (line 144)
-* output: Files. (line 36)
-* OutTicks: graph3. (line 35)
-* overloading functions: Functions. (line 44)
-* overwrite: Pens. (line 324)
-* P: Mathematical functions.
- (line 48)
-* pack: label. (line 101)
-* packing: Rest arguments. (line 30)
-* pair <1>: Data types. (line 43)
-* pair: Tutorial. (line 51)
-* pairs: Arrays. (line 242)
-* paperheight: Configuring. (line 61)
-* papertype: Configuring. (line 61)
-* paperwidth: Configuring. (line 61)
-* parallelogram: flowchart. (line 50)
-* parametric surface: graph3. (line 101)
-* parametrized curve: graph. (line 637)
-* partialsum: math. (line 53)
-* patch-dependent colors: three. (line 81)
-* path <1>: flowchart. (line 81)
-* path <2>: three. (line 43)
-* path: Paths and guides. (line 7)
-* path markers: graph. (line 485)
-* path3: three. (line 6)
-* path[]: Tutorial. (line 134)
-* patterns <1>: patterns. (line 6)
-* patterns: Pens. (line 238)
-* PDF: Options. (line 144)
-* pdflatex: Options. (line 144)
-* pdfviewer: Configuring. (line 6)
-* pdfviewerOptions: Options. (line 131)
-* pen: Pens. (line 6)
-* PenMargin: draw. (line 42)
-* PenMargin2: three. (line 576)
-* PenMargin3: three. (line 576)
-* PenMargins: draw. (line 42)
-* PenMargins2: three. (line 576)
-* PenMargins3: three. (line 576)
-* periodic: graph. (line 37)
-* perl: LaTeX usage. (line 30)
-* perpendicular: geometry. (line 6)
-* perspective: three. (line 375)
-* picture: Frames and pictures. (line 35)
-* picture alignment: Frames and pictures. (line 209)
-* piecewisestraight: Paths and guides. (line 81)
-* pixel: three. (line 583)
-* Pl: Mathematical functions.
- (line 48)
-* plain: plain. (line 6)
-* planar: three. (line 89)
-* plane: three. (line 313)
-* planeproject: three. (line 502)
-* point <1>: three. (line 519)
-* point: Paths and guides. (line 84)
-* polar: Data types. (line 121)
-* polargraph: graph. (line 90)
-* polygon: graph. (line 485)
-* pop: Arrays. (line 39)
-* Portrait: Frames and pictures. (line 95)
-* postcontrol <1>: three. (line 519)
-* postcontrol: Paths and guides. (line 135)
-* postfix operators: Self & prefix operators.
- (line 19)
-* postscript: Frames and pictures. (line 271)
-* PostScript fonts: Pens. (line 210)
-* PostScript subpath: Tutorial. (line 134)
-* pow10: Mathematical functions.
- (line 6)
-* prc: three. (line 243)
-* precision: Files. (line 92)
-* precontrol <1>: three. (line 519)
-* precontrol: Paths and guides. (line 128)
-* prefix operators: Self & prefix operators.
- (line 6)
-* private: Structures. (line 6)
-* programming: Programming. (line 6)
-* pstoedit: PostScript to Asymptote.
- (line 6)
-* psview: Microsoft Windows. (line 16)
-* psviewer: Configuring. (line 6)
-* psviewerOptions: Options. (line 131)
-* pt: Tutorial. (line 63)
-* public: Structures. (line 6)
-* push: Arrays. (line 39)
-* Python usage: Interactive mode. (line 80)
-* quadraticroots: Arrays. (line 309)
-* quarticroots: math. (line 22)
-* quick reference: Description. (line 80)
-* quit <1>: Debugger. (line 54)
-* quit <2>: Interactive mode. (line 59)
-* quit: Tutorial. (line 37)
-* quote: Import. (line 116)
-* quotient: Arithmetic & logical.
- (line 6)
-* RadialShade: Frames and pictures. (line 159)
-* radialshade: fill. (line 51)
-* RadialShadeDraw: Frames and pictures. (line 163)
-* radians: Mathematical functions.
- (line 17)
-* radius <1>: three. (line 519)
-* radius: Paths and guides. (line 124)
-* Rainbow: palette. (line 12)
-* rand: Mathematical functions.
- (line 39)
-* randMax: Mathematical functions.
- (line 39)
-* read: Arrays. (line 385)
-* reading: Files. (line 12)
-* reading string arrays: Arrays. (line 354)
-* readline: Files. (line 134)
-* real: Data types. (line 33)
-* realDigits: Data types. (line 33)
-* realEpsilon: Data types. (line 33)
-* realMax: Data types. (line 33)
-* realMin: Data types. (line 33)
-* realmult: Data types. (line 97)
-* rectangle: flowchart. (line 37)
-* recursion: Functions. (line 88)
-* reference: Description. (line 80)
-* reflect: Transforms. (line 51)
-* Relative: label. (line 51)
-* relpoint: Paths and guides. (line 165)
-* reltime: Paths and guides. (line 161)
-* remainder: Mathematical functions.
- (line 6)
-* rename: Files. (line 151)
-* render <1>: Options. (line 144)
-* render: three. (line 47)
-* replace: Data types. (line 254)
-* resetdefaultpen: Pens. (line 353)
-* rest arguments: Rest arguments. (line 6)
-* restore: Frames and pictures. (line 265)
-* restricted: Structures. (line 6)
-* return: Debugger. (line 48)
-* reverse <1>: three. (line 519)
-* reverse <2>: Arrays. (line 146)
-* reverse <3>: Paths and guides. (line 172)
-* reverse: Data types. (line 250)
-* rewind: Files. (line 92)
-* rfind: Data types. (line 231)
-* rgb: Pens. (line 30)
-* Riemann zeta function: Mathematical functions.
- (line 48)
-* Right: graph. (line 287)
-* RightSide: label. (line 61)
-* RightTicks: graph. (line 161)
-* RightView: three. (line 398)
-* rotate: three. (line 470)
-* Rotate: label. (line 36)
-* Rotate(pair z): label. (line 39)
-* round: Mathematical functions.
- (line 26)
-* roundcap: Pens. (line 129)
-* roundedpath: roundedpath. (line 6)
-* roundjoin: Pens. (line 138)
-* roundrectangle: flowchart. (line 69)
-* RPM: UNIX binary distributions.
- (line 6)
-* runtime imports: Import. (line 98)
-* Russian: unicode. (line 7)
-* S: Tutorial. (line 106)
-* safe: Options. (line 164)
-* save: Frames and pictures. (line 262)
-* saveline: Files. (line 134)
-* scale: three. (line 469)
-* Scale: graph. (line 698)
-* scale <1>: graph. (line 682)
-* scale <2>: Transforms. (line 39)
-* scale: Pens. (line 115)
-* Scale: label. (line 45)
-* scale3: three. (line 466)
-* scaled graph: graph. (line 663)
-* scientific graph: graph. (line 397)
-* scroll: Files. (line 108)
-* search: Arrays. (line 164)
-* search paths: Search paths. (line 6)
-* Seascape: Frames and pictures. (line 100)
-* secondary axis: graph. (line 812)
-* secondaryX: graph. (line 812)
-* secondaryY: graph. (line 812)
-* seconds: Data types. (line 306)
-* seek: Files. (line 92)
-* seekeof: Files. (line 92)
-* segment: math. (line 50)
-* segmentation fault: Help. (line 33)
-* self operators: Self & prefix operators.
- (line 6)
-* sequence: Arrays. (line 128)
-* settings <1>: Options. (line 116)
-* settings: Configuring. (line 23)
-* sgn: Mathematical functions.
- (line 26)
-* shading: fill. (line 32)
-* shift <1>: three. (line 454)
-* shift: Transforms. (line 27)
-* Shift: label. (line 33)
-* shiftless: Transforms. (line 53)
-* shipout: Frames and pictures. (line 83)
-* showtarget: three. (line 350)
-* Si: Mathematical functions.
- (line 48)
-* signedint: Files. (line 75)
-* SimpleHead: draw. (line 26)
-* simplex: simplex. (line 6)
-* simpson: Mathematical functions.
- (line 82)
-* Sin: Mathematical functions.
- (line 20)
-* sin: Mathematical functions.
- (line 6)
-* single precision: Files. (line 75)
-* singleint: Files. (line 75)
-* singlereal: Files. (line 75)
-* sinh: Mathematical functions.
- (line 6)
-* SixViews: three. (line 413)
-* SixViewsFR: three. (line 413)
-* SixViewsUS: three. (line 413)
-* size <1>: Options. (line 144)
-* size <2>: three. (line 519)
-* size <3>: Frames and pictures. (line 43)
-* size: Paths and guides. (line 70)
-* size3: three. (line 271)
-* slant: Transforms. (line 45)
-* Slant: label. (line 42)
-* sleep: Data types. (line 351)
-* slice: Paths and guides. (line 240)
-* slices: Slices. (line 6)
-* slide: slide. (line 6)
-* slope: math. (line 44)
-* slopefield: slopefield. (line 6)
-* sncndn: Mathematical functions.
- (line 48)
-* solid: Pens. (line 95)
-* solids: solids. (line 9)
-* solve: Arrays. (line 278)
-* sort: Arrays. (line 184)
-* Spline <1>: graph3. (line 101)
-* Spline: graph. (line 34)
-* split: Data types. (line 263)
-* sqrt: Mathematical functions.
- (line 6)
-* squarecap: Pens. (line 129)
-* srand: Mathematical functions.
- (line 39)
-* stack overflow <1>: Help. (line 33)
-* stack overflow: Functions. (line 88)
-* static: Static. (line 6)
-* stats: stats. (line 6)
-* stdin: Files. (line 48)
-* stdout: Files. (line 48)
-* step: Debugger. (line 39)
-* stickframe: markers. (line 16)
-* stop: Debugger. (line 10)
-* straight: three. (line 519)
-* Straight: graph. (line 31)
-* straight: Paths and guides. (line 77)
-* strftime: Data types. (line 298)
-* string: Data types. (line 181)
-* stroke: fill. (line 36)
-* strokepath: Paths and guides. (line 297)
-* strptime: Data types. (line 306)
-* struct: Structures. (line 6)
-* structures: Structures. (line 6)
-* subpath <1>: three. (line 519)
-* subpath: Paths and guides. (line 175)
-* subpictures: Frames and pictures. (line 103)
-* substr: Data types. (line 246)
-* Subversion: Subversion. (line 6)
-* sum: Arrays. (line 213)
-* superpath: Tutorial. (line 134)
-* Suppress: Pens. (line 331)
-* SuppressQuiet: Pens. (line 335)
-* surface <1>: graph3. (line 101)
-* surface: three. (line 47)
-* SVG: Options. (line 144)
-* SVN: Subversion. (line 6)
-* system <1>: Options. (line 164)
-* system: Data types. (line 328)
-* syzygy: syzygy. (line 6)
-* tab: Files. (line 61)
-* tab completion: Tutorial. (line 37)
-* Tan: Mathematical functions.
- (line 20)
-* tan: Mathematical functions.
- (line 6)
-* tanh: Mathematical functions.
- (line 6)
-* target: three. (line 350)
-* tell: Files. (line 92)
-* tension <1>: three. (line 6)
-* tension: Bezier curves. (line 56)
-* tensionSpecifier: Paths and guides. (line 388)
-* tensor product shading: fill. (line 78)
-* tensorshade: fill. (line 78)
-* tessellation: three. (line 112)
-* tex <1>: Options. (line 144)
-* tex: Frames and pictures. (line 278)
-* TeX fonts: Pens. (line 201)
-* TeX string: Data types. (line 181)
-* texcommand: Configuring. (line 67)
-* TeXHead: draw. (line 26)
-* TeXHead3: three. (line 560)
-* texpath <1>: label. (line 115)
-* texpath: Configuring. (line 67)
-* texpreamble: Frames and pictures. (line 286)
-* texreset: Frames and pictures. (line 289)
-* textbook graph: graph. (line 372)
-* tgz: UNIX binary distributions.
- (line 6)
-* thick: three. (line 123)
-* thin: three. (line 123)
-* this: Structures. (line 6)
-* three: three. (line 6)
-* ThreeViews: three. (line 413)
-* ThreeViewsFR: three. (line 413)
-* ThreeViewsUS: three. (line 413)
-* tick: graph. (line 343)
-* Ticks: graph. (line 161)
-* ticks: graph. (line 161)
-* tildeframe: markers. (line 26)
-* tile: Pens. (line 251)
-* tilings: Pens. (line 238)
-* time <1>: math. (line 30)
-* time: Data types. (line 298)
-* times: Paths and guides. (line 209)
-* Top: graph. (line 137)
-* TopView: three. (line 398)
-* trace: Debugger. (line 51)
-* trailingzero: graph. (line 175)
-* transform <1>: three. (line 494)
-* transform: Transforms. (line 6)
-* transform3: three. (line 449)
-* transparency: Pens. (line 222)
-* transpose: Arrays. (line 205)
-* tree: tree. (line 9)
-* trembling: trembling. (line 6)
-* triangle: geometry. (line 6)
-* triangles: three. (line 112)
-* triangulate: contour. (line 156)
-* tridiagonal: Arrays. (line 266)
-* trigonometric integrals: Mathematical functions.
- (line 48)
-* triple: Data types. (line 110)
-* TrueMargin: draw. (line 42)
-* TrueMargin3: three. (line 576)
-* tube <1>: tube. (line 6)
-* tube: three. (line 123)
-* tutorial: Tutorial. (line 6)
-* type1cm: Pens. (line 178)
-* typedef <1>: Functions. (line 36)
-* typedef: Data types. (line 361)
-* U3D: embed. (line 24)
-* undefined: Paths and guides. (line 271)
-* UnFill: Frames and pictures. (line 152)
-* unfill: fill. (line 110)
-* UnFill: draw. (line 26)
-* unicode: unicode. (line 6)
-* uniform: Arrays. (line 155)
-* Uninstall: Uninstall. (line 6)
-* unique: math. (line 64)
-* unit: Data types. (line 80)
-* unitbox <1>: three. (line 319)
-* unitbox: Tutorial. (line 155)
-* unitcircle <1>: three. (line 286)
-* unitcircle: Tutorial. (line 128)
-* unitrand: Mathematical functions.
- (line 39)
-* unitsize <1>: Frames and pictures. (line 64)
-* unitsize: Tutorial. (line 86)
-* UNIX binary distributions: UNIX binary distributions.
- (line 6)
-* unpacking: Rest arguments. (line 39)
-* unravel: Import. (line 30)
-* up: three. (line 350)
-* update: Files. (line 36)
-* UpsideDown: Frames and pictures. (line 95)
-* usepackage: Frames and pictures. (line 291)
-* user coordinates: Tutorial. (line 86)
-* user-defined operators: User-defined operators.
- (line 6)
-* usleep: Data types. (line 354)
-* value: math. (line 38)
-* var: Variable initializers.
- (line 63)
-* variable initializers: Variable initializers.
- (line 6)
-* vectorfield: graph. (line 974)
-* vectorfield3: graph3. (line 160)
-* vectorization: Arrays. (line 323)
-* verbatim: Frames and pictures. (line 271)
-* vertex-dependent colors: three. (line 81)
-* Vertical: flowchart. (line 81)
-* viewportheight: LaTeX usage. (line 51)
-* viewportmargin: three. (line 274)
-* viewportsize: three. (line 274)
-* viewportwidth: LaTeX usage. (line 51)
-* views: three. (line 243)
-* vim: Editing modes. (line 33)
-* virtual functions: Structures. (line 181)
-* void: Data types. (line 10)
-* W: Tutorial. (line 106)
-* whatever: Paths and guides. (line 235)
-* Wheel: palette. (line 22)
-* wheel mouse: GUI. (line 6)
-* while: Programming. (line 29)
-* white-space string delimiter mode: Arrays. (line 354)
-* width: LaTeX usage. (line 51)
-* windingnumber: Paths and guides. (line 271)
-* word: Arrays. (line 354)
-* write <1>: Arrays. (line 394)
-* write: Files. (line 53)
-* X: three. (line 286)
-* xasy: GUI. (line 6)
-* xaxis3: graph3. (line 7)
-* xdr: Files. (line 75)
-* xelatex: Options. (line 144)
-* xequals: graph. (line 294)
-* XEquals: graph. (line 280)
-* xlimits: graph. (line 637)
-* XOR: Arithmetic & logical.
- (line 80)
-* xpart: Data types. (line 91)
-* xscale: Transforms. (line 33)
-* xscale3: three. (line 457)
-* xtick: graph. (line 343)
-* XY: three. (line 479)
-* XYEquals: graph3. (line 21)
-* XYZero: graph3. (line 21)
-* XZEquals: graph3. (line 21)
-* XZero: graph. (line 275)
-* XZZero: graph3. (line 21)
-* Y <1>: three. (line 286)
-* Y: Mathematical functions.
- (line 6)
-* yaxis3: graph3. (line 7)
-* yequals: graph. (line 294)
-* YEquals: graph. (line 130)
-* ylimits: graph. (line 637)
-* ypart: Data types. (line 94)
-* yscale: Transforms. (line 36)
-* yscale3: three. (line 460)
-* ytick: graph. (line 343)
-* YX: three. (line 494)
-* YZ: three. (line 494)
-* YZEquals: graph3. (line 21)
-* YZero: graph. (line 125)
-* YZZero: graph3. (line 21)
-* Z: three. (line 286)
-* zaxis3: graph3. (line 7)
-* zero_Ai: Mathematical functions.
- (line 48)
-* zero_Ai_deriv: Mathematical functions.
- (line 48)
-* zero_Bi: Mathematical functions.
- (line 48)
-* zero_Bi_deriv: Mathematical functions.
- (line 48)
-* zero_J: Mathematical functions.
- (line 48)
-* zerowinding: Pens. (line 152)
-* zeta: Mathematical functions.
- (line 48)
-* zpart: Data types. (line 163)
-* zscale3: three. (line 463)
-* ZX: three. (line 494)
-* ZY: three. (line 494)
-* |: Arithmetic & logical.
- (line 62)
-* ||: Arithmetic & logical.
- (line 59)
-
-
-
-Tag Table:
-Node: Top575
-Node: Description6834
-Node: Installation10450
-Node: UNIX binary distributions11503
-Node: MacOS X binary distributions12609
-Node: Microsoft Windows13493
-Ref: psview14203
-Node: Configuring15137
-Node: Search paths19351
-Node: Compiling from UNIX source20193
-Node: Editing modes23051
-Node: Subversion25483
-Node: Uninstall25946
-Node: Tutorial26296
-Ref: unitcircle30594
-Node: Drawing commands32530
-Node: draw34241
-Ref: arrows35389
-Node: fill40632
-Ref: gradient shading41676
-Node: clip46231
-Node: label46823
-Ref: Label47421
-Node: Bezier curves53224
-Node: Programming56926
-Ref: array iteration57740
-Node: Data types58821
-Ref: format68018
-Node: Paths and guides72271
-Ref: circle72525
-Ref: extension81945
-Node: Pens88628
-Ref: fillrule95996
-Ref: basealign96893
-Ref: transparency99719
-Ref: makepen103162
-Ref: overwrite104000
-Node: Transforms105210
-Node: Frames and pictures107001
-Ref: envelope108142
-Ref: size109225
-Ref: unitsize110212
-Ref: shipout111272
-Ref: filltype113605
-Ref: add116742
-Ref: add about117688
-Ref: tex120626
-Node: Files121500
-Ref: cd122483
-Ref: scroll127157
-Node: Variable initializers130072
-Node: Structures132797
-Node: Operators140241
-Node: Arithmetic & logical140555
-Node: Self & prefix operators142528
-Node: User-defined operators143316
-Node: Implicit scaling144227
-Node: Functions144790
-Ref: stack overflow147543
-Node: Default arguments148107
-Node: Named arguments148846
-Node: Rest arguments151417
-Node: Mathematical functions154538
-Node: Arrays159203
-Ref: sort166192
-Ref: tridiagonal168596
-Ref: solve169824
-Node: Slices174017
-Node: Casts177907
-Node: Import179872
-Node: Static185109
-Node: LaTeX usage188003
-Node: Base modules194415
-Node: plain196915
-Node: simplex197567
-Node: math197840
-Node: interpolate200545
-Node: geometry200824
-Node: trembling201418
-Node: stats201687
-Node: patterns201947
-Node: markers202183
-Node: tree203966
-Node: binarytree204154
-Node: drawtree204774
-Node: syzygy204978
-Node: feynman205252
-Node: roundedpath205527
-Node: animation205810
-Ref: animate206230
-Node: embed207369
-Node: slide208396
-Node: MetaPost208736
-Node: unicode209452
-Node: latin1210340
-Node: babel210708
-Node: labelpath210937
-Node: labelpath3211757
-Node: annotate212068
-Node: CAD212539
-Node: graph212849
-Ref: ticks219978
-Ref: pathmarkers233305
-Ref: marker233770
-Ref: markuniform234121
-Ref: errorbars235912
-Ref: automatic scaling239949
-Node: palette250578
-Ref: images250696
-Ref: image254868
-Ref: logimage255346
-Ref: penimage256407
-Ref: penfunctionimage256628
-Node: three257352
-Ref: PostScript3D282920
-Node: obj284612
-Node: graph3284864
-Ref: GaussianSurface290019
-Node: grid3291123
-Node: solids291863
-Node: tube292811
-Node: flowchart295046
-Node: contour299615
-Node: contour3304705
-Node: slopefield305012
-Node: ode306449
-Node: Options306709
-Ref: configuration file312754
-Ref: settings312754
-Ref: convert313955
-Node: Interactive mode316922
-Ref: history319075
-Node: GUI320380
-Node: GUI installation320883
-Node: GUI usage322013
-Node: PostScript to Asymptote322916
-Node: Help323672
-Node: Debugger325408
-Node: Credits327193
-Node: Index328125
-
-End Tag Table
diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc
index 5576023c9f1..98383fc83be 100644
--- a/Build/source/utils/asymptote/drawsurface.cc
+++ b/Build/source/utils/asymptote/drawsurface.cc
@@ -599,6 +599,13 @@ void drawSphere::P(Triple& t, double x, double y, double z)
double temp=z; z=x; x=-temp;
}
+ if(T == NULL) {
+ t[0]=x;
+ t[1]=y;
+ t[2]=z;
+ return;
+ }
+
double f=T[12]*x+T[13]*y+T[14]*z+T[15];
if(f == 0.0) run::dividebyzero();
f=1.0/f;
diff --git a/Build/source/utils/asymptote/examples/RiemannSphere.asy b/Build/source/utils/asymptote/examples/RiemannSphere.asy
new file mode 100644
index 00000000000..ec1ab7586a9
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/RiemannSphere.asy
@@ -0,0 +1,47 @@
+import graph3;
+import solids;
+
+currentlight=White;
+defaultrender.merge=true;
+
+size(10cm,0);
+
+pair k=(1,0.2);
+real r=abs(k);
+real theta=angle(k);
+
+real x(real t) { return r^t*cos(t*theta); }
+real y(real t) { return r^t*sin(t*theta); }
+real z(real t) { return 0; }
+
+real u(real t) { return x(t)/(x(t)^2+y(t)^2+1); }
+real v(real t) { return y(t)/(x(t)^2+y(t)^2+1); }
+real w(real t) { return (x(t)^2+y(t)^2)/(x(t)^2+y(t)^2+1); }
+
+real nb=3;
+for (int i=0; i<12; ++i) draw((0,0,0)--nb*(Cos(i*30),Sin(i*30),0),yellow);
+for (int i=0; i<=nb; ++i) draw(circle((0,0,0),i),lightgreen+white);
+
+
+path3 p=graph(x,y,z,-200,40,operator ..);
+path3 q=graph(u,v,w,-200,40,operator ..);
+
+revolution sph=sphere((0,0,0.5),0.5);
+draw(surface(sph),green+white+opacity(0.5));
+
+draw(p,1bp+heavyred);
+draw(q,1bp+heavyblue);
+
+triple
+ A=(0,0,1),
+ B=(u(40),v(40),w(40)),
+ C=(x(40),y(40),z(40));
+
+path3 L=A--C;
+draw(L,1bp+black);
+
+pen p=fontsize(8pt);
+
+dot("$(0,0,1)$",A,N,p);
+dot("$(u,v,w)$",B,E,p);
+dot("$(x,y,0)$",C,E,p);
diff --git a/Build/source/utils/asymptote/examples/circumcircle.asy b/Build/source/utils/asymptote/examples/circumcircle.asy
new file mode 100644
index 00000000000..96b3bdd82a0
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/circumcircle.asy
@@ -0,0 +1,9 @@
+unitsize(1inch);
+
+path tri=(0,0)--(1,0)--(2,1)--cycle;
+pair p1=point(tri,0.5);
+pair p2=point(tri,1.5);
+pair z0=extension(p1,p1+I*dir(tri,0.5),p2,p2+I*dir(tri,1.5));
+dot(z0);
+draw(circle(z0,abs(z0-point(tri,0))));
+draw(tri,red);
diff --git a/Build/source/utils/asymptote/examples/refs.bib b/Build/source/utils/asymptote/examples/refs.bib
new file mode 100644
index 00000000000..5fde126a050
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/refs.bib
@@ -0,0 +1,15 @@
+@ARTICLE{Hobby86,
+ AUTHOR = "John D. Hobby",
+ TITLE = "Smooth, Easy to Compute Interpolating Splines",
+ JOURNAL = "Discrete Comput. Geom.",
+ YEAR = 1986,
+ VOLUME = 1,
+ PAGES = "123-140"}
+
+@BOOK{Knuth86b,
+ AUTHOR = "Donald E. Knuth",
+ TITLE = "The \MF{}book",
+ PUBLISHER = "Addison-Wesley",
+ YEAR = 1986,
+ ADDRESS = "Reading, Massachusetts"}
+
diff --git a/Build/source/utils/asymptote/examples/sqrtx01y1.asy b/Build/source/utils/asymptote/examples/sqrtx01y1.asy
index dcb247f572e..0bb7dd52162 100644
--- a/Build/source/utils/asymptote/examples/sqrtx01y1.asy
+++ b/Build/source/utils/asymptote/examples/sqrtx01y1.asy
@@ -15,9 +15,6 @@ revolution a=revolution(p3,Y,0,360);
draw(surface(a),green,render(compression=Low,merge=true));
draw(p3,blue);
-xtick((0,0,0));
-xtick((1,0,0));
-
xaxis3(Label("$x$",1),Arrow3);
yaxis3(Label("$y$",1),ymax=1.5,dashed,Arrow3);
dot(Label("$(1,1)$"),(1,1,0));
diff --git a/Build/source/utils/asymptote/fftw++.cc b/Build/source/utils/asymptote/fftw++.cc
index 954c845dee5..bd3a8c26438 100644
--- a/Build/source/utils/asymptote/fftw++.cc
+++ b/Build/source/utils/asymptote/fftw++.cc
@@ -2,15 +2,26 @@
namespace fftwpp {
-bool fftw::Wise=false;
-bool fftw::autothreads=true;
const double fftw::twopi=2.0*acos(-1.0);
+fft1d::Table fft1d::threadtable;
+mfft1d::Table mfft1d::threadtable;
+rcfft1d::Table rcfft1d::threadtable;
+crfft1d::Table crfft1d::threadtable;
+mrcfft1d::Table mrcfft1d::threadtable;
+mcrfft1d::Table mcrfft1d::threadtable;
+fft2d::Table fft2d::threadtable;
+
// User settings:
unsigned int fftw::effort=FFTW_MEASURE;
-const char *WisdomName=".wisdom";
+const char *fftw::WisdomName=".wisdom";
unsigned int fftw::maxthreads=1;
-double fftw::testseconds=0.1; // Time limit for threading efficiency tests
+double fftw::testseconds=1.0; // Time limit for threading efficiency tests
+unsigned int fftw::Wise=0;
+bool fftw::mpi=false;
+
+const char *fftw::oddshift="Shift is not implemented for odd nx";
+const char *inout="constructor and call must be both in place or both out of place";
void fftw::LoadWisdom() {
std::ifstream ifWisdom;
diff --git a/Build/source/utils/asymptote/fftw++.h b/Build/source/utils/asymptote/fftw++.h
index addb91cff05..35dfc6f249b 100644
--- a/Build/source/utils/asymptote/fftw++.h
+++ b/Build/source/utils/asymptote/fftw++.h
@@ -1,5 +1,5 @@
/* Fast Fourier transform C++ header class for the FFTW3 Library
- Copyright (C) 2004-12 John C. Bowman, University of Alberta
+ Copyright (C) 2004-13 John C. Bowman, University of Alberta
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -18,13 +18,14 @@
#ifndef __fftwpp_h__
#define __fftwpp_h__ 1
-#define __FFTWPP_H_VERSION__ 1.14
+#define __FFTWPP_H_VERSION__ 1.14pre
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <fftw3.h>
#include <cerrno>
+#include <map>
#ifndef FFTWPP_SINGLE_THREAD
#include <omp.h>
@@ -130,8 +131,7 @@ inline void newAlign(T *&v, size_t len, size_t align)
template<class T>
inline void deleteAlign(T *v, size_t len)
{
- for(size_t i=len-1; i > 0; i--) v[i].~T();
- v[0].~T();
+ for(size_t i=len; i-- > 0;) v[i].~T();
#ifdef HAVE_POSIX_MEMALIGN
free(v);
#else
@@ -187,12 +187,24 @@ inline int fftwpp_import_wisdom(int (*g)(std::ifstream& s), std::ifstream &s)
inline void PutWisdom(char c, std::ofstream& s) {s.put(c);}
inline int GetWisdom(std::ifstream& s) {return s.get();}
+extern const char *inout;
+
+struct threaddata {
+ unsigned int threads;
+ double mean;
+ double stdev;
+ threaddata() : threads(0), mean(0.0), stdev(0.0) {}
+ threaddata(unsigned int threads, double mean, double stdev) :
+ threads(threads), mean(mean), stdev(stdev) {}
+};
+
// Base clase for fft routines
//
class fftw {
protected:
unsigned int doubles; // number of double precision values in dataset
int sign;
+ unsigned int threads;
double norm;
fftw_plan plan;
@@ -214,54 +226,71 @@ protected:
return realsize(n,(Complex *) in,out);
}
- static bool Wise;
+ static unsigned int Wise;
static const double twopi;
- unsigned int threads;
public:
static unsigned int effort;
static unsigned int maxthreads;
static double testseconds;
+ static const char *WisdomName;
+ static bool mpi; // TODO: Remove when FFTW transpose routines are replaced
+
+ virtual unsigned int Threads() {return threads;}
- unsigned int Threads() {return threads;}
+ static const char *oddshift;
- // Shift the Fourier origin to (nx/2,0).
+ // Inplace shift of Fourier origin to (nx/2,0) for even nx.
static void Shift(Complex *data, unsigned int nx, unsigned int ny,
- int sign=0) {
+ unsigned int threads) {
const unsigned int nyp=ny/2+1;
- Complex *pstop=data+nx*nyp;
+ unsigned int stop=nx*nyp;
if(nx % 2 == 0) {
- int pinc=2*nyp;
- for(Complex *p=data+nyp; p < pstop; p += pinc) {
+ unsigned int inc=2*nyp;
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
+ for(unsigned int i=nyp; i < stop; i += inc) {
+ Complex *p=data+i;
for(unsigned int j=0; j < nyp; j++) p[j]=-p[j];
}
} else {
- if(sign) {
- unsigned int c=nx/2;
- double arg=twopi*c/nx;
- for(unsigned int i=0; i < nx; i++) {
- double iarg=i*arg;
- Complex zeta(cos(iarg),sign*sin(iarg));
- Complex *datai=data+i*nyp;
- for(unsigned int j=0; j < nyp; j++) datai[j] *= zeta;
- }
- } else {
- std::cerr << "Shift for odd nx must be signed and interleaved"
- << std::endl;
- exit(1);
+ std::cerr << oddshift << std::endl;
+ exit(1);
+ }
+ }
+
+ // Out-of-place shift of Fourier origin to (nx/2,0) for even nx.
+ static void Shift(double *data, unsigned int nx, unsigned int ny,
+ unsigned int threads) {
+ if(nx % 2 == 0) {
+ unsigned int stop=nx*ny;
+ unsigned int inc=2*ny;
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
+ for(unsigned int i=ny; i < stop; i += inc) {
+ double *p=data+i;
+ for(unsigned int j=0; j < ny; j++) p[j]=-p[j];
}
+ } else {
+ std::cerr << oddshift << std::endl;
+ exit(1);
}
}
- // Shift the Fourier origin to (nx/2,ny/2,0).
+ // Inplace shift of Fourier origin to (nx/2,ny/2,0) for even nx and ny.
static void Shift(Complex *data, unsigned int nx, unsigned int ny,
- unsigned int nz, int sign=0) {
+ unsigned int nz, unsigned int threads) {
const unsigned int nzp=nz/2+1;
const unsigned int nyzp=ny*nzp;
if(nx % 2 == 0 && ny % 2 == 0) {
const unsigned int pinc=2*nzp;
Complex *pstop=data;
Complex *p=data;
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
for(unsigned i=0; i < nx; i++) {
if(i % 2) p -= nzp;
else p += nzp;
@@ -271,43 +300,52 @@ public:
}
}
} else {
- if(sign) {
- unsigned int cx=nx/2;
- double argx=twopi*cx/nx;
- unsigned int cy=ny/2;
- double argy=twopi*cy/ny;
- for(unsigned i=0; i < nx; i++) {
- double iarg=i*argx;
- Complex zetax(cos(iarg),sign*sin(iarg));
- Complex *datai=data+nyzp*i;
- for(unsigned j=0; j < ny; j++) {
- double jarg=j*argy;
- Complex zeta=zetax*Complex(cos(jarg),sign*sin(jarg));
- Complex *dataij=datai+nzp*j;
- for(unsigned int k=0; k < nzp; k++) dataij[k] *= zeta;
- }
+ std::cerr << oddshift << "or odd ny" << std::endl;
+ exit(1);
+ }
+ }
+
+ // Out-of-place shift of Fourier origin to (nx/2,ny/2,0) for even nx and ny.
+ static void Shift(double *data, unsigned int nx, unsigned int ny,
+ unsigned int nz, unsigned int threads) {
+ const unsigned int nyz=ny*nz;
+ if(nx % 2 == 0 && ny % 2 == 0) {
+ const unsigned int pinc=2*nz;
+ double *pstop=data;
+ double *p=data;
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
+ for(unsigned i=0; i < nx; i++) {
+ if(i % 2) p -= nz;
+ else p += nz;
+ pstop += nyz;
+ for(; p < pstop; p += pinc) {
+ for(unsigned int k=0; k < nz; k++) p[k]=-p[k];
}
- } else {
- std::cerr << "Shift for odd nx or ny must be signed and interleaved"
- << std::endl;
- exit(1);
}
+ } else {
+ std::cerr << oddshift << "or odd ny" << std::endl;
+ exit(1);
}
}
-
- static bool autothreads;
- fftw(unsigned int doubles, int sign, unsigned int n=0) :
- doubles(doubles), sign(sign), norm(1.0/(n ? n : (doubles+1)/2)),
- plan(NULL) {
- if(autothreads) {
+
+ fftw(unsigned int doubles, int sign, unsigned int threads,
+ unsigned int n=0) :
+ doubles(doubles), sign(sign), threads(threads),
+ norm(1.0/(n ? n : doubles/2)), plan(NULL) {
#ifndef FFTWPP_SINGLE_THREAD
- fftw_init_threads();
+ if(!mpi) fftw_init_threads();
#endif
- autothreads=false;
- }
}
- virtual ~fftw() {if(plan) fftw_destroy_plan(plan);}
+ virtual ~fftw() {
+ if(Wise > 0)
+ --Wise;
+ if(Wise == 0)
+ SaveWisdom();
+ if(plan) fftw_destroy_plan(plan);
+ }
virtual fftw_plan Plan(Complex *in, Complex *out)=0;
@@ -317,24 +355,112 @@ public:
<< "-byte aligned: address " << p << std::endl;
}
- double stdev(unsigned int N, double sum, double sum2) {
- return N > 1 ? sqrt((sum2-sum*sum/N)/(N-1)) : 0.0;
- }
-
void noplan() {
std::cerr << "Unable to construct FFTW plan" << std::endl;
exit(1);
}
- void planThreads(unsigned int threads) {
+ static void planThreads(unsigned int threads) {
#ifndef FFTWPP_SINGLE_THREAD
omp_set_num_threads(threads);
fftw_plan_with_nthreads(threads);
#endif
}
- void Setup(Complex *in, Complex *out=NULL) {
- if(!Wise) LoadWisdom();
+ class statistics {
+ unsigned int N;
+ double A;
+ double varL;
+ double varH;
+ public:
+ statistics() : N(0), A(0.0), varL(0.0), varH(0.0) {}
+ double count() {return N;}
+ double mean() {return A;}
+ void add(double t) {
+ ++N;
+ double diff=t-A;
+ A += diff/N;
+ double v=diff*(t-A);
+ if(diff < 0.0)
+ varL += v;
+ else
+ varH += v;
+ }
+ double stdev(double var, double f) {
+ double factor=N > f ? f/(N-f) : 0.0;
+ return sqrt(var*factor);
+ }
+ double stdev() {
+ return stdev(varL+varH,1.0);
+ }
+ double stdevL() {
+ return stdev(varL,2.0);
+ }
+ double stdevH() {
+ return stdev(varH,2.0);
+ }
+ void output(const char *text, unsigned int m) {
+ std::cout << text << ":\n"
+ << m << "\t"
+ << A << "\t"
+ << stdevL() << "\t"
+ << stdevH() << std::endl;
+ }
+ };
+
+ threaddata time(fftw_plan plan1, fftw_plan planT, Complex *in, Complex *out,
+ unsigned int Threads) {
+ statistics S,ST;
+ double stop=totalseconds()+testseconds;
+ threads=1;
+ plan=plan1;
+ fft(in,out);
+ threads=Threads;
+ plan=planT;
+ fft(in,out);
+ unsigned int N=1;
+ for(;;) {
+ double t0=totalseconds();
+ threads=1;
+ plan=plan1;
+ for(unsigned int i=0; i < N; ++i)
+ fft(in,out);
+ double t1=totalseconds();
+ threads=Threads;
+ plan=planT;
+ for(unsigned int i=0; i < N; ++i)
+ fft(in,out);
+ double t=totalseconds();
+ S.add(t1-t0);
+ ST.add(t-t1);
+ if(S.mean() < 100.0/CLOCKS_PER_SEC) N *= 2;
+ if(S.count() >= 10) {
+ double error=S.stdev();
+ double diff=ST.mean()-S.mean();
+ if(diff >= 0.0 || t > stop) {
+ threads=1;
+ plan=plan1;
+ fftw_destroy_plan(planT);
+ break;
+ }
+ if(diff < -error) {
+ threads=Threads;
+ fftw_destroy_plan(plan1);
+ break;
+ }
+ }
+ }
+ return threaddata(threads,S.mean(),S.stdev());
+ }
+
+ virtual threaddata lookup(bool inplace, unsigned int threads) {
+ return threaddata();
+ }
+ virtual void store(bool inplace, const threaddata& data) {}
+
+ threaddata Setup(Complex *in, Complex *out=NULL) {
+ if(!Wise) {LoadWisdom(); ++Wise;}
+
bool alloc=!in;
if(alloc) in=ComplexAlign((doubles+1)/2);
#ifndef NO_CHECK_ALIGN
@@ -346,76 +472,36 @@ public:
#endif
inplace=(out==in);
- planThreads(1);
- fftw_plan plan1=Plan(in,out);
- if(!plan1) noplan();
- plan=plan1;
+ threaddata data;
+ unsigned int Threads=threads;
+ if(threads > 1) data=lookup(inplace,threads);
+ threads=data.threads > 0 ? data.threads : 1;
+ planThreads(threads);
+ plan=Plan(in,out);
+ if(!plan) noplan();
- if(maxthreads > 1) {
- double sum2=0.0;
- unsigned int N=1;
- double begin=totalseconds();
- double lastseconds=begin;
- double stop=begin+testseconds;
- for(;;++N) {
- fft(in,out);
- double t=totalseconds();
- double seconds=t-lastseconds;
- sum2 += seconds*seconds;
- lastseconds=t;
- if(t > stop)
- break;
- }
-
- double end=totalseconds();
- double sum=end-begin;
- double mean1=sum/N;
- double stdev1=stdev(N,sum,sum2);
-
- threads=maxthreads;
+ if(Threads > 1 && data.threads == 0) {
+ threads=Threads;
planThreads(threads);
- plan=Plan(in,out);
- if(!plan) noplan();
-
- if(plan) {
- double begin=totalseconds();
- double lastseconds=begin;
- double stop=begin+testseconds;
- N=1;
- for(;;++N) {
- fft(in,out);
- double t=totalseconds();
- double seconds=t-lastseconds;
- sum2 += seconds*seconds;
- lastseconds=t;
- if(t > stop)
- break;
- }
- double end=totalseconds();
- double sum=end-begin;
- double mean2=sum/N;
-
- if(mean2 > mean1-stdev1) {
- threads=1;
- fftw_destroy_plan(plan);
- plan=plan1;
- } else {
- fftw_destroy_plan(plan1);
- threads=maxthreads;
- }
- }
- } else
- threads=1;
+ fftw_plan planT=Plan(in,out);
+ if(planT)
+ data=time(plan,planT,in,out,threads);
+ else noplan();
+ store(inplace,threaddata(threads,data.mean,data.stdev));
+ }
if(alloc) Array::deleteAlign(in,(doubles+1)/2);
- SaveWisdom();
+ return data;
}
- void Setup(Complex *in, double *out) {Setup(in,(Complex *) out);}
- void Setup(double *in, Complex *out=NULL) {Setup((Complex *) in,out);}
+ void Setup(Complex *in, double *out) {
+ Setup(in,(Complex *) out);}
+ void Setup(double *in, Complex *out=NULL) {
+ Setup((Complex *) in,out);
+ }
- void LoadWisdom();
- void SaveWisdom();
+ static void LoadWisdom();
+ static void SaveWisdom();
virtual void Execute(Complex *in, Complex *out, bool=false) {
fftw_execute_dft(plan,(fftw_complex *) in,(fftw_complex *) out);
@@ -430,7 +516,7 @@ public:
if(!out) out=in;
#endif
if(inplace ^ (out == in)) {
- std::cerr << "ERROR: fft constructor and call must be both in place or both out of place" << std::endl;
+ std::cerr << "ERROR: fft " << inout << std::endl;
exit(1);
}
return out;
@@ -464,10 +550,16 @@ public:
void Normalize(Complex *out) {
unsigned int stop=(doubles+1)/2;
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
for(unsigned int i=0; i < stop; i++) out[i] *= norm;
}
void Normalize(double *out) {
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
for(unsigned int i=0; i < doubles; i++) out[i] *= norm;
}
@@ -507,21 +599,184 @@ public:
unsigned int nx, unsigned int M,
size_t stride, size_t dist) {
if(stride == 1 && dist == nx) fftw::fftNormalized(in,out);
- else if(stride == nx && dist == 1) fftw::fftNormalized(in,out);
else {
out=Setout(in,out);
Execute(in,out);
+
+ unsigned int stop=nx*stride;
+ Complex *outMdist=out+M*dist;
#ifndef FFTWPP_SINGLE_THREAD
#pragma omp parallel for num_threads(threads)
#endif
- for(unsigned int k=0; k < M; k++) {
- for(unsigned int j=0; j < nx; j++) {
- out[j*stride+k*dist] *= norm;
+ for(unsigned int i=0; i < stop; i += stride) {
+ Complex *pstop=outMdist+i;
+ for(Complex *p=out+i; p < pstop; p += dist) {
+ *p *= norm;
}
}
}
}
+
+}; // class fftw
+
+class Transpose {
+ fftw_plan plan;
+ unsigned int a,b;
+ unsigned int nlength,mlength;
+ unsigned int instride,outstride;
+ unsigned int threads;
+ bool inplace;
+ unsigned int size;
+public:
+ template<class T>
+ Transpose(unsigned int rows, unsigned int cols, unsigned int length,
+ T *in, T *out=NULL, unsigned int threads=fftw::maxthreads) :
+ threads(threads) {
+ size=sizeof(T);
+ if(size % sizeof(double) != 0) {
+ std::cerr << "ERROR: Transpose is not implemented for type of size "
+ << size;
+ exit(1);
+ }
+ size /= sizeof(double);
+ length *= size;
+ if(!out) out=in;
+ inplace=(out==in);
+ if(inplace) threads=1;
+
+ fftw_iodim dims[3];
+
+ a=std::min(rows,threads);
+ b=std::min(cols,threads/a);
+ unsigned int n=rows/a;
+ unsigned int m=cols/b;
+ nlength=n*length;
+ mlength=m*length;
+
+ instride=cols;
+ outstride=rows;
+
+ dims[0].n=n;
+ dims[0].is=instride*length;
+ dims[0].os=length;
+
+ dims[1].n=m;
+ dims[1].is=length;
+ dims[1].os=outstride*length;
+
+ dims[2].n=length;
+ dims[2].is=1;
+ dims[2].os=1;
+
+ fftw::planThreads(inplace ? threads : 1);
+ plan=fftw_plan_guru_r2r(0,NULL,3,dims,(double *) in,
+ (double *) out,NULL,fftw::effort);
+ }
+
+ ~Transpose() {if(plan) fftw_destroy_plan(plan);}
+
+ template<class T>
+ void transpose(T *in, T *out=NULL) {
+ if(!out) out=in;
+ if(inplace ^ (out == in)) {
+ std::cerr << "ERROR: Transpose " << inout << std::endl;
+ exit(1);
+ }
+#ifndef FFTWPP_SINGLE_THREAD
+ if(threads == 1)
+#endif
+ fftw_execute_r2r(plan,(double *) in,(double*) out);
+#ifndef FFTWPP_SINGLE_THREAD
+ else {
+ int A=a, B=b;
+#pragma omp parallel for num_threads(A)
+ for(unsigned int i=0; i < a; ++i) {
+ unsigned int I=i*nlength;
+#pragma omp parallel for num_threads(B)
+ for(unsigned int j=0; j < b; ++j) {
+ unsigned int J=j*mlength;
+ fftw_execute_r2r(plan,(double *) in+instride*I+J,
+ (double *) out+outstride*J+I);
+ }
+ }
+ }
+#endif
+ }
+};
+
+template<class T, class L>
+class Threadtable {
+public:
+ typedef std::map<T,threaddata,L> Table;
+
+ threaddata Lookup(Table& table, T key) {
+ typename Table::iterator p=table.find(key);
+ return p == table.end() ? threaddata() : p->second;
+ }
+
+ void Store(Table& threadtable, T key, const threaddata& data) {
+ threadtable[key]=data;
+ }
+};
+
+struct keytype1 {
+ unsigned int nx;
+ unsigned int threads;
+ bool inplace;
+ keytype1(unsigned int nx, unsigned int threads, bool inplace) :
+ nx(nx), threads(threads), inplace(inplace) {}
+};
+
+struct keyless1 {
+ bool operator()(const keytype1& a, const keytype1& b) const {
+ return a.nx < b.nx || (a.nx == b.nx &&
+ (a.threads < b.threads || (a.threads == b.threads &&
+ a.inplace < b.inplace)));
+ }
+};
+
+struct keytype2 {
+ unsigned int nx;
+ unsigned int ny;
+ unsigned int threads;
+ bool inplace;
+ keytype2(unsigned int nx, unsigned int ny, unsigned int threads,
+ bool inplace) :
+ nx(nx), ny(ny), threads(threads), inplace(inplace) {}
+};
+
+struct keyless2 {
+ bool operator()(const keytype2& a, const keytype2& b) const {
+ return a.nx < b.nx || (a.nx == b.nx &&
+ (a.ny < b.ny || (a.ny == b.ny &&
+ (a.threads < b.threads ||
+ (a.threads == b.threads &&
+ a.inplace < b.inplace)))));
+ }
+};
+
+struct keytype3 {
+ unsigned int nx;
+ unsigned int ny;
+ unsigned int nz;
+ unsigned int threads;
+ bool inplace;
+ keytype3(unsigned int nx, unsigned int ny, unsigned int nz,
+ unsigned int threads, bool inplace) :
+ nx(nx), ny(ny), nz(nz), threads(threads), inplace(inplace) {}
+};
+
+struct keyless3 {
+ bool operator()(const keytype3& a, const keytype3& b) const {
+ return a.nx < b.nx || (a.nx == b.nx &&
+ (a.ny < b.ny || (a.ny == b.ny &&
+ (a.nz < b.nz ||
+ (a.nz == b.nz &&
+ (a.threads < b.threads ||
+ (a.threads == b.threads &&
+ a.inplace < b.inplace)))))));
+ }
};
// Compute the complex Fourier transform of n complex values.
@@ -547,18 +802,28 @@ public:
// fft1d Backward(n,1);
// Backward.fft(in);
//
-class fft1d : public fftw {
+class fft1d : public fftw, public Threadtable<keytype1,keyless1> {
unsigned int nx;
+ static Table threadtable;
public:
- fft1d(unsigned int nx, int sign, Complex *in=NULL, Complex *out=NULL)
- : fftw(2*nx,sign), nx(nx) {Setup(in,out);}
+ fft1d(unsigned int nx, int sign, Complex *in=NULL, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*nx,sign,threads), nx(nx) {Setup(in,out);}
#ifdef __Array_h__
fft1d(int sign, const Array::array1<Complex>& in,
- const Array::array1<Complex>& out=Array::NULL1)
- : fftw(2*in.Nx(),sign), nx(in.Nx()) {Setup(in,out);}
+ const Array::array1<Complex>& out=Array::NULL1,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Nx(),sign,threads), nx(in.Nx()) {Setup(in,out);}
#endif
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return this->Lookup(threadtable,keytype1(nx,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ this->Store(threadtable,keytype1(nx,data.threads,inplace),data);
+ }
+
fftw_plan Plan(Complex *in, Complex *out) {
return fftw_plan_dft_1d(nx,(fftw_complex *) in,(fftw_complex *) out,
sign,effort);
@@ -582,29 +847,110 @@ public:
//
// Notes:
// stride is the spacing between the elements of each Complex vector;
-// dist is the spacing between the first elements of the vectors;
+// dist is the spacing between the first elements of the vectors.
//
//
-class mfft1d : public fftw {
+class mfft1d : public fftw, public Threadtable<keytype3,keyless3> {
unsigned int nx;
unsigned int M;
+ unsigned int T,Q,R;
size_t stride;
size_t dist;
+ fftw_plan plan1;
+ fftw_plan plan2;
+ static Table threadtable;
public:
mfft1d(unsigned int nx, int sign, unsigned int M=1, size_t stride=1,
- size_t dist=0, Complex *in=NULL, Complex *out=NULL)
- : fftw(2*((nx-1)*stride+(M-1)*Dist(nx,stride,dist)+1),sign,nx),
- nx(nx), M(M), stride(stride), dist(Dist(nx,stride,dist))
- {Setup(in,out);}
+ size_t dist=0, Complex *in=NULL, Complex *out=NULL,
+ unsigned int Threads=maxthreads)
+ : fftw(2*((nx-1)*stride+(M-1)*Dist(nx,stride,dist)+1),sign,Threads,nx),
+ nx(nx), M(M), stride(stride), dist(Dist(nx,stride,dist)),
+ plan1(NULL), plan2(NULL)
+ {
+ T=1;
+ Q=M;
+ R=0;
+ threaddata S1=Setup(in,out);
+ fftw_plan planT1=plan;
+
+ T=std::min(M,Threads);
+ if(T > 1) {
+ Q=M/T;
+ R=M-Q*T;
+ threads=Threads;
+ threaddata ST=Setup(in,out);
+
+ if(R > 0 && threads == 1 && plan1 != plan2) {
+ fftw_destroy_plan(plan2);
+ plan2=plan1;
+ }
+
+ if(ST.mean > S1.mean-S1.stdev) {
+ fftw_destroy_plan(plan);
+ if(R > 0) {
+ fftw_destroy_plan(plan2);
+ plan2=NULL;
+ }
+ T=1;
+ Q=M;
+ R=0;
+ plan=planT1;
+ threads=S1.threads;
+ } else {
+ fftw_destroy_plan(planT1);
+ threads=ST.threads;
+ }
+ }
+ }
+
+ unsigned int Threads() {return std::max(T,threads);}
+
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return Lookup(threadtable,keytype3(nx,Q,R,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ Store(threadtable,keytype3(nx,Q,R,data.threads,inplace),data);
+ }
fftw_plan Plan(Complex *in, Complex *out) {
int n=(int) nx;
- return fftw_plan_many_dft(1,&n,M,
+ if(R > 0) {
+ plan2=fftw_plan_many_dft(1,&n,Q+1,
+ (fftw_complex *) in,NULL,stride,dist,
+ (fftw_complex *) out,NULL,stride,dist,
+ sign,effort);
+ if(!plan2) noplan();
+ if(threads == 1) plan1=plan2;
+ }
+ return fftw_plan_many_dft(1,&n,Q,
(fftw_complex *) in,NULL,stride,dist,
(fftw_complex *) out,NULL,stride,dist,
sign,effort);
}
+ ~mfft1d() {
+ if(plan2) fftw_destroy_plan(plan2);
+ }
+
+ void Execute(Complex *in, Complex *out, bool=false) {
+ if(T == 1) {
+ fftw_execute_dft(plan,(fftw_complex *) in,(fftw_complex *) out);
+ } else {
+ unsigned int Tdist=T*dist;
+ unsigned int extra=(T-R)*dist;
+
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(T)
+#endif
+ for(unsigned int i=0; i < Tdist; i += dist) {
+ bool normal=i < extra;
+ unsigned int offset=normal ? Q*i : Q*i+i-extra;
+ fftw_execute_dft(normal ? plan : plan2,(fftw_complex *) in+offset,
+ (fftw_complex *) out+offset);
+ }
+ }
+ }
+
void fftNormalized(Complex *in, Complex *out=NULL) {
fftw::fftNormalized(in,out,nx,M,stride,dist);
}
@@ -629,24 +975,35 @@ public:
// in contains the n real values stored as a Complex array;
// out contains the first n/2+1 Complex Fourier values.
//
-class rcfft1d : public fftw {
+class rcfft1d : public fftw, public Threadtable<keytype1,keyless1> {
unsigned int nx;
+ static Table threadtable;
public:
- rcfft1d(unsigned int nx, Complex *out=NULL)
- : fftw(2*(nx/2+1),-1,nx), nx(nx) {Setup(out);}
+ rcfft1d(unsigned int nx, Complex *out=NULL, unsigned int threads=maxthreads)
+ : fftw(2*(nx/2+1),-1,threads,nx), nx(nx) {Setup(out,(double*) NULL);}
- rcfft1d(unsigned int nx, double *in, Complex *out=NULL)
- : fftw(realsize(nx,in,out),-1,nx), nx(nx) {Setup(in,out);}
+ rcfft1d(unsigned int nx, double *in, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(realsize(nx,in,out),-1,threads,nx), nx(nx) {Setup(in,out);}
#ifdef __Array_h__
- rcfft1d(unsigned int nx, const Array::array1<Complex>& out)
- : fftw(out.Size(),-1,nx), nx(nx) {Setup(out);}
+ rcfft1d(unsigned int nx, const Array::array1<Complex>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),-1,threads,nx), nx(nx) {Setup(out,(double*) NULL);}
rcfft1d(unsigned int nx, const Array::array1<double>& in,
- const Array::array1<Complex>& out=Array::NULL1)
- : fftw(realsize(nx,in(),out()),-1,nx), nx(nx) {Setup(in,out);}
+ const Array::array1<Complex>& out=Array::NULL1,
+ unsigned int threads=maxthreads)
+ : fftw(realsize(nx,in(),out()),-1,threads,nx), nx(nx) {Setup(in,out);}
#endif
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return Lookup(threadtable,keytype1(nx,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ Store(threadtable,keytype1(nx,data.threads,inplace),data);
+ }
+
fftw_plan Plan(Complex *in, Complex *out) {
return fftw_plan_dft_r2c_1d(nx,(double *) in,(fftw_complex *) out, effort);
}
@@ -677,27 +1034,38 @@ public:
// in contains the first n/2+1 Complex Fourier values.
// out contains the n real values stored as a Complex array;
//
-class crfft1d : public fftw {
+class crfft1d : public fftw, public Threadtable<keytype1,keyless1> {
unsigned int nx;
+ static Table threadtable;
public:
- crfft1d(unsigned int nx, double *out=NULL)
- : fftw(2*(nx/2+1),1,nx), nx(nx) {Setup(out);}
+ crfft1d(unsigned int nx, double *out=NULL, unsigned int threads=maxthreads)
+ : fftw(2*(nx/2+1),1,threads,nx), nx(nx) {Setup(out);}
- crfft1d(unsigned int nx, Complex *in, double *out=NULL)
- : fftw(realsize(nx,in,out),1,nx), nx(nx) {Setup(in,out);}
+ crfft1d(unsigned int nx, Complex *in, double *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(realsize(nx,in,out),1,threads,nx), nx(nx) {Setup(in,out);}
#ifdef __Array_h__
- crfft1d(unsigned int nx, const Array::array1<double>& out)
- : fftw(out.Size(),1,nx), nx(nx) {Setup(out);}
+ crfft1d(unsigned int nx, const Array::array1<double>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),1,threads,nx), nx(nx) {Setup(out);}
- crfft1d(unsigned int nx, const Array::array1<Complex>& in)
- : fftw(2*in.Size(),1,nx), nx(nx) {Setup(in);}
+ crfft1d(unsigned int nx, const Array::array1<Complex>& in,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Size(),1,threads,nx), nx(nx) {Setup(in);}
crfft1d(unsigned int nx, const Array::array1<Complex>& in,
const Array::array1<double>& out)
- : fftw(out.Size(),1,nx), nx(nx) {Setup(in,out);}
+ : fftw(out.Size(),1,threads,nx), nx(nx) {Setup(in,out);}
#endif
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return Lookup(threadtable,keytype1(nx,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ Store(threadtable,keytype1(nx,data.threads,inplace),data);
+ }
+
fftw_plan Plan(Complex *in, Complex *out) {
return fftw_plan_dft_c2r_1d(nx,(fftw_complex *) in,(double *) out,effort);
}
@@ -729,27 +1097,42 @@ public:
// in contains the n real values stored as a Complex array;
// out contains the first n/2+1 Complex Fourier values.
//
-class mrcfft1d : public fftw {
+class mrcfft1d : public fftw, public Threadtable<keytype2,keyless2> {
unsigned int nx;
unsigned int M;
size_t stride;
size_t dist;
+ static Table threadtable;
public:
mrcfft1d(unsigned int nx, unsigned int M=1, size_t stride=1,
- size_t dist=0, Complex *out=NULL)
- : fftw(2*(nx/2*stride+(M-1)*Dist(nx,stride,dist)+1),-1,nx), nx(nx), M(M),
- stride(stride), dist(Dist(nx,stride,dist)) {Setup(out);}
+ size_t dist=0, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*(nx/2*stride+(M-1)*Dist(nx,stride,dist)+1),-1,threads,nx), nx(nx),
+ M(M), stride(stride), dist(Dist(nx,stride,dist)) {Setup(out);}
mrcfft1d(unsigned int nx, unsigned int M=1, size_t stride=1,
- size_t dist=0, double *in=NULL, Complex *out=NULL)
- : fftw(2*(nx/2*stride+(M-1)*Dist(nx,stride,dist)+1),-1,nx), nx(nx), M(M),
- stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);}
+ size_t dist=0, double *in=NULL, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*(nx/2*stride+(M-1)*Dist(nx,stride,dist)+1),-1,threads,nx), nx(nx),
+ M(M), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);}
+
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return Lookup(threadtable,keytype2(nx,M,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ Store(threadtable,keytype2(nx,M,data.threads,inplace),data);
+ }
fftw_plan Plan(Complex *in, Complex *out) {
int n=(int) nx;
+ if(in != out)
+ return fftw_plan_many_dft_r2c(1,&n,M,
+ (double *) in,NULL,stride,dist,
+ (fftw_complex *) out,NULL,stride,dist/2+1,
+ effort);
return fftw_plan_many_dft_r2c(1,&n,M,
- (double *) in,NULL,stride,2*dist,
- (fftw_complex *) out,NULL,stride,dist,
+ (double *) in,NULL,stride,dist,
+ (fftw_complex *) out,NULL,stride,dist/2,
effort);
}
@@ -782,22 +1165,37 @@ public:
// Notes:
// stride is the spacing between the elements of each Complex vector;
// dist is the spacing between the first elements of the vectors;
-// in contains the first n/2+1 Complex Fourier values.
-// out contains the n real values stored as a Complex array;
+// in contains the first n/2+1 Complex Fourier values;
+// out contains the n real values stored as a Complex array.
//
-class mcrfft1d : public fftw {
+class mcrfft1d : public fftw, public Threadtable<keytype2,keyless2> {
unsigned int nx;
unsigned int M;
size_t stride;
size_t dist;
+ static Table threadtable;
public:
mcrfft1d(unsigned int nx, unsigned int M=1, size_t stride=1,
- size_t dist=0, Complex *in=NULL, double *out=NULL)
- : fftw((realsize(nx,in,out)-2)*stride+2*(M-1)*Dist(nx,stride,dist)+2,1,nx),
+ size_t dist=0, Complex *in=NULL, double *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw((realsize(nx,in,out)-2)*stride+2*(M-1)*Dist(nx,stride,dist)+2,1,
+ threads,nx),
nx(nx), M(M), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);}
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return Lookup(threadtable,keytype2(nx,M,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ Store(threadtable,keytype2(nx,M,data.threads,inplace),data);
+ }
+
fftw_plan Plan(Complex *in, Complex *out) {
int n=(int) nx;
+ if(in != out)
+ return fftw_plan_many_dft_c2r(1,&n,M,
+ (fftw_complex *) in,NULL,stride,dist,
+ (double *) out,NULL,stride,2*(dist-1),
+ effort);
return fftw_plan_many_dft_c2r(1,&n,M,
(fftw_complex *) in,NULL,stride,dist,
(double *) out,NULL,stride,2*dist,
@@ -808,8 +1206,23 @@ public:
fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out);
}
- void fftNormalized(Complex *in, Complex *out=NULL) {
- fftw::fftNormalized(in,out,(nx/2+1),M,stride,dist);
+ void fftNormalized(Complex *in, double *out=NULL) {
+ // TODO: improve threading (cf: mfft1d).
+ fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out);
+
+ unsigned int stop=nx*stride;
+ unsigned int odist=in == (Complex *) out ? 2*dist : 2*(dist-1);
+ double *outMdist=out+M*odist;
+
+#ifndef FFTWPP_SINGLE_THREAD
+#pragma omp parallel for num_threads(threads)
+#endif
+ for(unsigned int i=0; i < stop; i += stride) {
+ double *pstop=outMdist+i;
+ for(double *p=out+i; p < pstop; p += odist) {
+ *p *= norm;
+ }
+ }
}
};
@@ -839,20 +1252,29 @@ public:
// Note:
// in[ny*i+j] contains the ny Complex values for each i=0,...,nx-1.
//
-class fft2d : public fftw {
+class fft2d : public fftw, public Threadtable<keytype2,keyless2> {
unsigned int nx;
unsigned int ny;
+ static Table threadtable;
public:
fft2d(unsigned int nx, unsigned int ny, int sign, Complex *in=NULL,
- Complex *out=NULL)
- : fftw(2*nx*ny,sign), nx(nx), ny(ny) {Setup(in,out);}
+ Complex *out=NULL, unsigned int threads=maxthreads)
+ : fftw(2*nx*ny,sign,threads), nx(nx), ny(ny) {Setup(in,out);}
#ifdef __Array_h__
fft2d(int sign, const Array::array2<Complex>& in,
- const Array::array2<Complex>& out=Array::NULL2)
- : fftw(2*in.Size(),sign), nx(in.Nx()), ny(in.Ny()) {Setup(in,out);}
+ const Array::array2<Complex>& out=Array::NULL2,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Size(),sign,threads), nx(in.Nx()), ny(in.Ny()) {Setup(in,out);}
#endif
+ threaddata lookup(bool inplace, unsigned int threads) {
+ return this->Lookup(threadtable,keytype2(nx,ny,threads,inplace));
+ }
+ void store(bool inplace, const threaddata& data) {
+ this->Store(threadtable,keytype2(nx,ny,data.threads,inplace),data);
+ }
+
fftw_plan Plan(Complex *in, Complex *out) {
return fftw_plan_dft_2d(nx,ny,(fftw_complex *) in,(fftw_complex *) out,
sign,effort);
@@ -873,6 +1295,8 @@ public:
//
// rcfft2d Forward(nx,ny,in,out);
// Forward.fft(in,out); // Origin of Fourier domain at (0,0)
+// Forward.fft0(in,out); // Origin of Fourier domain at (nx/2,0);
+// input destroyed.
//
// In-place usage:
//
@@ -888,20 +1312,28 @@ class rcfft2d : public fftw {
unsigned int nx;
unsigned int ny;
public:
- rcfft2d(unsigned int nx, unsigned int ny, Complex *out=NULL)
- : fftw(2*nx*(ny/2+1),-1,nx*ny), nx(nx), ny(ny) {Setup(out);}
+ rcfft2d(unsigned int nx, unsigned int ny, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*nx*(ny/2+1),-1,threads,nx*ny), nx(nx), ny(ny) {Setup(out);}
- rcfft2d(unsigned int nx, unsigned int ny, double *in, Complex *out=NULL)
- : fftw(nx*realsize(ny,in,out),-1,nx*ny), nx(nx), ny(ny) {Setup(in,out);}
+ rcfft2d(unsigned int nx, unsigned int ny, double *in, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(nx*realsize(ny,in,out),-1,threads,nx*ny), nx(nx), ny(ny) {
+ Setup(in,out);
+ }
#ifdef __Array_h__
- rcfft2d(unsigned int ny, const Array::array2<Complex>& out)
- : fftw(out.Size(),-1,out.Nx()*ny), nx(out.Nx()), ny(ny) {Setup(out);}
+ rcfft2d(unsigned int ny, const Array::array2<Complex>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),-1,threads,out.Nx()*ny), nx(out.Nx()), ny(ny) {
+ Setup(out);
+ }
rcfft2d(unsigned int ny, const Array::array2<double>& in,
- const Array::array2<Complex>& out=Array::NULL2)
- : fftw(in.Nx()*realsize(ny,in(),out()),-1,in.Nx()*ny), nx(in.Nx()), ny(ny)
- {Setup(in,out);}
+ const Array::array2<Complex>& out=Array::NULL2,
+ unsigned int threads=maxthreads)
+ : fftw(in.Nx()*realsize(ny,in(),out()),-1,threads,in.Nx()*ny),
+ nx(in.Nx()), ny(ny) {Setup(in,out);}
#endif
fftw_plan Plan(Complex *in, Complex *out) {
@@ -910,7 +1342,10 @@ public:
}
void Execute(Complex *in, Complex *out, bool shift=false) {
- if(shift && inplace) Shift(in,nx,ny);
+ if(shift) {
+ if(inplace) Shift(in,nx,ny,threads);
+ else Shift((double *) in,nx,ny,threads);
+ }
fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out);
}
};
@@ -919,7 +1354,7 @@ public:
// nx*(ny/2+1) Complex values corresponding to the spectral values in the
// half-plane ky >= 0, using phase sign +1.
// Before calling fft(), the array in must be allocated as
-// Complex[nx*(ny+1)/2] and the array out must be allocated as
+// Complex[nx*(ny/2+1)] and the array out must be allocated as
// double[nx*ny]. The arrays in and out may coincide,
// allocated as Complex[nx*(ny/2+1)].
//
@@ -943,22 +1378,29 @@ class crfft2d : public fftw {
unsigned int nx;
unsigned int ny;
public:
- crfft2d(unsigned int nx, unsigned int ny, Complex *in=NULL) :
- fftw(2*nx*(ny/2+1),1,nx*ny), nx(nx), ny(ny) {Setup(in);}
+ crfft2d(unsigned int nx, unsigned int ny, Complex *in=NULL,
+ unsigned int threads=maxthreads) :
+ fftw(2*nx*(ny/2+1),1,threads,nx*ny), nx(nx), ny(ny) {Setup(in);}
- crfft2d(unsigned int nx, unsigned int ny, Complex *in, double *out) :
- fftw(nx*realsize(ny,in,out),1,nx*ny), nx(nx), ny(ny) {Setup(in,out);}
+ crfft2d(unsigned int nx, unsigned int ny, Complex *in, double *out,
+ unsigned int threads=maxthreads)
+ : fftw(nx*realsize(ny,in,out),1,threads,nx*ny), nx(nx), ny(ny) {
+ Setup(in,out);
+ }
#ifdef __Array_h__
- crfft2d(unsigned int ny, const Array::array2<double>& out)
- : fftw(out.Size(),1,out.Nx()*ny), nx(out.Nx()), ny(ny) {Setup(out);}
-
- crfft2d(unsigned int ny, const Array::array2<Complex>& in)
- : fftw(2*in.Size(),1,in.Nx()*ny), nx(in.Nx()), ny(ny) {Setup(in);}
+ crfft2d(unsigned int ny, const Array::array2<double>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),1,threads,out.Nx()*ny), nx(out.Nx()), ny(ny) {Setup(out);}
+
+ crfft2d(unsigned int ny, const Array::array2<Complex>& in,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Size(),1,threads,in.Nx()*ny), nx(in.Nx()), ny(ny) {Setup(in);}
crfft2d(unsigned int ny, const Array::array2<Complex>& in,
- const Array::array2<double>& out)
- : fftw(out.Size(),1,in.Nx()*ny), nx(in.Nx()), ny(ny) {Setup(in,out);}
+ const Array::array2<double>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),1,threads,in.Nx()*ny), nx(in.Nx()), ny(ny) {Setup(in,out);}
#endif
fftw_plan Plan(Complex *in, Complex *out) {
@@ -968,7 +1410,10 @@ public:
void Execute(Complex *in, Complex *out, bool shift=false) {
fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out);
- if(shift) Shift(out,nx,ny);
+ if(shift) {
+ if(inplace) Shift(out,nx,ny,threads);
+ else Shift((double *) out,nx,ny,threads);
+ }
}
};
@@ -1005,13 +1450,15 @@ class fft3d : public fftw {
unsigned int nz;
public:
fft3d(unsigned int nx, unsigned int ny, unsigned int nz,
- int sign, Complex *in=NULL, Complex *out=NULL)
- : fftw(2*nx*ny*nz,sign), nx(nx), ny(ny), nz(nz) {Setup(in,out);}
+ int sign, Complex *in=NULL, Complex *out=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*nx*ny*nz,sign,threads), nx(nx), ny(ny), nz(nz) {Setup(in,out);}
#ifdef __Array_h__
fft3d(int sign, const Array::array3<Complex>& in,
- const Array::array3<Complex>& out=Array::NULL3)
- : fftw(2*in.Size(),sign), nx(in.Nx()), ny(in.Ny()), nz(in.Nz())
+ const Array::array3<Complex>& out=Array::NULL3,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Size(),sign,threads), nx(in.Nx()), ny(in.Ny()), nz(in.Nz())
{Setup(in,out);}
#endif
@@ -1031,7 +1478,8 @@ public:
//
// rcfft3d Forward(nx,ny,nz,in,out);
// Forward.fft(in,out); // Origin of Fourier domain at (0,0)
-//
+// Forward.fft0(in,out); // Origin of Fourier domain at (nx/2,ny/2,0);
+// input destroyed
// In-place usage:
//
// rcfft3d Forward(nx,ny,nz);
@@ -1048,20 +1496,23 @@ class rcfft3d : public fftw {
unsigned int nz;
public:
rcfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *out=NULL)
- : fftw(2*nx*ny*(nz/2+1),-1,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(out);}
+ : fftw(2*nx*ny*(nz/2+1),-1,threads,nx*ny*nz), nx(nx), ny(ny), nz(nz) {Setup(out);}
rcfft3d(unsigned int nx, unsigned int ny, unsigned int nz, double *in,
- Complex *out=NULL) : fftw(nx*ny*realsize(nz,in,out),-1,nx*ny*nz),
- nx(nx), ny(ny), nz(nz) {Setup(in,out);}
+ Complex *out=NULL, unsigned int threads=maxthreads)
+ : fftw(nx*ny*realsize(nz,in,out),-1,threads,nx*ny*nz),
+ nx(nx), ny(ny), nz(nz) {Setup(in,out);}
#ifdef __Array_h__
- rcfft3d(unsigned int nz, const Array::array3<Complex>& out)
- : fftw(out.Size(),-1,out.Nx()*out.Ny()*nz),
+ rcfft3d(unsigned int nz, const Array::array3<Complex>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),-1,threads,out.Nx()*out.Ny()*nz),
nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);}
rcfft3d(unsigned int nz, const Array::array3<double>& in,
- const Array::array3<Complex>& out=Array::NULL3)
- : fftw(in.Nx()*in.Ny()*realsize(nz,in(),out()),-1,in.Size()),
+ const Array::array3<Complex>& out=Array::NULL3,
+ unsigned int threads=maxthreads)
+ : fftw(in.Nx()*in.Ny()*realsize(nz,in(),out()),-1,threads,in.Size()),
nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in,out);}
#endif
@@ -1071,7 +1522,10 @@ public:
}
void Execute(Complex *in, Complex *out, bool shift=false) {
- if(shift && inplace) Shift(in,nx,ny,nz);
+ if(shift) {
+ if(inplace) Shift(in,nx,ny,nz,threads);
+ else Shift((double *) in,nx,ny,nz,threads);
+ }
fftw_execute_dft_r2c(plan,(double *) in,(fftw_complex *) out);
}
};
@@ -1105,27 +1559,31 @@ class crfft3d : public fftw {
unsigned int ny;
unsigned int nz;
public:
- crfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *in=NULL)
- : fftw(2*nx*ny*(nz/2+1),1,nx*ny*nz), nx(nx), ny(ny), nz(nz)
+ crfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *in=NULL,
+ unsigned int threads=maxthreads)
+ : fftw(2*nx*ny*(nz/2+1),1,threads,nx*ny*nz), nx(nx), ny(ny), nz(nz)
{Setup(in);}
crfft3d(unsigned int nx, unsigned int ny, unsigned int nz, Complex *in,
- double *out=NULL) :
- fftw(nx*ny*(realsize(nz,in,out)),1,nx*ny*nz), nx(nx), ny(ny), nz(nz)
- {Setup(in,out);}
+ double *out=NULL, unsigned int threads=maxthreads)
+ : fftw(nx*ny*(realsize(nz,in,out)),1,threads,nx*ny*nz), nx(nx), ny(ny),
+ nz(nz) {Setup(in,out);}
#ifdef __Array_h__
- crfft3d(unsigned int nz, const Array::array3<double>& out)
- : fftw(out.Size(),1,out.Nx()*out.Ny()*nz),
+ crfft3d(unsigned int nz, const Array::array3<double>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),1,threads,out.Nx()*out.Ny()*nz),
nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);}
- crfft3d(unsigned int nz, const Array::array3<Complex>& in)
- : fftw(2*in.Size(),1,in.Nx()*in.Ny()*nz),
+ crfft3d(unsigned int nz, const Array::array3<Complex>& in,
+ unsigned int threads=maxthreads)
+ : fftw(2*in.Size(),1,threads,in.Nx()*in.Ny()*nz),
nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in);}
crfft3d(unsigned int nz, const Array::array3<Complex>& in,
- const Array::array3<double>& out)
- : fftw(out.Size(),1,in.Nx()*in.Ny()*nz),
+ const Array::array3<double>& out,
+ unsigned int threads=maxthreads)
+ : fftw(out.Size(),1,threads,in.Nx()*in.Ny()*nz),
nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in,out);}
#endif
@@ -1136,7 +1594,10 @@ public:
void Execute(Complex *in, Complex *out, bool shift=false) {
fftw_execute_dft_c2r(plan,(fftw_complex *) in,(double *) out);
- if(shift) Shift(out,nx,ny,nz);
+ if(shift) {
+ if(inplace) Shift(out,nx,ny,nz,threads);
+ else Shift((double *) out,nx,ny,nz,threads);
+ }
}
};
diff --git a/Build/source/utils/asymptote/guide.cc b/Build/source/utils/asymptote/guide.cc
index b46c269290d..6479a00ba56 100644
--- a/Build/source/utils/asymptote/guide.cc
+++ b/Build/source/utils/asymptote/guide.cc
@@ -8,28 +8,44 @@
namespace camp {
+multiguide::multiguide(guidevector& v)
+{
+ // This constructor tests if the first subguide is also a multiguide and,
+ // if possible, uses the same base, extending it beyond what is used.
+ multiguide *rg = v.empty() ? 0 : dynamic_cast<multiguide *>(v[0]);
+ if (rg && rg->base->size() == rg->length) {
+ base = rg->base;
+ base->insert(base->end(), v.begin()+1, v.end());
+ }
+ else
+ base = new guidevector(v);
+
+ length = base->size();
+}
+
void multiguide::flatten(flatguide& g, bool allowsolve)
{
- size_t n=v.size();
+ size_t n=length;
if(n > 0) {
for(size_t i=0; i+1 < n; ++i) {
- v[i]->flatten(g,allowsolve);
- if(!allowsolve && v[i]->cyclic()) {
+ subguide(i)->flatten(g,allowsolve);
+ if(!allowsolve && subguide(i)->cyclic()) {
g.precyclic(true);
g.resolvecycle();
}
}
- v[n-1]->flatten(g,allowsolve);
+ subguide(n-1)->flatten(g,allowsolve);
}
}
void multiguide::print(ostream& out) const
{
side lastLoc=JOIN;
- for(size_t i=0; i < v.size(); ++i) {
- side loc=v[i]->printLocation();
+ for(size_t i=0; i < length; ++i) {
+ guide *g = subguide(i);
+ side loc = g->printLocation();
adjustLocation(out,lastLoc,loc);
- v[i]->print(out);
+ g->print(out);
lastLoc=loc;
}
}
diff --git a/Build/source/utils/asymptote/guide.h b/Build/source/utils/asymptote/guide.h
index 103e05afa41..a25e7ffa9e7 100644
--- a/Build/source/utils/asymptote/guide.h
+++ b/Build/source/utils/asymptote/guide.h
@@ -224,22 +224,33 @@ public:
// tensions in between.
typedef mem::vector<guide *> guidevector;
+// A multiguide represents a guide given by the first "length" items of
+// the vector pointed to by "base".
+// The constructor, if given another multiguide as a first argument,
+// will try to avoid allocating a new "base" array.
class multiguide : public guide {
- guidevector v;
+ guidevector *base;
+ size_t length;
+
+ guide *subguide(size_t i) const
+ {
+ assert(i < length);
+ assert(length <= base->size());
+ return (*base)[i];
+ }
public:
+ multiguide(guidevector& v);
+
void flatten(flatguide&, bool=true);
bool cyclic() {
- size_t n=v.size();
+ size_t n=length;
if(n < 1) return false;
- return v[n-1]->cyclic();
+ return subguide(n-1)->cyclic();
}
- multiguide(guidevector& v)
- : v(v) {}
-
path solve() {
if (settings::verbose>3) {
cerr << "solving guide:\n";
@@ -259,7 +270,8 @@ public:
void print(ostream& out) const;
side printLocation() const {
- return v.back()->printLocation();
+ int n = length;
+ return subguide(n-1)->printLocation();
}
};
diff --git a/Build/source/utils/asymptote/guideflags.h b/Build/source/utils/asymptote/guideflags.h
index 37131422d29..dae2b7cc47a 100644
--- a/Build/source/utils/asymptote/guideflags.h
+++ b/Build/source/utils/asymptote/guideflags.h
@@ -10,6 +10,9 @@
namespace camp {
+#undef OUT
+#undef IN
+
enum side { OUT, IN, END, JOIN };
}
diff --git a/Build/source/utils/asymptote/install-sh b/Build/source/utils/asymptote/install-sh
index 04367377519..6781b987bdb 100755
--- a/Build/source/utils/asymptote/install-sh
+++ b/Build/source/utils/asymptote/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2013-10-30.23; # UTC
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,21 +35,25 @@ scriptversion=2013-10-30.23; # UTC
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
-# 'make' implicit rules from creating a file called install from it
+# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
-tab=' '
nl='
'
-IFS=" $tab$nl"
+IFS=" "" $nl"
-# Set DOITPROG to "echo" to test this script.
+# set DOITPROG to echo to test this script
+# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
-doit_exec=${doit:-exec}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
@@ -64,6 +68,17 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
posix_mkdir=
# Desired mode of installed file.
@@ -122,39 +137,36 @@ while test $# -ne 0; do
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
- case $mode in
- *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
-o) chowncmd="$chownprog $2"
- shift;;
+ shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
- shift;;
+ shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
- --) shift
- break;;
+ --) shift
+ break;;
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
*) break;;
esac
@@ -174,10 +186,6 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi
shift # arg
dst_arg=$arg
- # Protect names problematic for 'test' and other utilities.
- case $dst_arg in
- -* | [=\(\)!]) dst_arg=./$dst_arg;;
- esac
done
fi
@@ -186,17 +194,13 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2
exit 1
fi
- # It's OK to call 'install-sh -d' without argument.
+ # It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
- do_exit='(exit $ret); exit $ret'
- trap "ret=129; $do_exit" 1
- trap "ret=130; $do_exit" 2
- trap "ret=141; $do_exit" 13
- trap "ret=143; $do_exit" 15
+ trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
@@ -207,16 +211,16 @@ if test -z "$dir_arg"; then
*[0-7])
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw='% 200'
+ u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
- u_plus_rw=
+ u_plus_rw=
else
- u_plus_rw=,u+rw
+ u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
@@ -224,9 +228,9 @@ fi
for src
do
- # Protect names problematic for 'test' and other utilities.
+ # Protect names starting with `-'.
case $src in
- -* | [=\(\)!]) src=./$src;;
+ -*) src=./$src;;
esac
if test -n "$dir_arg"; then
@@ -248,20 +252,51 @@ do
echo "$0: no destination specified." >&2
exit 1
fi
+
dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
- dstdir=`dirname "$dst"`
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
test -d "$dstdir"
dstdir_status=$?
fi
@@ -272,74 +307,74 @@ do
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
esac
if
$posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
@@ -349,51 +384,53 @@ do
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
esac
+ eval "$initialize_posix_glob"
+
oIFS=$IFS
IFS=/
- set -f
+ $posix_glob set -f
set fnord $dstdir
shift
- set +f
+ $posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
- test X"$d" = X && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
done
if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
fi
fi
fi
@@ -428,12 +465,15 @@ do
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
- set -f &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
- set +f &&
+ $posix_glob set +f &&
+
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
@@ -446,24 +486,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
diff --git a/Build/source/utils/asymptote/interact.cc b/Build/source/utils/asymptote/interact.cc
index 51373077fcf..044b46fc6e8 100644
--- a/Build/source/utils/asymptote/interact.cc
+++ b/Build/source/utils/asymptote/interact.cc
@@ -85,20 +85,10 @@ FILE *fin=NULL;
char *readpipeline(const char *prompt)
{
- const int max_size=256;
- static char buf[max_size];
- ostringstream s;
- do {
- if(fgets(buf,max_size-1,fin) == NULL) break;
- s << buf;
- } while(buf[strlen(buf)-1] != '\n');
- return StrdupMalloc(s.str());
- /* Simpler version (requires POSIX 2008; temporarily removed for TeXLive 2013):
char *line=NULL;
size_t n;
- n=getline(&line,&n,fin);
+ getline(&line,&n,fin);
return line;
- */
}
void pre_readline()
diff --git a/Build/source/utils/asymptote/memory.h b/Build/source/utils/asymptote/memory.h
index ccf0436c500..9bbbfd17530 100644
--- a/Build/source/utils/asymptote/memory.h
+++ b/Build/source/utils/asymptote/memory.h
@@ -171,7 +171,13 @@ typedef std::basic_ostringstream<char,std::char_traits<char>,
gc_allocator<char> > ostringstream;
typedef std::basic_stringbuf<char,std::char_traits<char>,
gc_allocator<char> > stringbuf;
+#if GC_TMP_VERSION_MAJOR >= 7 && GC_TMP_VERSION_MINOR > 1
+inline void compact(int x) {GC_set_dont_expand(x);}
#else
+inline void compact(int x) {GC_dont_expand=x;}
+#endif
+#else
+inline void compact(int x) {}
typedef std::string string;
typedef std::stringstream stringstream;
typedef std::istringstream istringstream;
diff --git a/Build/source/utils/asymptote/pair.h b/Build/source/utils/asymptote/pair.h
index dc8f86d03b5..51d93503efa 100644
--- a/Build/source/utils/asymptote/pair.h
+++ b/Build/source/utils/asymptote/pair.h
@@ -100,7 +100,7 @@ public:
friend pair operator/ (const pair& z, const pair& w)
{
if (!w.nonZero())
- reportError("divison by pair (0,0)");
+ reportError("division by pair (0,0)");
double t = 1.0 / (w.x*w.x + w.y*w.y);
return pair(t*(z.x*w.x + z.y*w.y),
diff --git a/Build/source/utils/asymptote/patches/cygwin_glu.patch b/Build/source/utils/asymptote/patches/cygwin_glu.patch
index 0125a4bca60..04090e8a45c 100644
--- a/Build/source/utils/asymptote/patches/cygwin_glu.patch
+++ b/Build/source/utils/asymptote/patches/cygwin_glu.patch
@@ -1,29 +1,41 @@
---- w32api.orig/GL/glu.h 2008-09-26 08:26:56.000000000 -0600
-+++ w32api/GL/glu.h 2008-09-27 23:39:33.000000000 -0600
-@@ -43,6 +44,10 @@
+--- w32api.orig/GL/glu.h 2014-04-18 22:30:50.186158900 -0600
++++ w32api/GL/glu.h 2014-04-18 22:42:59.095926900 -0600
+@@ -108,8 +108,12 @@
+ typedef void (CALLBACK *GLUtessCombineDataProc)(GLdouble[3],void*[4],GLfloat[4],void**,void*);
+ typedef void (CALLBACK *GLUnurbsErrorProc)(GLenum);
- /*************************************************************/
-
-+/* Extensionsx */
+#define GLU_EXT_object_space_tess 1
+#define GLU_EXT_nurbs_tessellator 1
+
- /* Boolean */
- #define GLU_FALSE 0
- #define GLU_TRUE 1
-@@ -50,6 +55,7 @@
- /* Version */
- #define GLU_VERSION_1_1 1
- #define GLU_VERSION_1_2 1
+ #define GLU_VERSION_1_1 1
+ #define GLU_VERSION_1_2 1
+#define GLU_VERSION_1_3 1
- /* StringName */
- #define GLU_VERSION 100800
-@@ -66,6 +72,34 @@
- #define GLU_OUTLINE_POLYGON 100240
- #define GLU_OUTLINE_PATCH 100241
+ #define GLU_INVALID_ENUM 100900
+ #define GLU_INVALID_VALUE 100901
+@@ -183,7 +187,17 @@
+ #define GLU_SAMPLING_METHOD 100205
+ #define GLU_U_STEP 100206
+ #define GLU_V_STEP 100207
+-
++#define GLU_NURBS_MODE 100160
++#define GLU_NURBS_MODE_EXT 100160
++#define GLU_NURBS_TESSELLATOR 100161
++#define GLU_NURBS_TESSELLATOR_EXT 100161
++#define GLU_NURBS_RENDERER 100162
++#define GLU_NURBS_RENDERER_EXT 100162
++
++#define GLU_OBJECT_PARAMETRIC_ERROR 100208
++#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
++#define GLU_OBJECT_PATH_LENGTH 100209
++#define GLU_OBJECT_PATH_LENGTH_EXT 100209
+ #define GLU_PATH_LENGTH 100215
+ #define GLU_PARAMETRIC_ERROR 100216
+ #define GLU_DOMAIN_DISTANCE 100217
+@@ -194,6 +208,33 @@
+ #define GLU_OUTLINE_POLYGON 100240
+ #define GLU_OUTLINE_PATCH 100241
-+/* NurbsCallback */
+#define GLU_NURBS_ERROR 100103
+#define GLU_ERROR 100103
+#define GLU_NURBS_BEGIN 100164
@@ -51,37 +63,20 @@
+#define GLU_NURBS_END_DATA 100175
+#define GLU_NURBS_END_DATA_EXT 100175
+
- /* NurbsError */
- #define GLU_NURBS_ERROR1 100251
- #define GLU_NURBS_ERROR2 100252
-@@ -114,8 +148,18 @@
- #define GLU_SAMPLING_METHOD 100205
- #define GLU_U_STEP 100206
- #define GLU_V_STEP 100207
-+#define GLU_NURBS_MODE 100160
-+#define GLU_NURBS_MODE_EXT 100160
-+#define GLU_NURBS_TESSELLATOR 100161
-+#define GLU_NURBS_TESSELLATOR_EXT 100161
-+#define GLU_NURBS_RENDERER 100162
-+#define GLU_NURBS_RENDERER_EXT 100162
+ #define GLU_NURBS_ERROR1 100251
+ #define GLU_NURBS_ERROR2 100252
+ #define GLU_NURBS_ERROR3 100253
+@@ -248,6 +289,13 @@
+ #define GLU_ERROR GLU_TESS_ERROR
+ #define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG
- /* NurbsSampling */
-+#define GLU_OBJECT_PARAMETRIC_ERROR 100208
-+#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
-+#define GLU_OBJECT_PATH_LENGTH 100209
-+#define GLU_OBJECT_PATH_LENGTH_EXT 100209
- #define GLU_PATH_LENGTH 100215
- #define GLU_PARAMETRIC_ERROR 100216
- #define GLU_DOMAIN_DISTANCE 100217
-@@ -220,7 +260,11 @@
- #define GLU_TESS_MAX_COORD 1.0e150
-
- /* Internal convenience typedefs */
++/* Internal convenience typedefs */
+#ifdef __cplusplus
- typedef void (APIENTRY *_GLUfuncptr)();
++typedef void (APIENTRY *_GLUfuncptr)();
+#else
+typedef void (APIENTRY *_GLUfuncptr)(GLvoid);
+#endif
-
- GLAPI void APIENTRY gluBeginCurve (GLUnurbs* nurb);
- GLAPI void APIENTRY gluBeginPolygon (GLUtesselator* tess);
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc
index 8be37dc013d..d855e1f00e6 100644
--- a/Build/source/utils/asymptote/picture.cc
+++ b/Build/source/utils/asymptote/picture.cc
@@ -551,6 +551,9 @@ bool picture::texprocess(const string& texname, const string& outname,
cmd.push_back(getSetting<string>("dvisvgm"));
cmd.push_back("-n");
cmd.push_back("--verbosity=3");
+ string libgs=getSetting<string>("libgs");
+ if(!libgs.empty())
+ cmd.push_back("--libgs="+libgs);
push_split(cmd,getSetting<string>("dvisvgmOptions"));
cmd.push_back("-o"+outname);
ostringstream buf;
diff --git a/Build/source/utils/asymptote/prc/PRCbitStream.cc b/Build/source/utils/asymptote/prc/PRCbitStream.cc
index bb013dcefe9..9b18186a469 100644
--- a/Build/source/utils/asymptote/prc/PRCbitStream.cc
+++ b/Build/source/utils/asymptote/prc/PRCbitStream.cc
@@ -1,7 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/PRCbitStream.h b/Build/source/utils/asymptote/prc/PRCbitStream.h
index 67142586e50..5f189e428b1 100644
--- a/Build/source/utils/asymptote/prc/PRCbitStream.h
+++ b/Build/source/utils/asymptote/prc/PRCbitStream.h
@@ -1,7 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/oPRCFile.cc b/Build/source/utils/asymptote/prc/oPRCFile.cc
index 9724d0735f1..99a3efe26e9 100644
--- a/Build/source/utils/asymptote/prc/oPRCFile.cc
+++ b/Build/source/utils/asymptote/prc/oPRCFile.cc
@@ -1,8 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
-* with enhancements contributed by Michail Vidiassov.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/oPRCFile.h b/Build/source/utils/asymptote/prc/oPRCFile.h
index 29b7f20b880..0476bf7ca0a 100644
--- a/Build/source/utils/asymptote/prc/oPRCFile.h
+++ b/Build/source/utils/asymptote/prc/oPRCFile.h
@@ -1,7 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/test.cc b/Build/source/utils/asymptote/prc/test.cc
index 61577a1ff77..6c81baee4a5 100644
--- a/Build/source/utils/asymptote/prc/test.cc
+++ b/Build/source/utils/asymptote/prc/test.cc
@@ -1,7 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/writePRC.cc b/Build/source/utils/asymptote/prc/writePRC.cc
index 5c5b6875b3d..a2877b08996 100644
--- a/Build/source/utils/asymptote/prc/writePRC.cc
+++ b/Build/source/utils/asymptote/prc/writePRC.cc
@@ -1,8 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
-* with enhancements contributed by Michail Vidiassov.
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/prc/writePRC.h b/Build/source/utils/asymptote/prc/writePRC.h
index 3be7569e3af..4795c7550a1 100644
--- a/Build/source/utils/asymptote/prc/writePRC.h
+++ b/Build/source/utils/asymptote/prc/writePRC.h
@@ -1,7 +1,8 @@
/************
*
* This file is part of a tool for producing 3D content in the PRC format.
-* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com>
+* Copyright (C) 2008 Orest Shardt <shardtor (at) gmail dot com> and
+* Michail Vidiassov <master@iaas.msu.ru>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
diff --git a/Build/source/utils/asymptote/runarray.cc b/Build/source/utils/asymptote/runarray.cc
index 354d388cc10..eaf9b41513b 100644
--- a/Build/source/utils/asymptote/runarray.cc
+++ b/Build/source/utils/asymptote/runarray.cc
@@ -1925,21 +1925,23 @@ void gen_runarray63(stack *Stack)
#line 1599 "runarray.in"
real integral;
if(dxmax <= 0) dxmax=fabs(b-a);
+ callable *oldFunc=Func;
Func=f;
FuncStack=Stack;
if(!simpson(integral,wrapFunction,a,b,acc,dxmax))
error("nesting capacity exceeded in simpson");
+ Func=oldFunc;
{Stack->push<real>(integral); return;}
}
// Compute the fast Fourier transform of a pair array
-#line 1610 "runarray.in"
+#line 1612 "runarray.in"
// pairarray* fft(pairarray *a, Int sign=1);
void gen_runarray64(stack *Stack)
{
Int sign=vm::pop<Int>(Stack,1);
pairarray * a=vm::pop<pairarray *>(Stack);
-#line 1611 "runarray.in"
+#line 1613 "runarray.in"
unsigned n=(unsigned) checkArray(a);
#ifdef HAVE_LIBFFTW3
array *c=new array(n);
@@ -1968,12 +1970,12 @@ void gen_runarray64(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 1640 "runarray.in"
+#line 1642 "runarray.in"
// Intarray2* triangulate(pairarray *z);
void gen_runarray65(stack *Stack)
{
pairarray * z=vm::pop<pairarray *>(Stack);
-#line 1641 "runarray.in"
+#line 1643 "runarray.in"
size_t nv=checkArray(z);
// Call robust version of Gilles Dumoulin's port of Paul Bourke's
// triangulation code.
@@ -2007,12 +2009,12 @@ void gen_runarray65(stack *Stack)
{Stack->push<Intarray2*>(t); return;}
}
-#line 1675 "runarray.in"
+#line 1677 "runarray.in"
// real norm(realarray *a);
void gen_runarray66(stack *Stack)
{
realarray * a=vm::pop<realarray *>(Stack);
-#line 1676 "runarray.in"
+#line 1678 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2022,12 +2024,12 @@ void gen_runarray66(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1686 "runarray.in"
+#line 1688 "runarray.in"
// real norm(realarray2 *a);
void gen_runarray67(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 1687 "runarray.in"
+#line 1689 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2041,12 +2043,12 @@ void gen_runarray67(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1701 "runarray.in"
+#line 1703 "runarray.in"
// real norm(triplearray2 *a);
void gen_runarray68(stack *Stack)
{
triplearray2 * a=vm::pop<triplearray2 *>(Stack);
-#line 1702 "runarray.in"
+#line 1704 "runarray.in"
size_t n=checkArray(a);
real M=0.0;
for(size_t i=0; i < n; ++i) {
@@ -2060,12 +2062,12 @@ void gen_runarray68(stack *Stack)
{Stack->push<real>(sqrt(M)); return;}
}
-#line 1716 "runarray.in"
+#line 1718 "runarray.in"
// real change2(triplearray2 *a);
void gen_runarray69(stack *Stack)
{
triplearray2 * a=vm::pop<triplearray2 *>(Stack);
-#line 1717 "runarray.in"
+#line 1719 "runarray.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<real>(0.0); return;}
@@ -2086,13 +2088,13 @@ void gen_runarray69(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 1738 "runarray.in"
+#line 1740 "runarray.in"
// triple minbezier(triplearray2 *P, triple b);
void gen_runarray70(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1739 "runarray.in"
+#line 1741 "runarray.in"
real *A=copyTripleArray2Components(P,true,4);
b=triple(bound(A,::min,b.getx(),sqrtFuzz*norm(A,16)),
bound(A+16,::min,b.gety(),sqrtFuzz*norm(A+16,16)),
@@ -2101,13 +2103,13 @@ void gen_runarray70(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 1748 "runarray.in"
+#line 1750 "runarray.in"
// triple maxbezier(triplearray2 *P, triple b);
void gen_runarray71(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1749 "runarray.in"
+#line 1751 "runarray.in"
real *A=copyTripleArray2Components(P,true,4);
b=triple(bound(A,::max,b.getx(),sqrtFuzz*norm(A,16)),
bound(A+16,::max,b.gety(),sqrtFuzz*norm(A+16,16)),
@@ -2116,13 +2118,13 @@ void gen_runarray71(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 1758 "runarray.in"
+#line 1760 "runarray.in"
// pair minratio(triplearray2 *P, pair b);
void gen_runarray72(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1759 "runarray.in"
+#line 1761 "runarray.in"
triple *A;
copyArray2C(A,P,true,4);
real fuzz=sqrtFuzz*norm(A,16);
@@ -2132,13 +2134,13 @@ void gen_runarray72(stack *Stack)
{Stack->push<pair>(b); return;}
}
-#line 1769 "runarray.in"
+#line 1771 "runarray.in"
// pair maxratio(triplearray2 *P, pair b);
void gen_runarray73(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 1770 "runarray.in"
+#line 1772 "runarray.in"
triple *A;
copyArray2C(A,P,true,4);
real fuzz=sqrtFuzz*norm(A,16);
@@ -2148,11 +2150,11 @@ void gen_runarray73(stack *Stack)
{Stack->push<pair>(b); return;}
}
-#line 1780 "runarray.in"
+#line 1782 "runarray.in"
// realarray* _projection();
void gen_runarray74(stack *Stack)
{
-#line 1781 "runarray.in"
+#line 1783 "runarray.in"
#ifdef HAVE_GL
array *a=new array(14);
gl::projection P=gl::camera();
@@ -2317,27 +2319,27 @@ void gen_runarray_venv(venv &ve)
addFunc(ve, run::gen_runarray62, primReal(), SYM(newton), formal(primInt(), SYM(iterations), true, false), formal(realRealFunction(), SYM(f), false, false), formal(realRealFunction(), SYM(fprime), false, false), formal(primReal(), SYM(x1), false, false), formal(primReal(), SYM(x2), false, false), formal(primBoolean(), SYM(verbose), true, false));
#line 1597 "runarray.in"
addFunc(ve, run::gen_runarray63, primReal(), SYM(simpson), formal(realRealFunction(), SYM(f), false, false), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false), formal(primReal(), SYM(acc), true, false), formal(primReal(), SYM(dxmax), true, false));
-#line 1609 "runarray.in"
+#line 1611 "runarray.in"
addFunc(ve, run::gen_runarray64, pairArray(), SYM(fft), formal(pairArray(), SYM(a), false, false), formal(primInt(), SYM(sign), true, false));
-#line 1640 "runarray.in"
+#line 1642 "runarray.in"
addFunc(ve, run::gen_runarray65, IntArray2(), SYM(triangulate), formal(pairArray(), SYM(z), false, false));
-#line 1675 "runarray.in"
+#line 1677 "runarray.in"
addFunc(ve, run::gen_runarray66, primReal(), SYM(norm), formal(realArray(), SYM(a), false, false));
-#line 1686 "runarray.in"
+#line 1688 "runarray.in"
addFunc(ve, run::gen_runarray67, primReal(), SYM(norm), formal(realArray2(), SYM(a), false, false));
-#line 1701 "runarray.in"
+#line 1703 "runarray.in"
addFunc(ve, run::gen_runarray68, primReal(), SYM(norm), formal(tripleArray2(), SYM(a), false, false));
-#line 1716 "runarray.in"
+#line 1718 "runarray.in"
addFunc(ve, run::gen_runarray69, primReal(), SYM(change2), formal(tripleArray2(), SYM(a), false, false));
-#line 1738 "runarray.in"
+#line 1740 "runarray.in"
addFunc(ve, run::gen_runarray70, primTriple(), SYM(minbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false));
-#line 1748 "runarray.in"
+#line 1750 "runarray.in"
addFunc(ve, run::gen_runarray71, primTriple(), SYM(maxbezier), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(b), false, false));
-#line 1758 "runarray.in"
+#line 1760 "runarray.in"
addFunc(ve, run::gen_runarray72, primPair(), SYM(minratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false));
-#line 1769 "runarray.in"
+#line 1771 "runarray.in"
addFunc(ve, run::gen_runarray73, primPair(), SYM(maxratio), formal(tripleArray2(), SYM(p), false, false), formal(primPair(), SYM(b), false, false));
-#line 1780 "runarray.in"
+#line 1782 "runarray.in"
addFunc(ve, run::gen_runarray74, realArray(), SYM(_projection));
}
diff --git a/Build/source/utils/asymptote/runarray.in b/Build/source/utils/asymptote/runarray.in
index 4d0aaaa8d28..c9f80a12297 100644
--- a/Build/source/utils/asymptote/runarray.in
+++ b/Build/source/utils/asymptote/runarray.in
@@ -1599,10 +1599,12 @@ real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON,
{
real integral;
if(dxmax <= 0) dxmax=fabs(b-a);
+ callable *oldFunc=Func;
Func=f;
FuncStack=Stack;
if(!simpson(integral,wrapFunction,a,b,acc,dxmax))
error("nesting capacity exceeded in simpson");
+ Func=oldFunc;
return integral;
}
diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc
index 99a9149d45c..ddfe6d553fa 100644
--- a/Build/source/utils/asymptote/runtime.cc
+++ b/Build/source/utils/asymptote/runtime.cc
@@ -120,6 +120,9 @@ using namespace vm;
using namespace camp;
using namespace settings;
+#undef OUT
+#undef IN
+
namespace run {
using camp::pair;
using vm::array;
@@ -247,54 +250,54 @@ void unused(void *)
namespace run {
// Initializers
-#line 224 "runtime.in"
+#line 227 "runtime.in"
void IntZero(stack *Stack)
{
-#line 225 "runtime.in"
+#line 228 "runtime.in"
{Stack->push<Int>(0); return;}
}
-#line 230 "runtime.in"
+#line 233 "runtime.in"
void realZero(stack *Stack)
{
-#line 231 "runtime.in"
+#line 234 "runtime.in"
{Stack->push<real>(0.0); return;}
}
-#line 235 "runtime.in"
+#line 238 "runtime.in"
void boolFalse(stack *Stack)
{
-#line 236 "runtime.in"
+#line 239 "runtime.in"
{Stack->push<bool>(false); return;}
}
-#line 240 "runtime.in"
+#line 243 "runtime.in"
// bool isnan(real x);
void gen_runtime3(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 241 "runtime.in"
+#line 244 "runtime.in"
{Stack->push<bool>(std::isnan(x)); return;}
}
-#line 245 "runtime.in"
+#line 248 "runtime.in"
void pushNullArray(stack *Stack)
{
-#line 246 "runtime.in"
+#line 249 "runtime.in"
{Stack->push<array*>(0); return;}
}
-#line 250 "runtime.in"
+#line 253 "runtime.in"
void pushNullRecord(stack *Stack)
{
-#line 251 "runtime.in"
+#line 254 "runtime.in"
{Stack->push<frame*>(0); return;}
}
-#line 255 "runtime.in"
+#line 258 "runtime.in"
void pushNullFunction(stack *Stack)
{
-#line 256 "runtime.in"
+#line 259 "runtime.in"
{Stack->push(nullfunc::instance()); return;}
}
@@ -303,222 +306,222 @@ void pushNullFunction(stack *Stack)
// Put the default value token on the stack (in place of an argument when
// making a function call).
-#line 265 "runtime.in"
+#line 268 "runtime.in"
void pushDefault(stack *Stack)
{
-#line 266 "runtime.in"
+#line 269 "runtime.in"
{Stack->push(Default); return;}
}
// Test if the value on the stack is the default value token.
-#line 272 "runtime.in"
+#line 275 "runtime.in"
void isDefault(stack *Stack)
{
item i=vm::pop(Stack);
-#line 273 "runtime.in"
+#line 276 "runtime.in"
{Stack->push<bool>(isdefault(i)); return;}
}
// Casts
-#line 279 "runtime.in"
+#line 282 "runtime.in"
void pairToGuide(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 280 "runtime.in"
+#line 283 "runtime.in"
{Stack->push<guide*>(new pairguide(z)); return;}
}
-#line 285 "runtime.in"
+#line 288 "runtime.in"
void pathToGuide(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 286 "runtime.in"
+#line 289 "runtime.in"
{Stack->push<guide*>(new pathguide(p)); return;}
}
-#line 290 "runtime.in"
+#line 293 "runtime.in"
void guideToPath(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 291 "runtime.in"
+#line 294 "runtime.in"
{Stack->push<path>(g->solve()); return;}
}
// Pen operations
-#line 297 "runtime.in"
+#line 300 "runtime.in"
void newPen(stack *Stack)
{
-#line 298 "runtime.in"
+#line 301 "runtime.in"
{Stack->push<pen>(pen()); return;}
}
-#line 303 "runtime.in"
+#line 306 "runtime.in"
// bool ==(pen a, pen b);
void gen_runtime13(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 304 "runtime.in"
+#line 307 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 308 "runtime.in"
+#line 311 "runtime.in"
// bool !=(pen a, pen b);
void gen_runtime14(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 309 "runtime.in"
+#line 312 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 313 "runtime.in"
+#line 316 "runtime.in"
// pen +(pen a, pen b);
void gen_runtime15(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 314 "runtime.in"
+#line 317 "runtime.in"
{Stack->push<pen>(a+b); return;}
}
-#line 318 "runtime.in"
+#line 321 "runtime.in"
// pen *(real a, pen b);
void gen_runtime16(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
real a=vm::pop<real>(Stack);
-#line 319 "runtime.in"
+#line 322 "runtime.in"
{Stack->push<pen>(a*b); return;}
}
-#line 323 "runtime.in"
+#line 326 "runtime.in"
// pen *(pen a, real b);
void gen_runtime17(stack *Stack)
{
real b=vm::pop<real>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 324 "runtime.in"
+#line 327 "runtime.in"
{Stack->push<pen>(b*a); return;}
}
-#line 328 "runtime.in"
+#line 331 "runtime.in"
// pair max(pen p);
void gen_runtime18(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 329 "runtime.in"
+#line 332 "runtime.in"
{Stack->push<pair>(p.bounds().Max()); return;}
}
-#line 333 "runtime.in"
+#line 336 "runtime.in"
// pair min(pen p);
void gen_runtime19(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 334 "runtime.in"
+#line 337 "runtime.in"
{Stack->push<pair>(p.bounds().Min()); return;}
}
// Reset the meaning of pen default attributes.
-#line 339 "runtime.in"
+#line 342 "runtime.in"
// void resetdefaultpen();
void gen_runtime20(stack *)
{
-#line 340 "runtime.in"
+#line 343 "runtime.in"
processData().defaultpen=camp::pen::initialpen();
}
-#line 344 "runtime.in"
+#line 347 "runtime.in"
// void defaultpen(pen p);
void gen_runtime21(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 345 "runtime.in"
+#line 348 "runtime.in"
processData().defaultpen=pen(resolvepen,p);
}
-#line 349 "runtime.in"
+#line 352 "runtime.in"
// pen defaultpen();
void gen_runtime22(stack *Stack)
{
-#line 350 "runtime.in"
+#line 353 "runtime.in"
{Stack->push<pen>(processData().defaultpen); return;}
}
-#line 354 "runtime.in"
+#line 357 "runtime.in"
// bool invisible(pen p);
void gen_runtime23(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 355 "runtime.in"
+#line 358 "runtime.in"
{Stack->push<bool>(p.invisible()); return;}
}
-#line 359 "runtime.in"
+#line 362 "runtime.in"
// pen invisible();
void gen_runtime24(stack *Stack)
{
-#line 360 "runtime.in"
+#line 363 "runtime.in"
{Stack->push<pen>(pen(invisiblepen)); return;}
}
-#line 364 "runtime.in"
+#line 367 "runtime.in"
// pen gray(pen p);
void gen_runtime25(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 365 "runtime.in"
+#line 368 "runtime.in"
p.togrey();
{Stack->push<pen>(p); return;}
}
-#line 370 "runtime.in"
+#line 373 "runtime.in"
// pen rgb(pen p);
void gen_runtime26(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 371 "runtime.in"
+#line 374 "runtime.in"
p.torgb();
{Stack->push<pen>(p); return;}
}
-#line 376 "runtime.in"
+#line 379 "runtime.in"
// pen cmyk(pen p);
void gen_runtime27(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 377 "runtime.in"
+#line 380 "runtime.in"
p.tocmyk();
{Stack->push<pen>(p); return;}
}
-#line 382 "runtime.in"
+#line 385 "runtime.in"
// pen interp(pen a, pen b, real t);
void gen_runtime28(stack *Stack)
{
real t=vm::pop<real>(Stack);
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 383 "runtime.in"
+#line 386 "runtime.in"
{Stack->push<pen>(interpolate(a,b,t)); return;}
}
-#line 387 "runtime.in"
+#line 390 "runtime.in"
// pen rgb(real r, real g, real b);
void gen_runtime29(stack *Stack)
{
real b=vm::pop<real>(Stack);
real g=vm::pop<real>(Stack);
real r=vm::pop<real>(Stack);
-#line 388 "runtime.in"
+#line 391 "runtime.in"
{Stack->push<pen>(pen(r,g,b)); return;}
}
-#line 392 "runtime.in"
+#line 395 "runtime.in"
// pen cmyk(real c, real m, real y, real k);
void gen_runtime30(stack *Stack)
{
@@ -526,25 +529,25 @@ void gen_runtime30(stack *Stack)
real y=vm::pop<real>(Stack);
real m=vm::pop<real>(Stack);
real c=vm::pop<real>(Stack);
-#line 393 "runtime.in"
+#line 396 "runtime.in"
{Stack->push<pen>(pen(c,m,y,k)); return;}
}
-#line 397 "runtime.in"
+#line 400 "runtime.in"
// pen gray(real gray);
void gen_runtime31(stack *Stack)
{
real gray=vm::pop<real>(Stack);
-#line 398 "runtime.in"
+#line 401 "runtime.in"
{Stack->push<pen>(pen(gray)); return;}
}
-#line 402 "runtime.in"
+#line 405 "runtime.in"
// realarray* colors(pen p);
void gen_runtime32(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 403 "runtime.in"
+#line 406 "runtime.in"
size_t n=ColorComponents[p.colorspace()];
array *a=new array(n);
@@ -571,78 +574,78 @@ void gen_runtime32(stack *Stack)
{Stack->push<realarray*>(a); return;}
}
-#line 430 "runtime.in"
+#line 433 "runtime.in"
// string hex(pen p);
void gen_runtime33(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 431 "runtime.in"
+#line 434 "runtime.in"
{Stack->push<string>(p.hex()); return;}
}
-#line 435 "runtime.in"
+#line 438 "runtime.in"
// Int byte(real x);
void gen_runtime34(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 436 "runtime.in"
- {Stack->push<Int>(byte(x)); return;}
+#line 439 "runtime.in"
+ {Stack->push<Int>(camp::byte(x)); return;}
}
-#line 440 "runtime.in"
+#line 443 "runtime.in"
// string colorspace(pen p);
void gen_runtime35(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 441 "runtime.in"
+#line 444 "runtime.in"
string s=ColorDeviceSuffix[p.colorspace()];
std::transform(s.begin(),s.end(),s.begin(),tolower);
{Stack->push<string>(s); return;}
}
-#line 447 "runtime.in"
+#line 450 "runtime.in"
// pen pattern(string *s);
void gen_runtime36(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 448 "runtime.in"
+#line 451 "runtime.in"
{Stack->push<pen>(pen(setpattern,*s)); return;}
}
-#line 452 "runtime.in"
+#line 455 "runtime.in"
// string pattern(pen p);
void gen_runtime37(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 453 "runtime.in"
+#line 456 "runtime.in"
{Stack->push<string>(p.fillpattern()); return;}
}
-#line 457 "runtime.in"
+#line 460 "runtime.in"
// pen fillrule(Int n);
void gen_runtime38(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 458 "runtime.in"
+#line 461 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;}
}
-#line 462 "runtime.in"
+#line 465 "runtime.in"
// Int fillrule(pen p);
void gen_runtime39(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 463 "runtime.in"
+#line 466 "runtime.in"
{Stack->push<Int>(p.Fillrule()); return;}
}
-#line 467 "runtime.in"
+#line 470 "runtime.in"
// pen opacity(real opacity=1.0, string blend=defaulttransparency);
void gen_runtime40(stack *Stack)
{
string blend=vm::pop<string>(Stack,defaulttransparency);
real opacity=vm::pop<real>(Stack,1.0);
-#line 468 "runtime.in"
+#line 471 "runtime.in"
for(Int i=0; i < nBlendMode; ++i)
if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;}
@@ -651,25 +654,25 @@ void gen_runtime40(stack *Stack)
error(buf);
}
-#line 477 "runtime.in"
+#line 480 "runtime.in"
// real opacity(pen p);
void gen_runtime41(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 478 "runtime.in"
+#line 481 "runtime.in"
{Stack->push<real>(p.opacity()); return;}
}
-#line 482 "runtime.in"
+#line 485 "runtime.in"
// string blend(pen p);
void gen_runtime42(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 483 "runtime.in"
+#line 486 "runtime.in"
{Stack->push<string>(p.blend()); return;}
}
-#line 487 "runtime.in"
+#line 490 "runtime.in"
// pen linetype(realarray *pattern, real offset=0, bool scale=true, bool adjust=true);
void gen_runtime43(stack *Stack)
{
@@ -677,7 +680,7 @@ void gen_runtime43(stack *Stack)
bool scale=vm::pop<bool>(Stack,true);
real offset=vm::pop<real>(Stack,0);
realarray * pattern=vm::pop<realarray *>(Stack);
-#line 489 "runtime.in"
+#line 492 "runtime.in"
size_t size=checkArray(pattern);
array *a=new array(size);
for(size_t i=0; i < size; ++i)
@@ -686,272 +689,272 @@ void gen_runtime43(stack *Stack)
{Stack->push<pen>(pen(LineType(*a,offset,scale,adjust))); return;}
}
-#line 498 "runtime.in"
+#line 501 "runtime.in"
// realarray* linetype(pen p=CURRENTPEN);
void gen_runtime44(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 499 "runtime.in"
+#line 502 "runtime.in"
array a=p.linetype()->pattern;
{Stack->push<realarray*>(copyArray(&a)); return;}
}
-#line 504 "runtime.in"
+#line 507 "runtime.in"
// real offset(pen p);
void gen_runtime45(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 505 "runtime.in"
+#line 508 "runtime.in"
{Stack->push<real>(p.linetype()->offset); return;}
}
-#line 509 "runtime.in"
+#line 512 "runtime.in"
// bool scale(pen p);
void gen_runtime46(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 510 "runtime.in"
+#line 513 "runtime.in"
{Stack->push<bool>(p.linetype()->scale); return;}
}
-#line 514 "runtime.in"
+#line 517 "runtime.in"
// bool adjust(pen p);
void gen_runtime47(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 515 "runtime.in"
+#line 518 "runtime.in"
{Stack->push<bool>(p.linetype()->adjust); return;}
}
-#line 519 "runtime.in"
+#line 522 "runtime.in"
// pen adjust(pen p, real arclength, bool cyclic);
void gen_runtime48(stack *Stack)
{
bool cyclic=vm::pop<bool>(Stack);
real arclength=vm::pop<real>(Stack);
pen p=vm::pop<pen>(Stack);
-#line 520 "runtime.in"
+#line 523 "runtime.in"
{Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;}
}
-#line 524 "runtime.in"
+#line 527 "runtime.in"
// pen linecap(Int n);
void gen_runtime49(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 525 "runtime.in"
+#line 528 "runtime.in"
{Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;}
}
-#line 529 "runtime.in"
+#line 532 "runtime.in"
// Int linecap(pen p=CURRENTPEN);
void gen_runtime50(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 530 "runtime.in"
+#line 533 "runtime.in"
{Stack->push<Int>(p.cap()); return;}
}
-#line 534 "runtime.in"
+#line 537 "runtime.in"
// pen linejoin(Int n);
void gen_runtime51(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 535 "runtime.in"
+#line 538 "runtime.in"
{Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;}
}
-#line 539 "runtime.in"
+#line 542 "runtime.in"
// Int linejoin(pen p=CURRENTPEN);
void gen_runtime52(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 540 "runtime.in"
+#line 543 "runtime.in"
{Stack->push<Int>(p.join()); return;}
}
-#line 544 "runtime.in"
+#line 547 "runtime.in"
// pen miterlimit(real x);
void gen_runtime53(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 545 "runtime.in"
+#line 548 "runtime.in"
{Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;}
}
-#line 549 "runtime.in"
+#line 552 "runtime.in"
// real miterlimit(pen p=CURRENTPEN);
void gen_runtime54(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 550 "runtime.in"
+#line 553 "runtime.in"
{Stack->push<real>(p.miter()); return;}
}
-#line 554 "runtime.in"
+#line 557 "runtime.in"
// pen linewidth(real x);
void gen_runtime55(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 555 "runtime.in"
+#line 558 "runtime.in"
{Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;}
}
-#line 559 "runtime.in"
+#line 562 "runtime.in"
// real linewidth(pen p=CURRENTPEN);
void gen_runtime56(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 560 "runtime.in"
+#line 563 "runtime.in"
{Stack->push<real>(p.width()); return;}
}
-#line 564 "runtime.in"
+#line 567 "runtime.in"
// pen fontcommand(string *s);
void gen_runtime57(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 565 "runtime.in"
+#line 568 "runtime.in"
{Stack->push<pen>(pen(setfont,*s)); return;}
}
-#line 569 "runtime.in"
+#line 572 "runtime.in"
// string font(pen p=CURRENTPEN);
void gen_runtime58(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 570 "runtime.in"
+#line 573 "runtime.in"
{Stack->push<string>(p.Font()); return;}
}
-#line 574 "runtime.in"
+#line 577 "runtime.in"
// pen fontsize(real size, real lineskip);
void gen_runtime59(stack *Stack)
{
real lineskip=vm::pop<real>(Stack);
real size=vm::pop<real>(Stack);
-#line 575 "runtime.in"
+#line 578 "runtime.in"
{Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0,
lineskip > 0.0 ? lineskip : 0.0)); return;}
}
-#line 580 "runtime.in"
+#line 583 "runtime.in"
// real fontsize(pen p=CURRENTPEN);
void gen_runtime60(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 581 "runtime.in"
+#line 584 "runtime.in"
{Stack->push<real>(p.size()); return;}
}
-#line 585 "runtime.in"
+#line 588 "runtime.in"
// real lineskip(pen p=CURRENTPEN);
void gen_runtime61(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 586 "runtime.in"
+#line 589 "runtime.in"
{Stack->push<real>(p.Lineskip()); return;}
}
-#line 590 "runtime.in"
+#line 593 "runtime.in"
// pen overwrite(Int n);
void gen_runtime62(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 591 "runtime.in"
+#line 594 "runtime.in"
{Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n :
DEFWRITE)); return;}
}
-#line 596 "runtime.in"
+#line 599 "runtime.in"
// Int overwrite(pen p=CURRENTPEN);
void gen_runtime63(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 597 "runtime.in"
+#line 600 "runtime.in"
{Stack->push<Int>(p.Overwrite()); return;}
}
-#line 601 "runtime.in"
+#line 604 "runtime.in"
// pen basealign(Int n);
void gen_runtime64(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 602 "runtime.in"
+#line 605 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;}
}
-#line 606 "runtime.in"
+#line 609 "runtime.in"
// Int basealign(pen p=CURRENTPEN);
void gen_runtime65(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 607 "runtime.in"
+#line 610 "runtime.in"
{Stack->push<Int>(p.Baseline()); return;}
}
-#line 611 "runtime.in"
+#line 614 "runtime.in"
// transform transform(pen p);
void gen_runtime66(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 612 "runtime.in"
+#line 615 "runtime.in"
{Stack->push<transform>(p.getTransform()); return;}
}
-#line 616 "runtime.in"
+#line 619 "runtime.in"
// path nib(pen p);
void gen_runtime67(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 617 "runtime.in"
+#line 620 "runtime.in"
{Stack->push<path>(p.Path()); return;}
}
-#line 621 "runtime.in"
+#line 624 "runtime.in"
// pen makepen(path p);
void gen_runtime68(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 622 "runtime.in"
+#line 625 "runtime.in"
{Stack->push<pen>(pen(p)); return;}
}
-#line 626 "runtime.in"
+#line 629 "runtime.in"
// pen colorless(pen p);
void gen_runtime69(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 627 "runtime.in"
+#line 630 "runtime.in"
p.colorless();
{Stack->push<pen>(p); return;}
}
// Interactive mode
-#line 633 "runtime.in"
+#line 636 "runtime.in"
// bool interactive();
void gen_runtime70(stack *Stack)
{
-#line 634 "runtime.in"
+#line 637 "runtime.in"
{Stack->push<bool>(interact::interactive); return;}
}
-#line 639 "runtime.in"
+#line 642 "runtime.in"
// bool uptodate();
void gen_runtime71(stack *Stack)
{
-#line 640 "runtime.in"
+#line 643 "runtime.in"
{Stack->push<bool>(interact::uptodate); return;}
}
// System commands
-#line 646 "runtime.in"
+#line 649 "runtime.in"
// Int system(stringarray *s);
void gen_runtime72(stack *Stack)
{
stringarray * s=vm::pop<stringarray *>(Stack);
-#line 647 "runtime.in"
+#line 650 "runtime.in"
if(safe) error("system() call disabled; override with option -nosafe");
size_t size=checkArray(s);
if(size == 0) {Stack->push<Int>(0); return;}
@@ -961,57 +964,57 @@ void gen_runtime72(stack *Stack)
{Stack->push<Int>(System(cmd)); return;}
}
-#line 658 "runtime.in"
+#line 661 "runtime.in"
// bool view();
void gen_runtime73(stack *Stack)
{
-#line 659 "runtime.in"
+#line 662 "runtime.in"
{Stack->push<bool>(view()); return;}
}
-#line 663 "runtime.in"
+#line 666 "runtime.in"
// string asydir();
void gen_runtime74(stack *Stack)
{
-#line 664 "runtime.in"
+#line 667 "runtime.in"
{Stack->push<string>(systemDir); return;}
}
-#line 668 "runtime.in"
+#line 671 "runtime.in"
// string locale(string s=emptystring);
void gen_runtime75(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 669 "runtime.in"
+#line 672 "runtime.in"
char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str());
{Stack->push<string>(L != NULL ? string(L) : ""); return;}
}
-#line 674 "runtime.in"
+#line 677 "runtime.in"
// void abort(string s=emptystring);
void gen_runtime76(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 675 "runtime.in"
+#line 678 "runtime.in"
if(s.empty()) throw handled_error();
error(s.c_str());
}
-#line 680 "runtime.in"
+#line 683 "runtime.in"
// void exit();
void gen_runtime77(stack *)
{
-#line 681 "runtime.in"
+#line 684 "runtime.in"
throw quit();
}
-#line 685 "runtime.in"
+#line 688 "runtime.in"
// void assert(bool b, string s=emptystring);
void gen_runtime78(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
bool b=vm::pop<bool>(Stack);
-#line 686 "runtime.in"
+#line 689 "runtime.in"
flush(cout);
if(!b) {
ostringstream buf;
@@ -1021,34 +1024,34 @@ void gen_runtime78(stack *Stack)
}
}
-#line 696 "runtime.in"
+#line 699 "runtime.in"
// void sleep(Int seconds);
void gen_runtime79(stack *Stack)
{
Int seconds=vm::pop<Int>(Stack);
-#line 697 "runtime.in"
+#line 700 "runtime.in"
if(seconds <= 0) return;
sleep(seconds);
}
-#line 702 "runtime.in"
+#line 705 "runtime.in"
// void usleep(Int microseconds);
void gen_runtime80(stack *Stack)
{
Int microseconds=vm::pop<Int>(Stack);
-#line 703 "runtime.in"
+#line 706 "runtime.in"
if(microseconds <= 0) return;
usleep((unsigned long) microseconds);
}
-#line 708 "runtime.in"
+#line 711 "runtime.in"
// void _eval(string *s, bool embedded, bool interactiveWrite=false);
void gen_runtime81(stack *Stack)
{
bool interactiveWrite=vm::pop<bool>(Stack,false);
bool embedded=vm::pop<bool>(Stack);
string * s=vm::pop<string *>(Stack);
-#line 709 "runtime.in"
+#line 712 "runtime.in"
if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
@@ -1060,13 +1063,13 @@ void gen_runtime81(stack *Stack)
runString(*s,interactiveWrite);
}
-#line 721 "runtime.in"
+#line 724 "runtime.in"
// void _eval(runnable *s, bool embedded);
void gen_runtime82(stack *Stack)
{
bool embedded=vm::pop<bool>(Stack);
runnable * s=vm::pop<runnable *>(Stack);
-#line 722 "runtime.in"
+#line 725 "runtime.in"
absyntax::block *ast=new absyntax::block(s->getPos(), false);
ast->add(s);
@@ -1081,31 +1084,31 @@ void gen_runtime82(stack *Stack)
runCode(ast);
}
-#line 737 "runtime.in"
+#line 740 "runtime.in"
// string location();
void gen_runtime83(stack *Stack)
{
-#line 738 "runtime.in"
+#line 741 "runtime.in"
ostringstream buf;
buf << getPos();
{Stack->push<string>(buf.str()); return;}
}
// Wrapper for the stack::load() method.
-#line 744 "runtime.in"
+#line 747 "runtime.in"
void loadModule(stack *Stack)
{
string * index=vm::pop<string *>(Stack);
-#line 745 "runtime.in"
+#line 748 "runtime.in"
Stack->load(*index);
}
-#line 749 "runtime.in"
+#line 752 "runtime.in"
// string cd(string s=emptystring);
void gen_runtime85(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 750 "runtime.in"
+#line 753 "runtime.in"
if(!s.empty() && !globalwrite()) {
string outname=getSetting<string>("outname");
string dir=stripDir(outname);
@@ -1114,13 +1117,13 @@ void gen_runtime85(stack *Stack)
{Stack->push<string>(setPath(s.c_str())); return;}
}
-#line 759 "runtime.in"
+#line 762 "runtime.in"
// void list(string *s, bool imports=false);
void gen_runtime86(stack *Stack)
{
bool imports=vm::pop<bool>(Stack,false);
string * s=vm::pop<string *>(Stack);
-#line 760 "runtime.in"
+#line 763 "runtime.in"
if(*s == "-") return;
trans::genv ge;
symbol name=symbol::trans(*s);
@@ -1130,18 +1133,18 @@ void gen_runtime86(stack *Stack)
// Guide operations
-#line 770 "runtime.in"
+#line 773 "runtime.in"
void nullGuide(stack *Stack)
{
-#line 771 "runtime.in"
+#line 774 "runtime.in"
{Stack->push<guide*>(new pathguide(path())); return;}
}
-#line 776 "runtime.in"
+#line 779 "runtime.in"
void dotsGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 777 "runtime.in"
+#line 780 "runtime.in"
guidevector v;
size_t size=checkArray(a);
for (size_t i=0; i < size; ++i)
@@ -1150,14 +1153,14 @@ void dotsGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 786 "runtime.in"
+#line 789 "runtime.in"
void dashesGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 787 "runtime.in"
+#line 790 "runtime.in"
static camp::curlSpec curly;
- static specguide curlout(&curly, camp::OUT);
- static specguide curlin(&curly, camp::IN);
+ static camp::specguide curlout(&curly, camp::OUT);
+ static camp::specguide curlin(&curly, camp::IN);
size_t n=checkArray(a);
@@ -1180,179 +1183,179 @@ void dashesGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 813 "runtime.in"
+#line 816 "runtime.in"
void newCycleToken(stack *Stack)
{
-#line 814 "runtime.in"
+#line 817 "runtime.in"
{Stack->push<cycleToken>(cycleToken()); return;}
}
-#line 818 "runtime.in"
+#line 821 "runtime.in"
// guide* operator cast(cycleToken tok);
void gen_runtime91(stack *Stack)
{
cycleToken tok=vm::pop<cycleToken>(Stack);
-#line 819 "runtime.in"
+#line 822 "runtime.in"
// Avoid unused variable warning messages.
unused(&tok);
{Stack->push<guide*>(new cycletokguide()); return;}
}
-#line 825 "runtime.in"
+#line 828 "runtime.in"
// guide* operator spec(pair z, Int p);
void gen_runtime92(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 826 "runtime.in"
+#line 829 "runtime.in"
camp::side d=(camp::side) p;
camp::dirSpec *sp=new camp::dirSpec(z);
{Stack->push<guide*>(new specguide(sp,d)); return;}
}
-#line 833 "runtime.in"
+#line 836 "runtime.in"
// curlSpecifier operator curl(real gamma, Int p);
void gen_runtime93(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
real gamma=vm::pop<real>(Stack);
-#line 834 "runtime.in"
+#line 837 "runtime.in"
camp::side s=(camp::side) p;
{Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;}
}
-#line 839 "runtime.in"
+#line 842 "runtime.in"
void curlSpecifierValuePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 840 "runtime.in"
+#line 843 "runtime.in"
{Stack->push<real>(spec.getValue()); return;}
}
-#line 844 "runtime.in"
+#line 847 "runtime.in"
void curlSpecifierSidePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 845 "runtime.in"
+#line 848 "runtime.in"
{Stack->push<Int>(spec.getSide()); return;}
}
-#line 849 "runtime.in"
+#line 852 "runtime.in"
// guide* operator cast(curlSpecifier spec);
void gen_runtime96(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 850 "runtime.in"
+#line 853 "runtime.in"
{Stack->push<guide*>(new specguide(spec)); return;}
}
-#line 854 "runtime.in"
+#line 857 "runtime.in"
// tensionSpecifier operator tension(real tout, real tin, bool atleast);
void gen_runtime97(stack *Stack)
{
bool atleast=vm::pop<bool>(Stack);
real tin=vm::pop<real>(Stack);
real tout=vm::pop<real>(Stack);
-#line 855 "runtime.in"
+#line 858 "runtime.in"
{Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;}
}
-#line 859 "runtime.in"
+#line 862 "runtime.in"
void tensionSpecifierOutPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 860 "runtime.in"
+#line 863 "runtime.in"
{Stack->push<real>(t.getOut()); return;}
}
-#line 864 "runtime.in"
+#line 867 "runtime.in"
void tensionSpecifierInPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 865 "runtime.in"
+#line 868 "runtime.in"
{Stack->push<real>(t.getIn()); return;}
}
-#line 869 "runtime.in"
+#line 872 "runtime.in"
void tensionSpecifierAtleastPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 870 "runtime.in"
+#line 873 "runtime.in"
{Stack->push<bool>(t.getAtleast()); return;}
}
-#line 874 "runtime.in"
+#line 877 "runtime.in"
// guide* operator cast(tensionSpecifier t);
void gen_runtime101(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 875 "runtime.in"
+#line 878 "runtime.in"
{Stack->push<guide*>(new tensionguide(t)); return;}
}
-#line 879 "runtime.in"
+#line 882 "runtime.in"
// guide* operator controls(pair zout, pair zin);
void gen_runtime102(stack *Stack)
{
pair zin=vm::pop<pair>(Stack);
pair zout=vm::pop<pair>(Stack);
-#line 880 "runtime.in"
+#line 883 "runtime.in"
{Stack->push<guide*>(new controlguide(zout, zin)); return;}
}
-#line 884 "runtime.in"
+#line 887 "runtime.in"
// Int size(guide *g);
void gen_runtime103(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 885 "runtime.in"
+#line 888 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(f.size()); return;}
}
-#line 891 "runtime.in"
+#line 894 "runtime.in"
// Int length(guide *g);
void gen_runtime104(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 892 "runtime.in"
+#line 895 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;}
}
-#line 898 "runtime.in"
+#line 901 "runtime.in"
// bool cyclic(guide *g);
void gen_runtime105(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 899 "runtime.in"
+#line 902 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<bool>(g->cyclic()); return;}
}
-#line 905 "runtime.in"
+#line 908 "runtime.in"
// pair point(guide *g, Int t);
void gen_runtime106(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 906 "runtime.in"
+#line 909 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;}
}
-#line 912 "runtime.in"
+#line 915 "runtime.in"
// pairarray* dirSpecifier(guide *g, Int t);
void gen_runtime107(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 913 "runtime.in"
+#line 916 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1363,13 +1366,13 @@ void gen_runtime107(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 924 "runtime.in"
+#line 927 "runtime.in"
// pairarray* controlSpecifier(guide *g, Int t);
void gen_runtime108(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 925 "runtime.in"
+#line 928 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1385,13 +1388,13 @@ void gen_runtime108(stack *Stack)
} else {Stack->push<pairarray*>(new array(0)); return;}
}
-#line 941 "runtime.in"
+#line 944 "runtime.in"
// tensionSpecifier tensionSpecifier(guide *g, Int t);
void gen_runtime109(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 942 "runtime.in"
+#line 945 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1400,13 +1403,13 @@ void gen_runtime109(stack *Stack)
{Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;}
}
-#line 951 "runtime.in"
+#line 954 "runtime.in"
// realarray* curlSpecifier(guide *g, Int t);
void gen_runtime110(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 952 "runtime.in"
+#line 955 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -1419,12 +1422,12 @@ void gen_runtime110(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 965 "runtime.in"
+#line 968 "runtime.in"
// guide* reverse(guide *g);
void gen_runtime111(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 966 "runtime.in"
+#line 969 "runtime.in"
flatguide f;
g->flatten(f,false);
if(f.precyclic())
@@ -1475,11 +1478,11 @@ void gen_runtime111(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 1018 "runtime.in"
+#line 1021 "runtime.in"
// realarray* _cputime();
void gen_runtime112(stack *Stack)
{
-#line 1019 "runtime.in"
+#line 1022 "runtime.in"
static const real ticktime=1.0/sysconf(_SC_CLK_TCK);
struct tms buf;
@@ -1494,103 +1497,103 @@ void gen_runtime112(stack *Stack)
// Transforms
-#line 1034 "runtime.in"
+#line 1037 "runtime.in"
// bool ==(transform a, transform b);
void gen_runtime113(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1035 "runtime.in"
+#line 1038 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 1040 "runtime.in"
+#line 1043 "runtime.in"
// bool !=(transform a, transform b);
void gen_runtime114(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1041 "runtime.in"
+#line 1044 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 1045 "runtime.in"
+#line 1048 "runtime.in"
// transform +(transform a, transform b);
void gen_runtime115(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1046 "runtime.in"
+#line 1049 "runtime.in"
{Stack->push<transform>(a+b); return;}
}
-#line 1050 "runtime.in"
+#line 1053 "runtime.in"
// transform *(transform a, transform b);
void gen_runtime116(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 1051 "runtime.in"
+#line 1054 "runtime.in"
{Stack->push<transform>(a*b); return;}
}
-#line 1055 "runtime.in"
+#line 1058 "runtime.in"
// pair *(transform t, pair z);
void gen_runtime117(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1056 "runtime.in"
+#line 1059 "runtime.in"
{Stack->push<pair>(t*z); return;}
}
-#line 1060 "runtime.in"
+#line 1063 "runtime.in"
// path *(transform t, path g);
void gen_runtime118(stack *Stack)
{
path g=vm::pop<path>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1061 "runtime.in"
+#line 1064 "runtime.in"
{Stack->push<path>(transformed(t,g)); return;}
}
-#line 1065 "runtime.in"
+#line 1068 "runtime.in"
// pen *(transform t, pen p);
void gen_runtime119(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1066 "runtime.in"
+#line 1069 "runtime.in"
{Stack->push<pen>(transformed(t,p)); return;}
}
-#line 1070 "runtime.in"
+#line 1073 "runtime.in"
// picture* *(transform t, picture *f);
void gen_runtime120(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1071 "runtime.in"
+#line 1074 "runtime.in"
{Stack->push<picture*>(transformed(t,f)); return;}
}
-#line 1075 "runtime.in"
+#line 1078 "runtime.in"
// picture* *(realarray2 *t, picture *f);
void gen_runtime121(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 1076 "runtime.in"
+#line 1079 "runtime.in"
{Stack->push<picture*>(transformed(*t,f)); return;}
}
-#line 1080 "runtime.in"
+#line 1083 "runtime.in"
// transform ^(transform t, Int n);
void gen_runtime122(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 1081 "runtime.in"
+#line 1084 "runtime.in"
transform T;
if(n < 0) {
n=-n;
@@ -1600,55 +1603,55 @@ void gen_runtime122(stack *Stack)
{Stack->push<transform>(T); return;}
}
-#line 1091 "runtime.in"
+#line 1094 "runtime.in"
void transformXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1092 "runtime.in"
+#line 1095 "runtime.in"
{Stack->push<real>(t.getx()); return;}
}
-#line 1096 "runtime.in"
+#line 1099 "runtime.in"
void transformYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1097 "runtime.in"
+#line 1100 "runtime.in"
{Stack->push<real>(t.gety()); return;}
}
-#line 1101 "runtime.in"
+#line 1104 "runtime.in"
void transformXXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1102 "runtime.in"
+#line 1105 "runtime.in"
{Stack->push<real>(t.getxx()); return;}
}
-#line 1106 "runtime.in"
+#line 1109 "runtime.in"
void transformXYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1107 "runtime.in"
+#line 1110 "runtime.in"
{Stack->push<real>(t.getxy()); return;}
}
-#line 1111 "runtime.in"
+#line 1114 "runtime.in"
void transformYXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1112 "runtime.in"
+#line 1115 "runtime.in"
{Stack->push<real>(t.getyx()); return;}
}
-#line 1116 "runtime.in"
+#line 1119 "runtime.in"
void transformYYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1117 "runtime.in"
+#line 1120 "runtime.in"
{Stack->push<real>(t.getyy()); return;}
}
-#line 1121 "runtime.in"
+#line 1124 "runtime.in"
void real6ToTransform(stack *Stack)
{
real yy=vm::pop<real>(Stack);
@@ -1657,127 +1660,127 @@ void real6ToTransform(stack *Stack)
real xx=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1123 "runtime.in"
+#line 1126 "runtime.in"
{Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;}
}
-#line 1127 "runtime.in"
+#line 1130 "runtime.in"
// transform shift(transform t);
void gen_runtime130(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1128 "runtime.in"
+#line 1131 "runtime.in"
{Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;}
}
-#line 1132 "runtime.in"
+#line 1135 "runtime.in"
// transform shiftless(transform t);
void gen_runtime131(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1133 "runtime.in"
+#line 1136 "runtime.in"
{Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;}
}
-#line 1137 "runtime.in"
+#line 1140 "runtime.in"
// transform identity();
void transformIdentity(stack *Stack)
{
-#line 1138 "runtime.in"
+#line 1141 "runtime.in"
{Stack->push<transform>(identity); return;}
}
-#line 1142 "runtime.in"
+#line 1145 "runtime.in"
// transform inverse(transform t);
void gen_runtime133(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 1143 "runtime.in"
+#line 1146 "runtime.in"
{Stack->push<transform>(inverse(t)); return;}
}
-#line 1147 "runtime.in"
+#line 1150 "runtime.in"
// transform shift(pair z);
void gen_runtime134(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 1148 "runtime.in"
+#line 1151 "runtime.in"
{Stack->push<transform>(shift(z)); return;}
}
-#line 1152 "runtime.in"
+#line 1155 "runtime.in"
// transform shift(real x, real y);
void gen_runtime135(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1153 "runtime.in"
+#line 1156 "runtime.in"
{Stack->push<transform>(shift(pair(x,y))); return;}
}
-#line 1157 "runtime.in"
+#line 1160 "runtime.in"
// transform xscale(real x);
void gen_runtime136(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 1158 "runtime.in"
+#line 1161 "runtime.in"
{Stack->push<transform>(xscale(x)); return;}
}
-#line 1162 "runtime.in"
+#line 1165 "runtime.in"
// transform yscale(real y);
void gen_runtime137(stack *Stack)
{
real y=vm::pop<real>(Stack);
-#line 1163 "runtime.in"
+#line 1166 "runtime.in"
{Stack->push<transform>(yscale(y)); return;}
}
-#line 1167 "runtime.in"
+#line 1170 "runtime.in"
// transform scale(real x);
void gen_runtime138(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 1168 "runtime.in"
+#line 1171 "runtime.in"
{Stack->push<transform>(scale(x)); return;}
}
-#line 1172 "runtime.in"
+#line 1175 "runtime.in"
// transform scale(real x, real y);
void gen_runtime139(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 1173 "runtime.in"
+#line 1176 "runtime.in"
{Stack->push<transform>(scale(x,y)); return;}
}
-#line 1177 "runtime.in"
+#line 1180 "runtime.in"
// transform slant(real s);
void gen_runtime140(stack *Stack)
{
real s=vm::pop<real>(Stack);
-#line 1178 "runtime.in"
+#line 1181 "runtime.in"
{Stack->push<transform>(slant(s)); return;}
}
-#line 1182 "runtime.in"
+#line 1185 "runtime.in"
// transform rotate(real angle, pair z=0);
void gen_runtime141(stack *Stack)
{
pair z=vm::pop<pair>(Stack,0);
real angle=vm::pop<real>(Stack);
-#line 1183 "runtime.in"
+#line 1186 "runtime.in"
{Stack->push<transform>(rotatearound(z,radians(angle))); return;}
}
-#line 1187 "runtime.in"
+#line 1190 "runtime.in"
// transform reflect(pair a, pair b);
void gen_runtime142(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 1188 "runtime.in"
+#line 1191 "runtime.in"
{Stack->push<transform>(reflectabout(a,b)); return;}
}
@@ -1787,291 +1790,291 @@ namespace trans {
void gen_runtime_venv(venv &ve)
{
-#line 222 "runtime.in"
+#line 225 "runtime.in"
REGISTER_BLTIN(run::IntZero,"IntZero");
-#line 230 "runtime.in"
+#line 233 "runtime.in"
REGISTER_BLTIN(run::realZero,"realZero");
-#line 235 "runtime.in"
+#line 238 "runtime.in"
REGISTER_BLTIN(run::boolFalse,"boolFalse");
-#line 240 "runtime.in"
+#line 243 "runtime.in"
addFunc(ve, run::gen_runtime3, primBoolean(), SYM(isnan), formal(primReal(), SYM(x), false, false));
-#line 245 "runtime.in"
+#line 248 "runtime.in"
REGISTER_BLTIN(run::pushNullArray,"pushNullArray");
-#line 250 "runtime.in"
+#line 253 "runtime.in"
REGISTER_BLTIN(run::pushNullRecord,"pushNullRecord");
-#line 255 "runtime.in"
+#line 258 "runtime.in"
REGISTER_BLTIN(run::pushNullFunction,"pushNullFunction");
-#line 260 "runtime.in"
+#line 263 "runtime.in"
REGISTER_BLTIN(run::pushDefault,"pushDefault");
-#line 270 "runtime.in"
+#line 273 "runtime.in"
REGISTER_BLTIN(run::isDefault,"isDefault");
-#line 277 "runtime.in"
+#line 280 "runtime.in"
REGISTER_BLTIN(run::pairToGuide,"pairToGuide");
-#line 285 "runtime.in"
+#line 288 "runtime.in"
REGISTER_BLTIN(run::pathToGuide,"pathToGuide");
-#line 290 "runtime.in"
+#line 293 "runtime.in"
REGISTER_BLTIN(run::guideToPath,"guideToPath");
-#line 295 "runtime.in"
+#line 298 "runtime.in"
REGISTER_BLTIN(run::newPen,"newPen");
-#line 303 "runtime.in"
+#line 306 "runtime.in"
addFunc(ve, run::gen_runtime13, primBoolean(), SYM_EQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 308 "runtime.in"
+#line 311 "runtime.in"
addFunc(ve, run::gen_runtime14, primBoolean(), SYM_NEQ, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 313 "runtime.in"
+#line 316 "runtime.in"
addFunc(ve, run::gen_runtime15, primPen(), SYM_PLUS, formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 318 "runtime.in"
+#line 321 "runtime.in"
addFunc(ve, run::gen_runtime16, primPen(), SYM_TIMES, formal(primReal(), SYM(a), false, false), formal(primPen(), SYM(b), false, false));
-#line 323 "runtime.in"
+#line 326 "runtime.in"
addFunc(ve, run::gen_runtime17, primPen(), SYM_TIMES, formal(primPen(), SYM(a), false, false), formal(primReal(), SYM(b), false, false));
-#line 328 "runtime.in"
+#line 331 "runtime.in"
addFunc(ve, run::gen_runtime18, primPair(), SYM(max), formal(primPen(), SYM(p), false, false));
-#line 333 "runtime.in"
+#line 336 "runtime.in"
addFunc(ve, run::gen_runtime19, primPair(), SYM(min), formal(primPen(), SYM(p), false, false));
-#line 338 "runtime.in"
+#line 341 "runtime.in"
addFunc(ve, run::gen_runtime20, primVoid(), SYM(resetdefaultpen));
-#line 344 "runtime.in"
+#line 347 "runtime.in"
addFunc(ve, run::gen_runtime21, primVoid(), SYM(defaultpen), formal(primPen(), SYM(p), false, false));
-#line 349 "runtime.in"
+#line 352 "runtime.in"
addFunc(ve, run::gen_runtime22, primPen(), SYM(defaultpen));
-#line 354 "runtime.in"
+#line 357 "runtime.in"
addFunc(ve, run::gen_runtime23, primBoolean(), SYM(invisible), formal(primPen(), SYM(p), false, false));
-#line 359 "runtime.in"
+#line 362 "runtime.in"
addFunc(ve, run::gen_runtime24, primPen(), SYM(invisible));
-#line 364 "runtime.in"
+#line 367 "runtime.in"
addFunc(ve, run::gen_runtime25, primPen(), SYM(gray), formal(primPen(), SYM(p), false, false));
-#line 370 "runtime.in"
+#line 373 "runtime.in"
addFunc(ve, run::gen_runtime26, primPen(), SYM(rgb), formal(primPen(), SYM(p), false, false));
-#line 376 "runtime.in"
+#line 379 "runtime.in"
addFunc(ve, run::gen_runtime27, primPen(), SYM(cmyk), formal(primPen(), SYM(p), false, false));
-#line 382 "runtime.in"
+#line 385 "runtime.in"
addFunc(ve, run::gen_runtime28, primPen(), SYM(interp), formal(primPen(), SYM(a), false, false), formal(primPen(), SYM(b), false, false), formal(primReal(), SYM(t), false, false));
-#line 387 "runtime.in"
+#line 390 "runtime.in"
addFunc(ve, run::gen_runtime29, primPen(), SYM(rgb), formal(primReal(), SYM(r), false, false), formal(primReal(), SYM(g), false, false), formal(primReal(), SYM(b), false, false));
-#line 392 "runtime.in"
+#line 395 "runtime.in"
addFunc(ve, run::gen_runtime30, primPen(), SYM(cmyk), formal(primReal(), SYM(c), false, false), formal(primReal(), SYM(m), false, false), formal(primReal(), SYM(y), false, false), formal(primReal(), SYM(k), false, false));
-#line 397 "runtime.in"
+#line 400 "runtime.in"
addFunc(ve, run::gen_runtime31, primPen(), SYM(gray), formal(primReal(), SYM(gray), false, false));
-#line 402 "runtime.in"
+#line 405 "runtime.in"
addFunc(ve, run::gen_runtime32, realArray(), SYM(colors), formal(primPen(), SYM(p), false, false));
-#line 430 "runtime.in"
+#line 433 "runtime.in"
addFunc(ve, run::gen_runtime33, primString() , SYM(hex), formal(primPen(), SYM(p), false, false));
-#line 435 "runtime.in"
+#line 438 "runtime.in"
addFunc(ve, run::gen_runtime34, primInt(), SYM(byte), formal(primReal(), SYM(x), false, false));
-#line 440 "runtime.in"
+#line 443 "runtime.in"
addFunc(ve, run::gen_runtime35, primString() , SYM(colorspace), formal(primPen(), SYM(p), false, false));
-#line 447 "runtime.in"
+#line 450 "runtime.in"
addFunc(ve, run::gen_runtime36, primPen(), SYM(pattern), formal(primString(), SYM(s), false, false));
-#line 452 "runtime.in"
+#line 455 "runtime.in"
addFunc(ve, run::gen_runtime37, primString() , SYM(pattern), formal(primPen(), SYM(p), false, false));
-#line 457 "runtime.in"
+#line 460 "runtime.in"
addFunc(ve, run::gen_runtime38, primPen(), SYM(fillrule), formal(primInt(), SYM(n), false, false));
-#line 462 "runtime.in"
+#line 465 "runtime.in"
addFunc(ve, run::gen_runtime39, primInt(), SYM(fillrule), formal(primPen(), SYM(p), false, false));
-#line 467 "runtime.in"
+#line 470 "runtime.in"
addFunc(ve, run::gen_runtime40, primPen(), SYM(opacity), formal(primReal(), SYM(opacity), true, false), formal(primString() , SYM(blend), true, false));
-#line 477 "runtime.in"
+#line 480 "runtime.in"
addFunc(ve, run::gen_runtime41, primReal(), SYM(opacity), formal(primPen(), SYM(p), false, false));
-#line 482 "runtime.in"
+#line 485 "runtime.in"
addFunc(ve, run::gen_runtime42, primString() , SYM(blend), formal(primPen(), SYM(p), false, false));
-#line 487 "runtime.in"
+#line 490 "runtime.in"
addFunc(ve, run::gen_runtime43, primPen(), SYM(linetype), formal(realArray(), SYM(pattern), false, false), formal(primReal(), SYM(offset), true, false), formal(primBoolean(), SYM(scale), true, false), formal(primBoolean(), SYM(adjust), true, false));
-#line 498 "runtime.in"
+#line 501 "runtime.in"
addFunc(ve, run::gen_runtime44, realArray(), SYM(linetype), formal(primPen(), SYM(p), true, false));
-#line 504 "runtime.in"
+#line 507 "runtime.in"
addFunc(ve, run::gen_runtime45, primReal(), SYM(offset), formal(primPen(), SYM(p), false, false));
-#line 509 "runtime.in"
+#line 512 "runtime.in"
addFunc(ve, run::gen_runtime46, primBoolean(), SYM(scale), formal(primPen(), SYM(p), false, false));
-#line 514 "runtime.in"
+#line 517 "runtime.in"
addFunc(ve, run::gen_runtime47, primBoolean(), SYM(adjust), formal(primPen(), SYM(p), false, false));
-#line 519 "runtime.in"
+#line 522 "runtime.in"
addFunc(ve, run::gen_runtime48, primPen(), SYM(adjust), formal(primPen(), SYM(p), false, false), formal(primReal(), SYM(arclength), false, false), formal(primBoolean(), SYM(cyclic), false, false));
-#line 524 "runtime.in"
+#line 527 "runtime.in"
addFunc(ve, run::gen_runtime49, primPen(), SYM(linecap), formal(primInt(), SYM(n), false, false));
-#line 529 "runtime.in"
+#line 532 "runtime.in"
addFunc(ve, run::gen_runtime50, primInt(), SYM(linecap), formal(primPen(), SYM(p), true, false));
-#line 534 "runtime.in"
+#line 537 "runtime.in"
addFunc(ve, run::gen_runtime51, primPen(), SYM(linejoin), formal(primInt(), SYM(n), false, false));
-#line 539 "runtime.in"
+#line 542 "runtime.in"
addFunc(ve, run::gen_runtime52, primInt(), SYM(linejoin), formal(primPen(), SYM(p), true, false));
-#line 544 "runtime.in"
+#line 547 "runtime.in"
addFunc(ve, run::gen_runtime53, primPen(), SYM(miterlimit), formal(primReal(), SYM(x), false, false));
-#line 549 "runtime.in"
+#line 552 "runtime.in"
addFunc(ve, run::gen_runtime54, primReal(), SYM(miterlimit), formal(primPen(), SYM(p), true, false));
-#line 554 "runtime.in"
+#line 557 "runtime.in"
addFunc(ve, run::gen_runtime55, primPen(), SYM(linewidth), formal(primReal(), SYM(x), false, false));
-#line 559 "runtime.in"
+#line 562 "runtime.in"
addFunc(ve, run::gen_runtime56, primReal(), SYM(linewidth), formal(primPen(), SYM(p), true, false));
-#line 564 "runtime.in"
+#line 567 "runtime.in"
addFunc(ve, run::gen_runtime57, primPen(), SYM(fontcommand), formal(primString(), SYM(s), false, false));
-#line 569 "runtime.in"
+#line 572 "runtime.in"
addFunc(ve, run::gen_runtime58, primString() , SYM(font), formal(primPen(), SYM(p), true, false));
-#line 574 "runtime.in"
+#line 577 "runtime.in"
addFunc(ve, run::gen_runtime59, primPen(), SYM(fontsize), formal(primReal(), SYM(size), false, false), formal(primReal(), SYM(lineskip), false, false));
-#line 580 "runtime.in"
+#line 583 "runtime.in"
addFunc(ve, run::gen_runtime60, primReal(), SYM(fontsize), formal(primPen(), SYM(p), true, false));
-#line 585 "runtime.in"
+#line 588 "runtime.in"
addFunc(ve, run::gen_runtime61, primReal(), SYM(lineskip), formal(primPen(), SYM(p), true, false));
-#line 590 "runtime.in"
+#line 593 "runtime.in"
addFunc(ve, run::gen_runtime62, primPen(), SYM(overwrite), formal(primInt(), SYM(n), false, false));
-#line 596 "runtime.in"
+#line 599 "runtime.in"
addFunc(ve, run::gen_runtime63, primInt(), SYM(overwrite), formal(primPen(), SYM(p), true, false));
-#line 601 "runtime.in"
+#line 604 "runtime.in"
addFunc(ve, run::gen_runtime64, primPen(), SYM(basealign), formal(primInt(), SYM(n), false, false));
-#line 606 "runtime.in"
+#line 609 "runtime.in"
addFunc(ve, run::gen_runtime65, primInt(), SYM(basealign), formal(primPen(), SYM(p), true, false));
-#line 611 "runtime.in"
+#line 614 "runtime.in"
addFunc(ve, run::gen_runtime66, primTransform(), SYM(transform), formal(primPen(), SYM(p), false, false));
-#line 616 "runtime.in"
+#line 619 "runtime.in"
addFunc(ve, run::gen_runtime67, primPath(), SYM(nib), formal(primPen(), SYM(p), false, false));
-#line 621 "runtime.in"
+#line 624 "runtime.in"
addFunc(ve, run::gen_runtime68, primPen(), SYM(makepen), formal(primPath(), SYM(p), false, false));
-#line 626 "runtime.in"
+#line 629 "runtime.in"
addFunc(ve, run::gen_runtime69, primPen(), SYM(colorless), formal(primPen(), SYM(p), false, false));
-#line 632 "runtime.in"
+#line 635 "runtime.in"
addFunc(ve, run::gen_runtime70, primBoolean(), SYM(interactive));
-#line 639 "runtime.in"
+#line 642 "runtime.in"
addFunc(ve, run::gen_runtime71, primBoolean(), SYM(uptodate));
-#line 644 "runtime.in"
+#line 647 "runtime.in"
addFunc(ve, run::gen_runtime72, primInt(), SYM(system), formal(stringArray(), SYM(s), false, false));
-#line 658 "runtime.in"
+#line 661 "runtime.in"
addFunc(ve, run::gen_runtime73, primBoolean(), SYM(view));
-#line 663 "runtime.in"
+#line 666 "runtime.in"
addFunc(ve, run::gen_runtime74, primString() , SYM(asydir));
-#line 668 "runtime.in"
+#line 671 "runtime.in"
addFunc(ve, run::gen_runtime75, primString() , SYM(locale), formal(primString() , SYM(s), true, false));
-#line 674 "runtime.in"
+#line 677 "runtime.in"
addFunc(ve, run::gen_runtime76, primVoid(), SYM(abort), formal(primString() , SYM(s), true, false));
-#line 680 "runtime.in"
+#line 683 "runtime.in"
addFunc(ve, run::gen_runtime77, primVoid(), SYM(exit));
-#line 685 "runtime.in"
+#line 688 "runtime.in"
addFunc(ve, run::gen_runtime78, primVoid(), SYM(assert), formal(primBoolean(), SYM(b), false, false), formal(primString() , SYM(s), true, false));
-#line 696 "runtime.in"
+#line 699 "runtime.in"
addFunc(ve, run::gen_runtime79, primVoid(), SYM(sleep), formal(primInt(), SYM(seconds), false, false));
-#line 702 "runtime.in"
+#line 705 "runtime.in"
addFunc(ve, run::gen_runtime80, primVoid(), SYM(usleep), formal(primInt(), SYM(microseconds), false, false));
-#line 708 "runtime.in"
+#line 711 "runtime.in"
addFunc(ve, run::gen_runtime81, primVoid(), SYM(_eval), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false), formal(primBoolean(), SYM(interactivewrite), true, false));
-#line 721 "runtime.in"
+#line 724 "runtime.in"
addFunc(ve, run::gen_runtime82, primVoid(), SYM(_eval), formal(primCode(), SYM(s), false, false), formal(primBoolean(), SYM(embedded), false, false));
-#line 737 "runtime.in"
+#line 740 "runtime.in"
addFunc(ve, run::gen_runtime83, primString() , SYM(location));
-#line 743 "runtime.in"
+#line 746 "runtime.in"
REGISTER_BLTIN(run::loadModule,"loadModule");
-#line 749 "runtime.in"
+#line 752 "runtime.in"
addFunc(ve, run::gen_runtime85, primString() , SYM(cd), formal(primString() , SYM(s), true, false));
-#line 759 "runtime.in"
+#line 762 "runtime.in"
addFunc(ve, run::gen_runtime86, primVoid(), SYM(list), formal(primString(), SYM(s), false, false), formal(primBoolean(), SYM(imports), true, false));
-#line 768 "runtime.in"
+#line 771 "runtime.in"
REGISTER_BLTIN(run::nullGuide,"nullGuide");
-#line 776 "runtime.in"
+#line 779 "runtime.in"
REGISTER_BLTIN(run::dotsGuide,"dotsGuide");
-#line 786 "runtime.in"
+#line 789 "runtime.in"
REGISTER_BLTIN(run::dashesGuide,"dashesGuide");
-#line 813 "runtime.in"
+#line 816 "runtime.in"
REGISTER_BLTIN(run::newCycleToken,"newCycleToken");
-#line 818 "runtime.in"
+#line 821 "runtime.in"
addFunc(ve, run::gen_runtime91, primGuide(), symbol::trans("operator cast"), formal(primCycleToken(), SYM(tok), false, false));
-#line 825 "runtime.in"
+#line 828 "runtime.in"
addFunc(ve, run::gen_runtime92, primGuide(), symbol::trans("operator spec"), formal(primPair(), SYM(z), false, false), formal(primInt(), SYM(p), false, false));
-#line 833 "runtime.in"
+#line 836 "runtime.in"
addFunc(ve, run::gen_runtime93, primCurlSpecifier(), SYM_CURL, formal(primReal(), SYM(gamma), false, false), formal(primInt(), SYM(p), false, false));
-#line 839 "runtime.in"
+#line 842 "runtime.in"
REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart");
-#line 844 "runtime.in"
+#line 847 "runtime.in"
REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart");
-#line 849 "runtime.in"
+#line 852 "runtime.in"
addFunc(ve, run::gen_runtime96, primGuide(), symbol::trans("operator cast"), formal(primCurlSpecifier(), SYM(spec), false, false));
-#line 854 "runtime.in"
+#line 857 "runtime.in"
addFunc(ve, run::gen_runtime97, primTensionSpecifier(), SYM_TENSION, formal(primReal(), SYM(tout), false, false), formal(primReal(), SYM(tin), false, false), formal(primBoolean(), SYM(atleast), false, false));
-#line 859 "runtime.in"
+#line 862 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart");
-#line 864 "runtime.in"
+#line 867 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart");
-#line 869 "runtime.in"
+#line 872 "runtime.in"
REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart");
-#line 874 "runtime.in"
+#line 877 "runtime.in"
addFunc(ve, run::gen_runtime101, primGuide(), symbol::trans("operator cast"), formal(primTensionSpecifier(), SYM(t), false, false));
-#line 879 "runtime.in"
+#line 882 "runtime.in"
addFunc(ve, run::gen_runtime102, primGuide(), SYM_CONTROLS, formal(primPair(), SYM(zout), false, false), formal(primPair(), SYM(zin), false, false));
-#line 884 "runtime.in"
+#line 887 "runtime.in"
addFunc(ve, run::gen_runtime103, primInt(), SYM(size), formal(primGuide(), SYM(g), false, false));
-#line 891 "runtime.in"
+#line 894 "runtime.in"
addFunc(ve, run::gen_runtime104, primInt(), SYM(length), formal(primGuide(), SYM(g), false, false));
-#line 898 "runtime.in"
+#line 901 "runtime.in"
addFunc(ve, run::gen_runtime105, primBoolean(), SYM(cyclic), formal(primGuide(), SYM(g), false, false));
-#line 905 "runtime.in"
+#line 908 "runtime.in"
addFunc(ve, run::gen_runtime106, primPair(), SYM(point), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 912 "runtime.in"
+#line 915 "runtime.in"
addFunc(ve, run::gen_runtime107, pairArray(), SYM(dirSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 924 "runtime.in"
+#line 927 "runtime.in"
addFunc(ve, run::gen_runtime108, pairArray(), SYM(controlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 941 "runtime.in"
+#line 944 "runtime.in"
addFunc(ve, run::gen_runtime109, primTensionSpecifier(), SYM(tensionSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 951 "runtime.in"
+#line 954 "runtime.in"
addFunc(ve, run::gen_runtime110, realArray(), SYM(curlSpecifier), formal(primGuide(), SYM(g), false, false), formal(primInt(), SYM(t), false, false));
-#line 965 "runtime.in"
+#line 968 "runtime.in"
addFunc(ve, run::gen_runtime111, primGuide(), SYM(reverse), formal(primGuide(), SYM(g), false, false));
-#line 1018 "runtime.in"
+#line 1021 "runtime.in"
addFunc(ve, run::gen_runtime112, realArray(), SYM(_cputime));
-#line 1032 "runtime.in"
+#line 1035 "runtime.in"
addFunc(ve, run::gen_runtime113, primBoolean(), SYM_EQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1040 "runtime.in"
+#line 1043 "runtime.in"
addFunc(ve, run::gen_runtime114, primBoolean(), SYM_NEQ, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1045 "runtime.in"
+#line 1048 "runtime.in"
addFunc(ve, run::gen_runtime115, primTransform(), SYM_PLUS, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1050 "runtime.in"
+#line 1053 "runtime.in"
addFunc(ve, run::gen_runtime116, primTransform(), SYM_TIMES, formal(primTransform(), SYM(a), false, false), formal(primTransform(), SYM(b), false, false));
-#line 1055 "runtime.in"
+#line 1058 "runtime.in"
addFunc(ve, run::gen_runtime117, primPair(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(z), false, false));
-#line 1060 "runtime.in"
+#line 1063 "runtime.in"
addFunc(ve, run::gen_runtime118, primPath(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPath(), SYM(g), false, false));
-#line 1065 "runtime.in"
+#line 1068 "runtime.in"
addFunc(ve, run::gen_runtime119, primPen(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPen(), SYM(p), false, false));
-#line 1070 "runtime.in"
+#line 1073 "runtime.in"
addFunc(ve, run::gen_runtime120, primPicture(), SYM_TIMES, formal(primTransform(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false));
-#line 1075 "runtime.in"
+#line 1078 "runtime.in"
addFunc(ve, run::gen_runtime121, primPicture(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primPicture(), SYM(f), false, false));
-#line 1080 "runtime.in"
+#line 1083 "runtime.in"
addFunc(ve, run::gen_runtime122, primTransform(), SYM_CARET, formal(primTransform(), SYM(t), false, false), formal(primInt(), SYM(n), false, false));
-#line 1091 "runtime.in"
+#line 1094 "runtime.in"
REGISTER_BLTIN(run::transformXPart,"transformXPart");
-#line 1096 "runtime.in"
+#line 1099 "runtime.in"
REGISTER_BLTIN(run::transformYPart,"transformYPart");
-#line 1101 "runtime.in"
+#line 1104 "runtime.in"
REGISTER_BLTIN(run::transformXXPart,"transformXXPart");
-#line 1106 "runtime.in"
+#line 1109 "runtime.in"
REGISTER_BLTIN(run::transformXYPart,"transformXYPart");
-#line 1111 "runtime.in"
+#line 1114 "runtime.in"
REGISTER_BLTIN(run::transformYXPart,"transformYXPart");
-#line 1116 "runtime.in"
+#line 1119 "runtime.in"
REGISTER_BLTIN(run::transformYYPart,"transformYYPart");
-#line 1121 "runtime.in"
+#line 1124 "runtime.in"
REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform");
-#line 1127 "runtime.in"
+#line 1130 "runtime.in"
addFunc(ve, run::gen_runtime130, primTransform(), SYM(shift), formal(primTransform(), SYM(t), false, false));
-#line 1132 "runtime.in"
+#line 1135 "runtime.in"
addFunc(ve, run::gen_runtime131, primTransform(), SYM(shiftless), formal(primTransform(), SYM(t), false, false));
-#line 1137 "runtime.in"
+#line 1140 "runtime.in"
addFunc(ve, run::transformIdentity, primTransform(), SYM(identity));
-#line 1142 "runtime.in"
+#line 1145 "runtime.in"
addFunc(ve, run::gen_runtime133, primTransform(), SYM(inverse), formal(primTransform(), SYM(t), false, false));
-#line 1147 "runtime.in"
+#line 1150 "runtime.in"
addFunc(ve, run::gen_runtime134, primTransform(), SYM(shift), formal(primPair(), SYM(z), false, false));
-#line 1152 "runtime.in"
+#line 1155 "runtime.in"
addFunc(ve, run::gen_runtime135, primTransform(), SYM(shift), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false));
-#line 1157 "runtime.in"
+#line 1160 "runtime.in"
addFunc(ve, run::gen_runtime136, primTransform(), SYM(xscale), formal(primReal(), SYM(x), false, false));
-#line 1162 "runtime.in"
+#line 1165 "runtime.in"
addFunc(ve, run::gen_runtime137, primTransform(), SYM(yscale), formal(primReal(), SYM(y), false, false));
-#line 1167 "runtime.in"
+#line 1170 "runtime.in"
addFunc(ve, run::gen_runtime138, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false));
-#line 1172 "runtime.in"
+#line 1175 "runtime.in"
addFunc(ve, run::gen_runtime139, primTransform(), SYM(scale), formal(primReal(), SYM(x), false, false), formal(primReal(), SYM(y), false, false));
-#line 1177 "runtime.in"
+#line 1180 "runtime.in"
addFunc(ve, run::gen_runtime140, primTransform(), SYM(slant), formal(primReal(), SYM(s), false, false));
-#line 1182 "runtime.in"
+#line 1185 "runtime.in"
addFunc(ve, run::gen_runtime141, primTransform(), SYM(rotate), formal(primReal(), SYM(angle), false, false), formal(primPair(), SYM(z), true, false));
-#line 1187 "runtime.in"
+#line 1190 "runtime.in"
addFunc(ve, run::gen_runtime142, primTransform(), SYM(reflect), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false));
}
diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in
index 56ab4d8447f..9b508abed2e 100644
--- a/Build/source/utils/asymptote/runtime.in
+++ b/Build/source/utils/asymptote/runtime.in
@@ -100,6 +100,9 @@ using namespace vm;
using namespace camp;
using namespace settings;
+#undef OUT
+#undef IN
+
namespace run {
using camp::pair;
using vm::array;
@@ -434,7 +437,7 @@ string hex(pen p)
Int byte(real x)
{
- return byte(x);
+ return camp::byte(x);
}
string colorspace(pen p)
@@ -786,8 +789,8 @@ guide* :dotsGuide(guidearray *a)
guide* :dashesGuide(guidearray *a)
{
static camp::curlSpec curly;
- static specguide curlout(&curly, camp::OUT);
- static specguide curlin(&curly, camp::IN);
+ static camp::specguide curlout(&curly, camp::OUT);
+ static camp::specguide curlin(&curly, camp::IN);
size_t n=checkArray(a);
diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc
index ba4c980cb23..05248ef4155 100644
--- a/Build/source/utils/asymptote/settings.cc
+++ b/Build/source/utils/asymptote/settings.cc
@@ -97,6 +97,7 @@ string defaultPDFViewer="open";
string defaultPDFViewer="acroread";
#endif
string defaultGhostscript="gs";
+string defaultGhostscriptLibrary="/usr/lib/libgs.so";
string defaultDisplay="display";
string defaultAnimate="animate";
void queryRegistry() {}
@@ -112,7 +113,8 @@ const char pathSeparator=';';
string defaultPSViewer="cmd";
//string defaultPDFViewer="AcroRd32.exe";
string defaultPDFViewer="cmd";
-string defaultGhostscript="gswin32c.exe";
+string defaultGhostscript;
+string defaultGhostscriptLibrary;
//string defaultDisplay="imdisplay";
string defaultDisplay="cmd";
//string defaultAnimate="animate";
@@ -124,7 +126,7 @@ const string dirsep="\\";
// Use key to look up an entry in the MSWindows registry, respecting wild cards
string getEntry(const string& location, const string& key)
{
- string path="/proc/registry/"+location+key;
+ string path="/proc/registry"+location+key;
size_t star;
string head;
while((star=path.find("*")) < string::npos) {
@@ -172,17 +174,22 @@ string getEntry(const string& location, const string& key)
// Use key to look up an entry in the MSWindows registry, respecting wild cards
string getEntry(const string& key)
{
- string entry=getEntry("HKEY_CURRENT_USER/Software/",key);
- if(entry.empty()) entry=getEntry("HKEY_LOCAL_MACHINE/SOFTWARE/",key);
+ string entry=getEntry("64/HKEY_CURRENT_USER/Software/",key);
+ if(entry.empty()) entry=getEntry("64/HKEY_LOCAL_MACHINE/SOFTWARE/",key);
+ if(entry.empty()) entry=getEntry("/HKEY_CURRENT_USER/Software/",key);
+ if(entry.empty()) entry=getEntry("/HKEY_LOCAL_MACHINE/SOFTWARE/",key);
return entry;
}
void queryRegistry()
{
- string gs=getEntry("GPL Ghostscript/*/GS_DLL");
- if(gs.empty())
- gs=getEntry("AFPL Ghostscript/*/GS_DLL");
- defaultGhostscript=stripFile(gs)+defaultGhostscript;
+ defaultGhostscriptLibrary=getEntry("GPL Ghostscript/*/GS_DLL");
+ if(defaultGhostscriptLibrary.empty())
+ defaultGhostscriptLibrary=getEntry("AFPL Ghostscript/*/GS_DLL");
+
+ string gslib=stripDir(defaultGhostscriptLibrary);
+ defaultGhostscript=stripFile(defaultGhostscriptLibrary)+
+ ((gslib.empty() || gslib.substr(5,2) == "32") ? "gswin32c.exe" : "gswin64c.exe");
if(defaultPDFViewer != "cmd")
defaultPDFViewer=getEntry("Adobe/Acrobat Reader/*/InstallPath/@")+"\\"+
defaultPDFViewer;
@@ -207,6 +214,9 @@ char *argv0;
// The verbosity setting, a global variable.
Int verbose;
+
+// Conserve memory at the expense of speed.
+bool compact;
// Colorspace conversion flags (stored in global variables for efficiency).
bool gray;
@@ -754,12 +764,12 @@ struct boolrefSetting : public refSetting<bool> {
bool Default=false)
: refSetting<bool>(name, code, noarg, desc,
types::primBoolean(), ref, Default) {}
- bool getOption() {
+ virtual bool getOption() {
*ref=true;
return true;
}
- option *negation(string name) {
+ virtual option *negation(string name) {
struct negOption : public option {
boolrefSetting &base;
@@ -784,6 +794,21 @@ struct boolrefSetting : public refSetting<bool> {
}
};
+struct compactSetting : public boolrefSetting {
+ compactSetting(string name, char code, string desc, bool *ref,
+ bool Default=false)
+ : boolrefSetting(name,code,desc,ref,Default) {}
+ bool getOption() {
+ mem::compact(1);
+ return boolrefSetting::getOption();
+ }
+
+ option *negation(string name) {
+ mem::compact(0);
+ return boolrefSetting::negation(name);
+ }
+};
+
struct incrementSetting : public refSetting<Int> {
incrementSetting(string name, char code, string desc, Int *ref)
: refSetting<Int>(name, code, noarg, desc,
@@ -1189,9 +1214,9 @@ void initSettings() {
&startpath));
#ifdef USEGC
- addOption(new boolrefSetting("compact", 0,
+ addOption(new compactSetting("compact", 0,
"Conserve memory at the expense of speed",
- (bool *) &GC_dont_expand));
+ &compact));
addOption(new divisorOption("divisor", 0, "n",
"Garbage collect using purge(divisor=n) [2]"));
#endif
@@ -1272,6 +1297,7 @@ void initSettings() {
addOption(new envSetting("pdfviewer", defaultPDFViewer));
addOption(new envSetting("psviewer", defaultPSViewer));
addOption(new envSetting("gs", defaultGhostscript));
+ addOption(new envSetting("libgs", defaultGhostscriptLibrary));
addOption(new envSetting("texpath", ""));
addOption(new envSetting("texcommand", ""));
addOption(new envSetting("dvips", "dvips"));
diff --git a/Build/source/utils/asymptote/settings.h b/Build/source/utils/asymptote/settings.h
index 77725cde544..021503afde2 100644
--- a/Build/source/utils/asymptote/settings.h
+++ b/Build/source/utils/asymptote/settings.h
@@ -75,6 +75,7 @@ inline T getSetting(string name)
}
extern Int verbose;
+extern bool compact;
extern bool gray;
extern bool bw;
extern bool rgb;
diff --git a/Build/source/utils/asymptote/symbol.h b/Build/source/utils/asymptote/symbol.h
index 30ebe54fcc5..bcfed4f6307 100644
--- a/Build/source/utils/asymptote/symbol.h
+++ b/Build/source/utils/asymptote/symbol.h
@@ -27,7 +27,7 @@ struct GCInit {
GCInit() {
#ifdef USEGC
GC_set_free_space_divisor(2);
- GC_dont_expand=0;
+ mem::compact(0);
GC_INIT();
#endif
diff --git a/Build/source/utils/asymptote/tests/types/guide.asy b/Build/source/utils/asymptote/tests/types/guide.asy
index 77400fcfbbf..ec16e0ed7ce 100644
--- a/Build/source/utils/asymptote/tests/types/guide.asy
+++ b/Build/source/utils/asymptote/tests/types/guide.asy
@@ -140,5 +140,21 @@ pair[] z=controlSpecifier(g,0);
assert(close(z[0],(4,6)));
assert(close(z[1],(3,5)));
+// Test building guides in loops.
+int N = 100;
+guide g;
+for (int i = 0; i < N; ++i)
+ g = g--(i,i^2);
+path p=g;
+for (int i = 0; i < N; ++i)
+ assert(point(p, i) == (i,i^2));
+
+int N = 100;
+guide g;
+for (int i = 0; i < N; ++i)
+ g = (i,i^2)--g;
+path p=g;
+for (int i = N-1, j = 0; i >= 0; --i, ++j)
+ assert(point(p, j) == (i,i^2));
EndTest();