summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
committerKarl Berry <karl@freefriends.org>2009-08-15 23:57:48 +0000
commit16d128e5e10d541a78654b86409d5a3539f07708 (patch)
tree66de0af63c3811bb3040c16e9b52c11985f70811
parentb20f78c549859ec0e8610bdd3ad904245e86b489 (diff)
asymptote 1.83
git-svn-id: svn://tug.org/texlive/trunk@14696 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/utils/asymptote/ChangeLog716
-rw-r--r--Build/source/utils/asymptote/INSTALL2
-rw-r--r--Build/source/utils/asymptote/Makefile.in11
-rw-r--r--Build/source/utils/asymptote/ReleaseNotes23
-rw-r--r--Build/source/utils/asymptote/TODO13
-rw-r--r--Build/source/utils/asymptote/access.cc2
-rw-r--r--Build/source/utils/asymptote/application.cc11
-rw-r--r--Build/source/utils/asymptote/application.h33
-rw-r--r--Build/source/utils/asymptote/asymptote.spec2
-rw-r--r--Build/source/utils/asymptote/backtrace.cc84
-rw-r--r--Build/source/utils/asymptote/backtrace.h8
-rw-r--r--Build/source/utils/asymptote/backtrace.in32
-rw-r--r--Build/source/utils/asymptote/base/animation.asy71
-rw-r--r--Build/source/utils/asymptote/base/bezulate.asy2
-rw-r--r--Build/source/utils/asymptote/base/geometry.asy56
-rw-r--r--Build/source/utils/asymptote/base/graph.asy4
-rw-r--r--Build/source/utils/asymptote/base/graph3.asy208
-rw-r--r--Build/source/utils/asymptote/base/graph_splinetype.asy251
-rw-r--r--Build/source/utils/asymptote/base/interpolate.asy2
-rw-r--r--Build/source/utils/asymptote/base/labelpath.asy2
-rw-r--r--Build/source/utils/asymptote/base/labelpath3.asy4
-rw-r--r--Build/source/utils/asymptote/base/obj.asy6
-rw-r--r--Build/source/utils/asymptote/base/plain.asy9
-rw-r--r--Build/source/utils/asymptote/base/plain_Label.asy8
-rw-r--r--Build/source/utils/asymptote/base/plain_arrows.asy47
-rw-r--r--Build/source/utils/asymptote/base/plain_boxes.asy4
-rw-r--r--Build/source/utils/asymptote/base/plain_constants.asy7
-rw-r--r--Build/source/utils/asymptote/base/plain_paths.asy2
-rw-r--r--Build/source/utils/asymptote/base/plain_pens.asy4
-rw-r--r--Build/source/utils/asymptote/base/plain_picture.asy106
-rw-r--r--Build/source/utils/asymptote/base/plain_shipout.asy10
-rw-r--r--Build/source/utils/asymptote/base/slide.asy75
-rw-r--r--Build/source/utils/asymptote/base/solids.asy3
-rw-r--r--Build/source/utils/asymptote/base/syzygy.asy10
-rw-r--r--Build/source/utils/asymptote/base/three.asy719
-rw-r--r--Build/source/utils/asymptote/base/three_arrows.asy84
-rw-r--r--Build/source/utils/asymptote/base/three_light.asy113
-rw-r--r--Build/source/utils/asymptote/base/three_surface.asy812
-rw-r--r--Build/source/utils/asymptote/base/three_tube.asy373
-rw-r--r--Build/source/utils/asymptote/base/tree.asy4
-rw-r--r--Build/source/utils/asymptote/base/trembling.asy2
-rw-r--r--Build/source/utils/asymptote/base/tube.asy63
-rw-r--r--Build/source/utils/asymptote/builtin.cc59
-rw-r--r--Build/source/utils/asymptote/builtin.h2
-rw-r--r--Build/source/utils/asymptote/callable.cc23
-rw-r--r--Build/source/utils/asymptote/callable.h17
-rw-r--r--Build/source/utils/asymptote/coder.cc46
-rw-r--r--Build/source/utils/asymptote/coder.h16
-rwxr-xr-xBuild/source/utils/asymptote/configure28
-rw-r--r--Build/source/utils/asymptote/configure.ac12
-rw-r--r--Build/source/utils/asymptote/constructor.cc5
-rw-r--r--Build/source/utils/asymptote/dec.cc2
-rw-r--r--Build/source/utils/asymptote/doc/CAD.pdfbin67399 -> 67399 bytes
-rw-r--r--Build/source/utils/asymptote/doc/FAQ/asy-faq.info2
-rw-r--r--Build/source/utils/asymptote/doc/asy.16
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.pdfbin1565588 -> 1567201 bytes
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.sty7
-rw-r--r--Build/source/utils/asymptote/doc/asymptote.texi182
-rw-r--r--Build/source/utils/asymptote/doc/diatom.asy2
-rw-r--r--Build/source/utils/asymptote/doc/filegraph.asy4
-rw-r--r--Build/source/utils/asymptote/doc/leastsquares.asy4
-rw-r--r--Build/source/utils/asymptote/doc/options2
-rw-r--r--Build/source/utils/asymptote/doc/png/Makefile.in2
-rw-r--r--Build/source/utils/asymptote/doc/png/asymptote.info890
-rw-r--r--Build/source/utils/asymptote/doc/secondaryaxis.asy4
-rw-r--r--Build/source/utils/asymptote/doc/westnile.asy4
-rw-r--r--Build/source/utils/asymptote/drawclipbegin.h20
-rw-r--r--Build/source/utils/asymptote/drawclipend.h13
-rw-r--r--Build/source/utils/asymptote/drawelement.h6
-rw-r--r--Build/source/utils/asymptote/drawpath3.h7
-rw-r--r--Build/source/utils/asymptote/drawsurface.cc57
-rw-r--r--Build/source/utils/asymptote/drawsurface.h24
-rw-r--r--Build/source/utils/asymptote/errormsg.cc9
-rw-r--r--Build/source/utils/asymptote/errormsg.h6
-rw-r--r--Build/source/utils/asymptote/examples/BezierSurface.asy40
-rw-r--r--Build/source/utils/asymptote/examples/Klein.asy41
-rw-r--r--Build/source/utils/asymptote/examples/animations/earthmoon.asy17
-rw-r--r--Build/source/utils/asymptote/examples/animations/glmovie.asy21
-rw-r--r--Build/source/utils/asymptote/examples/animations/inlinemovie3.tex3
-rw-r--r--Build/source/utils/asymptote/examples/animations/sphere.asy2
-rw-r--r--Build/source/utils/asymptote/examples/cylinder.asy1
-rw-r--r--Build/source/utils/asymptote/examples/filesurface.asy4
-rw-r--r--Build/source/utils/asymptote/examples/galleon.asy2
-rw-r--r--Build/source/utils/asymptote/examples/label3.asy1
-rw-r--r--Build/source/utils/asymptote/examples/label3ribbon.asy1
-rw-r--r--Build/source/utils/asymptote/examples/label3solid.asy1
-rw-r--r--Build/source/utils/asymptote/examples/parametricsurface.asy7
-rw-r--r--Build/source/utils/asymptote/examples/pipeintersection.asy1
-rw-r--r--Build/source/utils/asymptote/examples/projectelevation.asy1
-rw-r--r--Build/source/utils/asymptote/examples/randompath3.asy1
-rw-r--r--Build/source/utils/asymptote/examples/slidedemo.asy1
-rw-r--r--Build/source/utils/asymptote/examples/slidedemo_.bbl2
-rw-r--r--Build/source/utils/asymptote/examples/smoothelevation.asy2
-rw-r--r--Build/source/utils/asymptote/examples/soccerball.asy4
-rw-r--r--Build/source/utils/asymptote/examples/spectrum.asy79
-rw-r--r--Build/source/utils/asymptote/examples/sphericalharmonic.asy1
-rw-r--r--Build/source/utils/asymptote/examples/spiral3.asy19
-rw-r--r--Build/source/utils/asymptote/examples/teapot.asy351
-rw-r--r--Build/source/utils/asymptote/examples/tensor.asy6
-rw-r--r--Build/source/utils/asymptote/examples/torus.asy13
-rw-r--r--Build/source/utils/asymptote/examples/trumpet.asy2
-rw-r--r--Build/source/utils/asymptote/examples/xsin1x.asy8
-rw-r--r--Build/source/utils/asymptote/exp.cc2
-rw-r--r--Build/source/utils/asymptote/frame.h13
-rw-r--r--Build/source/utils/asymptote/fundec.cc4
-rw-r--r--Build/source/utils/asymptote/fundec.h11
-rw-r--r--Build/source/utils/asymptote/genv.cc2
-rw-r--r--Build/source/utils/asymptote/genv.h2
-rw-r--r--Build/source/utils/asymptote/glrender.cc105
-rw-r--r--Build/source/utils/asymptote/inst.h9
-rw-r--r--Build/source/utils/asymptote/item.h27
-rw-r--r--Build/source/utils/asymptote/main.cc11
-rw-r--r--Build/source/utils/asymptote/name.cc17
-rw-r--r--Build/source/utils/asymptote/path3.cc151
-rw-r--r--Build/source/utils/asymptote/path3.h24
-rw-r--r--Build/source/utils/asymptote/picture.cc9
-rw-r--r--Build/source/utils/asymptote/picture.h7
-rw-r--r--Build/source/utils/asymptote/process.cc79
-rw-r--r--Build/source/utils/asymptote/program.cc59
-rw-r--r--Build/source/utils/asymptote/psfile.cc36
-rw-r--r--Build/source/utils/asymptote/psfile.h6
-rw-r--r--Build/source/utils/asymptote/record.cc10
-rw-r--r--Build/source/utils/asymptote/refaccess.cc3
-rw-r--r--Build/source/utils/asymptote/refaccess.h4
-rw-r--r--Build/source/utils/asymptote/runtime.cc5269
-rw-r--r--Build/source/utils/asymptote/runtime.h36
-rw-r--r--Build/source/utils/asymptote/runtime.in368
-rwxr-xr-xBuild/source/utils/asymptote/runtime.pl121
-rw-r--r--Build/source/utils/asymptote/runtimebase.in38
-rw-r--r--Build/source/utils/asymptote/settings.cc33
-rw-r--r--Build/source/utils/asymptote/settings.h2
-rw-r--r--Build/source/utils/asymptote/stack.cc97
-rw-r--r--Build/source/utils/asymptote/stack.h4
-rw-r--r--Build/source/utils/asymptote/stm.cc97
-rw-r--r--Build/source/utils/asymptote/tests/array/delete.asy6
-rw-r--r--Build/source/utils/asymptote/tests/array/fields.asy79
-rw-r--r--Build/source/utils/asymptote/tests/array/slice.asy58
-rw-r--r--Build/source/utils/asymptote/texfile.cc1
-rw-r--r--Build/source/utils/asymptote/texfile.h9
-rw-r--r--Build/source/utils/asymptote/types.cc319
-rw-r--r--Build/source/utils/asymptote/types.h43
-rw-r--r--Build/source/utils/asymptote/util.cc36
-rw-r--r--Build/source/utils/asymptote/util.h9
-rw-r--r--Build/source/utils/asymptote/virtualfieldaccess.cc41
-rw-r--r--Build/source/utils/asymptote/virtualfieldaccess.h49
-rw-r--r--Build/source/utils/asymptote/vm.h12
-rwxr-xr-xMaster/bin/i386-cygwin/asy.exebin5349888 -> 5462016 bytes
-rwxr-xr-xMaster/bin/win32/asy.exebin4096 -> 5462016 bytes
-rwxr-xr-xMaster/texmf/asymptote/GUI/xasyVersion.py2
-rw-r--r--Master/texmf/asymptote/animation.asy71
-rw-r--r--Master/texmf/asymptote/bezulate.asy2
-rw-r--r--Master/texmf/asymptote/geometry.asy56
-rw-r--r--Master/texmf/asymptote/graph.asy4
-rw-r--r--Master/texmf/asymptote/graph3.asy208
-rw-r--r--Master/texmf/asymptote/graph_splinetype.asy251
-rw-r--r--Master/texmf/asymptote/interpolate.asy2
-rw-r--r--Master/texmf/asymptote/labelpath.asy2
-rw-r--r--Master/texmf/asymptote/labelpath3.asy4
-rw-r--r--Master/texmf/asymptote/obj.asy6
-rw-r--r--Master/texmf/asymptote/plain.asy9
-rw-r--r--Master/texmf/asymptote/plain_Label.asy8
-rw-r--r--Master/texmf/asymptote/plain_arrows.asy47
-rw-r--r--Master/texmf/asymptote/plain_boxes.asy4
-rw-r--r--Master/texmf/asymptote/plain_constants.asy7
-rw-r--r--Master/texmf/asymptote/plain_paths.asy2
-rw-r--r--Master/texmf/asymptote/plain_pens.asy4
-rw-r--r--Master/texmf/asymptote/plain_picture.asy106
-rw-r--r--Master/texmf/asymptote/plain_shipout.asy10
-rw-r--r--Master/texmf/asymptote/slide.asy75
-rw-r--r--Master/texmf/asymptote/solids.asy3
-rw-r--r--Master/texmf/asymptote/syzygy.asy10
-rw-r--r--Master/texmf/asymptote/three.asy719
-rw-r--r--Master/texmf/asymptote/three_arrows.asy84
-rw-r--r--Master/texmf/asymptote/three_light.asy113
-rw-r--r--Master/texmf/asymptote/three_surface.asy812
-rw-r--r--Master/texmf/asymptote/three_tube.asy373
-rw-r--r--Master/texmf/asymptote/tree.asy4
-rw-r--r--Master/texmf/asymptote/trembling.asy2
-rw-r--r--Master/texmf/asymptote/tube.asy63
-rw-r--r--Master/texmf/asymptote/version.asy2
-rw-r--r--Master/texmf/doc/info/asy-faq.info2
-rw-r--r--Master/texmf/doc/man/man1/asy.16
-rw-r--r--Master/texmf/tex/latex/asymptote/asymptote.sty23
183 files changed, 9952 insertions, 6553 deletions
diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog
index 099840b402f..b2cc5a3a469 100644
--- a/Build/source/utils/asymptote/ChangeLog
+++ b/Build/source/utils/asymptote/ChangeLog
@@ -1,4 +1,720 @@
------------------------------------------------------------------------
+r4598 | jcbowman | 2009-08-15 01:16:08 -0600 (Sat, 15 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/png/Makefile.in
+
+Fix dependency.
+
+------------------------------------------------------------------------
+r4597 | jcbowman | 2009-08-15 00:28:59 -0600 (Sat, 15 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/asymptote/examples/Klein.asy
+ A /trunk/asymptote/examples/spectrum.asy
+
+Embed parametric equations on Klein bottle.
+
+Add new example.
+
+------------------------------------------------------------------------
+r4596 | jcbowman | 2009-08-15 00:17:32 -0600 (Sat, 15 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/INSTALL
+ M /trunk/asymptote/configure.ac
+
+Improve diagnostics for missing libz library or texi2dvi program.
+
+------------------------------------------------------------------------
+r4595 | jcbowman | 2009-08-14 23:25:57 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_picture.asy
+ M /trunk/asymptote/base/plain_shipout.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_light.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Add light argument to fit() and shipout().
+
+------------------------------------------------------------------------
+r4594 | jcbowman | 2009-08-14 22:36:55 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+
+Remove redundant angle arguments.
+
+------------------------------------------------------------------------
+r4593 | jcbowman | 2009-08-14 21:57:06 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.sty
+ M /trunk/asymptote/doc/asymptote.texi
+
+Remove unwanted quotes from LaTeX jobname.
+
+------------------------------------------------------------------------
+r4592 | jcbowman | 2009-08-14 17:05:07 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/picture.cc
+
+Fix display of generated file names with spaces.
+
+------------------------------------------------------------------------
+r4591 | jcbowman | 2009-08-14 09:05:32 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/types.cc
+ M /trunk/asymptote/types.h
+
+Check only primitive types for virtual file mode members.
+
+------------------------------------------------------------------------
+r4590 | pivaldi | 2009-08-14 08:50:49 -0600 (Fri, 14 Aug 2009) | 1 line
+Changed paths:
+ M /trunk/asymptote/base/geometry.asy
+
+Removing duplicated text of license
+------------------------------------------------------------------------
+r4589 | jcbowman | 2009-08-14 04:19:54 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/obj.asy
+ M /trunk/asymptote/types.cc
+
+Restrict file modes to ty_file.
+
+------------------------------------------------------------------------
+r4588 | jcbowman | 2009-08-14 04:02:48 -0600 (Fri, 14 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/tests/array/delete.asy
+ M /trunk/asymptote/tests/array/fields.asy
+ M /trunk/asymptote/tests/array/slice.asy
+
+Update tests.
+
+------------------------------------------------------------------------
+r4587 | jcbowman | 2009-08-14 03:41:41 -0600 (Fri, 14 Aug 2009) | 3 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/doc/diatom.asy
+ M /trunk/asymptote/doc/filegraph.asy
+ M /trunk/asymptote/doc/leastsquares.asy
+ M /trunk/asymptote/doc/secondaryaxis.asy
+ M /trunk/asymptote/doc/westnile.asy
+ M /trunk/asymptote/examples/filesurface.asy
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/types.cc
+
+Make file mode functions virtual members; this backwards incompatibility
+requires that line(file f) be changed to f.line(), etc.
+
+------------------------------------------------------------------------
+r4586 | jcbowman | 2009-08-13 22:36:05 -0600 (Thu, 13 Aug 2009) | 3 lines
+Changed paths:
+ M /trunk/asymptote/base/geometry.asy
+ M /trunk/asymptote/base/obj.asy
+ M /trunk/asymptote/base/plain_paths.asy
+ M /trunk/asymptote/base/plain_pens.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/base/three_tube.asy
+ M /trunk/asymptote/base/tube.asy
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/examples/galleon.asy
+ M /trunk/asymptote/examples/soccerball.asy
+ M /trunk/asymptote/types.cc
+
+Remove obsolete cyclicflag and void cyclic(bool) functions now that the
+cyclic member of an array is writeable.
+
+------------------------------------------------------------------------
+r4585 | jcbowman | 2009-08-13 22:06:27 -0600 (Thu, 13 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/examples/slidedemo.asy
+ M /trunk/asymptote/examples/slidedemo_.bbl
+
+Don't overwrite viewportmargin.
+
+------------------------------------------------------------------------
+r4584 | jcbowman | 2009-08-12 17:33:31 -0600 (Wed, 12 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/settings.cc
+
+Check ASYMPTOTE_HOME instead of ~/.asy in search path.
+
+------------------------------------------------------------------------
+r4583 | jcbowman | 2009-08-12 16:12:31 -0600 (Wed, 12 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runtime.in
+
+Fix texpath initialization.
+
+------------------------------------------------------------------------
+r4582 | jcbowman | 2009-08-11 01:32:50 -0600 (Tue, 11 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/examples/trumpet.asy
+
+Increase linegranularity.
+
+------------------------------------------------------------------------
+r4581 | jcbowman | 2009-08-10 23:38:34 -0600 (Mon, 10 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Fix splitting indices.
+
+------------------------------------------------------------------------
+r4580 | jcbowman | 2009-08-10 22:28:47 -0600 (Mon, 10 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Fix definition of normal in regularize.
+
+------------------------------------------------------------------------
+r4579 | jcbowman | 2009-08-10 21:27:22 -0600 (Mon, 10 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/examples/spiral3.asy
+
+Improve example.
+
+------------------------------------------------------------------------
+r4578 | jcbowman | 2009-08-10 21:21:17 -0600 (Mon, 10 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/graph3.asy
+ M /trunk/asymptote/base/graph_splinetype.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_arrows.asy
+ M /trunk/asymptote/base/three_light.asy
+ M /trunk/asymptote/base/three_surface.asy
+ A /trunk/asymptote/base/three_tube.asy
+ M /trunk/asymptote/base/tube.asy
+ M /trunk/asymptote/examples/BezierSurface.asy
+ M /trunk/asymptote/examples/cylinder.asy
+ M /trunk/asymptote/examples/randompath3.asy
+ M /trunk/asymptote/examples/sphericalharmonic.asy
+ A /trunk/asymptote/examples/spiral3.asy
+ M /trunk/asymptote/runtime.in
+
+Use splined parametric surfaces to implement smooth thick lines.
+
+------------------------------------------------------------------------
+r4577 | jcbowman | 2009-08-10 11:28:37 -0600 (Mon, 10 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/asymptote/drawclipbegin.h
+ M /trunk/asymptote/drawclipend.h
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/texfile.cc
+ M /trunk/asymptote/texfile.h
+
+Don't nest picture environments used for TeX clipping (not used for ConTeXt
+since the \beginpicture...\endpicture environment is still broken; this
+only affects the clipping of labels outside the bounding box.).
+
+------------------------------------------------------------------------
+r4576 | jcbowman | 2009-08-09 15:47:06 -0600 (Sun, 09 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/tube.asy
+
+Remove private qualifier from rmf.
+
+------------------------------------------------------------------------
+r4575 | jcbowman | 2009-08-09 01:34:45 -0600 (Sun, 09 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_picture.asy
+ M /trunk/asymptote/examples/BezierSurface.asy
+ M /trunk/asymptote/examples/animations/glmovie.asy
+ M /trunk/asymptote/examples/animations/inlinemovie3.tex
+
+Copy transformation T in projection.copy().
+
+------------------------------------------------------------------------
+r4574 | jcbowman | 2009-08-09 00:49:51 -0600 (Sun, 09 Aug 2009) | 14 lines
+Changed paths:
+ M /trunk/asymptote/base/graph3.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_light.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/drawsurface.cc
+ M /trunk/asymptote/drawsurface.h
+ M /trunk/asymptote/examples/label3.asy
+ M /trunk/asymptote/examples/label3ribbon.asy
+ M /trunk/asymptote/examples/label3solid.asy
+ M /trunk/asymptote/examples/parametricsurface.asy
+ M /trunk/asymptote/examples/pipeintersection.asy
+ M /trunk/asymptote/examples/projectelevation.asy
+ M /trunk/asymptote/examples/smoothelevation.asy
+ M /trunk/asymptote/examples/teapot.asy
+ M /trunk/asymptote/examples/tensor.asy
+ M /trunk/asymptote/examples/torus.asy
+ M /trunk/asymptote/psfile.cc
+ M /trunk/asymptote/psfile.h
+ M /trunk/asymptote/runtime.in
+
+Construct patches with the usual orientation for a counterclockwise
+external path; update tensor product shading to be consistent with this
+more sensible convention (rather than the reversed format described in the
+Postscript Language Reference Manual).
+
+Make the default currentlight=Headlamp for consistency with Adobe Reader;
+the previous currentlight is now called Viewport.
+
+Fix uequals, vequals, and surface indices; implement ucyclic() and vcyclic().
+
+Add rendermargin parameter.
+
+Add triple dir(explicit triple) function for consistency.
+
+------------------------------------------------------------------------
+r4573 | jcbowman | 2009-08-08 13:00:47 -0600 (Sat, 08 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_light.asy
+
+Tune Headlamp.
+
+------------------------------------------------------------------------
+r4572 | jcbowman | 2009-08-06 20:38:26 -0600 (Thu, 06 Aug 2009) | 4 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Add labelsurface function.
+
+Add min(frame, projection) and max(frame, projection).
+
+------------------------------------------------------------------------
+r4571 | hammera | 2009-08-04 11:17:53 -0600 (Tue, 04 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runtime.pl
+
+Added more error-checking to runtime.pl.
+
+------------------------------------------------------------------------
+r4570 | jcbowman | 2009-08-04 00:35:17 -0600 (Tue, 04 Aug 2009) | 6 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_picture.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/drawelement.h
+ M /trunk/asymptote/drawpath3.h
+ M /trunk/asymptote/drawsurface.cc
+ M /trunk/asymptote/drawsurface.h
+ M /trunk/asymptote/path3.cc
+ M /trunk/asymptote/path3.h
+ M /trunk/asymptote/picture.cc
+ M /trunk/asymptote/picture.h
+ M /trunk/asymptote/runtime.in
+
+Fix projected bounding box calculation and angle calculation.
+
+Remove viewportfactor and anglefactor; increase angleprecision.
+
+Cache modelview matrix.
+
+------------------------------------------------------------------------
+r4569 | hammera | 2009-08-03 13:48:16 -0600 (Mon, 03 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+ M /trunk/asymptote/genv.cc
+ M /trunk/asymptote/genv.h
+ M /trunk/asymptote/process.cc
+ M /trunk/asymptote/runtime.in
+
+Refactored pushing and popping processData.
+
+------------------------------------------------------------------------
+r4568 | jcbowman | 2009-08-01 14:03:12 -0600 (Sat, 01 Aug 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_picture.asy
+ M /trunk/asymptote/base/tree.asy
+ M /trunk/asymptote/examples/Klein.asy
+
+Simplify example.
+
+------------------------------------------------------------------------
+r4567 | hammera | 2009-07-31 10:39:57 -0600 (Fri, 31 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+
+Removed TODO items I no longer feel like doing.
+
+------------------------------------------------------------------------
+r4566 | hammera | 2009-07-30 14:22:52 -0600 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+ M /trunk/asymptote/builtin.cc
+ M /trunk/asymptote/builtin.h
+
+Removed menv.
+
+------------------------------------------------------------------------
+r4565 | hammera | 2009-07-30 13:19:42 -0600 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+ M /trunk/asymptote/TODO
+ A /trunk/asymptote/backtrace.in
+ M /trunk/asymptote/builtin.cc
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/runtime.pl
+ A /trunk/asymptote/runtimebase.in
+
+Added support for splitting runtime.in into several files.
+
+------------------------------------------------------------------------
+r4564 | jcbowman | 2009-07-30 08:44:44 -0600 (Thu, 30 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/graph.asy
+ A /trunk/asymptote/base/graph_splinetype.asy (from /trunk/asymptote/base/splinetype.asy:4561)
+ M /trunk/asymptote/base/interpolate.asy
+ D /trunk/asymptote/base/splinetype.asy
+
+Rename splinetype.asy to graph_splinetype.asy.
+
+------------------------------------------------------------------------
+r4563 | jcbowman | 2009-07-29 00:36:18 -0600 (Wed, 29 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Add uequals and vequals functions for indexed surfaces.
+
+------------------------------------------------------------------------
+r4562 | jcbowman | 2009-07-29 00:35:28 -0600 (Wed, 29 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runtime.in
+
+Enable getstring with --interactive even if not a tty.
+
+------------------------------------------------------------------------
+r4561 | jcbowman | 2009-07-28 01:17:37 -0600 (Tue, 28 Jul 2009) | 4 lines
+Changed paths:
+ M /trunk/asymptote/base/graph.asy
+ M /trunk/asymptote/base/graph3.asy
+ M /trunk/asymptote/base/labelpath3.asy
+ M /trunk/asymptote/base/splinetype.asy
+ M /trunk/asymptote/base/three_arrows.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/doc/asymptote.texi
+
+Add surface indices.
+
+Add nonuniform parametric surface routine.
+
+------------------------------------------------------------------------
+r4560 | jcbowman | 2009-07-27 14:53:25 -0600 (Mon, 27 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Fix formatting.
+
+------------------------------------------------------------------------
+r4559 | jcbowman | 2009-07-27 14:25:07 -0600 (Mon, 27 Jul 2009) | 3 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+
+Separate code to split a path into nondegenerate Coons patches out of
+surface constructor.
+
+------------------------------------------------------------------------
+r4558 | jcbowman | 2009-07-27 10:17:48 -0600 (Mon, 27 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/examples/animations/glmovie.asy
+ M /trunk/asymptote/examples/animations/inlinemovie3.tex
+
+Generalize extrude.
+
+------------------------------------------------------------------------
+r4557 | hammera | 2009-07-27 00:24:19 -0600 (Mon, 27 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+
+Removed finished TODO item.
+
+------------------------------------------------------------------------
+r4556 | hammera | 2009-07-27 00:23:45 -0600 (Mon, 27 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/application.cc
+ M /trunk/asymptote/application.h
+
+Made more compact bytecode for pushing defualt arguments onto the stack.
+
+------------------------------------------------------------------------
+r4555 | hammera | 2009-07-26 23:55:06 -0600 (Sun, 26 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+ M /trunk/asymptote/builtin.cc
+ M /trunk/asymptote/callable.cc
+ M /trunk/asymptote/callable.h
+ M /trunk/asymptote/coder.cc
+ M /trunk/asymptote/coder.h
+ M /trunk/asymptote/constructor.cc
+ M /trunk/asymptote/dec.cc
+ M /trunk/asymptote/frame.h
+ M /trunk/asymptote/fundec.cc
+ M /trunk/asymptote/fundec.h
+ M /trunk/asymptote/inst.h
+ M /trunk/asymptote/item.h
+ M /trunk/asymptote/process.cc
+ M /trunk/asymptote/program.cc
+ M /trunk/asymptote/record.cc
+ M /trunk/asymptote/stack.cc
+ M /trunk/asymptote/stack.h
+ M /trunk/asymptote/vm.h
+
+Added detailed output for debugging bytecode.
+
+------------------------------------------------------------------------
+r4554 | hammera | 2009-07-26 14:26:02 -0600 (Sun, 26 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/item.h
+ M /trunk/asymptote/program.cc
+ M /trunk/asymptote/stack.cc
+ M /trunk/asymptote/util.cc
+ M /trunk/asymptote/util.h
+
+Changed debugging output for DEBUG_STACK.
+
+------------------------------------------------------------------------
+r4553 | jcbowman | 2009-07-25 23:35:36 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Fix typo.
+
+------------------------------------------------------------------------
+r4552 | jcbowman | 2009-07-25 16:39:31 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/drawsurface.cc
+ M /trunk/asymptote/drawsurface.h
+ M /trunk/asymptote/runtime.in
+
+Implement empirical translation between OpenGL and PRC shininess.
+
+------------------------------------------------------------------------
+r4551 | hammera | 2009-07-25 10:31:06 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/builtin.cc
+ M /trunk/asymptote/coder.cc
+ M /trunk/asymptote/coder.h
+ M /trunk/asymptote/exp.cc
+ M /trunk/asymptote/program.cc
+ M /trunk/asymptote/record.cc
+ M /trunk/asymptote/refaccess.cc
+ M /trunk/asymptote/refaccess.h
+ M /trunk/asymptote/runtime.pl
+ M /trunk/asymptote/stack.cc
+ M /trunk/asymptote/vm.h
+
+Added preprocessor option to print names of bltin functions.
+
+------------------------------------------------------------------------
+r4550 | hammera | 2009-07-25 10:12:38 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_constants.asy
+ M /trunk/asymptote/stm.cc
+
+Changed formatting of interactive write for overloaded variables.
+
+------------------------------------------------------------------------
+r4549 | hammera | 2009-07-25 10:11:39 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/types.cc
+ M /trunk/asymptote/types.h
+
+Automated definition of IntArray, etc.
+
+------------------------------------------------------------------------
+r4548 | jcbowman | 2009-07-25 09:58:38 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/glrender.cc
+
+Fix viewportshift flicker.
+
+------------------------------------------------------------------------
+r4547 | jcbowman | 2009-07-25 02:05:50 -0600 (Sat, 25 Jul 2009) | 4 lines
+Changed paths:
+ M /trunk/asymptote/base/animation.asy
+ M /trunk/asymptote/base/three.asy
+
+Embed 2D frame.
+
+Improve OpenGL movie generation.
+
+------------------------------------------------------------------------
+r4546 | jcbowman | 2009-07-25 00:41:07 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_picture.asy
+
+Remove diagnostic.
+
+------------------------------------------------------------------------
+r4545 | jcbowman | 2009-07-25 00:01:06 -0600 (Sat, 25 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/doc/asymptote.texi
+
+Update documentation on suppressing warnings.
+
+------------------------------------------------------------------------
+r4544 | jcbowman | 2009-07-24 23:57:15 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/bezulate.asy
+ M /trunk/asymptote/base/geometry.asy
+ M /trunk/asymptote/base/labelpath.asy
+ M /trunk/asymptote/base/plain.asy
+ M /trunk/asymptote/base/plain_picture.asy
+ M /trunk/asymptote/base/slide.asy
+ M /trunk/asymptote/base/solids.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/trembling.asy
+ M /trunk/asymptote/doc/asymptote.texi
+ M /trunk/asymptote/errormsg.cc
+ M /trunk/asymptote/errormsg.h
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/settings.h
+
+Allow asy warnings to be disabled.
+
+------------------------------------------------------------------------
+r4543 | jcbowman | 2009-07-24 23:54:43 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/animation.asy
+
+Delete intermediate files.
+
+------------------------------------------------------------------------
+r4542 | jcbowman | 2009-07-24 19:55:40 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/util.h
+
+Add missing typedef.
+
+------------------------------------------------------------------------
+r4541 | hammera | 2009-07-24 02:07:57 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/stm.cc
+
+Write type info for variables on the interactive prompt.
+
+------------------------------------------------------------------------
+r4540 | hammera | 2009-07-24 01:45:10 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_constants.asy
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/stm.cc
+
+Made overloaded warning for interactive write less scary.
+
+------------------------------------------------------------------------
+r4539 | hammera | 2009-07-24 01:42:07 -0600 (Fri, 24 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/name.cc
+ M /trunk/asymptote/virtualfieldaccess.cc
+ M /trunk/asymptote/virtualfieldaccess.h
+
+Minor changes to virtual fields.
+
+------------------------------------------------------------------------
+r4538 | hammera | 2009-07-23 19:24:46 -0600 (Thu, 23 Jul 2009) | 2 lines
+Changed paths:
+ A /trunk/asymptote/tests/array/fields.asy
+
+Add automated testing of array virtual fields.
+
+------------------------------------------------------------------------
+r4537 | hammera | 2009-07-23 19:20:22 -0600 (Thu, 23 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/Makefile.in
+ M /trunk/asymptote/access.cc
+ M /trunk/asymptote/name.cc
+ M /trunk/asymptote/runtime.in
+ M /trunk/asymptote/types.cc
+ A /trunk/asymptote/virtualfieldaccess.cc
+ A /trunk/asymptote/virtualfieldaccess.h
+
+Implemented writing to virtual fields.
+
+------------------------------------------------------------------------
+r4536 | jcbowman | 2009-07-23 11:04:54 -0600 (Thu, 23 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/base/syzygy.asy
+
+Resolve ambiguity.
+
+------------------------------------------------------------------------
+r4535 | jcbowman | 2009-07-23 01:20:35 -0600 (Thu, 23 Jul 2009) | 9 lines
+Changed paths:
+ M /trunk/asymptote/TODO
+ M /trunk/asymptote/base/animation.asy
+ M /trunk/asymptote/base/plain_arrows.asy
+ M /trunk/asymptote/base/plain_boxes.asy
+ M /trunk/asymptote/base/three.asy
+ M /trunk/asymptote/base/three_surface.asy
+ M /trunk/asymptote/examples/animations/earthmoon.asy
+ A /trunk/asymptote/examples/animations/glmovie.asy
+ M /trunk/asymptote/examples/animations/heatequation.asy
+ M /trunk/asymptote/examples/animations/sphere.asy
+ M /trunk/asymptote/examples/xsin1x.asy
+ M /trunk/asymptote/glrender.cc
+ M /trunk/asymptote/main.cc
+ M /trunk/asymptote/settings.cc
+ M /trunk/asymptote/util.cc
+ M /trunk/asymptote/util.h
+
+Add support for OpenGL animations (illustrated in glmovie.asy), including
+new autoplay and loop settings.
+
+Implement a portable Signal function based on sigaction.
+
+Add example of inset graph to xsin1x.asy.
+
+Improve animation fitting to guarantee a single transformation for all pictures.
+
+------------------------------------------------------------------------
+r4534 | jcbowman | 2009-07-21 10:59:05 -0600 (Tue, 21 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+
+Extend embed(frame).
+
+------------------------------------------------------------------------
+r4533 | jcbowman | 2009-07-21 01:10:31 -0600 (Tue, 21 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/three.asy
+
+Factor 3D fitting routine.
+
+------------------------------------------------------------------------
+r4532 | jcbowman | 2009-07-21 00:14:50 -0600 (Tue, 21 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/glrender.cc
+
+Remove extra comma.
+
+------------------------------------------------------------------------
+r4531 | jcbowman | 2009-07-20 21:44:59 -0600 (Mon, 20 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/plain_Label.asy
+
+Add missing picture sizing.
+
+------------------------------------------------------------------------
+r4530 | hammera | 2009-07-20 15:12:11 -0600 (Mon, 20 Jul 2009) | 2 lines
+Changed paths:
+ M /trunk/asymptote/base/slide.asy
+
+Added routines for stepping through external animations in slides.
+
+------------------------------------------------------------------------
+r4529 | jcbowman | 2009-07-20 00:35:29 -0600 (Mon, 20 Jul 2009) | 1 line
+Changed paths:
+ M /trunk/asymptote/asymptote.spec
+ M /trunk/asymptote/configure.ac
+
+Increment version to 1.83svn.
+------------------------------------------------------------------------
r4528 | jcbowman | 2009-07-19 22:57:37 -0600 (Sun, 19 Jul 2009) | 2 lines
Changed paths:
M /trunk/asymptote/base/labelpath3.asy
diff --git a/Build/source/utils/asymptote/INSTALL b/Build/source/utils/asymptote/INSTALL
index 581096dbb0d..ade5ab7eb9e 100644
--- a/Build/source/utils/asymptote/INSTALL
+++ b/Build/source/utils/asymptote/INSTALL
@@ -15,7 +15,7 @@ you should change the first line to
./configure --prefix=$HOME/asymptote
-If you get errors from a broken pdftex installation, simply put
+If you get errors from a broken texinfo or pdftex installation, simply put
http://asymptote.sourceforge.net/asymptote.pdf
in the doc directory and repeat the commands make all and make install.
diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in
index 9fec3091437..270a8d517d8 100644
--- a/Build/source/utils/asymptote/Makefile.in
+++ b/Build/source/utils/asymptote/Makefile.in
@@ -14,11 +14,14 @@ LIBS = $(LFLAGS) @LIBS@ $(GCLIBS)
CAMP = camperror path drawpath drawlabel picture psfile texfile util settings \
guide flatguide knot drawfill path3 drawpath3 drawsurface
+RUNTIME_FILES = runtime backtrace
+
PRC = prc/PRCbitStream prc/oPRCFile prc/PRCdouble prc/writePRC
-FILES = $(CAMP) runtime env genv main stm dec errormsg \
+FILES = $(CAMP) $(RUNTIME_FILES) env genv main stm dec errormsg \
callable name symbol types entry exp newexp stack camp.tab lex.yy \
- access absyn record interact fileio builtin fftw++ simpson coder coenv \
+ access virtualfieldaccess absyn record interact fileio builtin fftw++ \
+ simpson coder coenv \
@getopt@ locate parser program application varinit fundec refaccess \
envcompleter process constructor array Delaunay predicates \
$(PRC) glrender tr arcball algebra3 quaternion svnrevision
@@ -126,8 +129,8 @@ man: asy
faq: asy
cd doc; $(MAKE) faq
-runtime.cc: runtime.pl runtime.in
- ./runtime.pl
+$(RUNTIME_FILES:=.cc): %.cc: runtime.pl runtimebase.in %.in
+ ./runtime.pl $(@:.cc=)
camp.tab.cc: camp.y
$(BISON) -dvt -b camp camp.y && mv camp.tab.c camp.tab.cc
diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes
index f419b077754..b3fc60b14f5 100644
--- a/Build/source/utils/asymptote/ReleaseNotes
+++ b/Build/source/utils/asymptote/ReleaseNotes
@@ -1,6 +1,27 @@
+Release Notes for Version 1.83
+
+OpenGL animations, illustrated in glmovie.asy, were implemented.
+Viewportshift flicker was fixed. An empirical translation between
+OpenGL and PRC shininess was implemented. Splined parametric surfaces are
+now used to implement smooth thick lines and tubes. The projected bounding box
+calculation and angle calculations were fixed. A labelsurface function was
+added. The Headlamp light is now the default light; a light argument was
+added to shipout. Patches are now constructed with the usual orientation
+for a counterclockwise external path; the convention for tensor product
+shading was updated. Picture environments for TeX clipping are no longer
+nested. A texpath initialization bug was fixed. An ASYMPTOTE_HOME
+environment variable was added. Viewing was fixed for file names
+containing spaces. A picture sizing bug was fixed. An example of an inset
+graph was added. Type information for variables is now returned at the
+interactive prompt. Warning message suppression was improved; warnings in
+Asymptote code can now be disabled. The cyclic member of an array is now
+writeable; the obsolete cyclicflag and void cyclic(bool) functions were
+removed. File mode functions are now virtual members; this backwards
+incompatibility requires that line(file f) be changed to f.line(), etc.
+
Release Notes for Version 1.82
-Threaded exports were fixed. The texpath fontsize was fixed for PDF tex engines.
+Threaded exports were fixed. The texpath fontsize was fixed for PDF tex engines.
A default currentprojection argument was added to transform3(projection).
The -gray and -bw settings are now respected in PRC output.
A consistent approximation is now used for drawing tube centers.
diff --git a/Build/source/utils/asymptote/TODO b/Build/source/utils/asymptote/TODO
index ae06d7a8b94..bd5b090f06f 100644
--- a/Build/source/utils/asymptote/TODO
+++ b/Build/source/utils/asymptote/TODO
@@ -1,22 +1,15 @@
-Andy: split runtime.in
+John: split runtime.in
Andy: implement operator init(A a) copy constructors.
Andy and John: (if possible) automatically turn expressions with array
sub-expressions into iteration over the array(s)
-Andy: Change primNull to another name (null is not primitive).
-
Andy: Decide if we should change vm::error to em in application.cc
-Andy: Add info to vm to aid debugging. (Locations are a start, but we can add
-variable names, type info, stack traces).
-
John or Andy: Add unit test for AddOps.
Andy: Fix: void f(int x=blah);
-Andy: Clean up processData and preRun
-
-Andy: Investigate adding unicode support for identifiers, using iswalpha, mbtowc
-etc.
+Andy: Investigate adding unicode support for identifiers, using iswalpha,
+mbtowc, etc.
diff --git a/Build/source/utils/asymptote/access.cc b/Build/source/utils/asymptote/access.cc
index 60aee6fa659..b3935fed922 100644
--- a/Build/source/utils/asymptote/access.cc
+++ b/Build/source/utils/asymptote/access.cc
@@ -130,4 +130,6 @@ void qualifiedAccess::encode(action act, position pos, coder &e, frame *top)
qualifier->encode(READ, pos, e, top);
field->encode(act, pos, e, qualifierLevel);
}
+
+
} // namespace trans
diff --git a/Build/source/utils/asymptote/application.cc b/Build/source/utils/asymptote/application.cc
index 7a146036722..9036f8d426b 100644
--- a/Build/source/utils/asymptote/application.cc
+++ b/Build/source/utils/asymptote/application.cc
@@ -36,13 +36,6 @@ score castScore(env &e, formal& target, formal& source) {
e.castable(target.t,source.t, symbol::castsym)) ? CAST : FAIL;
}
-defaultArg::defaultArg(types::ty *t)
- : arg(new absyntax::callExp(position(),
- new absyntax::varEntryExp(position(),
- new function(t),
- run::pushDefault)),
- t)
-{}
void restArg::transMaker(coenv &e, Int size, bool rest) {
// Push the number of cells and call the array maker.
@@ -237,7 +230,7 @@ bool application::matchRest(env &e, formal &source, varinit *a) {
formal &target=sig->getRest();
score s=castScore(e, target, source);
if (s!=FAIL) {
- rest->addRest(new arg(a, target.t));
+ rest->addRest(new varinitArg(a, target.t));
scores.push_back(s);
return true;
}
@@ -297,7 +290,7 @@ bool application::matchOpen(env &e, signature *source, arglist &al) {
rest->add(seq.addArg(al[i].val, f[i].t, i));
if (source->hasRest())
- rest->addRest(new arg(al.rest.val, source->getRest().t));
+ rest->addRest(new varinitArg(al.rest.val, source->getRest().t));
return true;
}
diff --git a/Build/source/utils/asymptote/application.h b/Build/source/utils/asymptote/application.h
index 994f0bb1970..060afeafdb3 100644
--- a/Build/source/utils/asymptote/application.h
+++ b/Build/source/utils/asymptote/application.h
@@ -16,6 +16,11 @@
#include "coenv.h"
#include "exp.h"
+// Defined in runtime.in:
+namespace run {
+ void pushDefault(vm::stack *Stack);
+}
+
using absyntax::arglist;
using absyntax::varinit;
using absyntax::arrayinit;
@@ -38,12 +43,20 @@ typedef mem::vector<score> score_vector;
typedef mem::vector<tempExp *> temp_vector;
struct arg : public gc {
+ types::ty *t;
+
+ arg(types::ty *t)
+ : t(t) {}
virtual ~arg() {}
+
+ virtual void trans(coenv &e, temp_vector &) = 0;
+};
+
+struct varinitArg : public arg {
varinit *v;
- types::ty *t;
- arg(varinit *v, types::ty *t)
- : v(v), t(t) {}
+ varinitArg(varinit *v, types::ty *t)
+ : arg(t), v(v) {}
virtual void trans(coenv &e, temp_vector &) {
// Open signatures can match overloaded variables, but there is no way to
@@ -57,10 +70,16 @@ struct arg : public gc {
}
};
+
// Pushes a default argument token on the stack as a placeholder for the
// argument.
struct defaultArg : public arg {
- defaultArg(types::ty *t);
+ defaultArg(types::ty *t)
+ : arg(t) {}
+
+ virtual void trans(coenv &e, temp_vector &) {
+ e.c.encode(inst::builtin, run::pushDefault);
+ }
};
// Handles translation of all the arguments matched to the rest formal.
@@ -96,11 +115,11 @@ public:
// used to ensure left-to-right order of evaluation of keyword arguments, even
// if they are given out of the order specified in the declaration.
class sequencer {
- struct sequencedArg : public arg {
+ struct sequencedArg : public varinitArg {
sequencer &parent;
size_t i;
sequencedArg(varinit *v, types::ty *t, sequencer &parent, size_t i)
- : arg(v, t), parent(parent), i(i) {}
+ : varinitArg(v, t), parent(parent), i(i) {}
void trans(coenv &e, temp_vector &temps) {
parent.trans(e, i, temps);
@@ -138,7 +157,7 @@ class sequencer {
advance(e, i, temps);
// Translate using the base method.
- args[i]->arg::trans(e,temps);
+ args[i]->varinitArg::trans(e,temps);
// Push null to indicate the argument has been translated.
temps.push_back(0);
diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec
index 0ecee2e6c08..0cd12e7df69 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: 1.82
+Version: 1.83
Release: 1%{?dist}
Summary: Descriptive vector graphics language
diff --git a/Build/source/utils/asymptote/backtrace.cc b/Build/source/utils/asymptote/backtrace.cc
new file mode 100644
index 00000000000..45bf8c4604a
--- /dev/null
+++ b/Build/source/utils/asymptote/backtrace.cc
@@ -0,0 +1,84 @@
+/***** Autogenerated from backtrace.in; changes will be overwritten *****/
+
+#line 1 "runtimebase.in"
+/*****
+ * runtimebase.in
+ * Andy Hammerlindl 2009/07/28
+ *
+ * Common declarations needed for all code-generating .in files.
+ *
+ *****/
+
+
+#line 1 "backtrace.in"
+/*****
+ * backtrace.in
+ * Andy Hammerlindl 2009/07/28
+ *
+ * Runtime functions for printing garbage collector backtraces.
+ *
+ *****/
+
+#line 1 "runtimebase.in"
+#include "stack.h"
+#include "types.h"
+#include "builtin.h"
+#include "entry.h"
+#include "errormsg.h"
+
+using vm::stack;
+using vm::error;
+using types::formal;
+
+#define PRIMITIVE(name,Name,asyName) using types::prim##Name;
+#include <primitives.h>
+#undef PRIMITIVE
+
+void unused(void *);
+
+#line 11 "backtrace.in"
+// No extra code for .cc file.
+
+
+namespace run {
+#line 13 "backtrace.in"
+// void generate_random_backtrace();
+void gen_backtrace0(stack *)
+{
+#line 14 "backtrace.in"
+#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
+ GC_generate_random_backtrace();
+#else
+ error("generate_random_backtrace() requires ./configure --enable-gc-debug");
+#endif
+}
+
+#line 22 "backtrace.in"
+// void print_random_addresses(Int n=1);
+void gen_backtrace1(stack *Stack)
+{
+ Int n=vm::pop<Int>(Stack,1);
+#line 23 "backtrace.in"
+#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
+ GC_gcollect();
+ for (Int i=0; i < n; ++i)
+ GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address()));
+#else
+ error("print_random_addresses() requires ./configure --enable-gc-debug");
+ unused(&n); // Avoid unused variable warning message.
+#endif
+}
+
+} // namespace run
+
+namespace trans {
+
+void gen_backtrace_venv(venv &ve)
+{
+#line 13 "backtrace.in"
+ addFunc(ve, run::gen_backtrace0, primVoid(), "generate_random_backtrace");
+#line 22 "backtrace.in"
+ addFunc(ve, run::gen_backtrace1, primVoid(), "print_random_addresses", formal(primInt(), "n", true, false));
+}
+
+} // namespace trans
diff --git a/Build/source/utils/asymptote/backtrace.h b/Build/source/utils/asymptote/backtrace.h
new file mode 100644
index 00000000000..f052679a6d6
--- /dev/null
+++ b/Build/source/utils/asymptote/backtrace.h
@@ -0,0 +1,8 @@
+/***** Autogenerated from backtrace.in; changes will be overwritten *****/
+
+#ifndef backtrace_H
+#define backtrace_H
+namespace run {
+}
+
+#endif // backtrace_H
diff --git a/Build/source/utils/asymptote/backtrace.in b/Build/source/utils/asymptote/backtrace.in
new file mode 100644
index 00000000000..4547355f965
--- /dev/null
+++ b/Build/source/utils/asymptote/backtrace.in
@@ -0,0 +1,32 @@
+/*****
+ * backtrace.in
+ * Andy Hammerlindl 2009/07/28
+ *
+ * Runtime functions for printing garbage collector backtraces.
+ *
+ *****/
+
+// No extra types defined.
+
+// No extra code for .cc file.
+
+void generate_random_backtrace()
+{
+#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
+ GC_generate_random_backtrace();
+#else
+ error("generate_random_backtrace() requires ./configure --enable-gc-debug");
+#endif
+}
+
+void print_random_addresses(Int n=1)
+{
+#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
+ GC_gcollect();
+ for (Int i=0; i < n; ++i)
+ GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address()));
+#else
+ error("print_random_addresses() requires ./configure --enable-gc-debug");
+ unused(&n); // Avoid unused variable warning message.
+#endif
+}
diff --git a/Build/source/utils/asymptote/base/animation.asy b/Build/source/utils/asymptote/base/animation.asy
index 6fcd2ad70e2..27f7171a639 100644
--- a/Build/source/utils/asymptote/base/animation.asy
+++ b/Build/source/utils/asymptote/base/animation.asy
@@ -8,16 +8,17 @@
// animation delay is in milliseconds
real animationdelay=50;
-typedef frame fit(string prefix="",picture);
+typedef frame enclosure(frame);
-frame NoBox(string prefix="", picture pic) {
- return pic.fit(prefix);
+frame NoBox(frame f) {
+ return f;
}
-fit BBox(string prefix="", real xmargin=0, real ymargin=xmargin,
- pen p=currentpen, filltype filltype=NoFill) {
- return new frame(string prefix, picture pic) {
- return bbox(prefix,pic,xmargin,ymargin,p,filltype);
+enclosure BBox(real xmargin=0, real ymargin=xmargin,
+ pen p=currentpen, filltype filltype=NoFill) {
+ return new frame(frame f) {
+ box(f,xmargin,ymargin,p,filltype,above=false);
+ return f;
};
}
@@ -59,11 +60,11 @@ struct animation {
shipped=false;
}
- void add(picture pic=currentpicture, fit fit=NoBox) {
+ void add(picture pic=currentpicture, enclosure enclosure=NoBox) {
if(global) {
++index;
pictures.push(pic.copy());
- } else this.shipout(fit(prefix,pic));
+ } else this.shipout(enclosure(pic.fit()));
}
void purge(bool keep=settings.keep) {
@@ -86,30 +87,33 @@ struct animation {
return rc;
}
+ void glmovie(string prefix=prefix, projection P=currentprojection) {
+ if(!view() || settings.render == 0) return;
+ fit(prefix,pictures,view=true,P);
+ }
+
// Export all frames with the same scaling.
- void export(string prefix=prefix, fit fit=NoBox,
- bool multipage=false, bool view=false) {
+ void export(string prefix=prefix, enclosure enclosure=NoBox,
+ bool multipage=false, bool view=false,
+ projection P=currentprojection) {
if(pictures.length == 0) return;
if(!global) multipage=false;
- rescale(pictures);
- frame multi;
bool inlinetex=settings.inlinetex;
if(multipage)
settings.inlinetex=false;
- for(int i=0; i < pictures.length; ++i) {
+ frame multi;
+ frame[] fits=fit(prefix,pictures,view=false,P);
+ for(int i=0; i < fits.length; ++i) {
+ string s=name(prefix,i);
if(multipage) {
- add(multi,fit(prefix,pictures[i]));
+ add(multi,enclosure(fits[i]));
newpage(multi);
+ files.push(s+"."+nativeformat());
} else {
- if(pictures[i].empty3() || settings.render <= 0) {
- real render=settings.render;
- settings.render=0;
- this.shipout(name(prefix,i),fit(prefix,pictures[i]));
- settings.render=render;
- } else { // Render 3D frames
- files.push(name(prefix,i)+"."+nativeformat());
- fit(prefix,pictures[i]);
- }
+ if(pictures[i].empty3() || settings.render <= 0)
+ this.shipout(s,enclosure(fits[i]));
+ else // 3D frames
+ files.push(s+"."+nativeformat());
}
}
if(multipage) {
@@ -129,8 +133,8 @@ struct animation {
return s;
}
- string pdf(fit fit=NoBox, real delay=animationdelay, string options="",
- bool keep=settings.keep, bool multipage=true) {
+ string pdf(enclosure enclosure=NoBox, real delay=animationdelay,
+ string options="", bool keep=settings.keep, bool multipage=true) {
if(settings.inlinetex) multipage=true;
if(!global) multipage=false;
if(settings.tex != "pdflatex")
@@ -141,16 +145,17 @@ struct animation {
string pdfname=filename+".pdf";
if(global)
- export(filename,fit,multipage=multipage);
+ export(filename,enclosure,multipage=multipage);
shipped=false;
- if(!keep && !settings.inlinetex) {
+ if(!keep) {
exitfcn currentexitfunction=atexit();
void exitfunction() {
if(currentexitfunction != null) currentexitfunction();
- this.purge();
- if(multipage)
+ if(multipage || !settings.inlinetex)
+ this.purge();
+ if(multipage && !settings.inlinetex)
delete(pdfname);
}
atexit(exitfunction);
@@ -162,15 +167,15 @@ struct animation {
return load(index,delay,options,multipage);
}
- int movie(fit fit=NoBox, int loops=0, real delay=animationdelay,
+ int movie(enclosure enclosure=NoBox, int loops=0, real delay=animationdelay,
string format=settings.outformat == "" ? "gif" : settings.outformat,
string options="", bool keep=settings.keep) {
if(global) {
if(format == "pdf") {
- export(fit,multipage=true,view=true);
+ export(enclosure,multipage=true,view=true);
return 0;
}
- export(fit);
+ export(enclosure);
}
return merge(loops,delay,format,options,keep);
}
diff --git a/Build/source/utils/asymptote/base/bezulate.asy b/Build/source/utils/asymptote/base/bezulate.asy
index 2b852623faf..d935d358989 100644
--- a/Build/source/utils/asymptote/base/bezulate.asy
+++ b/Build/source/utils/asymptote/base/bezulate.asy
@@ -238,7 +238,7 @@ path[] bezulate(path[] p)
// avoid infinite recursion
++refinements;
if(refinements > mantissaBits) {
- write("warning: too many subdivisions");
+ warning("subdivisions","too many subdivisions",position=true);
} else {
p=subdivide(p);
i=-1;
diff --git a/Build/source/utils/asymptote/base/geometry.asy b/Build/source/utils/asymptote/base/geometry.asy
index 12e35339dcc..0db3172d365 100644
--- a/Build/source/utils/asymptote/base/geometry.asy
+++ b/Build/source/utils/asymptote/base/geometry.asy
@@ -228,24 +228,6 @@ pair[] intersectionpoints(pair A, pair B, real[] equation)
// *=======================================================*
// *......................COORDINATES......................*
-// Copyright (c) 2007, Philippe Ivaldi.
-// Version: $Id: coordinates.asy,v 0.0 2007/02/03 16:06:23 Philippe Ivaldi Exp$
-// Last modified: Wed Aug 15 15:53:01 CEST 2007
-
-// This program 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
-// 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.
-
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-// 02110-1301, USA.
real EPS=sqrt(realEpsilon);
@@ -492,8 +474,9 @@ bool samecoordsys(bool warn=true ... point[] M)
t=M[i].coordsys;
}
if(warn && !ret)
- write("Warning, the coordinate system of two objects are not the same.
-The operation will be done relatively to the default coordinate system.");
+ warning("coodinatesystem",
+ "the coordinate system of two objects are not the same.
+The operation will be done relative to the default coordinate system.");
return ret;
}
@@ -2418,8 +2401,10 @@ bool samecoordsys(bool warn=true ... bqe[] bqes)
t=bqes[i].coordsys;
}
if(warn && !ret)
- write("Warning, the coordinate system of two bivariate quadratic equations are not the same.
-The operation will be done relatively to the default coordinate system.");
+ warning("coodinatesystem",
+ "the coordinate system of two bivariate quadratic equations are not
+the same. The operation will be done relatively to the default coordinate
+system.");
return ret;
}
@@ -2710,7 +2695,9 @@ int circlenodesnumberfactor=100;/*<asyxml></code><documentation>Factor for the n
/*<asyxml><function type="int" signature="circlenodesnumber(real)"><code></asyxml>*/
int circlenodesnumber(real r)
{/*<asyxml></code><documentation>Return the number of nodes for drawing a circle of radius 'r'.</documentation></function></asyxml>*/
- if (circlenodesnumberfactor < 100) write("Warning: variable 'circlenodesnumberfactor' maybe too small.");
+ if (circlenodesnumberfactor < 100)
+ warning("circlenodesnumberfactor",
+ "variable 'circlenodesnumberfactor' may be too small.");
int oi=ceil(circlenodesnumberfactor*abs(r)^0.1);
oi=45*floor(oi/45);
return oi == 0 ? 4 : conicnodesfactor*oi;
@@ -2729,7 +2716,9 @@ int ellipsenodesnumberfactor=250;/*<asyxml></code><documentation>Factor for the
/*<asyxml><function type="int" signature="ellipsenodesnumber(real,real)"><code></asyxml>*/
int ellipsenodesnumber(real a, real b)
{/*<asyxml></code><documentation>Return the number of nodes to draw a ellipse of axis 'a' and 'b'.</documentation></function></asyxml>*/
- if (ellipsenodesnumberfactor < 250) write("Warning: variable 'ellipsenodesnumberfactor' maybe too small.");
+ if (ellipsenodesnumberfactor < 250)
+ write("ellipsenodesnumberfactor",
+ "variable 'ellipsenodesnumberfactor' maybe too small.");
int tmp=circlenodesnumberfactor;
circlenodesnumberfactor=ellipsenodesnumberfactor;
int oi=circlenodesnumber(max(abs(a),abs(b))/min(abs(a),abs(b)));
@@ -5481,7 +5470,7 @@ circle excircle(point A, point B, point C)
}
private int[] numarray={1,2,3};
-numarray.cyclic(true);
+numarray.cyclic=true;
/*<asyxml><struct signature="triangle"><code></asyxml>*/
struct triangle {/*<asyxml></code><documentation></documentation></asyxml>*/
@@ -6440,13 +6429,19 @@ point operator *(inversion i, point P)
return inverse(i.k,i.C,P);
}
+void lineinversion()
+{
+ warning("lineinversion","the inversion of the line is not a circle.
+The returned circle has an infinite radius, circle.l has been set.");
+}
+
+
/*<asyxml><function type="circle" signature="inverse(real,point,line)"><code></asyxml>*/
circle inverse(real k, point A, line l)
{/*<asyxml></code><documentation>Return the inverse circle of 'l' with
respect to point 'A' and inversion radius 'k'.</documentation></function></asyxml>*/
if(A @ l) {
- write("Warning: the inversion of the line is not a circle.");
- write("The returned circle has an infinite radius, cirlce.l have been set.");
+ lineinversion();
circle C=circle(A, infinity);
C.l=l;
return C;
@@ -6467,8 +6462,7 @@ circle inverse(real k, point A, circle c)
respect to point A and inversion radius 'k'.</documentation></function></asyxml>*/
if(degenerate(c)) return inverse(k,A,c.l);
if(A @ c) {
- write("Warning: the inversion of the circle is not a circle.");
- write("The returned circle has an infinite radius, cirlce.l have been set.");
+ lineinversion();
point M=rotate(180,c.C)*A, Mp=rotate(90,c.C)*A;
circle oc=circle(A,infinity);
oc.l=line(inverse(k,A,M),inverse(k,A,Mp));
@@ -7123,7 +7117,7 @@ path square(pair z1, pair z2)
// relative to the path z--z+dir.
void perpendicular(picture pic=currentpicture, pair z, pair align,
pair dir=E, real size=0, pen p=currentpen,
- margin margin=NoMargin, filltype filltype=NoFill)
+ margin margin=NoMargin, filltype filltype=NoFill)
{
perpendicularmark(pic,(point) z,align,dir,size,p,margin,filltype);
}
@@ -7133,7 +7127,7 @@ void perpendicular(picture pic=currentpicture, pair z, pair align,
// relative to the path z--z+dir(g,0)
void perpendicular(picture pic=currentpicture, pair z, pair align, path g,
real size=0, pen p=currentpen, margin margin=NoMargin,
- filltype filltype=NoFill)
+ filltype filltype=NoFill)
{
perpendicularmark(pic,(point) z,align,dir(g,0),size,p,margin,filltype);
}
diff --git a/Build/source/utils/asymptote/base/graph.asy b/Build/source/utils/asymptote/base/graph.asy
index 2983137b612..55974c63f7d 100644
--- a/Build/source/utils/asymptote/base/graph.asy
+++ b/Build/source/utils/asymptote/base/graph.asy
@@ -1,6 +1,6 @@
private import math;
-import splinetype;
+import graph_splinetype;
import graph_settings;
scaleT Linear;
@@ -1893,7 +1893,7 @@ interpolate Hermite(splinetype splinetype)
};
}
-interpolate Hermite=Hermite(defaultspline);
+interpolate Hermite=Hermite(Spline);
guide graph(picture pic=currentpicture, real f(real), real a, real b,
int n=ngraph, real T(real)=identity, interpolate join=operator --)
diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy
index 8fe6c9ed5c6..c2630e10f11 100644
--- a/Build/source/utils/asymptote/base/graph3.asy
+++ b/Build/source/utils/asymptote/base/graph3.asy
@@ -1509,6 +1509,27 @@ path3[] segment(triple[] v, bool[] cond, interpolate3 join=operator --)
segment.length);
}
+bool uperiodic(triple[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length;
+ triple[] a0=a[0];
+ triple[] a1=a[n-1];
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int j=0; j < m; ++j)
+ if(abs(a0[j]-a1[j]) > epsilon) return false;
+ return true;
+}
+bool vperiodic(triple[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length-1;
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int i=0; i < n; ++i)
+ if(abs(a[i][0]-a[i][m]) > epsilon) return false;
+ return true;
+}
+
// return the surface described by a matrix f
surface surface(triple[][] f, bool[][] cond={})
{
@@ -1533,6 +1554,7 @@ surface surface(triple[][] f, bool[][] cond={})
}
surface s=surface(count);
+ s.index=new int[nx][ny];
int k=-1;
for(int i=0; i < nx; ++i) {
bool[] condi,condp;
@@ -1542,122 +1564,18 @@ surface surface(triple[][] f, bool[][] cond={})
}
triple[] fi=f[i];
triple[] fp=f[i+1];
+ int[] indexi=s.index[i];
for(int j=0; j < ny; ++j) {
if(all || (condi[j] && condi[j+1] && condp[j] && condp[j+1]))
s.s[++k]=patch(new triple[] {fi[j],fp[j],fp[j+1],fi[j+1]});
- }
- }
- return s;
-}
-
-private surface bispline(real[][] z, real[][] p, real[][] q, real[][] r,
- real[] x, real[] y, bool[][] cond={})
-{ // z[i][j] is the value at (x[i],y[j])
- // p and q are the first derivatives with respect to x and y, respectively
- // r is the second derivative ddu/dxdy
- int n=x.length-1;
- int m=y.length-1;
-
- bool all=cond.length == 0;
-
- int count;
- if(all)
- count=n*m;
- else {
- count=0;
- for(int i=0; i < n; ++i) {
- bool[] condi=cond[i];
- for(int j=0; j < m; ++j)
- if(condi[j]) ++count;
- }
- }
-
- surface g=surface(count);
- int k=-1;
- for(int i=0; i < n; ++i) {
- bool[] condi=all ? null : cond[i];
- real xi=x[i];
- real[] zi=z[i];
- real[] zp=z[i+1];
- real[] ri=r[i];
- real[] rp=r[i+1];
- real[] pi=p[i];
- real[] pp=p[i+1];
- real[] qi=q[i];
- real[] qp=q[i+1];
- real xp=x[i+1];
- real hx=(xp-xi)/3;
- for(int j=0; j < m; ++j) {
- real yj=y[j];
- real yp=y[j+1];
- if(all || condi[j]) {
- triple[][] P=array(4,array(4,O));
- real hy=(yp-yj)/3;
- real hxy=hx*hy;
- // first x and y directions
- for(int k=0; k < 4; ++k) {
- P[k][0] += xi*X;
- P[0][k] += yj*Y;
- P[k][1] += (xp+2*xi)/3*X;
- P[1][k] += (yp+2*yj)/3*Y;
- P[k][2] += (2*xp+xi)/3*X;
- P[2][k] += (2*yp+yj)/3*Y;
- P[k][3] += xp*X;
- P[3][k] += yp*Y;
- }
- // now z, first the value
- P[0][0] += zi[j]*Z;
- P[0][3] += zp[j]*Z;
- P[3][0] += zi[j+1]*Z;
- P[3][3] += zp[j+1]*Z;
- // 2nd, first derivative
- P[0][1] += (P[0][0].z+hx*pi[j])*Z;
- P[3][1] += (P[3][0].z+hx*pi[j+1])*Z;
- P[0][2] += (P[0][3].z-hx*pp[j])*Z;
- P[3][2] += (P[3][3].z-hx*pp[j+1])*Z;
- P[1][0] += (P[0][0].z+hy*qi[j])*Z;
- P[1][3] += (P[0][3].z+hy*qp[j])*Z;
- P[2][0] += (P[3][0].z-hy*qi[j+1])*Z;
- P[2][3] += (P[3][3].z-hy*qp[j+1])*Z;
- // 3nd, second derivative
- P[1][1] += (P[1][0].z+P[0][1].z-P[0][0].z+hxy*ri[j])*Z;
- P[2][1] += (P[2][0].z+P[3][1].z-P[3][0].z-hxy*ri[j+1])*Z;
- P[1][2] += (P[0][2].z+P[1][3].z-P[0][3].z-hxy*rp[j])*Z;
- P[2][2] += (P[3][2].z+P[2][3].z-P[3][3].z+hxy*rp[j+1])*Z;
- g.s[++k]=patch(P);
+ indexi[j]=k;
}
- }
}
- return g;
-}
-// return the surface described by a real matrix f, interpolated with
-// xsplinetype and ysplinetype.
-surface surface(real[][] f, real[] x, real[] y,
- splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
- bool[][] cond={})
-{
- real epsilon=sqrtEpsilon*max(abs(y));
- if(xsplinetype == null)
- xsplinetype=(abs(x[0]-x[x.length-1]) <= epsilon) ? periodic : notaknot;
- if(ysplinetype == null)
- ysplinetype=(abs(y[0]-y[y.length-1]) <= epsilon) ? periodic : notaknot;
- int n=x.length; int m=y.length;
- real[][] ft=transpose(f);
- real[][] tp=new real[m][];
- for(int j=0; j < m; ++j)
- tp[j]=xsplinetype(x,ft[j]);
- real[][] q=new real[n][];
- for(int i=0; i < n; ++i)
- q[i]=ysplinetype(y,f[i]);
- real[][] qt=transpose(q);
- real[] d1=xsplinetype(x,qt[0]);
- real[] d2=xsplinetype(x,qt[m-1]);
- real[][] r=new real[n][];
- real[][] p=transpose(tp);
- for(int i=0; i < n; ++i)
- r[i]=clamped(d1[i],d2[i])(y,p[i]);
- return bispline(f,p,q,r,x,y,cond);
+ if(uperiodic(f)) s.ucyclic(true);
+ if(vperiodic(f)) s.vcyclic(true);
+
+ return s;
}
// return the surface described by a real matrix f, interpolated with
@@ -1738,74 +1656,8 @@ 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)
{
- real[] upt=uniform(a.x,b.x,nu);
- real[] vpt=uniform(a.y,b.y,nv);
- real[] ipt=sequence(nu+1);
- real[] jpt=sequence(nv+1);
- real[][] fx=new real[nu+1][nv+1];
- real[][] fy=new real[nu+1][nv+1];
- real[][] fz=new real[nu+1][nv+1];
-
- bool[][] active;
- bool all=cond == null;
- if(!all) active=new bool[nu+1][nv+1];
-
- real norm;
- for(int i=0; i <= nu; ++i) {
- real upti=upt[i];
- real[] fxi=fx[i];
- real[] fyi=fy[i];
- real[] fzi=fz[i];
- bool[] activei=all ? null : active[i];
- for(int j=0; j <= nv; ++j) {
- pair z=(upti,vpt[j]);
- triple f=(all || (activei[j]=cond(z))) ? f(z) : O;
- norm=max(norm,abs(f));
- fxi[j]=f.x;
- fyi[j]=f.y;
- fzi[j]=f.z;
- }
- }
-
- real epsilon=sqrtEpsilon*norm;
-
- if(usplinetype.length == 0) {
- bool uperiodic(real[][] a) {
- for(int j=0; j < nv; ++j)
- if(abs(a[0][j]-a[nu][j]) > epsilon) return false;
- return true;
- }
- usplinetype=new splinetype[] {uperiodic(fx) ? periodic : notaknot,
- uperiodic(fy) ? periodic : notaknot,
- uperiodic(fz) ? periodic : notaknot};
- } else if(usplinetype.length != 3) abort("usplinetype must have length 3");
-
- if(vsplinetype.length == 0) {
- bool vperiodic(real[][] a) {
- for(int i=0; i < nu; ++i)
- if(abs(a[i][0]-a[i][nv]) > epsilon) return false;
- return true;
- }
- vsplinetype=new splinetype[] {vperiodic(fx) ? periodic : notaknot,
- vperiodic(fy) ? periodic : notaknot,
- vperiodic(fz) ? periodic : notaknot};
- } else if(vsplinetype.length != 3) abort("vsplinetype must have length 3");
-
- surface sx=surface(fx,ipt,jpt,usplinetype[0],vsplinetype[0],active);
- surface sy=surface(fy,ipt,jpt,usplinetype[1],vsplinetype[1],active);
- surface sz=surface(fz,ipt,jpt,usplinetype[2],vsplinetype[2],active);
-
- surface s=surface(sx.s.length);
- for(int k=0; k < sx.s.length; ++k) {
- triple[][] Q=new triple[4][4];
- for(int i=0; i < 4 ; ++i) {
- for(int j=0; j < 4 ; ++j) {
- Q[i][j]=(sx.s[k].P[i][j].z,sy.s[k].P[i][j].z,sz.s[k].P[i][j].z);
- }
- s.s[k]=patch(Q);
- }
- }
- return s;
+ return surface(f,uniform(a.x,b.x,nu),uniform(a.y,b.y,nv),
+ usplinetype,vsplinetype,cond);
}
// return the surface described by a real function f over box(a,b),
diff --git a/Build/source/utils/asymptote/base/graph_splinetype.asy b/Build/source/utils/asymptote/base/graph_splinetype.asy
new file mode 100644
index 00000000000..fbcb1b00c75
--- /dev/null
+++ b/Build/source/utils/asymptote/base/graph_splinetype.asy
@@ -0,0 +1,251 @@
+typedef real[] splinetype(real[], real[]);
+
+restricted real[] Spline(real[] x, real[] y);
+restricted splinetype[] Spline;
+
+string morepoints="interpolation requires at least 2 points";
+string differentlengths="arrays have different lengths";
+void checklengths(int x, int y, string text=differentlengths)
+{
+ if(x != y)
+ abort(text+": "+string(x)+" != "+string(y));
+}
+
+// Linear interpolation
+real[] linear(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d=new real[n];
+ for(int i=0; i < n-1; ++i)
+ d[i]=(y[i+1]-y[i])/(x[i+1]-x[i]);
+ d[n-1]=d[n-2];
+ return d;
+}
+
+// Standard cubic spline interpolation with not-a-knot condition:
+// s'''(x_2^-)=s'''(x_2^+) et s'''(x_(n_2)^-)=s'''(x_(n-2)^+)
+// if n=2, linear interpolation is returned
+// if n=3, an interpolation polynomial of degree <= 2 is returned:
+// p(x_1)=y_1, p(x_2)=y_2, p(x_3)=y_3
+real[] notaknot(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 3) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=x[2]-x[1];
+ c[0]=x[2]-x[0];
+ a[0]=0;
+ g[0]=((x[1]-x[0])^2*(y[2]-y[1])/b[0]+b[0]*(2*b[0]+3*(x[1]-x[0]))*
+ (y[1]-y[0])/(x[1]-x[0]))/c[0];
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ b[n-1]=x[n-2]-x[n-3];
+ a[n-1]=x[n-1]-x[n-3];
+ g[n-1]=((x[n-1]-x[n-2])^2*(y[n-2]-y[n-3])/b[n-1]+
+ b[n-1]*(2*b[n-1]+3(x[n-1]-x[n-2]))*
+ (y[n-1]-y[n-2])/(x[n-1]-x[n-2]))/a[n-1];
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ real val=(y[1]-y[0])/(x[1]-x[0]);
+ d=new real[] {val,val};
+ } else if(n == 3) {
+ real a=(y[1]-y[0])/(x[1]-x[0]);
+ real b=(y[2]-y[1])/(x[2]-x[1]);
+ real c=(b-a)/(x[2]-x[0]);
+ d=new real[] {a+c*(x[0]-x[1]),a+c*(x[1]-x[0]),a+c*(2*x[2]-x[0]-x[1])};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with periodic condition
+// s'(a)=s'(b), s''(a)=s''(b), assuming that f(a)=f(b)
+// if n=2, linear interpolation is returned
+real[] periodic(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ if(abs(y[n-1]-y[0]) > sqrtEpsilon*norm(y))
+ abort("function values are not periodic");
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n-1];
+ real[] b=new real[n-1];
+ real[] c=new real[n-1];
+ real[] g=new real[n-1];
+ c[0]=x[n-1]-x[n-2];
+ a[0]=x[1]-x[0];
+ b[0]=2*(a[0]+c[0]);
+ g[0]=3*c[0]*(y[1]-y[0])/a[0]+3*a[0]*(y[n-1]-y[n-2])/c[0];
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ d=tridiagonal(a,b,c,g);
+ d.push(d[0]);
+ } else if(n == 2) {
+ d=new real[] {0,0};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with the natural condition
+// s''(a)=s''(b)=0.
+// if n=2, linear interpolation is returned
+// Don't use the natural type unless the underlying function
+// has zero second end points derivatives.
+real[] natural(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=2*(x[1]-x[0]);
+ c[0]=x[1]-x[0];
+ a[0]=0;
+ g[0]=3*(y[1]-y[0]);
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ a[n-1]=x[n-1]-x[n-2];
+ b[n-1]=2*a[n-1];
+ g[n-1]=3*(y[n-1]-y[n-2]);
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ real val=(y[1]-y[0])/(x[1]-x[0]);
+ d=new real[] {val,val};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with clamped conditions f'(a), f'(b)
+splinetype clamped(real slopea, real slopeb)
+{
+ return new real[] (real[] x, real[] y) {
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=x[1]-x[0];
+ g[0]=b[0]*slopea;
+ c[0]=0;
+ a[0]=0;
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ a[n-1]=0;
+ b[n-1]=x[n-1]-x[n-2];
+ g[n-1]=b[n-1]*slopeb;
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ d=new real[] {slopea,slopeb};
+ } else abort(morepoints);
+ return d;
+ };
+}
+
+// Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)
+// Modified MATLAB code
+// [1] Fritsch, F. N. and R. E. Carlson,
+// "Monotone Piecewise Cubic Interpolation,"
+// SIAM J. Numerical Analysis, Vol. 17, 1980, pp.238-246.
+// [2] Kahaner, David, Cleve Moler, Stephen Nash,
+// Numerical Methods and Software, Prentice Hall, 1988.
+real[] monotonic(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d=new real[n];
+ if(n > 2) {
+ real[] h=new real[n-1];
+ real[] del=new real[n-1];
+ for(int i=0; i < n-1; ++i) {
+ h[i]=x[i+1]-x[i];
+ del[i]=(y[i+1]-y[i])/h[i];
+ }
+ int j=0;
+ int k[]=new int[];
+ for(int i=0; i < n-2; ++i)
+ if((sgn(del[i])*sgn(del[i+1])) > 0) {k[j]=i; j=j+1;}
+
+ real[] hs=new real[j];
+ for(int i=0; i < j; ++i) hs[i]=h[k[i]]+h[k[i]+1];
+ real w1[]=new real[j];
+ real w2[]=new real[j];
+ real dmax[]=new real[j];
+ real dmin[]=new real[j];
+ for(int i=0; i < j; ++i) {
+ w1[i]=(h[k[i]]+hs[i])/(3*hs[i]);
+ w2[i]=(h[k[i]+1]+hs[i])/(3*hs[i]);
+ dmax[i]=max(abs(del[k[i]]),abs(del[k[i]+1]));
+ dmin[i]=min(abs(del[k[i]]),abs(del[k[i]+1]));
+ }
+ for(int i=0; i < n; ++i) d[i]=0;
+ for(int i=0; i < j; ++i)
+ d[k[i]+1]=dmin[i]/(w1[i]*(del[k[i]]/dmax[i])+w2[i]*(del[k[i]+1]/dmax[i]));
+ d[0]=((2*h[0]+h[1])*del[0]-h[0]*del[1])/(h[0]+h[1]);
+ if(sgn(d[0]) != sgn(del[0])) {d[0]=0;}
+ else if((sgn(del[0]) != sgn(del[1])) && (abs(d[0]) > abs(3*del[0])))
+ d[0]=3*del[0];
+
+ d[n-1]=((2*h[n-2]+h[n-3])*del[n-2]-h[n-2]*del[n-2])/(h[n-2]+h[n-3]);
+ if(sgn(d[n-1]) != sgn(del[n-2])) {d[n-1]=0;}
+ else if((sgn(del[n-2]) != sgn(del[n-3])) &&
+ (abs(d[n-1]) > abs(3*del[n-2])))
+ d[n-1]=3*del[n-2];
+ } else if(n == 2) {
+ d[0]=d[1]=(y[1]-y[0])/(x[1]-x[0]);
+ } else abort(morepoints);
+ return d;
+}
+
+// Return standard cubic spline interpolation as a guide
+guide hermite(real[] x, real[] y, splinetype splinetype=null)
+{
+ int n=x.length;
+ if(n == 0) return nullpath;
+
+ guide g=(x[0],y[0]);
+ if(n == 1) return g;
+ if(n == 2) return g--(x[1],y[1]);
+
+ if(splinetype == null)
+ splinetype=(x[0] == x[x.length-1] && y[0] == y[y.length-1]) ?
+ periodic : notaknot;
+
+ real[] dy=splinetype(x,y);
+ for(int i=1; i < n; ++i) {
+ pair z=(x[i],y[i]);
+ real dx=x[i]-x[i-1];
+ g=g..controls((x[i-1],y[i-1])+dx*(1,dy[i-1])/3) and (z-dx*(1,dy[i])/3)..z;
+ }
+ return g;
+}
diff --git a/Build/source/utils/asymptote/base/interpolate.asy b/Build/source/utils/asymptote/base/interpolate.asy
index a6b820bc7d5..a600c94c125 100644
--- a/Build/source/utils/asymptote/base/interpolate.asy
+++ b/Build/source/utils/asymptote/base/interpolate.asy
@@ -29,7 +29,7 @@
// Here s is a real function that is constant on (-infinity,a] and [b,infinity).
private import math;
-import splinetype;
+import graph_splinetype;
typedef real fhorner(real);
diff --git a/Build/source/utils/asymptote/base/labelpath.asy b/Build/source/utils/asymptote/base/labelpath.asy
index fe597a1608d..39c1908efd3 100644
--- a/Build/source/utils/asymptote/base/labelpath.asy
+++ b/Build/source/utils/asymptote/base/labelpath.asy
@@ -12,7 +12,7 @@ void labelpath(frame f, Label L, path g, string justify=Centered,
_labelpath(f,L.s,L.size,g,justify,(L.T.x,L.T.y+0.5linewidth(p)),p);
return;
}
- write("warning: labelpath requires -tex latex");
+ warning("labelpathlatex","labelpath requires -tex latex");
}
void labelpath(picture pic=currentpicture, Label L, path g,
diff --git a/Build/source/utils/asymptote/base/labelpath3.asy b/Build/source/utils/asymptote/base/labelpath3.asy
index bf2e6d4c084..8483a76a047 100644
--- a/Build/source/utils/asymptote/base/labelpath3.asy
+++ b/Build/source/utils/asymptote/base/labelpath3.asy
@@ -41,11 +41,11 @@ triple[] nextframe(path3 p, real reltimestart, triple[] start, real
return bf[subdiv];
}
-surface labelpath(string txt, path3 p, real angle=90, triple optional=O)
+surface labelpath(string s, path3 p, real angle=90, triple optional=O)
{
real Cos=Cos(angle);
real Sin=Sin(angle);
- path[] text=texpath(Label(txt,(0,0),Align,basealign));
+ path[] text=texpath(Label(s,(0,0),Align,basealign));
text=scale(1/(max(text).x-min(text).x))*text;
path[][] decompose=containmentTree(text);
diff --git a/Build/source/utils/asymptote/base/obj.asy b/Build/source/utils/asymptote/base/obj.asy
index 02f839b594d..158d417c136 100644
--- a/Build/source/utils/asymptote/base/obj.asy
+++ b/Build/source/utils/asymptote/base/obj.asy
@@ -21,7 +21,7 @@ struct obj {
pen[] meshpen;
path3[][] read(string datafile, bool verbose=false) {
- file in=word(line(input(datafile)));
+ file in=input(datafile).word().line();
triple[] vert;
path3[][] g;
g[0]=new path3[] ;
@@ -92,8 +92,8 @@ struct obj {
material surfacepen, pen meshpen=nullpen) {
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
operator init(read(datafile,verbose),surfacepen,meshpen);
}
}
diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy
index 8424c767ffa..f9e18b883ea 100644
--- a/Build/source/utils/asymptote/base/plain.asy
+++ b/Build/source/utils/asymptote/base/plain.asy
@@ -20,8 +20,8 @@ include plain_constants;
access version;
if(version.VERSION != VERSION) {
- write(stdout,"warning: using possibly incompatible version "+
- version.VERSION+" of plain.asy"+'\n');
+ warning("version","using possibly incompatible version "+
+ version.VERSION+" of plain.asy"+'\n');
}
include plain_pens;
@@ -68,7 +68,7 @@ saveFunction[] saveFunctions={};
// When save is called, this will be redefined to do the corresponding restore.
void restore()
{
- write("warning: restore called with no matching save");
+ warning("nomatchingsave","restore called with no matching save");
}
void addSaveFunction(saveFunction s)
@@ -113,7 +113,8 @@ restoreThunk save()
void restoredefaults()
{
- write("warning: restoredefaults called with no matching savedefaults");
+ warning("nomatchingsavedefaults",
+ "restoredefaults called with no matching savedefaults");
}
restoreThunk buildRestoreDefaults()
diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy
index 3c11a2cedbd..b75d0de3967 100644
--- a/Build/source/utils/asymptote/base/plain_Label.asy
+++ b/Build/source/utils/asymptote/base/plain_Label.asy
@@ -335,7 +335,13 @@ struct Label {
pic.add(new void (frame f, transform t) {
out(f,t,point(g,position),
alignrelative ? -Align*dir(t*g,position)*I : Align);
- },true);
+ },!alignrelative);
+
+ frame f;
+ pair align=alignrelative ? -Align*dir(g,position)*I : Align;
+ label(f,(0,0),align);
+ pair position=point(g,position);
+ pic.addBox(position,position,min(f),max(f));
}
void write(file file=stdout, suffix suffix=endl) {
diff --git a/Build/source/utils/asymptote/base/plain_arrows.asy b/Build/source/utils/asymptote/base/plain_arrows.asy
index 0ef8c2b2d5c..18618c2b5b8 100644
--- a/Build/source/utils/asymptote/base/plain_arrows.asy
+++ b/Build/source/utils/asymptote/base/plain_arrows.asy
@@ -543,27 +543,36 @@ void arrow(picture pic=currentpicture, Label L="", pair b, pair dir,
draw(b,pic,L,a--(0,0),align,p,arrow,margin);
}
-// Force an array of 2D pictures to be as least as large as picture all.
-void rescale2(picture[] pictures, picture all)
-{
- if(!all.empty2()) {
- transform t=inverse(all.calculateTransform()*pictures[0].T);
- pair m=t*min(all);
- pair M=t*max(all);
- for(int i=0; i < pictures.length; ++i) {
- draw(pictures[i],m,nullpen);
- draw(pictures[i],M,nullpen);
- }
- }
-}
-
-// Force an array of pictures to have a uniform scaling.
-void rescale(picture[] pictures)
-{
- if(pictures.length == 0) return;
+// Fit an array of pictures simultaneously using the sizing of picture all.
+frame[] fit2(picture[] pictures, picture all)
+{
+ frame[] out;
+ if(!all.empty2()) {
+ transform t=all.calculateTransform();
+ pair m=all.min(t);
+ pair M=all.max(t);
+ for(picture pic : pictures) {
+ frame f=pic.fit(t);
+ draw(f,m,nullpen);
+ draw(f,M,nullpen);
+ out.push(f);
+ }
+ }
+ return out;
+}
+
+// Fit an array of pictures simultaneously using the size of the first picture.
+frame[] fit(string prefix="", picture[] pictures, string format="",
+ bool view=true, string options="", string script="",
+ projection P=currentprojection)
+{
+ if(pictures.length == 0)
+ return new frame[];
+
picture all;
size(all,pictures[0]);
for(picture pic : pictures)
add(all,pic);
- rescale2(pictures,all);
+
+ return fit2(pictures,all);
}
diff --git a/Build/source/utils/asymptote/base/plain_boxes.asy b/Build/source/utils/asymptote/base/plain_boxes.asy
index 7fb82c37c1f..ff82a0b0b32 100644
--- a/Build/source/utils/asymptote/base/plain_boxes.asy
+++ b/Build/source/utils/asymptote/base/plain_boxes.asy
@@ -126,11 +126,11 @@ pair point(object F, pair dir, transform t=identity())
return z+point(F.g,T[0]);
}
-frame bbox(string prefix="", picture pic=currentpicture,
+frame bbox(picture pic=currentpicture,
real xmargin=0, real ymargin=xmargin,
pen p=currentpen, filltype filltype=NoFill)
{
- frame f=pic.fit(prefix,max(pic.xsize-2*xmargin,0),max(pic.ysize-2*ymargin,0));
+ frame f=pic.fit(max(pic.xsize-2*xmargin,0),max(pic.ysize-2*ymargin,0));
box(f,xmargin,ymargin,p,filltype,above=false);
return f;
}
diff --git a/Build/source/utils/asymptote/base/plain_constants.asy b/Build/source/utils/asymptote/base/plain_constants.asy
index c1d8c086f71..32138756891 100644
--- a/Build/source/utils/asymptote/base/plain_constants.asy
+++ b/Build/source/utils/asymptote/base/plain_constants.asy
@@ -67,6 +67,13 @@ void tab(file file) {write(file,'\t');}
void comma(file file) {write(file,',');}
typedef void suffix(file);
+// Used by interactive write to warn that the outputted type is the resolution
+// of an overloaded name.
+void overloadedMessage(file file) {
+ write(file,' <overloaded>');
+ endl(file);
+}
+
void write(suffix suffix=endl) {suffix(stdout);}
void write(file file, suffix suffix=none) {suffix(file);}
diff --git a/Build/source/utils/asymptote/base/plain_paths.asy b/Build/source/utils/asymptote/base/plain_paths.asy
index d457fa5bc28..bf3f2790c1d 100644
--- a/Build/source/utils/asymptote/base/plain_paths.asy
+++ b/Build/source/utils/asymptote/base/plain_paths.asy
@@ -178,7 +178,7 @@ slice cut(path p, path knife, int n)
slice s;
real[][] T=intersections(p,knife);
if(T.length == 0) {s.before=p; s.after=nullpath; return s;}
- T.cyclic(true);
+ T.cyclic=true;
real t=T[n][0];
s.before=subpath(p,0,t);
s.after=subpath(p,t,length(p));
diff --git a/Build/source/utils/asymptote/base/plain_pens.asy b/Build/source/utils/asymptote/base/plain_pens.asy
index fd2dfadde68..a8a0d0c7461 100644
--- a/Build/source/utils/asymptote/base/plain_pens.asy
+++ b/Build/source/utils/asymptote/base/plain_pens.asy
@@ -139,11 +139,11 @@ pen[] colorPen={red,blue,green,magenta,cyan,orange,purple,brown,
deepblue,deepgreen,chartreuse,fuchsia,lightred,
lightblue,black,pink,yellow,gray};
-colorPen.cyclic(true);
+colorPen.cyclic=true;
pen[] monoPen={solid,dashed,dotted,longdashed,dashdotted,
longdashdotted};
-monoPen.cyclic(true);
+monoPen.cyclic=true;
pen Pen(int n)
{
diff --git a/Build/source/utils/asymptote/base/plain_picture.asy b/Build/source/utils/asymptote/base/plain_picture.asy
index b3836d7ef51..432a4a6ae6d 100644
--- a/Build/source/utils/asymptote/base/plain_picture.asy
+++ b/Build/source/utils/asymptote/base/plain_picture.asy
@@ -401,10 +401,18 @@ struct transformation {
transform3 compute() {
return projection*modelview;
}
+ transformation copy() {
+ transformation T=new transformation;
+ T.modelview=copy(modelview);
+ T.projection=copy(projection);
+ T.infinity=infinity;
+ T.oblique=oblique;
+ return T;
+ }
}
struct projection {
- transform3 t; // projection*modelview (cached)
+ transform3 t; // projection*modelview (cached)
bool infinity;
bool oblique;
bool absolute=false;
@@ -420,21 +428,16 @@ struct projection {
bool autoadjust=true; // Adjust camera to lie outside bounding volume?
bool center=false; // Center target within bounding volume?
int ninterpolate; // Used for projecting nurbs to 2D Bezier curves.
+ transformation T;
void calculate() {
- transformation T=projector(camera,up,target);
+ T=projector(camera,up,target);
t=T.compute();
infinity=T.infinity;
oblique=T.oblique;
ninterpolate=infinity ? 1 : 16;
}
- transformation transformation() {
- return projector(camera,up,target);
- }
-
- transform3 modelview() {return transformation().modelview;}
-
triple vector() {
return camera-target;
}
@@ -473,6 +476,7 @@ struct projection {
P.center=center;
P.projector=projector;
P.ninterpolate=ninterpolate;
+ P.T=T.copy();
return P;
}
@@ -500,6 +504,71 @@ struct projection {
projection currentprojection;
+struct light {
+ real[][] diffuse;
+ real[][] ambient;
+ real[][] specular;
+ pen background=nullpen; // Background color of the 3D canvas.
+ real specularfactor;
+ bool viewport; // Are the lights specified (and fixed) in the viewport frame?
+ triple[] position; // Only directional lights are currently implemented.
+
+ transform3 T=identity(4); // Transform to apply to normal vectors.
+
+ bool on() {return position.length > 0;}
+
+ void operator init(pen[] diffuse,
+ pen[] ambient=array(diffuse.length,black),
+ pen[] specular=diffuse, pen background=nullpen,
+ real specularfactor=1,
+ bool viewport=false, triple[] position) {
+ int n=diffuse.length;
+ assert(ambient.length == n && specular.length == n && position.length == n);
+
+ this.diffuse=new real[n][];
+ this.ambient=new real[n][];
+ this.specular=new real[n][];
+ this.background=background;
+ this.position=new triple[n];
+ for(int i=0; i < position.length; ++i) {
+ this.diffuse[i]=rgba(diffuse[i]);
+ this.ambient[i]=rgba(ambient[i]);
+ this.specular[i]=rgba(specular[i]);
+ this.position[i]=unit(position[i]);
+ }
+ this.specularfactor=specularfactor;
+ this.viewport=viewport;
+ }
+
+ void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
+ pen background=nullpen, real specularfactor=1,
+ bool viewport=false...triple[] position) {
+ int n=position.length;
+ operator init(array(n,diffuse),array(n,ambient),array(n,specular),
+ background,specularfactor,viewport,position);
+ }
+
+ void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
+ pen background=nullpen, bool viewport=false,
+ real x, real y, real z) {
+ operator init(diffuse,ambient,specular,background,viewport,(x,y,z));
+ }
+
+ void operator init(explicit light light) {
+ diffuse=copy(light.diffuse);
+ ambient=copy(light.ambient);
+ specular=copy(light.specular);
+ background=light.background;
+ specularfactor=light.specularfactor;
+ viewport=light.viewport;
+ position=copy(light.position);
+ }
+
+ real[] background() {return rgba(background == nullpen ? white : background);}
+}
+
+light currentlight;
+
triple min3(pen p)
{
return linewidth(p)*(-0.5,-0.5,-0.5);
@@ -990,7 +1059,7 @@ struct picture {
if(status == simplex.problem.OPTIMAL) {
return scaling.build(p.a(),p.b()).a;
} else if(status == simplex.problem.UNBOUNDED) {
- if(warn) write("warning: "+dir+" scaling in picture unbounded");
+ if(warn) warning("unbounded",dir+" scaling in picture unbounded");
return 0;
} else {
if(!warn) return 1;
@@ -1001,8 +1070,8 @@ struct picture {
abort("unbounded picture");
}
if(userzero) return 1;
- write("warning: cannot fit picture to "+dir+"size "+(string) size
- +"...enlarging...");
+ warning("cannotfit","cannot fit picture to "+dir+"size "+(string) size
+ +"...enlarging...");
return calculateScaling(dir,coords,sqrt(2)*size,warn);
}
}
@@ -1184,11 +1253,11 @@ struct picture {
pair d=size(f);
static real epsilon=100*realEpsilon;
if(d.x > xsize*(1+epsilon))
- write("warning: frame exceeds xlimit: "+(string) d.x+" > "+
- (string) xsize);
+ warning("xlimit","frame exceeds xlimit: "+(string) d.x+" > "+
+ (string) xsize);
if(d.y > ysize*(1+epsilon))
- write("warning: frame exceeds ylimit: "+(string) d.y+" > "+
- (string) ysize);
+ warning("ylimit","frame exceeds ylimit: "+(string) d.y+" > "+
+ (string) ysize);
return f;
}
@@ -1290,14 +1359,15 @@ struct picture {
}
static frame fitter(string,picture,string,real,real,bool,bool,string,string,
- projection);
+ light,projection);
frame fit(string prefix="", string format="",
real xsize=this.xsize, real ysize=this.ysize,
bool keepAspect=this.keepAspect, bool view=false,
- string options="", string script="",
+ string options="", string script="", light light=currentlight,
projection P=currentprojection) {
return fitter == null ? fit2(xsize,ysize,keepAspect) :
- fitter(prefix,this,format,xsize,ysize,keepAspect,view,options,script,P);
+ fitter(prefix,this,format,xsize,ysize,keepAspect,view,options,script,
+ light,P);
}
// In case only an approximate picture size estimate is available, return the
diff --git a/Build/source/utils/asymptote/base/plain_shipout.asy b/Build/source/utils/asymptote/base/plain_shipout.asy
index 22aeef7121f..2e86822cad0 100644
--- a/Build/source/utils/asymptote/base/plain_shipout.asy
+++ b/Build/source/utils/asymptote/base/plain_shipout.asy
@@ -27,7 +27,7 @@ typedef frame orientation(frame);
orientation orientation=Portrait;
// Forward references to functions defined in module three.
-object embed3(string, frame, string, string, string, projection);
+object embed3(string, frame, string, string, string, light, projection);
string Embed(string name, string options="", real width=0, real height=0);
string Link(string label, string text, string options="");
@@ -59,10 +59,10 @@ include plain_xasy;
void shipout(string prefix=defaultfilename, frame f,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection)
+ light light=currentlight, projection P=currentprojection)
{
if(is3D(f)) {
- f=enclose(prefix,embed3(prefix,f,format,options,script,P));
+ f=enclose(prefix,embed3(prefix,f,format,options,script,light,P));
if(settings.render != 0 && !prc(format)) {
shipped=true;
return;
@@ -88,14 +88,14 @@ void shipout(string prefix=defaultfilename, picture pic=currentpicture,
orientation orientation=orientation,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection)
+ light light=currentlight, projection P=currentprojection)
{
if(!uptodate()) {
bool inlinetex=settings.inlinetex;
bool prc=prc(format);
if(prc && !pic.empty3())
settings.inlinetex=settings.inlineimage;
- frame f=pic.fit(prefix,format,view=view,options,script,P);
+ frame f=pic.fit(prefix,format,view=view,options,script,light,P);
if(!pic.empty2() || settings.render == 0 || prc)
shipout(prefix,orientation(f),format,wait,view);
settings.inlinetex=inlinetex;
diff --git a/Build/source/utils/asymptote/base/slide.asy b/Build/source/utils/asymptote/base/slide.asy
index b154c1d4746..b23a352fc5d 100644
--- a/Build/source/utils/asymptote/base/slide.asy
+++ b/Build/source/utils/asymptote/base/slide.asy
@@ -217,11 +217,10 @@ bool checkposition()
return true;
}
-void step()
-{
+void erasestep(int erasenode) {
if(!stepping || !allowstepping) return;
if(!checkposition()) return;
- lastnode.push(currentpicture.nodes.length-1);
+ lastnode.push(erasenode);
nextpage(steppagenumberpen);
for(int i=0; i < firstnode.length; ++i) {
for(int j=firstnode[i]; j <= lastnode[i]; ++j) {
@@ -233,6 +232,12 @@ void step()
tex(bulletcolor(newbulletcolor));
}
+void step()
+{
+ // Step without erasing anything.
+ erasestep(currentpicture.nodes.length-1);
+}
+
void incrementposition(pair z)
{
currentposition += z;
@@ -279,11 +284,13 @@ void remark(bool center=false, string s, pair align=0, pen p=itempen,
pair M=tinv*min(f);
if(abs(offset.x+M.x) > 1)
- write("warning: slide too wide on page "+(string) page+':\n'+(string) s);
+ warning("slidetoowide","slide too wide on page "+(string) page+':\n'+
+ (string) s);
if(abs(offset.y+M.y) > 1) {
void toohigh() {
- write("warning: slide too high on page "+(string) page+':\n'+(string) s);
+ warning("slidetoohigh","slide too high on page "+(string) page+':\n'+
+ (string) s);
}
if(M.y-m.y < 2) {
newslide(); offset=(offset.x,currentposition.y);
@@ -326,7 +333,7 @@ void skip(real n=1)
}
void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
if(f.length == 0) return;
real[] width=new real[f.length];
@@ -336,7 +343,7 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
sum += width[i];
}
if(sum > pagewidth)
- write("warning: slide too wide on page "+(string) page);
+ warning("toowide","slide too wide on page "+(string) page);
else margin=(pagewidth-sum)/(f.length+1);
real pos;
frame F;
@@ -347,19 +354,22 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
pos += w;
}
add(F,(0,currentposition.y),align);
- real a=0.5(unit(align).y-1);
- incrementposition((0,(tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ if (final) {
+ real a=0.5(unit(align).y-1);
+ incrementposition(
+ (0, (tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ }
}
void display(frame f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new frame[] {f},margin,align,p,figuremattpen);
+ display(new frame[] {f},margin,align,p,figuremattpen, final);
}
void display(string[] s, real margin=0, string[] captions=new string[],
string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
frame[] f=new frame[s.length];
frame F;
@@ -374,32 +384,59 @@ void display(string[] s, real margin=0, string[] captions=new string[],
if(captions[i] != "")
label(f[i],captions[i],point(f[i],S).x+I*y,S);
}
- display(f,margin,align,p,figuremattpen);
+ display(f,margin,align,p,figuremattpen, final);
if(caption != "") center(caption,p);
}
void display(string s, string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new string[] {s},caption,align,p,figuremattpen);
+ display(new string[] {s},caption,align,p,figuremattpen, final);
}
void figure(string[] s, string options="", real margin=0,
string[] captions=new string[], string caption="",
- pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen,
+ bool final=true)
{
string[] S;
for(int i=0; i < s.length; ++i) {
S[i]=graphic(s[i],options);
}
- display(S,margin,captions,caption,align,itempen,figuremattpen);
+ display(S,margin,captions,caption,align,itempen,figuremattpen, final);
}
void figure(string s, string options="", string caption="", pair align=S,
- pen p=itempen, pen figuremattpen=figuremattpen)
+ pen p=itempen, pen figuremattpen=figuremattpen, bool final=true)
+{
+ figure(new string[] {s},options,caption,align,p,figuremattpen, final);
+}
+
+void multifigure(string[] slist, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+{
+ if (stepping) {
+ int lastnode = currentpicture.nodes.length-1;
+ for (int i=0; i<slist.length-1; ++i) {
+ figure(slist[i], options, caption, align, p, figuremattpen, final=false);
+ erasestep(lastnode);
+ }
+ }
+ figure(slist[slist.length-1], options, caption, align, p, figuremattpen,
+ final=true);
+
+ if(!firststep) step();
+ firststep=false;
+}
+
+void indexedfigure(string prefix, int n, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
{
- figure(new string[] {s},options,caption,align,p,figuremattpen);
+ string[] s;
+ for (int i=0; i<n; ++i)
+ s.push(prefix+"+"+string(i));
+ multifigure(s, options, caption, align, p, figuremattpen);
}
string[] codefile;
diff --git a/Build/source/utils/asymptote/base/solids.asy b/Build/source/utils/asymptote/base/solids.asy
index 0b2ffa2a508..db98af3088c 100644
--- a/Build/source/utils/asymptote/base/solids.asy
+++ b/Build/source/utils/asymptote/base/solids.asy
@@ -212,7 +212,8 @@ struct revolution {
// must be recomputed if camera is adjusted
path3[] silhouette(int m=64, projection P=currentprojection) {
if(is3D())
- write("warning: silhouette routine is intended only for 2d projections");
+ warning("2Dsilhouette",
+ "silhouette routine is intended only for 2d projections");
path3 G,H;
int N=size(g);
int M=(m == 0) ? N : m;
diff --git a/Build/source/utils/asymptote/base/syzygy.asy b/Build/source/utils/asymptote/base/syzygy.asy
index dce87805c9d..93889b252e5 100644
--- a/Build/source/utils/asymptote/base/syzygy.asy
+++ b/Build/source/utils/asymptote/base/syzygy.asy
@@ -669,16 +669,6 @@ Braid apply(Relation r, Braid b, int step, int place) {
}
// Tableau {{{1
-frame[] fit(picture[] pics) {
- frame[] f;
- for (int i=0; i<pics.length; ++i) {
- frame ff=pics[i].fit();
- //label(ff, (string)i, (10,10));
- //f.push(pics[i].fit());
- f.push(ff);
- }
- return f;
-}
// Draw a number of frames in a nice circular arrangement.
picture tableau(frame[] cards, bool number=false) {
diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy
index 39075193073..1f9392ee094 100644
--- a/Build/source/utils/asymptote/base/three.asy
+++ b/Build/source/utils/asymptote/base/three.asy
@@ -13,13 +13,11 @@ if(prc0()) {
real defaultshininess=0.25;
real defaultgranularity=0;
-real linegranularity=0.01;
-real tubegranularity=0.003;
+real linegranularity=0.005;
+int linesectors=8; // Number of angular sectors.
real dotgranularity=0.0001;
-real viewportfactor=1.002; // Factor used to expand orthographic viewport.
-real angleprecision=1e-3; // Precision for centering perspective projections.
-real anglefactor=max(1.01,1+angleprecision);
-// Factor used to expand perspective viewport.
+real angleprecision=1e-5; // Precision for centering perspective projections.
+real rendermargin=0.02;
string defaultembed3Doptions;
string defaultembed3Dscript;
@@ -137,7 +135,9 @@ triple project(triple u, triple v)
triple perp(triple v)
{
triple u=cross(v,Y);
- return (abs(u) > sqrtEpsilon) ? unit(u) : unit(cross(v,Z));
+ if(abs(u) > sqrtEpsilon) return unit(u);
+ u=cross(v,Z);
+ return (abs(u) > sqrtEpsilon) ? unit(u) : X;
}
// Return the transformation corresponding to moving the camera from the target
@@ -757,7 +757,7 @@ real[] theta(triple[] v, real[] alpha, real[] beta,
{
real[] a,b,c,f,l,psi;
int n=alpha.length;
- bool cyclic=v.cyclicflag;
+ bool cyclic=v.cyclic;
for(int i=0; i < n; ++i)
l[i]=1/length(v[i+1]-v[i]);
int i0,in;
@@ -766,8 +766,8 @@ real[] theta(triple[] v, real[] alpha, real[] beta,
for(int i=0; i < in; ++i)
psi[i]=angle(v[i+1]-v[i],v[i+2]-v[i+1],reference);
if(cyclic) {
- l.cyclic(true);
- psi.cyclic(true);
+ l.cyclic=true;
+ psi.cyclic=true;
} else {
psi[n-1]=0;
if(dir0 == O) {
@@ -869,9 +869,9 @@ void aim(flatguide3 g, int N)
beta[k]=g.Tension[K].in;
}
if(cyclic) {
- v.cyclic(true);
- alpha.cyclic(true);
- beta.cyclic(true);
+ v.cyclic=true;
+ alpha.cyclic=true;
+ beta.cyclic=true;
} else v[n]=g.nodes[(start+n) % N];
int final=(end-1) % N;
@@ -883,8 +883,8 @@ void aim(flatguide3 g, int N)
real[] theta=theta(v,alpha,beta,d0,d1,g.out[start].gamma,g.in[final].gamma,
reference);
- v.cyclic(true);
- theta.cyclic(true);
+ v.cyclic=true;
+ theta.cyclic=true;
for(int k=1; k < (cyclic ? n+1 : n); ++k) {
triple w=dir(theta[k],v[k]-v[k-1],v[k+1]-v[k],reference);
@@ -1029,6 +1029,17 @@ path3[] path3(explicit path[] g, triple plane(pair)=XYplane)
return sequence(new path3(int i) {return path3(g[i],plane);},g.length);
}
+path3 invert(path p, triple normal, triple point,
+ projection P=currentprojection)
+{
+ return path3(p,new triple(pair z) {return invert(z,normal,point,P);});
+}
+
+path3 invert(path p, projection P=currentprojection)
+{
+ return path3(p,new triple(pair z) {return invert(z,P);});
+}
+
// Construct a path from a path3 by applying P to each control point.
path path(path3 p, pair P(triple)=xypart)
{
@@ -1801,6 +1812,16 @@ triple[] operator * (transform3 t, triple[] v)
return sequence(new triple(int i) {return t*v[i];},v.length);
}
+triple[][] operator * (transform3 t, triple[][] v)
+{
+ triple[][] V=new triple[v.length][];
+ for(int i=0; i < v.length; ++i) {
+ triple[] vi=v[i];
+ V[i]=sequence(new triple(int j) {return t*vi[j];},vi.length);
+ }
+ return V;
+}
+
triple min(explicit path3[] p)
{
checkEmpty(p.length);
@@ -1978,6 +1999,38 @@ void addPath(picture pic, path3 g, pen p)
include three_surface;
include three_margins;
+pair min(path3 p, projection P)
+{
+ path3 q=P.T.modelview*p;
+ if(P.infinity)
+ return xypart(min(q));
+ return maxratio(q)/P.T.projection[3][2];
+}
+
+pair max(path3 p, projection P)
+{
+ path3 q=P.T.modelview*p;
+ if(P.infinity)
+ return xypart(max(q));
+ return minratio(q)/P.T.projection[3][2];
+}
+
+pair min(frame f, projection P)
+{
+ frame g=P.T.modelview*f;
+ if(P.infinity)
+ return xypart(min3(g));
+ return maxratio(g)/P.T.projection[3][2];
+}
+
+pair max(frame f, projection P)
+{
+ frame g=P.T.modelview*f;
+ if(P.infinity)
+ return xypart(max3(g));
+ return minratio(g)/P.T.projection[3][2];
+}
+
void draw(picture pic=currentpicture, Label L="", path3 g,
align align=NoAlign, material p=currentpen, margin3 margin=NoMargin3,
light light=nolight)
@@ -1988,8 +2041,8 @@ void draw(picture pic=currentpicture, Label L="", path3 g,
if(is3D()) {
draw(f,G,p,light,null);
if(pic != null && size(G) > 0) {
- pic.addPoint(min(G,P.t));
- pic.addPoint(max(G,P.t));
+ pic.addPoint(min(G,P));
+ pic.addPoint(max(G,P));
}
}
if(pic != null)
@@ -2004,7 +2057,7 @@ void draw(picture pic=currentpicture, Label L="", path3 g,
addPath(pic,g,q);
}
-include three_arrows;
+include three_tube;
draw=new void(frame f, path3 g, material p=currentpen,
light light=nolight, projection P=currentprojection) {
@@ -2015,7 +2068,7 @@ draw=new void(frame f, path3 g, material p=currentpen,
if(settings.thick) {
real width=linewidth(q);
if(width > 0) {
- tube T=tube(g,width,p.granularity);
+ tube T=tube(g,width,linesectors);
int L=length(g);
if(L >= 0) {
if(!cyclic(g)) {
@@ -2050,7 +2103,7 @@ draw=new void(frame f, path3 g, material p=currentpen,
else {
real[] dash=(real[]) split(type," ");
if(sum(dash) > 0) {
- dash.cyclic(true);
+ dash.cyclic=true;
real offset=offset(q);
real L=arclength(g);
int i=0;
@@ -2081,6 +2134,8 @@ void draw(picture pic=currentpicture, explicit path3[] g,
for(int i=0; i < g.length; ++i) draw(pic,g[i],p,margin,light);
}
+include three_arrows;
+
void draw(picture pic=currentpicture, Label L="", path3 g,
align align=NoAlign, material p=currentpen, arrowbar3 arrow,
arrowbar3 bar=None, margin3 margin=NoMargin3, light light=nolight,
@@ -2321,7 +2376,7 @@ pair viewportmargin(pair lambda)
string embed3D(string label="", string text=label, string prefix,
frame f, string format="",
- real width=0, real height=0, real angle=30,
+ real width=0, real height=0,
string options="", string script="",
light light=currentlight, projection P=currentprojection)
{
@@ -2341,7 +2396,7 @@ string embed3D(string label="", string text=label, string prefix,
pair margin=viewportmargin((lambda.x,lambda.y));
viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/(cm*P.zoom);
} else
- if(!P.absolute) angle=2*aTan(Tan(0.5*angle));
+ if(!P.absolute) P.angle=2*aTan(Tan(0.5*P.angle));
string name=prefix+".js";
writeJavaScript(name,lightscript+projection(P.infinity,viewplanesize),script);
@@ -2375,7 +2430,7 @@ string embed3D(string label="", string text=label, string prefix,
options3 += ",poster";
options3 += ",text={"+text+"},label="+label+
",toolbar="+(settings.toolbar ? "true" : "false")+
- ",3Daac="+Format(P.absolute ? P.angle : angle)+
+ ",3Daac="+Format(P.angle)+
",3Dc2c="+Format(u)+
",3Dcoo="+Format(target/cm)+
",3Droll="+Format(roll)+
@@ -2387,302 +2442,350 @@ string embed3D(string label="", string text=label, string prefix,
return Embed(stripdirectory(prefix),options3,width,height);
}
-object embed(string label="", string text=label,
- string prefix=defaultfilename,
- frame f, string format="",
- real width=0, real height=0, real angle=30,
- string options="", string script="",
- light light=currentlight, projection P=currentprojection)
-{
- object F;
-
- if(is3D(format))
- F.L=embed3D(label,text,prefix,f,format,width,height,angle,options,script,
- light,P);
- else
- F.f=f;
- return F;
-}
-
-object embed(string label="", string text=label,
- string prefix=defaultfilename,
- picture pic, string format="",
- real xsize=pic.xsize, real ysize=pic.ysize,
- bool keepAspect=pic.keepAspect, bool view=true, string options="",
- string script="", real angle=0,
- light light=currentlight, projection P=currentprojection)
+struct scene
{
- object F;
- real xsize3=pic.xsize3, ysize3=pic.ysize3, zsize3=pic.zsize3;
- bool warn=true;
- transform3 modelview;
-
- if(xsize3 == 0 && ysize3 == 0 && zsize3 == 0) {
- xsize3=ysize3=zsize3=max(xsize,ysize);
- warn=false;
+ frame f;
+ transform3 t;
+ projection P;
+ bool adjusted;
+ real width,height;
+ transform3 T=identity4;
+ picture pic2;
+
+ void operator init(frame f, projection P=currentprojection) {
+ this.f=f;
+ this.t=identity4;
+ this.P=P;
}
+
+ void operator init(picture pic, real xsize=pic.xsize, real ysize=pic.ysize,
+ bool keepAspect=pic.keepAspect, bool is3D=true,
+ projection P=currentprojection) {
+ real xsize3=pic.xsize3, ysize3=pic.ysize3, zsize3=pic.zsize3;
+ bool warn=true;
+
+ if(xsize3 == 0 && ysize3 == 0 && zsize3 == 0) {
+ xsize3=ysize3=zsize3=max(xsize,ysize);
+ warn=false;
+ }
- projection P=P.copy();
+ if(P.absolute)
+ this.P=P.copy();
+ else if(P.showtarget)
+ draw(pic,P.target,nullpen);
- if(!P.absolute && P.showtarget)
- draw(pic,P.target,nullpen);
+ t=pic.scaling(xsize3,ysize3,zsize3,keepAspect,warn);
+ adjusted=false;
+ triple m=pic.min(t);
+ triple M=pic.max(t);
- transform3 t=pic.scaling(xsize3,ysize3,zsize3,keepAspect,warn);
- bool adjusted=false;
- transform3 tinv=inverse(t);
- triple m=pic.min(t);
- triple M=pic.max(t);
+ if(!P.absolute) {
+ this.P=t*P;
+ if(this.P.center) {
+ bool recalculate=false;
+ triple target=0.5*(m+M);
+ this.P.target=target;
+ recalculate=true;
+ if(recalculate) this.P.calculate();
+ }
+ if(this.P.autoadjust || this.P.infinity)
+ adjusted=adjusted | this.P.adjust(m,M);
+ }
- if(!P.absolute) {
- P=t*P;
- if(P.center) {
- bool recalculate=false;
- triple target=0.5*(m+M);
- P.target=target;
- recalculate=true;
- if(recalculate) P.calculate();
+ f=pic.fit3(t,pic.bounds3.exact ? pic2 : null,this.P);
+
+ if(!pic.bounds3.exact) {
+ transform3 s=pic.scale3(f,xsize3,ysize3,zsize3,keepAspect);
+ t=s*t;
+ this.P=s*this.P;
+ f=pic.fit3(t,pic2,this.P);
}
- if(P.autoadjust || P.infinity)
- adjusted=adjusted | P.adjust(m,M);
- }
- picture pic2;
-
- frame f=pic.fit3(t,pic.bounds3.exact ? pic2 : null,P);
+ bool scale=xsize != 0 || ysize != 0;
+
+ if(is3D || scale) {
+ pic2.bounds.exact=true;
+ transform s=pic2.scaling(xsize,ysize,keepAspect);
+
+ pair m2=pic2.min(s);
+ pair M2=pic2.max(s);
+ pair lambda=M2-m2;
+ pair viewportmargin=viewportmargin(lambda);
+ width=ceil(lambda.x+2*viewportmargin.x);
+ height=ceil(lambda.y+2*viewportmargin.y);
+
+ if(!this.P.absolute) {
+ if(scale && this.P.autoadjust) {
+ pair v=(s.xx,s.yy);
+ transform3 T=this.P.t;
+ pair x=project(X,T);
+ pair y=project(Y,T);
+ pair z=project(Z,T);
+ real f(pair a, pair b) {
+ return b == 0 ? (0.5*(a.x+a.y)) :
+ (b.x^2*a.x+b.y^2*a.y)/(b.x^2+b.y^2);
+ }
+ pic2.erase();
+ transform3 s=keepAspect ? scale3(min(f(v,x),f(v,y),f(v,z))) :
+ xscale3(f(v,x))*yscale3(f(v,y))*zscale3(f(v,z));
+ s=shift(this.P.target)*s*shift(-this.P.target);
+ t=s*t;
+ this.P=s*this.P;
+ f=pic.fit3(t,is3D ? null : pic2,this.P);
+ }
- if(!pic.bounds3.exact) {
- transform3 s=pic.scale3(f,xsize3,ysize3,zsize3,keepAspect);
- t=s*t;
- tinv=inverse(t);
- P=s*P;
- f=pic.fit3(t,pic2,P);
+ if(this.P.autoadjust || this.P.infinity)
+ adjusted=adjusted | this.P.adjust(min3(f),max3(f));
+ }
+ }
}
- bool is3D=is3D(format);
- bool scale=xsize != 0 || ysize != 0;
-
- if(is3D || scale) {
- pic2.bounds.exact=true;
- transform s=pic2.scaling(xsize,ysize,keepAspect);
- pair m2=pic2.min(s);
- pair M2=pic2.max(s);
- pair lambda=M2-m2;
- pair viewportmargin=viewportmargin(lambda);
- real width=ceil(lambda.x+2*viewportmargin.x);
- real height=ceil(lambda.y+2*viewportmargin.y);
-
- projection Q;
- if(!P.absolute) {
- if(scale && P.autoadjust) {
- pair v=(s.xx,s.yy);
- transform3 T=P.t;
- pair x=project(X,T);
- pair y=project(Y,T);
- pair z=project(Z,T);
- real f(pair a, pair b) {
- return b == 0 ? (0.5*(a.x+a.y)) : (b.x^2*a.x+b.y^2*a.y)/(b.x^2+b.y^2);
+ // Choose the angle to be just large enough to view the entire image.
+ real angle(projection P) {
+ T=identity4;
+ int maxiterations=100;
+ real h=-0.5*P.target.z;
+ pair r,R;
+ real diff=realMax;
+ pair s;
+ int i;
+ do {
+ r=minratio(f);
+ R=maxratio(f);
+ pair lasts=s;
+ if(P.autoadjust) {
+ s=r+R;
+ if(s != 0) {
+ transform3 t=shift(h*s.x,h*s.y,0);
+ f=t*f;
+ T=t*T;
+ adjusted=true;
}
- pic2.erase();
- transform3 s=keepAspect ? scale3(min(f(v,x),f(v,y),f(v,z))) :
- xscale3(f(v,x))*yscale3(f(v,y))*zscale3(f(v,z));
- s=shift(P.target)*s*shift(-P.target);
- t=s*t;
- P=s*P;
- f=pic.fit3(t,is3D ? null : pic2,P);
}
+ diff=abs(s-lasts);
+ ++i;
+ } while (diff > angleprecision && i < maxiterations);
+ real aspect=width > 0 ? height/width : 1;
+ real rx=-r.x*aspect;
+ real Rx=R.x*aspect;
+ real ry=-r.y;
+ real Ry=R.y;
+ if(!P.autoadjust) {
+ if(rx > Rx) Rx=rx;
+ else rx=Rx;
+ if(ry > Ry) Ry=ry;
+ else ry=Ry;
+ }
+ return (1+angleprecision)*max(aTan(rx)+aTan(Rx),aTan(ry)+aTan(Ry));
+ }
+}
- if(P.autoadjust || P.infinity)
- adjusted=adjusted | P.adjust(min3(f),max3(f));
+object embed(string label="", string text=label, string prefix=defaultfilename,
+ scene S, string format="", bool view=true, string options="",
+ string script="", light light=currentlight)
+{
+ object F;
+ transform3 modelview;
+ projection P=S.P;
+ transform3 tinv=inverse(S.t);
- triple target=P.target;
- modelview=P.modelview();
- f=modelview*f;
- P=modelview*P;
- Q=P.copy();
- light=modelview*light;
-
- if(P.infinity) {
- triple m=min3(f);
- triple M=max3(f);
- triple lambda=M-m;
- viewportmargin=viewportmargin((lambda.x,lambda.y));
- width=lambda.x+2*viewportmargin.x;
- height=lambda.y+2*viewportmargin.y;
- f=shift((-0.5(m.x+M.x),-0.5*(m.y+M.y),0))*f; // Eye will be at (0,0,0).
- } else {
- transform3 T=identity4;
- // Choose the angle to be just large enough to view the entire image:
- if(angle == 0) angle=P.angle;
- int maxiterations=100;
- if(is3D && angle == 0) {
- real h=-0.5*P.target.z;
- pair r,R;
- real diff=realMax;
- pair s;
- int i;
- do {
- r=minratio(f);
- R=maxratio(f);
- pair lasts=s;
- if(P.autoadjust) {
- s=r+R;
- if(s != 0) {
- transform3 t=shift(h*s.x,h*s.y,0);
- f=t*f;
- T=t*T;
- adjusted=true;
- }
- }
- diff=abs(s-lasts);
- ++i;
- } while (diff > angleprecision && i < maxiterations);
- real aspect=width > 0 ? height/width : 1;
- real rx=-r.x*aspect;
- real Rx=R.x*aspect;
- real ry=-r.y;
- real Ry=R.y;
- if(!P.autoadjust) {
- if(rx > Rx) Rx=rx;
- else rx=Rx;
- if(ry > Ry) Ry=ry;
- else ry=Ry;
- }
-
- angle=anglefactor*max(aTan(rx)+aTan(Rx),aTan(ry)+aTan(Ry));
- if(viewportmargin.y != 0)
- angle=2*aTan(Tan(0.5*angle)-viewportmargin.y/P.target.z);
-
- modelview=T*modelview;
- }
- if(settings.verbose > 0) {
- transform3 inv=inverse(modelview);
- if(adjusted)
- write("adjusting camera to ",tinv*inv*P.camera);
- target=inv*P.target;
- }
- P=T*P;
+ projection Q;
+ modelview=P.T.modelview;
+ if(P.absolute) {
+ Q=modelview*P;
+ } else {
+ triple target=P.target;
+ S.f=modelview*S.f;
+ P=modelview*P;
+ Q=P.copy();
+ light=modelview*light;
+
+ pair viewportmargin=viewportmargin;
+ if(P.infinity) {
+ triple m=min3(S.f);
+ triple M=max3(S.f);
+ triple lambda=M-m;
+ viewportmargin=viewportmargin((lambda.x,lambda.y));
+ S.width=lambda.x+2*viewportmargin.x;
+ S.height=lambda.y+2*viewportmargin.y;
+ S.f=shift((-0.5(m.x+M.x),-0.5*(m.y+M.y),0))*S.f; // Eye will be at (0,0,0)
+ } else {
+ if(P.angle == 0) {
+ Q.angle=P.angle=S.angle(P);
+ modelview=S.T*modelview;
+ if(viewportmargin.y != 0)
+ P.angle=2*aTan(Tan(0.5*P.angle)-viewportmargin.y/P.target.z);
}
if(settings.verbose > 0) {
- if(P.center || (!P.infinity && P.autoadjust))
- write("adjusting target to ",tinv*target);
+ transform3 inv=inverse(modelview);
+ if(S.adjusted)
+ write("adjusting camera to ",tinv*inv*P.camera);
+ target=inv*P.target;
}
+ P=S.T*P;
}
+ if(settings.verbose > 0) {
+ if(P.center || (!P.infinity && P.autoadjust))
+ write("adjusting target to ",tinv*target);
+ }
+ }
- if(prefix == "") prefix=outprefix();
- bool prc=prc(format);
- bool preview=settings.render > 0;
- if(prc) {
- // The movie15.sty package cannot handle spaces or dots in filenames.
- prefix=replace(prefix,new string[][]{{" ","_"},{".","_"}});
- if(settings.embed || nativeformat() == "pdf")
- prefix += "+"+(string) file3.length;
- } else
- preview=false;
- if(preview || (!prc && settings.render != 0)) {
- frame f=f;
- triple m,M;
- real zcenter;
- if(P.absolute) {
- modelview=P.modelview();
- f=modelview*f;
- Q=modelview*P;
- m=min3(f);
- M=max3(f);
- real r=0.5*abs(M-m);
- zcenter=0.5*(M.z+m.z);
- M=(M.x,M.y,zcenter+r);
- m=(m.x,m.y,zcenter-r);
- angle=P.angle;
- } else {
- m=min3(f);
- M=max3(f);
- zcenter=P.target.z;
- real d=P.distance(m,M);
- M=(M.x,M.y,zcenter+d);
- m=(m.x,m.y,zcenter-d);
- }
-
- if(P.infinity) {
- triple margin=(viewportfactor-1.0)*(abs(M.x-m.x),abs(M.y-m.y),0)
- +(viewportmargin.x,viewportmargin.y,0);
- M += margin;
- m -= margin;
- } else if(M.z >= 0) abort("camera too close");
-
- shipout3(prefix,f,preview ? nativeformat() : format,
- width,height,P.infinity ? 0 : 2aTan(Tan(0.5*angle)*P.zoom),
- P.zoom,m,M,P.viewportshift,
- tinv*inverse(modelview)*shift(0,0,zcenter),light.background(),
- P.absolute ? (modelview*light).position : light.position,
- light.diffuse,light.ambient,light.specular,
- light.viewport,view && !preview);
- if(!preview) return F;
+ if(prefix == "") prefix=outprefix();
+ bool prc=prc(format);
+ bool preview=settings.render > 0;
+ if(prc) {
+ // The movie15.sty package cannot handle spaces or dots in filenames.
+ prefix=replace(prefix,new string[][]{{" ","_"},{".","_"}});
+ if(settings.embed || nativeformat() == "pdf")
+ prefix += "+"+(string) file3.length;
+ } else
+ preview=false;
+ if(preview || (!prc && settings.render != 0)) {
+ frame f=S.f;
+ triple m,M;
+ real zcenter;
+ real r;
+ if(P.absolute) {
+ f=modelview*f;
+ m=min3(f);
+ M=max3(f);
+ r=0.5*abs(M-m);
+ zcenter=0.5*(M.z+m.z);
+ } else {
+ m=min3(f);
+ M=max3(f);
+ zcenter=P.target.z;
+ r=P.distance(m,M);
}
+ M=(M.x,M.y,zcenter+r);
+ m=(m.x,m.y,zcenter-r);
+
+ if(P.infinity) {
+ triple margin=(viewportmargin.x,viewportmargin.y,0);
+ M += margin;
+ m -= margin;
+ } else if(M.z >= 0) abort("camera too close");
+
+ shipout3(prefix,f,preview ? nativeformat() : format,
+ S.width-rendermargin,S.height-rendermargin,
+ P.infinity ? 0 : 2aTan(Tan(0.5*P.angle)*P.zoom),
+ P.zoom,m,M,P.viewportshift,
+ tinv*inverse(modelview)*shift(0,0,zcenter),light.background(),
+ P.absolute ? (modelview*light).position : light.position,
+ light.diffuse,light.ambient,light.specular,
+ light.viewport,view && !preview);
+ if(!preview) return F;
+ }
+
+ string image;
+ if(preview && settings.embed) {
+ image=prefix;
+ if(settings.inlinetex) image += "_0";
+ image += "."+nativeformat();
+ if(!settings.inlinetex) file3.push(image);
+ image=graphic(image,"hiresbb");
+ }
+ if(prc) {
+ if(!P.infinity && P.viewportshift != 0)
+ warning("offaxis",
+ "PRC does not support off-axis projections; use pan instead of
+shift");
+ F.L=embed3D(label,text=image,prefix,S.f,format,
+ S.width-2,S.height-2,options,script,light,Q);
+ }
+ return F;
+}
- string image;
- if(preview && settings.embed) {
- image=prefix;
- if(settings.inlinetex) image += "_0";
- image += "."+nativeformat();
- if(!settings.inlinetex) file3.push(image);
- image=graphic(image,"hiresbb");
- }
- if(prc) {
- if(!P.infinity && P.viewportshift != 0)
- write("warning: PRC does not support off-axis projections; use pan instead of shift");
- F.L=embed3D(label,text=image,prefix,f,format,
- width,height,angle,options,script,light,Q);
- }
-
+object embed(string label="", string text=label,
+ string prefix=defaultfilename,
+ picture pic, string format="",
+ real xsize=pic.xsize, real ysize=pic.ysize,
+ bool keepAspect=pic.keepAspect, bool view=true, string options="",
+ string script="", light light=currentlight,
+ projection P=currentprojection)
+{
+ bool is3D=is3D(format);
+ scene S=scene(pic,xsize,ysize,keepAspect,is3D,P);
+ if(is3D)
+ return embed(label,text,prefix,S,format,view,options,script,light);
+ else {
+ object F;
+ transform T=S.pic2.scaling(xsize,ysize,keepAspect);
+ F.f=pic.fit(scale(S.t[0][0])*T);
+ add(F.f,S.pic2.fit(T));
+ return F;
}
+}
- if(!is3D) {
- transform T=pic2.scaling(xsize,ysize,keepAspect);
- F.f=pic.fit(scale(t[0][0])*T);
- add(F.f,pic2.fit(T));
+object embed(string label="", string text=label,
+ string prefix=defaultfilename,
+ frame f, string format="", real width=0, real height=0,
+ bool view=true, string options="", string script="",
+ light light=currentlight, projection P=currentprojection)
+{
+ if(is3D(format))
+ return embed(label,text,prefix,scene(f,P),format,view,options,script,light);
+ else {
+ object F;
+ F.f=f;
+ return F;
}
-
- return F;
}
embed3=new object(string prefix, frame f, string format, string options,
- string script, projection P) {
- return embed(prefix=prefix,f,format,options,script,P);
+ string script, light light, projection P) {
+ return embed(prefix=prefix,f,format,options,script,light,P);
};
+frame embedder(object embedder(string prefix, string format),
+ string prefix, string format, bool view, light light)
+{
+ frame f;
+ bool prc=prc(format);
+ if(!prc && settings.render != 0 && !view) {
+ static int previewcount=0;
+ bool keep=prefix != "";
+ prefix=outprefix(prefix)+"+"+(string) previewcount;
+ ++previewcount;
+ format=nativeformat();
+ if(!keep) file3.push(prefix+"."+format);
+ }
+ object F=embedder(prefix,format);
+ if(prc)
+ label(f,F.L);
+ else {
+ if(settings.render == 0) {
+ add(f,F.f);
+ if(light.background != nullpen)
+ box(f,light.background,Fill,above=false);
+ } else if(!view)
+ label(f,graphic(prefix,"hiresbb"));
+ }
+ return f;
+}
+
currentpicture.fitter=new frame(string prefix, picture pic, string format,
- real xsize, real ysize,
- bool keepAspect, bool view,
- string options, string script, projection P) {
+ real xsize, real ysize, bool keepAspect,
+ bool view, string options, string script,
+ light light, projection P) {
frame f;
bool empty3=pic.empty3();
+ if(!empty3) f=embedder(new object(string prefix, string format) {
+ return embed(prefix=prefix,pic,format,xsize,ysize,keepAspect,view,
+ options,script,light,P);
+ },prefix,format,view,light);
if(is3D(format) || empty3) add(f,pic.fit2(xsize,ysize,keepAspect));
- if(!empty3) {
- bool prc=prc(format);
- if(!prc && settings.render != 0 && !view) {
- static int previewcount=0;
- bool keep=prefix != "";
- prefix=outprefix(prefix)+"+"+(string) previewcount;
- ++previewcount;
- format=nativeformat();
- if(!keep) file3.push(prefix+"."+format);
- }
- object F=embed(prefix=prefix,pic,format,xsize,ysize,keepAspect,view,
- options,script,currentlight,P);
- if(prc)
- label(f,F.L);
- else {
- if(settings.render == 0) {
- add(f,F.f);
- if(currentlight.background != nullpen)
- box(f,currentlight.background,Fill,above=false);
- } else if(!view)
- label(f,graphic(prefix,"hiresbb"));
- }
- }
return f;
};
+frame embedder(string prefix, frame f, string format, bool view,
+ string options, string script, light light, projection P)
+{
+ return embedder(new object(string prefix, string format) {
+ return embed(prefix=prefix,f,format,view,options,script,light,P);
+ },prefix,format,view,light);
+}
+
void addViews(picture dest, picture src, bool group=true,
filltype filltype=NoFill)
{
@@ -2733,29 +2836,53 @@ void addAllViews(picture src, bool group=true, filltype filltype=NoFill)
addAllViews(currentpicture,src,group,filltype);
}
-// Force an array of 3D pictures to be as least as large as picture all.
-void rescale3(picture[] pictures, picture all, projection P=currentprojection)
+// Fit an array of 3D pictures simultaneously using the sizing of picture all.
+frame[] fit3(string prefix="", picture[] pictures, picture all,
+ string format="", bool view=true, string options="",
+ string script="", light light=currentlight,
+ projection P=currentprojection)
{
- if(!all.empty3()) {
- transform3 t=inverse(all.calculateTransform3(P)*pictures[0].T3);
- triple m=t*min3(all);
- triple M=t*max3(all);
+ frame[] out;
+ scene S=scene(all,P);
+ triple m=all.min(S.t);
+ triple M=all.max(S.t);
+ out=new frame[pictures.length];
+ int i=0;
+ bool loop=settings.loop;
+ for(picture pic : pictures) {
+ picture pic2;
+ frame f=pic.fit3(S.t,pic2,S.P);
+ if(loop && !settings.loop) break;
+ add(f,pic2.fit2());
+ draw(f,m,nullpen);
+ draw(f,M,nullpen);
+ out[i]=loop ? f : embedder(prefix,f,format,view,options,script,light,S.P);
+ ++i;
+ }
+
+ while(settings.loop)
for(int i=0; i < pictures.length; ++i) {
- draw(pictures[i],m,nullpen);
- draw(pictures[i],M,nullpen);
+ if(!settings.loop) break;
+ embedder(prefix,out[i],format,view,options,script,light,S.P);
}
- }
+
+ return out;
}
-// Force an array of pictures to have a uniform scaling using currenprojection.
-rescale=new void(picture[] pictures) {
- if(pictures.length == 0) return;
+// Fit an array of pictures simultaneously using the size of the first picture.
+fit=new frame[](string prefix="", picture[] pictures, string format="",
+ bool view=true, string options="", string script="",
+ projection P=currentprojection) {
+ if(pictures.length == 0)
+ return new frame[];
+
picture all;
size(all,pictures[0]);
for(picture pic : pictures)
add(all,pic);
- rescale2(pictures,all);
- rescale3(pictures,all);
+
+ return all.empty3() ? fit2(pictures,all) :
+ fit3(prefix,pictures,all,format,view,options,script,P);
};
exitfcn currentexitfunction=atexit();
diff --git a/Build/source/utils/asymptote/base/three_arrows.asy b/Build/source/utils/asymptote/base/three_arrows.asy
index 841c4f731f4..161a716bca6 100644
--- a/Build/source/utils/asymptote/base/three_arrows.asy
+++ b/Build/source/utils/asymptote/base/three_arrows.asy
@@ -48,91 +48,20 @@ void bend(surface s, path3 g, real L)
}
}
-void render(path3 s, real granularity=tubegranularity, void f(path3, real))
-{
- static int maxdepth=ceil(-log(realEpsilon)/log(2))+1;
- void Split(triple z0, triple c0, triple c1, triple z1, real t0=0, real t1=1,
- real depth=mantissaBits) {
- if(depth > 0) {
- real S=straightness(z0,c0,c1,z1);
- real R=infinity;
- int nintervals=3;
- real fuzz=sqrtEpsilon*max(abs(z0),abs(z1));
- if(S > 0) {
- --depth;
- for(int i=0; i <= nintervals; ++i) {
- R=min(R,radius(z0,c0,c1,z1,i/nintervals));
- if(S > max(granularity*R,fuzz)) {
- triple m0=0.5*(z0+c0);
- triple m1=0.5*(c0+c1);
- triple m2=0.5*(c1+z1);
- triple m3=0.5*(m0+m1);
- triple m4=0.5*(m1+m2);
- triple m5=0.5*(m3+m4);
- real tm=0.5*(t0+t1);
- Split(z0,m0,m3,m5,t0,tm,depth);
- Split(m5,m4,m2,z1,tm,t1,depth);
- return;
- }
- }
- }
- }
- f(z0..controls c0 and c1..z1,t0);
- }
- Split(point(s,0),postcontrol(s,0),precontrol(s,1),point(s,1));
-}
-
-struct tube
-{
- surface s;
- path3 center;
-
- void operator init(path3 g, real width, real granularity=tubegranularity) {
- real r=0.5*width;
-
- transform3 t=scale3(r);
-
- int n=length(g);
- for(int i=0; i < n; ++i) {
- path3 gi=subpath(g,i,i+1);
- real S=straightness(g,i);
- if(S < sqrtEpsilon*r) {
- triple v=point(g,i);
- triple u=point(g,i+1)-v;
- s.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder);
- center=center&gi;
- } else {
- render(gi,granularity,new void(path3 q, real) {
- real L=arclength(q);
- surface segment=scale(r,r,L)*unitcylinder;
- bend(segment,q,L);
- s.s.append(segment.s);
- triple a=L*Z/3;
- center=center&bend(O,q,L)..controls bend(a,q,L) and bend(2a,q,L)..
- bend(3a,q,L);
- });
- }
-
- if((cyclic(g) || i > 0) && abs(dir(g,i,1)-dir(g,i,-1)) > sqrtEpsilon)
- s.append(shift(point(g,i))*t*align(dir(g,i,-1))*unithemisphere);
- }
- }
-}
-
// Refine a noncyclic path3 g so that it approaches its endpoint in
// geometrically spaced steps.
-path3 approach(path3 g, int n, real radix=3)
+path3 approach(path3 p, int n, real radix=3)
{
guide3 G;
- real L=length(g);
+ real L=length(p);
real tlast=0;
real r=1/radix;
for(int i=1; i < n; ++i) {
real t=L*(1-r^i);
- G=G&subpath(g,tlast,t);
+ G=G&subpath(p,tlast,t);
tlast=t;
}
- return G&subpath(g,tlast,L);
+ return G&subpath(p,tlast,L);
}
struct arrowhead3
@@ -176,7 +105,7 @@ struct arrowhead3
}
if(draw)
for(path3 g : H)
- s.append(tube(g,width).s);
+ s.append(tube(g,width,linesectors).s);
return shift(v)*s;
}
@@ -231,8 +160,7 @@ DefaultHead3.head=new surface(path3 g, position position=EndPoint,
for(int i=0; i < 4; ++i) {
for(int j=0; j < 4; ++j) {
real k=1-p.P[i][j].z/remainL;
- p.P[i][j]=(k*p.P[i][j].x,k*p.P[i][j].y,p.P[i][j].z);
- p.P[i][j]=bend(p.P[i][j],q,l);
+ p.P[i][j]=bend((k*p.P[i][j].x,k*p.P[i][j].y,p.P[i][j].z),q,l);
}
}
}
diff --git a/Build/source/utils/asymptote/base/three_light.asy b/Build/source/utils/asymptote/base/three_light.asy
index 8e5a6281795..36ba9a34c19 100644
--- a/Build/source/utils/asymptote/base/three_light.asy
+++ b/Build/source/utils/asymptote/base/three_light.asy
@@ -75,88 +75,27 @@ material emissive(material m, real granularity=m.granularity)
granularity);
}
-struct light {
- real[][] diffuse;
- real[][] ambient;
- real[][] specular;
- pen background; // Background color of the 3D canvas.
- real specularfactor;
- bool viewport; // Are the lights specified (and fixed) in the viewport frame?
- triple[] position; // Only directional lights are currently implemented.
-
- transform3 T=identity(4); // Transform to apply to normal vectors.
-
- bool on() {return position.length > 0;}
-
- void operator init(pen[] diffuse,
- pen[] ambient=array(diffuse.length,black),
- pen[] specular=diffuse, pen background=nullpen,
- real specularfactor=1,
- bool viewport=true, triple[] position) {
- int n=diffuse.length;
- assert(ambient.length == n && specular.length == n && position.length == n);
-
- this.diffuse=new real[n][];
- this.ambient=new real[n][];
- this.specular=new real[n][];
- this.background=background;
- this.position=new triple[n];
- for(int i=0; i < position.length; ++i) {
- this.diffuse[i]=rgba(diffuse[i]);
- this.ambient[i]=rgba(ambient[i]);
- this.specular[i]=rgba(specular[i]);
- this.position[i]=unit(position[i]);
- }
- this.specularfactor=specularfactor;
- this.viewport=viewport;
- }
-
- void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
- pen background=nullpen, real specularfactor=1,
- bool viewport=true...triple[] position) {
- int n=position.length;
- operator init(array(n,diffuse),array(n,ambient),array(n,specular),
- background,specularfactor,viewport,position);
- }
-
- void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
- pen background=nullpen, bool viewport=true,
- real x, real y, real z) {
- operator init(diffuse,ambient,specular,background,viewport,(x,y,z));
+pen color(triple normal, material m, light light, transform3 T=light.T) {
+ triple[] position=light.position;
+ if(invisible((pen) m)) return invisible;
+ if(position.length == 0) return m.diffuse();
+ normal=unit(T*normal);
+ if(settings.twosided) normal *= sgn(normal.z);
+ real s=m.shininess*128;
+ real[] Diffuse=rgba(m.diffuse());
+ real[] Ambient=rgba(m.ambient());
+ real[] Specular=rgba(m.specular());
+ real[] p=rgba(m.emissive());
+ for(int i=0; i < position.length; ++i) {
+ triple L=light.viewport ? position[i] : T*position[i];
+ real Ldotn=max(dot(normal,L),0);
+ p += light.ambient[i]*Ambient+Ldotn*light.diffuse[i]*Diffuse;
+ // Apply specularfactor to partially compensate non-pixel-based rendering.
+ if(Ldotn > 0) // Phong-Blinn model of specular reflection
+ p += dot(normal,unit(L+Z))^s*light.specularfactor*
+ light.specular[i]*Specular;
}
-
- void operator init(explicit light light) {
- diffuse=copy(light.diffuse);
- ambient=copy(light.ambient);
- specular=copy(light.specular);
- background=light.background;
- specularfactor=light.specularfactor;
- viewport=light.viewport;
- position=copy(light.position);
- }
-
- pen color(triple normal, material m, transform3 T=T) {
- if(invisible((pen) m)) return invisible;
- if(position.length == 0) return m.diffuse();
- normal=unit(T*normal);
- if(settings.twosided) normal *= sgn(normal.z);
- real s=m.shininess*128;
- real[] Diffuse=rgba(m.diffuse());
- real[] Ambient=rgba(m.ambient());
- real[] Specular=rgba(m.specular());
- real[] p=rgba(m.emissive());
- for(int i=0; i < position.length; ++i) {
- triple L=viewport ? position[i] : T*position[i];
- real Ldotn=max(dot(normal,L),0);
- p += ambient[i]*Ambient+Ldotn*diffuse[i]*Diffuse;
- // Apply specularfactor to partially compensate non-pixel-based rendering.
- if(Ldotn > 0) // Phong-Blinn model of specular reflection
- p += dot(normal,unit(L+Z))^s*specularfactor*specular[i]*Specular;
- }
- return rgb(p[0],p[1],p[2])+opacity(opacity(m.diffuse()));
- }
-
- real[] background() {return rgba(background == nullpen ? white : background);}
+ return rgb(p[0],p[1],p[2])+opacity(opacity(m.diffuse()));
}
light operator * (transform3 t, light light)
@@ -168,14 +107,16 @@ light operator * (transform3 t, light light)
light operator cast(triple v) {return light(v);}
-light currentlight=light(ambient=gray(0.1),specularfactor=3,
- (0.25,-0.25,1));
+light Viewport=light(ambient=gray(0.1),specularfactor=3,viewport=true,
+ (0.25,-0.25,1));
light White=light(new pen[] {rgb(0.38,0.38,0.45),rgb(0.6,0.6,0.67),
- rgb(0.5,0.5,0.57)},specularfactor=3,viewport=false,
+ rgb(0.5,0.5,0.57)},specularfactor=3,
new triple[] {(-2,-1.5,-0.5),(2,1.1,-2.5),(-0.5,0,2)});
-light Headlamp=light(gray(0.9),ambient=gray(0.1),specularfactor=3,
- (0.5,0.5,1/sqrt(2)),specular=gray(0.7));
+light Headlamp=light(gray(0.8),ambient=gray(0.1),specular=gray(0.7),
+ specularfactor=3,viewport=true,dir(42,48));
+
+currentlight=Headlamp;
light nolight;
diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy
index f2ad86dfe7e..e545d87cf7b 100644
--- a/Build/source/utils/asymptote/base/three_surface.asy
+++ b/Build/source/utils/asymptote/base/three_surface.asy
@@ -1,4 +1,5 @@
import bezulate;
+private import interpolate;
int nslice=12;
real camerafactor=1.2;
@@ -15,24 +16,24 @@ struct patch {
path3 external() {
return
- P[0][0]..controls P[0][1] and P[0][2]..
- P[0][3]..controls P[1][3] and P[2][3]..
- P[3][3]..controls P[3][2] and P[3][1]..
- P[3][0]..controls P[2][0] and P[1][0]..cycle;
+ P[0][0]..controls P[1][0] and P[2][0]..
+ P[3][0]..controls P[3][1] and P[3][2]..
+ P[3][3]..controls P[2][3] and P[1][3]..
+ P[0][3]..controls P[0][2] and P[0][1]..cycle;
}
triple[] internal() {
- return new triple[] {P[1][1],P[1][2],P[2][2],P[2][1]};
+ return new triple[] {P[1][1],P[2][1],P[2][2],P[1][2]};
}
triple cornermean() {
- return 0.25*(P[0][0]+P[0][3]+P[3][3]+P[3][0]);
+ return 0.25*(P[0][0]+P[0][3]+P[3][0]+P[3][3]);
}
- triple[] corners() {return new triple[] {P[0][0],P[0][3],P[3][3],P[3][0]};}
+ triple[] corners() {return new triple[] {P[0][0],P[3][0],P[3][3],P[0][3]};}
real[] map(real f(triple)) {
- return new real[] {f(P[0][0]),f(P[0][3]),f(P[3][3]),f(P[3][0])};
+ return new real[] {f(P[0][0]),f(P[3][0]),f(P[3][3]),f(P[0][3])};
}
triple Bu(int j, real u) {return bezier(P[0][j],P[1][j],P[2][j],P[3][j],u);}
@@ -43,8 +44,10 @@ struct patch {
triple BuPPP(int j) {return bezierPPP(P[0][j],P[1][j],P[2][j],P[3][j]);}
path3 uequals(real u) {
- return straight ? Bu(0,u)--Bu(3,u) :
- Bu(0,u)..controls Bu(1,u) and Bu(2,u)..Bu(3,u);
+ triple z0=Bu(0,u);
+ triple z1=Bu(3,u);
+ return path3(new triple[] {z0,Bu(2,u)},new triple[] {z0,z1},
+ new triple[] {Bu(1,u),z1},new bool[] {straight,false},false);
}
triple Bv(int i, real v) {return bezier(P[i][0],P[i][1],P[i][2],P[i][3],v);}
@@ -55,8 +58,10 @@ struct patch {
triple BvPPP(int i) {return bezierPPP(P[i][0],P[i][1],P[i][2],P[i][3]);}
path3 vequals(real v) {
- return straight ? Bv(0,v)--Bv(3,v) :
- Bv(0,v)..controls Bv(1,v) and Bv(2,v)..Bv(3,v);
+ triple z0=Bv(0,v);
+ triple z1=Bv(3,v);
+ return path3(new triple[] {z0,Bv(2,v)},new triple[] {z0,z1},
+ new triple[] {Bv(1,v),z1},new bool[] {straight,false},false);
}
triple point(real u, real v) {
@@ -65,76 +70,76 @@ struct patch {
// compute normal vectors for degenerate cases
private triple normal0(real u, real v, real epsilon) {
- triple n=0.5*(cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))+
- cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v)));
+ triple n=0.5*(cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u))+
+ cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u)));
return abs(n) > epsilon ? n :
- 0.25*cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v))+
- 1/6*(cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))+
- cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v)))+
- 1/12*(cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v))+
- cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v)))+
- 1/36*cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v));
+ 0.25*cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u))+
+ 1/6*(cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u))+
+ cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u)))+
+ 1/12*(cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u))+
+ cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u)))+
+ 1/36*cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u));
}
static real fuzz=1000*realEpsilon;
triple normal(real u, real v) {
- triple n=cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v));
+ triple n=cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u));
real epsilon=fuzz*change2(P);
return (abs(n) > epsilon) ? n : normal0(u,v,epsilon);
}
triple normal00() {
- triple n=9*cross(P[0][1]-P[0][0],P[1][0]-P[0][0]);
+ triple n=9*cross(P[1][0]-P[0][0],P[0][1]-P[0][0]);
real epsilon=fuzz*change2(P);
return abs(n) > epsilon ? n : normal0(0,0,epsilon);
}
- triple normal01() {
- triple n=9*cross(P[0][3]-P[0][2],P[1][3]-P[0][3]);
+ triple normal10() {
+ triple n=9*cross(P[3][0]-P[2][0],P[3][1]-P[3][0]);
real epsilon=fuzz*change2(P);
- return abs(n) > epsilon ? n : normal0(0,1,epsilon);
+ return abs(n) > epsilon ? n : normal0(1,0,epsilon);
}
triple normal11() {
- triple n=9*cross(P[3][3]-P[3][2],P[3][3]-P[2][3]);
+ triple n=9*cross(P[3][3]-P[2][3],P[3][3]-P[3][2]);
real epsilon=fuzz*change2(P);
return abs(n) > epsilon ? n : normal0(1,1,epsilon);
}
- triple normal10() {
- triple n=9*cross(P[3][1]-P[3][0],P[3][0]-P[2][0]);
+ triple normal01() {
+ triple n=9*cross(P[1][3]-P[0][3],P[0][3]-P[0][2]);
real epsilon=fuzz*change2(P);
- return abs(n) > epsilon ? n : normal0(1,0,epsilon);
+ return abs(n) > epsilon ? n : normal0(0,1,epsilon);
}
pen[] colors(material m, light light=currentlight) {
bool nocolors=colors.length == 0;
if(normals.length > 0)
- return new pen[] {light.color(normals[0],nocolors ? m : colors[0]),
- light.color(normals[1],nocolors ? m : colors[1]),
- light.color(normals[2],nocolors ? m : colors[2]),
- light.color(normals[3],nocolors ? m : colors[3])};
+ return new pen[] {color(normals[0],nocolors ? m : colors[0],light),
+ color(normals[1],nocolors ? m : colors[1],light),
+ color(normals[2],nocolors ? m : colors[2],light),
+ color(normals[3],nocolors ? m : colors[3],light)};
if(planar) {
triple normal=normal(0.5,0.5);
- return new pen[] {light.color(normal,nocolors ? m : colors[0]),
- light.color(normal,nocolors ? m : colors[1]),
- light.color(normal,nocolors ? m : colors[2]),
- light.color(normal,nocolors ? m : colors[3])};
+ return new pen[] {color(normal,nocolors ? m : colors[0],light),
+ color(normal,nocolors ? m : colors[1],light),
+ color(normal,nocolors ? m : colors[2],light),
+ color(normal,nocolors ? m : colors[3],light)};
}
- return new pen[] {light.color(normal00(),nocolors ? m : colors[0]),
- light.color(normal01(),nocolors ? m : colors[1]),
- light.color(normal11(),nocolors ? m : colors[2]),
- light.color(normal10(),nocolors ? m : colors[3])};
+ return new pen[] {color(normal00(),nocolors ? m : colors[0],light),
+ color(normal10(),nocolors ? m : colors[1],light),
+ color(normal11(),nocolors ? m : colors[2],light),
+ color(normal01(),nocolors ? m : colors[3],light)};
}
triple min3,max3;
@@ -162,11 +167,19 @@ struct patch {
}
pair min(projection P, pair bound=project(this.P[0][0],P.t)) {
- return minbezier(this.P,P.t,bound);
+ triple[][] Q=P.T.modelview*this.P;
+ if(P.infinity)
+ return xypart(minbezier(Q,(bound.x,bound.y,0)));
+ real d=P.T.projection[3][2];
+ return maxratio(Q,d*bound)/d; // d is negative
}
pair max(projection P, pair bound=project(this.P[0][0],P.t)) {
- return maxbezier(this.P,P.t,bound);
+ triple[][] Q=P.T.modelview*this.P;
+ if(P.infinity)
+ return xypart(maxbezier(Q,(bound.x,bound.y,0)));
+ real d=P.T.projection[3][2];
+ return minratio(Q,d*bound)/d; // d is negative
}
void operator init(triple[][] P, triple[] normals=new triple[],
@@ -242,11 +255,11 @@ struct patch {
} else straight=false;
P=new triple[][] {
- {point(external,0),postcontrol(external,0),precontrol(external,1),
- point(external,1)},
- {precontrol(external,0),internal[0],internal[1],postcontrol(external,1)},
- {postcontrol(external,3),internal[3],internal[2],precontrol(external,2)},
- {point(external,3),precontrol(external,3),postcontrol(external,2),
+ {point(external,0),precontrol(external,0),postcontrol(external,3),
+ point(external,3)},
+ {postcontrol(external,0),internal[0],internal[3],precontrol(external,3)},
+ {precontrol(external,1),internal[1],internal[2],postcontrol(external,2)},
+ {point(external,1),postcontrol(external,1),precontrol(external,2),
point(external,2)}
};
}
@@ -280,10 +293,10 @@ struct patch {
delta[j]=(external[(j+1)% 4]-external[j])/3;
P=new triple[][] {
- {external[0],external[0]+delta[0],external[1]-delta[0],external[1]},
- {external[0]-delta[3],internal[0],internal[1],external[1]+delta[1]},
- {external[3]+delta[3],internal[3],internal[2],external[2]-delta[1]},
- {external[3],external[3]-delta[2],external[2]+delta[2],external[2]}
+ {external[0],external[0]-delta[3],external[3]+delta[3],external[3]},
+ {external[0]+delta[0],internal[0],internal[3],external[3]-delta[2]},
+ {external[1]-delta[0],internal[1],internal[2],external[2]+delta[2]},
+ {external[1],external[1]+delta[1],external[2]-delta[1],external[2]}
};
}
}
@@ -322,8 +335,243 @@ patch reverse(patch s)
return S;
}
+// Return the Coons patch control points corresponding to path p.
+pair[][] coons(path p)
+{
+ int L=length(p);
+ if(L == 1)
+ p=p--cycle--cycle--cycle;
+ else if(L == 2)
+ p=p--cycle--cycle;
+ else if(L == 3)
+ p=p--cycle;
+
+ pair[] internal=new pair[4];
+ for(int j=0; j < 4; ++j) {
+ internal[j]=nineth*(-4*point(p,j)
+ +6*(precontrol(p,j)+postcontrol(p,j))
+ -2*(point(p,j-1)+point(p,j+1))
+ +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)}
+ };
+}
+
+// Decompose a possibly nonconvex cyclic path into an array of paths that
+// yield nondegenerate Coons patches.
+path[] regularize(path p, bool checkboundary=true)
+{
+ path[] s;
+
+ if(!cyclic(p))
+ abort("cyclic path expected");
+
+ int L=length(p);
+
+ if(L > 4) {
+ for(path g : bezulate(p))
+ s.append(regularize(g,checkboundary));
+ return s;
+ }
+
+ bool straight=piecewisestraight(p);
+ if(L <= 3 && straight) {
+ return new path[] {p};
+ }
+
+ // Split p along the angle bisector at t.
+ bool split(path p, real t) {
+ pair dir=dir(p,t);
+ if(dir != 0) {
+ path g=subpath(p,t,t+length(p));
+ int L=length(g);
+ pair z=point(g,0);
+ real[] T=intersections(g,z,z+I*dir);
+ for(int i=0; i < T.length; ++i) {
+ real cut=T[i];
+ if(cut > sqrtEpsilon && cut < L-sqrtEpsilon) {
+ pair w=point(g,cut);
+ if(!inside(p,0.5*(z+w),zerowinding)) continue;
+ pair delta=sqrtEpsilon*(w-z);
+ if(intersections(g,z-delta--w+delta).length != 2) continue;
+ s.append(regularize(subpath(g,0,cut)--cycle,checkboundary));
+ s.append(regularize(subpath(g,cut,L)--cycle,checkboundary));
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ // Ensure that all interior angles are less than 180 degrees.
+ real fuzz=1e-4;
+ int sign=sgn(windingnumber(p,inside(p,zerowinding)));
+ for(int i=0; i < L; ++i) {
+ if(sign*(conj(dir(p,i,-1))*dir(p,i,1)).y < -fuzz) {
+ if(split(p,i)) return s;
+ }
+ }
+
+ if(straight)
+ return new path[] {p};
+
+ pair[][] P=coons(p);
+
+ // Check for degeneracy.
+ pair[][] U=new pair[3][4];
+ pair[][] V=new pair[4][3];
+
+ for(int i=0; i < 3; ++i) {
+ for(int j=0; j < 4; ++j)
+ U[i][j]=P[i+1][j]-P[i][j];
+ }
+
+ for(int i=0; i < 4; ++i) {
+ for(int j=0; j < 3; ++j)
+ V[i][j]=P[i][j+1]-P[i][j];
+ }
+
+ int[] choose2={1,2,1};
+ int[] choose3={1,3,3,1};
+
+ real T[][]=new real[6][6];
+ for(int p=0; p < 6; ++p) {
+ int kstart=max(p-2,0);
+ int kstop=min(p,3);
+ real[] Tp=T[p];
+ for(int q=0; q < 6; ++q) {
+ real Tpq;
+ int jstop=min(q,3);
+ int jstart=max(q-2,0);
+ for(int k=kstart; k <= kstop; ++k) {
+ int choose3k=choose3[k];
+ for(int j=jstart; j <= jstop; ++j) {
+ int i=p-k;
+ int l=q-j;
+ Tpq += (conj(U[i][j])*V[k][l]).y*
+ choose2[i]*choose3k*choose3[j]*choose2[l];
+ }
+ }
+ Tp[q]=Tpq;
+ }
+ }
+
+ bool3 aligned=default;
+ bool degenerate=false;
+
+ for(int p=0; p < 6; ++p) {
+ for(int q=0; q < 6; ++q) {
+ if(aligned == default) {
+ if(T[p][q] > sqrtEpsilon) aligned=true;
+ if(T[p][q] < -sqrtEpsilon) aligned=false;
+ } else {
+ if((T[p][q] > sqrtEpsilon && aligned == false) ||
+ (T[p][q] < -sqrtEpsilon && aligned == true)) degenerate=true;
+ }
+ }
+ }
+
+ if(!degenerate) {
+ if(aligned == (sign >= 0))
+ return new path[] {p};
+ return s;
+ }
+
+ if(checkboundary) {
+ // Polynomial coefficients of (B_i'' B_j + B_i' B_j')/3.
+ static real[][][] fpv0={
+ {{5, -20, 30, -20, 5},
+ {-3, 24, -54, 48, -15},
+ {0, -6, 27, -36, 15},
+ {0, 0, -3, 8, -5}},
+ {{-7, 36, -66, 52, -15},
+ {3, -36, 108, -120, 45},
+ {0, 6, -45, 84, -45},
+ {0, 0, 3, -16, 15}},
+ {{2, -18, 45, -44, 15},
+ {0, 12, -63, 96, -45},
+ {0, 0, 18, -60, 45},
+ {0, 0, 0, 8, -15}},
+ {{0, 2, -9, 12, -5},
+ {0, 0, 9, -24, 15},
+ {0, 0, 0, 12, -15},
+ {0, 0, 0, 0, 5}}
+ };
+
+ // Compute one-ninth of the derivative of the Jacobian along the boundary.
+ real[][] c=array(4,array(5,0.0));
+ for(int i=0; i < 4; ++i) {
+ real[][] fpv0i=fpv0[i];
+ for(int j=0; j < 4; ++j) {
+ real[] w=fpv0i[j];
+ c[0] += w*(conj(P[i][0])*(P[j][1]-P[j][0])).y; // v=0
+ c[1] += w*(conj(P[3][j]-P[2][j])*P[3][i]).y; // u=1
+ c[2] += w*(conj(P[i][3])*(P[j][3]-P[j][2])).y; // v=1
+ c[3] += w*(conj(P[0][j]-P[1][j])*P[0][i]).y; // u=0
+ }
+ }
+
+ pair BuP(int j, real u) {
+ return bezierP(P[0][j],P[1][j],P[2][j],P[3][j],u);
+ }
+ pair BvP(int i, real v) {
+ return bezierP(P[i][0],P[i][1],P[i][2],P[i][3],v);
+ }
+ real normal(real u, real v) {
+ return (conj(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))*
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u)).y;
+ }
+
+ // Use Rolle's theorem to check for degeneracy on the boundary.
+ real M=0;
+ real cut;
+ for(int i=0; i < 4; ++i) {
+ if(!straight(p,i)) {
+ real[] ci=c[i];
+ pair[] R=quarticroots(ci[4],ci[3],ci[2],ci[1],ci[0]);
+ for(pair r : R) {
+ if(fabs(r.y) < sqrtEpsilon) {
+ real t=r.x;
+ if(0 <= t && t <= 1) {
+ real[] U={t,1,t,0};
+ real[] V={0,t,1,t};
+ real[] T={t,t,1-t,1-t};
+ real N=sign*normal(U[i],V[i]);
+ if(N < M) {
+ M=N; cut=i+T[i];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Split at the worst boundary degeneracy.
+ if(M < 0 && split(p,cut)) return s;
+ }
+
+ // Split arbitrarily to resolve any remaining (internal) degeneracy.
+ checkboundary=false;
+ for(int i=0; i < L; ++i)
+ if(!straight(p,i) && split(p,i+0.5)) return s;
+
+ while(true)
+ for(int i=0; i < L; ++i)
+ if(!straight(p,i) && split(p,i+unitrand())) return s;
+
+ return s;
+}
+
struct surface {
patch[] s;
+ int index[][];
+ bool vcyclic;
bool empty() {
return s.length == 0;
@@ -341,6 +589,8 @@ struct surface {
this.s=new patch[s.s.length];
for(int i=0; i < s.s.length; ++i)
this.s[i]=patch(s.s[i]);
+ this.index=copy(s.index);
+ this.vcyclic=s.vcyclic;
}
void operator init(triple[][][] P, triple[][] normals=new triple[][],
@@ -352,10 +602,8 @@ struct surface {
}
void colors(pen[][] palette) {
- for(int i=0; i < s.length; ++i) {
- pen[] palettei=palette[i];
- s[i].colors=new pen[] {palettei[0],palettei[1],palettei[2],palettei[3]};
- }
+ for(int i=0; i < s.length; ++i)
+ s[i].colors=copy(palette[i]);
}
triple[][] corners() {
@@ -376,232 +624,66 @@ struct surface {
return sequence(new triple(int i) {return s[i].cornermean();},s.length);
}
- // A constructor for a possibly nonconvex cyclic path in a given plane.
- void operator init (path p, triple plane(pair)=XYplane,
- bool checkboundary=true) {
- if(!cyclic(p))
- abort("cyclic path expected");
-
- int L=length(p);
+ triple point(real u, real v) {
+ int U=floor(u);
+ int V=floor(v);
+ int index=index.length == 0 ? U+V : index[U][V];
+ return s[index].point(u-U,v-V);
+ }
- if(L > 4) {
- for(path g : bezulate(p))
- s.append(surface(g,plane,checkboundary).s);
- return;
- }
-
- pair[][] P(path p) {
- if(L == 1)
- p=p--cycle--cycle--cycle;
- else if(L == 2)
- p=p--cycle--cycle;
- else if(L == 3)
- p=p--cycle;
-
- pair[] internal=new pair[4];
- for(int j=0; j < 4; ++j) {
- internal[j]=nineth*(-4*point(p,j)
- +6*(precontrol(p,j)+postcontrol(p,j))
- -2*(point(p,j-1)+point(p,j+1))
- +3*(precontrol(p,j-1)+postcontrol(p,j+1))
- -point(p,j+2));
- }
-
- return new pair[][] {
- {point(p,0),postcontrol(p,0),precontrol(p,1),point(p,1)},
- {precontrol(p,0),internal[0],internal[1],postcontrol(p,1)},
- {postcontrol(p,3),internal[3],internal[2],precontrol(p,2)},
- {point(p,3),precontrol(p,3),postcontrol(p,2),point(p,2)}
- };
- }
+ triple normal(real u, real v) {
+ int U=floor(u);
+ int V=floor(v);
+ int index=index.length == 0 ? U+V : index[U][V];
+ return s[index].normal(u-U,v-V);
+ }
+
+ void ucyclic(bool f)
+ {
+ index.cyclic=f;
+ }
+
+ void vcyclic(bool f)
+ {
+ for(int[] i : index)
+ i.cyclic=f;
+ vcyclic=f;
+ }
+
+ bool ucyclic()
+ {
+ return index.cyclic;
+ }
+
+ bool vcyclic()
+ {
+ return vcyclic;
+ }
+ path3 uequals(real u) {
+ if(index.length == 0) return nullpath3;
+ int U=floor(u);
+ int[] index=index[U];
+ path3 g;
+ for(int i : index)
+ g=g&s[i].uequals(u-U);
+ return vcyclic() ? g&cycle : g;
+ }
+
+ path3 vequals(real v) {
+ if(index.length == 0) return nullpath3;
+ int V=floor(v);
+ path3 g;
+ for(int[] i : index)
+ g=g&s[i[V]].vequals(v-V);
+ return ucyclic() ? g&cycle : g;
+ }
+
+ // A constructor for a possibly nonconvex cyclic path in a given plane.
+ void operator init(path p, triple plane(pair)=XYplane) {
bool straight=piecewisestraight(p);
- if(L <= 3 && straight) {
- s=new patch[] {patch(P(p),plane,straight)};
- return;
- }
-
- // Split p along the angle bisector at t.
- bool split(path p, real t) {
- pair dir=dir(p,t);
- if(dir != 0) {
- path g=subpath(p,t,t+length(p));
- int L=length(g);
- pair z=point(g,0);
- real[] T=intersections(g,z,z+I*dir);
- for(int i=0; i < T.length; ++i) {
- real cut=T[i];
- if(cut > sqrtEpsilon && cut < L-sqrtEpsilon) {
- pair w=point(g,cut);
- if(!inside(p,0.5*(z+w),zerowinding)) continue;
- pair delta=sqrtEpsilon*(w-z);
- if(intersections(g,z-delta--w+delta).length != 2) continue;
- s=surface(subpath(g,0,cut)--cycle,plane,checkboundary).s;
- s.append(surface(subpath(g,cut,L)--cycle,plane,checkboundary).s);
- return true;
- }
- }
- }
- return false;
- }
-
- // Ensure that all interior angles are less than 180 degrees.
- real fuzz=1e-4;
- int sign=sgn(windingnumber(p,inside(p,zerowinding)));
- for(int i=0; i < L; ++i) {
- if(sign*(conj(dir(p,i,-1))*dir(p,i,1)).y < -fuzz) {
- if(split(p,i)) return;
- }
- }
-
- pair[][] P=P(p);
-
- if(straight) {
- s=new patch[] {patch(P,plane,straight)};
- return;
- }
-
- // Check for degeneracy.
- pair[][] U=new pair[3][4];
- pair[][] V=new pair[4][3];
-
- for(int i=0; i < 3; ++i) {
- for(int j=0; j < 4; ++j)
- U[i][j]=P[i+1][j]-P[i][j];
- }
-
- for(int i=0; i < 4; ++i) {
- for(int j=0; j < 3; ++j)
- V[i][j]=P[i][j+1]-P[i][j];
- }
-
- int[] choose2={1,2,1};
- int[] choose3={1,3,3,1};
-
- real T[][]=new real[6][6];
- for(int p=0; p < 6; ++p) {
- int kstart=max(p-2,0);
- int kstop=min(p,3);
- real[] Tp=T[p];
- for(int q=0; q < 6; ++q) {
- real Tpq;
- int jstop=min(q,3);
- int jstart=max(q-2,0);
- for(int k=kstart; k <= kstop; ++k) {
- int choose3k=choose3[k];
- for(int j=jstart; j <= jstop; ++j) {
- int i=p-k;
- int l=q-j;
- Tpq += (conj(U[i][j])*V[k][l]).y*
- choose2[i]*choose3k*choose3[j]*choose2[l];
- }
- }
- Tp[q]=Tpq;
- }
- }
-
- bool3 aligned=default;
- bool degenerate=false;
-
- for(int p=0; p < 6; ++p) {
- for(int q=0; q < 6; ++q) {
- if(aligned == default) {
- if(T[p][q] < -sqrtEpsilon) aligned=true;
- if(T[p][q] > sqrtEpsilon) aligned=false;
- } else {
- if((T[p][q] < -sqrtEpsilon && aligned == false) ||
- (T[p][q] > sqrtEpsilon && aligned == true)) degenerate=true;
- }
- }
- }
-
- if(!degenerate) {
- if(aligned == (sign >= 0))
- s=new patch[] {patch(P,plane)};
- return;
- }
-
- if(checkboundary) {
- // Polynomial coefficients of (B_i'' B_j + B_i' B_j')/3.
- static real[][][] fpv0={
- {{5, -20, 30, -20, 5},
- {-3, 24, -54, 48, -15},
- {0, -6, 27, -36, 15},
- {0, 0, -3, 8, -5}},
- {{-7, 36, -66, 52, -15},
- {3, -36, 108, -120, 45},
- {0, 6, -45, 84, -45},
- {0, 0, 3, -16, 15}},
- {{2, -18, 45, -44, 15},
- {0, 12, -63, 96, -45},
- {0, 0, 18, -60, 45},
- {0, 0, 0, 8, -15}},
- {{0, 2, -9, 12, -5},
- {0, 0, 9, -24, 15},
- {0, 0, 0, 12, -15},
- {0, 0, 0, 0, 5}}
- };
-
- // Compute one-ninth of the derivative of the Jacobian along the boundary.
- real[][] c=array(4,array(5,0.0));
- for(int i=0; i < 4; ++i) {
- real[][] fpv0i=fpv0[i];
- for(int j=0; j < 4; ++j) {
- real[] w=fpv0i[j];
- c[0] += w*(conj(P[0][j]-P[1][j])*P[0][i]).y; // u=0
- c[1] += w*(conj(P[i][3])*(P[j][3]-P[j][2])).y; // v=1
- c[2] += w*(conj(P[3][j]-P[2][j])*P[3][i]).y; // u=1
- c[3] += w*(conj(P[i][0])*(P[j][1]-P[j][0])).y; // v=0
- }
- }
-
- pair BuP(int j, real u) {
- return bezierP(P[0][j],P[1][j],P[2][j],P[3][j],u);
- }
- pair BvP(int i, real v) {
- return bezierP(P[i][0],P[i][1],P[i][2],P[i][3],v);
- }
- real normal(real u, real v) {
- return (conj(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u))*
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v)).y;
- }
-
- // Use Rolle's theorem to check for degeneracy on the boundary.
- real M=0;
- real cut;
- for(int i=0; i < 4; ++i) {
- if(!straight(p,i)) {
- real[] ci=c[i];
- pair[] R=quarticroots(ci[4],ci[3],ci[2],ci[1],ci[0]);
- for(pair r : R) {
- if(fabs(r.y) < sqrtEpsilon) {
- real t=r.x;
- if(0 <= t && t <= 1) {
- real[] U={0,t,1,t};
- real[] V={t,1,t,0};
- real[] T={t,t,1-t,1-t};
- real N=sign*normal(U[i],V[i]);
- if(N < M) {
- M=N; cut=i+T[i];
- }
- }
- }
- }
- }
- }
-
- // Split at the worst boundary degeneracy.
- if(M < 0 && split(p,cut)) return;
- }
-
- // Split arbitrarily to resolve any remaining (internal) degeneracy.
- checkboundary=false;
- for(int i=0; i < L; ++i)
- if(!straight(p,i) && split(p,i+0.5)) return;
-
- while(true)
- for(int i=0; i < L; ++i)
- if(!straight(p,i) && split(p,i+unitrand())) return;
+ for(path g : regularize(p))
+ s.push(patch(coons(g),plane,straight));
}
void operator init(explicit path[] g, triple plane(pair)=XYplane) {
@@ -715,12 +797,13 @@ struct surface {
// An optional surface pen color(int i, real j) may be specified
// to override the color at vertex(i,j).
void operator init(triple c, path3 g, triple axis, int n=nslice,
- real angle1=0, real angle2= 360,
+ real angle1=0, real angle2=360,
pen color(int i, real j)=null) {
axis=unit(axis);
real w=(angle2-angle1)/n;
int L=length(g);
s=new patch[L*n];
+ index=new int[n][L];
int m=-1;
transform3[] T=new transform3[n+1];
transform3 t=rotate(w,c,c+axis);
@@ -728,6 +811,9 @@ struct surface {
for(int k=1; k <= n; ++k)
T[k]=T[k-1]*t;
+ typedef pen colorfcn(int i, real j);
+ bool defaultcolors=(colorfcn) color == null;
+
for(int i=0; i < L; ++i) {
path3 h=subpath(g,i,i+1);
path3 r=reverse(h);
@@ -754,13 +840,16 @@ struct surface {
for(int k=0; k < n; ++k, j += w) {
transform3 Tp=T[k+1];
triple dirp=dir(j+w);
- path3 G=Tk*h{dirj}..{dirp}Tp*r{-dirp}..{-dirj}cycle;
+ path3 G=reverse(Tk*h{dirj}..{dirp}Tp*r{-dirp}..{-dirj}cycle);
Tk=Tp;
dirj=dirp;
- s[++m]=color == null ? patch(G) :
- patch(G,new pen[] {color(i,j),color(i+1,j),color(i+1,j+w),
- color(i,j+w)});
+ s[++m]=defaultcolors ? patch(G) :
+ patch(G,new pen[] {color(i,j),color(i,j+w),color(i+1,j+w),
+ color(i+1,j)});
+ index[k][i]=m;
}
+ ucyclic((angle2-angle1) % 360 == 0);
+ vcyclic(cyclic(g));
}
}
@@ -784,6 +873,9 @@ surface operator * (transform3 t, surface s)
S.s=new patch[s.s.length];
for(int i=0; i < s.s.length; ++i)
S.s[i]=t*s.s[i];
+ S.index=copy(s.index);
+ S.vcyclic=(bool) s.vcyclic;
+
return S;
}
@@ -894,10 +986,11 @@ triple[][] subpatchend(triple[][] P, real u, real v)
{c4[2],c5[2],c6[2],c7[2]}};
}
-patch subpatch(patch s, real ua, real va, real ub, real vb)
+patch subpatch(patch s, pair a, pair b)
{
- assert(ua >= 0 && va >= 0 && ub <= 1 && vb <= 1 && ua < ub && va < vb);
- return patch(subpatchbegin(subpatchend(s.P,ub,vb),ua/ub,va/vb),
+ assert(a.x >= 0 && a.y >= 0 && b.x <= 1 && b.y <= 1 &&
+ a.x < b.x && a.y < b.y);
+ return patch(subpatchbegin(subpatchend(s.P,b.x,b.y),a.x/b.x,a.y/b.y),
s.straight,s.planar);
}
@@ -958,8 +1051,17 @@ void draw3D(frame f, patch s, material m, light light=currentlight)
bool lighton=light.on();
if(!lighton && !invisible((pen) m))
m=emissive(m);
+ real PRCshininess;
+ if(prc()) {
+ // Empirical translation table from Phong-Blinn to PRC shininess model:
+ static real[] x={0.015,0.025,0.05,0.07,0.1,0.14,0.23,0.5,0.65,0.75,0.85,
+ 0.875,0.9,1};
+ static real[] y={0.05,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.55,0.6,0.7,0.8,0.9,1};
+ static realfunction s=fspline(x,y,monotonic);
+ PRCshininess=s(m.shininess);
+ }
real granularity=m.granularity >= 0 ? m.granularity : defaultgranularity;
- draw(f,s.P,s.straight,m.p,m.opacity,m.shininess,granularity,
+ draw(f,s.P,s.straight,m.p,m.opacity,m.shininess,PRCshininess,granularity,
s.planar ? s.normal(0.5,0.5) : O,lighton,s.colors);
}
@@ -972,7 +1074,7 @@ void tensorshade(transform t=identity(), frame f, patch s,
}
restricted pen[] nullpens={nullpen};
-nullpens.cyclic(true);
+nullpens.cyclic=true;
void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
material[] surfacepen, pen[] meshpen=nullpens,
@@ -1011,7 +1113,7 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
depth=sort(depth);
- light.T=shiftless(P.modelview());
+ light.T=shiftless(P.T.modelview);
// Draw from farthest to nearest
while(depth.length > 0) {
@@ -1033,8 +1135,8 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
{
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
draw(t,f,s,nu,nv,surfacepen,meshpen,light,meshlight,P);
}
@@ -1082,8 +1184,8 @@ void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
{
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
draw(pic,s,nu,nv,surfacepen,meshpen,light,meshlight);
}
@@ -1092,18 +1194,26 @@ void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
light light=currentlight, light meshlight=light)
{
pen[] meshpen={meshpen};
- meshpen.cyclic(true);
+ meshpen.cyclic=true;
draw(pic,s,nu,nv,surfacepen,meshpen,light,meshlight);
}
-surface extrude(path p, triple axis=Z)
+surface extrude(path3 p, path3 q)
{
static patch[] allocate;
- path3 G=path3(p);
- path3 G2=shift(axis)*G;
return surface(...sequence(new patch(int i) {
- return patch(subpath(G,i,i+1)--subpath(G2,i+1,i)--cycle);
- },length(G)));
+ return patch(subpath(p,i,i+1)--subpath(q,i+1,i)--cycle);
+ },length(p)));
+}
+
+surface extrude(path3 p, triple axis=Z)
+{
+ return extrude(p,shift(axis)*p);
+}
+
+surface extrude(path p, triple axis=Z)
+{
+ return extrude(path3(p),axis);
}
surface extrude(explicit path[] p, triple axis=Z)
@@ -1179,11 +1289,11 @@ void label(frame f, Label L, triple position, align align=NoAlign,
} else {
if(L.filltype == NoFill)
fill(f,path(L,project(position,P.t),P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
else {
frame d;
fill(d,path(L,project(position,P.t),P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
add(f,d,L.filltype);
}
}
@@ -1215,11 +1325,11 @@ void label(picture pic=currentpicture, Label L, triple position,
if(pic != null) {
if(L.filltype == NoFill)
fill(project(v,P.t),pic,path(L,P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
else {
picture d;
fill(project(v,P.t),d,path(L,P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
add(pic,d,L.filltype);
}
}
@@ -1271,30 +1381,74 @@ surface extrude(Label L, triple axis=Z)
restricted surface nullsurface;
+surface labelsurface(Label L, surface s, real uoffset, real voffset,
+ real height=0, bool bottom=false, bool top=true)
+{
+ int nu=s.index.length;
+ if(nu == 0) return nullsurface;
+ int nv=s.index[0].length;
+ if(nv == 0) return nullsurface;
+
+ path[] g=texpath(L);
+ pair m=min(g);
+ pair M=max(g);
+ pair lambda=inverse(L.T*scale(nu-epsilon,nv-epsilon))*(M-m);
+ lambda=(abs(lambda.x),abs(lambda.y));
+ path[] G=bezulate(g);
+
+ path3 transpath(path p, real height) {
+ return path3(unstraighten(p),new triple(pair z) {
+ real u=uoffset+(z.x-m.x)/lambda.x;
+ real v=voffset+(z.y-m.y)/lambda.y;
+ if(((u < 0 || u >= nu) && !s.ucyclic()) ||
+ ((v < 0 || v >= nv) && !s.vcyclic()))
+ abort("cannot fit string to surface");
+ return s.point(u,v)+height*unit(s.normal(u,v));
+ });
+ }
+
+ surface s;
+ for(path p : G) {
+ for(path g : regularize(p)) {
+ path3 b;
+ bool extrude=height > 0;
+ if(bottom || extrude)
+ b=transpath(g,0);
+ if(bottom) s.s.push(patch(b));
+ if(top || extrude) {
+ path3 h=transpath(g,height);
+ if(top) s.s.push(patch(h));
+ if(extrude) s.append(extrude(b,h));
+ }
+ }
+ }
+ return s;
+}
+
private real a=4/3*(sqrt(2)-1);
-private transform3 t=rotate(90,O,Z);
-private transform3 t2=t*t;
-private transform3 t3=t2*t;
+private transform3 t1=rotate(90,O,Z);
+private transform3 t2=t1*t1;
+private transform3 t3=t2*t1;
private transform3 i=xscale3(-1)*zscale3(-1);
-restricted patch octant1=patch(X{Z}..{-X}Z..Z{Y}..{-Z}Y{X}..{-Y}cycle,
- new triple[] {(1,a,a),(a,a^2,1),(a^2,a,1),
- (a,1,a)});
+restricted patch octant1=patch(X{Y}..{-X}Y{Z}..{-Y}Z..Z{X}..{-Z}cycle,
+ new triple[] {(1,a,a),(a,1,a),(a^2,a,1),
+ (a,a^2,1)});
-restricted surface unithemisphere=surface(octant1,t*octant1,t2*octant1,
+restricted surface unithemisphere=surface(octant1,t1*octant1,t2*octant1,
t3*octant1);
-restricted surface unitsphere=surface(octant1,t*octant1,t2*octant1,t3*octant1,
- i*octant1,i*t*octant1,i*t2*octant1,
+restricted surface unitsphere=surface(octant1,t1*octant1,t2*octant1,t3*octant1,
+ i*octant1,i*t1*octant1,i*t2*octant1,
i*t3*octant1);
restricted patch unitfrustum(real t1, real t2)
{
real s1=interp(t1,t2,1/3);
real s2=interp(t1,t2,2/3);
- return patch(interp(Z,X,t2)--interp(Z,X,t1){Y}..{-X}interp(Z,Y,t1)--
- interp(Z,Y,t2){X}..{-Y}cycle,
- new triple[] {(s2,s2*a,1-s2),(s1,s1*a,1-s1),(s1*a,s1,1-s1),
- (s2*a,s2,1-s2)});
+ return patch(interp(Z,X,t2){Y}..{-X}interp(Z,Y,t2)--interp(Z,Y,t1){X}..{-Y}
+ interp(Z,X,t1)--cycle,
+ new triple[] {(s2,s2*a,1-s2),(s2*a,s2,1-s2),(s1*a,s1,1-s1),
+ (s1,s1*a,1-s1)});
}
// Return a unitcone constructed from n frusta (the final one being degenerate)
@@ -1306,7 +1460,7 @@ surface unitcone(int n=6)
for(int i=0; i < n; ++i) {
patch s=unitfrustum(i < n-1 ? r^(i+1) : 0,r^i);
unitcone.s[i]=s;
- unitcone.s[n+i]=t*s;
+ unitcone.s[n+i]=t1*s;
unitcone.s[2n+i]=t2*s;
unitcone.s[3n+i]=t3*s;
}
@@ -1316,9 +1470,9 @@ surface unitcone(int n=6)
restricted surface unitcone=unitcone();
restricted surface unitsolidcone=surface(patch(unitcircle3)...unitcone.s);
-private patch unitcylinder1=patch(X--X+Z{Y}..{-X}Y+Z--Y{X}..{-Y}cycle);
+private patch unitcylinder1=patch(X{Y}..{-X}Y--Y+Z{X}..{-Y}X+Z--cycle);
-restricted surface unitcylinder=surface(unitcylinder1,t*unitcylinder1,
+restricted surface unitcylinder=surface(unitcylinder1,t1*unitcylinder1,
t2*unitcylinder1,t3*unitcylinder1);
private patch unitplane=patch(new triple[] {O,X,X+Y,Y});
diff --git a/Build/source/utils/asymptote/base/three_tube.asy b/Build/source/utils/asymptote/base/three_tube.asy
new file mode 100644
index 00000000000..c79ae3f619f
--- /dev/null
+++ b/Build/source/utils/asymptote/base/three_tube.asy
@@ -0,0 +1,373 @@
+void render(path3 s, real granularity=linegranularity, void f(path3, real))
+{
+ void Split(triple z0, triple c0, triple c1, triple z1, real t0=0, real t1=1,
+ real depth=mantissaBits) {
+ if(depth > 0) {
+ real S=straightness(z0,c0,c1,z1);
+ if(S > 0) {
+ --depth;
+ if(S > max(granularity*max(abs(z0),abs(c0),abs(c1),abs(z1)))) {
+ triple m0=0.5*(z0+c0);
+ triple m1=0.5*(c0+c1);
+ triple m2=0.5*(c1+z1);
+ triple m3=0.5*(m0+m1);
+ triple m4=0.5*(m1+m2);
+ triple m5=0.5*(m3+m4);
+ real tm=0.5*(t0+t1);
+ Split(z0,m0,m3,m5,t0,tm,depth);
+ Split(m5,m4,m2,z1,tm,t1,depth);
+ return;
+ }
+ }
+ }
+ f(z0..controls c0 and c1..z1,t0);
+ }
+ Split(point(s,0),postcontrol(s,0),precontrol(s,1),point(s,1));
+}
+
+struct rmf
+{
+ triple p,r,t,s;
+ void operator init(triple p, triple r, triple t)
+ {
+ this.p=p;
+ this.r=r;
+ this.t=t;
+ s=cross(t,r);
+ }
+}
+
+// Rotation minimizing frame
+// http://www.cs.hku.hk/research/techreps/document/TR-2007-07.pdf
+rmf[] rmf(path3 g, real[] t)
+{
+ rmf[] R=new rmf[t.length];
+ triple d=dir(g,0);
+ R[0]=rmf(point(g,0),perp(d),d);
+ for(int i=1; i < t.length; ++i) {
+ rmf Ri=R[i-1];
+ real t=t[i];
+ triple p=point(g,t);
+ triple v1=p-Ri.p;
+ if(v1 != O) {
+ triple r=Ri.r;
+ triple u1=unit(v1);
+ triple ti=Ri.t;
+ triple tp=ti-2*dot(u1,ti)*u1;
+ ti=dir(g,t);
+ triple rp=r-2*dot(u1,r)*u1;
+ triple u2=unit(ti-tp);
+ rp=rp-2*dot(u2,rp)*u2;
+ R[i]=rmf(p,unit(rp),unit(ti));
+ } else
+ R[i]=R[i-1];
+ }
+ return R;
+}
+
+surface bispline(real[][] z, real[][] p, real[][] q, real[][] r,
+ real[] x, real[] y, bool[][] cond={})
+{ // z[i][j] is the value at (x[i],y[j])
+ // p and q are the first derivatives with respect to x and y, respectively
+ // r is the second derivative ddu/dxdy
+ int n=x.length-1;
+ int m=y.length-1;
+
+ bool all=cond.length == 0;
+
+ int count;
+ if(all)
+ count=n*m;
+ else {
+ count=0;
+ for(int i=0; i < n; ++i) {
+ bool[] condi=cond[i];
+ for(int j=0; j < m; ++j)
+ if(condi[j]) ++count;
+ }
+ }
+
+ surface s=surface(count);
+ s.index=new int[n][m];
+ int k=-1;
+ for(int i=0; i < n; ++i) {
+ bool[] condi=all ? null : cond[i];
+ real xi=x[i];
+ real[] zi=z[i];
+ real[] zp=z[i+1];
+ real[] ri=r[i];
+ real[] rp=r[i+1];
+ real[] pi=p[i];
+ real[] pp=p[i+1];
+ real[] qi=q[i];
+ real[] qp=q[i+1];
+ real xp=x[i+1];
+ real hx=(xp-xi)/3;
+ int[] indexi=s.index[i];
+ for(int j=0; j < m; ++j) {
+ real yj=y[j];
+ real yp=y[j+1];
+ if(all || condi[j]) {
+ triple[][] P=array(4,array(4,O));
+ real hy=(yp-yj)/3;
+ real hxy=hx*hy;
+ // x and y directions
+ for(int k=0; k < 4; ++k) {
+ P[0][k] += xi*X;
+ P[k][0] += yj*Y;
+ P[1][k] += (xp+2*xi)/3*X;
+ P[k][1] += (yp+2*yj)/3*Y;
+ P[2][k] += (2*xp+xi)/3*X;
+ P[k][2] += (2*yp+yj)/3*Y;
+ P[3][k] += xp*X;
+ P[k][3] += yp*Y;
+ }
+ // z: value
+ P[0][0] += zi[j]*Z;
+ P[3][0] += zp[j]*Z;
+ P[0][3] += zi[j+1]*Z;
+ P[3][3] += zp[j+1]*Z;
+ // z: first derivative
+ P[1][0] += (P[0][0].z+hx*pi[j])*Z;
+ P[1][3] += (P[0][3].z+hx*pi[j+1])*Z;
+ P[2][0] += (P[3][0].z-hx*pp[j])*Z;
+ P[2][3] += (P[3][3].z-hx*pp[j+1])*Z;
+ P[0][1] += (P[0][0].z+hy*qi[j])*Z;
+ P[3][1] += (P[3][0].z+hy*qp[j])*Z;
+ P[0][2] += (P[0][3].z-hy*qi[j+1])*Z;
+ P[3][2] += (P[3][3].z-hy*qp[j+1])*Z;
+ // z: second derivative
+ P[1][1] += (P[0][1].z+P[1][0].z-P[0][0].z+hxy*ri[j])*Z;
+ P[1][2] += (P[0][2].z+P[1][3].z-P[0][3].z-hxy*ri[j+1])*Z;
+ P[2][1] += (P[2][0].z+P[3][1].z-P[3][0].z-hxy*rp[j])*Z;
+ P[2][2] += (P[2][3].z+P[3][2].z-P[3][3].z+hxy*rp[j+1])*Z;
+ s.s[++k]=patch(P);
+ indexi[j]=k;
+ }
+ }
+ }
+
+ return s;
+}
+
+// return the surface described by a real matrix f, interpolated with
+// xsplinetype and ysplinetype.
+surface surface(real[][] f, real[] x, real[] y,
+ splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
+ bool[][] cond={})
+{
+ real epsilon=sqrtEpsilon*norm(y);
+ if(xsplinetype == null)
+ xsplinetype=(abs(x[0]-x[x.length-1]) <= epsilon) ? periodic : notaknot;
+ if(ysplinetype == null)
+ ysplinetype=(abs(y[0]-y[y.length-1]) <= epsilon) ? periodic : notaknot;
+ int n=x.length; int m=y.length;
+ real[][] ft=transpose(f);
+ real[][] tp=new real[m][];
+ for(int j=0; j < m; ++j)
+ tp[j]=xsplinetype(x,ft[j]);
+ real[][] q=new real[n][];
+ for(int i=0; i < n; ++i)
+ q[i]=ysplinetype(y,f[i]);
+ real[][] qt=transpose(q);
+ real[] d1=xsplinetype(x,qt[0]);
+ real[] d2=xsplinetype(x,qt[m-1]);
+ real[][] r=new real[n][];
+ real[][] p=transpose(tp);
+ for(int i=0; i < n; ++i)
+ r[i]=clamped(d1[i],d2[i])(y,p[i]);
+ surface s=bispline(f,p,q,r,x,y,cond);
+ if(xsplinetype == periodic) s.ucyclic(true);
+ if(ysplinetype == periodic) s.vcyclic(true);
+ return s;
+}
+
+bool uperiodic(real[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length;
+ real[] a0=a[0];
+ real[] a1=a[n-1];
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int j=0; j < m; ++j)
+ if(abs(a0[j]-a1[j]) > epsilon) return false;
+ return true;
+}
+bool vperiodic(real[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length-1;
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int i=0; i < n; ++i)
+ if(abs(a[i][0]-a[i][m]) > epsilon) return false;
+ return true;
+}
+
+// return the surface described by a parametric function f evaluated at u and v
+// and interpolated with usplinetype and vsplinetype.
+surface surface(triple f(pair z), real[] u, real[] v,
+ splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
+ bool cond(pair z)=null)
+{
+ int nu=u.length-1;
+ int nv=v.length-1;
+ real[] ipt=sequence(u.length);
+ real[] jpt=sequence(v.length);
+ real[][] fx=new real[u.length][v.length];
+ real[][] fy=new real[u.length][v.length];
+ real[][] fz=new real[u.length][v.length];
+
+ bool[][] active;
+ bool all=cond == null;
+ if(!all) active=new bool[u.length][v.length];
+
+ for(int i=0; i <= nu; ++i) {
+ real ui=u[i];
+ real[] fxi=fx[i];
+ real[] fyi=fy[i];
+ real[] fzi=fz[i];
+ bool[] activei=all ? null : active[i];
+ for(int j=0; j <= nv; ++j) {
+ pair z=(ui,v[j]);
+ triple f=(all || (activei[j]=cond(z))) ? f(z) : O;
+ fxi[j]=f.x;
+ fyi[j]=f.y;
+ fzi[j]=f.z;
+ }
+ }
+
+ if(usplinetype.length == 0) {
+ usplinetype=new splinetype[] {uperiodic(fx) ? periodic : notaknot,
+ uperiodic(fy) ? periodic : notaknot,
+ uperiodic(fz) ? periodic : notaknot};
+ } else if(usplinetype.length != 3) abort("usplinetype must have length 3");
+
+ if(vsplinetype.length == 0) {
+ vsplinetype=new splinetype[] {vperiodic(fx) ? periodic : notaknot,
+ vperiodic(fy) ? periodic : notaknot,
+ vperiodic(fz) ? periodic : notaknot};
+ } else if(vsplinetype.length != 3) abort("vsplinetype must have length 3");
+
+ surface sx=surface(fx,ipt,jpt,usplinetype[0],vsplinetype[0],active);
+ surface sy=surface(fy,ipt,jpt,usplinetype[1],vsplinetype[1],active);
+ surface sz=surface(fz,ipt,jpt,usplinetype[2],vsplinetype[2],active);
+
+ surface s=surface(sx.s.length);
+ s.index=new int[nu][nv];
+ int k=-1;
+ for(int i=0; i < nu; ++i) {
+ int[] indexi=s.index[i];
+ for(int j=0; j < nv; ++j)
+ indexi[j]=++k;
+ }
+
+ for(int k=0; k < sx.s.length; ++k) {
+ triple[][] Q=new triple[4][];
+ for(int i=0; i < 4 ; ++i)
+ Q[i]=sequence(new triple(int j) {
+ return (sx.s[k].P[i][j].z,sy.s[k].P[i][j].z,sz.s[k].P[i][j].z);
+ },4);
+ s.s[k]=patch(Q);
+ }
+
+ if(usplinetype[0] == periodic && usplinetype[1] == periodic &&
+ usplinetype[1] == periodic) s.ucyclic(true);
+
+ if(vsplinetype[0] == periodic && vsplinetype[1] == periodic &&
+ vsplinetype[1] == periodic) s.vcyclic(true);
+
+ return s;
+}
+
+path3 interp(path3 a, path3 b, real t)
+{
+ int n=size(a);
+ return path3(sequence(new triple(int i) {return interp(precontrol(a,i),
+ precontrol(b,i),t);},n),
+ sequence(new triple(int i) {return interp(point(a,i),point(b,i),t);},n),
+ sequence(new triple(int i) {return interp(postcontrol(a,i),
+ postcontrol(b,i),t);},n),
+ sequence(new bool(int i) {return straight(a,i) && straight(b,i);},n),
+ cyclic(a) && cyclic(b));
+}
+
+struct tube
+{
+ surface s;
+ path3 center;
+
+ void operator init(path3 p, real width, int sectors=4,
+ real granularity=linegranularity) {
+ sectors += sectors % 2; // Must be even.
+ int h=quotient(sectors,2);
+ real r=0.5*width;
+
+ void generate(path3 p) {
+ int n=length(p);
+ if(piecewisestraight(p)) {
+ for(int i=0; i < n; ++i) {
+ triple v=point(p,i);
+ triple u=point(p,i+1)-v;
+ s.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder);
+ }
+ center=center&p;
+ } else {
+ real[] T;
+ path3 G;
+ for(int i=0; i < n; ++i)
+ render(subpath(p,i,i+1),granularity,
+ new void(path3 g, real s) {
+ G=G&g;
+ T.push(i+s);
+ });
+ T.push(n);
+ T.cyclic=cyclic(p);
+ rmf[] rmf=rmf(p,T);
+ triple f(pair t) {
+ rmf R=rmf[round(t.x)];
+ return point(G,t.x)+r*(R.r*cos(t.y)-R.s*sin(t.y));
+ }
+
+ real[] v=uniform(0,2pi,sectors);
+ static splinetype[] Monotonic={monotonic,monotonic,monotonic};
+ static splinetype[] Periodic={periodic,periodic,periodic};
+ if(T.length > 0) {
+ surface S=surface(f,sequence(T.length),v,Monotonic,Periodic);
+ s.append(S);
+
+ // Compute center of tube:
+ int n=S.index.length;
+ if(T.cyclic) --n;
+ triple[] pre=new triple[n+1];
+ triple[] point=new triple[n+1];
+ triple[] post=new triple[n+1];
+ int[] index=S.index[0];
+ pre[0]=point[0]=0.5*(S.s[index[0]].P[0][0]+S.s[index[h]].P[0][0]);
+ for(int i=0; i < n; ++i) {
+ index=S.index[i];
+ triple [][] P=S.s[index[0]].P;
+ triple [][] Q=S.s[index[h]].P;
+ post[i]=0.5*(P[1][0]+Q[1][0]);
+ pre[i+1]=0.5*(P[2][0]+Q[2][0]);
+ point[i+1]=0.5*(P[3][0]+Q[3][0]);
+ }
+ index=S.index[n-1];
+ post[n]=0.5*(S.s[index[0]].P[3][0]+S.s[index[h]].P[3][0]);
+ center=center&path3(pre,point,post,array(n+1,false),T.cyclic);
+ }
+ }
+ }
+
+ transform3 t=scale3(r);
+ bool cyclic=cyclic(p);
+ int begin=0;
+ int n=length(p);
+ for(int i=cyclic ? 0 : 1; i < n; ++i)
+ if(abs(dir(p,i,1)-dir(p,i,-1)) > sqrtEpsilon) {
+ generate(subpath(p,begin,i));
+ s.append(shift(point(p,i))*t*align(dir(p,i,-1))*unithemisphere);
+ begin=i;
+ }
+ generate(subpath(p,begin,n));
+ }
+}
diff --git a/Build/source/utils/asymptote/base/tree.asy b/Build/source/utils/asymptote/base/tree.asy
index 0f3559112c3..1e603ec4b6b 100644
--- a/Build/source/utils/asymptote/base/tree.asy
+++ b/Build/source/utils/asymptote/base/tree.asy
@@ -7,8 +7,8 @@
struct tree
{
- tree left = null;
- tree right = null;
+ tree left;
+ tree right;
int key = 0;
int value = 0;
}
diff --git a/Build/source/utils/asymptote/base/trembling.asy b/Build/source/utils/asymptote/base/trembling.asy
index fc50ce9b7f5..b01d572d6e2 100644
--- a/Build/source/utils/asymptote/base/trembling.asy
+++ b/Build/source/utils/asymptote/base/trembling.asy
@@ -84,7 +84,7 @@ real atime(pair m, path g, real fuzz=trembleFuzz())
// if(t.length <= 0) { // degenerated case
// r=initr;
// T *= shift(shx,0);
- // write("warning: atime needs numerical adjustment.");
+ // warning("atime","atime needs numerical adjustment.",position=true);
// }
// } while(t.length <= 0);
if(t.length > 0) ot=t[1];
diff --git a/Build/source/utils/asymptote/base/tube.asy b/Build/source/utils/asymptote/base/tube.asy
index 1f8ef950251..844a39c92f0 100644
--- a/Build/source/utils/asymptote/base/tube.asy
+++ b/Build/source/utils/asymptote/base/tube.asy
@@ -58,20 +58,7 @@ real[] sample(path3 g, real r, real relstep=0)
return t;
}
-struct Rmf
-{
- triple p,r,t; // s=cross(t,r);
- real reltime;
- void operator init(triple p, triple r, triple t, real reltime)
- {
- this.p=p;
- this.r=r;
- this.t=t;
- this.reltime=reltime;
- }
-}
-
-real degrees(Rmf a, Rmf b)
+real degrees(rmf a, rmf b)
{
real d=degrees(acos1(dot(a.r,b.r)));
real dt=dot(cross(a.r,b.r),a.t);
@@ -79,37 +66,6 @@ real degrees(Rmf a, Rmf b)
return d%360;
}
-private Rmf[] rmf(path3 g, Rmf U0=Rmf(O,O,O,0), real[] t)
-{
- if(U0.t == O) {
- triple d=dir(g,0);
- U0=Rmf(point(g,0),perp(d),d,0);
- }
- int l=length(g);
- Rmf[] R={U0};
- triple rp,v1,v2,tp,ti,p;
- real c;
-
- for(int i=0; i < t.length-1; ++i) {
- p=point(g,t[i+1]);
- v1=p-R[i].p;
- c=dot(v1,v1);
- if(c != 0) {
- rp=R[i].r-2*dot(v1,R[i].r)*v1/c;
- ti=R[i].t;
- tp=ti-2*dot(v1,ti)*v1/c;
- ti=dir(g,t[i+1]);
- v2=ti-tp;
- rp=rp-2*dot(v2,rp)*v2/dot(v2,v2);
- R.push(Rmf(p,unit(rp),unit(ti),t[i+1]/l));
- } else {
- write("Warning: path3 has duplicated point in Rmf.");
- R.push(R[R.length-1]);
- }
- }
- return R;
-}
-
restricted int coloredNodes=1;
restricted int coloredSegments=2;
@@ -158,8 +114,7 @@ coloredpath operator cast(guide p)
return coloredpath(p);
}
-private surface surface(Rmf[] R, coloredpath cp,transform T(real)=
- new transform(real t) {return identity();},
+private surface surface(rmf[] R, real[] t, coloredpath cp, transform T(real),
bool cyclic)
{
path g=cp.p;
@@ -169,22 +124,22 @@ private surface surface(Rmf[] R, coloredpath cp,transform T(real)=
planar[i]=straight(g,i);
surface s;
- path3 sec=path3(T(R[0].reltime)*g);
+ path3 sec=path3(T(t[0]/l)*g);
real adjust=0;
if(cyclic) adjust=-degrees(R[0],R[R.length-1])/(R.length-1);
- path3 sec1=shift(R[0].p)*transform3(R[0].r,cross(R[0].t,R[0].r),R[0].t)*sec,
+ path3 sec1=shift(R[0].p)*transform3(R[0].r,R[0].s,R[0].t)*sec,
sec2;
for(int i=1; i < R.length; ++i) {
- sec=path3(T(R[i].reltime)*g);
+ sec=path3(T(t[i]/l)*g);
sec2=shift(R[i].p)*transform3(R[i].r,cross(R[i].t,R[i].r),R[i].t)*
rotate(i*adjust,Z)*sec;
for(int j=0; j < l; ++j) {
surface st=surface(subpath(sec1,j,j+1)--subpath(sec2,j+1,j)--cycle,
planar=planar[j]);
if(cp.usepens) {
- pen[] tp1=cp.pens(R[i-1].reltime), tp2=cp.pens(R[i].reltime);
- tp1.cyclic(true); tp2.cyclic(true);
+ pen[] tp1=cp.pens(t[i-1]/l), tp2=cp.pens(t[i]/l);
+ tp1.cyclic=true; tp2.cyclic=true;
if(cp.colortype == coloredSegments) {
st.colors(new pen[][] {{tp1[j],tp1[j],tp2[j],tp2[j]}});
} else {
@@ -206,6 +161,6 @@ surface tube(path3 g, coloredpath section,
real[] t=sample(g,max(M.x-m.x,M.y-m.y)/max(realEpsilon,abs(corner)),
min(abs(relstep),1));
bool cyclic=cyclic(g);
- t.cyclic(cyclic);
- return surface(rmf(g,t),section,T,cyclic);
+ t.cyclic=cyclic;
+ return surface(rmf(g,t),t,section,T,cyclic);
}
diff --git a/Build/source/utils/asymptote/builtin.cc b/Build/source/utils/asymptote/builtin.cc
index ae998acf322..c20a14e4778 100644
--- a/Build/source/utils/asymptote/builtin.cc
+++ b/Build/source/utils/asymptote/builtin.cc
@@ -45,7 +45,8 @@ using run::minus;
using namespace run;
-void gen_base_venv(venv &ve);
+void gen_runtime_venv(venv &ve);
+void gen_backtrace_venv(venv &ve);
void addType(tenv &te, const char *name, ty *t)
{
@@ -56,7 +57,7 @@ void addType(tenv &te, const char *name, ty *t)
void base_tenv(tenv &te)
{
#define PRIMITIVE(name,Name,asyName) addType(te, #asyName, prim##Name());
-#include <primitives.h>
+#include "primitives.h"
#undef PRIMITIVE
}
@@ -104,6 +105,7 @@ void addFunc(venv &ve, bltin f, ty *result, const char *name,
formal f7, formal f8, formal f9, formal fA, formal fB, formal fC,
formal fD, formal fE, formal fF, formal fG, formal fH, formal fI)
{
+ REGISTER_BLTIN(f, name);
access *a = new bltinAccess(f);
addFunc(ve,a,result,symbol::trans(name),f1,f2,f3,f4,f5,f6,f7,f8,f9,
fA,fB,fC,fD,fE,fF,fG,fH,fI);
@@ -118,6 +120,7 @@ void addOpenFunc(venv &ve, bltin f, ty *result, const char *name)
{
function *fun = new function(result, signature::OPEN);
+ REGISTER_BLTIN(f, name);
access *a= new bltinAccess(f);
varEntry *ent = new varEntry(fun, a, 0, position());
@@ -132,6 +135,7 @@ void addRestFunc(venv &ve, bltin f, ty *result, const char *name, formal frest,
formal f4=noformal, formal f5=noformal, formal f6=noformal,
formal f7=noformal, formal f8=noformal, formal f9=noformal)
{
+ REGISTER_BLTIN(f, name);
access *a = new bltinAccess(f);
function *fun = new function(result);
@@ -599,6 +603,11 @@ void addInitializer(venv &ve, ty *t, access *a)
void addInitializer(venv &ve, ty *t, bltin f)
{
+#ifdef DEBUG_BLTIN
+ ostringstream s;
+ s << "initializer for " << *t;
+ REGISTER_BLTIN(f, s.str());
+#endif
access *a = new bltinAccess(f);
addInitializer(ve, t, a);
}
@@ -617,10 +626,20 @@ void addCast(venv &ve, ty *target, ty *source, access *a) {
}
void addExplicitCast(venv &ve, ty *target, ty *source, bltin f) {
+#ifdef DEBUG_BLTIN
+ ostringstream s;
+ s << "explicit cast from " << *source << " to " << *target;
+ REGISTER_BLTIN(f, s.str());
+#endif
addExplicitCast(ve, target, source, new bltinAccess(f));
}
void addCast(venv &ve, ty *target, ty *source, bltin f) {
+#ifdef DEBUG_BLTIN
+ ostringstream s;
+ s << "cast from " << *source << " to " << *target;
+ REGISTER_BLTIN(f, s.str());
+#endif
addCast(ve, target, source, new bltinAccess(f));
}
@@ -749,9 +768,11 @@ template<class T, template <class S> class op>
void addBooleanOps(venv &ve, ty *t1, const char *name, ty *t2)
{
addBooleanOperator(ve,binaryOp<T,op>,t1,name);
- addFunc(ve,opArray<T,T,op>,boolArray(),name,formal(t1,"a"),formal(t2,"b"));
- addFunc(ve,arrayOp<T,T,op>,boolArray(),name,formal(t2,"a"),formal(t1,"b"));
- addFunc(ve,arrayArrayOp<T,op>,boolArray(),name,formal(t2,"a"),
+ addFunc(ve,opArray<T,T,op>,
+ booleanArray(),name,formal(t1,"a"),formal(t2,"b"));
+ addFunc(ve,arrayOp<T,T,op>,
+ booleanArray(),name,formal(t2,"a"),formal(t1,"b"));
+ addFunc(ve,arrayArrayOp<T,op>,booleanArray(),name,formal(t2,"a"),
formal(t2,"b"));
}
@@ -916,12 +937,12 @@ void addOperators(venv &ve)
{
addSimpleOperator(ve,binaryOp<string,plus>,primString(),"+");
- addBooleanOps<bool,And>(ve,primBoolean(),"&",boolArray());
- addBooleanOps<bool,Or>(ve,primBoolean(),"|",boolArray());
- addBooleanOps<bool,Xor>(ve,primBoolean(),"^",boolArray());
+ addBooleanOps<bool,And>(ve,primBoolean(),"&",booleanArray());
+ addBooleanOps<bool,Or>(ve,primBoolean(),"|",booleanArray());
+ addBooleanOps<bool,Xor>(ve,primBoolean(),"^",booleanArray());
- addUnorderedOps<bool>(ve,primBoolean(),boolArray(),boolArray2(),
- boolArray3());
+ addUnorderedOps<bool>(ve,primBoolean(),booleanArray(),booleanArray2(),
+ booleanArray3());
addOps<Int>(ve,primInt(),IntArray(),IntArray2(),IntArray3(),true);
addOps<double>(ve,primReal(),realArray(),realArray2(),realArray3());
addOps<pair>(ve,primPair(),pairArray(),pairArray2(),pairArray3(),false,true);
@@ -978,7 +999,12 @@ void addOperators(venv &ve)
dummyRecord *createDummyRecord(venv &ve, const char *name)
{
dummyRecord *r=new dummyRecord(name);
- addConstant(ve, new vm::frame(0), r, name);
+#ifdef DEBUG_FRAME
+ vm::frame *f = new vm::frame("dummy record " + string(name), 0);
+#else
+ vm::frame *f = new vm::frame(0);
+#endif
+ addConstant(ve, f, r, name);
addRecordOps(ve, r);
return r;
}
@@ -1329,9 +1355,9 @@ void base_venv(venv &ve)
addWrite(ve,write<transform>,primTransform(),transformArray());
addWrite(ve,write<guide *>,primGuide(),guideArray());
addWrite(ve,write<pen>,primPen(),penArray());
- addFunc(ve,arrayArrayOp<pen,equals>,boolArray(),"==",
+ addFunc(ve,arrayArrayOp<pen,equals>,booleanArray(),"==",
formal(penArray(),"a"),formal(penArray(),"b"));
- addFunc(ve,arrayArrayOp<pen,notequals>,boolArray(),"!=",
+ addFunc(ve,arrayArrayOp<pen,notequals>,booleanArray(),"!=",
formal(penArray(),"a"),formal(penArray(),"b"));
addFunc(ve,arrayFunction,realArray(),"map",
@@ -1369,11 +1395,8 @@ void base_venv(venv &ve)
addOpenFunc(ve, openFunc, primInt(), "openFunc");
#endif
- gen_base_venv(ve);
-}
-
-void base_menv(menv&)
-{
+ gen_runtime_venv(ve);
+ gen_backtrace_venv(ve);
}
} //namespace trans
diff --git a/Build/source/utils/asymptote/builtin.h b/Build/source/utils/asymptote/builtin.h
index 67f9165ec6c..6f0c382d100 100644
--- a/Build/source/utils/asymptote/builtin.h
+++ b/Build/source/utils/asymptote/builtin.h
@@ -14,12 +14,10 @@ namespace trans {
class tenv;
class venv;
-class menv;
// The base environments for built-in types and functions
void base_tenv(tenv &);
void base_venv(venv &);
-void base_menv(menv &);
extern const types::formal noformal;
diff --git a/Build/source/utils/asymptote/callable.cc b/Build/source/utils/asymptote/callable.cc
index ba3fe33152c..581c3af2c1c 100644
--- a/Build/source/utils/asymptote/callable.cc
+++ b/Build/source/utils/asymptote/callable.cc
@@ -18,6 +18,10 @@ void func::call(stack *s)
s->run(this);
}
+void nullfunc::print(ostream& out) {
+ out << "nullfunc";
+}
+
bool func::compare(callable* F)
{
if (func* f=dynamic_cast<func*>(F))
@@ -25,6 +29,13 @@ bool func::compare(callable* F)
else return false;
}
+void func::print(ostream& out) {
+ out << "func with lambda";
+#ifdef DEBUG_FRAME
+ out << " " << body->name;
+#endif
+}
+
bool bfunc::compare(callable* F)
{
if (bfunc* f=dynamic_cast<bfunc*>(F))
@@ -32,12 +43,24 @@ bool bfunc::compare(callable* F)
else return false;
}
+void bfunc::print(ostream& out) {
+ out << "bltin";
+#ifdef DEBUG_BLTIN
+ out << " " << lookupBltin(func);
+#endif
+}
+
void thunk::call(stack *s)
{
s->push(arg);
func->call(s);
}
+void thunk::print(ostream& out) {
+ out << "thunk on " << arg << " with ";
+ func->print(out);
+}
+
nullfunc nullfunc::func;
void nullfunc::call(stack *)
{
diff --git a/Build/source/utils/asymptote/callable.h b/Build/source/utils/asymptote/callable.h
index 4274218f8fd..851ccb4623d 100644
--- a/Build/source/utils/asymptote/callable.h
+++ b/Build/source/utils/asymptote/callable.h
@@ -10,6 +10,7 @@
#include "common.h"
#include "item.h"
+#include "inst.h"
namespace vm {
@@ -21,6 +22,9 @@ struct callable : public gc
virtual void call(stack *) = 0;
virtual ~callable();
virtual bool compare(callable*) { return false; }
+
+ // For debugging:
+ virtual void print(ostream& out) = 0;
};
class nullfunc : public callable
@@ -32,6 +36,8 @@ public:
virtual void call (stack*);
virtual bool compare(callable*);
static callable* instance() { return &func; }
+
+ void print(ostream& out);
};
// How a function reference to a non-builtin function is stored.
@@ -41,6 +47,8 @@ struct func : public callable {
func () : body(), closure() {}
virtual void call (stack*);
virtual bool compare(callable*);
+
+ void print(ostream& out);
};
class bfunc : public callable
@@ -49,6 +57,8 @@ public:
bfunc(bltin b) : func(b) {}
virtual void call (stack *s) { func(s); }
virtual bool compare(callable*);
+
+ void print(ostream& out);
private:
bltin func;
};
@@ -58,11 +68,18 @@ class thunk : public callable
public:
thunk(callable *f, item i) : func(f), arg(i) {}
virtual void call (stack*);
+
+ void print(ostream& out);
private:
callable *func;
item arg;
};
+inline ostream& operator<< (ostream& out, callable &c) {
+ c.print(out);
+ return out;
+}
+
} // namespace vm
GC_DECLARE_PTRFREE(vm::nullfunc);
diff --git a/Build/source/utils/asymptote/coder.cc b/Build/source/utils/asymptote/coder.cc
index 01d3ff3a58f..fc71f730b44 100644
--- a/Build/source/utils/asymptote/coder.cc
+++ b/Build/source/utils/asymptote/coder.cc
@@ -24,15 +24,25 @@ function *inittype();
function *bootuptype();
}
+vm::lambda *newLambda(string name) {
+ assert(!name.empty());
+ vm::lambda *l = new vm::lambda;
+#ifdef DEBUG_FRAME
+ l->name = name;
+#endif
+ return l;
+}
+
+
// The dummy environment of the global environment.
// Used purely for global variables and static code blocks of file
// level modules.
-coder::coder(modifier sord)
- : level(new frame(0, 0)),
+coder::coder(string name, modifier sord)
+ : level(new frame(name, 0, 0)),
recordLevel(0),
recordType(0),
isCodelet(false),
- l(new vm::lambda),
+ l(newLambda(name)),
funtype(bootuptype()),
parent(0),
sord(sord),
@@ -46,13 +56,16 @@ coder::coder(modifier sord)
}
// Defines a new function environment.
-coder::coder(function *t, coder *parent, modifier sord, bool reframe)
- : level(reframe ? new frame(parent->getFrame(), t->sig.getNumFormals()) :
- parent->getFrame()),
+coder::coder(string name, function *t, coder *parent,
+ modifier sord, bool reframe)
+ : level(reframe ? new frame(name,
+ parent->getFrame(),
+ t->sig.getNumFormals()) :
+ parent->getFrame()),
recordLevel(parent->recordLevel),
recordType(parent->recordType),
isCodelet(!reframe),
- l(new vm::lambda),
+ l(newLambda(name)),
funtype(t),
parent(parent),
sord(sord),
@@ -85,21 +98,22 @@ coder::coder(record *t, coder *parent, modifier sord)
encodeAllocInstruction();
}
-coder coder::newFunction(function *t, modifier sord)
+coder coder::newFunction(string name, function *t, modifier sord)
{
- return coder(t, this, sord);
+ return coder(name, t, this, sord);
}
coder coder::newCodelet()
{
- return coder(new function(primVoid()), this, DEFAULT_DYNAMIC, false);
+ return coder("<codelet>", new function(primVoid()), this,
+ DEFAULT_DYNAMIC, false);
}
record *coder::newRecord(symbol *id)
{
frame *underlevel = getFrame();
- frame *level = new frame(underlevel, 0);
+ frame *level = new frame(*id, underlevel, 0);
record *r = new record(id, level);
@@ -111,6 +125,16 @@ coder coder::newRecordInit(record *r, modifier sord)
return coder(r, this, sord);
}
+#ifdef DEBUG_BLTIN
+void assertBltinLookup(inst::opcode op, item it)
+{
+ if (op == inst::builtin) {
+ string name=lookupBltin(vm::get<vm::bltin>(it));
+ assert(!name.empty());
+ }
+}
+#endif
+
bool coder::encode(frame *f)
{
diff --git a/Build/source/utils/asymptote/coder.h b/Build/source/utils/asymptote/coder.h
index 331ed3d9952..c6524f3c4ad 100644
--- a/Build/source/utils/asymptote/coder.h
+++ b/Build/source/utils/asymptote/coder.h
@@ -30,6 +30,10 @@ using vm::bltin;
using vm::inst;
using vm::item;
+#ifdef DEBUG_BLTIN
+void assertBltinLookup(inst::opcode op, item it);
+#endif
+
class coder {
// The frame of the function we are currently encoding. This keeps
// track of local variables, and parameters with respect to the stack.
@@ -100,14 +104,15 @@ public:
// its own frame, which is the usual (sensible) thing to do. It is set to
// false for a line-at-a-time codelet, where variables should be allocated in
// the lower frame.
- coder(function *t, coder *parent, modifier sord = DEFAULT_DYNAMIC,
+ coder(string name, function *t, coder *parent,
+ modifier sord = DEFAULT_DYNAMIC,
bool reframe=true);
// Start encoding the body of the record. The function being encoded
// is the record's initializer.
coder(record *t, coder *parent, modifier sord = DEFAULT_DYNAMIC);
- coder(modifier sord = DEFAULT_DYNAMIC);
+ coder(string name, modifier sord = DEFAULT_DYNAMIC);
coder(const coder&);
@@ -174,7 +179,7 @@ public:
bool isRecord();
// Creates a new coder to handle the translation of a new function.
- coder newFunction(function *t, modifier sord=DEFAULT_DYNAMIC);
+ coder newFunction(string name, function *t, modifier sord=DEFAULT_DYNAMIC);
// Creates a new record type.
record *newRecord(symbol *id);
@@ -253,6 +258,9 @@ public:
}
void encode(inst::opcode op, item it)
{
+#ifdef DEBUG_BLTIN
+ assertBltinLookup(op, it);
+#endif
inst i; i.op = op; i.pos = nullPos; i.ref = it;
encode(i);
}
@@ -349,7 +357,7 @@ private:
public:
void encodePushFrame() {
encode(inst::pushframe);
- level = new frame(level, 0);
+ level = new frame("encodePushFrame", level, 0);
encodeAllocInstruction();
}
diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure
index b2f95697198..17edcf8f38f 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.63 for Asymptote 1.82.
+# Generated by GNU Autoconf 2.63 for Asymptote 1.83.
#
# Report bugs to <http://sourceforge.net/projects/asymptote>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='Asymptote'
PACKAGE_TARNAME='asymptote'
-PACKAGE_VERSION='1.82'
-PACKAGE_STRING='Asymptote 1.82'
+PACKAGE_VERSION='1.83'
+PACKAGE_STRING='Asymptote 1.83'
PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote'
# Factoring default headers for most tests.
@@ -1294,7 +1294,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 1.82 to adapt to many kinds of systems.
+\`configure' configures Asymptote 1.83 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1355,7 +1355,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of Asymptote 1.82:";;
+ short | recursive ) echo "Configuration of Asymptote 1.83:";;
esac
cat <<\_ACEOF
@@ -1465,7 +1465,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-Asymptote configure 1.82
+Asymptote configure 1.83
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1479,7 +1479,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 1.82, which was
+It was created by Asymptote $as_me 1.83, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -4028,6 +4028,8 @@ 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; exit -1;"
+
@@ -7096,6 +7098,10 @@ _ACEOF
LIBS="-lm $LIBS"
+else
+ { { $as_echo "$as_me:$LINENO: error: *** Please install libm on your system ***" >&5
+$as_echo "$as_me: error: *** Please install libm on your system ***" >&2;}
+ { (exit 1); exit 1; }; }
fi
@@ -7171,6 +7177,10 @@ _ACEOF
LIBS="-lz $LIBS"
+else
+ { { $as_echo "$as_me:$LINENO: error: *** Please install libz on your system ***" >&5
+$as_echo "$as_me: error: *** Please install libz on your system ***" >&2;}
+ { (exit 1); exit 1; }; }
fi
@@ -11496,7 +11506,7 @@ exec 6>&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 1.82, which was
+This file was extended by Asymptote $as_me 1.83, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -11555,7 +11565,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-Asymptote config.status 1.82
+Asymptote config.status 1.83
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/Build/source/utils/asymptote/configure.ac b/Build/source/utils/asymptote/configure.ac
index fc37dab5cb7..315381fc1c2 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],[1.82],[http://sourceforge.net/projects/asymptote])
+AC_INIT([Asymptote],[1.83],[http://sourceforge.net/projects/asymptote])
VERSION=$PACKAGE_VERSION
AC_SUBST(VERSION)
@@ -52,7 +52,9 @@ else
fi
])
-AC_CHECK_PROGS(TEXI2DVI,[texi2dvi texi2dvi4a2ps])
+AC_CHECK_PROGS(TEXI2DVI,[texi2dvi texi2dvi4a2ps],
+[echo texi2dvi is missing! Please put http://asymptote.sourceforge.net/asymptote.pdf in the doc directory; exit -1;])
+
AC_SUBST(TEXI2DVI)
latexdir=$latexdir/asymptote
@@ -210,8 +212,10 @@ AC_SUBST(OPTIONS)
AC_CHECK_LIB([ncurses], [setupterm], [AC_DEFINE(HAVE_LIBCURSES)
LIBS=$LIBS"-lncurses "],
AC_CHECK_LIB([curses], [setupterm]))
-AC_CHECK_LIB([m], [sqrt])
-AC_CHECK_LIB([z], [deflate])
+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_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([sigsegv], [stackoverflow_install_handler])
AC_CHECK_LIB([rt], [sched_yield])
diff --git a/Build/source/utils/asymptote/constructor.cc b/Build/source/utils/asymptote/constructor.cc
index 5915a614985..d22e9ee31d0 100644
--- a/Build/source/utils/asymptote/constructor.cc
+++ b/Build/source/utils/asymptote/constructor.cc
@@ -92,8 +92,11 @@ varEntry *constructorFromInitializer(position pos, coenv &e, record *r,
types::function *ft=new types::function(r, init->getSignature());
+ ostringstream out;
+ ft->printVar(out, symbol::trans("<constructor>"));
+
// Create a new function environment.
- coder fc = e.c.newFunction(ft);
+ coder fc = e.c.newFunction(out.str(), ft);
coenv fe(fc,e.e);
// Translate the function.
diff --git a/Build/source/utils/asymptote/dec.cc b/Build/source/utils/asymptote/dec.cc
index fefc096fdc5..07e1711107c 100644
--- a/Build/source/utils/asymptote/dec.cc
+++ b/Build/source/utils/asymptote/dec.cc
@@ -164,7 +164,7 @@ void block::transAsRecordBody(coenv &e, record *r)
record *block::transAsFile(genv& ge, symbol *id)
{
// Create the new module.
- record *r = new record(id, new frame(0,0));
+ record *r = new record(id, new frame(*id,0,0));
// Create coder and environment to translate the module.
// File-level modules have dynamic fields by default.
diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf
index 0aa34db1a1f..2b4cc8370e5 100644
--- a/Build/source/utils/asymptote/doc/CAD.pdf
+++ b/Build/source/utils/asymptote/doc/CAD.pdf
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
index 08d26f6dc61..085a3a3aca6 100644
--- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
+++ b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info
@@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY
File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir)
ASYMPTOTE FREQUENTLY ASKED QUESTIONS
- 19 Jul 2009
+ 15 Aug 2009
This is the list of Frequently Asked Questions about Asymptote (asy).
diff --git a/Build/source/utils/asymptote/doc/asy.1 b/Build/source/utils/asymptote/doc/asy.1
index 18992ffb7b3..5bd2e78daa0 100644
--- a/Build/source/utils/asymptote/doc/asy.1
+++ b/Build/source/utils/asymptote/doc/asy.1
@@ -50,6 +50,9 @@ Module to automatically import.
.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
@@ -137,6 +140,9 @@ List available global functions and variables [false].
.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
diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf
index 845a4f3e2cc..c6b4904a2f7 100644
--- a/Build/source/utils/asymptote/doc/asymptote.pdf
+++ b/Build/source/utils/asymptote/doc/asymptote.pdf
Binary files differ
diff --git a/Build/source/utils/asymptote/doc/asymptote.sty b/Build/source/utils/asymptote/doc/asymptote.sty
index e1f059bf46d..3e6bf310c60 100644
--- a/Build/source/utils/asymptote/doc/asymptote.sty
+++ b/Build/source/utils/asymptote/doc/asymptote.sty
@@ -3,18 +3,21 @@
%%% Modified by John Bowman
%%% Adapted from comment.sty (Under GPL v2)
-\ProvidesPackage{asymptote}[2009/06/18 v1.08 Asymptote style file for LaTeX]
+\ProvidesPackage{asymptote}[2009/08/14 v1.09 Asymptote style file for LaTeX]
\RequirePackage{keyval}
\RequirePackage{ifthen}
\newif\ifASYinline
\DeclareOption{inline}{\ASYinlinetrue}
\ProcessOptions*
+\def\unquoteJobname#1"#2"#3\relax{\def\rawJobname{#1}%
+ \ifx\rawJobname\empty\def\rawJobname{#2}\fi}
+\expandafter\unquoteJobname\jobname""\relax
% Work around jobname bug in MiKTeX 2.5 and 2.6:
% Turn stars in file names (resulting from spaces, etc.) into minus signs
\def\fixstar#1*#2\relax{\def\argtwo{#2}\ifx\argtwo\empty\gdef\Jobname{#1}\else
\fixstar#1-#2\relax\fi}
-\expandafter\fixstar\jobname*\relax
+\expandafter\fixstar\rawJobname*\relax
\RequirePackage{color,graphicx}
diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi
index db56898ee9c..736ac00dfa1 100644
--- a/Build/source/utils/asymptote/doc/asymptote.texi
+++ b/Build/source/utils/asymptote/doc/asymptote.texi
@@ -361,11 +361,12 @@ You will also need to install @code{GPL Ghostscript} from
To view the default @code{PostScript} output, you can install the
program @code{gsview} available from
@url{http://www.cs.wisc.edu/~ghost/gsview/}.
+@cindex @code{psview}
@anchor{psview}
A better (and free) @code{PostScript} viewer available at
@url{http://psview.sourceforge.net/} (which in particular works properly
in interactive mode) unfortunately currently requires some manual
-configuration. Specifically, if version @code{x.xx} of psview is
+configuration. Specifically, if version @code{x.xx} of @code{psview} is
extracted to the directory @code{c:\Program Files} one needs to put
@verbatim
import settings;
@@ -415,17 +416,15 @@ Users of @code{gsview} will need to enable @code{Options/Auto Redisplay}
(however, under @code{MSDOS} it is still necessary to click on the
@code{gsview} window; under @code{UNIX} one must manually redisplay by
pressing the @code{r} key). A better (and free) multiplatform
-alternative to @code{gsview} is psview (@pxref{psview}).
+alternative to @code{gsview} is @code{psview} (@pxref{psview}).
@cindex @code{settings}
@cindex configuration file
Configuration variables are most easily set as @code{Asymptote}
-variables in an optional configuration file (by default,
-@code{.asy/config.asy} in the user's home directory,
-@code{$TEXMFCONFIG/asymptote} under @code{TeXLive}, and
-@code{%USERPROFILE%\.asy\config.asy} under @code{MSDOS};
-@pxref{configuration file}). Here are the default values
-of several important configuration variables under @code{UNIX}:
+variables in an optional configuration file @code{config.asy}
+@pxref{configuration file}).
+Here are the default values of several important configuration
+variables under @code{UNIX}:
@noindent
@verbatim
@@ -506,7 +505,8 @@ warn(string s);
nowarn(string s);
@end verbatim
@noindent
-or by directly modifying the string array @code{warnings}.
+or by directly modifying the string array @code{settings.suppress}, which lists
+all disabled warnings.
@cindex command-line options
Configuration variables may also be set or overwritten with a
@@ -550,8 +550,10 @@ variable @code{dir} (separated by @code{:} under UNIX and
@code{;} under @code{MSDOS});
@item
@cindex @code{.asy}
-The directory @code{.asy} in the user's home directory
-(@code{%USERPROFILE%\.asy} under @code{MSDOS});
+The directory specified by the environment variable
+@code{ASYMPTOTE_HOME}; if this variable is not set,
+the directory @code{.asy} in the user's home directory
+(@code{%USERPROFILE%\.asy} under @code{MSDOS}) is used;
@item
The @code{Asymptote} system directory (by default,
@code{@value{Datadir}/asymptote} under @code{UNIX} and
@@ -898,6 +900,7 @@ interconnected with
@cindex @code{..}
@code{--}, which denotes a straight line segment, or @code{..}, which
denotes a cubic spline.
+@cindex @code{unitcircle}
@anchor{unitcircle}
@cindex @code{unitcircle}
Specifying a final node @code{cycle} creates a cyclic path that
@@ -907,6 +910,7 @@ connects smoothly back to the initial node, as in this approximation
path unitcircle=E..N..W..S..cycle;
@end verbatim
+@cindex Bezier
@anchor{Bezier}
@cindex direction specifier
Each interior node of a cubic spline may be given a
@@ -1127,6 +1131,7 @@ ends of the path). Each of these bar specifiers (except for
length of the bar in @code{PostScript} coordinates. The default
bar length is @code{barsize(pen)}.
+@cindex arrows
@anchor{arrows}
@cindex @code{None}
@cindex @code{Blank}
@@ -1161,10 +1166,10 @@ the predefined arrowhead styles @code{DefaultHead}, @code{SimpleHead},
real @code{size} (arrowhead size in @code{PostScript} coordinates),
real @code{angle} (arrowhead angle
in degrees), filltype @code{filltype} (one of @code{FillDraw}, @code{Fill},
-@code{NoFill}, @code{UnFill}, @code{Draw})
-and (except for @code{MidArrow} and @code{Arrows}) a
-relative real @code{position} along the path (an @code{arctime}) where
-the tip of the arrow should be placed. The default arrowhead size when drawn
+@code{NoFill}, @code{UnFill}, @code{Draw}) and (except for
+@code{MidArrow} and @code{Arrows}) a real @code{position} (in the
+sense of @code{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 @code{p} is @code{arrowsize(p)}. There are also arrow versions with
slightly modified default values of @code{size} and @code{angle} suitable for
curved arrows: @code{BeginArcArrow}, @code{EndArcArrow} (or equivalently
@@ -1478,6 +1483,7 @@ bottom-left corner of the label at @code{position}.
@cindex @code{nullpen}
If @code{p} is @code{nullpen}, the pen specified within the
Label, which defaults to @code{currentpen}, will be used.
+@cindex @code{Label}
@anchor{Label}
The Label @code{L} can either be a string or the structure obtained by calling
one of the functions
@@ -1529,11 +1535,11 @@ void label(picture pic=currentpicture, Label L, path g, align align=NoAlign,
@end verbatim
@cindex @code{Relative}
By default the label will be positioned at the midpoint of the path.
-An alternative label location (an @code{arctime} value between 0 and
-@code{length(g)} @pxref{arctime}) may be specified as real value for
-@code{position} in constructing the Label. The position
-@code{Relative(real)} specifies a location relative to the total
-arclength of the path. These convenient abbreviations are predefined:
+An alternative label position (in the sense of @code{point(path p, real t)})
+may be specified as a real value for @code{position} in constructing
+the Label. The position @code{Relative(real)} specifies a location
+relative to the total arclength of the path. These convenient
+abbreviations are predefined:
@cindex @code{BeginPoint}
@cindex @code{MidPoint}
@cindex @code{EndPoint}
@@ -2199,8 +2205,8 @@ path Arc(pair c, explicit pair z1, explicit pair z2,
@end verbatim
An ellipse can be drawn with the routine
-@verbatim
@cindex @code{ellipse}
+@verbatim
path ellipse(pair c, real a, real b)
{
return shift(c)*scale(a,b)*unitcircle;
@@ -2761,7 +2767,14 @@ pen Dotted(pen p=currentpen) {return dotted+2*linewidth(p);}
@cindex @code{defaultpen}
The default line type is @code{solid}; this may be changed with
@code{defaultpen(pen)}.
-The line type of a pen is returned by @code{int linetype(pen p=currentpen)}.
+@cindex @code{linetype}
+@cindex @code{offset}
+@cindex @code{scale}
+@cindex @code{adjust}
+The line type of a pen can be determined with the functions
+@code{string linetype(pen p=currentpen)},
+@code{real offset(pen p)}, @code{bool scale(pen p)}, and
+@code{bool adjust(pen p)}.
@cindex @code{linewidth}
@cindex @code{defaultpen}
@@ -3259,7 +3272,7 @@ void shipout(string prefix=defaultfilename, picture pic=currentpicture,
orientation orientation=orientation,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection);
+ light light=currentlight, projection P=currentprojection)
@end verbatim
@noindent
The default output format, @code{PostScript}, may be changed
@@ -3381,8 +3394,8 @@ margin and output the resulting frame, use the command:
@verbatim
shipout(bbox(0.25cm));
@end verbatim
-A @code{picture} may be fit to a frame with the background color of
-pen @code{p} with the function @code{bbox(p,Fill)}.
+A @code{picture} may be fit to a frame with the background color
+pen @code{p}, using the function @code{bbox(p,Fill)}.
The functions
@verbatim
@@ -3656,9 +3669,11 @@ write(fout,"List: ",1,2,3); // Writes "List: 1 2 3"
@cindex @code{xoutput}
@cindex @code{binput}
@cindex @code{boutput}
-@cindex @code{single}
+@cindex single precision
@cindex double precision
-@cindex @code{signed}
+@cindex @code{singlereal}
+@cindex @code{singleint}
+@cindex @code{signedint}
A file may also be opened with @code{xinput} or @code{xoutput}, instead of
@code{input} or @code{output}, to read or write
double precision (64-bit) reals and single precision (32-bit)
@@ -3668,23 +3683,21 @@ Data Representation) portable binary format (available on all
Alternatively, a file may also be opened with @code{binput} or
@code{boutput} to read or write double precision reals and single
precision integers in the native (nonportable) machine binary format.
-The function
-@code{file single(file f, bool real=true, bool int=true)} may
+The virtual member functions
+@code{file singlereal(bool b=false)} and @code{file singleint(bool b=true)}
be used to change the precision of real and integer I/O
operations, respectively, for an @acronym{XDR} or binary file @code{f}.
-Similarly, the function @code{file signed(file f, bool b=true)}
+Similarly, the function @code{file signedint(bool b=true)}
can be used to modify the signedness of integer reads and writes for
an @acronym{XDR} or binary file @code{f}.
-Note that @code{single}, and @code{signed} modify and return their
-file arguments (to facilitate nested function calls).
@cindex @code{name}
@cindex @code{mode}
@cindex @code{singlereal}
@cindex @code{singleint}
-@cindex @code{signed}
+@cindex @code{signedint}
The virtual members @code{name}, @code{mode}, @code{singlereal},
-@code{singleint}, and @code{signed} may be used to query the
+@code{singleint}, and @code{signedint} may be used to query the
respective parameters for a given file.
@cindex @code{eof}
@@ -4467,6 +4480,7 @@ as variables, but allows overloading by distinguishing variables
based on their signatures.
@cindex @code{libsigsegv}
+@cindex stack overflow
@anchor{stack overflow}
@cindex recursion
@cindex stack overflow
@@ -4906,7 +4920,6 @@ The @code{copy} function listed below provides a deep copy of an array.
@cindex @code{length}
@cindex @code{cyclic}
-@cindex @code{cyclicflag}
@cindex @code{keys}
@cindex @code{push}
@cindex @code{append}
@@ -4917,8 +4930,7 @@ The @code{copy} function listed below provides a deep copy of an array.
Every array @code{A} of type @code{T[]} has the virtual members
@itemize
@item @code{int length},
-@item @code{void cyclic(bool b)},
-@item @code{bool cyclicflag},
+@item @code{int cyclic},
@item @code{int[] keys},
@item @code{T push(T x)},
@item @code{void append(T[] a)},
@@ -4930,10 +4942,9 @@ Every array @code{A} of type @code{T[]} has the virtual members
@end itemize
The member @code{A.length} evaluates to the length of the array.
-Setting @code{A.cyclic(true)} signifies that array indices should be reduced
+Setting @code{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
-@code{A.cyclicflag} returns the current setting of the @code{cyclic} flag.
+cyclic array never leads to out-of-bounds errors or array resizing.
The member @code{A.keys} evaluates to an array of integers containing the
indices of initialized entries in the array in ascending order. Hence, for an
@@ -4952,7 +4963,7 @@ elements down. If no arguments are given, @code{A.delete()} provides a
convenient way of deleting all elements of @code{A}. The routine
@code{A.initialized(int n)} can be used to examine whether the element
at index @code{n} is initialized. Like all @code{Asymptote} functions,
-@code{cyclic}, @code{push}, @code{append}, @code{pop}, @code{insert},
+@code{push}, @code{append}, @code{pop}, @code{insert},
@code{delete}, and @code{initialized} can be "pulled off" of the array
and used on their own. For example,
@verbatim
@@ -5214,7 +5225,6 @@ If the matrix @code{a} is tridiagonal, the routine @code{tridiagonal} provides
a more efficient algorithm (@pxref{tridiagonal}).
@anchor{solve}
-
@cindex @code{solve}
@item real[][] solve(real[][] a, real[][] b, bool warn=true)
Solve the linear equation @math{@code{a}x=@code{b}} and return the
@@ -5286,12 +5296,16 @@ real[] A=fin;
@cindex line mode
@noindent
reads real values into @code{A} until the end-of-file is reached (or an
-I/O error occurs). If line mode is set with @code{line(file)}, then
+I/O error occurs).
+
+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
-(line mode may be cleared with @code{line(file,false)}):
@verbatim
file fin=input("test.txt");
-real[] A=line(fin);
+real[] A=fin.line();
@end verbatim
@cindex reading string arrays
@@ -5299,27 +5313,25 @@ real[] A=line(fin);
@cindex white-space string delimiter mode
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, set with
-@code{word(file)} and cleared with @code{word(file,false)}, which causes
-string reads to respect white-space delimiters, instead of the default
-end-of-line delimiter:
+However, there is a white-space delimiter mode for reading strings,
+@code{file word(bool b=true)}, which causes string reads to respect
+white-space delimiters, instead of the default end-of-line delimiter:
@verbatim
-file fin=word(line(input("test.txt")));
+file fin=input("test.txt").line().word();
real[] A=fin;
@end verbatim
@cindex @code{csv}
@cindex comma-separated-value mode
-Another useful mode is comma-separated-value mode, set with @code{csv(file)}
-and cleared with @code{csv(file,false)}, which causes reads to respect
-comma delimiters:
+Another useful mode is comma-separated-value mode,
+@code{file csv(bool b=true)}, which causes reads to respect comma delimiters:
@verbatim
file fin=csv(input("test.txt"));
real[] A=fin;
@end verbatim
@cindex @code{dimension}
-To restrict the number of values read, use the @code{dimension(file,int)}
+To restrict the number of values read, use the @code{file dimension(int)}
function:
@verbatim
file fin=input("test.txt");
@@ -5336,23 +5348,22 @@ Two- and three-dimensional arrays of the basic data types can be read
in like this:
@verbatim
file fin=input("test.txt");
-real[][] A=dimension(fin,2,3);
-real[][][] B=dimension(fin,2,3,4);
+real[][] A=fin.dimension(2,3);
+real[][][] B=fin.dimension(2,3,4);
@end verbatim
@noindent
Again, an integer limit of zero means no restriction.
-@cindex @code{read1}
-@cindex @code{read2}
-@cindex @code{read3}
+@cindex @code{read}
Sometimes the array dimensions are stored with the data as integer
-fields at the beginning of an array. Such arrays can be read in with the
-functions @code{read1}, @code{read2}, and @code{read3}, respectively:
+fields at the beginning of an array. Such 1, 2, or 3 dimensional
+arrays can be read in with the virtual member functions
+@code{read(1)}, @code{read(2)}, or @code{read(3)}, respectively:
@verbatim
file fin=input("test.txt");
-real[] A=read1(fin);
-real[][] B=read2(fin);
-real[][][] C=read3(fin);
+real[] A=fin.read(1);
+real[][] B=fin.read(2);
+real[][][] C=fin.read(3);
@end verbatim
@cindex @code{write}
@@ -5360,18 +5371,6 @@ One, two, and three-dimensional arrays of the basic data types can be
output with the functions @code{write(file,T[])},
@code{write(file,T[][])}, @code{write(file,T[][][])}, respectively.
-@cindex @code{dimension}
-@cindex @code{line}
-@cindex @code{csv}
-@cindex @code{word}
-@cindex @code{single}
-@cindex @code{signed}
-Note that @code{dimension}, @code{line}, @code{csv},
-@code{word}, @code{single}, and @code{signed} modify and return their
-file arguments (to facilitate nested function calls).
-The virtual members @code{dimension}, @code{line}, @code{csv}, and
-@code{word} may be used to query the respective parameters for a given file.
-
@node Slices
@subsection Slices
@cindex slices
@@ -5410,7 +5409,7 @@ simply wrap around. For example:
@verbatim
int[] x={0,1,2,3,4,5,6,7,8,9};
-x.cyclic(true);
+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}
@@ -5907,7 +5906,7 @@ need to remove the files @code{latexusage-*}, @code{latexusage_.pre}, and
One can specify @code{width}, @code{height},
@code{viewportwidth}, @code{viewportheight}, and @code{attach}
@code{keyval}-style options to the @code{asy} environment.
-The current version (1.07) of @code{asymptote.sty} supports the
+The current version (1.09) of @code{asymptote.sty} supports the
embedding of 3D @acronym{PRC} files, either inline or, using the
@code{attach} option with the @code{attachfile2} (or older
@code{attachfile}) @code{LaTeX} package,
@@ -6015,7 +6014,7 @@ sizing of pictures.
@section @code{math}
@cindex @code{math}
This package extends @code{Asymptote}'s mathematical capabilities with
-intersection algorithms and matrix arithmetic:
+matrix arithmetic and intersection algorithms:
@table @code
@@ -6195,7 +6194,6 @@ sharp corners of paths, as illustrated in the example file @code{roundpath.asy}.
@node animation
@section @code{animation}
@cindex @code{animation}
-@cindex @code{merge}
@cindex @code{convert}
@cindex animation
@cindex @code{ImageMagick}
@@ -6203,7 +6201,7 @@ This module allows one to generate animations, as illustrated by the
files @code{wheel.asy}, @code{wavelet.asy}, and @code{cube.asy} in
the @code{animations} subdirectory of the examples directory. These
animations use the @code{ImageMagick} @code{convert} program to
-@code{merge} multiple images into a @acronym{GIF} or @acronym{MPEG}
+merge multiple images into a @acronym{GIF} or @acronym{MPEG}
movie.
@cindex @code{animate}
@@ -6450,7 +6448,7 @@ bool3 function @code{cond} on [@code{a},@code{b}]. If @code{cond} is:
@item @code{default}, the point is added to a new guide;
@item @code{false}, the point is omitted and a new guide is begun.
@end itemize
-Th points are connected using the interpolation specified by @code{join}:
+The points are connected using the interpolation specified by @code{join}:
@itemize @bullet
@cindex @code{operator --}
@@ -6925,6 +6923,7 @@ the tick labels on the @math{y} axis.
@cindex @code{marknodes}
@cindex @code{markuniform}
@cindex @code{mark}
+@cindex path markers
@anchor{pathmarkers}
@item The next example draws two graphs of an array of coordinate pairs,
using frame alignment and data markers. In the left-hand graph, the
@@ -6991,6 +6990,7 @@ absolute values of the elements of the pair array @code{dp} and the
optional pair array @code{dm}. If @code{dm} is not specified, the
positive and negative extents of the error are assumed to be equal.
@anchor{errorbars}
+@cindex error bars
@verbatiminclude errorbars.asy
@sp 1
@center @image{errorbars}
@@ -7042,6 +7042,7 @@ factor.
@center @image{scaledgraph}
@anchor{automatic scaling}
+@cindex automatic scaling
@cindex @code{scale}
@cindex @code{Linear}
@cindex @code{Log}
@@ -7201,6 +7202,7 @@ data in @code{diatom.csv} and @code{westnile.csv}.
@node palette
@section @code{palette}
@anchor{images}
+@cindex images
@code{Asymptote} can also generate color density images
and palettes. The following palettes are predefined in
@code{palette.asy}:
@@ -7484,17 +7486,17 @@ Arbitrary thick three-dimensional curves and line caps (which the
@code{OpenGL} standard does not require implementations to provide) are
constructed with
@verbatim
-tube tube(path3 g, real width, real granularity=tubegranularity);
+tube tube(path3 p, real width, real granularity=tubegranularity);
@end verbatim
@noindent
this returns a tube structure representing a tube of diameter @code{width}
centered approximately on @code{g}. The tube structure consists of a
surface @code{s} and the actual tube center, path3 @code{center}.
-This can make files slow to render,
+Drawing thick lines as tubes can be slow to render,
especially with the @code{Adobe Reader} renderer. The setting
@code{thick=false} can be used to disable this feature and force all
lines to be drawn with @code{linewidth(0)} (one pixel wide, regardless
-of the resolution). By default mesh and contour lines in three-dimensions
+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 @code{thin} is set to @code{false}. The pens
@code{thin()} and @code{thick()} defined in plain_pens.asy can also be used
@@ -8040,6 +8042,7 @@ Further three-dimensional examples are provided in the files
subdirectory) @code{cube.asy}.
@anchor{PostScript3D}
+@cindex 3D @code{PostScript}
Limited support for projected vector graphics (effectively three-dimensional
nonrendered @code{PostScript}) is available with the setting
@code{render=0}. This currently only works for piecewise planar
@@ -8181,6 +8184,9 @@ surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
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,
@@ -8621,6 +8627,7 @@ automatically imported for each run as the final step in loading module
@code{plain}.
@anchor{configuration file}
+@cindex configuration file
@cindex @code{ASYMPTOTE_CONFIG}
@cindex @code{config}
@cindex @code{settings}
@@ -8628,8 +8635,8 @@ automatically imported for each run as the final step in loading module
Default option values may be entered as @code{Asymptote} code in a
configuration file named @code{config.asy} (or the file specified by
the environment variable @code{ASYMPTOTE_CONFIG} or @code{-config} option).
-@code{Asymptote} will look for this file in its usual search path.
-Typically the configuration file is placed in the
+@code{Asymptote} will look for this file in its usual search path
+(@pxref{Search paths}). Typically the configuration file is placed in the
@code{.asy} directory in the user's home directory
(@code{%USERPROFILE%\.asy} under @code{MSDOS}).
Configuration variables are accessed using the long form of the option names:
@@ -8804,6 +8811,7 @@ A trailing semi-colon followed by optional @code{Asymptote} commands may
be entered on the same line.
@cindex @code{quit}
@cindex @code{exit}
+@cindex @code{history}
@anchor{history}
@item quit
exit interactive mode (@code{exit} is a synonym; the abbreviation
diff --git a/Build/source/utils/asymptote/doc/diatom.asy b/Build/source/utils/asymptote/doc/diatom.asy
index 44155c56d89..2ded75bf0ea 100644
--- a/Build/source/utils/asymptote/doc/diatom.asy
+++ b/Build/source/utils/asymptote/doc/diatom.asy
@@ -10,7 +10,7 @@ int[] begin,end;
defaultpen(fontsize(8pt)+overwrite(MoveQuiet));
-file in=line(csv(input(data)));
+file in=input(data).line().csv();
string depthlabel=in;
string yearlabel=in;
diff --git a/Build/source/utils/asymptote/doc/filegraph.asy b/Build/source/utils/asymptote/doc/filegraph.asy
index c56dd0234f3..4b05c5bcbd7 100644
--- a/Build/source/utils/asymptote/doc/filegraph.asy
+++ b/Build/source/utils/asymptote/doc/filegraph.asy
@@ -2,8 +2,8 @@ import graph;
size(200,150,IgnoreAspect);
-file in=line(input("filegraph.dat"));
-real[][] a=dimension(in,0,0);
+file in=input("filegraph.dat").line();
+real[][] a=in.dimension(0,0);
a=transpose(a);
real[] x=a[0];
diff --git a/Build/source/utils/asymptote/doc/leastsquares.asy b/Build/source/utils/asymptote/doc/leastsquares.asy
index c2f3e027aae..cb2b8f3a42b 100644
--- a/Build/source/utils/asymptote/doc/leastsquares.asy
+++ b/Build/source/utils/asymptote/doc/leastsquares.asy
@@ -3,9 +3,9 @@ size(400,200,IgnoreAspect);
import graph;
import stats;
-file fin=line(input("leastsquares.dat"));
+file fin=input("leastsquares.dat").line();
-real[][] a=dimension(fin,0,0);
+real[][] a=fin.dimension(0,0);
a=transpose(a);
real[] t=a[0], rho=a[1];
diff --git a/Build/source/utils/asymptote/doc/options b/Build/source/utils/asymptote/doc/options
index 5616b5f3adf..6dc619a0686 100644
--- a/Build/source/utils/asymptote/doc/options
+++ b/Build/source/utils/asymptote/doc/options
@@ -9,6 +9,7 @@ Options (negate by replacing - with -no):
-auto3D Automatically activate 3D scene [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]
-batchMask Mask fpu exceptions in batch mode [false]
-batchView View output in batch mode [false]
@@ -38,6 +39,7 @@ Options (negate by replacing - with -no):
-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 [(0,0)]
-maxviewport pair Maximum viewport size [(2048,2048)]
diff --git a/Build/source/utils/asymptote/doc/png/Makefile.in b/Build/source/utils/asymptote/doc/png/Makefile.in
index 864db45c736..1d96e88a2b5 100644
--- a/Build/source/utils/asymptote/doc/png/Makefile.in
+++ b/Build/source/utils/asymptote/doc/png/Makefile.in
@@ -22,7 +22,7 @@ index.html: $(SOURCE) $(ASYFILES:.asy=.png)
asymptote.info: $(SOURCE)
makeinfo --no-warn --no-split ../asymptote
-info: $(SOURCE)
+info: $(SOURCE) $(ASYFILES:.asy=.png)
makeinfo --no-split ../asymptote
html: index.html
diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info
index 91b3a89f369..671fc33dba2 100644
--- a/Build/source/utils/asymptote/doc/png/asymptote.info
+++ b/Build/source/utils/asymptote/doc/png/asymptote.info
@@ -1,7 +1,7 @@
This is asymptote.info, produced by makeinfo version 4.13 from
../asymptote.texi.
-This file documents `Asymptote', version 1.82.
+This file documents `Asymptote', version 1.83.
`http://asymptote.sourceforge.net'
@@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir)
Asymptote
*********
-This file documents `Asymptote', version 1.82.
+This file documents `Asymptote', version 1.83.
`http://asymptote.sourceforge.net'
@@ -336,7 +336,7 @@ also need to install `GPL Ghostscript' from
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
+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";
@@ -376,14 +376,12 @@ interactive mode to work properly. Users of `ggv' will need to enable
`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
+(and free) multiplatform alternative to `gsview' is `psview' (*note
psview::).
Configuration variables are most easily set as `Asymptote' variables
-in an optional configuration file (by default, `.asy/config.asy' in the
-user's home directory, `$TEXMFCONFIG/asymptote' under `TeXLive', and
-`%USERPROFILE%\.asy\config.asy' under `MSDOS'; *note configuration
-file::). Here are the default values of several important configuration
+in an optional configuration file `config.asy' *note configuration
+file::). Here are the default values of several important configuration
variables under `UNIX':
@@ -437,7 +435,8 @@ animate
the functions
warn(string s);
nowarn(string s);
- or by directly modifying the string array `warnings'.
+ 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:
@@ -473,8 +472,10 @@ following paths, in the order listed:
2. A list of one or more directories specified by the configuration
variable `dir' (separated by `:' under UNIX and `;' under `MSDOS');
- 3. The directory `.asy' in the user's home directory
- (`%USERPROFILE%\.asy' 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
@@ -953,12 +954,12 @@ 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 relative real `position' along the path (an `arctime') 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'.
+`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
@@ -1213,11 +1214,11 @@ Label should transform with the embedding picture:
void label(picture pic=currentpicture, Label L, path g, align align=NoAlign,
pen p=nullpen, filltype filltype=NoFill);
By default the label will be positioned at the midpoint of the path.
-An alternative label location (an `arctime' value between 0 and
-`length(g)' *note arctime::) may be specified as 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:
+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);
@@ -1740,8 +1741,7 @@ File: asymptote.info, Node: Paths and guides, Next: Pens, Prev: Data types,
path Arc(pair c, explicit pair z1, explicit pair z2,
bool direction=CCW, int n=nCircle);
- An ellipse can be drawn with the routine @cindex @code{ellipse}
- path ellipse(pair c, real a, real b)
+ An ellipse can be drawn with the routine path ellipse(pair c, real a, real b)
{
return shift(c)*scale(a,b)*unitcircle;
}
@@ -2215,8 +2215,9 @@ number, until it saturates with one or more color components equal to 1.
The default line type is `solid'; this may be changed with
- `defaultpen(pen)'. The line type of a pen is returned by `int
- linetype(pen p=currentpen)'.
+ `defaultpen(pen)'. The line type of a pen can be determined with
+ the functions `string 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
@@ -2601,7 +2602,7 @@ File: asymptote.info, Node: Frames and pictures, Next: Files, Prev: Transform
orientation orientation=orientation,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection);
+ 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
@@ -2680,8 +2681,8 @@ File: asymptote.info, Node: Frames and pictures, Next: Files, Prev: Transform
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 of
- pen `p' with the function `bbox(p,Fill)'.
+ 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);
@@ -2884,16 +2885,15 @@ and single precision (32-bit) integers in Sun Microsystem's XDR
`UNIX' platforms). Alternatively, a file may also be opened with
`binput' or `boutput' to read or write double precision reals and single
precision integers in the native (nonportable) machine binary format.
-The function `file single(file f, bool real=true, bool int=true)' may
-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 signed(file f, bool b=true)' can be used to modify the signedness
-of integer reads and writes for an XDR or binary file `f'. Note that
-`single', and `signed' modify and return their file arguments (to
-facilitate nested function calls).
+The virtual member functions `file singlereal(bool b=false)' 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
-`signed' may be used to query the respective parameters for a given
+`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
@@ -3830,9 +3830,7 @@ The `copy' function listed below provides a deep copy of an array.
Every array `A' of type `T[]' has the virtual members
* `int length',
- * `void cyclic(bool b)',
-
- * `bool cyclicflag',
+ * `int cyclic',
* `int[] keys',
@@ -3851,10 +3849,9 @@ The `copy' function listed below provides a deep copy of an array.
* `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
+`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.cyclicflag' returns the current setting of the `cyclic' flag.
+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,
@@ -3871,9 +3868,9 @@ 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, `cyclic', `push', `append', `pop',
-`insert', `delete', and `initialized' can be "pulled off" of the array
-and used on their own. For example,
+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}.
@@ -4135,28 +4132,29 @@ 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). If line mode is set with `line(file)', then reading will
-stop once the end of the line is reached instead (line mode may be
-cleared with `line(file,false)'):
+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=line(fin);
+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, set with
-`word(file)' and cleared with `word(file,false)', which causes string
-reads to respect white-space delimiters, instead of the default
-end-of-line delimiter:
-file fin=word(line(input("test.txt")));
+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, set with
-`csv(file)' and cleared with `csv(file,false)', which causes reads to
-respect comma delimiters:
+ 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 `dimension(file,int)'
+ To restrict the number of values read, use the `file dimension(int)'
function:
file fin=input("test.txt");
real[] A=dimension(fin,10);
@@ -4170,27 +4168,23 @@ 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=dimension(fin,2,3);
-real[][][] B=dimension(fin,2,3,4);
+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 arrays can be read in with the
-functions `read1', `read2', and `read3', respectively:
+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=read1(fin);
-real[][] B=read2(fin);
-real[][][] C=read3(fin);
+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.
- Note that `dimension', `line', `csv', `word', `single', and `signed'
-modify and return their file arguments (to facilitate nested function
-calls). The virtual members `dimension', `line', `csv', and `word' may
-be used to query the respective parameters for a given file.
-

File: asymptote.info, Node: Slices, Up: Arrays
@@ -4226,7 +4220,7 @@ 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);
+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}
@@ -4628,7 +4622,7 @@ remove the files `latexusage-*', `latexusage_.pre', and
One can specify `width', `height', `viewportwidth',
`viewportheight', and `attach' `keyval'-style options to the `asy'
-environment. The current version (1.07) of `asymptote.sty' supports the
+environment. The current version (1.09) of `asymptote.sty' supports the
embedding of 3D PRC files, either inline or, using the `attach' option
with the `attachfile2' (or older `attachfile') `LaTeX' package, as
annotated (but printable) attachments. For many applications, the
@@ -4853,7 +4847,7 @@ File: asymptote.info, Node: math, Next: interpolate, Prev: simplex, Up: Base
==========
This package extends `Asymptote''s mathematical capabilities with
-intersection algorithms and matrix arithmetic:
+matrix arithmetic and intersection algorithms:
`void drawline(picture pic=currentpicture, pair P, pair Q, pen p=currentpen);'
draw the visible portion of the (infinite) line going through `P'
@@ -5058,8 +5052,8 @@ File: asymptote.info, Node: animation, Next: embed, Prev: roundedpath, Up: B
This module allows one to generate animations, as illustrated by the
files `wheel.asy', `wavelet.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.
+`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
@@ -5282,7 +5276,7 @@ following routines:
* `default', the point is added to a new guide;
* `false', the point is omitted and a new guide is begun.
- Th points are connected using the interpolation specified by
+ The points are connected using the interpolation specified by
`join':
* `operator --' (linear interpolation; the abbreviation
`Straight' is also accepted);
@@ -5713,8 +5707,8 @@ following routines:
size(200,150,IgnoreAspect);
- file in=line(input("filegraph.dat"));
- real[][] a=dimension(in,0,0);
+ file in=input("filegraph.dat").line();
+ real[][] a=in.dimension(0,0);
a=transpose(a);
real[] x=a[0];
@@ -6094,12 +6088,12 @@ following routines:
size(9cm,6cm,IgnoreAspect);
string data="secondaryaxis.csv";
- file in=line(csv(input(data)));
+ file in=input(data).line().csv();
string[] titlelabel=in;
string[] columnlabel=in;
- real[][] a=dimension(in,0,0);
+ 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];
@@ -6150,9 +6144,9 @@ following routines:
import graph;
import stats;
- file fin=line(input("leastsquares.dat"));
+ file fin=input("leastsquares.dat").line();
- real[][] a=dimension(fin,0,0);
+ real[][] a=fin.dimension(0,0);
a=transpose(a);
real[] t=a[0], rho=a[1];
@@ -6556,18 +6550,18 @@ length `4' or less.
Arbitrary thick three-dimensional curves and line caps (which the
`OpenGL' standard does not require implementations to provide) are
constructed with
-tube tube(path3 g, real width, real granularity=tubegranularity);
+tube tube(path3 p, real width, real granularity=tubegranularity);
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'. This can make files
-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.
+`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
@@ -7144,6 +7138,9 @@ surface surface(real f(pair z), pair a, pair b, int nx=nmesh, int ny=nx,
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,
@@ -7689,6 +7686,7 @@ Options (negate by replacing - with -no):
-auto3D Automatically activate 3D scene [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]
-batchMask Mask fpu exceptions in batch mode [false]
-batchView View output in batch mode [false]
@@ -7718,6 +7716,7 @@ Options (negate by replacing - with -no):
-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 [(0,0)]
-maxviewport pair Maximum viewport size [(2048,2048)]
@@ -7779,11 +7778,11 @@ automatically imported for each run as the final step in loading module
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.
-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:
+`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;
@@ -8221,9 +8220,9 @@ Index
* ---: Tutorial. (line 192)
* -=: Self & prefix operators.
(line 6)
-* -c: Options. (line 161)
-* -l: Options. (line 180)
-* -u: Options. (line 171)
+* -c: Options. (line 163)
+* -l: Options. (line 182)
+* -u: Options. (line 173)
* -V <1>: Tutorial. (line 41)
* -V: Configuring. (line 6)
* ..: Tutorial. (line 109)
@@ -8235,6 +8234,7 @@ Index
* 2D graphs: graph. (line 6)
* 3D graphs: graph3. (line 6)
* 3D grids: grid3. (line 6)
+* 3D PostScript: three. (line 525)
* 3D rendering: Compiling from UNIX source.
(line 16)
* :: Arithmetic & logical.
@@ -8258,13 +8258,13 @@ Index
* ^=: Self & prefix operators.
(line 6)
* ^^: Tutorial. (line 197)
-* a4: Configuring. (line 63)
+* a4: Configuring. (line 61)
* abort: Data types. (line 321)
* abs <1>: Mathematical functions.
(line 35)
* abs: Data types. (line 60)
* accel <1>: three. (line 455)
-* accel: Paths and guides. (line 110)
+* accel: Paths and guides. (line 109)
* access: Import. (line 6)
* acknowledgments: Credits. (line 6)
* aCos: Mathematical functions.
@@ -8274,28 +8274,29 @@ Index
* acosh: Mathematical functions.
(line 6)
* add: Frames and pictures. (line 192)
+* adjust: Pens. (line 112)
* Ai: Mathematical functions.
(line 48)
* Ai_deriv: Mathematical functions.
(line 48)
* Airy: Mathematical functions.
(line 48)
-* alias <1>: Arrays. (line 187)
+* alias <1>: Arrays. (line 184)
* alias: Structures. (line 54)
-* align: Options. (line 155)
+* align: Options. (line 157)
* Align: label. (line 12)
-* all: Arrays. (line 331)
-* Allow: Pens. (line 323)
+* all: Arrays. (line 328)
+* Allow: Pens. (line 324)
* AND: Arithmetic & logical.
(line 80)
* and: Tutorial. (line 165)
* angle: Data types. (line 68)
* animate <1>: animation. (line 12)
-* animate <2>: Files. (line 152)
-* animate: Configuring. (line 69)
+* animate <2>: Files. (line 151)
+* animate: Configuring. (line 67)
* animation: animation. (line 6)
* annotate: annotate. (line 6)
-* antialias <1>: Options. (line 134)
+* antialias <1>: Options. (line 136)
* antialias: three. (line 198)
* antialiasing: Compiling from UNIX source.
(line 16)
@@ -8309,13 +8310,13 @@ Index
* ArcArrows: draw. (line 26)
* ArcArrows3: three. (line 498)
* arclength <1>: three. (line 455)
-* arclength: Paths and guides. (line 137)
+* arclength: Paths and guides. (line 136)
* arctime <1>: three. (line 455)
-* arctime: Paths and guides. (line 141)
+* arctime: Paths and guides. (line 140)
* arguments: Default arguments. (line 6)
* arithmetic operators: Arithmetic & logical.
(line 6)
-* array: Arrays. (line 125)
+* array: Arrays. (line 122)
* array iteration: Programming. (line 33)
* arrays: Arrays. (line 6)
* arrow: label. (line 72)
@@ -8324,6 +8325,7 @@ Index
* arrow keys: Tutorial. (line 21)
* Arrow3: three. (line 498)
* Arrows: draw. (line 26)
+* arrows: draw. (line 26)
* Arrows3: three. (line 498)
* as: Import. (line 70)
* aSin: Mathematical functions.
@@ -8339,7 +8341,7 @@ Index
* asy.vim: Editing modes. (line 33)
* asymptote.sty: LaTeX usage. (line 6)
* asymptote.xml: Editing modes. (line 49)
-* ASYMPTOTE_CONFIG: Options. (line 107)
+* ASYMPTOTE_CONFIG: Options. (line 109)
* aTan: Mathematical functions.
(line 20)
* atan: Mathematical functions.
@@ -8352,7 +8354,7 @@ Index
* attach <1>: graph. (line 405)
* attach: LaTeX usage. (line 32)
* autoadjust: three. (line 335)
-* autoimport: Options. (line 103)
+* autoimport: Options. (line 105)
* automatic scaling: graph. (line 672)
* axialshade: fill. (line 43)
* axis <1>: graph3. (line 66)
@@ -8367,7 +8369,7 @@ Index
* Bars3: three. (line 498)
* barsize: draw. (line 19)
* base modules: Base modules. (line 6)
-* basealign: Pens. (line 164)
+* basealign: Pens. (line 165)
* baseline: label. (line 92)
* batch mode: Tutorial. (line 30)
* beep: Data types. (line 335)
@@ -8388,7 +8390,8 @@ Index
* Bessel: Mathematical functions.
(line 48)
* bevel: flowchart. (line 68)
-* beveljoin: Pens. (line 134)
+* beveljoin: Pens. (line 135)
+* Bezier: Tutorial. (line 115)
* bezulate: three. (line 98)
* Bi: Mathematical functions.
(line 48)
@@ -8426,10 +8429,10 @@ Index
* bp: Tutorial. (line 17)
* break: Programming. (line 29)
* breakpoints: Debugger. (line 21)
-* brick: Pens. (line 247)
+* brick: Pens. (line 248)
* broken axis: graph. (line 773)
* bug reports: Help. (line 23)
-* buildcycle: Paths and guides. (line 251)
+* buildcycle: Paths and guides. (line 250)
* Button-1: GUI. (line 6)
* Button-2: GUI. (line 6)
* BWRainbow: palette. (line 15)
@@ -8445,7 +8448,7 @@ Index
(line 26)
* center: three. (line 319)
* Center: label. (line 62)
-* checker: Pens. (line 247)
+* checker: Pens. (line 248)
* Chinese: unicode. (line 12)
* choose: Mathematical functions.
(line 39)
@@ -8458,10 +8461,10 @@ Index
* circlebarframe: markers. (line 18)
* CJK: unicode. (line 12)
* clear <1>: Debugger. (line 23)
-* clear: Files. (line 90)
+* clear: Files. (line 89)
* clip: fill. (line 110)
* cm: Tutorial. (line 63)
-* cmd: Configuring. (line 36)
+* cmd: Configuring. (line 34)
* cmyk: Pens. (line 34)
* colatitude: Data types. (line 129)
* color: Pens. (line 23)
@@ -8471,38 +8474,39 @@ Index
* colorless: Pens. (line 54)
* colors: Pens. (line 51)
* comma: Files. (line 59)
-* comma-separated-value mode: Arrays. (line 362)
+* comma-separated-value mode: Arrays. (line 361)
* command-line options <1>: Options. (line 6)
-* command-line options: Configuring. (line 83)
+* command-line options: Configuring. (line 82)
* comment character: Files. (line 15)
* compass directions: Tutorial. (line 94)
* Compiling from UNIX source: Compiling from UNIX source.
(line 6)
-* complement: Arrays. (line 153)
-* concat: Arrays. (line 183)
+* complement: Arrays. (line 150)
+* concat: Arrays. (line 180)
* conditional <1>: Arithmetic & logical.
(line 73)
* conditional: Programming. (line 8)
-* config: Options. (line 107)
+* config: Options. (line 109)
+* configuration file <1>: Options. (line 109)
* configuration file: Configuring. (line 23)
* configuring: Configuring. (line 6)
* conj: Data types. (line 57)
* constructors: Structures. (line 95)
-* context: Options. (line 134)
+* context: Options. (line 136)
* continue <1>: Debugger. (line 31)
* continue: Programming. (line 29)
* contour: contour. (line 9)
* contour3: contour3. (line 6)
* controls <1>: three. (line 6)
* controls: Tutorial. (line 154)
-* controlSpecifier: Paths and guides. (line 375)
-* convert <1>: Options. (line 134)
+* controlSpecifier: Paths and guides. (line 374)
+* convert <1>: Options. (line 136)
* convert <2>: animation. (line 6)
-* convert <3>: Files. (line 152)
-* convert: Configuring. (line 69)
-* convertOptions: Options. (line 122)
+* convert <3>: Files. (line 151)
+* convert: Configuring. (line 67)
+* convertOptions: Options. (line 124)
* Coons shading: fill. (line 74)
-* copy: Arrays. (line 174)
+* copy: Arrays. (line 171)
* Cos: Mathematical functions.
(line 20)
* cos: Mathematical functions.
@@ -8515,25 +8519,24 @@ Index
* cross <1>: graph. (line 474)
* cross: Data types. (line 167)
* crossframe: markers. (line 23)
-* crosshatch: Pens. (line 263)
-* csv: Arrays. (line 362)
-* cubicroots: Arrays. (line 320)
+* crosshatch: Pens. (line 264)
+* csv: Arrays. (line 361)
+* cubicroots: Arrays. (line 317)
* curl <1>: three. (line 6)
* curl: Tutorial. (line 172)
-* curlSpecifier: Paths and guides. (line 387)
+* curlSpecifier: Paths and guides. (line 386)
* currentpen: Pens. (line 6)
* currentprojection: three. (line 359)
* curve: slopefield. (line 20)
* custom axis types: graph. (line 138)
* custom mark routine: graph. (line 566)
* custom tick locations: graph. (line 241)
-* cut: Paths and guides. (line 233)
+* cut: Paths and guides. (line 232)
* cycle <1>: three. (line 6)
* cycle: Tutorial. (line 46)
* cyclic <1>: three. (line 455)
* cyclic <2>: Arrays. (line 39)
-* cyclic: Paths and guides. (line 75)
-* cyclicflag: Arrays. (line 39)
+* cyclic: Paths and guides. (line 74)
* Cyrillic: unicode. (line 7)
* dashdotted: Pens. (line 92)
* dashed: Pens. (line 92)
@@ -8556,20 +8559,20 @@ Index
(line 17)
* degrees: Data types. (line 73)
* delete <1>: Arrays. (line 39)
-* delete: Files. (line 147)
+* delete: Files. (line 146)
* description: Description. (line 6)
-* diagonal: Arrays. (line 305)
+* diagonal: Arrays. (line 302)
* diamond: flowchart. (line 50)
-* dimension: Arrays. (line 368)
+* dimension: Arrays. (line 366)
* dir <1>: three. (line 455)
-* dir <2>: Paths and guides. (line 99)
+* dir <2>: Paths and guides. (line 98)
* dir <3>: Data types. (line 85)
* dir: Search paths. (line 10)
* direction specifier: Tutorial. (line 115)
* directory: Files. (line 24)
-* dirSpecifier: Paths and guides. (line 369)
-* dirtime: Paths and guides. (line 147)
-* display: Configuring. (line 69)
+* dirSpecifier: Paths and guides. (line 368)
+* dirtime: Paths and guides. (line 146)
+* display: Configuring. (line 67)
* do: Programming. (line 29)
* dot <1>: Data types. (line 98)
* dot: draw. (line 83)
@@ -8587,15 +8590,16 @@ Index
* drawing commands: Drawing commands. (line 6)
* drawline: math. (line 9)
* drawtree: drawtree. (line 9)
-* dvips: Configuring. (line 69)
-* dvipsOptions: Options. (line 122)
+* dvips: Configuring. (line 67)
+* dvipsOptions: Options. (line 124)
* E <1>: Mathematical functions.
(line 48)
* E: Tutorial. (line 94)
* Editing modes: Editing modes. (line 6)
* Ei: Mathematical functions.
(line 48)
-* ellipse: Frames and pictures. (line 22)
+* ellipse <1>: Frames and pictures. (line 22)
+* ellipse: Paths and guides. (line 39)
* elliptic functions: Mathematical functions.
(line 48)
* else: Programming. (line 8)
@@ -8618,11 +8622,11 @@ Index
* EndPenMargin3: three. (line 514)
* EndPoint: label. (line 57)
* envelope: Frames and pictures. (line 22)
-* environment variables: Configuring. (line 87)
-* eof <1>: Arrays. (line 346)
-* eof: Files. (line 90)
-* eol <1>: Arrays. (line 346)
-* eol: Files. (line 90)
+* environment variables: Configuring. (line 86)
+* eof <1>: Arrays. (line 343)
+* eof: Files. (line 89)
+* eol <1>: Arrays. (line 343)
+* eol: Files. (line 89)
* EPS: label. (line 80)
* erase <1>: Frames and pictures. (line 7)
* erase: Data types. (line 239)
@@ -8631,9 +8635,10 @@ Index
* erfc: Mathematical functions.
(line 6)
* error: Files. (line 15)
+* error bars: graph. (line 522)
* errorbars: graph. (line 474)
* eval: Import. (line 101)
-* evenodd <1>: Pens. (line 148)
+* evenodd <1>: Pens. (line 149)
* evenodd: Tutorial. (line 211)
* exit <1>: Debugger. (line 57)
* exit <2>: Interactive mode. (line 37)
@@ -8647,9 +8652,9 @@ Index
(line 6)
* exponential integral: Mathematical functions.
(line 48)
-* extendcap: Pens. (line 125)
+* extendcap: Pens. (line 126)
* extension <1>: MetaPost. (line 10)
-* extension: Paths and guides. (line 228)
+* extension: Paths and guides. (line 227)
* external: embed. (line 28)
* extrude: three. (line 449)
* F: Mathematical functions.
@@ -8662,7 +8667,7 @@ Index
* Fedora: UNIX binary distributions.
(line 15)
* feynman: feynman. (line 6)
-* fft: Arrays. (line 252)
+* fft: Arrays. (line 249)
* FFTW: Compiling from UNIX source.
(line 58)
* file <1>: Debugger. (line 45)
@@ -8675,12 +8680,12 @@ Index
* filldraw: fill. (line 11)
* FillDraw: draw. (line 26)
* filloutside: fill. (line 27)
-* fillrule: Pens. (line 148)
-* find <1>: Arrays. (line 162)
+* fillrule: Pens. (line 149)
+* find <1>: Arrays. (line 159)
* find: Data types. (line 224)
-* firstcut: Paths and guides. (line 243)
+* firstcut: Paths and guides. (line 242)
* fit: Frames and pictures. (line 103)
-* fix-cm: Pens. (line 174)
+* fix-cm: Pens. (line 175)
* fixedscaling: Frames and pictures. (line 74)
* floor: Mathematical functions.
(line 26)
@@ -8688,12 +8693,12 @@ Index
* flush: Files. (line 59)
* fmod: Mathematical functions.
(line 6)
-* font: Pens. (line 188)
-* font command: Pens. (line 188)
-* fontcommand: Pens. (line 203)
-* fontsize: Pens. (line 174)
+* font: Pens. (line 189)
+* font command: Pens. (line 189)
+* fontcommand: Pens. (line 204)
+* fontsize: Pens. (line 175)
* for: Programming. (line 8)
-* format <1>: Options. (line 134)
+* format <1>: Options. (line 136)
* format: Data types. (line 266)
* forum: Help. (line 6)
* frame: Frames and pictures. (line 7)
@@ -8714,11 +8719,11 @@ Index
(line 39)
* geometry: geometry. (line 6)
* getc: Files. (line 30)
-* getpair: Files. (line 115)
-* getreal: Files. (line 115)
-* getstring: Files. (line 115)
-* gettriple: Files. (line 115)
-* glOptions <1>: Options. (line 122)
+* getpair: Files. (line 114)
+* getreal: Files. (line 114)
+* getstring: Files. (line 114)
+* gettriple: Files. (line 114)
+* glOptions <1>: Options. (line 124)
* glOptions: three. (line 198)
* GNU Scientific Library: Mathematical functions.
(line 48)
@@ -8733,20 +8738,20 @@ Index
* Grayscale: palette. (line 9)
* grayscale: Pens. (line 25)
* grid <1>: graph. (line 724)
-* grid: Pens. (line 247)
+* grid: Pens. (line 248)
* grid3: grid3. (line 6)
* gs: Configuring. (line 6)
* gsl: Mathematical functions.
(line 48)
* GSL: Compiling from UNIX source.
(line 58)
-* gsOptions: Options. (line 122)
+* gsOptions: Options. (line 124)
* GUI: GUI. (line 6)
* GUI installation: GUI Installation. (line 6)
* GUI usage: GUI Usage. (line 6)
-* guide: Paths and guides. (line 296)
+* guide: Paths and guides. (line 295)
* guide3: three. (line 6)
-* hatch: Pens. (line 263)
+* hatch: Pens. (line 264)
* height: LaTeX usage. (line 32)
* help <1>: Debugger. (line 30)
* help <2>: Help. (line 6)
@@ -8759,7 +8764,8 @@ Index
* hidden surface removal: three. (line 533)
* histogram: Mathematical functions.
(line 39)
-* history: Files. (line 140)
+* history <1>: Interactive mode. (line 37)
+* history: Files. (line 139)
* historylines: Interactive mode. (line 42)
* HookHead: draw. (line 26)
* HookHead3: three. (line 498)
@@ -8771,16 +8777,17 @@ Index
* i_scaled: Mathematical functions.
(line 48)
* iconic: three. (line 198)
-* identity <1>: Arrays. (line 302)
+* identity <1>: Arrays. (line 299)
* identity <2>: Mathematical functions.
(line 6)
* identity: Transforms. (line 24)
* if: Programming. (line 8)
* IgnoreAspect: Frames and pictures. (line 58)
* image: palette. (line 34)
-* ImageMagick <1>: Options. (line 134)
+* ImageMagick <1>: Options. (line 136)
* ImageMagick <2>: animation. (line 6)
-* ImageMagick: Configuring. (line 69)
+* 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)
@@ -8796,32 +8803,32 @@ Index
* input: Files. (line 11)
* insert <1>: Arrays. (line 39)
* insert: Data types. (line 235)
-* inside: Paths and guides. (line 275)
+* inside: Paths and guides. (line 274)
* 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 271)
+* interior: Paths and guides. (line 270)
* international characters: unicode. (line 6)
* interp: Arithmetic & logical.
(line 76)
* interpolate: interpolate. (line 6)
* intersect <1>: three. (line 455)
* intersect <2>: math. (line 13)
-* intersect: Paths and guides. (line 176)
+* intersect: Paths and guides. (line 175)
* intersectionpoint <1>: three. (line 455)
* intersectionpoint <2>: math. (line 17)
-* intersectionpoint: Paths and guides. (line 220)
+* intersectionpoint: Paths and guides. (line 219)
* intersectionpoints <1>: three. (line 455)
-* intersectionpoints: Paths and guides. (line 224)
+* intersectionpoints: Paths and guides. (line 223)
* intersections <1>: three. (line 455)
-* intersections: Paths and guides. (line 187)
+* intersections: Paths and guides. (line 186)
* InTicks: graph3. (line 34)
* intMax: Data types. (line 28)
* intMin: Data types. (line 28)
-* inverse <1>: Arrays. (line 308)
+* inverse <1>: Arrays. (line 305)
* inverse: Transforms. (line 16)
* invert: three. (line 388)
* invisible: Pens. (line 39)
@@ -8838,7 +8845,8 @@ Index
* keys: Arrays. (line 39)
* keywords: Named arguments. (line 6)
* Korean: unicode. (line 12)
-* Label: graph. (line 332)
+* Label <1>: graph. (line 332)
+* Label: label. (line 15)
* label: clip. (line 16)
* Label: draw. (line 98)
* labelpath: labelpath. (line 6)
@@ -8846,10 +8854,10 @@ Index
* labelx: graph. (line 332)
* labely: graph. (line 332)
* Landscape: Frames and pictures. (line 95)
-* lastcut: Paths and guides. (line 247)
+* lastcut: Paths and guides. (line 246)
* lasy-mode: Editing modes. (line 6)
-* latex: Options. (line 134)
-* LaTeX fonts: Pens. (line 188)
+* latex: Options. (line 136)
+* LaTeX fonts: Pens. (line 189)
* LaTeX usage: LaTeX usage. (line 6)
* latin1: latin1. (line 6)
* latitude: Data types. (line 134)
@@ -8869,21 +8877,22 @@ Index
(line 48)
* length <1>: three. (line 455)
* length <2>: Arrays. (line 39)
-* length <3>: Paths and guides. (line 66)
+* length <3>: Paths and guides. (line 65)
* length: Data types. (line 60)
-* letter: Configuring. (line 63)
+* letter: Configuring. (line 61)
* libm routines: Mathematical functions.
(line 6)
* libsigsegv <1>: Help. (line 33)
* libsigsegv: Functions. (line 88)
* limits: graph. (line 626)
-* line: Arrays. (line 346)
-* line mode: Arrays. (line 346)
+* line: Arrays. (line 343)
+* line mode: Arrays. (line 343)
* Linear: graph. (line 672)
-* linecap: Pens. (line 125)
-* linejoin: Pens. (line 134)
-* lineskip: Pens. (line 174)
-* linewidth: Pens. (line 115)
+* linecap: Pens. (line 126)
+* linejoin: Pens. (line 135)
+* lineskip: Pens. (line 175)
+* linetype: Pens. (line 112)
+* linewidth: Pens. (line 116)
* locale: Data types. (line 286)
* Log: graph. (line 672)
* log: Mathematical functions.
@@ -8903,8 +8912,8 @@ Index
* loop: Programming. (line 8)
* MacOS X binary distributions: MacOS X binary distributions.
(line 6)
-* makepen: Pens. (line 296)
-* map: Arrays. (line 144)
+* makepen: Pens. (line 297)
+* map: Arrays. (line 141)
* Margin: draw. (line 42)
* Margin3: three. (line 514)
* margins: three. (line 247)
@@ -8920,18 +8929,17 @@ Index
* mathematical functions: Mathematical functions.
(line 6)
* max <1>: three. (line 455)
-* max <2>: Arrays. (line 231)
+* max <2>: Arrays. (line 228)
* max <3>: Frames and pictures. (line 7)
-* max: Paths and guides. (line 260)
+* max: Paths and guides. (line 259)
* maxbound: Data types. (line 104)
* maxtile: three. (line 198)
-* maxtimes: Paths and guides. (line 215)
+* maxtimes: Paths and guides. (line 214)
* maxviewport: three. (line 198)
-* merge: animation. (line 6)
* MetaPost: MetaPost. (line 6)
* MetaPost ... : Tutorial. (line 176)
-* MetaPost cutafter: Paths and guides. (line 248)
-* MetaPost cutbefore: Paths and guides. (line 244)
+* MetaPost cutafter: Paths and guides. (line 247)
+* MetaPost cutbefore: Paths and guides. (line 243)
* MetaPost pickup: Pens. (line 6)
* MetaPost whatever: MetaPost. (line 10)
* Microsoft Windows: Microsoft Windows. (line 6)
@@ -8939,38 +8947,38 @@ Index
* MidArcArrow3: three. (line 498)
* MidArrow: draw. (line 26)
* MidArrow3: three. (line 498)
-* midpoint: Paths and guides. (line 161)
+* midpoint: Paths and guides. (line 160)
* MidPoint: label. (line 57)
* min <1>: three. (line 455)
-* min <2>: Arrays. (line 224)
+* min <2>: Arrays. (line 221)
* min <3>: Frames and pictures. (line 7)
-* min: Paths and guides. (line 256)
+* min: Paths and guides. (line 255)
* minbound: Data types. (line 101)
* minipage: label. (line 119)
-* mintimes: Paths and guides. (line 210)
-* miterjoin: Pens. (line 134)
-* miterlimit: Pens. (line 143)
+* mintimes: Paths and guides. (line 209)
+* miterjoin: Pens. (line 135)
+* miterlimit: Pens. (line 144)
* mm: Tutorial. (line 63)
-* mode: Files. (line 86)
+* mode: Files. (line 85)
* mouse: GUI. (line 6)
* mouse bindings: three. (line 131)
-* Move: Pens. (line 335)
-* MoveQuiet: Pens. (line 341)
+* Move: Pens. (line 336)
+* MoveQuiet: Pens. (line 342)
* multisample: three. (line 121)
* multisampling: Compiling from UNIX source.
(line 16)
* N: Tutorial. (line 94)
-* name: Files. (line 86)
+* name: Files. (line 85)
* named arguments: Named arguments. (line 6)
-* new <1>: Arrays. (line 112)
+* new <1>: Arrays. (line 109)
* new: Structures. (line 6)
* newframe: Frames and pictures. (line 7)
* newl: Files. (line 59)
* newton: Mathematical functions.
(line 65)
* next: Debugger. (line 42)
-* NFSS: Pens. (line 188)
-* nobasealign: Pens. (line 164)
+* NFSS: Pens. (line 189)
+* nobasealign: Pens. (line 165)
* NoFill <1>: Frames and pictures. (line 141)
* NoFill: draw. (line 26)
* NoMargin: draw. (line 42)
@@ -8978,7 +8986,7 @@ Index
* none: Files. (line 59)
* None: draw. (line 19)
* normal: three. (line 441)
-* nosafe: Options. (line 150)
+* nosafe: Options. (line 152)
* NOT: Arithmetic & logical.
(line 80)
* NoTicks: graph. (line 155)
@@ -8994,8 +9002,9 @@ Index
* obliqueY: three. (line 315)
* obliqueZ: three. (line 300)
* ode: ode. (line 9)
-* offset: Options. (line 155)
-* opacity: Pens. (line 218)
+* offset <1>: Options. (line 157)
+* offset: Pens. (line 112)
+* opacity: Pens. (line 219)
* open: Files. (line 11)
* OpenGL: three. (line 121)
* operator: User-defined operators.
@@ -9015,34 +9024,35 @@ Index
* orthographic: three. (line 319)
* outformat: three. (line 121)
* outprefix: Frames and pictures. (line 83)
-* output <1>: Options. (line 134)
+* output <1>: Options. (line 136)
* output: Files. (line 36)
* OutTicks: graph3. (line 34)
* overloading functions: Functions. (line 44)
-* overwrite: Pens. (line 320)
+* overwrite: Pens. (line 321)
* P: Mathematical functions.
(line 48)
* pack: label. (line 102)
* packing: Rest arguments. (line 30)
* pair <1>: Data types. (line 41)
* pair: Tutorial. (line 17)
-* pairs: Arrays. (line 248)
-* paperheight: Configuring. (line 63)
-* papertype: Configuring. (line 63)
-* paperwidth: Configuring. (line 63)
+* pairs: Arrays. (line 245)
+* paperheight: Configuring. (line 61)
+* papertype: Configuring. (line 61)
+* paperwidth: Configuring. (line 61)
* parametric surface: graph3. (line 100)
* parametrized curve: graph. (line 626)
* patch-dependent colors: three. (line 75)
* path <1>: flowchart. (line 74)
* path <2>: three. (line 43)
* path: Paths and guides. (line 7)
+* path markers: graph. (line 474)
* path3: three. (line 6)
* path[]: Tutorial. (line 197)
* patterns <1>: patterns. (line 6)
-* patterns: Pens. (line 234)
-* pdflatex: Options. (line 134)
+* patterns: Pens. (line 235)
+* pdflatex: Options. (line 136)
* pdfviewer: Configuring. (line 6)
-* pdfviewerOptions: Options. (line 122)
+* pdfviewerOptions: Options. (line 124)
* pen: Pens. (line 6)
* PenMargin: draw. (line 42)
* PenMargin2: three. (line 514)
@@ -9054,7 +9064,7 @@ Index
* perspective: three. (line 339)
* picture: Frames and pictures. (line 35)
* picture alignment: Frames and pictures. (line 205)
-* piecewisestraight: Paths and guides. (line 82)
+* piecewisestraight: Paths and guides. (line 81)
* Pl: Mathematical functions.
(line 48)
* plain: plain. (line 6)
@@ -9062,38 +9072,39 @@ Index
* plane: three. (line 282)
* planeproject: three. (line 438)
* point <1>: three. (line 455)
-* point: Paths and guides. (line 85)
+* point: Paths and guides. (line 84)
* polar: Data types. (line 119)
* polargraph: graph. (line 90)
* polygon: graph. (line 474)
* pop: Arrays. (line 39)
* Portrait: Frames and pictures. (line 95)
* postcontrol <1>: three. (line 455)
-* postcontrol: Paths and guides. (line 130)
+* postcontrol: Paths and guides. (line 129)
* postfix operators: Self & prefix operators.
(line 19)
* postscript: Frames and pictures. (line 267)
-* PostScript fonts: Pens. (line 206)
+* PostScript fonts: Pens. (line 207)
* PostScript subpath: Tutorial. (line 197)
* pow10: Mathematical functions.
(line 6)
* prc: three. (line 216)
-* precision: Files. (line 90)
+* precision: Files. (line 89)
* precontrol <1>: three. (line 455)
-* precontrol: Paths and guides. (line 123)
+* precontrol: Paths and guides. (line 122)
* 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 122)
+* psviewerOptions: Options. (line 124)
* pt: Tutorial. (line 63)
* public: Structures. (line 6)
* push: Arrays. (line 39)
* Python usage: Interactive mode. (line 58)
-* quadraticroots: Arrays. (line 311)
+* quadraticroots: Arrays. (line 308)
* quarticroots: math. (line 22)
* quit <1>: Debugger. (line 54)
* quit: Interactive mode. (line 37)
@@ -9105,18 +9116,16 @@ Index
* radians: Mathematical functions.
(line 17)
* radius <1>: three. (line 455)
-* radius: Paths and guides. (line 119)
+* radius: Paths and guides. (line 118)
* Rainbow: palette. (line 12)
* rand: Mathematical functions.
(line 39)
* randMax: Mathematical functions.
(line 39)
-* read1: Arrays. (line 386)
-* read2: Arrays. (line 386)
-* read3: Arrays. (line 386)
+* read: Arrays. (line 384)
* reading: Files. (line 11)
* reading string arrays: Arrays. (line 353)
-* readline: Files. (line 132)
+* readline: Files. (line 131)
* real: Data types. (line 33)
* realDigits: Data types. (line 33)
* realEpsilon: Data types. (line 33)
@@ -9127,24 +9136,24 @@ Index
* recursion: Functions. (line 88)
* reflect: Transforms. (line 51)
* Relative: label. (line 52)
-* relpoint: Paths and guides. (line 157)
-* reltime: Paths and guides. (line 153)
+* relpoint: Paths and guides. (line 156)
+* reltime: Paths and guides. (line 152)
* remainder: Mathematical functions.
(line 6)
-* rename: Files. (line 149)
-* render <1>: Options. (line 134)
+* rename: Files. (line 148)
+* render <1>: Options. (line 136)
* render: three. (line 121)
* replace: Data types. (line 252)
-* resetdefaultpen: Pens. (line 349)
+* resetdefaultpen: Pens. (line 350)
* rest arguments: Rest arguments. (line 6)
* restore: Frames and pictures. (line 261)
* restricted: Structures. (line 6)
* return: Debugger. (line 48)
* reverse <1>: three. (line 455)
-* reverse <2>: Arrays. (line 149)
-* reverse <3>: Paths and guides. (line 164)
+* reverse <2>: Arrays. (line 146)
+* reverse <3>: Paths and guides. (line 163)
* reverse: Data types. (line 248)
-* rewind: Files. (line 90)
+* rewind: Files. (line 89)
* rfind: Data types. (line 229)
* rgb: Pens. (line 30)
* Riemann zeta function: Mathematical functions.
@@ -9157,41 +9166,42 @@ Index
* Rotate(pair z): label. (line 40)
* round: Mathematical functions.
(line 26)
-* roundcap: Pens. (line 125)
+* roundcap: Pens. (line 126)
* roundedpath: roundedpath. (line 6)
-* roundjoin: Pens. (line 134)
+* roundjoin: Pens. (line 135)
* roundrectangle: flowchart. (line 62)
* RPM: UNIX binary distributions.
(line 6)
* runtime imports: Import. (line 101)
* Russian: unicode. (line 7)
* S: Tutorial. (line 94)
-* safe: Options. (line 150)
+* safe: Options. (line 152)
* save: Frames and pictures. (line 258)
-* saveline: Files. (line 132)
+* saveline: Files. (line 131)
* scale: three. (line 417)
* Scale: graph. (line 688)
* scale <1>: graph. (line 672)
-* scale: Transforms. (line 39)
+* scale <2>: Transforms. (line 39)
+* scale: Pens. (line 112)
* Scale: label. (line 46)
* scale3: three. (line 414)
* scaled graph: graph. (line 653)
* scientific graph: graph. (line 386)
-* scroll: Files. (line 106)
-* search: Arrays. (line 167)
+* scroll: Files. (line 105)
+* search: Arrays. (line 164)
* search paths: Search paths. (line 6)
* Seascape: Frames and pictures. (line 100)
* secondary axis: graph. (line 803)
* secondaryX: graph. (line 803)
* secondaryY: graph. (line 803)
* seconds: Data types. (line 299)
-* seek: Files. (line 90)
-* seekeof: Files. (line 90)
+* seek: Files. (line 89)
+* seekeof: Files. (line 89)
* segmentation fault: Help. (line 33)
* self operators: Self & prefix operators.
(line 6)
-* sequence: Arrays. (line 131)
-* settings <1>: Options. (line 107)
+* sequence: Arrays. (line 128)
+* settings <1>: Options. (line 109)
* settings: Configuring. (line 23)
* sgn: Mathematical functions.
(line 26)
@@ -9204,8 +9214,7 @@ Index
* showtarget: three. (line 319)
* Si: Mathematical functions.
(line 48)
-* signed <1>: Arrays. (line 398)
-* signed: Files. (line 71)
+* signedint: Files. (line 71)
* SimpleHead: draw. (line 26)
* simplex: simplex. (line 6)
* simpson: Mathematical functions.
@@ -9214,34 +9223,33 @@ Index
(line 20)
* sin: Mathematical functions.
(line 6)
-* single <1>: Arrays. (line 398)
-* single: Files. (line 71)
-* singleint: Files. (line 86)
-* singlereal: Files. (line 86)
+* single precision: Files. (line 71)
+* singleint: Files. (line 71)
+* singlereal: Files. (line 71)
* sinh: Mathematical functions.
(line 6)
-* size <1>: Options. (line 134)
+* size <1>: Options. (line 136)
* size <2>: three. (line 455)
* size <3>: Frames and pictures. (line 43)
-* size: Paths and guides. (line 71)
+* size: Paths and guides. (line 70)
* size3: three. (line 244)
* slant: Transforms. (line 45)
* Slant: label. (line 43)
* sleep: Data types. (line 329)
-* slice: Paths and guides. (line 233)
+* slice: Paths and guides. (line 232)
* slices: Slices. (line 6)
* slide: slide. (line 6)
* slopefield: slopefield. (line 6)
* solid: Pens. (line 92)
* solids: solids. (line 9)
-* solve: Arrays. (line 265)
-* sort: Arrays. (line 190)
+* solve: Arrays. (line 262)
+* sort: Arrays. (line 187)
* Spline <1>: graph3. (line 100)
* Spline: graph. (line 34)
* split: Data types. (line 261)
* sqrt: Mathematical functions.
(line 6)
-* squarecap: Pens. (line 125)
+* squarecap: Pens. (line 126)
* srand: Mathematical functions.
(line 39)
* stack overflow <1>: Help. (line 33)
@@ -9255,28 +9263,28 @@ Index
* stop: Debugger. (line 10)
* straight: three. (line 455)
* Straight: graph. (line 31)
-* straight: Paths and guides. (line 78)
+* straight: Paths and guides. (line 77)
* strftime: Data types. (line 291)
* string: Data types. (line 179)
* stroke: fill. (line 36)
-* strokepath: Paths and guides. (line 290)
+* strokepath: Paths and guides. (line 289)
* strptime: Data types. (line 299)
* struct: Structures. (line 6)
* structures: Structures. (line 6)
* subpath <1>: three. (line 455)
-* subpath: Paths and guides. (line 167)
+* subpath: Paths and guides. (line 166)
* subpictures: Frames and pictures. (line 103)
* substr: Data types. (line 244)
* Subversion: Subversion. (line 6)
-* sum: Arrays. (line 219)
+* sum: Arrays. (line 216)
* superpath: Tutorial. (line 197)
-* Suppress: Pens. (line 327)
-* SuppressQuiet: Pens. (line 331)
+* Suppress: Pens. (line 328)
+* SuppressQuiet: Pens. (line 332)
* surface <1>: graph3. (line 100)
* surface: three. (line 47)
* SVN: Subversion. (line 6)
-* system <1>: Options. (line 150)
-* system: Files. (line 157)
+* system <1>: Options. (line 152)
+* system: Files. (line 156)
* syzygy: syzygy. (line 6)
* tab: Files. (line 59)
* tab completion: Tutorial. (line 21)
@@ -9287,21 +9295,21 @@ Index
* tanh: Mathematical functions.
(line 6)
* target: three. (line 319)
-* tell: Files. (line 90)
+* tell: Files. (line 89)
* tension <1>: three. (line 6)
* tension: Tutorial. (line 165)
-* tensionSpecifier: Paths and guides. (line 381)
+* tensionSpecifier: Paths and guides. (line 380)
* tensor product shading: fill. (line 74)
* tensorshade: fill. (line 74)
-* tex <1>: Options. (line 134)
+* tex <1>: Options. (line 136)
* tex: Frames and pictures. (line 274)
-* TeX fonts: Pens. (line 197)
+* TeX fonts: Pens. (line 198)
* TeX string: Data types. (line 179)
-* texcommand: Configuring. (line 69)
+* texcommand: Configuring. (line 67)
* TeXHead: draw. (line 26)
* TeXHead3: three. (line 498)
* texpath <1>: label. (line 116)
-* texpath: Configuring. (line 69)
+* texpath: Configuring. (line 67)
* texpreamble: Frames and pictures. (line 282)
* texreset: Frames and pictures. (line 285)
* textbook graph: graph. (line 361)
@@ -9315,10 +9323,10 @@ Index
* Ticks: graph. (line 155)
* ticks: graph. (line 155)
* tildeframe: markers. (line 26)
-* tile: Pens. (line 247)
-* tilings: Pens. (line 234)
+* tile: Pens. (line 248)
+* tilings: Pens. (line 235)
* time: Data types. (line 291)
-* times: Paths and guides. (line 202)
+* times: Paths and guides. (line 201)
* Top: graph. (line 131)
* TopView: three. (line 362)
* trace: Debugger. (line 51)
@@ -9326,13 +9334,13 @@ Index
* transform <1>: three. (line 429)
* transform: Transforms. (line 6)
* transform3: three. (line 398)
-* transparency: Pens. (line 218)
-* transpose: Arrays. (line 211)
+* transparency: Pens. (line 219)
+* transpose: Arrays. (line 208)
* tree: tree. (line 9)
* trembling: trembling. (line 6)
* triangle: geometry. (line 6)
* triangulate: contour. (line 156)
-* tridiagonal: Arrays. (line 268)
+* tridiagonal: Arrays. (line 265)
* trigonometric integrals: Mathematical functions.
(line 48)
* triple: Data types. (line 108)
@@ -9343,12 +9351,12 @@ Index
* tutorial: Tutorial. (line 6)
* typedef <1>: Functions. (line 36)
* typedef: Data types. (line 339)
-* undefined: Paths and guides. (line 264)
+* undefined: Paths and guides. (line 263)
* UnFill: Frames and pictures. (line 152)
* unfill: fill. (line 105)
* UnFill: draw. (line 26)
* unicode: unicode. (line 6)
-* uniform: Arrays. (line 158)
+* uniform: Arrays. (line 155)
* Uninstall: Uninstall. (line 6)
* unit: Data types. (line 78)
* unitbox <1>: three. (line 288)
@@ -9374,8 +9382,8 @@ Index
* variable initializers: Variable initializers.
(line 6)
* vectorfield: graph. (line 965)
-* vectorfield3: graph3. (line 156)
-* vectorization: Arrays. (line 325)
+* vectorfield3: graph3. (line 159)
+* vectorization: Arrays. (line 322)
* verbatim: Frames and pictures. (line 267)
* vertex-dependent colors: three. (line 75)
* Vertical: flowchart. (line 74)
@@ -9388,20 +9396,20 @@ Index
* virtual functions: Structures. (line 189)
* void: Data types. (line 10)
* W: Tutorial. (line 94)
-* whatever: Paths and guides. (line 228)
+* whatever: Paths and guides. (line 227)
* Wheel: palette. (line 22)
* wheel mouse: GUI. (line 6)
* while: Programming. (line 29)
* white-space string delimiter mode: Arrays. (line 353)
* width: LaTeX usage. (line 32)
-* windingnumber: Paths and guides. (line 264)
+* windingnumber: Paths and guides. (line 263)
* word: Arrays. (line 353)
-* write <1>: Arrays. (line 394)
+* write <1>: Arrays. (line 393)
* write: Files. (line 51)
* X: three. (line 255)
* xasy: GUI. (line 6)
* xaxis3: graph3. (line 7)
-* xelatex <1>: Options. (line 134)
+* xelatex <1>: Options. (line 136)
* xelatex: embed. (line 10)
* xequals: graph. (line 284)
* XEquals: graph. (line 270)
@@ -9445,7 +9453,7 @@ Index
(line 48)
* zero_J: Mathematical functions.
(line 48)
-* zerowinding: Pens. (line 148)
+* zerowinding: Pens. (line 149)
* zeta: Mathematical functions.
(line 48)
* zpart: Data types. (line 161)
@@ -9465,139 +9473,139 @@ Node: UNIX binary distributions11307
Node: MacOS X binary distributions12413
Node: Microsoft Windows13361
Ref: psview14071
-Node: Configuring14990
-Node: Search paths19297
-Node: Compiling from UNIX source19977
-Ref: multisampling20566
-Node: Editing modes22984
-Node: Subversion25416
-Node: Uninstall25879
-Node: Tutorial26229
-Ref: unitcircle29972
-Ref: Bezier30181
-Node: Drawing commands35240
-Node: draw36949
-Ref: arrows38097
-Node: fill43322
-Ref: gradient shading44366
-Node: clip48559
-Node: label49151
-Ref: Label49850
-Node: Programming55594
-Ref: array iteration56411
-Node: Data types57493
-Ref: format66394
-Node: Paths and guides69858
-Ref: circle70112
-Ref: arctime75457
-Ref: extension79322
-Node: Pens86005
-Ref: fillrule93150
-Ref: basealign94047
-Ref: transparency96872
-Ref: makepen100315
-Ref: overwrite101153
-Node: Transforms102363
-Node: Frames and pictures104154
-Ref: envelope105295
-Ref: size106378
-Ref: unitsize107365
-Ref: shipout108425
-Ref: filltype110733
-Ref: add113716
-Ref: add about114662
-Ref: tex117607
-Node: Files118481
-Ref: cd119446
-Ref: scroll124005
-Node: Variable initializers127078
-Node: Structures129373
-Node: Operators136825
-Node: Arithmetic & logical137139
-Node: Self & prefix operators139036
-Node: User-defined operators139824
-Node: Implicit scaling140735
-Node: Functions141298
-Ref: stack overflow144051
-Node: Default arguments144615
-Node: Named arguments145354
-Node: Rest arguments147516
-Node: Mathematical functions150326
-Node: Arrays154931
-Ref: sort162112
-Ref: tridiagonal164403
-Ref: solve165631
-Node: Slices170034
-Node: Casts173928
-Node: Import175894
-Node: Static181124
-Node: LaTeX usage184020
-Node: Base modules189465
-Node: plain191965
-Node: simplex192617
-Node: math192890
-Node: interpolate193989
-Node: geometry194268
-Node: trembling194872
-Node: stats195233
-Node: patterns195493
-Node: markers195729
-Node: tree197512
-Node: binarytree197700
-Node: drawtree198289
-Node: syzygy198493
-Node: feynman198767
-Node: roundedpath199042
-Node: animation199325
-Ref: animate199744
-Node: embed200883
-Node: slide202672
-Node: MetaPost203012
-Node: unicode203728
-Node: latin1204616
-Node: babel204984
-Node: labelpath205213
-Node: labelpath3206033
-Node: annotate206344
-Node: CAD206815
-Node: graph207125
-Ref: ticks213963
-Ref: pathmarkers227113
-Ref: marker227578
-Ref: markuniform227929
-Ref: errorbars229720
-Ref: automatic scaling233776
-Node: palette244419
-Ref: images244537
-Ref: image248708
-Ref: logimage249186
-Ref: penimage249992
-Node: three250436
-Ref: PostScript3D272750
-Node: obj274442
-Node: graph3274694
-Ref: GaussianSurface279649
-Node: grid3280734
-Node: solids281474
-Node: tube282422
-Node: flowchart284657
-Node: contour289156
-Node: contour3294187
-Node: slopefield294494
-Node: ode295931
-Node: Options296191
-Ref: configuration file301631
-Ref: settings301631
-Ref: convert302702
-Node: Interactive mode305491
-Ref: history307115
-Node: GUI308420
-Node: GUI Installation308923
-Node: GUI Usage310061
-Node: PostScript to Asymptote310964
-Node: Help312107
-Node: Debugger313836
-Node: Credits315621
-Node: Index316534
+Node: Configuring14992
+Node: Search paths19205
+Node: Compiling from UNIX source20002
+Ref: multisampling20591
+Node: Editing modes23009
+Node: Subversion25441
+Node: Uninstall25904
+Node: Tutorial26254
+Ref: unitcircle29997
+Ref: Bezier30206
+Node: Drawing commands35265
+Node: draw36974
+Ref: arrows38122
+Node: fill43365
+Ref: gradient shading44409
+Node: clip48602
+Node: label49194
+Ref: Label49893
+Node: Programming55618
+Ref: array iteration56435
+Node: Data types57517
+Ref: format66418
+Node: Paths and guides69882
+Ref: circle70136
+Ref: arctime75453
+Ref: extension79318
+Node: Pens86001
+Ref: fillrule93245
+Ref: basealign94142
+Ref: transparency96967
+Ref: makepen100410
+Ref: overwrite101248
+Node: Transforms102458
+Node: Frames and pictures104249
+Ref: envelope105390
+Ref: size106473
+Ref: unitsize107460
+Ref: shipout108520
+Ref: filltype110853
+Ref: add113835
+Ref: add about114781
+Ref: tex117726
+Node: Files118600
+Ref: cd119565
+Ref: scroll124034
+Node: Variable initializers127107
+Node: Structures129402
+Node: Operators136854
+Node: Arithmetic & logical137168
+Node: Self & prefix operators139065
+Node: User-defined operators139853
+Node: Implicit scaling140764
+Node: Functions141327
+Ref: stack overflow144080
+Node: Default arguments144644
+Node: Named arguments145383
+Node: Rest arguments147545
+Node: Mathematical functions150355
+Node: Arrays154960
+Ref: sort162020
+Ref: tridiagonal164311
+Ref: solve165539
+Node: Slices169736
+Node: Casts173629
+Node: Import175595
+Node: Static180825
+Node: LaTeX usage183721
+Node: Base modules189166
+Node: plain191666
+Node: simplex192318
+Node: math192591
+Node: interpolate193690
+Node: geometry193969
+Node: trembling194573
+Node: stats194934
+Node: patterns195194
+Node: markers195430
+Node: tree197213
+Node: binarytree197401
+Node: drawtree197990
+Node: syzygy198194
+Node: feynman198468
+Node: roundedpath198743
+Node: animation199026
+Ref: animate199443
+Node: embed200582
+Node: slide202371
+Node: MetaPost202711
+Node: unicode203427
+Node: latin1204315
+Node: babel204683
+Node: labelpath204912
+Node: labelpath3205732
+Node: annotate206043
+Node: CAD206514
+Node: graph206824
+Ref: ticks213663
+Ref: pathmarkers226814
+Ref: marker227279
+Ref: markuniform227630
+Ref: errorbars229421
+Ref: automatic scaling233477
+Node: palette244123
+Ref: images244241
+Ref: image248412
+Ref: logimage248890
+Ref: penimage249696
+Node: three250140
+Ref: PostScript3D272471
+Node: obj274163
+Node: graph3274415
+Ref: GaussianSurface279540
+Node: grid3280625
+Node: solids281365
+Node: tube282313
+Node: flowchart284548
+Node: contour289047
+Node: contour3294078
+Node: slopefield294385
+Node: ode295822
+Node: Options296082
+Ref: configuration file301624
+Ref: settings301624
+Ref: convert302719
+Node: Interactive mode305508
+Ref: history307132
+Node: GUI308437
+Node: GUI Installation308940
+Node: GUI Usage310078
+Node: PostScript to Asymptote310981
+Node: Help312124
+Node: Debugger313853
+Node: Credits315638
+Node: Index316551

End Tag Table
diff --git a/Build/source/utils/asymptote/doc/secondaryaxis.asy b/Build/source/utils/asymptote/doc/secondaryaxis.asy
index 527675f2f51..39f802f935d 100644
--- a/Build/source/utils/asymptote/doc/secondaryaxis.asy
+++ b/Build/source/utils/asymptote/doc/secondaryaxis.asy
@@ -3,12 +3,12 @@ import graph;
size(9cm,6cm,IgnoreAspect);
string data="secondaryaxis.csv";
-file in=line(csv(input(data)));
+file in=input(data).line().csv();
string[] titlelabel=in;
string[] columnlabel=in;
-real[][] a=dimension(in,0,0);
+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];
diff --git a/Build/source/utils/asymptote/doc/westnile.asy b/Build/source/utils/asymptote/doc/westnile.asy
index c01ebc5cde2..7f63047983f 100644
--- a/Build/source/utils/asymptote/doc/westnile.asy
+++ b/Build/source/utils/asymptote/doc/westnile.asy
@@ -3,11 +3,11 @@ import graph;
size(9cm,8cm,IgnoreAspect);
string data="westnile.csv";
-file in=line(csv(input(data)));
+file in=input(data).line().csv();
string[] columnlabel=in;
-real[][] A=dimension(in,0,0);
+real[][] A=in.dimension(0,0);
A=transpose(A);
real[] number=A[0], survival=A[1];
diff --git a/Build/source/utils/asymptote/drawclipbegin.h b/Build/source/utils/asymptote/drawclipbegin.h
index 55862b35c23..cba0acc9a15 100644
--- a/Build/source/utils/asymptote/drawclipbegin.h
+++ b/Build/source/utils/asymptote/drawclipbegin.h
@@ -58,16 +58,20 @@ public:
if(gsave) out->gsave();
if(empty()) return true;
- if(!settings::context(out->texengine)) {
+ if(out->toplevel()) {
out->verbatim(settings::beginpicture(out->texengine));
- out->verbatim("(");
- double width=bpath.right-bpath.left;
- double height=bpath.top-bpath.bottom;
- out->write(width*ps2tex);
- out->verbatim(",");
- out->write(height*ps2tex);
- out->verbatimline(")%");
+ if(!settings::context(out->texengine)) {
+ out->verbatim("(");
+ double width=bpath.right-bpath.left;
+ double height=bpath.top-bpath.bottom;
+ out->write(width*ps2tex);
+ out->verbatim(",");
+ out->write(height*ps2tex);
+ out->verbatim(")");
+ }
+ out->verbatimline("%");
}
+ out->begingroup();
out->beginspecial();
out->beginraw();
diff --git a/Build/source/utils/asymptote/drawclipend.h b/Build/source/utils/asymptote/drawclipend.h
index 098d4dac8eb..4b2d3260f2c 100644
--- a/Build/source/utils/asymptote/drawclipend.h
+++ b/Build/source/utils/asymptote/drawclipend.h
@@ -46,11 +46,14 @@ public:
}
bool write(texfile *out, const bbox& bpath) {
- out->verbatimline(settings::endpicture(out->texengine));
- out->verbatim("\\kern");
- double width=bpath.right-bpath.left;
- out->write(-width*ps2tex);
- out->verbatimline("pt%");
+ out->endgroup();
+ if(out->toplevel()) {
+ out->verbatimline(settings::endpicture(out->texengine));
+ out->verbatim("\\kern");
+ double width=bpath.right-bpath.left;
+ out->write(-width*ps2tex);
+ out->verbatimline("pt%");
+ }
if(grestore) out->grestore();
return true;
}
diff --git a/Build/source/utils/asymptote/drawelement.h b/Build/source/utils/asymptote/drawelement.h
index f2108591e5f..e704912ac21 100644
--- a/Build/source/utils/asymptote/drawelement.h
+++ b/Build/source/utils/asymptote/drawelement.h
@@ -104,10 +104,8 @@ public:
virtual void bounds(bbox&, iopipestream&, boxvector&, bboxlist&) {}
virtual void bounds(bbox3&) {}
- virtual void bounds(pair &b, double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t, bool &first){}
+ // Compute bounds on ratio (x,y)/z for 3d picture (not cached).
+ virtual void ratio(pair &b, double (*m)(double, double), bool &first){}
virtual bool islabel() {return false;}
diff --git a/Build/source/utils/asymptote/drawpath3.h b/Build/source/utils/asymptote/drawpath3.h
index 25e9ffadf6d..7e27f196d31 100644
--- a/Build/source/utils/asymptote/drawpath3.h
+++ b/Build/source/utils/asymptote/drawpath3.h
@@ -40,11 +40,8 @@ public:
B.add(Max);
}
- void bounds(pair &b, double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t, bool &first) {
- pair z=g.bounds(m,x,y,t);
+ void ratio(pair &b, double (*m)(double, double), bool &first) {
+ pair z=g.ratio(m);
if(first) {
b=z;
first=false;
diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc
index af6f0cd8722..1eee043df7c 100644
--- a/Build/source/utils/asymptote/drawsurface.cc
+++ b/Build/source/utils/asymptote/drawsurface.cc
@@ -41,20 +41,23 @@ void drawSurface::bounds(bbox3& b)
for(int i=0; i < 16; ++i)
c1[i]=controls[i][0];
double c0=c1[0];
- double xmin=bound(c1,min,b.empty ? c0 : min(c0,b.left));
- double xmax=bound(c1,max,b.empty ? c0 : max(c0,b.right));
+ double fuzz=sqrtFuzz*norm(c1,16);
+ double xmin=bound(c1,min,b.empty ? c0 : min(c0,b.left),fuzz);
+ double xmax=bound(c1,max,b.empty ? c0 : max(c0,b.right),fuzz);
for(int i=0; i < 16; ++i)
c1[i]=controls[i][1];
c0=c1[0];
- double ymin=bound(c1,min,b.empty ? c0 : min(c0,b.bottom));
- double ymax=bound(c1,max,b.empty ? c0 : max(c0,b.top));
+ fuzz=sqrtFuzz*norm(c1,16);
+ double ymin=bound(c1,min,b.empty ? c0 : min(c0,b.bottom),fuzz);
+ double ymax=bound(c1,max,b.empty ? c0 : max(c0,b.top),fuzz);
for(int i=0; i < 16; ++i)
c1[i]=controls[i][2];
c0=c1[0];
- double zmin=bound(c1,min,b.empty ? c0 : min(c0,b.lower));
- double zmax=bound(c1,max,b.empty ? c0 : max(c0,b.upper));
+ fuzz=sqrtFuzz*norm(c1,16);
+ double zmin=bound(c1,min,b.empty ? c0 : min(c0,b.lower),fuzz);
+ double zmax=bound(c1,max,b.empty ? c0 : max(c0,b.upper),fuzz);
Min=triple(xmin,ymin,zmin);
Max=triple(xmax,ymax,zmax);
@@ -63,10 +66,7 @@ void drawSurface::bounds(bbox3& b)
b.add(Max);
}
-void drawSurface::bounds(pair &b, double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t, bool &first)
+void drawSurface::ratio(pair &b, double (*m)(double, double), bool &first)
{
for(int i=0; i < 16; ++i) {
double *ci=controls[i];
@@ -75,11 +75,12 @@ void drawSurface::bounds(pair &b, double (*m)(double, double),
if(first) {
triple v=c3[0];
- b=pair(x(v,t),y(v,t));
+ b=pair(xratio(v),yratio(v));
first=false;
}
- b=pair(bound(c3,m,x,t,b.getx()),bound(c3,m,y,t,b.gety()));
+ double fuzz=sqrtFuzz*norm(c3,16);
+ b=pair(bound(c3,m,xratio,b.getx(),fuzz),bound(c3,m,yratio,b.gety(),fuzz));
}
bool drawSurface::write(prcfile *out)
@@ -87,7 +88,7 @@ bool drawSurface::write(prcfile *out)
if(invisible)
return true;
- PRCMaterial m(ambient,diffuse,emissive,specular,opacity,shininess);
+ PRCMaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess);
out->add(new PRCBezierSurface(out,3,3,4,4,controls,m,granularity));
return true;
@@ -260,10 +261,10 @@ void drawSurface::render(GLUnurbs *nurb, double size2,
}
static GLfloat bezier[]={0.0,0.0,0.0,0.0,1.0,1.0,1.0,1.0};
gluBeginSurface(nurb);
- gluNurbsSurface(nurb,8,bezier,8,bezier,3,12,c,4,4,GL_MAP2_VERTEX_3);
+ gluNurbsSurface(nurb,8,bezier,8,bezier,12,3,c,4,4,GL_MAP2_VERTEX_3);
if(havecolors) {
static GLfloat linear[]={0.0,0.0,1.0,1.0};
- gluNurbsSurface(nurb,4,linear,4,linear,4,8,colors,2,2,GL_MAP2_COLOR_4);
+ gluNurbsSurface(nurb,4,linear,4,linear,8,4,colors,2,2,GL_MAP2_COLOR_4);
}
gluEndSurface(nurb);
@@ -275,14 +276,14 @@ void drawSurface::render(GLUnurbs *nurb, double size2,
glColor4fv(colors);
glVertex3fv(c);
if(havecolors)
- glColor4fv(colors+4);
- glVertex3fv(c+9);
+ glColor4fv(colors+8);
+ glVertex3fv(c+36);
if(havecolors)
glColor4fv(colors+12);
glVertex3fv(c+45);
if(havecolors)
- glColor4fv(colors+8);
- glVertex3fv(c+36);
+ glColor4fv(colors+4);
+ glVertex3fv(c+9);
glEnd();
}
@@ -296,4 +297,22 @@ drawElement *drawSurface::transformed(const array& t)
return new drawSurface(t,this);
}
+double norm(double *a, size_t n)
+{
+ if(n == 0) return 0.0;
+ double M=fabs(a[0]);
+ for(size_t i=1; i < n; ++i)
+ M=max(M,fabs(a[i]));
+ return M;
+}
+
+double norm(triple *a, size_t n)
+{
+ if(n == 0) return 0.0;
+ double M=a[0].abs2();
+ for(size_t i=1; i < n; ++i)
+ M=max(M,a[i].abs2());
+ return sqrt(M);
+}
+
} //namespace camp
diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h
index 2bd8aeea4d4..9c7f25342b9 100644
--- a/Build/source/utils/asymptote/drawsurface.h
+++ b/Build/source/utils/asymptote/drawsurface.h
@@ -24,6 +24,7 @@ protected:
RGBAColour specular;
double opacity;
double shininess;
+ double PRCshininess;
double granularity;
triple normal;
bool lighton;
@@ -56,10 +57,12 @@ protected:
public:
drawSurface(const vm::array& g, bool straight, const vm::array&p,
- double opacity, double shininess, double granularity,
- triple normal, bool lighton, const vm::array &pens) :
+ double opacity, double shininess, double PRCshininess,
+ double granularity, triple normal, bool lighton,
+ const vm::array &pens) :
straight(straight), opacity(opacity), shininess(shininess),
- granularity(granularity), normal(unit(normal)), lighton(lighton) {
+ PRCshininess(PRCshininess), granularity(granularity), normal(unit(normal)),
+ lighton(lighton) {
string wrongsize=
"Bezier surface patch requires 4x4 array of triples and array of 4 pens";
if(checkArray(&g) != 4 || checkArray(&p) != 4)
@@ -80,9 +83,9 @@ public:
colors=new GLfloat[16];
if(size != 4) reportError(wrongsize);
storecolor(0,pens,0);
- storecolor(4,pens,1);
+ storecolor(8,pens,1);
storecolor(12,pens,2);
- storecolor(8,pens,3);
+ storecolor(4,pens,3);
}
#endif
@@ -105,7 +108,8 @@ public:
drawSurface(const vm::array& t, const drawSurface *s) :
straight(s->straight), diffuse(s->diffuse), ambient(s->ambient),
emissive(s->emissive), specular(s->specular), opacity(s->opacity),
- shininess(s->shininess), granularity(s->granularity), lighton(s->lighton),
+ shininess(s->shininess), PRCshininess(s->PRCshininess),
+ granularity(s->granularity), lighton(s->lighton),
invisible(s->invisible), colors(s->colors), havecolors(s->havecolors) {
for(size_t i=0; i < 16; ++i) {
const double *c=s->controls[i];
@@ -121,10 +125,7 @@ public:
void bounds(bbox3& b);
- void bounds(pair &b, double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t, bool &first);
+ void ratio(pair &b, double (*m)(double, double), bool &first);
virtual ~drawSurface() {
if(havecolors)
@@ -140,6 +141,9 @@ public:
drawElement *transformed(const vm::array& t);
};
+double norm(double *a, size_t n);
+double norm(triple *a, size_t n);
+
}
#endif
diff --git a/Build/source/utils/asymptote/errormsg.cc b/Build/source/utils/asymptote/errormsg.cc
index b9b45ee0d2d..249e26dfb1a 100644
--- a/Build/source/utils/asymptote/errormsg.cc
+++ b/Build/source/utils/asymptote/errormsg.cc
@@ -63,15 +63,16 @@ void errorstream::error(position pos)
anyErrors = true;
}
-void errorstream::warning(position pos)
+void errorstream::warning(position pos, string s)
{
- message(pos,"warning: ");
+ message(pos,"warning ["+s+"]: ");
anyWarnings = true;
}
-void errorstream::disable(string s)
+void errorstream::warning(position pos)
{
- out << ": to ignore, use nowarn(\""+s+"\");";
+ message(pos,"warning: ");
+ anyWarnings = true;
}
void errorstream::fatal(position pos)
diff --git a/Build/source/utils/asymptote/errormsg.h b/Build/source/utils/asymptote/errormsg.h
index 2a762680be9..62508cc0ca7 100644
--- a/Build/source/utils/asymptote/errormsg.h
+++ b/Build/source/utils/asymptote/errormsg.h
@@ -114,6 +114,8 @@ inline bool operator == (const position& a, const position& b)
a.filename() == b.filename();
}
+string warning(string s);
+
class errorstream {
ostream& out;
bool anyErrors;
@@ -155,10 +157,8 @@ public:
// Indicate potential problems in the code, but the code is still usable.
void warning(position pos);
+ void warning(position pos, string s);
- // Indicate how a warning may be disabled.
- void disable(string s);
-
// Single a fatal error and execute the main process.
void fatal(position pos);
diff --git a/Build/source/utils/asymptote/examples/BezierSurface.asy b/Build/source/utils/asymptote/examples/BezierSurface.asy
index e87f785c761..bf386baf7e5 100644
--- a/Build/source/utils/asymptote/examples/BezierSurface.asy
+++ b/Build/source/utils/asymptote/examples/BezierSurface.asy
@@ -5,29 +5,29 @@ string viewpoint="{-24.132780075073242 7.2992024421691895 7.695427417755127}{0.8
//viewpoint=getstring("viewpoint",viewpoint);
currentprojection=perspective(viewpoint);
-currentlight=White;
-
-triple[][][] P={{
- {(-1.6,0,1.875),(-1.6,-0.3,1.875),(-1.5,-0.3,2.1),(-1.5,0,2.1)},
- {(-2.3,0,1.875),(-2.3,-0.3,1.875),(-2.5,-0.3,2.1),(-2.5,0,2.1)},
- {(-2.7,0,1.875),(-2.7,-0.3,1.875),(-3,-0.3,2.1),(-3,0,2.1)},
- {(-2.7,0,1.65),(-2.7,-0.3,1.65),(-3,-0.3,1.65),(-3,0,1.65)}
+triple[][][] P={
+ {
+ {(-1.6,0,1.875),(-2.3,0,1.875),(-2.7,0,1.875),(-2.7,0,1.65),},
+ {(-1.6,-0.3,1.875),(-2.3,-0.3,1.875),(-2.7,-0.3,1.875),(-2.7,-0.3,1.65),},
+ {(-1.5,-0.3,2.1),(-2.5,-0.3,2.1),(-3,-0.3,2.1),(-3,-0.3,1.65),},
+ {(-1.5,0,2.1),(-2.5,0,2.1),(-3,0,2.1),(-3,0,1.65),}
},{
- {(-2.7,0,1.65),(-2.7,-0.3,1.65),(-3,-0.3,1.65),(-3,0,1.65)},
- {(-2.7,0,1.425),(-2.7,-0.3,1.425),(-3,-0.3,1.2),(-3,0,1.2)},
- {(-2.5,0,0.975),(-2.5,-0.3,0.975),(-2.65,-0.3,0.7275),(-2.65,0,0.7275)},
- {(-2,0,0.75),(-2,-0.3,0.75),(-1.9,-0.3,0.45),(-1.9,0,0.45)}
+ {(-2.7,0,1.65),(-2.7,0,1.425),(-2.5,0,0.975),(-2,0,0.75),},
+ {(-2.7,-0.3,1.65),(-2.7,-0.3,1.425),(-2.5,-0.3,0.975),(-2,-0.3,0.75),},
+ {(-3,-0.3,1.65),(-3,-0.3,1.2),(-2.65,-0.3,0.7275),(-1.9,-0.3,0.45),},
+ {(-3,0,1.65),(-3,0,1.2),(-2.65,0,0.7275),(-1.9,0,0.45),}
},{
- {(-2.7,0,1.65),(-2.7,0.3,1.65),(-3,0.3,1.65),(-3,0,1.65)},
- {(-2.7,0,1.875),(-2.7,0.3,1.875),(-3,0.3,2.1),(-3,0,2.1)},
- {(-2.3,0,1.875),(-2.3,0.3,1.875),(-2.5,0.3,2.1),(-2.5,0,2.1)},
- {(-1.6,0,1.875),(-1.6,0.3,1.875),(-1.5,0.3,2.1),(-1.5,0,2.1)}
+ {(-2.7,0,1.65),(-2.7,0,1.875),(-2.3,0,1.875),(-1.6,0,1.875),},
+ {(-2.7,0.3,1.65),(-2.7,0.3,1.875),(-2.3,0.3,1.875),(-1.6,0.3,1.875),},
+ {(-3,0.3,1.65),(-3,0.3,2.1),(-2.5,0.3,2.1),(-1.5,0.3,2.1),},
+ {(-3,0,1.65),(-3,0,2.1),(-2.5,0,2.1),(-1.5,0,2.1),}
},{
- {(-2,0,0.75),(-2,0.3,0.75),(-1.9,0.3,0.45),(-1.9,0,0.45)},
- {(-2.5,0,0.975),(-2.5,0.3,0.975),(-2.65,0.3,0.7275),(-2.65,0,0.7275)},
- {(-2.7,0,1.425),(-2.7,0.3,1.425),(-3,0.3,1.2),(-3,0,1.2)},
- {(-2.7,0,1.65),(-2.7,0.3,1.65),(-3,0.3,1.65),(-3,0,1.65)}
- }};
+ {(-2,0,0.75),(-2.5,0,0.975),(-2.7,0,1.425),(-2.7,0,1.65),},
+ {(-2,0.3,0.75),(-2.5,0.3,0.975),(-2.7,0.3,1.425),(-2.7,0.3,1.65),},
+ {(-1.9,0.3,0.45),(-2.65,0.3,0.7275),(-3,0.3,1.2),(-3,0.3,1.65),},
+ {(-1.9,0,0.45),(-2.65,0,0.7275),(-3,0,1.2),(-3,0,1.65),}
+ }
+};
picture pic;
size(pic,15cm);
diff --git a/Build/source/utils/asymptote/examples/Klein.asy b/Build/source/utils/asymptote/examples/Klein.asy
index 43199200276..bba99023f7d 100644
--- a/Build/source/utils/asymptote/examples/Klein.asy
+++ b/Build/source/utils/asymptote/examples/Klein.asy
@@ -1,17 +1,44 @@
import graph3;
-size(200,0);
-currentprojection=perspective(40,-100,40);
+size(469pt);
+
+viewportmargin=0;
+
+currentprojection=perspective(
+camera=(25.0851928432063,-30.3337528952473,19.3728775115443),
+up=Z,
+target=(-0.590622314050054,0.692357205025578,-0.627122488455679),
+zoom=1,
+autoadjust=false);
-// From http://local.wasp.uwa.edu.au/~pbourke/surfaces_curves/klein/
triple f(pair t) {
real u=t.x;
real v=t.y;
- real r=4*(1-cos(u)/2);
- real x=6*cos(u)*(1+sin(u))+(u < pi ? r*cos(u)*cos(v) : r*cos(v+pi));
- real y=16*sin(u)+(u < pi ? r*sin(u)*cos(v) : 0);
+ real r=2-cos(u);
+ real x=3*cos(u)*(1+sin(u))+r*cos(v)*(u < pi ? cos(u) : -1);
+ real y=8*sin(u)+(u < pi ? r*sin(u)*cos(v) : 0);
real z=r*sin(v);
return (x,y,z);
}
-draw(surface(f,(0,0),(2pi,2pi),8,8,Spline),lightgray);
+surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline);
+draw(s,lightolive+white);
+
+string lo="$\displaystyle u\in[0,\pi]: \cases{x=3\cos u(1+\sin u)+(2-\cos u)\cos u\cos v,\cr
+y=8\sin u+(2-\cos u)\sin u\cos v,\cr
+z=(2-\cos u)\sin v.\cr}$";
+
+string hi="$\displaystyle u\in[\pi,2\pi]:\\\cases{x=3\cos u(1+\sin u)-(2-\cos u)\cos v,\cr
+y=8\sin u,\cr
+z=(2-\cos u)\sin v.\cr}$";
+
+real h=0.0125;
+
+draw(labelsurface(xscale(-0.38)*yscale(-0.18)*lo,s,0,1.7,h));
+draw(labelsurface(xscale(0.26)*yscale(0.1)*rotate(90)*hi,s,4.9,1.4,h));
+draw(s.uequals(0),blue+dashed);
+draw(s.uequals(pi),blue+dashed);
+
+currentpicture.add(new void(frame f, transform3 t, picture pic, projection P) {
+ draw(f,invert(box(min(f,P),max(f,P)),P));
+ });
diff --git a/Build/source/utils/asymptote/examples/animations/earthmoon.asy b/Build/source/utils/asymptote/examples/animations/earthmoon.asy
index abd8ac9f431..37f2ac0fdc5 100644
--- a/Build/source/utils/asymptote/examples/animations/earthmoon.asy
+++ b/Build/source/utils/asymptote/examples/animations/earthmoon.asy
@@ -23,17 +23,17 @@ real xST(real t) {return ast*cos(t)+cst;}
real yST(real t) {return bst*sin(t);}
real zST(real t) {return 0;}
-real xTL(real t) {return atl*cos(27*t);}
-real yTL(real t) {return btl*sin(27*t);}
+real xTL(real t) {return atl*cos(27t);}
+real yTL(real t) {return btl*sin(27t);}
real zTL(real t) {return 0;}
-real xLl(real t) {return Rl*cos(27*t);}
-real yLl(real t) {return Rl*sin(27*t);}
+real xLl(real t) {return Rl*cos(27t);}
+real yLl(real t) {return Rl*sin(27t);}
real zLl(real t) {return 0;}
-real xTt(real t) {return Rtl*cos(100*(t))/5;}
-real yTt(real t) {return Rtl*sin(100*(t))/5;}
+real xTt(real t) {return Rtl*cos(100t)/5;}
+real yTt(real t) {return Rtl*sin(100t)/5;}
real zTt(real t) {return 0;}
real xl(real t) {return xST(t)+xTL(t)+xLl(t);}
@@ -48,8 +48,8 @@ real xL(real t) {return xST(t)+xTL(t);}
real yL(real t) {return yST(t)+yTL(t);}
real zL(real t) {return 0;}
-path3 Pl=graph(xl,yl,zl,0,2*pi,1000),Pt=graph(xt,yt,zt,0,2*pi,3000),
-Pts=graph(xST,yST,zST,0,2*pi,500);
+path3 Pl=graph(xl,yl,zl,0,2pi,1000),Pt=graph(xt,yt,zt,0,2pi,3000),
+Pts=graph(xST,yST,zST,0,2pi,500);
picture pic;
@@ -63,6 +63,7 @@ surface terre=scale3(Rtl/5)*unitsphere;
surface lune=scale3(Rl)*unitsphere;
int n=100;
+
real step=2pi/n;
for(int i=0; i < n; ++i) {
real k=i*step;
diff --git a/Build/source/utils/asymptote/examples/animations/glmovie.asy b/Build/source/utils/asymptote/examples/animations/glmovie.asy
new file mode 100644
index 00000000000..c3d86481b1b
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/animations/glmovie.asy
@@ -0,0 +1,21 @@
+settings.autoplay=true;
+settings.loop=true;
+
+import graph3;
+import animate;
+currentprojection=orthographic(1,-2,0.5);
+
+animation A;
+int n=25;
+
+for(int i=0; i < n; ++i) {
+ picture pic;
+ size3(pic,6cm);
+ real k=i/n*pi;
+ real f(pair z) {return 4cos(abs(z)-k)*exp(-abs(z)/6);}
+ draw(pic,surface(f,(-4pi,-4pi),(4pi,4pi),Spline),paleblue);
+ draw(pic,shift(i*6Z/n)*unitsphere,yellow);
+ A.add(pic);
+}
+
+A.glmovie();
diff --git a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex
index 0dab166ab9d..4cd9cce3150 100644
--- a/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex
+++ b/Build/source/utils/asymptote/examples/animations/inlinemovie3.tex
@@ -19,13 +19,12 @@ settings.prc=false;
import graph3;
import animate;
currentprojection=orthographic(1,-2,0.5);
-currentlight=Headlamp;
+
animation A=animation("movie3");
int n=20;
for(int i=0; i < n; ++i) {
picture pic;
size3(pic,12cm,12cm,8cm);
- limits((-2,-2,-2),(2,2,2));
real k=i/n*pi;
real f(pair z) {return 4cos(abs(z)-k)*exp(-abs(z)/6);}
draw(pic,surface(f,(-4pi,-4pi),(4pi,4pi),Spline),paleblue);
diff --git a/Build/source/utils/asymptote/examples/animations/sphere.asy b/Build/source/utils/asymptote/examples/animations/sphere.asy
index e6bcb589add..56c5f73e3b6 100644
--- a/Build/source/utils/asymptote/examples/animations/sphere.asy
+++ b/Build/source/utils/asymptote/examples/animations/sphere.asy
@@ -3,7 +3,9 @@ import animation;
currentprojection=orthographic((0,5,2));
currentlight=(0,5,5);
+
settings.thick=false;
+settings.render=0;
int nbpts=200;
real step=2*pi/nbpts;
diff --git a/Build/source/utils/asymptote/examples/cylinder.asy b/Build/source/utils/asymptote/examples/cylinder.asy
index c574f577bbd..d326ea579a2 100644
--- a/Build/source/utils/asymptote/examples/cylinder.asy
+++ b/Build/source/utils/asymptote/examples/cylinder.asy
@@ -1,6 +1,7 @@
import solids;
size(0,100);
+currentlight=Viewport;
revolution r=cylinder(O,1,1.5,Y+Z);
draw(surface(r),green);
diff --git a/Build/source/utils/asymptote/examples/filesurface.asy b/Build/source/utils/asymptote/examples/filesurface.asy
index 8e59c201f5e..702b503fc28 100644
--- a/Build/source/utils/asymptote/examples/filesurface.asy
+++ b/Build/source/utils/asymptote/examples/filesurface.asy
@@ -3,11 +3,11 @@ import palette;
size3(200,IgnoreAspect);
-file in=line(input("filesurface.dat"));
+file in=input("filesurface.dat").line();
real[] x=in;
real[] y=in;
-real[][] f=dimension(in,0,0);
+real[][] f=in.dimension(0,0);
triple f(pair t) {
int i=round(t.x);
diff --git a/Build/source/utils/asymptote/examples/galleon.asy b/Build/source/utils/asymptote/examples/galleon.asy
index 6cd0f4545df..1221fd5c862 100644
--- a/Build/source/utils/asymptote/examples/galleon.asy
+++ b/Build/source/utils/asymptote/examples/galleon.asy
@@ -9,6 +9,6 @@ currentprojection=orthographic(0,2,5,up=Y);
pen[] surfacepen={darkred,brown,darkred+orange,heavyred,heavyred,darkred+orange,
palegreen+blue+lightgrey,darkred,darkred,yellow,darkred,white,
white,white,white,white,white};
-surfacepen.cyclic(true);
+surfacepen.cyclic=true;
draw(obj("galleon.obj",verbose=false,surfacepen));
diff --git a/Build/source/utils/asymptote/examples/label3.asy b/Build/source/utils/asymptote/examples/label3.asy
index e3abafc56b0..fdf8d512e39 100644
--- a/Build/source/utils/asymptote/examples/label3.asy
+++ b/Build/source/utils/asymptote/examples/label3.asy
@@ -1,7 +1,6 @@
import three;
currentprojection=perspective(1,1,1,up=Y);
-currentlight=Headlamp;
label(scale(4)*"$\displaystyle\int_{-\infty}^{+\infty} e^{-\alpha x^2}\,dx=
\sqrt{\frac{\pi}{\alpha}}$",O,blue);
diff --git a/Build/source/utils/asymptote/examples/label3ribbon.asy b/Build/source/utils/asymptote/examples/label3ribbon.asy
index 6ad52804ce8..59ccbc9237c 100644
--- a/Build/source/utils/asymptote/examples/label3ribbon.asy
+++ b/Build/source/utils/asymptote/examples/label3ribbon.asy
@@ -1,7 +1,6 @@
import three;
currentprojection=perspective(100,100,200,up=Y);
-currentlight=Headlamp;
draw(scale3(4)*extrude(texpath("$\displaystyle\int_{-\infty}^{+\infty}
e^{-\alpha x^2}\,dx=\sqrt{\frac{\pi}{\alpha}}$"),2Z),blue);
diff --git a/Build/source/utils/asymptote/examples/label3solid.asy b/Build/source/utils/asymptote/examples/label3solid.asy
index 13c91917f5a..476d41fdbc3 100644
--- a/Build/source/utils/asymptote/examples/label3solid.asy
+++ b/Build/source/utils/asymptote/examples/label3solid.asy
@@ -1,7 +1,6 @@
import three;
currentprojection=perspective(100,100,200,up=Y);
-currentlight=Headlamp;
draw(scale3(4)*extrude("$\displaystyle\int_{-\infty}^{+\infty}
e^{-\alpha x^2}\,dx=\sqrt{\frac{\pi}{\alpha}}$",2Z),blue);
diff --git a/Build/source/utils/asymptote/examples/parametricsurface.asy b/Build/source/utils/asymptote/examples/parametricsurface.asy
index 6fb0272b085..f78e8470658 100644
--- a/Build/source/utils/asymptote/examples/parametricsurface.asy
+++ b/Build/source/utils/asymptote/examples/parametricsurface.asy
@@ -11,12 +11,13 @@ triple f(pair t) {
}
pen p=rgb(0.2,0.5,0.7);
+surface s=surface(f,(0,0),(2pi,2pi),8,8,Spline);
// surface only
-draw(surface(f,(0,0),(2pi,2pi),8,8,Spline),lightgray);
+draw(s,lightgray);
// mesh only
-//draw(surface(f,(0,0),(2pi,2pi),8,8,Spline),nullpen,meshpen=p);
+// draw(s,nullpen,meshpen=p);
// surface & mesh
-//draw(surface(f,(0,0),(2pi,2pi),8,8,Spline),lightgray,meshpen=p);
+// draw(s,lightgray,meshpen=p);
diff --git a/Build/source/utils/asymptote/examples/pipeintersection.asy b/Build/source/utils/asymptote/examples/pipeintersection.asy
index a5ace98a19f..d65b8b562ea 100644
--- a/Build/source/utils/asymptote/examples/pipeintersection.asy
+++ b/Build/source/utils/asymptote/examples/pipeintersection.asy
@@ -1,7 +1,6 @@
import graph3;
currentprojection=orthographic(5,4,2);
-currentlight=Headlamp;
size(12cm,0);
diff --git a/Build/source/utils/asymptote/examples/projectelevation.asy b/Build/source/utils/asymptote/examples/projectelevation.asy
index 19918c241c9..6ffe5126633 100644
--- a/Build/source/utils/asymptote/examples/projectelevation.asy
+++ b/Build/source/utils/asymptote/examples/projectelevation.asy
@@ -3,7 +3,6 @@ import grid3;
import palette;
currentprojection=orthographic(0.8,1,2);
-
size(400,300,IgnoreAspect);
real f(pair z) {return cos(2*pi*z.x)*sin(2*pi*z.y);}
diff --git a/Build/source/utils/asymptote/examples/randompath3.asy b/Build/source/utils/asymptote/examples/randompath3.asy
index 56382d19b89..755c3a29128 100644
--- a/Build/source/utils/asymptote/examples/randompath3.asy
+++ b/Build/source/utils/asymptote/examples/randompath3.asy
@@ -1,3 +1,4 @@
import three;
+
size(300);
draw(randompath3(100),red,currentlight);
diff --git a/Build/source/utils/asymptote/examples/slidedemo.asy b/Build/source/utils/asymptote/examples/slidedemo.asy
index 57d7188a5a0..1668ade5fde 100644
--- a/Build/source/utils/asymptote/examples/slidedemo.asy
+++ b/Build/source/utils/asymptote/examples/slidedemo.asy
@@ -21,6 +21,7 @@ bibliographystyle("alpha");
// Generated needed files if they don't already exist.
asy(nativeformat(),"Pythagoras","log","PythagoreanTree");
+usepackage("mflogo");
// Optional background color or header:
// import x11colors;
diff --git a/Build/source/utils/asymptote/examples/slidedemo_.bbl b/Build/source/utils/asymptote/examples/slidedemo_.bbl
index b3e55e47eee..73f4fc0bc70 100644
--- a/Build/source/utils/asymptote/examples/slidedemo_.bbl
+++ b/Build/source/utils/asymptote/examples/slidedemo_.bbl
@@ -7,7 +7,7 @@ John~D. Hobby.
\bibitem[Knu86]{Knuth86b}
Donald~E. Knuth.
-\newblock {\em The METAFONTbook}.
+\newblock {\em The \MF{}book}.
\newblock Addison-Wesley, Reading, Massachusetts, 1986.
\end{thebibliography}
diff --git a/Build/source/utils/asymptote/examples/smoothelevation.asy b/Build/source/utils/asymptote/examples/smoothelevation.asy
index 29ee84ba688..a7995b7079a 100644
--- a/Build/source/utils/asymptote/examples/smoothelevation.asy
+++ b/Build/source/utils/asymptote/examples/smoothelevation.asy
@@ -2,6 +2,8 @@ import graph3;
import grid3;
import palette;
+currentlight=Viewport;
+
if(settings.render <= 0) settings.prc=false;
currentprojection=orthographic(1,2,13);
diff --git a/Build/source/utils/asymptote/examples/soccerball.asy b/Build/source/utils/asymptote/examples/soccerball.asy
index 4b93a492947..f481ef1b7ff 100644
--- a/Build/source/utils/asymptote/examples/soccerball.asy
+++ b/Build/source/utils/asymptote/examples/soccerball.asy
@@ -52,7 +52,7 @@ for(int i=0; i < P.length; ++i){
path3 p=arc(O,P[i][0],P[i][k+1]);
return point(p,reltime(p,1/3));
},5);
- pentagon.cyclic(true);
+ pentagon.cyclic=true;
draw(sequence(new path3(int k) {
return arc(O,pentagon[k],pentagon[k+1]);},5),linewidth(2pt));
triple M=unit(sum(pentagon)/5);
@@ -75,7 +75,7 @@ for(int i=0; i < P.length; ++i){
point(p[1],reltime(p[1],2/3)),
point(p[2],reltime(p[2],1/3)),
point(p[2],reltime(p[2],2/3))};
- hexagon.cyclic(true);
+ hexagon.cyclic=true;
triple M=unit(sum(hexagon)/6);
for(int i=0; i < 6; ++i){
surface sf=sphericaltriangle(O,hexagon[i],M,hexagon[i+1]);
diff --git a/Build/source/utils/asymptote/examples/spectrum.asy b/Build/source/utils/asymptote/examples/spectrum.asy
new file mode 100644
index 00000000000..efbc6752e2a
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/spectrum.asy
@@ -0,0 +1,79 @@
+import graph;
+usepackage("ocg");
+settings.tex="pdflatex";
+
+// Dan Burton algorithm
+pen nm2rgb(real wl, real gamma=0.8, bool intensity=true) {
+ triple rgb;
+ if(wl >= 380 && wl <= 440) {rgb=((440-wl)/60,0,1);}
+ if(wl > 440 && wl <= 490) {rgb=(0,(wl-440)/50,1);}
+ if(wl > 490 && wl <= 510) {rgb=(0,1,(510-wl)/20);}
+ if(wl > 510 && wl <= 580) {rgb=((wl-510)/70,1,0);}
+ if(wl > 580 && wl <= 645) {rgb=(1,(645-wl)/65,0);}
+ if(wl > 645 && wl <= 780) {rgb=(1,0,0);}
+
+ real Intensity=1;
+ if(intensity) {
+ if(wl >= 700) {Intensity=0.3+0.7*(780-wl)/80;}
+ else if(wl <= 420) {Intensity=0.3+0.7*(wl-380)/40;}
+ }
+
+ return rgb((Intensity*rgb.x)**gamma,(Intensity*rgb.y)**gamma,
+ (Intensity*rgb.z)**gamma);
+}
+
+real width=1;
+real height=50;
+
+begin("spectrum");
+for(real i=380 ; i <= 780 ; i += width) {
+ draw((i,0)--(i,height),width+nm2rgb(wl=i,false)+squarecap);
+}
+begin("Extinction",false); // nested
+for(real i=380 ; i <= 780 ; i += width) {
+ draw((i,0)--(i,height),width+nm2rgb(wl=i,true)+squarecap);
+}
+end();
+end();
+
+begin("Wavelength");
+xaxis(scale(0.5)*"$\lambda$(nm)",BottomTop,380,780,
+ RightTicks(scale(0.5)*rotate(90)*Label(),step=2,Step=10),above=true);
+end();
+
+// From Astronomical Data Center(NASA)
+// Neutral only
+real[] Na={423.899, 424.208, 427.364, 427.679, 428.784, 429.101,
+ 432.14, 432.462, 434.149, 434.474, 439.003, 439.334, 441.989, 442.325,
+ 449.418, 449.766, 454.163, 454.519, 568.2633, 568.8204, 588.995,
+ 589.5924};
+begin("Na absorption");
+for(int i=0; i < Na.length; ++i) {
+ draw((Na[i],0)--(Na[i],height),0.1*width+squarecap);
+}
+end();
+
+begin("Na emission");
+for(int i=0; i < Na.length; ++i) {
+ draw((Na[i],0)--(Na[i],-height),0.1*width+nm2rgb(Na[i],false)+squarecap);
+}
+end();
+
+// Neutral only
+real[] Zn={388.334, 396.543, 411.321, 429.288, 429.833, 462.981,
+ 468.014, 472.215, 481.053 , 506.866, 506.958, 518.198, 530.865,
+ 531.024, 531.102, 577.21, 577.55, 577.711, 623.79, 623.917, 636.234,
+ 647.918, 692.832, 693.847, 694.32, 779.936};
+begin("Zn absorption",false);
+for(int i=0; i < Zn.length; ++i) {
+ draw((Zn[i],0)--(Zn[i],height),width+squarecap);
+}
+end();
+
+begin("Zn emission",false);
+for(int i=0; i < Zn.length; ++i) {
+ draw((Zn[i],0)--(Zn[i],-height),width+nm2rgb(Zn[i],false)+squarecap);
+}
+end();
+
+shipout(bbox(2mm,Fill(white)));
diff --git a/Build/source/utils/asymptote/examples/sphericalharmonic.asy b/Build/source/utils/asymptote/examples/sphericalharmonic.asy
index 1df89959f33..d89d81aee86 100644
--- a/Build/source/utils/asymptote/examples/sphericalharmonic.asy
+++ b/Build/source/utils/asymptote/examples/sphericalharmonic.asy
@@ -3,6 +3,7 @@ import palette;
size(200);
currentprojection=orthographic(4,2,4);
+currentlight=Viewport;
real r(real theta, real phi) {return 1+0.5*(sin(2*theta)*sin(2*phi))^2;}
diff --git a/Build/source/utils/asymptote/examples/spiral3.asy b/Build/source/utils/asymptote/examples/spiral3.asy
new file mode 100644
index 00000000000..cea9665a951
--- /dev/null
+++ b/Build/source/utils/asymptote/examples/spiral3.asy
@@ -0,0 +1,19 @@
+import graph3;
+import palette;
+
+size3(10cm);
+
+currentprojection=orthographic(5,4,2);
+
+real r(real t) {return 3exp(-0.1*t);}
+real x(real t) {return r(t)*cos(t);}
+real y(real t) {return r(t)*sin(t);}
+real z(real t) {return t;}
+
+path3 p=graph(x,y,z,0,6*pi,50,operator ..);
+
+tube T=tube(p,2);
+surface s=T.s;
+s.colors(palette(s.map(zpart),BWRainbow()));
+draw(s);
+draw(T.center,thin());
diff --git a/Build/source/utils/asymptote/examples/teapot.asy b/Build/source/utils/asymptote/examples/teapot.asy
index 2fb6b9b0873..9ec5b0cb370 100644
--- a/Build/source/utils/asymptote/examples/teapot.asy
+++ b/Build/source/utils/asymptote/examples/teapot.asy
@@ -3,200 +3,169 @@ import three;
size(20cm);
currentprojection=perspective(250,-250,250);
-//currentlight=White;
+currentlight=Viewport;
triple[][][] Q={
{
- {(39.68504,0.0,68.03150),(39.68504,-22.22362,68.03150),(22.22362,-39.68504,68.03150),(0.0,-39.68504,68.03150)},
- {(37.91339,0.0,71.75197),(37.91339,-21.23150,71.75197),(21.23150,-37.91339,71.75197),(0.0,-37.91339,71.75197)},
- {(40.74803,0.0,71.75197),(40.74803,-22.81890,71.75197),(22.81890,-40.74803,71.75197),(0.0,-40.74803,71.75197)},
- {(42.51969,0.0,68.03150),(42.51969,-23.81102,68.03150),(23.81102,-42.51969,68.03150),(0.0,-42.51969,68.03150)},
- },
- {
- {(0.0,-39.68504,68.03150),(-22.22362,-39.68504,68.03150),(-39.68504,-22.22362,68.03150),(-39.68504,0.0,68.03150)},
- {(0.0,-37.91339,71.75197),(-21.23150,-37.91339,71.75197),(-37.91339,-21.23150,71.75197),(-37.91339,0.0,71.75197)},
- {(0.0,-40.74803,71.75197),(-22.81890,-40.74803,71.75197),(-40.74803,-22.81890,71.75197),(-40.74803,0.0,71.75197)},
- {(0.0,-42.51969,68.03150),(-23.81102,-42.51969,68.03150),(-42.51969,-23.81102,68.03150),(-42.51969,0.0,68.03150)},
- },
- {
- {(-39.68504,0.0,68.03150),(-39.68504,22.22362,68.03150),(-22.22362,39.68504,68.03150),(0.0,39.68504,68.03150)},
- {(-37.91339,0.0,71.75197),(-37.91339,21.23150,71.75197),(-21.23150,37.91339,71.75197),(0.0,37.91339,71.75197)},
- {(-40.74803,0.0,71.75197),(-40.74803,22.81890,71.75197),(-22.81890,40.74803,71.75197),(0.0,40.74803,71.75197)},
- {(-42.51969,0.0,68.03150),(-42.51969,23.81102,68.03150),(-23.81102,42.51969,68.03150),(0.0,42.51969,68.03150)},
- },
- {
- {(0.0,39.68504,68.03150),(22.22362,39.68504,68.03150),(39.68504,22.22362,68.03150),(39.68504,0.0,68.03150)},
- {(0.0,37.91339,71.75197),(21.23150,37.91339,71.75197),(37.91339,21.23150,71.75197),(37.91339,0.0,71.75197)},
- {(0.0,40.74803,71.75197),(22.81890,40.74803,71.75197),(40.74803,22.81890,71.75197),(40.74803,0.0,71.75197)},
- {(0.0,42.51969,68.03150),(23.81102,42.51969,68.03150),(42.51969,23.81102,68.03150),(42.51969,0.0,68.03150)},
- },
- {
- {(42.51969,0.0,68.03150),(42.51969,-23.81102,68.03150),(23.81102,-42.51969,68.03150),(0.0,-42.51969,68.03150)},
- {(49.60629,0.0,53.14960),(49.60629,-27.77952,53.14960),(27.77952,-49.60629,53.14960),(0.0,-49.60629,53.14960)},
- {(56.69291,0.0,38.26771),(56.69291,-31.74803,38.26771),(31.74803,-56.69291,38.26771),(0.0,-56.69291,38.26771)},
- {(56.69291,0.0,25.51181),(56.69291,-31.74803,25.51181),(31.74803,-56.69291,25.51181),(0.0,-56.69291,25.51181)},
- },
- {
- {(0.0,-42.51969,68.03150),(-23.81102,-42.51969,68.03150),(-42.51969,-23.81102,68.03150),(-42.51969,0.0,68.03150)},
- {(0.0,-49.60629,53.14960),(-27.77952,-49.60629,53.14960),(-49.60629,-27.77952,53.14960),(-49.60629,0.0,53.14960)},
- {(0.0,-56.69291,38.26771),(-31.74803,-56.69291,38.26771),(-56.69291,-31.74803,38.26771),(-56.69291,0.0,38.26771)},
- {(0.0,-56.69291,25.51181),(-31.74803,-56.69291,25.51181),(-56.69291,-31.74803,25.51181),(-56.69291,0.0,25.51181)},
- },
- {
- {(-42.51969,0.0,68.03150),(-42.51969,23.81102,68.03150),(-23.81102,42.51969,68.03150),(0.0,42.51969,68.03150)},
- {(-49.60629,0.0,53.14960),(-49.60629,27.77952,53.14960),(-27.77952,49.60629,53.14960),(0.0,49.60629,53.14960)},
- {(-56.69291,0.0,38.26771),(-56.69291,31.74803,38.26771),(-31.74803,56.69291,38.26771),(0.0,56.69291,38.26771)},
- {(-56.69291,0.0,25.51181),(-56.69291,31.74803,25.51181),(-31.74803,56.69291,25.51181),(0.0,56.69291,25.51181)},
- },
- {
- {(0.0,42.51969,68.03150),(23.81102,42.51969,68.03150),(42.51969,23.81102,68.03150),(42.51969,0.0,68.03150)},
- {(0.0,49.60629,53.14960),(27.77952,49.60629,53.14960),(49.60629,27.77952,53.14960),(49.60629,0.0,53.14960)},
- {(0.0,56.69291,38.26771),(31.74803,56.69291,38.26771),(56.69291,31.74803,38.26771),(56.69291,0.0,38.26771)},
- {(0.0,56.69291,25.51181),(31.74803,56.69291,25.51181),(56.69291,31.74803,25.51181),(56.69291,0.0,25.51181)},
- },
- {
- {(56.69291,0.0,25.51181),(56.69291,-31.74803,25.51181),(31.74803,-56.69291,25.51181),(0.0,-56.69291,25.51181)},
- {(56.69291,0.0,12.75590),(56.69291,-31.74803,12.75590),(31.74803,-56.69291,12.75590),(0.0,-56.69291,12.75590)},
- {(42.51969,0.0,6.377957),(42.51969,-23.81102,6.377957),(23.81102,-42.51969,6.377957),(0.0,-42.51969,6.377957)},
- {(42.51969,0.0,4.251961),(42.51969,-23.81102,4.251961),(23.81102,-42.51969,4.251961),(0.0,-42.51969,4.251961)},
- },
- {
- {(0.0,-56.69291,25.51181),(-31.74803,-56.69291,25.51181),(-56.69291,-31.74803,25.51181),(-56.69291,0.0,25.51181)},
- {(0.0,-56.69291,12.75590),(-31.74803,-56.69291,12.75590),(-56.69291,-31.74803,12.75590),(-56.69291,0.0,12.75590)},
- {(0.0,-42.51969,6.377957),(-23.81102,-42.51969,6.377957),(-42.51969,-23.81102,6.377957),(-42.51969,0.0,6.377957)},
- {(0.0,-42.51969,4.251961),(-23.81102,-42.51969,4.251961),(-42.51969,-23.81102,4.251961),(-42.51969,0.0,4.251961)},
- },
- {
- {(-56.69291,0.0,25.51181),(-56.69291,31.74803,25.51181),(-31.74803,56.69291,25.51181),(0.0,56.69291,25.51181)},
- {(-56.69291,0.0,12.75590),(-56.69291,31.74803,12.75590),(-31.74803,56.69291,12.75590),(0.0,56.69291,12.75590)},
- {(-42.51969,0.0,6.377957),(-42.51969,23.81102,6.377957),(-23.81102,42.51969,6.377957),(0.0,42.51969,6.377957)},
- {(-42.51969,0.0,4.251961),(-42.51969,23.81102,4.251961),(-23.81102,42.51969,4.251961),(0.0,42.51969,4.251961)},
- },
- {
- {(0.0,56.69291,25.51181),(31.74803,56.69291,25.51181),(56.69291,31.74803,25.51181),(56.69291,0.0,25.51181)},
- {(0.0,56.69291,12.75590),(31.74803,56.69291,12.75590),(56.69291,31.74803,12.75590),(56.69291,0.0,12.75590)},
- {(0.0,42.51969,6.377957),(23.81102,42.51969,6.377957),(42.51969,23.81102,6.377957),(42.51969,0.0,6.377957)},
- {(0.0,42.51969,4.251961),(23.81102,42.51969,4.251961),(42.51969,23.81102,4.251961),(42.51969,0.0,4.251961)},
- },
- {
- {(-45.35433,0.0,57.40157),(-45.35433,-8.503932,57.40157),(-42.51969,-8.503932,63.77952),(-42.51969,0.0,63.77952)},
- {(-65.19685,0.0,57.40157),(-65.19685,-8.503932,57.40157),(-70.86614,-8.503932,63.77952),(-70.86614,0.0,63.77952)},
- {(-76.53543,0.0,57.40157),(-76.53543,-8.503932,57.40157),(-85.03937,-8.503932,63.77952),(-85.03937,0.0,63.77952)},
- {(-76.53543,0.0,51.02362),(-76.53543,-8.503932,51.02362),(-85.03937,-8.503932,51.02362),(-85.03937,0.0,51.02362)},
- },
- {
- {(-42.51969,0.0,63.77952),(-42.51969,8.503932,63.77952),(-45.35433,8.503932,57.40157),(-45.35433,0.0,57.40157)},
- {(-70.86614,0.0,63.77952),(-70.86614,8.503932,63.77952),(-65.19685,8.503932,57.40157),(-65.19685,0.0,57.40157)},
- {(-85.03937,0.0,63.77952),(-85.03937,8.503932,63.77952),(-76.53543,8.503932,57.40157),(-76.53543,0.0,57.40157)},
- {(-85.03937,0.0,51.02362),(-85.03937,8.503932,51.02362),(-76.53543,8.503932,51.02362),(-76.53543,0.0,51.02362)},
- },
- {
- {(-76.53543,0.0,51.02362),(-76.53543,-8.503932,51.02362),(-85.03937,-8.503932,51.02362),(-85.03937,0.0,51.02362)},
- {(-76.53543,0.0,44.64566),(-76.53543,-8.503932,44.64566),(-85.03937,-8.503932,38.26771),(-85.03937,0.0,38.26771)},
- {(-70.86614,0.0,31.88976),(-70.86614,-8.503932,31.88976),(-75.11811,-8.503932,26.57480),(-75.11811,0.0,26.57480)},
- {(-56.69291,0.0,25.51181),(-56.69291,-8.503932,25.51181),(-53.85826,-8.503932,17.00787),(-53.85826,0.0,17.00787)},
- },
- {
- {(-85.03937,0.0,51.02362),(-85.03937,8.503932,51.02362),(-76.53543,8.503932,51.02362),(-76.53543,0.0,51.02362)},
- {(-85.03937,0.0,38.26771),(-85.03937,8.503932,38.26771),(-76.53543,8.503932,44.64566),(-76.53543,0.0,44.64566)},
- {(-75.11811,0.0,26.57480),(-75.11811,8.503932,26.57480),(-70.86614,8.503932,31.88976),(-70.86614,0.0,31.88976)},
- {(-53.85826,0.0,17.00787),(-53.85826,8.503932,17.00787),(-56.69291,8.503932,25.51181),(-56.69291,0.0,25.51181)},
- },
- {
- {(48.18897,0.0,40.39370),(48.18897,-18.70866,40.39370),(48.18897,-18.70866,17.00787),(48.18897,0.0,17.00787)},
- {(73.70078,0.0,40.39370),(73.70078,-18.70866,40.39370),(87.87401,-18.70866,23.38582),(87.87401,0.0,23.38582)},
- {(65.19685,0.0,59.52755),(65.19685,-7.086619,59.52755),(68.03150,-7.086619,57.40157),(68.03150,0.0,57.40157)},
- {(76.53543,0.0,68.03150),(76.53543,-7.086619,68.03150),(93.54330,-7.086619,68.03150),(93.54330,0.0,68.03150)},
- },
- {
- {(48.18897,0.0,17.00787),(48.18897,18.70866,17.00787),(48.18897,18.70866,40.39370),(48.18897,0.0,40.39370)},
- {(87.87401,0.0,23.38582),(87.87401,18.70866,23.38582),(73.70078,18.70866,40.39370),(73.70078,0.0,40.39370)},
- {(68.03150,0.0,57.40157),(68.03150,7.086619,57.40157),(65.19685,7.086619,59.52755),(65.19685,0.0,59.52755)},
- {(93.54330,0.0,68.03150),(93.54330,7.086619,68.03150),(76.53543,7.086619,68.03150),(76.53543,0.0,68.03150)},
- },
- {
- {(76.53543,0.0,68.03150),(76.53543,-7.086619,68.03150),(93.54330,-7.086619,68.03150),(93.54330,0.0,68.03150)},
- {(79.37007,0.0,70.15748),(79.37007,-7.086619,70.15748),(99.92125,-7.086619,70.68897),(99.92125,0.0,70.68897)},
- {(82.20472,0.0,70.15748),(82.20472,-4.251961,70.15748),(97.79527,-4.251961,71.22047),(97.79527,0.0,71.22047)},
- {(79.37007,0.0,68.03150),(79.37007,-4.251961,68.03150),(90.70866,-4.251961,68.03150),(90.70866,0.0,68.03150)},
- },
- {
- {(93.54330,0.0,68.03150),(93.54330,7.086619,68.03150),(76.53543,7.086619,68.03150),(76.53543,0.0,68.03150)},
- {(99.92125,0.0,70.68897),(99.92125,7.086619,70.68897),(79.37007,7.086619,70.15748),(79.37007,0.0,70.15748)},
- {(97.79527,0.0,71.22047),(97.79527,4.251961,71.22047),(82.20472,4.251961,70.15748),(82.20472,0.0,70.15748)},
- {(90.70866,0.0,68.03150),(90.70866,4.251961,68.03150),(79.37007,4.251961,68.03150),(79.37007,0.0,68.03150)},
- },
- {
- {(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133)},
- {(22.67716,0.0,89.29133),(22.67716,-12.75590,89.29133),(12.75590,-22.67716,89.29133),(0.0,-22.67716,89.29133)},
- {(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740)},
- {(5.669294,0.0,76.53543),(5.669294,-3.174809,76.53543),(3.174809,-5.669294,76.53543),(0.0,-5.669294,76.53543)},
- },
- {
- {(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133)},
- {(0.0,-22.67716,89.29133),(-12.75590,-22.67716,89.29133),(-22.67716,-12.75590,89.29133),(-22.67716,0.0,89.29133)},
- {(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740)},
- {(0.0,-5.669294,76.53543),(-3.174809,-5.669294,76.53543),(-5.669294,-3.174809,76.53543),(-5.669294,0.0,76.53543)},
- },
- {
- {(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133)},
- {(-22.67716,0.0,89.29133),(-22.67716,12.75590,89.29133),(-12.75590,22.67716,89.29133),(0.0,22.67716,89.29133)},
- {(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740)},
- {(-5.669294,0.0,76.53543),(-5.669294,3.174809,76.53543),(-3.174809,5.669294,76.53543),(0.0,5.669294,76.53543)},
- },
- {
- {(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133),(0.0,0.0,89.29133)},
- {(0.0,22.67716,89.29133),(12.75590,22.67716,89.29133),(22.67716,12.75590,89.29133),(22.67716,0.0,89.29133)},
- {(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740),(0.0,0.0,80.78740)},
- {(0.0,5.669294,76.53543),(3.174809,5.669294,76.53543),(5.669294,3.174809,76.53543),(5.669294,0.0,76.53543)},
- },
- {
- {(5.669294,0.0,76.53543),(5.669294,-3.174809,76.53543),(3.174809,-5.669294,76.53543),(0.0,-5.669294,76.53543)},
- {(11.33858,0.0,72.28346),(11.33858,-6.349609,72.28346),(6.349609,-11.33858,72.28346),(0.0,-11.33858,72.28346)},
- {(36.85039,0.0,72.28346),(36.85039,-20.63622,72.28346),(20.63622,-36.85039,72.28346),(0.0,-36.85039,72.28346)},
- {(36.85039,0.0,68.03150),(36.85039,-20.63622,68.03150),(20.63622,-36.85039,68.03150),(0.0,-36.85039,68.03150)},
- },
- {
- {(0.0,-5.669294,76.53543),(-3.174809,-5.669294,76.53543),(-5.669294,-3.174809,76.53543),(-5.669294,0.0,76.53543)},
- {(0.0,-11.33858,72.28346),(-6.349609,-11.33858,72.28346),(-11.33858,-6.349609,72.28346),(-11.33858,0.0,72.28346)},
- {(0.0,-36.85039,72.28346),(-20.63622,-36.85039,72.28346),(-36.85039,-20.63622,72.28346),(-36.85039,0.0,72.28346)},
- {(0.0,-36.85039,68.03150),(-20.63622,-36.85039,68.03150),(-36.85039,-20.63622,68.03150),(-36.85039,0.0,68.03150)},
- },
- {
- {(-5.669294,0.0,76.53543),(-5.669294,3.174809,76.53543),(-3.174809,5.669294,76.53543),(0.0,5.669294,76.53543)},
- {(-11.33858,0.0,72.28346),(-11.33858,6.349609,72.28346),(-6.349609,11.33858,72.28346),(0.0,11.33858,72.28346)},
- {(-36.85039,0.0,72.28346),(-36.85039,20.63622,72.28346),(-20.63622,36.85039,72.28346),(0.0,36.85039,72.28346)},
- {(-36.85039,0.0,68.03150),(-36.85039,20.63622,68.03150),(-20.63622,36.85039,68.03150),(0.0,36.85039,68.03150)},
- },
- {
- {(0.0,5.669294,76.53543),(3.174809,5.669294,76.53543),(5.669294,3.174809,76.53543),(5.669294,0.0,76.53543)},
- {(0.0,11.33858,72.28346),(6.349609,11.33858,72.28346),(11.33858,6.349609,72.28346),(11.33858,0.0,72.28346)},
- {(0.0,36.85039,72.28346),(20.63622,36.85039,72.28346),(36.85039,20.63622,72.28346),(36.85039,0.0,72.28346)},
- {(0.0,36.85039,68.03150),(20.63622,36.85039,68.03150),(36.85039,20.63622,68.03150),(36.85039,0.0,68.03150)},
- },
- {
- {(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0)},
- {(40.39370,0.0,0.0),(40.39370,22.62047,0.0),(22.62047,40.39370,0.0),(0.0,40.39370,0.0)},
- {(42.51969,0.0,2.12598),(42.51969,23.81102,2.12598),(23.81102,42.51969,2.12598),(0.0,42.51969,2.12598)},
- {(42.51969,0.0,4.251961),(42.51969,23.81102,4.251961),(23.81102,42.51969,4.251961),(0.0,42.51969,4.251961)},
- },
- {
- {(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0)},
- {(0.0,40.39370,0.0),(-22.62047,40.39370,0.0),(-40.39370,22.62047,0.0),(-40.39370,0.0,0.0)},
- {(0.0,42.51969,2.12598),(-23.81102,42.51969,2.12598),(-42.51969,23.81102,2.12598),(-42.51969,0.0,2.12598)},
- {(0.0,42.51969,4.251961),(-23.81102,42.51969,4.251961),(-42.51969,23.81102,4.251961),(-42.51969,0.0,4.251961)},
- },
- {
- {(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0)},
- {(-40.39370,0.0,0.0),(-40.39370,-22.62047,0.0),(-22.62047,-40.39370,0.0),(0.0,-40.39370,0.0)},
- {(-42.51969,0.0,2.12598),(-42.51969,-23.81102,2.12598),(-23.81102,-42.51969,2.12598),(0.0,-42.51969,2.12598)},
- {(-42.51969,0.0,4.251961),(-42.51969,-23.81102,4.251961),(-23.81102,-42.51969,4.251961),(0.0,-42.51969,4.251961)},
- },
- {
- {(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0),(0.0,0.0,0.0)},
- {(0.0,-40.39370,0.0),(22.62047,-40.39370,0.0),(40.39370,-22.62047,0.0),(40.39370,0.0,0.0)},
- {(0.0,-42.51969,2.12598),(23.81102,-42.51969,2.12598),(42.51969,-23.81102,2.12598),(42.51969,0.0,2.12598)},
- {(0.0,-42.51969,4.251961),(23.81102,-42.51969,4.251961),(42.51969,-23.81102,4.251961),(42.51969,0.0,4.251961)},
+ {(39.68504,0,68.0315),(37.91339,0,71.75197),(40.74803,0,71.75197),(42.51969,0,68.0315)},
+ {(39.68504,-22.22362,68.0315),(37.91339,-21.2315,71.75197),(40.74803,-22.8189,71.75197),(42.51969,-23.81102,68.0315)},
+ {(22.22362,-39.68504,68.0315),(21.2315,-37.91339,71.75197),(22.8189,-40.74803,71.75197),(23.81102,-42.51969,68.0315)},
+ {(0,-39.68504,68.0315),(0,-37.91339,71.75197),(0,-40.74803,71.75197),(0,-42.51969,68.0315)}
+ },{
+ {(0,-39.68504,68.0315),(0,-37.91339,71.75197),(0,-40.74803,71.75197),(0,-42.51969,68.0315)},
+ {(-22.22362,-39.68504,68.0315),(-21.2315,-37.91339,71.75197),(-22.8189,-40.74803,71.75197),(-23.81102,-42.51969,68.0315)},
+ {(-39.68504,-22.22362,68.0315),(-37.91339,-21.2315,71.75197),(-40.74803,-22.8189,71.75197),(-42.51969,-23.81102,68.0315)},
+ {(-39.68504,0,68.0315),(-37.91339,0,71.75197),(-40.74803,0,71.75197),(-42.51969,0,68.0315)}
+ },{
+ {(-39.68504,0,68.0315),(-37.91339,0,71.75197),(-40.74803,0,71.75197),(-42.51969,0,68.0315)},
+ {(-39.68504,22.22362,68.0315),(-37.91339,21.2315,71.75197),(-40.74803,22.8189,71.75197),(-42.51969,23.81102,68.0315)},
+ {(-22.22362,39.68504,68.0315),(-21.2315,37.91339,71.75197),(-22.8189,40.74803,71.75197),(-23.81102,42.51969,68.0315)},
+ {(0,39.68504,68.0315),(0,37.91339,71.75197),(0,40.74803,71.75197),(0,42.51969,68.0315)}
+ },{
+ {(0,39.68504,68.0315),(0,37.91339,71.75197),(0,40.74803,71.75197),(0,42.51969,68.0315)},
+ {(22.22362,39.68504,68.0315),(21.2315,37.91339,71.75197),(22.8189,40.74803,71.75197),(23.81102,42.51969,68.0315)},
+ {(39.68504,22.22362,68.0315),(37.91339,21.2315,71.75197),(40.74803,22.8189,71.75197),(42.51969,23.81102,68.0315)},
+ {(39.68504,0,68.0315),(37.91339,0,71.75197),(40.74803,0,71.75197),(42.51969,0,68.0315)}
+ },{
+ {(42.51969,0,68.0315),(49.60629,0,53.1496),(56.69291,0,38.26771),(56.69291,0,25.51181)},
+ {(42.51969,-23.81102,68.0315),(49.60629,-27.77952,53.1496),(56.69291,-31.74803,38.26771),(56.69291,-31.74803,25.51181)},
+ {(23.81102,-42.51969,68.0315),(27.77952,-49.60629,53.1496),(31.74803,-56.69291,38.26771),(31.74803,-56.69291,25.51181)},
+ {(0,-42.51969,68.0315),(0,-49.60629,53.1496),(0,-56.69291,38.26771),(0,-56.69291,25.51181)}
+ },{
+ {(0,-42.51969,68.0315),(0,-49.60629,53.1496),(0,-56.69291,38.26771),(0,-56.69291,25.51181)},
+ {(-23.81102,-42.51969,68.0315),(-27.77952,-49.60629,53.1496),(-31.74803,-56.69291,38.26771),(-31.74803,-56.69291,25.51181)},
+ {(-42.51969,-23.81102,68.0315),(-49.60629,-27.77952,53.1496),(-56.69291,-31.74803,38.26771),(-56.69291,-31.74803,25.51181)},
+ {(-42.51969,0,68.0315),(-49.60629,0,53.1496),(-56.69291,0,38.26771),(-56.69291,0,25.51181)}
+ },{
+ {(-42.51969,0,68.0315),(-49.60629,0,53.1496),(-56.69291,0,38.26771),(-56.69291,0,25.51181)},
+ {(-42.51969,23.81102,68.0315),(-49.60629,27.77952,53.1496),(-56.69291,31.74803,38.26771),(-56.69291,31.74803,25.51181)},
+ {(-23.81102,42.51969,68.0315),(-27.77952,49.60629,53.1496),(-31.74803,56.69291,38.26771),(-31.74803,56.69291,25.51181)},
+ {(0,42.51969,68.0315),(0,49.60629,53.1496),(0,56.69291,38.26771),(0,56.69291,25.51181)}
+ },{
+ {(0,42.51969,68.0315),(0,49.60629,53.1496),(0,56.69291,38.26771),(0,56.69291,25.51181)},
+ {(23.81102,42.51969,68.0315),(27.77952,49.60629,53.1496),(31.74803,56.69291,38.26771),(31.74803,56.69291,25.51181)},
+ {(42.51969,23.81102,68.0315),(49.60629,27.77952,53.1496),(56.69291,31.74803,38.26771),(56.69291,31.74803,25.51181)},
+ {(42.51969,0,68.0315),(49.60629,0,53.1496),(56.69291,0,38.26771),(56.69291,0,25.51181)}
+ },{
+ {(56.69291,0,25.51181),(56.69291,0,12.7559),(42.51969,0,6.377957),(42.51969,0,4.251961)},
+ {(56.69291,-31.74803,25.51181),(56.69291,-31.74803,12.7559),(42.51969,-23.81102,6.377957),(42.51969,-23.81102,4.251961)},
+ {(31.74803,-56.69291,25.51181),(31.74803,-56.69291,12.7559),(23.81102,-42.51969,6.377957),(23.81102,-42.51969,4.251961)},
+ {(0,-56.69291,25.51181),(0,-56.69291,12.7559),(0,-42.51969,6.377957),(0,-42.51969,4.251961)}
+ },{
+ {(0,-56.69291,25.51181),(0,-56.69291,12.7559),(0,-42.51969,6.377957),(0,-42.51969,4.251961)},
+ {(-31.74803,-56.69291,25.51181),(-31.74803,-56.69291,12.7559),(-23.81102,-42.51969,6.377957),(-23.81102,-42.51969,4.251961)},
+ {(-56.69291,-31.74803,25.51181),(-56.69291,-31.74803,12.7559),(-42.51969,-23.81102,6.377957),(-42.51969,-23.81102,4.251961)},
+ {(-56.69291,0,25.51181),(-56.69291,0,12.7559),(-42.51969,0,6.377957),(-42.51969,0,4.251961)}
+ },{
+ {(-56.69291,0,25.51181),(-56.69291,0,12.7559),(-42.51969,0,6.377957),(-42.51969,0,4.251961)},
+ {(-56.69291,31.74803,25.51181),(-56.69291,31.74803,12.7559),(-42.51969,23.81102,6.377957),(-42.51969,23.81102,4.251961)},
+ {(-31.74803,56.69291,25.51181),(-31.74803,56.69291,12.7559),(-23.81102,42.51969,6.377957),(-23.81102,42.51969,4.251961)},
+ {(0,56.69291,25.51181),(0,56.69291,12.7559),(0,42.51969,6.377957),(0,42.51969,4.251961)}
+ },{
+ {(0,56.69291,25.51181),(0,56.69291,12.7559),(0,42.51969,6.377957),(0,42.51969,4.251961)},
+ {(31.74803,56.69291,25.51181),(31.74803,56.69291,12.7559),(23.81102,42.51969,6.377957),(23.81102,42.51969,4.251961)},
+ {(56.69291,31.74803,25.51181),(56.69291,31.74803,12.7559),(42.51969,23.81102,6.377957),(42.51969,23.81102,4.251961)},
+ {(56.69291,0,25.51181),(56.69291,0,12.7559),(42.51969,0,6.377957),(42.51969,0,4.251961)}
+ },{
+ {(-45.35433,0,57.40157),(-65.19685,0,57.40157),(-76.53543,0,57.40157),(-76.53543,0,51.02362)},
+ {(-45.35433,-8.503932,57.40157),(-65.19685,-8.503932,57.40157),(-76.53543,-8.503932,57.40157),(-76.53543,-8.503932,51.02362)},
+ {(-42.51969,-8.503932,63.77952),(-70.86614,-8.503932,63.77952),(-85.03937,-8.503932,63.77952),(-85.03937,-8.503932,51.02362)},
+ {(-42.51969,0,63.77952),(-70.86614,0,63.77952),(-85.03937,0,63.77952),(-85.03937,0,51.02362)}
+ },{
+ {(-42.51969,0,63.77952),(-70.86614,0,63.77952),(-85.03937,0,63.77952),(-85.03937,0,51.02362)},
+ {(-42.51969,8.503932,63.77952),(-70.86614,8.503932,63.77952),(-85.03937,8.503932,63.77952),(-85.03937,8.503932,51.02362)},
+ {(-45.35433,8.503932,57.40157),(-65.19685,8.503932,57.40157),(-76.53543,8.503932,57.40157),(-76.53543,8.503932,51.02362)},
+ {(-45.35433,0,57.40157),(-65.19685,0,57.40157),(-76.53543,0,57.40157),(-76.53543,0,51.02362)}
+ },{
+ {(-76.53543,0,51.02362),(-76.53543,0,44.64566),(-70.86614,0,31.88976),(-56.69291,0,25.51181)},
+ {(-76.53543,-8.503932,51.02362),(-76.53543,-8.503932,44.64566),(-70.86614,-8.503932,31.88976),(-56.69291,-8.503932,25.51181)},
+ {(-85.03937,-8.503932,51.02362),(-85.03937,-8.503932,38.26771),(-75.11811,-8.503932,26.5748),(-53.85826,-8.503932,17.00787)},
+ {(-85.03937,0,51.02362),(-85.03937,0,38.26771),(-75.11811,0,26.5748),(-53.85826,0,17.00787)}
+ },{
+ {(-85.03937,0,51.02362),(-85.03937,0,38.26771),(-75.11811,0,26.5748),(-53.85826,0,17.00787)},
+ {(-85.03937,8.503932,51.02362),(-85.03937,8.503932,38.26771),(-75.11811,8.503932,26.5748),(-53.85826,8.503932,17.00787)},
+ {(-76.53543,8.503932,51.02362),(-76.53543,8.503932,44.64566),(-70.86614,8.503932,31.88976),(-56.69291,8.503932,25.51181)},
+ {(-76.53543,0,51.02362),(-76.53543,0,44.64566),(-70.86614,0,31.88976),(-56.69291,0,25.51181)}
+ },{
+ {(48.18897,0,40.3937),(73.70078,0,40.3937),(65.19685,0,59.52755),(76.53543,0,68.0315)},
+ {(48.18897,-18.70866,40.3937),(73.70078,-18.70866,40.3937),(65.19685,-7.086619,59.52755),(76.53543,-7.086619,68.0315)},
+ {(48.18897,-18.70866,17.00787),(87.87401,-18.70866,23.38582),(68.0315,-7.086619,57.40157),(93.5433,-7.086619,68.0315)},
+ {(48.18897,0,17.00787),(87.87401,0,23.38582),(68.0315,0,57.40157),(93.5433,0,68.0315)}
+ },{
+ {(48.18897,0,17.00787),(87.87401,0,23.38582),(68.0315,0,57.40157),(93.5433,0,68.0315)},
+ {(48.18897,18.70866,17.00787),(87.87401,18.70866,23.38582),(68.0315,7.086619,57.40157),(93.5433,7.086619,68.0315)},
+ {(48.18897,18.70866,40.3937),(73.70078,18.70866,40.3937),(65.19685,7.086619,59.52755),(76.53543,7.086619,68.0315)},
+ {(48.18897,0,40.3937),(73.70078,0,40.3937),(65.19685,0,59.52755),(76.53543,0,68.0315)}
+ },{
+ {(76.53543,0,68.0315),(79.37007,0,70.15748),(82.20472,0,70.15748),(79.37007,0,68.0315)},
+ {(76.53543,-7.086619,68.0315),(79.37007,-7.086619,70.15748),(82.20472,-4.251961,70.15748),(79.37007,-4.251961,68.0315)},
+ {(93.5433,-7.086619,68.0315),(99.92125,-7.086619,70.68897),(97.79527,-4.251961,71.22047),(90.70866,-4.251961,68.0315)},
+ {(93.5433,0,68.0315),(99.92125,0,70.68897),(97.79527,0,71.22047),(90.70866,0,68.0315)}
+ },{
+ {(93.5433,0,68.0315),(99.92125,0,70.68897),(97.79527,0,71.22047),(90.70866,0,68.0315)},
+ {(93.5433,7.086619,68.0315),(99.92125,7.086619,70.68897),(97.79527,4.251961,71.22047),(90.70866,4.251961,68.0315)},
+ {(76.53543,7.086619,68.0315),(79.37007,7.086619,70.15748),(82.20472,4.251961,70.15748),(79.37007,4.251961,68.0315)},
+ {(76.53543,0,68.0315),(79.37007,0,70.15748),(82.20472,0,70.15748),(79.37007,0,68.0315)}
+ },{
+ {(0,0,89.29133),(22.67716,0,89.29133),(0,0,80.7874),(5.669294,0,76.53543)},
+ {(0,0,89.29133),(22.67716,-12.7559,89.29133),(0,0,80.7874),(5.669294,-3.174809,76.53543)},
+ {(0,0,89.29133),(12.7559,-22.67716,89.29133),(0,0,80.7874),(3.174809,-5.669294,76.53543)},
+ {(0,0,89.29133),(0,-22.67716,89.29133),(0,0,80.7874),(0,-5.669294,76.53543)}
+ },{
+ {(0,0,89.29133),(0,-22.67716,89.29133),(0,0,80.7874),(0,-5.669294,76.53543)},
+ {(0,0,89.29133),(-12.7559,-22.67716,89.29133),(0,0,80.7874),(-3.174809,-5.669294,76.53543)},
+ {(0,0,89.29133),(-22.67716,-12.7559,89.29133),(0,0,80.7874),(-5.669294,-3.174809,76.53543)},
+ {(0,0,89.29133),(-22.67716,0,89.29133),(0,0,80.7874),(-5.669294,0,76.53543)}
+ },{
+ {(0,0,89.29133),(-22.67716,0,89.29133),(0,0,80.7874),(-5.669294,0,76.53543)},
+ {(0,0,89.29133),(-22.67716,12.7559,89.29133),(0,0,80.7874),(-5.669294,3.174809,76.53543)},
+ {(0,0,89.29133),(-12.7559,22.67716,89.29133),(0,0,80.7874),(-3.174809,5.669294,76.53543)},
+ {(0,0,89.29133),(0,22.67716,89.29133),(0,0,80.7874),(0,5.669294,76.53543)}
+ },{
+ {(0,0,89.29133),(0,22.67716,89.29133),(0,0,80.7874),(0,5.669294,76.53543)},
+ {(0,0,89.29133),(12.7559,22.67716,89.29133),(0,0,80.7874),(3.174809,5.669294,76.53543)},
+ {(0,0,89.29133),(22.67716,12.7559,89.29133),(0,0,80.7874),(5.669294,3.174809,76.53543)},
+ {(0,0,89.29133),(22.67716,0,89.29133),(0,0,80.7874),(5.669294,0,76.53543)}
+ },{
+ {(5.669294,0,76.53543),(11.33858,0,72.28346),(36.85039,0,72.28346),(36.85039,0,68.0315)},
+ {(5.669294,-3.174809,76.53543),(11.33858,-6.349609,72.28346),(36.85039,-20.63622,72.28346),(36.85039,-20.63622,68.0315)},
+ {(3.174809,-5.669294,76.53543),(6.349609,-11.33858,72.28346),(20.63622,-36.85039,72.28346),(20.63622,-36.85039,68.0315)},
+ {(0,-5.669294,76.53543),(0,-11.33858,72.28346),(0,-36.85039,72.28346),(0,-36.85039,68.0315)}
+ },{
+ {(0,-5.669294,76.53543),(0,-11.33858,72.28346),(0,-36.85039,72.28346),(0,-36.85039,68.0315)},
+ {(-3.174809,-5.669294,76.53543),(-6.349609,-11.33858,72.28346),(-20.63622,-36.85039,72.28346),(-20.63622,-36.85039,68.0315)},
+ {(-5.669294,-3.174809,76.53543),(-11.33858,-6.349609,72.28346),(-36.85039,-20.63622,72.28346),(-36.85039,-20.63622,68.0315)},
+ {(-5.669294,0,76.53543),(-11.33858,0,72.28346),(-36.85039,0,72.28346),(-36.85039,0,68.0315)},
+ },{
+ {(-5.669294,0,76.53543),(-11.33858,0,72.28346),(-36.85039,0,72.28346),(-36.85039,0,68.0315)},
+ {(-5.669294,3.174809,76.53543),(-11.33858,6.349609,72.28346),(-36.85039,20.63622,72.28346),(-36.85039,20.63622,68.0315)},
+ {(-3.174809,5.669294,76.53543),(-6.349609,11.33858,72.28346),(-20.63622,36.85039,72.28346),(-20.63622,36.85039,68.0315)},
+ {(0,5.669294,76.53543),(0,11.33858,72.28346),(0,36.85039,72.28346),(0,36.85039,68.0315)}
+ },{
+ {(0,5.669294,76.53543),(0,11.33858,72.28346),(0,36.85039,72.28346),(0,36.85039,68.0315)},
+ {(3.174809,5.669294,76.53543),(6.349609,11.33858,72.28346),(20.63622,36.85039,72.28346),(20.63622,36.85039,68.0315)},
+ {(5.669294,3.174809,76.53543),(11.33858,6.349609,72.28346),(36.85039,20.63622,72.28346),(36.85039,20.63622,68.0315)},
+ {(5.669294,0,76.53543),(11.33858,0,72.28346),(36.85039,0,72.28346),(36.85039,0,68.0315)},
+ },{
+ {(0,0,0),(40.3937,0,0),(42.51969,0,2.12598),(42.51969,0,4.251961)},
+ {(0,0,0),(40.3937,22.62047,0),(42.51969,23.81102,2.12598),(42.51969,23.81102,4.251961)},
+ {(0,0,0),(22.62047,40.3937,0),(23.81102,42.51969,2.12598),(23.81102,42.51969,4.251961)},
+ {(0,0,0),(0,40.3937,0),(0,42.51969,2.12598),(0,42.51969,4.251961)}
+ },{
+ {(0,0,0),(0,40.3937,0),(0,42.51969,2.12598),(0,42.51969,4.251961)},
+ {(0,0,0),(-22.62047,40.3937,0),(-23.81102,42.51969,2.12598),(-23.81102,42.51969,4.251961)},
+ {(0,0,0),(-40.3937,22.62047,0),(-42.51969,23.81102,2.12598),(-42.51969,23.81102,4.251961)},
+ {(0,0,0),(-40.3937,0,0),(-42.51969,0,2.12598),(-42.51969,0,4.251961)}
+ },{
+ {(0,0,0),(-40.3937,0,0),(-42.51969,0,2.12598),(-42.51969,0,4.251961)},
+ {(0,0,0),(-40.3937,-22.62047,0),(-42.51969,-23.81102,2.12598),(-42.51969,-23.81102,4.251961)},
+ {(0,0,0),(-22.62047,-40.3937,0),(-23.81102,-42.51969,2.12598),(-23.81102,-42.51969,4.251961)},
+ {(0,0,0),(0,-40.3937,0),(0,-42.51969,2.12598),(0,-42.51969,4.251961)}
+ },{
+ {(0,0,0),(0,-40.3937,0),(0,-42.51969,2.12598),(0,-42.51969,4.251961)},
+ {(0,0,0),(22.62047,-40.3937,0),(23.81102,-42.51969,2.12598),(23.81102,-42.51969,4.251961)},
+ {(0,0,0),(40.3937,-22.62047,0),(42.51969,-23.81102,2.12598),(42.51969,-23.81102,4.251961)},
+ {(0,0,0),(40.3937,0,0),(42.51969,0,2.12598),(42.51969,0,4.251961)}
}
};
diff --git a/Build/source/utils/asymptote/examples/tensor.asy b/Build/source/utils/asymptote/examples/tensor.asy
index 3791b032b92..aa633c4087b 100644
--- a/Build/source/utils/asymptote/examples/tensor.asy
+++ b/Build/source/utils/asymptote/examples/tensor.asy
@@ -1,8 +1,10 @@
size(200);
-pen[][] p={{red,green,blue,cyan},{green,blue,rgb(black),magenta}};
+//pen[][] p={{red,green,blue,cyan},{green,blue,rgb(black),magenta}};
+pen[][] p={{red,green,blue,cyan},{blue,green,magenta,rgb(black)}};
path G=(0,0){dir(-120)}..(1,0)..(1,1)..(0,1)..cycle;
-path[] g={G,subpath(G,1,2)..(2,1)..(2,0)..cycle};
+path[] g={G,subpath(G,2,1)..(2,0)..(2,1)..cycle};
pair[][] z={{(0.5,0.5),(0.5,0.5),(0.5,0.5),(0.5,0.5)},{(2,0.5),(2,0.5),(1.5,0.5),(2,0.5)}};
tensorshade(g,p,z);
+
dot(g);
diff --git a/Build/source/utils/asymptote/examples/torus.asy b/Build/source/utils/asymptote/examples/torus.asy
index e2363f47450..c64c16701ad 100644
--- a/Build/source/utils/asymptote/examples/torus.asy
+++ b/Build/source/utils/asymptote/examples/torus.asy
@@ -3,15 +3,18 @@ import graph3;
currentprojection=perspective(5,4,4);
-//import solids;
-//revolution torus=revolution(shift(3X)*Circle(O,1,Y,32),Z,90,345);
-//draw(surface(torus),green);
-
real R=3;
real a=1;
+/*
+import solids;
+revolution torus=revolution(reverse(Circle(R*X,a,Y,32)),Z,90,345);
+surface s=surface(torus);
+*/
+
triple f(pair t) {
return ((R+a*cos(t.y))*cos(t.x),(R+a*cos(t.y))*sin(t.x),a*sin(t.y));
}
-draw(surface(f,(radians(90),0),(radians(345),2pi),8,8,Spline),green);
+surface s=surface(f,(radians(90),0),(radians(345),2pi),8,8,Spline);
+draw(s,green);
diff --git a/Build/source/utils/asymptote/examples/trumpet.asy b/Build/source/utils/asymptote/examples/trumpet.asy
index 8d48da0c951..032f8a7ffd6 100644
--- a/Build/source/utils/asymptote/examples/trumpet.asy
+++ b/Build/source/utils/asymptote/examples/trumpet.asy
@@ -1,6 +1,8 @@
import graph3;
size(200,0);
+currentlight=Viewport;
+
triple f(pair t) {
return(10*sin(t.y),cos(t.x)*(cos(t.y)+log(abs(tan(t.y/2)))),
sin(t.x)*(cos(t.y)+log(abs(tan(t.y/2)))));
diff --git a/Build/source/utils/asymptote/examples/xsin1x.asy b/Build/source/utils/asymptote/examples/xsin1x.asy
index f03714b79df..e419ba19a69 100644
--- a/Build/source/utils/asymptote/examples/xsin1x.asy
+++ b/Build/source/utils/asymptote/examples/xsin1x.asy
@@ -8,3 +8,11 @@ xaxis("$x$",red);
yaxis(red);
draw(graph(f,-1.2/pi,1.2/pi,1000));
label("$x\sin\frac{1}{x}$",F(1.1/pi),NW);
+
+picture pic;
+size(pic,50,IgnoreAspect);
+xaxis(pic,red);
+yaxis(pic,red);
+draw(pic,graph(pic,f,-0.1/pi,0.1/pi,1000));
+attach(bbox(pic,blue),point(N+0.85W),10SE);
+
diff --git a/Build/source/utils/asymptote/exp.cc b/Build/source/utils/asymptote/exp.cc
index 6ec234212de..cd4bca37ee0 100644
--- a/Build/source/utils/asymptote/exp.cc
+++ b/Build/source/utils/asymptote/exp.cc
@@ -896,7 +896,7 @@ void conditionalExp::transToType(coenv &e, types::ty *target)
em.error(getPos());
em << "cannot cast vectorized conditional to '" << *target << "'";
}
- test->transToType(e, types::boolArray());
+ test->transToType(e, types::booleanArray());
onTrue->transToType(e, target);
onFalse->transToType(e, target);
e.c.encode(inst::builtin, run::arrayConditional);
diff --git a/Build/source/utils/asymptote/frame.h b/Build/source/utils/asymptote/frame.h
index 9f3db9247a4..ee050050061 100644
--- a/Build/source/utils/asymptote/frame.h
+++ b/Build/source/utils/asymptote/frame.h
@@ -21,9 +21,18 @@ class frame : public gc {
size_t numFormals;
Int numLocals;
+#ifdef DEBUG_FRAME
+ string name;
+#endif
+
public:
- frame(frame *parent, size_t numFormals)
- : parent(parent), numFormals(numFormals), numLocals(0) {}
+ frame(string name, frame *parent, size_t numFormals)
+ : parent(parent), numFormals(numFormals), numLocals(0)
+#ifdef DEBUG_FRAME
+ , name(name)
+#endif
+
+ {}
size_t getNumFormals() {
return numFormals;
diff --git a/Build/source/utils/asymptote/fundec.cc b/Build/source/utils/asymptote/fundec.cc
index 016e300321e..232b7550bb7 100644
--- a/Build/source/utils/asymptote/fundec.cc
+++ b/Build/source/utils/asymptote/fundec.cc
@@ -230,8 +230,10 @@ varinit *fundef::makeVarInit(function *ft) {
void fundef::baseTrans(coenv &e, types::function *ft)
{
+ string name = id ? string(*id) : string("<anonymous function>");
+
// Create a new function environment.
- coder fc = e.c.newFunction(ft);
+ coder fc = e.c.newFunction(name, ft);
coenv fe(fc,e.e);
// Translate the function.
diff --git a/Build/source/utils/asymptote/fundec.h b/Build/source/utils/asymptote/fundec.h
index 058bd95e366..98ff2e3f51f 100644
--- a/Build/source/utils/asymptote/fundec.h
+++ b/Build/source/utils/asymptote/fundec.h
@@ -100,10 +100,16 @@ class fundef : public exp {
ty *result;
formals *params;
stm *body;
+
+ // If the fundef is part of a fundec, the name of the function is stored
+ // here for debugging purposes.
+ symbol *id;
+
+ friend class fundec;
public:
fundef(position pos, ty *result, formals *params, stm *body)
- : exp(pos), result(result), params(params), body(body) {}
+ : exp(pos), result(result), params(params), body(body), id(0) {}
virtual void prettyprint(ostream &out, Int indent);
@@ -124,7 +130,8 @@ class fundec : public dec {
public:
fundec(position pos, ty *result, symbol *id, formals *params, stm *body)
- : dec(pos), id(id), fun(pos, result, params, body) {}
+ : dec(pos), id(id), fun(pos, result, params, body)
+ { fun.id = id; }
void prettyprint(ostream &out, Int indent);
diff --git a/Build/source/utils/asymptote/genv.cc b/Build/source/utils/asymptote/genv.cc
index bb0a325d6b5..df223ef4af7 100644
--- a/Build/source/utils/asymptote/genv.cc
+++ b/Build/source/utils/asymptote/genv.cc
@@ -60,7 +60,7 @@ genv::genv()
record *genv::loadModule(symbol *id, string filename) {
// Get the abstract syntax tree.
absyntax::file *ast = parser::parseFile(filename,"Loading");
-
+
inTranslation.push_front(filename);
em.sync();
diff --git a/Build/source/utils/asymptote/genv.h b/Build/source/utils/asymptote/genv.h
index 051b7b6e030..c706f0c109c 100644
--- a/Build/source/utils/asymptote/genv.h
+++ b/Build/source/utils/asymptote/genv.h
@@ -29,7 +29,7 @@ using vm::lambda;
namespace trans {
-class genv {
+class genv : public gc {
// The initializer functions for imports, indexed by filename.
typedef mem::map<CONST string,record *> importMap;
importMap imap;
diff --git a/Build/source/utils/asymptote/glrender.cc b/Build/source/utils/asymptote/glrender.cc
index c08684e2d53..5d8c1c58105 100644
--- a/Build/source/utils/asymptote/glrender.cc
+++ b/Build/source/utils/asymptote/glrender.cc
@@ -8,7 +8,6 @@
#include <fstream>
#include <cstring>
#include <sys/time.h>
-#include <signal.h>
#include "common.h"
@@ -74,6 +73,7 @@ int maxTileHeight;
double *T;
bool Xspin,Yspin,Zspin;
+bool Animate;
bool Menu;
bool Motion;
bool ignorezoom;
@@ -109,6 +109,7 @@ double *Ambient;
double *Specular;
bool ViewportLighting;
bool queueExport=false;
+bool queueScreen=false;
bool readyAfterExport=false;
bool antialias;
@@ -214,20 +215,24 @@ void initlighting()
void setDimensions(int Width, int Height, double X, double Y)
{
double Aspect=((double) Width)/Height;
- double X0=(X/Width*lastzoom+Shift.getx()*Xfactor)*(xmax-xmin);
- double Y0=(Y/Height*lastzoom+Shift.gety()*Yfactor)*(ymax-ymin);
+ double xshift=X/Width*lastzoom+Shift.getx()*Xfactor;
+ double yshift=Y/Height*lastzoom+Shift.gety()*Yfactor;
double Zoominv=1.0/Zoom;
if(orthographic) {
double xsize=Xmax-Xmin;
double ysize=Ymax-Ymin;
if(xsize < ysize*Aspect) {
double r=0.5*ysize*Aspect*Zoominv;
+ double X0=2.0*r*xshift;
+ double Y0=(Ymax-Ymin)*Zoominv*yshift;
xmin=-r-X0;
xmax=r-X0;
ymin=Ymin*Zoominv-Y0;
ymax=Ymax*Zoominv-Y0;
} else {
double r=0.5*xsize/(Aspect*Zoom);
+ double X0=(Xmax-Xmin)*Zoominv*xshift;
+ double Y0=2.0*r*yshift;
xmin=Xmin*Zoominv-X0;
xmax=Xmax*Zoominv-X0;
ymin=-r-Y0;
@@ -235,8 +240,11 @@ void setDimensions(int Width, int Height, double X, double Y)
}
} else {
double r=H*Zoominv;
- xmin=-r*Aspect-X0;
- xmax=r*Aspect-X0;
+ double rAspect=r*Aspect;
+ double X0=2.0*rAspect*xshift;
+ double Y0=2.0*r*yshift;
+ xmin=-rAspect-X0;
+ xmax=rAspect-X0;
ymin=-r-Y0;
ymax=r-Y0;
}
@@ -413,7 +421,7 @@ void windowposition(int& x, int& y, int width=Width, int height=Height)
}
}
-void setsize(int w, int h, int minsize=0)
+void setsize(int w, int h, int minsize=0, bool reposition=true)
{
int x,y;
@@ -430,14 +438,16 @@ void setsize(int w, int h, int minsize=0)
}
capsize(w,h);
- windowposition(x,y,w,h);
- glutPositionWindow(x,y);
+ if(reposition) {
+ windowposition(x,y,w,h);
+ glutPositionWindow(x,y);
+ }
glutReshapeWindow(w,h);
reshape0(w,h);
glutPostRedisplay();
}
-void fullscreen()
+void fullscreen(bool reposition=true)
{
Width=screenWidth;
Height=screenHeight;
@@ -445,19 +455,21 @@ void fullscreen()
#ifdef __CYGWIN__
glutFullScreen();
#else
- glutPositionWindow(0,0);
+ if(reposition)
+ glutPositionWindow(0,0);
glutReshapeWindow(Width,Height);
glutPostRedisplay();
#endif
}
-void fitscreen()
+void fitscreen(bool reposition=true)
{
+ if(Animate && Fitscreen == 2) Fitscreen=0;
switch(Fitscreen) {
case 0: // Original size
{
Xfactor=Yfactor=1.0;
- setsize(oldWidth,oldHeight,minimumsize);
+ setsize(oldWidth,oldHeight,minimumsize,reposition);
break;
}
case 1: // Fit to screen in one dimension
@@ -468,14 +480,14 @@ void fitscreen()
int h=screenHeight;
if(w >= h*Aspect) w=(int) (h*Aspect+0.5);
else h=(int) (w/Aspect+0.5);
- setsize(w,h,minimumsize);
+ setsize(w,h,minimumsize,reposition);
break;
}
case 2: // Full screen
{
Xfactor=((double) screenHeight)/Height;
Yfactor=((double) screenWidth)/Width;
- fullscreen();
+ fullscreen(reposition);
break;
}
}
@@ -490,11 +502,12 @@ void togglefitscreen()
void updateHandler(int)
{
+ queueScreen=true;
update();
- glutShowWindow();
- glutShowWindow(); // Call twice to work around apparent freeglut bug.
- if(glthread && !interact::interactive)
- fitscreen();
+ if(!Animate) {
+ glutShowWindow();
+ glutShowWindow(); // Call twice to work around apparent freeglut bug.
+ }
}
void exportHandler(int=0)
@@ -513,7 +526,7 @@ void reshape(int width, int height)
static bool initialize=true;
if(initialize) {
initialize=false;
- signal(SIGUSR1,updateHandler);
+ Signal(SIGUSR1,updateHandler);
}
}
@@ -540,6 +553,18 @@ void idle()
Xspin=Yspin=Zspin=false;
}
+void animate()
+{
+ Animate=!Animate;
+ if(Animate) {
+ if(Fitscreen == 2) {
+ togglefitscreen();
+ togglefitscreen();
+ }
+ update();
+ }
+}
+
void home()
{
idle();
@@ -555,26 +580,43 @@ void home()
void quit()
{
if(glthread) {
+ Setting("loop")=false;
home();
- glutHideWindow();
- #ifdef HAVE_LIBPTHREAD
+#ifdef HAVE_LIBPTHREAD
if(!interact::interactive)
endwait(readySignal,readyLock);
#endif
+ glutHideWindow();
} else {
glutDestroyWindow(window);
exit(0);
}
}
+void screen()
+{
+ if(glthread && !interact::interactive)
+ fitscreen(false);
+}
+
void display()
{
+ if(queueScreen) {
+ if(!Animate) screen();
+ queueScreen=false;
+ }
drawscene(Width,Height);
glutSwapBuffers();
+#ifdef HAVE_LIBPTHREAD
+ if(glthread && Animate) {
+ queueExport=false;
+ endwait(readySignal,readyLock);
+ }
+#endif
if(queueExport) {
Export();
queueExport=false;
- }
+ }
if(!glthread) {
if(Oldpid != 0 && waitpid(Oldpid,NULL,WNOHANG) != Oldpid) {
kill(Oldpid,SIGHUP);
@@ -1014,11 +1056,11 @@ void camera()
<< "camera=" << Camera << "," << endl
<< "up=" << Up << "," << endl
<< "target=" << Target << "," << endl
- << "zoom=" << Zoom << "," << endl;
+ << "zoom=" << Zoom;
if(!orthographic)
- cout << "angle=" << 2.0*atan(tan(0.5*Angle)/Zoom)/radians << "," << endl;
+ cout << "," << endl << "angle=" << 2.0*atan(tan(0.5*Angle)/Zoom)/radians;
if(viewportshift != pair(0.0,0.0))
- cout << "viewportshift=" << viewportshift;
+ cout << "," << endl << "viewportshift=" << viewportshift;
if(!orthographic)
cout << "," << endl << "autoadjust=false";
cout << ");" << endl;
@@ -1065,6 +1107,9 @@ void keyboard(unsigned char key, int x, int y)
case '<':
shrink();
break;
+ case 'p':
+ animate();
+ break;
case 17: // Ctrl-q
case 'q':
if(!Format.empty()) Export();
@@ -1073,7 +1118,8 @@ void keyboard(unsigned char key, int x, int y)
}
}
-enum Menu {HOME,FITSCREEN,XSPIN,YSPIN,ZSPIN,STOP,MODE,EXPORT,CAMERA,QUIT};
+enum Menu {HOME,FITSCREEN,XSPIN,YSPIN,ZSPIN,STOP,MODE,EXPORT,CAMERA,
+ ANIMATE,QUIT};
void menu(int choice)
{
@@ -1109,6 +1155,9 @@ void menu(int choice)
case CAMERA:
camera();
break;
+ case ANIMATE:
+ animate();
+ break;
case QUIT:
quit();
break;
@@ -1341,6 +1390,7 @@ void glrender(const string& prefix, const picture *pic, const string& format,
glMatrixMode(GL_MODELVIEW);
home();
+ Animate=getSetting<bool>("autoplay");
if(View) {
if(!getSetting<bool>("fitscreen"))
@@ -1390,6 +1440,7 @@ void glrender(const string& prefix, const picture *pic, const string& format,
glutAddMenuEntry("(m) Mode",MODE);
glutAddMenuEntry("(e) Export",EXPORT);
glutAddMenuEntry("(c) Camera",CAMERA);
+ glutAddMenuEntry("(p) Play",ANIMATE);
glutAddMenuEntry("(q) Quit" ,QUIT);
for(size_t i=0; i < nbuttons; ++i) {
@@ -1407,7 +1458,7 @@ void glrender(const string& prefix, const picture *pic, const string& format,
} else {
initialized=true;
readyAfterExport=true;
- signal(SIGUSR1,exportHandler);
+ Signal(SIGUSR1,exportHandler);
exportHandler();
}
} else {
diff --git a/Build/source/utils/asymptote/inst.h b/Build/source/utils/asymptote/inst.h
index c4f7efb8f86..391f3c99461 100644
--- a/Build/source/utils/asymptote/inst.h
+++ b/Build/source/utils/asymptote/inst.h
@@ -21,8 +21,15 @@ namespace vm {
struct inst; class stack; class program;
// A function "lambda," that is, the code that runs a function.
-// It also need the closure of the enclosing module or function to run.
+// It also needs the closure of the enclosing module or function to run.
struct lambda : public gc {
+#ifdef DEBUG_FRAME
+ lambda()
+ : name("<unnamed>") {}
+ virtual ~lambda() {}
+ string name;
+#endif
+
// The instructions to follow.
program *code;
diff --git a/Build/source/utils/asymptote/item.h b/Build/source/utils/asymptote/item.h
index 9df090cc948..14caea884b0 100644
--- a/Build/source/utils/asymptote/item.h
+++ b/Build/source/utils/asymptote/item.h
@@ -11,7 +11,6 @@
#include "common.h"
#include <typeinfo>
-
namespace vm {
class item;
@@ -22,7 +21,7 @@ T get(const item&);
class item : public gc {
public:
- bool empty()
+ bool empty() const
{ return *kind == typeid(void); }
item()
@@ -113,12 +112,23 @@ private:
};
class frame : public gc {
+#ifdef DEBUG_FRAME
+ string name;
+#endif
typedef mem::vector<item> vars_t;
vars_t vars;
public:
+#ifdef DEBUG_FRAME
+ frame(string name, size_t size)
+ : name(name), vars(size)
+ {}
+
+ string getName() { return name; }
+#else
frame(size_t size)
: vars(size)
{}
+#endif
item& operator[] (size_t n)
{ return vars[n]; }
@@ -181,18 +191,7 @@ inline bool isdefault(const item& it)
return *it.kind == typeid(default_t);
}
-inline ostream& operator<< (ostream& out, const item& i)
-{
- out << "type " << i.type().name();
- if (i.type() == typeid(Int))
- cout << ", value = " << get<Int>(i) << endl;
- else if (i.type() == typeid(double))
- cout << ", value = " << get<double>(i) << endl;
- else if (i.type() == typeid(string))
- cout << ", value = " << get<string>(i) << endl;
- else out << endl;
- return out;
-}
+ostream& operator<< (ostream& out, const item& i);
} // namespace vm
diff --git a/Build/source/utils/asymptote/main.cc b/Build/source/utils/asymptote/main.cc
index 1a42ff47bba..153e5a265f7 100644
--- a/Build/source/utils/asymptote/main.cc
+++ b/Build/source/utils/asymptote/main.cc
@@ -20,7 +20,6 @@
*************/
#include <iostream>
-#include <csignal>
#include <cstdlib>
#include <cerrno>
#include <sys/wait.h>
@@ -79,8 +78,8 @@ void setsignal(RETSIGTYPE (*handler)(int))
mystack,sizeof (mystack));
sigsegv_install_handler(&sigsegv_handler);
#endif
- signal(SIGBUS,handler);
- signal(SIGFPE,handler);
+ Signal(SIGBUS,handler);
+ Signal(SIGFPE,handler);
}
void signalHandler(int)
@@ -88,8 +87,8 @@ void signalHandler(int)
// Print the position and trust the shell to print an error message.
em.runtime(vm::getPos());
- signal(SIGBUS,SIG_DFL);
- signal(SIGFPE,SIG_DFL);
+ Signal(SIGBUS,SIG_DFL);
+ Signal(SIGFPE,SIG_DFL);
}
void interruptHandler(int)
@@ -126,7 +125,7 @@ void *asymain(void *A)
fpu_trap(trap());
if(interactive) {
- signal(SIGINT,interruptHandler);
+ Signal(SIGINT,interruptHandler);
processPrompt();
} else if (getSetting<bool>("listvariables") && numArgs()==0) {
try {
diff --git a/Build/source/utils/asymptote/name.cc b/Build/source/utils/asymptote/name.cc
index 41280351ccf..0c822792e0c 100644
--- a/Build/source/utils/asymptote/name.cc
+++ b/Build/source/utils/asymptote/name.cc
@@ -170,22 +170,7 @@ bool qualifiedName::varTransVirtual(action act, coenv &e,
// Push qualifier onto stack.
qualifier->varTrans(READ, e, qt);
- if (act == WRITE) {
- em.error(getPos());
- em << "virtual field '" << *id << "' of '" << *qt
- << "' cannot be modified";
- }
- else {
- // Call instead of reading as it is a virtual field.
- v->encode(CALL, getPos(), e.c);
- e.implicitCast(getPos(), target, v->getType());
-
- if (act == CALL)
- // In this case, the virtual field will construct a vm::func object
- // and push it on the stack.
- // Then, pop and call the function.
- e.c.encode(inst::popcall);
- }
+ v->encode(act, getPos(), e.c);
// A virtual field was used.
return true;
diff --git a/Build/source/utils/asymptote/path3.cc b/Build/source/utils/asymptote/path3.cc
index b993f9a5620..fcedd4090c4 100644
--- a/Build/source/utils/asymptote/path3.cc
+++ b/Build/source/utils/asymptote/path3.cc
@@ -316,13 +316,25 @@ bbox3 path3::bounds() const
return box;
}
+// Return f evaluated at controlling vertex of bounding box of convex hull for
+// similiar-triangle transform x'=x/z, y'=y/z, where z < 0.
+double ratiobound(triple z0, triple c0, triple c1, triple z1,
+ double (*m)(double, double),
+ double (*f)(const triple&))
+{
+ double MX=m(m(m(-z0.getx(),-c0.getx()),-c1.getx()),-z1.getx());
+ double MY=m(m(m(-z0.gety(),-c0.gety()),-c1.gety()),-z1.gety());
+ double Z=m(m(m(z0.getz(),c0.getz()),c1.getz()),z1.getz());
+ double MZ=m(m(m(-z0.getz(),-c0.getz()),-c1.getz()),-z1.getz());
+ return m(f(triple(-MX,-MY,Z)),f(triple(-MX,-MY,-MZ)));
+}
+
double bound(triple z0, triple c0, triple c1, triple z1,
double (*m)(double, double),
- double (*f)(const triple&, double*), double *t,
- double b, double fuzz, int depth)
+ double (*f)(const triple&), double b, double fuzz, int depth)
{
- b=m(b,m(f(z0,t),f(z1,t)));
- if(m(-1.0,1.0)*(b-m(f(c0,t),f(c1,t))) >= -fuzz || depth == 0)
+ b=m(b,m(f(z0),f(z1)));
+ if(m(-1.0,1.0)*(b-ratiobound(z0,c0,c1,z1,m,f)) >= -fuzz || depth == 0)
return b;
--depth;
@@ -334,31 +346,32 @@ double bound(triple z0, triple c0, triple c1, triple z1,
triple m5=0.5*(m3+m4);
// Check both Bezier subpaths.
- b=bound(z0,m0,m3,m5,m,f,t,b,fuzz,depth);
- return bound(m5,m4,m2,z1,m,f,t,b,fuzz,depth);
+ b=bound(z0,m0,m3,m5,m,f,b,fuzz,depth);
+ return bound(m5,m4,m2,z1,m,f,b,fuzz,depth);
}
-pair path3::bounds(double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*), double *t) const
+pair path3::ratio(double (*m)(double, double)) const
{
checkEmpty3(n);
triple v=point((Int) 0);
- pair B=pair(x(v,t),y(v,t));
+ pair B=pair(xratio(v),yratio(v));
Int n=length();
for(Int i=0; i <= n; ++i) {
if(straight(i)) {
triple v=point(i);
- B=pair(m(B.getx(),x(v,t)),m(B.gety(),y(v,t)));
+ B=pair(m(B.getx(),xratio(v)),m(B.gety(),yratio(v)));
} else {
triple z0=point(i);
triple c0=postcontrol(i);
triple c1=precontrol(i+1);
triple z1=point(i+1);
- B=pair(bound(z0,c0,c1,z1,m,x,t,B.getx()),
- bound(z0,c0,c1,z1,m,y,t,B.gety()));
+ double fuzz=sqrtFuzz*camp::max(camp::max(camp::max(z0.length(),
+ c0.length()),
+ c1.length()),z1.length());
+ B=pair(bound(z0,c0,c1,z1,m,xratio,B.getx(),fuzz),
+ bound(z0,c0,c1,z1,m,yratio,B.gety(),fuzz));
}
}
return B;
@@ -748,36 +761,14 @@ path3 transformed(const array& t, const path3& p)
return path3(nodes, n, p.cyclic());
}
-double xproject(const triple& v, double *t)
-{
- double x=v.getx();
- double y=v.gety();
- double z=v.getz();
- double f=t[12]*x+t[13]*y+t[14]*z+t[15];
- if(f == 0.0) run::dividebyzero();
- return (t[0]*x+t[1]*y+t[2]*z+t[3])/f;
-}
-
-double yproject(const triple& v, double *t)
+double xratio(const triple& v)
{
- double x=v.getx();
- double y=v.gety();
- double z=v.getz();
- double f=t[12]*x+t[13]*y+t[14]*z+t[15];
- if(f == 0.0) run::dividebyzero();
- return (t[4]*x+t[5]*y+t[6]*z+t[7])/f;
+ return v.getx()/v.getz();
}
-double xratio(const triple& v, double *)
+double yratio(const triple& v)
{
- double z=v.getz();
- return v.getx()/z;
-}
-
-double yratio(const triple& v, double *)
-{
- double z=v.getz();
- return v.gety()/z;
+ return v.gety()/v.getz();
}
template<class T>
@@ -815,30 +806,6 @@ double controlbound(double *P, double (*m)(double, double))
return m(b,P[14]);
}
-double cornerbound(triple *P, double (*m)(double, double),
- double (*f)(const triple&, double*), double *t)
-{
- double b=m(f(P[0],t),f(P[3],t));
- b=m(b,f(P[12],t));
- return m(b,f(P[15],t));
-}
-
-double controlbound(triple *P, double (*m)(double, double),
- double (*f)(const triple&, double*), double *t)
-{
- double b=m(f(P[1],t),f(P[2],t));
- b=m(b,f(P[4],t));
- b=m(b,f(P[5],t));
- b=m(b,f(P[6],t));
- b=m(b,f(P[7],t));
- b=m(b,f(P[8],t));
- b=m(b,f(P[9],t));
- b=m(b,f(P[10],t));
- b=m(b,f(P[11],t));
- b=m(b,f(P[13],t));
- return m(b,f(P[14],t));
-}
-
double bound(double *P, double (*m)(double, double), double b,
double fuzz, int depth)
{
@@ -875,12 +842,54 @@ double bound(double *P, double (*m)(double, double), double b,
return bound(s3,m,b,fuzz,depth);
}
+double cornerbound(triple *P, double (*m)(double, double),
+ double (*f)(const triple&))
+{
+ double b=m(f(P[0]),f(P[3]));
+ b=m(b,f(P[12]));
+ return m(b,f(P[15]));
+}
+
+// Return f evaluated at controlling vertex of bounding box of convex hull for
+// similiar-triangle transform x'=x/z, y'=y/z, where z < 0.
+double ratiobound(triple *P, double (*m)(double, double),
+ double (*f)(const triple&))
+{
+ double MX=-P[0].getx();
+ double MY=-P[0].gety();
+ double Z=P[0].getz();
+ double MZ=-P[0].getz();
+ for(int i=1; i < 16; ++i) {
+ triple v=P[i];
+ MX=m(MX,-v.getx());
+ MY=m(MY,-v.gety());
+ Z=m(Z,v.getz());
+ MZ=m(MZ,-v.getz());
+ }
+ return m(f(triple(-MX,-MY,Z)),f(triple(-MX,-MY,-MZ)));
+}
+
+double controlbound(triple *P, double (*m)(double, double),
+ double (*f)(const triple&))
+{
+ double b=m(f(P[1]),f(P[2]));
+ b=m(b,f(P[4]));
+ b=m(b,f(P[5]));
+ b=m(b,f(P[6]));
+ b=m(b,f(P[7]));
+ b=m(b,f(P[8]));
+ b=m(b,f(P[9]));
+ b=m(b,f(P[10]));
+ b=m(b,f(P[11]));
+ b=m(b,f(P[13]));
+ return m(b,f(P[14]));
+}
+
double bound(triple *P, double (*m)(double, double),
- double (*f)(const triple&, double*), double *t,
- double b, double fuzz, int depth)
+ double (*f)(const triple&), double b, double fuzz, int depth)
{
- b=m(b,cornerbound(P,m,f,t));
- if(m(-1.0,1.0)*(b-controlbound(P,m,f,t)) >= -fuzz || depth == 0)
+ b=m(b,cornerbound(P,m,f));
+ if(m(-1.0,1.0)*(b-ratiobound(P,m,f)) >= -fuzz || depth == 0)
return b;
--depth;
@@ -900,16 +909,16 @@ double bound(triple *P, double (*m)(double, double),
// Check all 4 Bezier subpatches.
triple s0[]={c4.m5,c5.m5,c6.m5,c7.m5,c4.m3,c5.m3,c6.m3,c7.m3,
c4.m0,c5.m0,c6.m0,c7.m0,P[12],c3.m0,c3.m3,c3.m5};
- b=bound(s0,m,f,t,b,fuzz,depth);
+ b=bound(s0,m,f,b,fuzz,depth);
triple s1[]={P[0],c0.m0,c0.m3,c0.m5,c4.m2,c5.m2,c6.m2,c7.m2,
c4.m4,c5.m4,c6.m4,c7.m4,c4.m5,c5.m5,c6.m5,c7.m5};
- b=bound(s1,m,f,t,b,fuzz,depth);
+ b=bound(s1,m,f,b,fuzz,depth);
triple s2[]={c0.m5,c0.m4,c0.m2,P[3],c7.m2,c8.m2,c9.m2,c10.m2,
c7.m4,c8.m4,c9.m4,c10.m4,c7.m5,c8.m5,c9.m5,c10.m5};
- b=bound(s2,m,f,t,b,fuzz,depth);
+ b=bound(s2,m,f,b,fuzz,depth);
triple s3[]={c7.m5,c8.m5,c9.m5,c10.m5,c7.m3,c8.m3,c9.m3,c10.m3,
c7.m0,c8.m0,c9.m0,c10.m0,c3.m5,c3.m4,c3.m2,P[15]};
- return bound(s3,m,f,t,b,fuzz,depth);
+ return bound(s3,m,f,b,fuzz,depth);
}
inline void add(std::vector<double>& T, std::vector<double>& U,
diff --git a/Build/source/utils/asymptote/path3.h b/Build/source/utils/asymptote/path3.h
index 208c9ab2688..067bc2e92e1 100644
--- a/Build/source/utils/asymptote/path3.h
+++ b/Build/source/utils/asymptote/path3.h
@@ -308,10 +308,7 @@ public:
return bounds().Min();
}
- pair bounds(double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*), double *t) const;
-
+ pair ratio(double (*m)(double, double)) const;
// Increment count if the path3 has a vertical component at t.
bool Count(Int& count, double t) const;
@@ -357,21 +354,18 @@ inline triple displacement(const triple& z, const triple& p, const triple& q)
return Z-dot(Z,Q)*Q;
}
-double xproject(const triple& v, double *t);
-double yproject(const triple& v, double *t);
-
-double xratio(const triple& v, double *t);
-double yratio(const triple& v, double *t);
+double xratio(const triple& v);
+double yratio(const triple& v);
double bound(triple z0, triple c0, triple c1, triple z1,
double (*m)(double, double),
- double (*f)(const triple&, double*), double *t,
- double b, double fuzz=sqrtFuzz, int depth=maxdepth);
+ double (*f)(const triple&),
+ double b, double fuzz, int depth=maxdepth);
double bound(double *p, double (*m)(double, double),
- double b, double fuzz=sqrtFuzz, int depth=maxdepth);
-double bound(triple *p, double (*m)(double, double),
- double (*f)(const triple&, double*), double* t,
- double b, double fuzz=sqrtFuzz, int depth=maxdepth);
+ double b, double fuzz, int depth=maxdepth);
+double bound(triple *P, double (*m)(double, double),
+ double (*f)(const triple&), double b, double fuzz,
+ int depth=maxdepth);
}
#ifndef BROKEN_COMPILER
diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc
index eb7e28e3751..de844a2410c 100644
--- a/Build/source/utils/asymptote/picture.cc
+++ b/Build/source/utils/asymptote/picture.cc
@@ -191,16 +191,13 @@ bbox3 picture::bounds3()
return b3;
}
-pair picture::bounds(double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t)
+pair picture::ratio(double (*m)(double, double))
{
bool first=true;
pair b;
for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) {
assert(*p);
- (*p)->bounds(b,m,x,y,t,first);
+ (*p)->ratio(b,m,first);
}
return b;
}
@@ -528,7 +525,7 @@ bool picture::postprocess(const string& prename, const string& outname,
"psviewerOptions");
if(!viewerOptions.empty())
push_split(cmd,viewerOptions);
- push_split(cmd,outname);
+ cmd.push_back(outname);
status=System(cmd,0,wait,
pdfformat ? "pdfviewer" : "psviewer",
pdfformat ? "your PDF viewer" : "your PostScript viewer",
diff --git a/Build/source/utils/asymptote/picture.h b/Build/source/utils/asymptote/picture.h
index 7bab7fa3dc1..5589d1d760a 100644
--- a/Build/source/utils/asymptote/picture.h
+++ b/Build/source/utils/asymptote/picture.h
@@ -62,11 +62,8 @@ public:
bbox bounds();
bbox3 bounds3();
- // Projected bounds of 3d picture given transform3 t (not cached).
- pair bounds(double (*m)(double, double),
- double (*x)(const triple&, double*),
- double (*y)(const triple&, double*),
- double *t=NULL);
+ // Compute bounds on ratio (x,y)/z for 3d picture (not cached).
+ pair ratio(double (*m)(double, double));
bool Transparency() {
return transparency;
diff --git a/Build/source/utils/asymptote/process.cc b/Build/source/utils/asymptote/process.cc
index 59fb8c358fa..a84505d523c 100644
--- a/Build/source/utils/asymptote/process.cc
+++ b/Build/source/utils/asymptote/process.cc
@@ -64,6 +64,34 @@ processDataStruct &processData() {
return *processDataStack.top();
}
+// A process environment. Basically this just serves as short-hand to start a
+// new global environment (genv) and new process data at the same time. When
+// it goes out of scope, the process data is popped off the stack. This also
+// ensures that the data is popped even if an exception is thrown.
+class penv {
+ genv *_ge;
+ processDataStruct pd;
+
+ // Do not let this object be dynamically allocated.
+ void *operator new(size_t);
+
+public:
+ penv() : _ge(0), pd() {
+ // Push the processData first, as it needs to be on the stack before genv
+ // is initialized.
+ processDataStack.push(&pd);
+ _ge = new genv;
+ }
+
+ virtual ~penv() {
+ processDataStack.pop();
+ delete _ge;
+ }
+
+ genv &ge() { return *_ge; }
+};
+
+
void init(bool resetpath=true)
{
vm::indebugger=false;
@@ -146,8 +174,8 @@ struct icore {
public:
// preRun and postRun are the optional activities that take place before and
- // after running the code specified. They can be overridden by derived class
- // that wish different behaviour.
+ // after running the code specified. They can be overridden by a derived
+ // class that wishes different behaviour.
virtual void preRun(coenv &e, istack &s) {
if(getSetting<bool>("autoplain"))
runAutoplain(e,s);
@@ -167,13 +195,13 @@ public:
try {
if(purge) run::purge();
- genv ge;
- env base_env(ge);
- coder base_coder;
+ penv pe;
+ env base_env(pe.ge());
+ coder base_coder("icore::doRun");
coenv e(base_coder,base_env);
vm::interactiveStack s;
- s.setInitMap(ge.getInitMap());
+ s.setInitMap(pe.ge().getInitMap());
s.setEnvironment(&e);
preRun(e,s);
@@ -200,18 +228,10 @@ public:
virtual void process(bool purge=false) {
if (!interactive && getSetting<bool>("parseonly"))
doParse();
- else {
- // This is not done in preRun as it is not an optional step.
- processDataStruct data;
- processDataStack.push(&data);
-
- if (getSetting<bool>("listvariables"))
- doList();
- else
- doRun(purge);
-
- processDataStack.pop();
- }
+ else if (getSetting<bool>("listvariables"))
+ doList();
+ else
+ doRun(purge);
}
};
@@ -253,8 +273,8 @@ public:
void doList() {
block *tree=getTree();
if (tree) {
- genv ge;
- record *r=tree->transAsFile(ge, symbol::trans(getName()));
+ penv pe;
+ record *r=tree->transAsFile(pe.ge(), symbol::trans(getName()));
r->e.list(r);
}
}
@@ -271,15 +291,8 @@ public:
void doRun(transMode tm=TRANS_NORMAL) {
// Don't prepare an environment to run the code if there isn't any code.
- if (getTree()) {
- // This is not done in preRun as it is not an optional step.
- processDataStruct data;
- processDataStack.push(&data);
-
+ if (getTree())
icore::doRun(false,tm);
-
- processDataStack.pop();
- }
}
};
@@ -866,18 +879,14 @@ void runPromptEmbedded(trans::coenv &e, istack &s) {
}
void doUnrestrictedList() {
- processDataStruct data;
- processDataStack.push(&data);
-
- genv ge;
- env base_env(ge);
- coder base_coder;
+ penv pe;
+ env base_env(pe.ge());
+ coder base_coder("doUnrestictedList");
coenv e(base_coder,base_env);
if (getSetting<bool>("autoplain"))
absyntax::autoplainRunnable()->trans(e);
- processDataStack.pop();
e.e.list(0);
}
diff --git a/Build/source/utils/asymptote/program.cc b/Build/source/utils/asymptote/program.cc
index fd7b14bfe0e..4459362e9b5 100644
--- a/Build/source/utils/asymptote/program.cc
+++ b/Build/source/utils/asymptote/program.cc
@@ -6,8 +6,11 @@
*****/
#include <iostream>
+#include "util.h"
+#include "callable.h"
#include "program.h"
+
namespace vm {
static const char* opnames[] = {
@@ -19,6 +22,44 @@ static const char* opnames[] = {
};
static const Int numOps = (Int)(sizeof(opnames)/sizeof(char *));
+#ifdef DEBUG_BLTIN
+mem::map<bltin,string> bltinRegistry;
+
+void registerBltin(bltin b, string s) {
+ bltinRegistry[b] = s;
+}
+string lookupBltin(bltin b) {
+ return bltinRegistry[b];
+}
+#endif
+
+
+ostream& operator<< (ostream& out, const item& i)
+{
+ // TODO: Make a data structure mapping typeids to print functions.
+ if (i.empty())
+ out << "empty";
+ else if (isdefault(i))
+ out << "default";
+ else if (i.type() == typeid(Int))
+ out << "Int, value = " << get<Int>(i);
+ else if (i.type() == typeid(double))
+ out << "real, value = " << get<double>(i);
+ else if (i.type() == typeid(string))
+ out << "string, value = " << get<string>(i);
+ else if (i.type() == typeid(callable))
+ out << *(get<callable *>(i));
+ else if (i.type() == typeid(frame)) {
+ out << "frame";
+#ifdef DEBUG_FRAME
+ out << " " << (get<frame *>(i))->getName();
+#endif
+ }
+ else
+ out << "type " << demangle(i.type().name());
+ return out;
+}
+
void printInst(ostream& out, const program::label& code,
const program::label& base)
{
@@ -44,11 +85,21 @@ void printInst(ostream& out, const program::label& code,
break;
}
+ case inst::constpush:
+ {
+ item c = code->ref;
+ out << " " << c;
+ break;
+ }
+
+#ifdef DEBUG_BLTIN
case inst::builtin:
- {
- out << " " << get<bltin>(*code) << " ";
+ {
+ string s=lookupBltin(get<bltin>(*code));
+ out << " " << (!s.empty() ? s : "<unnamed>") << " ";
break;
}
+#endif
case inst::jmp:
case inst::cjmp:
@@ -62,11 +113,13 @@ void printInst(ostream& out, const program::label& code,
break;
}
+#ifdef DEBUG_FRAME
case inst::makefunc:
{
- out << " " << get<lambda*>(*code) << " ";
+ out << " " << get<lambda*>(*code)->name << " ";
break;
}
+#endif
default: {
/* nothing else to do */
diff --git a/Build/source/utils/asymptote/psfile.cc b/Build/source/utils/asymptote/psfile.cc
index 506821d7f28..4605758de67 100644
--- a/Build/source/utils/asymptote/psfile.cc
+++ b/Build/source/utils/asymptote/psfile.cc
@@ -345,7 +345,7 @@ void psfile::latticeshade(const vm::array& a, const bbox& b)
}
// Axial and radial shading
-void psfile::gradientshade(bool axial, const ColorSpace &colorspace,
+void psfile::gradientshade(bool axial, ColorSpace colorspace,
const pen& pena, const pair& a, double ra,
const pen& penb, const pair& b, double rb)
{
@@ -406,6 +406,16 @@ void psfile::gouraudshade(const array& pens, const array& vertices,
<< "shfill" << newl;
}
+void psfile::vertexpen(array *pi, int j, ColorSpace colorspace)
+{
+ pen *p=read<pen *>(pi,j);
+ p->convert();
+ if(!p->promote(colorspace))
+ reportError(inconsistent);
+ *out << " ";
+ write(*p);
+}
+
// Tensor-product patch shading
void psfile::tensorshade(const array& pens, const array& boundaries,
const array& z)
@@ -435,10 +445,10 @@ void psfile::tensorshade(const array& pens, const array& boundaries,
path g=read<path>(boundaries,i);
if(!(g.cyclic() && g.size() == 4))
reportError("specify cyclic path of length 4");
- for(Int j=0; j < 4; ++j) {
+ for(Int j=4; j > 0; --j) {
write(g.point(j));
- write(g.postcontrol(j));
- write(g.precontrol(j+1));
+ write(g.precontrol(j));
+ write(g.postcontrol(j-1));
}
if(nz == 0) { // Coons patch
static double nineth=1.0/9.0;
@@ -452,21 +462,19 @@ void psfile::tensorshade(const array& pens, const array& boundaries,
array *zi=read<array *>(z,i);
if(checkArray(zi) != 4)
reportError("specify 4 internal control points for each path");
- for(Int j=0; j < 4; ++j)
- write(read<pair>(zi,j));
+ write(read<pair>(zi,0));
+ write(read<pair>(zi,3));
+ write(read<pair>(zi,2));
+ write(read<pair>(zi,1));
}
array *pi=read<array *>(pens,i);
if(checkArray(pi) != 4)
reportError("specify 4 pens for each path");
- for(Int j=0; j < 4; ++j) {
- pen *p=read<pen *>(pi,j);
- p->convert();
- if(!p->promote(colorspace))
- reportError(inconsistent);
- *out << " ";
- write(*p);
- }
+ vertexpen(pi,0,colorspace);
+ vertexpen(pi,3,colorspace);
+ vertexpen(pi,2,colorspace);
+ vertexpen(pi,1,colorspace);
*out << newl;
}
diff --git a/Build/source/utils/asymptote/psfile.h b/Build/source/utils/asymptote/psfile.h
index d68e56e2619..c9c5126e442 100644
--- a/Build/source/utils/asymptote/psfile.h
+++ b/Build/source/utils/asymptote/psfile.h
@@ -268,7 +268,7 @@ public:
void latticeshade(const vm::array& a, const bbox& b);
- void gradientshade(bool axial, const ColorSpace& colorspace,
+ void gradientshade(bool axial, ColorSpace colorspace,
const pen& pena, const pair& a, double ra,
const pen& penb, const pair& b, double rb);
@@ -276,7 +276,9 @@ public:
const vm::array& edges);
void tensorshade(const vm::array& pens, const vm::array& boundaries,
const vm::array& z);
-
+
+ void vertexpen(vm::array *pi, int j, ColorSpace colorspace);
+
void imageheader(size_t width, size_t height, ColorSpace colorspace);
void image(const vm::array& a, const vm::array& p, bool antialias);
diff --git a/Build/source/utils/asymptote/record.cc b/Build/source/utils/asymptote/record.cc
index b19083d51d4..a09aff54cf2 100644
--- a/Build/source/utils/asymptote/record.cc
+++ b/Build/source/utils/asymptote/record.cc
@@ -22,6 +22,9 @@ record::record(symbol *name, frame *level)
e()
{
assert(init);
+#ifdef DEBUG_STACK
+ init->name = "struct "+string(*name);
+#endif
}
record::~record()
@@ -32,7 +35,7 @@ record *record::newRecord(symbol *id, bool statically)
frame *underlevel = getLevel(statically);
assert(underlevel);
- frame *level = new frame(underlevel, 0);
+ frame *level = new frame(*id, underlevel, 0);
record *r = new record(id, level);
return r;
@@ -45,7 +48,7 @@ trans::access *record::initializer() {
}
dummyRecord::dummyRecord(symbol *name)
- : record(name, new frame(0,0))
+ : record(name, new frame(*name, 0,0))
{
// Encode the instructions to put an placeholder instance of the record
// on the stack.
@@ -54,7 +57,7 @@ dummyRecord::dummyRecord(symbol *name)
}
dummyRecord::dummyRecord(string s)
- : record (symbol::trans(s), new frame(0,0))
+ : record (symbol::trans(s), new frame(s,0,0))
{
// Encode the instructions to put an placeholder instance of the record
// on the stack.
@@ -70,6 +73,7 @@ void dummyRecord::add(string name, ty *t, trans::access *a,
void dummyRecord::add(string name, function *t, vm::bltin f,
trans::permission perm) {
+ REGISTER_BLTIN(f, name);
add(name, t, new trans::bltinAccess(f), perm);
}
diff --git a/Build/source/utils/asymptote/refaccess.cc b/Build/source/utils/asymptote/refaccess.cc
index 32bc6607356..b1addf41e1c 100644
--- a/Build/source/utils/asymptote/refaccess.cc
+++ b/Build/source/utils/asymptote/refaccess.cc
@@ -28,6 +28,9 @@ void itemPointerWrite(stack *s) {
void itemRefAccess::encode(action act, position, coder &e)
{
+ REGISTER_BLTIN(itemPointerRead, "itemPointerRead");
+ REGISTER_BLTIN(itemPointerWrite, "itemPointerWrite");
+
e.encode(inst::constpush, (item)ref);
switch (act) {
diff --git a/Build/source/utils/asymptote/refaccess.h b/Build/source/utils/asymptote/refaccess.h
index c848f8f171d..3357438115a 100644
--- a/Build/source/utils/asymptote/refaccess.h
+++ b/Build/source/utils/asymptote/refaccess.h
@@ -58,6 +58,10 @@ void pointerWrite(vm::stack *s) {
template <class T>
void refAccess<T>::encode(action act, position, coder &e)
{
+ // You may be able to use typeid(T).name() to get a better label.
+ REGISTER_BLTIN((bltin) pointerRead<T>, "pointerRead");
+ REGISTER_BLTIN((bltin) pointerWrite<T>, "pointerWrite");
+
e.encode(vm::inst::constpush, (vm::item)ref);
switch (act) {
diff --git a/Build/source/utils/asymptote/runtime.cc b/Build/source/utils/asymptote/runtime.cc
index 3317b59ffe9..2caa6a4acfc 100644
--- a/Build/source/utils/asymptote/runtime.cc
+++ b/Build/source/utils/asymptote/runtime.cc
@@ -1,5 +1,15 @@
/***** Autogenerated from runtime.in; changes will be overwritten *****/
+#line 1 "runtimebase.in"
+/*****
+ * runtimebase.in
+ * Andy Hammerlindl 2009/07/28
+ *
+ * Common declarations needed for all code-generating .in files.
+ *
+ *****/
+
+
#line 1 "runtime.in"
/*****
* runtime.in
@@ -20,7 +30,24 @@
// Use Void f() instead of void f() to force an explicit Stack argument.
-#line 63 "runtime.in"
+#line 1 "runtimebase.in"
+#include "stack.h"
+#include "types.h"
+#include "builtin.h"
+#include "entry.h"
+#include "errormsg.h"
+
+using vm::stack;
+using vm::error;
+using types::formal;
+
+#define PRIMITIVE(name,Name,asyName) using types::prim##Name;
+#include <primitives.h>
+#undef PRIMITIVE
+
+void unused(void *);
+
+#line 55 "runtime.in"
#include <cfloat>
#include <iostream>
#include <fstream>
@@ -130,7 +157,7 @@ using types::function;
#include <primitives.h>
#undef PRIMITIVE
-using types::boolArray;
+using types::booleanArray;
using types::IntArray;
using types::IntArray2;
using types::realArray;
@@ -184,6 +211,7 @@ namespace run {
const char *invalidargument="invalid argument";
const char *arrayempty="cannot take min or max of empty array";
+const char *noruntime="no runtime environment for embedded eval";
// Return the factorial of a non-negative integer using a lookup table.
Int factorial(Int n)
@@ -285,7 +313,7 @@ inline size_t checkdimension(array *a, size_t dim)
size_t size=checkArray(a);
if(dim && size != dim) {
ostringstream buf;
- buf << "array of length " << dim << " expected" << endl;
+ buf << "array of length " << dim << " expected";
error(buf);
}
return size;
@@ -351,7 +379,7 @@ double *copyArray2C(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -375,7 +403,7 @@ triple *copyTripleArray2C(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -399,7 +427,7 @@ double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -426,24 +454,6 @@ double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0)
return cx;
}
-double norm(double *a, size_t n)
-{
- if(n == 0) return 0.0;
- double M=fabs(a[0]);
- for(size_t i=1; i < n; ++i)
- M=::max(M,fabs(a[i]));
- return M;
-}
-
-double norm(triple *a, size_t n)
-{
- if(n == 0) return 0.0;
- double M=a[0].abs2();
- for(size_t i=1; i < n; ++i)
- M=::max(M,a[i].abs2());
- return sqrt(M);
-}
-
static const char *incommensurate="Incommensurate matrices";
static const char *singular="Singular matrix";
static size_t *pivot,*Row,*Col;
@@ -699,11 +709,6 @@ void init_readline(bool tabcompletion=true)
void cleanup()
{
- processDataStruct &pd=processData();
- pd.atExitFunction=NULL;
- pd.atUpdateFunction=NULL;
- pd.atBreakpointFunction=NULL;
-
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
store_history(&history_save);
int nlines=intcast(getSetting<Int>("historylines"));
@@ -737,7 +742,6 @@ void exitFunction(stack *Stack)
callable *atExitFunction=processData().atExitFunction;
if(atExitFunction && !nullfunc::instance()->compare(atExitFunction))
atExitFunction->call(Stack);
- cleanup();
}
default_t def;
@@ -842,7 +846,6 @@ inline double principalBranch(double deg)
}
static string defaulttransparency=string("Compatible");
-
static const string defaulttimeformat=string("%a %b %d %T %Z %Y");
#ifdef HAVE_STRFTIME
static const size_t nTime=256;
@@ -1073,14 +1076,14 @@ pair gamma(pair z)
void cannotread(const string& s)
{
ostringstream buf;
- buf << "Cannot read from " << s << endl;
+ buf << "Cannot read from " << s;
error(buf);
}
void cannotwrite(const string& s)
{
ostringstream buf;
- buf << "Cannot write to " << s << endl;
+ buf << "Cannot write to " << s;
error(buf);
}
@@ -1091,45 +1094,45 @@ void cannotwrite(const string& s)
namespace run {
// Initializers
-#line 1131 "runtime.in"
+#line 1099 "runtime.in"
void IntZero(stack *Stack)
{
-#line 1132 "runtime.in"
+#line 1100 "runtime.in"
{Stack->push<Int>(0); return;}
}
-#line 1137 "runtime.in"
+#line 1105 "runtime.in"
void realZero(stack *Stack)
{
-#line 1138 "runtime.in"
+#line 1106 "runtime.in"
{Stack->push<real>(0.0); return;}
}
-#line 1142 "runtime.in"
+#line 1110 "runtime.in"
void boolFalse(stack *Stack)
{
-#line 1143 "runtime.in"
+#line 1111 "runtime.in"
{Stack->push<bool>(false); return;}
}
-#line 1147 "runtime.in"
+#line 1115 "runtime.in"
void pushNullArray(stack *Stack)
{
-#line 1148 "runtime.in"
+#line 1116 "runtime.in"
{Stack->push<array*>(0); return;}
}
-#line 1152 "runtime.in"
+#line 1120 "runtime.in"
void pushNullRecord(stack *Stack)
{
-#line 1153 "runtime.in"
+#line 1121 "runtime.in"
{Stack->push<frame*>(0); return;}
}
-#line 1157 "runtime.in"
+#line 1125 "runtime.in"
void pushNullFunction(stack *Stack)
{
-#line 1158 "runtime.in"
+#line 1126 "runtime.in"
{Stack->push(nullfunc::instance()); return;}
}
@@ -1138,185 +1141,185 @@ void pushNullFunction(stack *Stack)
// Put the default value token on the stack (in place of an argument when
// making a function call).
-#line 1167 "runtime.in"
+#line 1135 "runtime.in"
void pushDefault(stack *Stack)
{
-#line 1168 "runtime.in"
+#line 1136 "runtime.in"
{Stack->push(def); return;}
}
// Test if the value on the stack is the default value token.
-#line 1174 "runtime.in"
+#line 1142 "runtime.in"
void isDefault(stack *Stack)
{
item i=vm::pop(Stack);
-#line 1175 "runtime.in"
+#line 1143 "runtime.in"
{Stack->push<bool>(isdefault(i)); return;}
}
// Logical operations
-#line 1181 "runtime.in"
+#line 1149 "runtime.in"
// bool !(bool b);
-void gen8(stack *Stack)
+void gen_runtime8(stack *Stack)
{
bool b=vm::pop<bool>(Stack);
-#line 1182 "runtime.in"
+#line 1150 "runtime.in"
{Stack->push<bool>(!b); return;}
}
-#line 1187 "runtime.in"
+#line 1155 "runtime.in"
void boolMemEq(stack *Stack)
{
frame * b=vm::pop<frame *>(Stack);
frame * a=vm::pop<frame *>(Stack);
-#line 1188 "runtime.in"
+#line 1156 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 1192 "runtime.in"
+#line 1160 "runtime.in"
void boolMemNeq(stack *Stack)
{
frame * b=vm::pop<frame *>(Stack);
frame * a=vm::pop<frame *>(Stack);
-#line 1193 "runtime.in"
+#line 1161 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 1197 "runtime.in"
+#line 1165 "runtime.in"
void boolFuncEq(stack *Stack)
{
callable * b=vm::pop<callable *>(Stack);
callable * a=vm::pop<callable *>(Stack);
-#line 1198 "runtime.in"
+#line 1166 "runtime.in"
{Stack->push<bool>(a->compare(b)); return;}
}
-#line 1202 "runtime.in"
+#line 1170 "runtime.in"
void boolFuncNeq(stack *Stack)
{
callable * b=vm::pop<callable *>(Stack);
callable * a=vm::pop<callable *>(Stack);
-#line 1203 "runtime.in"
+#line 1171 "runtime.in"
{Stack->push<bool>(!(a->compare(b))); return;}
}
// Bit operations
-#line 1209 "runtime.in"
+#line 1177 "runtime.in"
// Int AND(Int a, Int b);
-void gen13(stack *Stack)
+void gen_runtime13(stack *Stack)
{
Int b=vm::pop<Int>(Stack);
Int a=vm::pop<Int>(Stack);
-#line 1210 "runtime.in"
+#line 1178 "runtime.in"
{Stack->push<Int>(a & b); return;}
}
-#line 1215 "runtime.in"
+#line 1183 "runtime.in"
// Int OR(Int a, Int b);
-void gen14(stack *Stack)
+void gen_runtime14(stack *Stack)
{
Int b=vm::pop<Int>(Stack);
Int a=vm::pop<Int>(Stack);
-#line 1216 "runtime.in"
+#line 1184 "runtime.in"
{Stack->push<Int>(a | b); return;}
}
-#line 1220 "runtime.in"
+#line 1188 "runtime.in"
// Int XOR(Int a, Int b);
-void gen15(stack *Stack)
+void gen_runtime15(stack *Stack)
{
Int b=vm::pop<Int>(Stack);
Int a=vm::pop<Int>(Stack);
-#line 1221 "runtime.in"
+#line 1189 "runtime.in"
{Stack->push<Int>(a ^ b); return;}
}
-#line 1225 "runtime.in"
+#line 1193 "runtime.in"
// Int NOT(Int a);
-void gen16(stack *Stack)
+void gen_runtime16(stack *Stack)
{
Int a=vm::pop<Int>(Stack);
-#line 1226 "runtime.in"
+#line 1194 "runtime.in"
{Stack->push<Int>(~a); return;}
}
// Casts
-#line 1232 "runtime.in"
+#line 1200 "runtime.in"
void pairToGuide(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 1233 "runtime.in"
+#line 1201 "runtime.in"
{Stack->push<guide*>(new pairguide(z)); return;}
}
-#line 1238 "runtime.in"
+#line 1206 "runtime.in"
void pathToGuide(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 1239 "runtime.in"
+#line 1207 "runtime.in"
{Stack->push<guide*>(new pathguide(p)); return;}
}
-#line 1243 "runtime.in"
+#line 1211 "runtime.in"
void guideToPath(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 1244 "runtime.in"
+#line 1212 "runtime.in"
{Stack->push<path>(g->solve()); return;}
}
// Picture operations
-#line 1250 "runtime.in"
+#line 1218 "runtime.in"
void newPicture(stack *Stack)
{
-#line 1251 "runtime.in"
+#line 1219 "runtime.in"
{Stack->push<picture*>(new picture()); return;}
}
-#line 1256 "runtime.in"
+#line 1224 "runtime.in"
// bool empty(picture *f);
-void gen21(stack *Stack)
+void gen_runtime21(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1257 "runtime.in"
+#line 1225 "runtime.in"
{Stack->push<bool>(f->null()); return;}
}
-#line 1261 "runtime.in"
+#line 1229 "runtime.in"
// void erase(picture *f);
-void gen22(stack *Stack)
+void gen_runtime22(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1262 "runtime.in"
+#line 1230 "runtime.in"
f->nodes.clear();
}
-#line 1266 "runtime.in"
+#line 1234 "runtime.in"
// pair min(picture *f);
-void gen23(stack *Stack)
+void gen_runtime23(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1267 "runtime.in"
+#line 1235 "runtime.in"
{Stack->push<pair>(f->bounds().Min()); return;}
}
-#line 1271 "runtime.in"
+#line 1239 "runtime.in"
// pair max(picture *f);
-void gen24(stack *Stack)
+void gen_runtime24(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1272 "runtime.in"
+#line 1240 "runtime.in"
{Stack->push<pair>(f->bounds().Max()); return;}
}
-#line 1276 "runtime.in"
+#line 1244 "runtime.in"
// void label(picture *f, string *s, string *size, transform t, pair position, pair align, pen p);
-void gen25(stack *Stack)
+void gen_runtime25(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
pair align=vm::pop<pair>(Stack);
@@ -1325,26 +1328,26 @@ void gen25(stack *Stack)
string * size=vm::pop<string *>(Stack);
string * s=vm::pop<string *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1278 "runtime.in"
+#line 1246 "runtime.in"
f->append(new drawLabel(*s,*size,t,position,align,p));
}
-#line 1282 "runtime.in"
+#line 1250 "runtime.in"
// bool labels(picture *f);
-void gen26(stack *Stack)
+void gen_runtime26(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1283 "runtime.in"
+#line 1251 "runtime.in"
{Stack->push<bool>(f->havelabels()); return;}
}
-#line 1287 "runtime.in"
+#line 1255 "runtime.in"
// realarray* texsize(string *s, pen p=CURRENTPEN);
-void gen27(stack *Stack)
+void gen_runtime27(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
string * s=vm::pop<string *>(Stack);
-#line 1288 "runtime.in"
+#line 1256 "runtime.in"
texinit();
processDataStruct &pd=processData();
@@ -1363,13 +1366,13 @@ void gen27(stack *Stack)
{Stack->push<realarray*>(t); return;}
}
-#line 1307 "runtime.in"
+#line 1275 "runtime.in"
// patharray* _texpath(string *s, pen p=CURRENTPEN);
-void gen28(stack *Stack)
+void gen_runtime28(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
string * s=vm::pop<string *>(Stack);
-#line 1308 "runtime.in"
+#line 1276 "runtime.in"
array *P=new array(0);
if(s->empty()) {Stack->push<patharray*>(P); return;}
@@ -1390,7 +1393,7 @@ void gen28(stack *Stack)
tex.verbatimline(ASYx);
tex.verbatimline(ASYy);
tex.verbatimline("/ASY1 true def");
- tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYy ASYx (L) print ASYy add ASYx (L) print add ASYy add ASYx (L) print add ASYy ASYx (c) print} bind def");
+ tex.verbatimline("/v {"+ASY1+"neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYy ASYx (L) print ASYy add ASYx (L) print add ASYy add ASYx (L) print add ASYy ASYx (c) print} bind def");
tex.verbatimline("/show {"+ASY1+
"currentpoint newpath moveto false charpath "+
pathforall+"} bind def}");
@@ -1466,13 +1469,13 @@ void gen28(stack *Stack)
{Stack->push<patharray*>(pdf ? readpath(psname,keep,0.1) : readpath(psname,keep,0.12,-1.0)); return;}
}
-#line 1405 "runtime.in"
+#line 1373 "runtime.in"
// patharray* textpath(string *s, pen p=CURRENTPEN);
-void gen29(stack *Stack)
+void gen_runtime29(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
string * s=vm::pop<string *>(Stack);
-#line 1406 "runtime.in"
+#line 1374 "runtime.in"
array *P=new array(0);
if(s->empty()) {Stack->push<patharray*>(P); return;}
@@ -1542,13 +1545,13 @@ void gen29(stack *Stack)
{Stack->push<patharray*>(readpath(psname,keep,0.1)); return;}
}
-#line 1476 "runtime.in"
+#line 1444 "runtime.in"
// patharray* _strokepath(path g, pen p=CURRENTPEN);
-void gen30(stack *Stack)
+void gen_runtime30(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
path g=vm::pop<path>(Stack);
-#line 1477 "runtime.in"
+#line 1445 "runtime.in"
array *P=new array(0);
if(g.size() == 0) {Stack->push<patharray*>(P); return;}
@@ -1572,33 +1575,33 @@ void gen30(stack *Stack)
{Stack->push<patharray*>(readpath(psname,getSetting<bool>("keep"))); return;}
}
-#line 1501 "runtime.in"
+#line 1469 "runtime.in"
// void _draw(picture *f, path g, pen p);
-void gen31(stack *Stack)
+void gen_runtime31(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
path g=vm::pop<path>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1502 "runtime.in"
+#line 1470 "runtime.in"
f->append(new drawPath(g,p));
}
-#line 1506 "runtime.in"
+#line 1474 "runtime.in"
// void fill(picture *f, patharray *g, pen p=CURRENTPEN, bool copy=true);
-void gen32(stack *Stack)
+void gen_runtime32(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
pen p=vm::pop<pen>(Stack,CURRENTPEN);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1507 "runtime.in"
+#line 1475 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawFill(*copyarray(g),false,p));
}
-#line 1512 "runtime.in"
+#line 1480 "runtime.in"
// void latticeshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, bool copy=true);
-void gen33(stack *Stack)
+void gen_runtime33(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
penarray2 * p=vm::pop<penarray2 *>(Stack);
@@ -1606,14 +1609,14 @@ void gen33(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1514 "runtime.in"
+#line 1482 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p)));
}
-#line 1519 "runtime.in"
+#line 1487 "runtime.in"
// void axialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, pen penb, pair b, bool copy=true);
-void gen34(stack *Stack)
+void gen_runtime34(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
pair b=vm::pop<pair>(Stack);
@@ -1623,14 +1626,14 @@ void gen34(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1521 "runtime.in"
+#line 1489 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawAxialShade(*copyarray(g),stroke,pena,a,penb,b));
}
-#line 1526 "runtime.in"
+#line 1494 "runtime.in"
// void radialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, real ra, pen penb, pair b, real rb, bool copy=true);
-void gen35(stack *Stack)
+void gen_runtime35(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
real rb=vm::pop<real>(Stack);
@@ -1642,14 +1645,14 @@ void gen35(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1528 "runtime.in"
+#line 1496 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawRadialShade(*copyarray(g),stroke,pena,a,ra,penb,b,rb));
}
-#line 1533 "runtime.in"
+#line 1501 "runtime.in"
// void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, pairarray *z, Intarray *edges, bool copy=true);
-void gen36(stack *Stack)
+void gen_runtime36(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
Intarray * edges=vm::pop<Intarray *>(Stack);
@@ -1659,7 +1662,7 @@ void gen36(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1536 "runtime.in"
+#line 1504 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
checkArrays(p,z);
checkArrays(z,edges);
@@ -1667,9 +1670,9 @@ void gen36(stack *Stack)
*copyarray(z),*copyarray(edges)));
}
-#line 1544 "runtime.in"
+#line 1512 "runtime.in"
// void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, Intarray *edges, bool copy=true);
-void gen37(stack *Stack)
+void gen_runtime37(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
Intarray * edges=vm::pop<Intarray *>(Stack);
@@ -1678,7 +1681,7 @@ void gen37(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1547 "runtime.in"
+#line 1515 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
size_t n=checkArrays(p,edges);
size_t m=checkArray(g);
@@ -1699,9 +1702,9 @@ void gen37(stack *Stack)
*z,*copyarray(edges)));
}
-#line 1568 "runtime.in"
+#line 1536 "runtime.in"
// void tensorshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, patharray *b=NULL, pairarray2 *z=emptyarray, bool copy=true);
-void gen38(stack *Stack)
+void gen_runtime38(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
pairarray2 * z=vm::pop<pairarray2 *>(Stack,emptyarray);
@@ -1711,7 +1714,7 @@ void gen38(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1571 "runtime.in"
+#line 1539 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
array *(*copyarray2)(array *a)=copy ? copyArray2: nop;
if(b == NULL) b=g;
@@ -1723,9 +1726,9 @@ void gen38(stack *Stack)
*copyarray(b),*copyarray2(z)));
}
-#line 1583 "runtime.in"
+#line 1551 "runtime.in"
// void functionshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, string shader=emptystring, bool copy=true);
-void gen39(stack *Stack)
+void gen_runtime39(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
string shader=vm::pop<string>(Stack,emptystring);
@@ -1733,176 +1736,176 @@ void gen39(stack *Stack)
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1586 "runtime.in"
+#line 1554 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawFunctionShade(*copyarray(g),stroke,fillrule,shader));
}
// Clip a picture to a superpath using the given fill rule.
// Subsequent additions to the picture will not be affected by the clipping.
-#line 1593 "runtime.in"
+#line 1561 "runtime.in"
// void clip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true);
-void gen40(stack *Stack)
+void gen_runtime40(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
pen fillrule=vm::pop<pen>(Stack,CURRENTPEN);
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1595 "runtime.in"
+#line 1563 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
drawClipBegin *begin=new drawClipBegin(*copyarray(g),stroke,fillrule,true);
f->enclose(begin,new drawClipEnd(true,begin));
}
-#line 1601 "runtime.in"
+#line 1569 "runtime.in"
// void beginclip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true);
-void gen41(stack *Stack)
+void gen_runtime41(stack *Stack)
{
bool copy=vm::pop<bool>(Stack,true);
pen fillrule=vm::pop<pen>(Stack,CURRENTPEN);
bool stroke=vm::pop<bool>(Stack,false);
patharray * g=vm::pop<patharray *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1603 "runtime.in"
+#line 1571 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
f->append(new drawClipBegin(*copyarray(g),stroke,fillrule,false));
}
-#line 1608 "runtime.in"
+#line 1576 "runtime.in"
// void endclip(picture *f);
-void gen42(stack *Stack)
+void gen_runtime42(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1609 "runtime.in"
+#line 1577 "runtime.in"
f->append(new drawClipEnd(false));
}
-#line 1613 "runtime.in"
+#line 1581 "runtime.in"
// void gsave(picture *f);
-void gen43(stack *Stack)
+void gen_runtime43(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1614 "runtime.in"
+#line 1582 "runtime.in"
f->append(new drawGsave());
}
-#line 1618 "runtime.in"
+#line 1586 "runtime.in"
// void grestore(picture *f);
-void gen44(stack *Stack)
+void gen_runtime44(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1619 "runtime.in"
+#line 1587 "runtime.in"
f->append(new drawGrestore());
}
-#line 1623 "runtime.in"
+#line 1591 "runtime.in"
// void begingroup(picture *f);
-void gen45(stack *Stack)
+void gen_runtime45(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1624 "runtime.in"
+#line 1592 "runtime.in"
f->append(new drawBegin());
}
-#line 1628 "runtime.in"
+#line 1596 "runtime.in"
// void endgroup(picture *f);
-void gen46(stack *Stack)
+void gen_runtime46(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1629 "runtime.in"
+#line 1597 "runtime.in"
f->append(new drawEnd());
}
-#line 1633 "runtime.in"
+#line 1601 "runtime.in"
// void add(picture *dest, picture *src);
-void gen47(stack *Stack)
+void gen_runtime47(stack *Stack)
{
picture * src=vm::pop<picture *>(Stack);
picture * dest=vm::pop<picture *>(Stack);
-#line 1634 "runtime.in"
+#line 1602 "runtime.in"
dest->add(*src);
}
-#line 1638 "runtime.in"
+#line 1606 "runtime.in"
// void prepend(picture *dest, picture *src);
-void gen48(stack *Stack)
+void gen_runtime48(stack *Stack)
{
picture * src=vm::pop<picture *>(Stack);
picture * dest=vm::pop<picture *>(Stack);
-#line 1639 "runtime.in"
+#line 1607 "runtime.in"
dest->prepend(*src);
}
-#line 1643 "runtime.in"
+#line 1611 "runtime.in"
// void postscript(picture *f, string s);
-void gen49(stack *Stack)
+void gen_runtime49(stack *Stack)
{
string s=vm::pop<string>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1644 "runtime.in"
+#line 1612 "runtime.in"
f->append(new drawVerbatim(PostScript,s));
}
-#line 1648 "runtime.in"
+#line 1616 "runtime.in"
// void tex(picture *f, string s);
-void gen50(stack *Stack)
+void gen_runtime50(stack *Stack)
{
string s=vm::pop<string>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1649 "runtime.in"
+#line 1617 "runtime.in"
f->append(new drawVerbatim(TeX,s));
}
-#line 1653 "runtime.in"
+#line 1621 "runtime.in"
// void postscript(picture *f, string s, pair min, pair max);
-void gen51(stack *Stack)
+void gen_runtime51(stack *Stack)
{
pair max=vm::pop<pair>(Stack);
pair min=vm::pop<pair>(Stack);
string s=vm::pop<string>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1654 "runtime.in"
+#line 1622 "runtime.in"
f->append(new drawVerbatim(PostScript,s,min,max));
}
-#line 1658 "runtime.in"
+#line 1626 "runtime.in"
// void tex(picture *f, string s, pair min, pair max);
-void gen52(stack *Stack)
+void gen_runtime52(stack *Stack)
{
pair max=vm::pop<pair>(Stack);
pair min=vm::pop<pair>(Stack);
string s=vm::pop<string>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1659 "runtime.in"
+#line 1627 "runtime.in"
f->append(new drawVerbatim(TeX,s,min,max));
}
-#line 1663 "runtime.in"
+#line 1631 "runtime.in"
// void texpreamble(string s);
-void gen53(stack *Stack)
+void gen_runtime53(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 1664 "runtime.in"
+#line 1632 "runtime.in"
string t=s+"\n";
processDataStruct &pd=processData();
pd.TeXpipepreamble.push_back(t);
pd.TeXpreamble.push_back(t);
}
-#line 1671 "runtime.in"
+#line 1639 "runtime.in"
// void deletepreamble();
-void gen54(stack *)
+void gen_runtime54(stack *)
{
-#line 1672 "runtime.in"
+#line 1640 "runtime.in"
if(getSetting<bool>("inlinetex")) {
unlink(auxname(outname(),"pre").c_str());
}
}
-#line 1678 "runtime.in"
+#line 1646 "runtime.in"
// void _labelpath(picture *f, string s, string size, path g, string justify, pair offset, pen p);
-void gen55(stack *Stack)
+void gen_runtime55(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
pair offset=vm::pop<pair>(Stack);
@@ -1911,42 +1914,42 @@ void gen55(stack *Stack)
string size=vm::pop<string>(Stack);
string s=vm::pop<string>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1680 "runtime.in"
+#line 1648 "runtime.in"
f->append(new drawLabelPath(s,size,g,justify,offset,p));
}
-#line 1684 "runtime.in"
+#line 1652 "runtime.in"
// void texreset();
-void gen56(stack *)
+void gen_runtime56(stack *)
{
-#line 1685 "runtime.in"
+#line 1653 "runtime.in"
processDataStruct &pd=processData();
pd.TeXpipepreamble.clear();
pd.TeXpreamble.clear();
pd.tex.pipeclose();
}
-#line 1692 "runtime.in"
+#line 1660 "runtime.in"
// void layer(picture *f);
-void gen57(stack *Stack)
+void gen_runtime57(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1693 "runtime.in"
+#line 1661 "runtime.in"
f->append(new drawLayer());
}
-#line 1697 "runtime.in"
+#line 1665 "runtime.in"
// void newpage(picture *f);
-void gen58(stack *Stack)
+void gen_runtime58(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 1698 "runtime.in"
+#line 1666 "runtime.in"
f->append(new drawNewPage());
}
-#line 1702 "runtime.in"
+#line 1670 "runtime.in"
// void _image(picture *f, realarray2 *data, pair initial, pair final, penarray *palette=NULL, transform t=identity, bool copy=true, bool antialias=false);
-void gen59(stack *Stack)
+void gen_runtime59(stack *Stack)
{
bool antialias=vm::pop<bool>(Stack,false);
bool copy=vm::pop<bool>(Stack,true);
@@ -1956,16 +1959,16 @@ void gen59(stack *Stack)
pair initial=vm::pop<pair>(Stack);
realarray2 * data=vm::pop<realarray2 *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1705 "runtime.in"
+#line 1673 "runtime.in"
array *(*copyarray)(array *a)=copy ? copyArray: nop;
array *(*copyarray2)(array *a)=copy ? copyArray2: nop;
f->append(new drawImage(*copyarray2(data),*copyarray(palette),
t*matrix(initial,final),antialias));
}
-#line 1712 "runtime.in"
+#line 1680 "runtime.in"
// void _image(picture *f, penarray2 *data, pair initial, pair final, transform t=identity, bool copy=true, bool antialias=false);
-void gen60(stack *Stack)
+void gen_runtime60(stack *Stack)
{
bool antialias=vm::pop<bool>(Stack,false);
bool copy=vm::pop<bool>(Stack,true);
@@ -1974,38 +1977,38 @@ void gen60(stack *Stack)
pair initial=vm::pop<pair>(Stack);
penarray2 * data=vm::pop<penarray2 *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 1714 "runtime.in"
+#line 1682 "runtime.in"
array *(*copyarray2)(array *a)=copy ? copyArray2: nop;
f->append(new drawImage(*copyarray2(data),t*matrix(initial,final),antialias));
}
-#line 1719 "runtime.in"
+#line 1687 "runtime.in"
// string nativeformat();
-void gen61(stack *Stack)
+void gen_runtime61(stack *Stack)
{
-#line 1720 "runtime.in"
+#line 1688 "runtime.in"
{Stack->push<string>(nativeformat()); return;}
}
-#line 1724 "runtime.in"
+#line 1692 "runtime.in"
// bool latex();
-void gen62(stack *Stack)
+void gen_runtime62(stack *Stack)
{
-#line 1725 "runtime.in"
+#line 1693 "runtime.in"
{Stack->push<bool>(latex(getSetting<string>("tex"))); return;}
}
-#line 1729 "runtime.in"
+#line 1697 "runtime.in"
// bool pdf();
-void gen63(stack *Stack)
+void gen_runtime63(stack *Stack)
{
-#line 1730 "runtime.in"
+#line 1698 "runtime.in"
{Stack->push<bool>(pdf(getSetting<string>("tex"))); return;}
}
-#line 1734 "runtime.in"
+#line 1702 "runtime.in"
// void shipout(string prefix=emptystring, picture *f, picture *preamble=NULL, string format=emptystring, bool wait=false, bool view=true, callableTransform *xform);
-void gen64(stack *Stack)
+void gen_runtime64(stack *Stack)
{
callableTransform * xform=vm::pop<callableTransform *>(Stack);
bool view=vm::pop<bool>(Stack,true);
@@ -2014,7 +2017,7 @@ void gen64(stack *Stack)
picture * preamble=vm::pop<picture *>(Stack,NULL);
picture * f=vm::pop<picture *>(Stack);
string prefix=vm::pop<string>(Stack,emptystring);
-#line 1737 "runtime.in"
+#line 1705 "runtime.in"
if(prefix.empty()) prefix=outname();
picture *result=new picture;
@@ -2057,9 +2060,9 @@ void gen64(stack *Stack)
result->shipout(preamble,prefix,format,0.0,wait,view);
}
-#line 1780 "runtime.in"
+#line 1748 "runtime.in"
// void shipout3(string prefix, picture *f, string format=emptystring, real width, real height, real angle, real zoom, triple m, triple M, pair shift, realarray2 *t, realarray *background, triplearray *lights, realarray2 *diffuse, realarray2 *ambient, realarray2 *specular, bool viewportlighting, bool view=true);
-void gen65(stack *Stack)
+void gen_runtime65(stack *Stack)
{
bool view=vm::pop<bool>(Stack,true);
bool viewportlighting=vm::pop<bool>(Stack);
@@ -2079,7 +2082,7 @@ void gen65(stack *Stack)
string format=vm::pop<string>(Stack,emptystring);
picture * f=vm::pop<picture *>(Stack);
string prefix=vm::pop<string>(Stack);
-#line 1786 "runtime.in"
+#line 1754 "runtime.in"
size_t n=checkArrays(lights,diffuse);
checkEqual(n,checkArray(ambient));
checkEqual(n,checkArray(specular));
@@ -2091,25 +2094,25 @@ void gen65(stack *Stack)
copyArray2C(specular,false,4),viewportlighting,view);
}
-#line 1798 "runtime.in"
+#line 1766 "runtime.in"
// void shipout3(string prefix, picture *f);
-void gen66(stack *Stack)
+void gen_runtime66(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
string prefix=vm::pop<string>(Stack);
-#line 1799 "runtime.in"
+#line 1767 "runtime.in"
f->shipout3(prefix);
}
-#line 1803 "runtime.in"
+#line 1771 "runtime.in"
// void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, callableTransform *xform);
-void gen67(stack *Stack)
+void gen_runtime67(stack *Stack)
{
callableTransform * xform=vm::pop<callableTransform *>(Stack);
real magnification=vm::pop<real>(Stack,1);
picture * preamble=vm::pop<picture *>(Stack,NULL);
picture * f=vm::pop<picture *>(Stack);
-#line 1805 "runtime.in"
+#line 1773 "runtime.in"
unsigned level=0;
unsigned n=0;
@@ -2230,214 +2233,214 @@ void gen67(stack *Stack)
}
}
-#line 1926 "runtime.in"
+#line 1894 "runtime.in"
// void purge(Int divisor=0);
-void gen68(stack *Stack)
+void gen_runtime68(stack *Stack)
{
Int divisor=vm::pop<Int>(Stack,0);
-#line 1927 "runtime.in"
+#line 1895 "runtime.in"
purge(divisor);
}
// Pen operations
-#line 1933 "runtime.in"
+#line 1901 "runtime.in"
void newPen(stack *Stack)
{
-#line 1934 "runtime.in"
+#line 1902 "runtime.in"
{Stack->push<pen>(pen()); return;}
}
-#line 1939 "runtime.in"
+#line 1907 "runtime.in"
// bool ==(pen a, pen b);
-void gen70(stack *Stack)
+void gen_runtime70(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 1940 "runtime.in"
+#line 1908 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 1944 "runtime.in"
+#line 1912 "runtime.in"
// bool !=(pen a, pen b);
-void gen71(stack *Stack)
+void gen_runtime71(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 1945 "runtime.in"
+#line 1913 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 1949 "runtime.in"
+#line 1917 "runtime.in"
// pen +(pen a, pen b);
-void gen72(stack *Stack)
+void gen_runtime72(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 1950 "runtime.in"
+#line 1918 "runtime.in"
{Stack->push<pen>(a+b); return;}
}
-#line 1954 "runtime.in"
+#line 1922 "runtime.in"
// pen *(real a, pen b);
-void gen73(stack *Stack)
+void gen_runtime73(stack *Stack)
{
pen b=vm::pop<pen>(Stack);
real a=vm::pop<real>(Stack);
-#line 1955 "runtime.in"
+#line 1923 "runtime.in"
{Stack->push<pen>(a*b); return;}
}
-#line 1959 "runtime.in"
+#line 1927 "runtime.in"
// pen *(pen a, real b);
-void gen74(stack *Stack)
+void gen_runtime74(stack *Stack)
{
real b=vm::pop<real>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 1960 "runtime.in"
+#line 1928 "runtime.in"
{Stack->push<pen>(b*a); return;}
}
-#line 1964 "runtime.in"
+#line 1932 "runtime.in"
// pair max(pen p);
-void gen75(stack *Stack)
+void gen_runtime75(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 1965 "runtime.in"
+#line 1933 "runtime.in"
{Stack->push<pair>(p.bounds().Max()); return;}
}
-#line 1969 "runtime.in"
+#line 1937 "runtime.in"
// pair min(pen p);
-void gen76(stack *Stack)
+void gen_runtime76(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 1970 "runtime.in"
+#line 1938 "runtime.in"
{Stack->push<pair>(p.bounds().Min()); return;}
}
// Reset the meaning of pen default attributes.
-#line 1975 "runtime.in"
+#line 1943 "runtime.in"
// void resetdefaultpen();
-void gen77(stack *)
+void gen_runtime77(stack *)
{
-#line 1976 "runtime.in"
+#line 1944 "runtime.in"
processData().defaultpen=camp::pen::initialpen();
}
-#line 1980 "runtime.in"
+#line 1948 "runtime.in"
// void defaultpen(pen p);
-void gen78(stack *Stack)
+void gen_runtime78(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 1981 "runtime.in"
+#line 1949 "runtime.in"
processData().defaultpen=pen(resolvepen,p);
}
-#line 1985 "runtime.in"
+#line 1953 "runtime.in"
// pen defaultpen();
-void gen79(stack *Stack)
+void gen_runtime79(stack *Stack)
{
-#line 1986 "runtime.in"
+#line 1954 "runtime.in"
{Stack->push<pen>(processData().defaultpen); return;}
}
-#line 1990 "runtime.in"
+#line 1958 "runtime.in"
// bool invisible(pen p);
-void gen80(stack *Stack)
+void gen_runtime80(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 1991 "runtime.in"
+#line 1959 "runtime.in"
{Stack->push<bool>(p.invisible()); return;}
}
-#line 1995 "runtime.in"
+#line 1963 "runtime.in"
// pen invisible();
-void gen81(stack *Stack)
+void gen_runtime81(stack *Stack)
{
-#line 1996 "runtime.in"
+#line 1964 "runtime.in"
{Stack->push<pen>(pen(invisiblepen)); return;}
}
-#line 2000 "runtime.in"
+#line 1968 "runtime.in"
// pen gray(pen p);
-void gen82(stack *Stack)
+void gen_runtime82(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2001 "runtime.in"
+#line 1969 "runtime.in"
p.togrey();
{Stack->push<pen>(p); return;}
}
-#line 2006 "runtime.in"
+#line 1974 "runtime.in"
// pen rgb(pen p);
-void gen83(stack *Stack)
+void gen_runtime83(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2007 "runtime.in"
+#line 1975 "runtime.in"
p.torgb();
{Stack->push<pen>(p); return;}
}
-#line 2012 "runtime.in"
+#line 1980 "runtime.in"
// pen cmyk(pen p);
-void gen84(stack *Stack)
+void gen_runtime84(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2013 "runtime.in"
+#line 1981 "runtime.in"
p.tocmyk();
{Stack->push<pen>(p); return;}
}
-#line 2018 "runtime.in"
+#line 1986 "runtime.in"
// pen interp(pen a, pen b, real t);
-void gen85(stack *Stack)
+void gen_runtime85(stack *Stack)
{
real t=vm::pop<real>(Stack);
pen b=vm::pop<pen>(Stack);
pen a=vm::pop<pen>(Stack);
-#line 2019 "runtime.in"
+#line 1987 "runtime.in"
{Stack->push<pen>(interpolate(a,b,t)); return;}
}
-#line 2023 "runtime.in"
+#line 1991 "runtime.in"
// pen rgb(real r, real g, real b);
-void gen86(stack *Stack)
+void gen_runtime86(stack *Stack)
{
real b=vm::pop<real>(Stack);
real g=vm::pop<real>(Stack);
real r=vm::pop<real>(Stack);
-#line 2024 "runtime.in"
+#line 1992 "runtime.in"
{Stack->push<pen>(pen(r,g,b)); return;}
}
-#line 2028 "runtime.in"
+#line 1996 "runtime.in"
// pen cmyk(real c, real m, real y, real k);
-void gen87(stack *Stack)
+void gen_runtime87(stack *Stack)
{
real k=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
real m=vm::pop<real>(Stack);
real c=vm::pop<real>(Stack);
-#line 2029 "runtime.in"
+#line 1997 "runtime.in"
{Stack->push<pen>(pen(c,m,y,k)); return;}
}
-#line 2033 "runtime.in"
+#line 2001 "runtime.in"
// pen gray(real gray);
-void gen88(stack *Stack)
+void gen_runtime88(stack *Stack)
{
real gray=vm::pop<real>(Stack);
-#line 2034 "runtime.in"
+#line 2002 "runtime.in"
{Stack->push<pen>(pen(gray)); return;}
}
-#line 2038 "runtime.in"
+#line 2006 "runtime.in"
// realarray* colors(pen p);
-void gen89(stack *Stack)
+void gen_runtime89(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2039 "runtime.in"
+#line 2007 "runtime.in"
size_t n=ColorComponents[p.colorspace()];
array *a=new array(n);
@@ -2464,60 +2467,60 @@ void gen89(stack *Stack)
{Stack->push<realarray*>(a); return;}
}
-#line 2066 "runtime.in"
+#line 2034 "runtime.in"
// string colorspace(pen p);
-void gen90(stack *Stack)
+void gen_runtime90(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2067 "runtime.in"
+#line 2035 "runtime.in"
string s=ColorDeviceSuffix[p.colorspace()];
std::transform(s.begin(),s.end(),s.begin(),tolower);
{Stack->push<string>(s); return;}
}
-#line 2073 "runtime.in"
+#line 2041 "runtime.in"
// pen pattern(string *s);
-void gen91(stack *Stack)
+void gen_runtime91(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 2074 "runtime.in"
+#line 2042 "runtime.in"
{Stack->push<pen>(pen(setpattern,*s)); return;}
}
-#line 2078 "runtime.in"
+#line 2046 "runtime.in"
// string pattern(pen p);
-void gen92(stack *Stack)
+void gen_runtime92(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2079 "runtime.in"
+#line 2047 "runtime.in"
{Stack->push<string>(p.fillpattern()); return;}
}
-#line 2083 "runtime.in"
+#line 2051 "runtime.in"
// pen fillrule(Int n);
-void gen93(stack *Stack)
+void gen_runtime93(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 2084 "runtime.in"
+#line 2052 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nFill ? (FillRule) n : DEFFILL)); return;}
}
-#line 2088 "runtime.in"
+#line 2056 "runtime.in"
// Int fillrule(pen p);
-void gen94(stack *Stack)
+void gen_runtime94(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2089 "runtime.in"
+#line 2057 "runtime.in"
{Stack->push<Int>(p.Fillrule()); return;}
}
-#line 2093 "runtime.in"
+#line 2061 "runtime.in"
// pen opacity(real opacity=1.0, string blend=defaulttransparency);
-void gen95(stack *Stack)
+void gen_runtime95(stack *Stack)
{
string blend=vm::pop<string>(Stack,defaulttransparency);
real opacity=vm::pop<real>(Stack,1.0);
-#line 2094 "runtime.in"
+#line 2062 "runtime.in"
for(Int i=0; i < nBlendMode; ++i)
if(blend == BlendMode[i]) {Stack->push<pen>(pen(Transparency(blend,opacity))); return;}
@@ -2526,301 +2529,301 @@ void gen95(stack *Stack)
error(buf);
}
-#line 2103 "runtime.in"
+#line 2071 "runtime.in"
// real opacity(pen p);
-void gen96(stack *Stack)
+void gen_runtime96(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2104 "runtime.in"
+#line 2072 "runtime.in"
{Stack->push<real>(p.opacity()); return;}
}
-#line 2108 "runtime.in"
+#line 2076 "runtime.in"
// string blend(pen p);
-void gen97(stack *Stack)
+void gen_runtime97(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2109 "runtime.in"
+#line 2077 "runtime.in"
{Stack->push<string>(p.blend()); return;}
}
-#line 2113 "runtime.in"
+#line 2081 "runtime.in"
// pen linetype(string *s, real offset=0, bool scale=true, bool adjust=true);
-void gen98(stack *Stack)
+void gen_runtime98(stack *Stack)
{
bool adjust=vm::pop<bool>(Stack,true);
bool scale=vm::pop<bool>(Stack,true);
real offset=vm::pop<real>(Stack,0);
string * s=vm::pop<string *>(Stack);
-#line 2114 "runtime.in"
+#line 2082 "runtime.in"
{Stack->push<pen>(pen(LineType(*s,offset,scale,adjust))); return;}
}
-#line 2118 "runtime.in"
+#line 2086 "runtime.in"
// string linetype(pen p=CURRENTPEN);
-void gen99(stack *Stack)
+void gen_runtime99(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2119 "runtime.in"
+#line 2087 "runtime.in"
{Stack->push<string>(p.stroke()); return;}
}
-#line 2123 "runtime.in"
+#line 2091 "runtime.in"
// real offset(pen p);
-void gen100(stack *Stack)
+void gen_runtime100(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2124 "runtime.in"
+#line 2092 "runtime.in"
{Stack->push<real>(p.linetype().offset); return;}
}
-#line 2128 "runtime.in"
+#line 2096 "runtime.in"
// bool scale(pen p);
-void gen101(stack *Stack)
+void gen_runtime101(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2129 "runtime.in"
+#line 2097 "runtime.in"
{Stack->push<bool>(p.linetype().scale); return;}
}
-#line 2133 "runtime.in"
+#line 2101 "runtime.in"
// bool adjust(pen p);
-void gen102(stack *Stack)
+void gen_runtime102(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2134 "runtime.in"
+#line 2102 "runtime.in"
{Stack->push<bool>(p.linetype().adjust); return;}
}
-#line 2138 "runtime.in"
+#line 2106 "runtime.in"
// pen adjust(pen p, real arclength, bool cyclic);
-void gen103(stack *Stack)
+void gen_runtime103(stack *Stack)
{
bool cyclic=vm::pop<bool>(Stack);
real arclength=vm::pop<real>(Stack);
pen p=vm::pop<pen>(Stack);
-#line 2139 "runtime.in"
+#line 2107 "runtime.in"
{Stack->push<pen>(adjustdash(p,arclength,cyclic)); return;}
}
-#line 2143 "runtime.in"
+#line 2111 "runtime.in"
// pen linecap(Int n);
-void gen104(stack *Stack)
+void gen_runtime104(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 2144 "runtime.in"
+#line 2112 "runtime.in"
{Stack->push<pen>(pen(setlinecap,n >= 0 && n < nCap ? n : DEFCAP)); return;}
}
-#line 2148 "runtime.in"
+#line 2116 "runtime.in"
// Int linecap(pen p=CURRENTPEN);
-void gen105(stack *Stack)
+void gen_runtime105(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2149 "runtime.in"
+#line 2117 "runtime.in"
{Stack->push<Int>(p.cap()); return;}
}
-#line 2153 "runtime.in"
+#line 2121 "runtime.in"
// pen linejoin(Int n);
-void gen106(stack *Stack)
+void gen_runtime106(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 2154 "runtime.in"
+#line 2122 "runtime.in"
{Stack->push<pen>(pen(setlinejoin,n >= 0 && n < nJoin ? n : DEFJOIN)); return;}
}
-#line 2158 "runtime.in"
+#line 2126 "runtime.in"
// Int linejoin(pen p=CURRENTPEN);
-void gen107(stack *Stack)
+void gen_runtime107(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2159 "runtime.in"
+#line 2127 "runtime.in"
{Stack->push<Int>(p.join()); return;}
}
-#line 2163 "runtime.in"
+#line 2131 "runtime.in"
// pen miterlimit(real x);
-void gen108(stack *Stack)
+void gen_runtime108(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 2164 "runtime.in"
+#line 2132 "runtime.in"
{Stack->push<pen>(pen(setmiterlimit,x >= 1.0 ? x : DEFJOIN)); return;}
}
-#line 2168 "runtime.in"
+#line 2136 "runtime.in"
// real miterlimit(pen p=CURRENTPEN);
-void gen109(stack *Stack)
+void gen_runtime109(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2169 "runtime.in"
+#line 2137 "runtime.in"
{Stack->push<real>(p.miter()); return;}
}
-#line 2173 "runtime.in"
+#line 2141 "runtime.in"
// pen linewidth(real x);
-void gen110(stack *Stack)
+void gen_runtime110(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 2174 "runtime.in"
+#line 2142 "runtime.in"
{Stack->push<pen>(pen(setlinewidth,x >= 0.0 ? x : DEFWIDTH)); return;}
}
-#line 2178 "runtime.in"
+#line 2146 "runtime.in"
// real linewidth(pen p=CURRENTPEN);
-void gen111(stack *Stack)
+void gen_runtime111(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2179 "runtime.in"
+#line 2147 "runtime.in"
{Stack->push<real>(p.width()); return;}
}
-#line 2183 "runtime.in"
+#line 2151 "runtime.in"
// pen fontcommand(string *s);
-void gen112(stack *Stack)
+void gen_runtime112(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 2184 "runtime.in"
+#line 2152 "runtime.in"
{Stack->push<pen>(pen(setfont,*s)); return;}
}
-#line 2188 "runtime.in"
+#line 2156 "runtime.in"
// string font(pen p=CURRENTPEN);
-void gen113(stack *Stack)
+void gen_runtime113(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2189 "runtime.in"
+#line 2157 "runtime.in"
{Stack->push<string>(p.Font()); return;}
}
-#line 2193 "runtime.in"
+#line 2161 "runtime.in"
// pen fontsize(real size, real lineskip);
-void gen114(stack *Stack)
+void gen_runtime114(stack *Stack)
{
real lineskip=vm::pop<real>(Stack);
real size=vm::pop<real>(Stack);
-#line 2194 "runtime.in"
+#line 2162 "runtime.in"
{Stack->push<pen>(pen(setfontsize,size > 0.0 ? size : 0.0,
lineskip > 0.0 ? lineskip : 0.0)); return;}
}
-#line 2199 "runtime.in"
+#line 2167 "runtime.in"
// real fontsize(pen p=CURRENTPEN);
-void gen115(stack *Stack)
+void gen_runtime115(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2200 "runtime.in"
+#line 2168 "runtime.in"
{Stack->push<real>(p.size()); return;}
}
-#line 2204 "runtime.in"
+#line 2172 "runtime.in"
// real lineskip(pen p=CURRENTPEN);
-void gen116(stack *Stack)
+void gen_runtime116(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2205 "runtime.in"
+#line 2173 "runtime.in"
{Stack->push<real>(p.Lineskip()); return;}
}
-#line 2209 "runtime.in"
+#line 2177 "runtime.in"
// pen overwrite(Int n);
-void gen117(stack *Stack)
+void gen_runtime117(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 2210 "runtime.in"
+#line 2178 "runtime.in"
{Stack->push<pen>(pen(setoverwrite,n >= 0 && n < nOverwrite ? (overwrite_t) n :
DEFWRITE)); return;}
}
-#line 2215 "runtime.in"
+#line 2183 "runtime.in"
// Int overwrite(pen p=CURRENTPEN);
-void gen118(stack *Stack)
+void gen_runtime118(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2216 "runtime.in"
+#line 2184 "runtime.in"
{Stack->push<Int>(p.Overwrite()); return;}
}
-#line 2220 "runtime.in"
+#line 2188 "runtime.in"
// pen basealign(Int n);
-void gen119(stack *Stack)
+void gen_runtime119(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 2221 "runtime.in"
+#line 2189 "runtime.in"
{Stack->push<pen>(pen(n >= 0 && n < nBaseLine ? (BaseLine) n : DEFBASE)); return;}
}
-#line 2225 "runtime.in"
+#line 2193 "runtime.in"
// Int basealign(pen p=CURRENTPEN);
-void gen120(stack *Stack)
+void gen_runtime120(stack *Stack)
{
pen p=vm::pop<pen>(Stack,CURRENTPEN);
-#line 2226 "runtime.in"
+#line 2194 "runtime.in"
{Stack->push<Int>(p.Baseline()); return;}
}
-#line 2230 "runtime.in"
+#line 2198 "runtime.in"
// transform transform(pen p);
-void gen121(stack *Stack)
+void gen_runtime121(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2231 "runtime.in"
+#line 2199 "runtime.in"
{Stack->push<transform>(p.getTransform()); return;}
}
-#line 2235 "runtime.in"
+#line 2203 "runtime.in"
// path nib(pen p);
-void gen122(stack *Stack)
+void gen_runtime122(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2236 "runtime.in"
+#line 2204 "runtime.in"
{Stack->push<path>(p.Path()); return;}
}
-#line 2240 "runtime.in"
+#line 2208 "runtime.in"
// pen makepen(path p);
-void gen123(stack *Stack)
+void gen_runtime123(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2241 "runtime.in"
+#line 2209 "runtime.in"
{Stack->push<pen>(pen(p)); return;}
}
-#line 2245 "runtime.in"
+#line 2213 "runtime.in"
// pen colorless(pen p);
-void gen124(stack *Stack)
+void gen_runtime124(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
-#line 2246 "runtime.in"
+#line 2214 "runtime.in"
p.colorless();
{Stack->push<pen>(p); return;}
}
// Interactive mode
-#line 2252 "runtime.in"
+#line 2220 "runtime.in"
// bool interactive();
-void gen125(stack *Stack)
+void gen_runtime125(stack *Stack)
{
-#line 2253 "runtime.in"
+#line 2221 "runtime.in"
{Stack->push<bool>(interact::interactive); return;}
}
-#line 2258 "runtime.in"
+#line 2226 "runtime.in"
// bool uptodate();
-void gen126(stack *Stack)
+void gen_runtime126(stack *Stack)
{
-#line 2259 "runtime.in"
+#line 2227 "runtime.in"
{Stack->push<bool>(interact::uptodate); return;}
}
// System commands
-#line 2265 "runtime.in"
+#line 2233 "runtime.in"
// Int system(stringarray *s);
-void gen127(stack *Stack)
+void gen_runtime127(stack *Stack)
{
stringarray * s=vm::pop<stringarray *>(Stack);
-#line 2266 "runtime.in"
+#line 2234 "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;}
@@ -2830,166 +2833,162 @@ void gen127(stack *Stack)
{Stack->push<Int>(System(cmd)); return;}
}
-#line 2277 "runtime.in"
+#line 2245 "runtime.in"
// bool view();
-void gen128(stack *Stack)
+void gen_runtime128(stack *Stack)
{
-#line 2278 "runtime.in"
+#line 2246 "runtime.in"
{Stack->push<bool>(view()); return;}
}
-#line 2282 "runtime.in"
+#line 2250 "runtime.in"
// string asydir();
-void gen129(stack *Stack)
+void gen_runtime129(stack *Stack)
{
-#line 2283 "runtime.in"
+#line 2251 "runtime.in"
{Stack->push<string>(systemDir); return;}
}
-#line 2287 "runtime.in"
+#line 2255 "runtime.in"
// string locale(string s=emptystring);
-void gen130(stack *Stack)
+void gen_runtime130(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 2288 "runtime.in"
+#line 2256 "runtime.in"
char *L=setlocale(LC_ALL,s.empty() ? NULL : s.c_str());
{Stack->push<string>(L != NULL ? string(L) : ""); return;}
}
-#line 2293 "runtime.in"
+#line 2261 "runtime.in"
// void abort(string s=emptystring);
-void gen131(stack *Stack)
+void gen_runtime131(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 2294 "runtime.in"
+#line 2262 "runtime.in"
if(s.empty()) throw handled_error();
error(s.c_str());
}
-#line 2299 "runtime.in"
+#line 2267 "runtime.in"
// void exit();
-void gen132(stack *)
+void gen_runtime132(stack *)
{
-#line 2300 "runtime.in"
+#line 2268 "runtime.in"
throw quit();
}
-#line 2304 "runtime.in"
+#line 2272 "runtime.in"
// void assert(bool b, string s=emptystring);
-void gen133(stack *Stack)
+void gen_runtime133(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
bool b=vm::pop<bool>(Stack);
-#line 2305 "runtime.in"
+#line 2273 "runtime.in"
flush(cout);
if(!b) {
ostringstream buf;
buf << "assert FAILED";
- if(s != "") buf << ": " << s << endl;
+ if(s != "") buf << ": " << s;
error(buf);
}
}
-#line 2315 "runtime.in"
+#line 2283 "runtime.in"
// void sleep(Int seconds);
-void gen134(stack *Stack)
+void gen_runtime134(stack *Stack)
{
Int seconds=vm::pop<Int>(Stack);
-#line 2316 "runtime.in"
+#line 2284 "runtime.in"
if(seconds <= 0) return;
sleep(seconds);
}
-#line 2321 "runtime.in"
+#line 2289 "runtime.in"
// void usleep(Int microseconds);
-void gen135(stack *Stack)
+void gen_runtime135(stack *Stack)
{
Int microseconds=vm::pop<Int>(Stack);
-#line 2322 "runtime.in"
+#line 2290 "runtime.in"
if(microseconds <= 0) return;
usleep((unsigned long) microseconds);
}
-#line 2327 "runtime.in"
+#line 2295 "runtime.in"
// void _eval(string *s, bool embedded, bool interactiveWrite=false);
-void gen136(stack *Stack)
+void gen_runtime136(stack *Stack)
{
bool interactiveWrite=vm::pop<bool>(Stack,false);
bool embedded=vm::pop<bool>(Stack);
string * s=vm::pop<string *>(Stack);
-#line 2328 "runtime.in"
- if (embedded) {
+#line 2296 "runtime.in"
+ if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
- if (e && is) {
+ if(e && is)
runStringEmbedded(*s, *e, *is);
- } else {
- cerr << "no runtime environment for embedded eval" << endl;
- }
- } else {
+ else
+ error(noruntime);
+ } else
runString(*s,interactiveWrite);
- }
}
-#line 2342 "runtime.in"
+#line 2308 "runtime.in"
// void _eval(runnable *s, bool embedded);
-void gen137(stack *Stack)
+void gen_runtime137(stack *Stack)
{
bool embedded=vm::pop<bool>(Stack);
runnable * s=vm::pop<runnable *>(Stack);
-#line 2343 "runtime.in"
+#line 2309 "runtime.in"
absyntax::block *ast=new absyntax::block(s->getPos(), false);
ast->add(s);
- if (embedded) {
+ if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
- if (e && is) {
+ if(e && is)
runCodeEmbedded(ast, *e, *is);
- } else {
- cerr << "no runtime environment for embedded eval" << endl;
- }
- } else {
+ else
+ error(noruntime);
+ } else
runCode(ast);
- }
}
-#line 2360 "runtime.in"
+#line 2324 "runtime.in"
// string location();
-void gen138(stack *Stack)
+void gen_runtime138(stack *Stack)
{
-#line 2361 "runtime.in"
+#line 2325 "runtime.in"
ostringstream buf;
buf << getPos();
{Stack->push<string>(buf.str()); return;}
}
// Wrapper for the stack::load() method.
-#line 2367 "runtime.in"
+#line 2331 "runtime.in"
void loadModule(stack *Stack)
{
string * index=vm::pop<string *>(Stack);
-#line 2368 "runtime.in"
+#line 2332 "runtime.in"
Stack->load(*index);
}
-#line 2372 "runtime.in"
+#line 2336 "runtime.in"
// string cd(string s=emptystring);
-void gen140(stack *Stack)
+void gen_runtime140(stack *Stack)
{
string s=vm::pop<string>(Stack,emptystring);
-#line 2373 "runtime.in"
+#line 2337 "runtime.in"
if(!s.empty() && !globalwrite()) writeDisabled();
{Stack->push<string>(setPath(s.c_str())); return;}
}
-#line 2378 "runtime.in"
+#line 2342 "runtime.in"
// void list(string *s, bool imports=false);
-void gen141(stack *Stack)
+void gen_runtime141(stack *Stack)
{
bool imports=vm::pop<bool>(Stack,false);
string * s=vm::pop<string *>(Stack);
-#line 2379 "runtime.in"
+#line 2343 "runtime.in"
if(*s == "-") return;
trans::genv ge;
symbol *name=symbol::trans(*s);
@@ -2999,144 +2998,144 @@ void gen141(stack *Stack)
// Path operations
-#line 2389 "runtime.in"
+#line 2353 "runtime.in"
void nullPath(stack *Stack)
{
-#line 2390 "runtime.in"
+#line 2354 "runtime.in"
{Stack->push<path>(nullpath); return;}
}
-#line 2395 "runtime.in"
+#line 2359 "runtime.in"
// bool ==(path a, path b);
-void gen143(stack *Stack)
+void gen_runtime143(stack *Stack)
{
path b=vm::pop<path>(Stack);
path a=vm::pop<path>(Stack);
-#line 2396 "runtime.in"
+#line 2360 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 2400 "runtime.in"
+#line 2364 "runtime.in"
// bool !=(path a, path b);
-void gen144(stack *Stack)
+void gen_runtime144(stack *Stack)
{
path b=vm::pop<path>(Stack);
path a=vm::pop<path>(Stack);
-#line 2401 "runtime.in"
+#line 2365 "runtime.in"
{Stack->push<bool>(!(a == b)); return;}
}
-#line 2405 "runtime.in"
+#line 2369 "runtime.in"
// pair point(path p, Int t);
-void gen145(stack *Stack)
+void gen_runtime145(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2406 "runtime.in"
+#line 2370 "runtime.in"
{Stack->push<pair>(p.point((Int) t)); return;}
}
-#line 2410 "runtime.in"
+#line 2374 "runtime.in"
// pair point(path p, real t);
-void gen146(stack *Stack)
+void gen_runtime146(stack *Stack)
{
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2411 "runtime.in"
+#line 2375 "runtime.in"
{Stack->push<pair>(p.point(t)); return;}
}
-#line 2415 "runtime.in"
+#line 2379 "runtime.in"
// pair precontrol(path p, Int t);
-void gen147(stack *Stack)
+void gen_runtime147(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2416 "runtime.in"
+#line 2380 "runtime.in"
{Stack->push<pair>(p.precontrol((Int) t)); return;}
}
-#line 2420 "runtime.in"
+#line 2384 "runtime.in"
// pair precontrol(path p, real t);
-void gen148(stack *Stack)
+void gen_runtime148(stack *Stack)
{
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2421 "runtime.in"
+#line 2385 "runtime.in"
{Stack->push<pair>(p.precontrol(t)); return;}
}
-#line 2425 "runtime.in"
+#line 2389 "runtime.in"
// pair postcontrol(path p, Int t);
-void gen149(stack *Stack)
+void gen_runtime149(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2426 "runtime.in"
+#line 2390 "runtime.in"
{Stack->push<pair>(p.postcontrol((Int) t)); return;}
}
-#line 2430 "runtime.in"
+#line 2394 "runtime.in"
// pair postcontrol(path p, real t);
-void gen150(stack *Stack)
+void gen_runtime150(stack *Stack)
{
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2431 "runtime.in"
+#line 2395 "runtime.in"
{Stack->push<pair>(p.postcontrol(t)); return;}
}
-#line 2435 "runtime.in"
+#line 2399 "runtime.in"
// pair dir(path p, Int t, Int sign=0, bool normalize=true);
-void gen151(stack *Stack)
+void gen_runtime151(stack *Stack)
{
bool normalize=vm::pop<bool>(Stack,true);
Int sign=vm::pop<Int>(Stack,0);
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2436 "runtime.in"
+#line 2400 "runtime.in"
{Stack->push<pair>(p.dir(t,sign,normalize)); return;}
}
-#line 2440 "runtime.in"
+#line 2404 "runtime.in"
// pair dir(path p, real t, bool normalize=true);
-void gen152(stack *Stack)
+void gen_runtime152(stack *Stack)
{
bool normalize=vm::pop<bool>(Stack,true);
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2441 "runtime.in"
+#line 2405 "runtime.in"
{Stack->push<pair>(p.dir(t,normalize)); return;}
}
-#line 2445 "runtime.in"
+#line 2409 "runtime.in"
// pair accel(path p, Int t, Int sign=0);
-void gen153(stack *Stack)
+void gen_runtime153(stack *Stack)
{
Int sign=vm::pop<Int>(Stack,0);
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2446 "runtime.in"
+#line 2410 "runtime.in"
{Stack->push<pair>(p.accel(t,sign)); return;}
}
-#line 2450 "runtime.in"
+#line 2414 "runtime.in"
// pair accel(path p, real t);
-void gen154(stack *Stack)
+void gen_runtime154(stack *Stack)
{
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2451 "runtime.in"
+#line 2415 "runtime.in"
{Stack->push<pair>(p.accel(t)); return;}
}
-#line 2455 "runtime.in"
+#line 2419 "runtime.in"
// real radius(path p, real t);
-void gen155(stack *Stack)
+void gen_runtime155(stack *Stack)
{
real t=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2456 "runtime.in"
+#line 2420 "runtime.in"
pair v=p.dir(t,false);
pair a=p.accel(t);
real d=dot(a,v);
@@ -3147,40 +3146,40 @@ void gen155(stack *Stack)
{Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;}
}
-#line 2467 "runtime.in"
+#line 2431 "runtime.in"
// path reverse(path p);
-void gen156(stack *Stack)
+void gen_runtime156(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2468 "runtime.in"
+#line 2432 "runtime.in"
{Stack->push<path>(p.reverse()); return;}
}
-#line 2472 "runtime.in"
+#line 2436 "runtime.in"
// path subpath(path p, Int a, Int b);
-void gen157(stack *Stack)
+void gen_runtime157(stack *Stack)
{
Int b=vm::pop<Int>(Stack);
Int a=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2473 "runtime.in"
+#line 2437 "runtime.in"
{Stack->push<path>(p.subpath((Int) a, (Int) b)); return;}
}
-#line 2477 "runtime.in"
+#line 2441 "runtime.in"
// path subpath(path p, real a, real b);
-void gen158(stack *Stack)
+void gen_runtime158(stack *Stack)
{
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2478 "runtime.in"
+#line 2442 "runtime.in"
{Stack->push<path>(p.subpath(a,b)); return;}
}
-#line 2482 "runtime.in"
+#line 2446 "runtime.in"
// path nurb(pair z0, pair z1, pair z2, pair z3, real w0, real w1, real w2, real w3, Int m);
-void gen159(stack *Stack)
+void gen_runtime159(stack *Stack)
{
Int m=vm::pop<Int>(Stack);
real w3=vm::pop<real>(Stack);
@@ -3191,93 +3190,93 @@ void gen159(stack *Stack)
pair z2=vm::pop<pair>(Stack);
pair z1=vm::pop<pair>(Stack);
pair z0=vm::pop<pair>(Stack);
-#line 2484 "runtime.in"
+#line 2448 "runtime.in"
{Stack->push<path>(nurb(z0,z1,z2,z3,w0,w1,w2,w3,m)); return;}
}
-#line 2488 "runtime.in"
+#line 2452 "runtime.in"
// Int length(path p);
-void gen160(stack *Stack)
+void gen_runtime160(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2489 "runtime.in"
+#line 2453 "runtime.in"
{Stack->push<Int>(p.length()); return;}
}
-#line 2493 "runtime.in"
+#line 2457 "runtime.in"
// bool cyclic(path p);
-void gen161(stack *Stack)
+void gen_runtime161(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2494 "runtime.in"
+#line 2458 "runtime.in"
{Stack->push<bool>(p.cyclic()); return;}
}
-#line 2498 "runtime.in"
+#line 2462 "runtime.in"
// bool straight(path p, Int t);
-void gen162(stack *Stack)
+void gen_runtime162(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path p=vm::pop<path>(Stack);
-#line 2499 "runtime.in"
+#line 2463 "runtime.in"
{Stack->push<bool>(p.straight(t)); return;}
}
-#line 2503 "runtime.in"
+#line 2467 "runtime.in"
// path unstraighten(path p);
-void gen163(stack *Stack)
+void gen_runtime163(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2504 "runtime.in"
+#line 2468 "runtime.in"
{Stack->push<path>(p.unstraighten()); return;}
}
-#line 2508 "runtime.in"
+#line 2472 "runtime.in"
// bool piecewisestraight(path p);
-void gen164(stack *Stack)
+void gen_runtime164(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2509 "runtime.in"
+#line 2473 "runtime.in"
{Stack->push<bool>(p.piecewisestraight()); return;}
}
-#line 2513 "runtime.in"
+#line 2477 "runtime.in"
// real arclength(path p);
-void gen165(stack *Stack)
+void gen_runtime165(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2514 "runtime.in"
+#line 2478 "runtime.in"
{Stack->push<real>(p.arclength()); return;}
}
-#line 2518 "runtime.in"
+#line 2482 "runtime.in"
// real arctime(path p, real dval);
-void gen166(stack *Stack)
+void gen_runtime166(stack *Stack)
{
real dval=vm::pop<real>(Stack);
path p=vm::pop<path>(Stack);
-#line 2519 "runtime.in"
+#line 2483 "runtime.in"
{Stack->push<real>(p.arctime(dval)); return;}
}
-#line 2523 "runtime.in"
+#line 2487 "runtime.in"
// real dirtime(path p, pair z);
-void gen167(stack *Stack)
+void gen_runtime167(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
path p=vm::pop<path>(Stack);
-#line 2524 "runtime.in"
+#line 2488 "runtime.in"
{Stack->push<real>(p.directiontime(z)); return;}
}
-#line 2528 "runtime.in"
+#line 2492 "runtime.in"
// realarray* intersect(path p, path q, real fuzz=-1);
-void gen168(stack *Stack)
+void gen_runtime168(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
path q=vm::pop<path>(Stack);
path p=vm::pop<path>(Stack);
-#line 2529 "runtime.in"
+#line 2493 "runtime.in"
bool exact=fuzz <= 0.0;
if(fuzz < 0)
fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
@@ -3293,14 +3292,14 @@ void gen168(stack *Stack)
{Stack->push<realarray*>(new array(0)); return;}
}
-#line 2545 "runtime.in"
+#line 2509 "runtime.in"
// realarray2* intersections(path p, path q, real fuzz=-1);
-void gen169(stack *Stack)
+void gen_runtime169(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
path q=vm::pop<path>(Stack);
path p=vm::pop<path>(Stack);
-#line 2546 "runtime.in"
+#line 2510 "runtime.in"
bool exact=fuzz <= 0.0;
if(fuzz < 0.0)
fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
@@ -3330,15 +3329,15 @@ void gen169(stack *Stack)
{Stack->push<realarray2*>(V); return;}
}
-#line 2576 "runtime.in"
+#line 2540 "runtime.in"
// realarray* intersections(path p, explicit pair a, explicit pair b, real fuzz=-1);
-void gen170(stack *Stack)
+void gen_runtime170(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
path p=vm::pop<path>(Stack);
-#line 2577 "runtime.in"
+#line 2541 "runtime.in"
if(fuzz < 0)
fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
::max(length(a),length(b)));
@@ -3354,15 +3353,15 @@ void gen170(stack *Stack)
// Return the intersection point of the extensions of the line segments
// PQ and pq.
-#line 2593 "runtime.in"
+#line 2557 "runtime.in"
// pair extension(pair P, pair Q, pair p, pair q);
-void gen171(stack *Stack)
+void gen_runtime171(stack *Stack)
{
pair q=vm::pop<pair>(Stack);
pair p=vm::pop<pair>(Stack);
pair Q=vm::pop<pair>(Stack);
pair P=vm::pop<pair>(Stack);
-#line 2594 "runtime.in"
+#line 2558 "runtime.in"
pair ac=P-Q;
pair bd=q-p;
real det=ac.getx()*bd.gety()-ac.gety()*bd.getx();
@@ -3370,49 +3369,49 @@ void gen171(stack *Stack)
{Stack->push<pair>(P+((p.getx()-P.getx())*bd.gety()-(p.gety()-P.gety())*bd.getx())*ac/det); return;}
}
-#line 2602 "runtime.in"
+#line 2566 "runtime.in"
// Int size(path p);
-void gen172(stack *Stack)
+void gen_runtime172(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2603 "runtime.in"
+#line 2567 "runtime.in"
{Stack->push<Int>(p.size()); return;}
}
-#line 2607 "runtime.in"
+#line 2571 "runtime.in"
// path &(path p, path q);
-void gen173(stack *Stack)
+void gen_runtime173(stack *Stack)
{
path q=vm::pop<path>(Stack);
path p=vm::pop<path>(Stack);
-#line 2608 "runtime.in"
+#line 2572 "runtime.in"
{Stack->push<path>(camp::concat(p,q)); return;}
}
-#line 2612 "runtime.in"
+#line 2576 "runtime.in"
// pair min(path p);
-void gen174(stack *Stack)
+void gen_runtime174(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2613 "runtime.in"
+#line 2577 "runtime.in"
{Stack->push<pair>(p.min()); return;}
}
-#line 2617 "runtime.in"
+#line 2581 "runtime.in"
// pair max(path p);
-void gen175(stack *Stack)
+void gen_runtime175(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2618 "runtime.in"
+#line 2582 "runtime.in"
{Stack->push<pair>(p.max()); return;}
}
-#line 2622 "runtime.in"
+#line 2586 "runtime.in"
// realarray* mintimes(path p);
-void gen176(stack *Stack)
+void gen_runtime176(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2623 "runtime.in"
+#line 2587 "runtime.in"
array *V=new array(2);
pair z=p.mintimes();
(*V)[0]=z.getx();
@@ -3420,12 +3419,12 @@ void gen176(stack *Stack)
{Stack->push<realarray*>(V); return;}
}
-#line 2631 "runtime.in"
+#line 2595 "runtime.in"
// realarray* maxtimes(path p);
-void gen177(stack *Stack)
+void gen_runtime177(stack *Stack)
{
path p=vm::pop<path>(Stack);
-#line 2632 "runtime.in"
+#line 2596 "runtime.in"
array *V=new array(2);
pair z=p.maxtimes();
(*V)[0]=z.getx();
@@ -3433,90 +3432,90 @@ void gen177(stack *Stack)
{Stack->push<realarray*>(V); return;}
}
-#line 2640 "runtime.in"
+#line 2604 "runtime.in"
// real relativedistance(real theta, real phi, real t, bool atleast);
-void gen178(stack *Stack)
+void gen_runtime178(stack *Stack)
{
bool atleast=vm::pop<bool>(Stack);
real t=vm::pop<real>(Stack);
real phi=vm::pop<real>(Stack);
real theta=vm::pop<real>(Stack);
-#line 2641 "runtime.in"
+#line 2605 "runtime.in"
{Stack->push<real>(camp::velocity(theta,phi,tension(t,atleast))); return;}
}
-#line 2645 "runtime.in"
+#line 2609 "runtime.in"
// Int windingnumber(patharray *p, pair z);
-void gen179(stack *Stack)
+void gen_runtime179(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
patharray * p=vm::pop<patharray *>(Stack);
-#line 2646 "runtime.in"
+#line 2610 "runtime.in"
{Stack->push<Int>(windingnumber(p,z)); return;}
}
-#line 2650 "runtime.in"
+#line 2614 "runtime.in"
// bool inside(explicit patharray *g, pair z, pen fillrule=CURRENTPEN);
-void gen180(stack *Stack)
+void gen_runtime180(stack *Stack)
{
pen fillrule=vm::pop<pen>(Stack,CURRENTPEN);
pair z=vm::pop<pair>(Stack);
patharray * g=vm::pop<patharray *>(Stack);
-#line 2651 "runtime.in"
+#line 2615 "runtime.in"
{Stack->push<bool>(fillrule.inside(windingnumber(g,z))); return;}
}
-#line 2655 "runtime.in"
+#line 2619 "runtime.in"
// bool inside(path g, pair z, pen fillrule=CURRENTPEN);
-void gen181(stack *Stack)
+void gen_runtime181(stack *Stack)
{
pen fillrule=vm::pop<pen>(Stack,CURRENTPEN);
pair z=vm::pop<pair>(Stack);
path g=vm::pop<path>(Stack);
-#line 2656 "runtime.in"
+#line 2620 "runtime.in"
{Stack->push<bool>(fillrule.inside(g.windingnumber(z))); return;}
}
// Determine the side of a--b that c lies on
// (negative=left, zero=on line, positive=right).
-#line 2662 "runtime.in"
+#line 2626 "runtime.in"
// real side(pair a, pair b, pair c);
-void gen182(stack *Stack)
+void gen_runtime182(stack *Stack)
{
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 2663 "runtime.in"
+#line 2627 "runtime.in"
{Stack->push<real>(orient2d(a,b,c)); return;}
}
// Determine the side of the counterclockwise circle through a,b,c that d
// lies on (negative=inside, 0=on circle, positive=right).
-#line 2669 "runtime.in"
+#line 2633 "runtime.in"
// real incircle(pair a, pair b, pair c, pair d);
-void gen183(stack *Stack)
+void gen_runtime183(stack *Stack)
{
pair d=vm::pop<pair>(Stack);
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 2670 "runtime.in"
+#line 2634 "runtime.in"
{Stack->push<real>(incircle(a.getx(),a.gety(),b.getx(),b.gety(),c.getx(),c.gety(),
d.getx(),d.gety())); return;}
}
// Path3 operations
-#line 2677 "runtime.in"
+#line 2641 "runtime.in"
// path3 path3(triplearray *pre, triplearray *point, triplearray *post, boolarray *straight, bool cyclic);
-void gen184(stack *Stack)
+void gen_runtime184(stack *Stack)
{
bool cyclic=vm::pop<bool>(Stack);
boolarray * straight=vm::pop<boolarray *>(Stack);
triplearray * post=vm::pop<triplearray *>(Stack);
triplearray * point=vm::pop<triplearray *>(Stack);
triplearray * pre=vm::pop<triplearray *>(Stack);
-#line 2679 "runtime.in"
+#line 2643 "runtime.in"
size_t n=checkArrays(pre,point);
checkEqual(n,checkArray(post));
checkEqual(n,checkArray(straight));
@@ -3531,144 +3530,144 @@ void gen184(stack *Stack)
{Stack->push<path3>(path3(nodes,(Int) n,cyclic)); return;}
}
-#line 2695 "runtime.in"
+#line 2659 "runtime.in"
void nullPath3(stack *Stack)
{
-#line 2696 "runtime.in"
+#line 2660 "runtime.in"
{Stack->push<path3>(nullpath3); return;}
}
-#line 2700 "runtime.in"
+#line 2664 "runtime.in"
// bool ==(path3 a, path3 b);
-void gen186(stack *Stack)
+void gen_runtime186(stack *Stack)
{
path3 b=vm::pop<path3>(Stack);
path3 a=vm::pop<path3>(Stack);
-#line 2701 "runtime.in"
+#line 2665 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 2705 "runtime.in"
+#line 2669 "runtime.in"
// bool !=(path3 a, path3 b);
-void gen187(stack *Stack)
+void gen_runtime187(stack *Stack)
{
path3 b=vm::pop<path3>(Stack);
path3 a=vm::pop<path3>(Stack);
-#line 2706 "runtime.in"
+#line 2670 "runtime.in"
{Stack->push<bool>(!(a == b)); return;}
}
-#line 2710 "runtime.in"
+#line 2674 "runtime.in"
// triple point(path3 p, Int t);
-void gen188(stack *Stack)
+void gen_runtime188(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2711 "runtime.in"
+#line 2675 "runtime.in"
{Stack->push<triple>(p.point((Int) t)); return;}
}
-#line 2715 "runtime.in"
+#line 2679 "runtime.in"
// triple point(path3 p, real t);
-void gen189(stack *Stack)
+void gen_runtime189(stack *Stack)
{
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2716 "runtime.in"
+#line 2680 "runtime.in"
{Stack->push<triple>(p.point(t)); return;}
}
-#line 2720 "runtime.in"
+#line 2684 "runtime.in"
// triple precontrol(path3 p, Int t);
-void gen190(stack *Stack)
+void gen_runtime190(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2721 "runtime.in"
+#line 2685 "runtime.in"
{Stack->push<triple>(p.precontrol((Int) t)); return;}
}
-#line 2725 "runtime.in"
+#line 2689 "runtime.in"
// triple precontrol(path3 p, real t);
-void gen191(stack *Stack)
+void gen_runtime191(stack *Stack)
{
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2726 "runtime.in"
+#line 2690 "runtime.in"
{Stack->push<triple>(p.precontrol(t)); return;}
}
-#line 2730 "runtime.in"
+#line 2694 "runtime.in"
// triple postcontrol(path3 p, Int t);
-void gen192(stack *Stack)
+void gen_runtime192(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2731 "runtime.in"
+#line 2695 "runtime.in"
{Stack->push<triple>(p.postcontrol((Int) t)); return;}
}
-#line 2735 "runtime.in"
+#line 2699 "runtime.in"
// triple postcontrol(path3 p, real t);
-void gen193(stack *Stack)
+void gen_runtime193(stack *Stack)
{
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2736 "runtime.in"
+#line 2700 "runtime.in"
{Stack->push<triple>(p.postcontrol(t)); return;}
}
-#line 2740 "runtime.in"
+#line 2704 "runtime.in"
// triple dir(path3 p, Int t, Int sign=0, bool normalize=true);
-void gen194(stack *Stack)
+void gen_runtime194(stack *Stack)
{
bool normalize=vm::pop<bool>(Stack,true);
Int sign=vm::pop<Int>(Stack,0);
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2741 "runtime.in"
+#line 2705 "runtime.in"
{Stack->push<triple>(p.dir(t,sign,normalize)); return;}
}
-#line 2745 "runtime.in"
+#line 2709 "runtime.in"
// triple dir(path3 p, real t, bool normalize=true);
-void gen195(stack *Stack)
+void gen_runtime195(stack *Stack)
{
bool normalize=vm::pop<bool>(Stack,true);
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2746 "runtime.in"
+#line 2710 "runtime.in"
{Stack->push<triple>(p.dir(t,normalize)); return;}
}
-#line 2750 "runtime.in"
+#line 2714 "runtime.in"
// triple accel(path3 p, Int t, Int sign=0);
-void gen196(stack *Stack)
+void gen_runtime196(stack *Stack)
{
Int sign=vm::pop<Int>(Stack,0);
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2751 "runtime.in"
+#line 2715 "runtime.in"
{Stack->push<triple>(p.accel(t,sign)); return;}
}
-#line 2755 "runtime.in"
+#line 2719 "runtime.in"
// triple accel(path3 p, real t);
-void gen197(stack *Stack)
+void gen_runtime197(stack *Stack)
{
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2756 "runtime.in"
+#line 2720 "runtime.in"
{Stack->push<triple>(p.accel(t)); return;}
}
-#line 2760 "runtime.in"
+#line 2724 "runtime.in"
// real radius(path3 p, real t);
-void gen198(stack *Stack)
+void gen_runtime198(stack *Stack)
{
real t=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2761 "runtime.in"
+#line 2725 "runtime.in"
triple v=p.dir(t,false);
triple a=p.accel(t);
real d=dot(a,v);
@@ -3679,16 +3678,16 @@ void gen198(stack *Stack)
{Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;}
}
-#line 2772 "runtime.in"
+#line 2736 "runtime.in"
// real radius(triple z0, triple c0, triple c1, triple z1, real t);
-void gen199(stack *Stack)
+void gen_runtime199(stack *Stack)
{
real t=vm::pop<real>(Stack);
triple z1=vm::pop<triple>(Stack);
triple c1=vm::pop<triple>(Stack);
triple c0=vm::pop<triple>(Stack);
triple z0=vm::pop<triple>(Stack);
-#line 2773 "runtime.in"
+#line 2737 "runtime.in"
triple v=(3.0*(z1-z0)+9.0*(c0-c1))*t*t+(6.0*(z0+c1)-12.0*c0)*t+3.0*(c0-z0);
triple a=6.0*(z1-z0+3.0*(c0-c1))*t+6.0*(z0+c1)-12.0*c0;
real d=dot(a,v);
@@ -3699,85 +3698,85 @@ void gen199(stack *Stack)
{Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;}
}
-#line 2784 "runtime.in"
+#line 2748 "runtime.in"
// path3 reverse(path3 p);
-void gen200(stack *Stack)
+void gen_runtime200(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2785 "runtime.in"
+#line 2749 "runtime.in"
{Stack->push<path3>(p.reverse()); return;}
}
-#line 2789 "runtime.in"
+#line 2753 "runtime.in"
// path3 subpath(path3 p, Int a, Int b);
-void gen201(stack *Stack)
+void gen_runtime201(stack *Stack)
{
Int b=vm::pop<Int>(Stack);
Int a=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2790 "runtime.in"
+#line 2754 "runtime.in"
{Stack->push<path3>(p.subpath((Int) a, (Int) b)); return;}
}
-#line 2794 "runtime.in"
+#line 2758 "runtime.in"
// path3 subpath(path3 p, real a, real b);
-void gen202(stack *Stack)
+void gen_runtime202(stack *Stack)
{
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2795 "runtime.in"
+#line 2759 "runtime.in"
{Stack->push<path3>(p.subpath(a,b)); return;}
}
-#line 2799 "runtime.in"
+#line 2763 "runtime.in"
// Int length(path3 p);
-void gen203(stack *Stack)
+void gen_runtime203(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2800 "runtime.in"
+#line 2764 "runtime.in"
{Stack->push<Int>(p.length()); return;}
}
-#line 2804 "runtime.in"
+#line 2768 "runtime.in"
// bool cyclic(path3 p);
-void gen204(stack *Stack)
+void gen_runtime204(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2805 "runtime.in"
+#line 2769 "runtime.in"
{Stack->push<bool>(p.cyclic()); return;}
}
-#line 2809 "runtime.in"
+#line 2773 "runtime.in"
// bool straight(path3 p, Int t);
-void gen205(stack *Stack)
+void gen_runtime205(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2810 "runtime.in"
+#line 2774 "runtime.in"
{Stack->push<bool>(p.straight(t)); return;}
}
// Return the component of vector v perpendicular to a unit vector u.
-#line 2815 "runtime.in"
+#line 2779 "runtime.in"
// triple perp(triple v, triple u);
-void gen206(stack *Stack)
+void gen_runtime206(stack *Stack)
{
triple u=vm::pop<triple>(Stack);
triple v=vm::pop<triple>(Stack);
-#line 2816 "runtime.in"
- {Stack->push<triple>(v-dot(v,u)*u); return;}
+#line 2780 "runtime.in"
+ {Stack->push<triple>(perp(v,u)); return;}
}
// Return the maximum perpendicular deviation of segment i of path3 g
// from a straight line.
-#line 2822 "runtime.in"
+#line 2786 "runtime.in"
// real straightness(path3 p, Int t);
-void gen207(stack *Stack)
+void gen_runtime207(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2823 "runtime.in"
+#line 2787 "runtime.in"
if(p.straight(t)) {Stack->push<real>(0); return;}
triple z0=p.point(t);
triple u=unit(p.point(t+1)-z0);
@@ -3787,55 +3786,55 @@ void gen207(stack *Stack)
// Return the maximum perpendicular deviation of z0..controls c0 and c1..z1
// from a straight line.
-#line 2833 "runtime.in"
+#line 2797 "runtime.in"
// real straightness(triple z0, triple c0, triple c1, triple z1);
-void gen208(stack *Stack)
+void gen_runtime208(stack *Stack)
{
triple z1=vm::pop<triple>(Stack);
triple c1=vm::pop<triple>(Stack);
triple c0=vm::pop<triple>(Stack);
triple z0=vm::pop<triple>(Stack);
-#line 2834 "runtime.in"
+#line 2798 "runtime.in"
triple u=unit(z1-z0);
{Stack->push<real>(::max(length(perp(c0-z0,u)),length(perp(c1-z0,u)))); return;}
}
-#line 2839 "runtime.in"
+#line 2803 "runtime.in"
// bool piecewisestraight(path3 p);
-void gen209(stack *Stack)
+void gen_runtime209(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2840 "runtime.in"
+#line 2804 "runtime.in"
{Stack->push<bool>(p.piecewisestraight()); return;}
}
-#line 2844 "runtime.in"
+#line 2808 "runtime.in"
// real arclength(path3 p);
-void gen210(stack *Stack)
+void gen_runtime210(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2845 "runtime.in"
+#line 2809 "runtime.in"
{Stack->push<real>(p.arclength()); return;}
}
-#line 2849 "runtime.in"
+#line 2813 "runtime.in"
// real arctime(path3 p, real dval);
-void gen211(stack *Stack)
+void gen_runtime211(stack *Stack)
{
real dval=vm::pop<real>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2850 "runtime.in"
+#line 2814 "runtime.in"
{Stack->push<real>(p.arctime(dval)); return;}
}
-#line 2854 "runtime.in"
+#line 2818 "runtime.in"
// realarray* intersect(path3 p, path3 q, real fuzz=-1);
-void gen212(stack *Stack)
+void gen_runtime212(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
path3 q=vm::pop<path3>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2855 "runtime.in"
+#line 2819 "runtime.in"
bool exact=fuzz <= 0.0;
if(fuzz < 0)
fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
@@ -3852,14 +3851,14 @@ void gen212(stack *Stack)
{Stack->push<realarray*>(new array(0)); return;}
}
-#line 2872 "runtime.in"
+#line 2836 "runtime.in"
// realarray2* intersections(path3 p, path3 q, real fuzz=-1);
-void gen213(stack *Stack)
+void gen_runtime213(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
path3 q=vm::pop<path3>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2873 "runtime.in"
+#line 2837 "runtime.in"
bool exact=fuzz <= 0.0;
if(fuzz < 0)
fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
@@ -3891,14 +3890,14 @@ void gen213(stack *Stack)
{Stack->push<realarray2*>(V); return;}
}
-#line 2905 "runtime.in"
+#line 2869 "runtime.in"
// realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1);
-void gen214(stack *Stack)
+void gen_runtime214(stack *Stack)
{
real fuzz=vm::pop<real>(Stack,-1);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2906 "runtime.in"
+#line 2870 "runtime.in"
triple *A=copyTripleArray2C(P,true,4);
if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
norm(A,16));
@@ -3917,49 +3916,49 @@ void gen214(stack *Stack)
{Stack->push<realarray2*>(W); return;} // Sorting will done in asy.
}
-#line 2925 "runtime.in"
+#line 2889 "runtime.in"
// Int size(path3 p);
-void gen215(stack *Stack)
+void gen_runtime215(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2926 "runtime.in"
+#line 2890 "runtime.in"
{Stack->push<Int>(p.size()); return;}
}
-#line 2930 "runtime.in"
+#line 2894 "runtime.in"
// path3 &(path3 p, path3 q);
-void gen216(stack *Stack)
+void gen_runtime216(stack *Stack)
{
path3 q=vm::pop<path3>(Stack);
path3 p=vm::pop<path3>(Stack);
-#line 2931 "runtime.in"
+#line 2895 "runtime.in"
{Stack->push<path3>(camp::concat(p,q)); return;}
}
-#line 2935 "runtime.in"
+#line 2899 "runtime.in"
// triple min(path3 p);
-void gen217(stack *Stack)
+void gen_runtime217(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2936 "runtime.in"
+#line 2900 "runtime.in"
{Stack->push<triple>(p.min()); return;}
}
-#line 2940 "runtime.in"
+#line 2904 "runtime.in"
// triple max(path3 p);
-void gen218(stack *Stack)
+void gen_runtime218(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2941 "runtime.in"
+#line 2905 "runtime.in"
{Stack->push<triple>(p.max()); return;}
}
-#line 2945 "runtime.in"
+#line 2909 "runtime.in"
// realarray* mintimes(path3 p);
-void gen219(stack *Stack)
+void gen_runtime219(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2946 "runtime.in"
+#line 2910 "runtime.in"
array *V=new array(3);
triple v=p.mintimes();
(*V)[0]=v.getx();
@@ -3968,12 +3967,12 @@ void gen219(stack *Stack)
{Stack->push<realarray*>(V); return;}
}
-#line 2955 "runtime.in"
+#line 2919 "runtime.in"
// realarray* maxtimes(path3 p);
-void gen220(stack *Stack)
+void gen_runtime220(stack *Stack)
{
path3 p=vm::pop<path3>(Stack);
-#line 2956 "runtime.in"
+#line 2920 "runtime.in"
array *V=new array(3);
triple v=p.maxtimes();
(*V)[0]=v.getx();
@@ -3982,30 +3981,30 @@ void gen220(stack *Stack)
{Stack->push<realarray*>(V); return;}
}
-#line 2965 "runtime.in"
+#line 2929 "runtime.in"
// path3 *(realarray2 *t, path3 g);
-void gen221(stack *Stack)
+void gen_runtime221(stack *Stack)
{
path3 g=vm::pop<path3>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 2966 "runtime.in"
+#line 2930 "runtime.in"
{Stack->push<path3>(transformed(*t,g)); return;}
}
// Guide operations
-#line 2972 "runtime.in"
+#line 2936 "runtime.in"
void nullGuide(stack *Stack)
{
-#line 2973 "runtime.in"
+#line 2937 "runtime.in"
{Stack->push<guide*>(new pathguide(path())); return;}
}
-#line 2978 "runtime.in"
+#line 2942 "runtime.in"
void dotsGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 2979 "runtime.in"
+#line 2943 "runtime.in"
guidevector v;
size_t size=checkArray(a);
for (size_t i=0; i < size; ++i)
@@ -4014,11 +4013,11 @@ void dotsGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 2988 "runtime.in"
+#line 2952 "runtime.in"
void dashesGuide(stack *Stack)
{
guidearray * a=vm::pop<guidearray *>(Stack);
-#line 2989 "runtime.in"
+#line 2953 "runtime.in"
static camp::curlSpec curly;
static specguide curlout(&curly, camp::OUT);
static specguide curlin(&curly, camp::IN);
@@ -4044,179 +4043,179 @@ void dashesGuide(stack *Stack)
{Stack->push<guide*>(new multiguide(v)); return;}
}
-#line 3015 "runtime.in"
+#line 2979 "runtime.in"
void newCycleToken(stack *Stack)
{
-#line 3016 "runtime.in"
+#line 2980 "runtime.in"
{Stack->push<cycleToken>(cycleToken()); return;}
}
-#line 3020 "runtime.in"
+#line 2984 "runtime.in"
// guide* operator cast(cycleToken tok);
-void gen226(stack *Stack)
+void gen_runtime226(stack *Stack)
{
cycleToken tok=vm::pop<cycleToken>(Stack);
-#line 3021 "runtime.in"
+#line 2985 "runtime.in"
// Avoid unused variable warning messages.
unused(&tok);
{Stack->push<guide*>(new cycletokguide()); return;}
}
-#line 3027 "runtime.in"
+#line 2991 "runtime.in"
// guide* operator spec(pair z, Int p);
-void gen227(stack *Stack)
+void gen_runtime227(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 3028 "runtime.in"
+#line 2992 "runtime.in"
camp::side d=(camp::side) p;
camp::dirSpec *sp=new camp::dirSpec(z);
{Stack->push<guide*>(new specguide(sp,d)); return;}
}
-#line 3035 "runtime.in"
+#line 2999 "runtime.in"
// curlSpecifier operator curl(real gamma, Int p);
-void gen228(stack *Stack)
+void gen_runtime228(stack *Stack)
{
Int p=vm::pop<Int>(Stack);
real gamma=vm::pop<real>(Stack);
-#line 3036 "runtime.in"
+#line 3000 "runtime.in"
camp::side s=(camp::side) p;
{Stack->push<curlSpecifier>(curlSpecifier(gamma,s)); return;}
}
-#line 3041 "runtime.in"
+#line 3005 "runtime.in"
void curlSpecifierValuePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 3042 "runtime.in"
+#line 3006 "runtime.in"
{Stack->push<real>(spec.getValue()); return;}
}
-#line 3046 "runtime.in"
+#line 3010 "runtime.in"
void curlSpecifierSidePart(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 3047 "runtime.in"
+#line 3011 "runtime.in"
{Stack->push<Int>(spec.getSide()); return;}
}
-#line 3051 "runtime.in"
+#line 3015 "runtime.in"
// guide* operator cast(curlSpecifier spec);
-void gen231(stack *Stack)
+void gen_runtime231(stack *Stack)
{
curlSpecifier spec=vm::pop<curlSpecifier>(Stack);
-#line 3052 "runtime.in"
+#line 3016 "runtime.in"
{Stack->push<guide*>(new specguide(spec)); return;}
}
-#line 3056 "runtime.in"
+#line 3020 "runtime.in"
// tensionSpecifier operator tension(real tout, real tin, bool atleast);
-void gen232(stack *Stack)
+void gen_runtime232(stack *Stack)
{
bool atleast=vm::pop<bool>(Stack);
real tin=vm::pop<real>(Stack);
real tout=vm::pop<real>(Stack);
-#line 3057 "runtime.in"
+#line 3021 "runtime.in"
{Stack->push<tensionSpecifier>(tensionSpecifier(tout, tin, atleast)); return;}
}
-#line 3061 "runtime.in"
+#line 3025 "runtime.in"
void tensionSpecifierOutPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 3062 "runtime.in"
+#line 3026 "runtime.in"
{Stack->push<real>(t.getOut()); return;}
}
-#line 3066 "runtime.in"
+#line 3030 "runtime.in"
void tensionSpecifierInPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 3067 "runtime.in"
+#line 3031 "runtime.in"
{Stack->push<real>(t.getIn()); return;}
}
-#line 3071 "runtime.in"
+#line 3035 "runtime.in"
void tensionSpecifierAtleastPart(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 3072 "runtime.in"
+#line 3036 "runtime.in"
{Stack->push<bool>(t.getAtleast()); return;}
}
-#line 3076 "runtime.in"
+#line 3040 "runtime.in"
// guide* operator cast(tensionSpecifier t);
-void gen236(stack *Stack)
+void gen_runtime236(stack *Stack)
{
tensionSpecifier t=vm::pop<tensionSpecifier>(Stack);
-#line 3077 "runtime.in"
+#line 3041 "runtime.in"
{Stack->push<guide*>(new tensionguide(t)); return;}
}
-#line 3081 "runtime.in"
+#line 3045 "runtime.in"
// guide* operator controls(pair zout, pair zin);
-void gen237(stack *Stack)
+void gen_runtime237(stack *Stack)
{
pair zin=vm::pop<pair>(Stack);
pair zout=vm::pop<pair>(Stack);
-#line 3082 "runtime.in"
+#line 3046 "runtime.in"
{Stack->push<guide*>(new controlguide(zout, zin)); return;}
}
-#line 3086 "runtime.in"
+#line 3050 "runtime.in"
// Int size(guide *g);
-void gen238(stack *Stack)
+void gen_runtime238(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 3087 "runtime.in"
+#line 3051 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(f.size()); return;}
}
-#line 3093 "runtime.in"
+#line 3057 "runtime.in"
// Int length(guide *g);
-void gen239(stack *Stack)
+void gen_runtime239(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 3094 "runtime.in"
+#line 3058 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<Int>(g->cyclic() ? f.size() : f.size()-1); return;}
}
-#line 3100 "runtime.in"
+#line 3064 "runtime.in"
// bool cyclic(guide *g);
-void gen240(stack *Stack)
+void gen_runtime240(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 3101 "runtime.in"
+#line 3065 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<bool>(g->cyclic()); return;}
}
-#line 3107 "runtime.in"
+#line 3071 "runtime.in"
// pair point(guide *g, Int t);
-void gen241(stack *Stack)
+void gen_runtime241(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 3108 "runtime.in"
+#line 3072 "runtime.in"
flatguide f;
g->flatten(f,false);
{Stack->push<pair>(f.Nodes(adjustedIndex(t,f.size(),g->cyclic())).z); return;}
}
-#line 3114 "runtime.in"
+#line 3078 "runtime.in"
// pairarray* dirSpecifier(guide *g, Int t);
-void gen242(stack *Stack)
+void gen_runtime242(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 3115 "runtime.in"
+#line 3079 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -4227,13 +4226,13 @@ void gen242(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 3126 "runtime.in"
+#line 3090 "runtime.in"
// pairarray* controlSpecifier(guide *g, Int t);
-void gen243(stack *Stack)
+void gen_runtime243(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 3127 "runtime.in"
+#line 3091 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -4249,13 +4248,13 @@ void gen243(stack *Stack)
} else {Stack->push<pairarray*>(new array(0)); return;}
}
-#line 3143 "runtime.in"
+#line 3107 "runtime.in"
// tensionSpecifier tensionSpecifier(guide *g, Int t);
-void gen244(stack *Stack)
+void gen_runtime244(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 3144 "runtime.in"
+#line 3108 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -4264,13 +4263,13 @@ void gen244(stack *Stack)
{Stack->push<tensionSpecifier>(tensionSpecifier(curr.tout.val,f.Nodes(t+1).tin.val,curr.tout.atleast)); return;}
}
-#line 3153 "runtime.in"
+#line 3117 "runtime.in"
// realarray* curlSpecifier(guide *g, Int t);
-void gen245(stack *Stack)
+void gen_runtime245(stack *Stack)
{
Int t=vm::pop<Int>(Stack);
guide * g=vm::pop<guide *>(Stack);
-#line 3154 "runtime.in"
+#line 3118 "runtime.in"
flatguide f;
g->flatten(f,false);
Int n=f.size();
@@ -4283,12 +4282,12 @@ void gen245(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 3167 "runtime.in"
+#line 3131 "runtime.in"
// guide* reverse(guide *g);
-void gen246(stack *Stack)
+void gen_runtime246(stack *Stack)
{
guide * g=vm::pop<guide *>(Stack);
-#line 3168 "runtime.in"
+#line 3132 "runtime.in"
flatguide f;
g->flatten(f,false);
if(f.precyclic())
@@ -4343,106 +4342,81 @@ void gen246(stack *Stack)
// Three-dimensional picture and surface operations
-#line 3223 "runtime.in"
+#line 3187 "runtime.in"
// void _draw(picture *f, path3 g, pen p);
-void gen247(stack *Stack)
+void gen_runtime247(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
path3 g=vm::pop<path3>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 3224 "runtime.in"
+#line 3188 "runtime.in"
if(g.size() > 0)
f->append(new drawPath3(g,p));
}
-#line 3230 "runtime.in"
-// void draw(picture *f, triplearray2 *g, bool straight, penarray *p, real opacity, real shininess, real granularity, triple normal, bool lighton, penarray *colors);
-void gen248(stack *Stack)
+#line 3194 "runtime.in"
+// void draw(picture *f, triplearray2 *g, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, real granularity, triple normal, bool lighton, penarray *colors);
+void gen_runtime248(stack *Stack)
{
penarray * colors=vm::pop<penarray *>(Stack);
bool lighton=vm::pop<bool>(Stack);
triple normal=vm::pop<triple>(Stack);
real granularity=vm::pop<real>(Stack);
+ real PRCshininess=vm::pop<real>(Stack);
real shininess=vm::pop<real>(Stack);
real opacity=vm::pop<real>(Stack);
penarray * p=vm::pop<penarray *>(Stack);
bool straight=vm::pop<bool>(Stack);
triplearray2 * g=vm::pop<triplearray2 *>(Stack);
picture * f=vm::pop<picture *>(Stack);
-#line 3233 "runtime.in"
- f->append(new drawSurface(*g,straight,*p,opacity,shininess,granularity,
- normal,lighton,*colors));
+#line 3197 "runtime.in"
+ f->append(new drawSurface(*g,straight,*p,opacity,shininess,PRCshininess,
+ granularity,normal,lighton,*colors));
}
-#line 3238 "runtime.in"
+#line 3202 "runtime.in"
// triple min3(picture *f);
-void gen249(stack *Stack)
+void gen_runtime249(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 3239 "runtime.in"
+#line 3203 "runtime.in"
{Stack->push<triple>(f->bounds3().Min()); return;}
}
-#line 3243 "runtime.in"
+#line 3207 "runtime.in"
// triple max3(picture *f);
-void gen250(stack *Stack)
+void gen_runtime250(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 3244 "runtime.in"
+#line 3208 "runtime.in"
{Stack->push<triple>(f->bounds3().Max()); return;}
}
-#line 3248 "runtime.in"
-// pair min(picture *f, realarray2 *t);
-void gen251(stack *Stack)
-{
- realarray2 * t=vm::pop<realarray2 *>(Stack);
- picture * f=vm::pop<picture *>(Stack);
-#line 3249 "runtime.in"
- real *T=copyArray2C(t,4);
- pair m=f->bounds(::min,xproject,yproject,T);
- delete[] T;
- {Stack->push<pair>(m); return;}
-}
-
-#line 3256 "runtime.in"
-// pair max(picture *f, realarray2 *t);
-void gen252(stack *Stack)
-{
- realarray2 * t=vm::pop<realarray2 *>(Stack);
- picture * f=vm::pop<picture *>(Stack);
-#line 3257 "runtime.in"
- real *T=copyArray2C(t,4);
- pair M=f->bounds(::max,xproject,yproject,T);
- delete[] T;
- {Stack->push<pair>(M); return;}
-}
-
-#line 3264 "runtime.in"
+#line 3212 "runtime.in"
// pair minratio(picture *f);
-void gen253(stack *Stack)
+void gen_runtime251(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 3265 "runtime.in"
- {Stack->push<pair>(f->bounds(::min,xratio,yratio)); return;}
+#line 3213 "runtime.in"
+ {Stack->push<pair>(f->ratio(::min)); return;}
}
-#line 3269 "runtime.in"
+#line 3217 "runtime.in"
// pair maxratio(picture *f);
-void gen254(stack *Stack)
+void gen_runtime252(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 3270 "runtime.in"
- {Stack->push<pair>(f->bounds(::max,xratio,yratio)); return;}
+#line 3218 "runtime.in"
+ {Stack->push<pair>(f->ratio(::max)); return;}
}
-#line 3274 "runtime.in"
+#line 3222 "runtime.in"
// triple minbezier(triplearray2 *P, triple b);
-void gen255(stack *Stack)
+void gen_runtime253(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 3275 "runtime.in"
+#line 3223 "runtime.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)),
@@ -4451,13 +4425,13 @@ void gen255(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 3284 "runtime.in"
+#line 3232 "runtime.in"
// triple maxbezier(triplearray2 *P, triple b);
-void gen256(stack *Stack)
+void gen_runtime254(stack *Stack)
{
triple b=vm::pop<triple>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 3285 "runtime.in"
+#line 3233 "runtime.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)),
@@ -4466,74 +4440,113 @@ void gen256(stack *Stack)
{Stack->push<triple>(b); return;}
}
-#line 3294 "runtime.in"
-// pair minbezier(triplearray2 *P, realarray2 *t, pair b);
-void gen257(stack *Stack)
+#line 3242 "runtime.in"
+// pair minratio(triplearray2 *P, pair b);
+void gen_runtime255(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
- realarray2 * t=vm::pop<realarray2 *>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 3295 "runtime.in"
+#line 3243 "runtime.in"
triple *A=copyTripleArray2C(P,true,4);
- real *T=copyArray2C(t,4);
real fuzz=sqrtFuzz*norm(A,16);
- b=pair(bound(A,::min,xproject,T,b.getx(),fuzz),
- bound(A,::min,yproject,T,b.gety(),fuzz));
- delete[] T;
+ b=pair(bound(A,::min,xratio,b.getx(),fuzz),
+ bound(A,::min,yratio,b.gety(),fuzz));
delete[] A;
{Stack->push<pair>(b); return;}
}
-#line 3306 "runtime.in"
-// pair maxbezier(triplearray2 *P, realarray2 *t, pair b);
-void gen258(stack *Stack)
+#line 3252 "runtime.in"
+// pair maxratio(triplearray2 *P, pair b);
+void gen_runtime256(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
- realarray2 * t=vm::pop<realarray2 *>(Stack);
triplearray2 * P=vm::pop<triplearray2 *>(Stack);
-#line 3307 "runtime.in"
+#line 3253 "runtime.in"
triple *A=copyTripleArray2C(P,true,4);
- real *T=copyArray2C(t,4);
real fuzz=sqrtFuzz*norm(A,16);
- b=pair(bound(A,::max,xproject,T,b.getx(),fuzz),
- bound(A,::max,yproject,T,b.gety(),fuzz));
- delete[] T;
+ b=pair(bound(A,::max,xratio,b.getx(),fuzz),
+ bound(A,::max,yratio,b.gety(),fuzz));
delete[] A;
{Stack->push<pair>(b); return;}
}
-#line 3318 "runtime.in"
-// pair max(path3 g, realarray2 *t);
-void gen259(stack *Stack)
+#line 3262 "runtime.in"
+// pair minratio(path3 g);
+void gen_runtime257(stack *Stack)
{
- realarray2 * t=vm::pop<realarray2 *>(Stack);
path3 g=vm::pop<path3>(Stack);
-#line 3319 "runtime.in"
- real *T=copyArray2C(t,4);
- pair b=g.bounds(::max,xproject,yproject,T);
- delete[] T;
- {Stack->push<pair>(b); return;}
+#line 3263 "runtime.in"
+ {Stack->push<pair>(g.ratio(::min)); return;}
}
-#line 3326 "runtime.in"
-// pair min(path3 g, realarray2 *t);
-void gen260(stack *Stack)
+#line 3267 "runtime.in"
+// pair maxratio(path3 g);
+void gen_runtime258(stack *Stack)
{
- realarray2 * t=vm::pop<realarray2 *>(Stack);
path3 g=vm::pop<path3>(Stack);
-#line 3327 "runtime.in"
- real *T=copyArray2C(t,4);
- pair b=g.bounds(::min,xproject,yproject,T);
- delete[] T;
- {Stack->push<pair>(b); return;}
+#line 3268 "runtime.in"
+ {Stack->push<pair>(g.ratio(::max)); return;}
}
-#line 3334 "runtime.in"
+#line 3272 "runtime.in"
+// real norm(realarray *a);
+void gen_runtime259(stack *Stack)
+{
+ realarray * a=vm::pop<realarray *>(Stack);
+#line 3273 "runtime.in"
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ real x=fabs(vm::read<real>(a,i));
+ if(x > M) M=x;
+ }
+ {Stack->push<real>(M); return;}
+}
+
+#line 3283 "runtime.in"
+// real norm(realarray2 *a);
+void gen_runtime260(stack *Stack)
+{
+ realarray2 * a=vm::pop<realarray2 *>(Stack);
+#line 3284 "runtime.in"
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ vm::array *ai=vm::read<vm::array*>(a,i);
+ size_t m=checkArray(ai);
+ for(size_t j=0; j < m; ++j) {
+ real a=fabs(vm::read<real>(ai,j));
+ if(a > M) M=a;
+ }
+ }
+ {Stack->push<real>(M); return;}
+}
+
+#line 3298 "runtime.in"
+// real norm(triplearray2 *a);
+void gen_runtime261(stack *Stack)
+{
+ triplearray2 * a=vm::pop<triplearray2 *>(Stack);
+#line 3299 "runtime.in"
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ vm::array *ai=vm::read<vm::array*>(a,i);
+ size_t m=checkArray(ai);
+ for(size_t j=0; j < m; ++j) {
+ real a=vm::read<triple>(ai,j).abs2();
+ if(a > M) M=a;
+ }
+ }
+ {Stack->push<real>(sqrt(M)); return;}
+}
+
+#line 3313 "runtime.in"
// real change2(triplearray2 *a);
-void gen261(stack *Stack)
+void gen_runtime262(stack *Stack)
{
triplearray2 * a=vm::pop<triplearray2 *>(Stack);
-#line 3335 "runtime.in"
+#line 3314 "runtime.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<real>(0.0); return;}
@@ -4554,241 +4567,241 @@ void gen261(stack *Stack)
{Stack->push<real>(M); return;}
}
-#line 3356 "runtime.in"
+#line 3335 "runtime.in"
// bool is3D(picture *f);
-void gen262(stack *Stack)
+void gen_runtime263(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
-#line 3357 "runtime.in"
+#line 3336 "runtime.in"
{Stack->push<bool>(f->have3D()); return;}
}
-#line 3361 "runtime.in"
+#line 3340 "runtime.in"
// pair bezier(pair a, pair b, pair c, pair d, real t);
-void gen263(stack *Stack)
+void gen_runtime264(stack *Stack)
{
real t=vm::pop<real>(Stack);
pair d=vm::pop<pair>(Stack);
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 3362 "runtime.in"
+#line 3341 "runtime.in"
real onemt=1-t;
real onemt2=onemt*onemt;
{Stack->push<pair>(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;}
}
-#line 3368 "runtime.in"
+#line 3347 "runtime.in"
// pair bezierP(pair a, pair b, pair c, pair d, real t);
-void gen264(stack *Stack)
+void gen_runtime265(stack *Stack)
{
real t=vm::pop<real>(Stack);
pair d=vm::pop<pair>(Stack);
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 3369 "runtime.in"
+#line 3348 "runtime.in"
{Stack->push<pair>(3.0*(t*t*(d-a+3.0*(b-c))+t*(2.0*(a+c)-4.0*b)+b-a)); return;}
}
-#line 3373 "runtime.in"
+#line 3352 "runtime.in"
// pair bezierPP(pair a, pair b, pair c, pair d, real t);
-void gen265(stack *Stack)
+void gen_runtime266(stack *Stack)
{
real t=vm::pop<real>(Stack);
pair d=vm::pop<pair>(Stack);
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 3374 "runtime.in"
+#line 3353 "runtime.in"
{Stack->push<pair>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;}
}
-#line 3378 "runtime.in"
+#line 3357 "runtime.in"
// pair bezierPPP(pair a, pair b, pair c, pair d);
-void gen266(stack *Stack)
+void gen_runtime267(stack *Stack)
{
pair d=vm::pop<pair>(Stack);
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 3379 "runtime.in"
+#line 3358 "runtime.in"
{Stack->push<pair>(6.0*(d-a+3.0*(b-c))); return;}
}
-#line 3383 "runtime.in"
+#line 3362 "runtime.in"
// triple bezier(triple a, triple b, triple c, triple d, real t);
-void gen267(stack *Stack)
+void gen_runtime268(stack *Stack)
{
real t=vm::pop<real>(Stack);
triple d=vm::pop<triple>(Stack);
triple c=vm::pop<triple>(Stack);
triple b=vm::pop<triple>(Stack);
triple a=vm::pop<triple>(Stack);
-#line 3384 "runtime.in"
+#line 3363 "runtime.in"
real onemt=1-t;
real onemt2=onemt*onemt;
{Stack->push<triple>(onemt2*onemt*a+t*(3.0*(onemt2*b+t*onemt*c)+t*t*d)); return;}
}
-#line 3390 "runtime.in"
+#line 3369 "runtime.in"
// triple bezierP(triple a, triple b, triple c, triple d, real t);
-void gen268(stack *Stack)
+void gen_runtime269(stack *Stack)
{
real t=vm::pop<real>(Stack);
triple d=vm::pop<triple>(Stack);
triple c=vm::pop<triple>(Stack);
triple b=vm::pop<triple>(Stack);
triple a=vm::pop<triple>(Stack);
-#line 3391 "runtime.in"
+#line 3370 "runtime.in"
{Stack->push<triple>(3.0*(t*t*(d-a+3.0*(b-c))+t*(2.0*(a+c)-4.0*b)+b-a)); return;}
}
-#line 3395 "runtime.in"
+#line 3374 "runtime.in"
// triple bezierPP(triple a, triple b, triple c, triple d, real t);
-void gen269(stack *Stack)
+void gen_runtime270(stack *Stack)
{
real t=vm::pop<real>(Stack);
triple d=vm::pop<triple>(Stack);
triple c=vm::pop<triple>(Stack);
triple b=vm::pop<triple>(Stack);
triple a=vm::pop<triple>(Stack);
-#line 3396 "runtime.in"
+#line 3375 "runtime.in"
{Stack->push<triple>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;}
}
-#line 3400 "runtime.in"
+#line 3379 "runtime.in"
// triple bezierPPP(triple a, triple b, triple c, triple d);
-void gen270(stack *Stack)
+void gen_runtime271(stack *Stack)
{
triple d=vm::pop<triple>(Stack);
triple c=vm::pop<triple>(Stack);
triple b=vm::pop<triple>(Stack);
triple a=vm::pop<triple>(Stack);
-#line 3401 "runtime.in"
+#line 3380 "runtime.in"
{Stack->push<triple>(6.0*(d-a+3.0*(b-c))); return;}
}
// String operations
-#line 3407 "runtime.in"
+#line 3386 "runtime.in"
void emptyString(stack *Stack)
{
-#line 3408 "runtime.in"
+#line 3387 "runtime.in"
{Stack->push<string>(emptystring); return;}
}
-#line 3413 "runtime.in"
+#line 3392 "runtime.in"
// Int length(string *s);
-void gen272(stack *Stack)
+void gen_runtime273(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 3414 "runtime.in"
+#line 3393 "runtime.in"
{Stack->push<Int>((Int) s->length()); return;}
}
-#line 3418 "runtime.in"
+#line 3397 "runtime.in"
// Int find(string *s, string t, Int pos=0);
-void gen273(stack *Stack)
+void gen_runtime274(stack *Stack)
{
Int pos=vm::pop<Int>(Stack,0);
string t=vm::pop<string>(Stack);
string * s=vm::pop<string *>(Stack);
-#line 3419 "runtime.in"
+#line 3398 "runtime.in"
size_t n=s->find(t,pos);
{Stack->push<Int>(n == string::npos ? (Int) -1 : (Int) n); return;}
}
-#line 3424 "runtime.in"
+#line 3403 "runtime.in"
// Int rfind(string *s, string t, Int pos=-1);
-void gen274(stack *Stack)
+void gen_runtime275(stack *Stack)
{
Int pos=vm::pop<Int>(Stack,-1);
string t=vm::pop<string>(Stack);
string * s=vm::pop<string *>(Stack);
-#line 3425 "runtime.in"
+#line 3404 "runtime.in"
size_t n=s->rfind(t,pos);
{Stack->push<Int>(n == string::npos ? (Int) -1 : (Int) n); return;}
}
-#line 3430 "runtime.in"
+#line 3409 "runtime.in"
// string reverse(string s);
-void gen275(stack *Stack)
+void gen_runtime276(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 3431 "runtime.in"
+#line 3410 "runtime.in"
reverse(s.begin(),s.end());
{Stack->push<string>(s); return;}
}
-#line 3436 "runtime.in"
+#line 3415 "runtime.in"
// string insert(string s, Int pos, string t);
-void gen276(stack *Stack)
+void gen_runtime277(stack *Stack)
{
string t=vm::pop<string>(Stack);
Int pos=vm::pop<Int>(Stack);
string s=vm::pop<string>(Stack);
-#line 3437 "runtime.in"
+#line 3416 "runtime.in"
if ((size_t) pos < s.length())
{Stack->push<string>(s.insert(pos,t)); return;}
{Stack->push<string>(s); return;}
}
-#line 3443 "runtime.in"
+#line 3422 "runtime.in"
// string substr(string* s, Int pos, Int n=-1);
-void gen277(stack *Stack)
+void gen_runtime278(stack *Stack)
{
Int n=vm::pop<Int>(Stack,-1);
Int pos=vm::pop<Int>(Stack);
string* s=vm::pop<string*>(Stack);
-#line 3444 "runtime.in"
+#line 3423 "runtime.in"
if ((size_t) pos < s->length())
{Stack->push<string>(s->substr(pos,n)); return;}
{Stack->push<string>(emptystring); return;}
}
-#line 3450 "runtime.in"
+#line 3429 "runtime.in"
// string erase(string s, Int pos, Int n);
-void gen278(stack *Stack)
+void gen_runtime279(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
Int pos=vm::pop<Int>(Stack);
string s=vm::pop<string>(Stack);
-#line 3451 "runtime.in"
+#line 3430 "runtime.in"
if ((size_t) pos < s.length())
{Stack->push<string>(s.erase(pos,n)); return;}
{Stack->push<string>(s); return;}
}
-#line 3457 "runtime.in"
+#line 3436 "runtime.in"
// string downcase(string s);
-void gen279(stack *Stack)
+void gen_runtime280(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 3458 "runtime.in"
+#line 3437 "runtime.in"
std::transform(s.begin(),s.end(),s.begin(),tolower);
{Stack->push<string>(s); return;}
}
-#line 3463 "runtime.in"
+#line 3442 "runtime.in"
// string upcase(string s);
-void gen280(stack *Stack)
+void gen_runtime281(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 3464 "runtime.in"
+#line 3443 "runtime.in"
std::transform(s.begin(),s.end(),s.begin(),toupper);
{Stack->push<string>(s); return;}
}
// returns a string constructed by translating all occurrences of the string
// from in an array of string pairs {from,to} to the string to in string s.
-#line 3471 "runtime.in"
+#line 3450 "runtime.in"
// string replace(string *S, stringarray2 *translate);
-void gen281(stack *Stack)
+void gen_runtime282(stack *Stack)
{
stringarray2 * translate=vm::pop<stringarray2 *>(Stack);
string * S=vm::pop<string *>(Stack);
-#line 3472 "runtime.in"
+#line 3451 "runtime.in"
size_t size=checkArray(translate);
for(size_t i=0; i < size; i++) {
array *a=read<array*>(translate,i);
@@ -4812,13 +4825,13 @@ void gen281(stack *Stack)
{Stack->push<string>(buf.str()); return;}
}
-#line 3496 "runtime.in"
+#line 3475 "runtime.in"
// string format(string *format, Int x);
-void gen282(stack *Stack)
+void gen_runtime283(stack *Stack)
{
Int x=vm::pop<Int>(Stack);
string * format=vm::pop<string *>(Stack);
-#line 3497 "runtime.in"
+#line 3476 "runtime.in"
const char *f=format->c_str();
checkformat(f,true);
@@ -4832,14 +4845,14 @@ void gen282(stack *Stack)
{Stack->push<string>(s); return;}
}
-#line 3511 "runtime.in"
+#line 3490 "runtime.in"
// string format(string *format, real x, string locale=emptystring);
-void gen283(stack *Stack)
+void gen_runtime284(stack *Stack)
{
string locale=vm::pop<string>(Stack,emptystring);
real x=vm::pop<real>(Stack);
string * format=vm::pop<string *>(Stack);
-#line 3512 "runtime.in"
+#line 3491 "runtime.in"
bool tex=getSetting<string>("tex") != "none";
bool texify=false;
ostringstream out;
@@ -4963,12 +4976,12 @@ void gen283(stack *Stack)
{Stack->push<string>(out.str()); return;}
}
-#line 3636 "runtime.in"
+#line 3615 "runtime.in"
// Int hex(string s);
-void gen284(stack *Stack)
+void gen_runtime285(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 3637 "runtime.in"
+#line 3616 "runtime.in"
istringstream is(s);
is.setf(std::ios::hex,std::ios::basefield);
Int value;
@@ -4978,36 +4991,36 @@ void gen284(stack *Stack)
error(buf);
}
-#line 3647 "runtime.in"
+#line 3626 "runtime.in"
// string string(Int x);
-void gen285(stack *Stack)
+void gen_runtime286(stack *Stack)
{
Int x=vm::pop<Int>(Stack);
-#line 3648 "runtime.in"
+#line 3627 "runtime.in"
ostringstream buf;
buf << x;
{Stack->push<string>(buf.str()); return;}
}
-#line 3654 "runtime.in"
+#line 3633 "runtime.in"
// string string(real x, Int digits=DBL_DIG);
-void gen286(stack *Stack)
+void gen_runtime287(stack *Stack)
{
Int digits=vm::pop<Int>(Stack,DBL_DIG);
real x=vm::pop<real>(Stack);
-#line 3655 "runtime.in"
+#line 3634 "runtime.in"
ostringstream buf;
buf.precision(digits);
buf << x;
{Stack->push<string>(buf.str()); return;}
}
-#line 3662 "runtime.in"
+#line 3641 "runtime.in"
// string time(string format=defaulttimeformat);
-void gen287(stack *Stack)
+void gen_runtime288(stack *Stack)
{
string format=vm::pop<string>(Stack,defaulttimeformat);
-#line 3663 "runtime.in"
+#line 3642 "runtime.in"
#ifdef HAVE_STRFTIME
const time_t bintime=time(NULL);
if(!strftime(Time,nTime,format.c_str(),localtime(&bintime))) {Stack->push<string>(""); return;}
@@ -5017,13 +5030,13 @@ void gen287(stack *Stack)
#endif
}
-#line 3673 "runtime.in"
+#line 3652 "runtime.in"
// string time(Int seconds, string format=defaulttimeformat);
-void gen288(stack *Stack)
+void gen_runtime289(stack *Stack)
{
string format=vm::pop<string>(Stack,defaulttimeformat);
Int seconds=vm::pop<Int>(Stack);
-#line 3674 "runtime.in"
+#line 3653 "runtime.in"
#ifdef HAVE_STRFTIME
const time_t bintime=seconds;
if(!strftime(Time,nTime,format.c_str(),localtime(&bintime))) {Stack->push<string>(""); return;}
@@ -5035,13 +5048,13 @@ void gen288(stack *Stack)
#endif
}
-#line 3686 "runtime.in"
+#line 3665 "runtime.in"
// Int seconds(string t=emptystring, string format=emptystring);
-void gen289(stack *Stack)
+void gen_runtime290(stack *Stack)
{
string format=vm::pop<string>(Stack,emptystring);
string t=vm::pop<string>(Stack,emptystring);
-#line 3687 "runtime.in"
+#line 3666 "runtime.in"
#if defined(HAVE_STRPTIME)
const time_t bintime=time(NULL);
tm tm=*localtime(&bintime);
@@ -5052,11 +5065,11 @@ void gen289(stack *Stack)
#endif
}
-#line 3698 "runtime.in"
+#line 3677 "runtime.in"
// realarray* _cputime();
-void gen290(stack *Stack)
+void gen_runtime291(stack *Stack)
{
-#line 3699 "runtime.in"
+#line 3678 "runtime.in"
static const real ticktime=1.0/sysconf(_SC_CLK_TCK);
struct tms buf;
@@ -5071,234 +5084,234 @@ void gen290(stack *Stack)
// Math
-#line 3714 "runtime.in"
+#line 3693 "runtime.in"
// real ^(real x, Int y);
-void gen291(stack *Stack)
+void gen_runtime292(stack *Stack)
{
Int y=vm::pop<Int>(Stack);
real x=vm::pop<real>(Stack);
-#line 3715 "runtime.in"
+#line 3694 "runtime.in"
{Stack->push<real>(pow(x,y)); return;}
}
-#line 3720 "runtime.in"
+#line 3699 "runtime.in"
// pair ^(pair z, Int y);
-void gen292(stack *Stack)
+void gen_runtime293(stack *Stack)
{
Int y=vm::pop<Int>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 3721 "runtime.in"
+#line 3700 "runtime.in"
{Stack->push<pair>(pow(z,y)); return;}
}
-#line 3725 "runtime.in"
+#line 3704 "runtime.in"
// Int quotient(Int x, Int y);
-void gen293(stack *Stack)
+void gen_runtime294(stack *Stack)
{
Int y=vm::pop<Int>(Stack);
Int x=vm::pop<Int>(Stack);
-#line 3726 "runtime.in"
+#line 3705 "runtime.in"
if(y == 0) dividebyzero();
if(y == -1) {Stack->push<Int>(Negate(x)); return;}
// Implementation-independent definition of integer division: round down
{Stack->push<Int>((x-portableMod(x,y))/y); return;}
}
-#line 3733 "runtime.in"
+#line 3712 "runtime.in"
// Int abs(Int x);
-void gen294(stack *Stack)
+void gen_runtime295(stack *Stack)
{
Int x=vm::pop<Int>(Stack);
-#line 3734 "runtime.in"
+#line 3713 "runtime.in"
{Stack->push<Int>(Abs(x)); return;}
}
-#line 3738 "runtime.in"
+#line 3717 "runtime.in"
// Int sgn(real x);
-void gen295(stack *Stack)
+void gen_runtime296(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3739 "runtime.in"
+#line 3718 "runtime.in"
{Stack->push<Int>(sgn(x)); return;}
}
-#line 3743 "runtime.in"
+#line 3722 "runtime.in"
// Int rand();
-void gen296(stack *Stack)
+void gen_runtime297(stack *Stack)
{
-#line 3744 "runtime.in"
+#line 3723 "runtime.in"
{Stack->push<Int>(rand()); return;}
}
-#line 3748 "runtime.in"
+#line 3727 "runtime.in"
// void srand(Int seed);
-void gen297(stack *Stack)
+void gen_runtime298(stack *Stack)
{
Int seed=vm::pop<Int>(Stack);
-#line 3749 "runtime.in"
+#line 3728 "runtime.in"
srand(intcast(seed));
}
// a random number uniformly distributed in the interval [0,1]
-#line 3754 "runtime.in"
+#line 3733 "runtime.in"
// real unitrand();
-void gen298(stack *Stack)
+void gen_runtime299(stack *Stack)
{
-#line 3755 "runtime.in"
+#line 3734 "runtime.in"
{Stack->push<real>(((real) rand())/RAND_MAX); return;}
}
-#line 3759 "runtime.in"
+#line 3738 "runtime.in"
// Int ceil(real x);
-void gen299(stack *Stack)
+void gen_runtime300(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3760 "runtime.in"
+#line 3739 "runtime.in"
{Stack->push<Int>(Intcast(ceil(x))); return;}
}
-#line 3764 "runtime.in"
+#line 3743 "runtime.in"
// Int floor(real x);
-void gen300(stack *Stack)
+void gen_runtime301(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3765 "runtime.in"
+#line 3744 "runtime.in"
{Stack->push<Int>(Intcast(floor(x))); return;}
}
-#line 3769 "runtime.in"
+#line 3748 "runtime.in"
// Int round(real x);
-void gen301(stack *Stack)
+void gen_runtime302(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3770 "runtime.in"
+#line 3749 "runtime.in"
if(validInt(x)) {Stack->push<Int>(Round(x)); return;}
integeroverflow(0);
}
-#line 3775 "runtime.in"
+#line 3754 "runtime.in"
// Int Ceil(real x);
-void gen302(stack *Stack)
+void gen_runtime303(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3776 "runtime.in"
+#line 3755 "runtime.in"
{Stack->push<Int>(Ceil(x)); return;}
}
-#line 3780 "runtime.in"
+#line 3759 "runtime.in"
// Int Floor(real x);
-void gen303(stack *Stack)
+void gen_runtime304(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3781 "runtime.in"
+#line 3760 "runtime.in"
{Stack->push<Int>(Floor(x)); return;}
}
-#line 3785 "runtime.in"
+#line 3764 "runtime.in"
// Int Round(real x);
-void gen304(stack *Stack)
+void gen_runtime305(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3786 "runtime.in"
+#line 3765 "runtime.in"
{Stack->push<Int>(Round(Intcap(x))); return;}
}
-#line 3790 "runtime.in"
+#line 3769 "runtime.in"
// real fmod(real x, real y);
-void gen305(stack *Stack)
+void gen_runtime306(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 3791 "runtime.in"
+#line 3770 "runtime.in"
if (y == 0.0) dividebyzero();
{Stack->push<real>(fmod(x,y)); return;}
}
-#line 3796 "runtime.in"
+#line 3775 "runtime.in"
// real atan2(real y, real x);
-void gen306(stack *Stack)
+void gen_runtime307(stack *Stack)
{
real x=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
-#line 3797 "runtime.in"
+#line 3776 "runtime.in"
{Stack->push<real>(atan2(y,x)); return;}
}
-#line 3801 "runtime.in"
+#line 3780 "runtime.in"
// real hypot(real x, real y);
-void gen307(stack *Stack)
+void gen_runtime308(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 3802 "runtime.in"
+#line 3781 "runtime.in"
{Stack->push<real>(hypot(x,y)); return;}
}
-#line 3806 "runtime.in"
+#line 3785 "runtime.in"
// real remainder(real x, real y);
-void gen308(stack *Stack)
+void gen_runtime309(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 3807 "runtime.in"
+#line 3786 "runtime.in"
{Stack->push<real>(remainder(x,y)); return;}
}
-#line 3811 "runtime.in"
+#line 3790 "runtime.in"
// real J(Int n, real x);
-void gen309(stack *Stack)
+void gen_runtime310(stack *Stack)
{
real x=vm::pop<real>(Stack);
Int n=vm::pop<Int>(Stack);
-#line 3812 "runtime.in"
+#line 3791 "runtime.in"
{Stack->push<real>(jn(n,x)); return;}
}
-#line 3816 "runtime.in"
+#line 3795 "runtime.in"
// real Y(Int n, real x);
-void gen310(stack *Stack)
+void gen_runtime311(stack *Stack)
{
real x=vm::pop<real>(Stack);
Int n=vm::pop<Int>(Stack);
-#line 3817 "runtime.in"
+#line 3796 "runtime.in"
{Stack->push<real>(yn(n,x)); return;}
}
-#line 3821 "runtime.in"
+#line 3800 "runtime.in"
// real erf(real x);
-void gen311(stack *Stack)
+void gen_runtime312(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3822 "runtime.in"
+#line 3801 "runtime.in"
{Stack->push<real>(erf(x)); return;}
}
-#line 3826 "runtime.in"
+#line 3805 "runtime.in"
// real erfc(real x);
-void gen312(stack *Stack)
+void gen_runtime313(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3827 "runtime.in"
+#line 3806 "runtime.in"
{Stack->push<real>(erfc(x)); return;}
}
-#line 3831 "runtime.in"
+#line 3810 "runtime.in"
// Int factorial(Int n);
-void gen313(stack *Stack)
+void gen_runtime314(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 3832 "runtime.in"
+#line 3811 "runtime.in"
if(n < 0) error(invalidargument);
{Stack->push<Int>(factorial(n)); return;}
}
-#line 3836 "runtime.in"
+#line 3815 "runtime.in"
// Int choose(Int n, Int k);
-void gen314(stack *Stack)
+void gen_runtime315(stack *Stack)
{
Int k=vm::pop<Int>(Stack);
Int n=vm::pop<Int>(Stack);
-#line 3837 "runtime.in"
+#line 3816 "runtime.in"
if(n < 0 || k < 0 || k > n) error(invalidargument);
Int f=1;
Int r=n-k;
@@ -5309,12 +5322,12 @@ void gen314(stack *Stack)
{Stack->push<Int>(f); return;}
}
-#line 3847 "runtime.in"
+#line 3826 "runtime.in"
// real gamma(real x);
-void gen315(stack *Stack)
+void gen_runtime316(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 3848 "runtime.in"
+#line 3827 "runtime.in"
#ifdef HAVE_TGAMMA
{Stack->push<real>(tgamma(x)); return;}
#else
@@ -5324,23 +5337,23 @@ void gen315(stack *Stack)
}
// Complex Gamma function
-#line 3858 "runtime.in"
+#line 3837 "runtime.in"
// pair gamma(explicit pair z);
-void gen316(stack *Stack)
+void gen_runtime317(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 3859 "runtime.in"
+#line 3838 "runtime.in"
{Stack->push<pair>(gamma(z)); return;}
}
-#line 3863 "runtime.in"
+#line 3842 "runtime.in"
// realarray* quadraticroots(real a, real b, real c);
-void gen317(stack *Stack)
+void gen_runtime318(stack *Stack)
{
real c=vm::pop<real>(Stack);
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
-#line 3864 "runtime.in"
+#line 3843 "runtime.in"
quadraticroots q(a,b,c);
array *roots=new array(q.roots);
if(q.roots >= 1) (*roots)[0]=q.t1;
@@ -5348,14 +5361,14 @@ void gen317(stack *Stack)
{Stack->push<realarray*>(roots); return;}
}
-#line 3872 "runtime.in"
+#line 3851 "runtime.in"
// pairarray* quadraticroots(explicit pair a, explicit pair b, explicit pair c);
-void gen318(stack *Stack)
+void gen_runtime319(stack *Stack)
{
pair c=vm::pop<pair>(Stack);
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 3873 "runtime.in"
+#line 3852 "runtime.in"
Quadraticroots q(a,b,c);
array *roots=new array(q.roots);
if(q.roots >= 1) (*roots)[0]=q.z1;
@@ -5363,15 +5376,15 @@ void gen318(stack *Stack)
{Stack->push<pairarray*>(roots); return;}
}
-#line 3881 "runtime.in"
+#line 3860 "runtime.in"
// realarray* cubicroots(real a, real b, real c, real d);
-void gen319(stack *Stack)
+void gen_runtime320(stack *Stack)
{
real d=vm::pop<real>(Stack);
real c=vm::pop<real>(Stack);
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
-#line 3882 "runtime.in"
+#line 3861 "runtime.in"
cubicroots q(a,b,c,d);
array *roots=new array(q.roots);
if(q.roots >= 1) (*roots)[0]=q.t1;
@@ -5382,103 +5395,103 @@ void gen319(stack *Stack)
// Transforms
-#line 3893 "runtime.in"
+#line 3872 "runtime.in"
// bool ==(transform a, transform b);
-void gen320(stack *Stack)
+void gen_runtime321(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 3894 "runtime.in"
+#line 3873 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 3899 "runtime.in"
+#line 3878 "runtime.in"
// bool !=(transform a, transform b);
-void gen321(stack *Stack)
+void gen_runtime322(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 3900 "runtime.in"
+#line 3879 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 3904 "runtime.in"
+#line 3883 "runtime.in"
// transform +(transform a, transform b);
-void gen322(stack *Stack)
+void gen_runtime323(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 3905 "runtime.in"
+#line 3884 "runtime.in"
{Stack->push<transform>(a+b); return;}
}
-#line 3909 "runtime.in"
+#line 3888 "runtime.in"
// transform *(transform a, transform b);
-void gen323(stack *Stack)
+void gen_runtime324(stack *Stack)
{
transform b=vm::pop<transform>(Stack);
transform a=vm::pop<transform>(Stack);
-#line 3910 "runtime.in"
+#line 3889 "runtime.in"
{Stack->push<transform>(a*b); return;}
}
-#line 3914 "runtime.in"
+#line 3893 "runtime.in"
// pair *(transform t, pair z);
-void gen324(stack *Stack)
+void gen_runtime325(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 3915 "runtime.in"
+#line 3894 "runtime.in"
{Stack->push<pair>(t*z); return;}
}
-#line 3919 "runtime.in"
+#line 3898 "runtime.in"
// path *(transform t, path g);
-void gen325(stack *Stack)
+void gen_runtime326(stack *Stack)
{
path g=vm::pop<path>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 3920 "runtime.in"
+#line 3899 "runtime.in"
{Stack->push<path>(transformed(t,g)); return;}
}
-#line 3924 "runtime.in"
+#line 3903 "runtime.in"
// pen *(transform t, pen p);
-void gen326(stack *Stack)
+void gen_runtime327(stack *Stack)
{
pen p=vm::pop<pen>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 3925 "runtime.in"
+#line 3904 "runtime.in"
{Stack->push<pen>(transformed(t,p)); return;}
}
-#line 3929 "runtime.in"
+#line 3908 "runtime.in"
// picture* *(transform t, picture *f);
-void gen327(stack *Stack)
+void gen_runtime328(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 3930 "runtime.in"
+#line 3909 "runtime.in"
{Stack->push<picture*>(transformed(t,f)); return;}
}
-#line 3934 "runtime.in"
+#line 3913 "runtime.in"
// picture* *(realarray2 *t, picture *f);
-void gen328(stack *Stack)
+void gen_runtime329(stack *Stack)
{
picture * f=vm::pop<picture *>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 3935 "runtime.in"
+#line 3914 "runtime.in"
{Stack->push<picture*>(transformed(*t,f)); return;}
}
-#line 3939 "runtime.in"
+#line 3918 "runtime.in"
// transform ^(transform t, Int n);
-void gen329(stack *Stack)
+void gen_runtime330(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
transform t=vm::pop<transform>(Stack);
-#line 3940 "runtime.in"
+#line 3919 "runtime.in"
transform T;
if(n < 0) {
n=-n;
@@ -5488,55 +5501,55 @@ void gen329(stack *Stack)
{Stack->push<transform>(T); return;}
}
-#line 3950 "runtime.in"
+#line 3929 "runtime.in"
void transformXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3951 "runtime.in"
+#line 3930 "runtime.in"
{Stack->push<real>(t.getx()); return;}
}
-#line 3955 "runtime.in"
+#line 3934 "runtime.in"
void transformYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3956 "runtime.in"
+#line 3935 "runtime.in"
{Stack->push<real>(t.gety()); return;}
}
-#line 3960 "runtime.in"
+#line 3939 "runtime.in"
void transformXXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3961 "runtime.in"
+#line 3940 "runtime.in"
{Stack->push<real>(t.getxx()); return;}
}
-#line 3965 "runtime.in"
+#line 3944 "runtime.in"
void transformXYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3966 "runtime.in"
+#line 3945 "runtime.in"
{Stack->push<real>(t.getxy()); return;}
}
-#line 3970 "runtime.in"
+#line 3949 "runtime.in"
void transformYXPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3971 "runtime.in"
+#line 3950 "runtime.in"
{Stack->push<real>(t.getyx()); return;}
}
-#line 3975 "runtime.in"
+#line 3954 "runtime.in"
void transformYYPart(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3976 "runtime.in"
+#line 3955 "runtime.in"
{Stack->push<real>(t.getyy()); return;}
}
-#line 3980 "runtime.in"
+#line 3959 "runtime.in"
void real6ToTransform(stack *Stack)
{
real yy=vm::pop<real>(Stack);
@@ -5545,783 +5558,806 @@ void real6ToTransform(stack *Stack)
real xx=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 3982 "runtime.in"
+#line 3961 "runtime.in"
{Stack->push<transform>(transform(x,y,xx,xy,yx,yy)); return;}
}
-#line 3986 "runtime.in"
+#line 3965 "runtime.in"
// transform shift(transform t);
-void gen337(stack *Stack)
+void gen_runtime338(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3987 "runtime.in"
+#line 3966 "runtime.in"
{Stack->push<transform>(transform(t.getx(),t.gety(),0,0,0,0)); return;}
}
-#line 3991 "runtime.in"
+#line 3970 "runtime.in"
// transform shiftless(transform t);
-void gen338(stack *Stack)
+void gen_runtime339(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 3992 "runtime.in"
+#line 3971 "runtime.in"
{Stack->push<transform>(transform(0,0,t.getxx(),t.getxy(),t.getyx(),t.getyy())); return;}
}
-#line 3996 "runtime.in"
+#line 3975 "runtime.in"
// transform identity();
void transformIdentity(stack *Stack)
{
-#line 3997 "runtime.in"
+#line 3976 "runtime.in"
{Stack->push<transform>(identity); return;}
}
-#line 4001 "runtime.in"
+#line 3980 "runtime.in"
// transform inverse(transform t);
-void gen340(stack *Stack)
+void gen_runtime341(stack *Stack)
{
transform t=vm::pop<transform>(Stack);
-#line 4002 "runtime.in"
+#line 3981 "runtime.in"
{Stack->push<transform>(inverse(t)); return;}
}
-#line 4006 "runtime.in"
+#line 3985 "runtime.in"
// transform shift(pair z);
-void gen341(stack *Stack)
+void gen_runtime342(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4007 "runtime.in"
+#line 3986 "runtime.in"
{Stack->push<transform>(shift(z)); return;}
}
-#line 4011 "runtime.in"
+#line 3990 "runtime.in"
// transform shift(real x, real y);
-void gen342(stack *Stack)
+void gen_runtime343(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 4012 "runtime.in"
+#line 3991 "runtime.in"
{Stack->push<transform>(shift(pair(x,y))); return;}
}
-#line 4016 "runtime.in"
+#line 3995 "runtime.in"
// transform xscale(real x);
-void gen343(stack *Stack)
+void gen_runtime344(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 4017 "runtime.in"
+#line 3996 "runtime.in"
{Stack->push<transform>(xscale(x)); return;}
}
-#line 4021 "runtime.in"
+#line 4000 "runtime.in"
// transform yscale(real y);
-void gen344(stack *Stack)
+void gen_runtime345(stack *Stack)
{
real y=vm::pop<real>(Stack);
-#line 4022 "runtime.in"
+#line 4001 "runtime.in"
{Stack->push<transform>(yscale(y)); return;}
}
-#line 4026 "runtime.in"
+#line 4005 "runtime.in"
// transform scale(real x);
-void gen345(stack *Stack)
+void gen_runtime346(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 4027 "runtime.in"
+#line 4006 "runtime.in"
{Stack->push<transform>(scale(x)); return;}
}
-#line 4031 "runtime.in"
+#line 4010 "runtime.in"
// transform scale(real x, real y);
-void gen346(stack *Stack)
+void gen_runtime347(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 4032 "runtime.in"
+#line 4011 "runtime.in"
{Stack->push<transform>(xscale(x)*yscale(y)); return;}
}
-#line 4036 "runtime.in"
+#line 4015 "runtime.in"
// transform slant(real s);
-void gen347(stack *Stack)
+void gen_runtime348(stack *Stack)
{
real s=vm::pop<real>(Stack);
-#line 4037 "runtime.in"
+#line 4016 "runtime.in"
{Stack->push<transform>(slant(s)); return;}
}
-#line 4041 "runtime.in"
+#line 4020 "runtime.in"
// transform rotate(real angle, pair z=0);
-void gen348(stack *Stack)
+void gen_runtime349(stack *Stack)
{
pair z=vm::pop<pair>(Stack,0);
real angle=vm::pop<real>(Stack);
-#line 4042 "runtime.in"
+#line 4021 "runtime.in"
{Stack->push<transform>(rotatearound(z,radians(angle))); return;}
}
-#line 4046 "runtime.in"
+#line 4025 "runtime.in"
// transform reflect(pair a, pair b);
-void gen349(stack *Stack)
+void gen_runtime350(stack *Stack)
{
pair b=vm::pop<pair>(Stack);
pair a=vm::pop<pair>(Stack);
-#line 4047 "runtime.in"
+#line 4026 "runtime.in"
{Stack->push<transform>(reflectabout(a,b)); return;}
}
// Pair operations
-#line 4053 "runtime.in"
+#line 4032 "runtime.in"
void pairZero(stack *Stack)
{
-#line 4054 "runtime.in"
+#line 4033 "runtime.in"
{Stack->push<pair>(zero); return;}
}
-#line 4059 "runtime.in"
+#line 4038 "runtime.in"
void realRealToPair(stack *Stack)
{
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 4060 "runtime.in"
+#line 4039 "runtime.in"
{Stack->push<pair>(pair(x,y)); return;}
}
-#line 4064 "runtime.in"
+#line 4043 "runtime.in"
void pairNegate(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4065 "runtime.in"
+#line 4044 "runtime.in"
{Stack->push<pair>(-z); return;}
}
-#line 4069 "runtime.in"
+#line 4048 "runtime.in"
// real xpart(pair z);
void pairXPart(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4070 "runtime.in"
+#line 4049 "runtime.in"
{Stack->push<real>(z.getx()); return;}
}
-#line 4074 "runtime.in"
+#line 4053 "runtime.in"
// real ypart(pair z);
void pairYPart(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4075 "runtime.in"
+#line 4054 "runtime.in"
{Stack->push<real>(z.gety()); return;}
}
-#line 4079 "runtime.in"
+#line 4058 "runtime.in"
// real length(pair z);
-void gen355(stack *Stack)
+void gen_runtime356(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4080 "runtime.in"
+#line 4059 "runtime.in"
{Stack->push<real>(z.length()); return;}
}
-#line 4084 "runtime.in"
+#line 4063 "runtime.in"
// real abs(pair z);
-void gen356(stack *Stack)
+void gen_runtime357(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4085 "runtime.in"
+#line 4064 "runtime.in"
{Stack->push<real>(z.length()); return;}
}
-#line 4089 "runtime.in"
+#line 4068 "runtime.in"
// pair sqrt(explicit pair z);
-void gen357(stack *Stack)
+void gen_runtime358(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4090 "runtime.in"
+#line 4069 "runtime.in"
{Stack->push<pair>(Sqrt(z)); return;}
}
// Return the angle of z in radians.
-#line 4095 "runtime.in"
+#line 4074 "runtime.in"
// real angle(pair z, bool warn=true);
-void gen358(stack *Stack)
+void gen_runtime359(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
pair z=vm::pop<pair>(Stack);
-#line 4096 "runtime.in"
+#line 4075 "runtime.in"
if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(z.angle()); return;}
}
// Return the angle of z in degrees in the interval [0,360).
-#line 4102 "runtime.in"
+#line 4081 "runtime.in"
// real degrees(pair z, bool warn=true);
-void gen359(stack *Stack)
+void gen_runtime360(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
pair z=vm::pop<pair>(Stack);
-#line 4103 "runtime.in"
+#line 4082 "runtime.in"
if(!warn && z.getx() == 0.0 && z.gety() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(principalBranch(degrees(z.angle()))); return;}
}
// Convert degrees to radians.
-#line 4109 "runtime.in"
+#line 4088 "runtime.in"
// real radians(real degrees);
-void gen360(stack *Stack)
+void gen_runtime361(stack *Stack)
{
real degrees=vm::pop<real>(Stack);
-#line 4110 "runtime.in"
+#line 4089 "runtime.in"
{Stack->push<real>(radians(degrees)); return;}
}
// Convert radians to degrees.
-#line 4115 "runtime.in"
+#line 4094 "runtime.in"
// real degrees(real radians);
-void gen361(stack *Stack)
+void gen_runtime362(stack *Stack)
{
real radians=vm::pop<real>(Stack);
-#line 4116 "runtime.in"
+#line 4095 "runtime.in"
{Stack->push<real>(degrees(radians)); return;}
}
// Convert radians to degrees in [0,360).
-#line 4121 "runtime.in"
+#line 4100 "runtime.in"
// real Degrees(real radians);
-void gen362(stack *Stack)
+void gen_runtime363(stack *Stack)
{
real radians=vm::pop<real>(Stack);
-#line 4122 "runtime.in"
+#line 4101 "runtime.in"
{Stack->push<real>(principalBranch(degrees(radians))); return;}
}
-#line 4126 "runtime.in"
+#line 4105 "runtime.in"
// real Sin(real deg);
-void gen363(stack *Stack)
+void gen_runtime364(stack *Stack)
{
real deg=vm::pop<real>(Stack);
-#line 4127 "runtime.in"
+#line 4106 "runtime.in"
{Stack->push<real>(sin(radians(deg))); return;}
}
-#line 4131 "runtime.in"
+#line 4110 "runtime.in"
// real Cos(real deg);
-void gen364(stack *Stack)
+void gen_runtime365(stack *Stack)
{
real deg=vm::pop<real>(Stack);
-#line 4132 "runtime.in"
+#line 4111 "runtime.in"
{Stack->push<real>(cos(radians(deg))); return;}
}
-#line 4136 "runtime.in"
+#line 4115 "runtime.in"
// real Tan(real deg);
-void gen365(stack *Stack)
+void gen_runtime366(stack *Stack)
{
real deg=vm::pop<real>(Stack);
-#line 4137 "runtime.in"
+#line 4116 "runtime.in"
{Stack->push<real>(tan(radians(deg))); return;}
}
-#line 4141 "runtime.in"
+#line 4120 "runtime.in"
// real aSin(real x);
-void gen366(stack *Stack)
+void gen_runtime367(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 4142 "runtime.in"
+#line 4121 "runtime.in"
{Stack->push<real>(degrees(asin(x))); return;}
}
-#line 4146 "runtime.in"
+#line 4125 "runtime.in"
// real aCos(real x);
-void gen367(stack *Stack)
+void gen_runtime368(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 4147 "runtime.in"
+#line 4126 "runtime.in"
{Stack->push<real>(degrees(acos(x))); return;}
}
-#line 4151 "runtime.in"
+#line 4130 "runtime.in"
// real aTan(real x);
-void gen368(stack *Stack)
+void gen_runtime369(stack *Stack)
{
real x=vm::pop<real>(Stack);
-#line 4152 "runtime.in"
+#line 4131 "runtime.in"
{Stack->push<real>(degrees(atan(x))); return;}
}
-#line 4156 "runtime.in"
+#line 4135 "runtime.in"
// pair unit(pair z);
-void gen369(stack *Stack)
+void gen_runtime370(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4157 "runtime.in"
+#line 4136 "runtime.in"
{Stack->push<pair>(unit(z)); return;}
}
-#line 4161 "runtime.in"
+#line 4140 "runtime.in"
// pair dir(real degrees);
-void gen370(stack *Stack)
+void gen_runtime371(stack *Stack)
{
real degrees=vm::pop<real>(Stack);
-#line 4162 "runtime.in"
+#line 4141 "runtime.in"
{Stack->push<pair>(expi(radians(degrees))); return;}
}
-#line 4166 "runtime.in"
+#line 4145 "runtime.in"
// pair dir(explicit pair z);
-void gen371(stack *Stack)
+void gen_runtime372(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4167 "runtime.in"
+#line 4146 "runtime.in"
{Stack->push<pair>(unit(z)); return;}
}
-#line 4171 "runtime.in"
+#line 4150 "runtime.in"
// pair expi(real angle);
-void gen372(stack *Stack)
+void gen_runtime373(stack *Stack)
{
real angle=vm::pop<real>(Stack);
-#line 4172 "runtime.in"
+#line 4151 "runtime.in"
{Stack->push<pair>(expi(angle)); return;}
}
-#line 4176 "runtime.in"
+#line 4155 "runtime.in"
// pair exp(explicit pair z);
-void gen373(stack *Stack)
+void gen_runtime374(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4177 "runtime.in"
+#line 4156 "runtime.in"
{Stack->push<pair>(exp(z)); return;}
}
-#line 4181 "runtime.in"
+#line 4160 "runtime.in"
// pair log(explicit pair z);
-void gen374(stack *Stack)
+void gen_runtime375(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4182 "runtime.in"
+#line 4161 "runtime.in"
{Stack->push<pair>(pair(log(z.length()),z.angle())); return;}
}
-#line 4186 "runtime.in"
+#line 4165 "runtime.in"
// pair sin(explicit pair z);
-void gen375(stack *Stack)
+void gen_runtime376(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4187 "runtime.in"
+#line 4166 "runtime.in"
{Stack->push<pair>(sin(z)); return;}
}
-#line 4191 "runtime.in"
+#line 4170 "runtime.in"
// pair cos(explicit pair z);
-void gen376(stack *Stack)
+void gen_runtime377(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4192 "runtime.in"
+#line 4171 "runtime.in"
{Stack->push<pair>(pair(cos(z.getx())*cosh(z.gety()),-sin(z.getx())*sinh(z.gety()))); return;}
}
-#line 4196 "runtime.in"
+#line 4175 "runtime.in"
// pair conj(pair z);
-void gen377(stack *Stack)
+void gen_runtime378(stack *Stack)
{
pair z=vm::pop<pair>(Stack);
-#line 4197 "runtime.in"
+#line 4176 "runtime.in"
{Stack->push<pair>(conj(z)); return;}
}
-#line 4201 "runtime.in"
+#line 4180 "runtime.in"
// pair realmult(pair z, pair w);
-void gen378(stack *Stack)
+void gen_runtime379(stack *Stack)
{
pair w=vm::pop<pair>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 4202 "runtime.in"
+#line 4181 "runtime.in"
{Stack->push<pair>(pair (z.getx()*w.getx(),z.gety()*w.gety())); return;}
}
-#line 4206 "runtime.in"
+#line 4185 "runtime.in"
// triple realmult(triple u, triple v);
-void gen379(stack *Stack)
+void gen_runtime380(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
triple u=vm::pop<triple>(Stack);
-#line 4207 "runtime.in"
+#line 4186 "runtime.in"
{Stack->push<triple>(triple (u.getx()*v.getx(),u.gety()*v.gety(),u.getz()*v.getz())); return;}
}
// To avoid confusion, a dot product requires explicit pair arguments.
-#line 4212 "runtime.in"
+#line 4191 "runtime.in"
// real dot(explicit pair z, explicit pair w);
-void gen380(stack *Stack)
+void gen_runtime381(stack *Stack)
{
pair w=vm::pop<pair>(Stack);
pair z=vm::pop<pair>(Stack);
-#line 4213 "runtime.in"
+#line 4192 "runtime.in"
{Stack->push<real>(dot(z,w)); return;}
}
// Triple operations
-#line 4219 "runtime.in"
+#line 4198 "runtime.in"
void tripleZero(stack *Stack)
{
-#line 4220 "runtime.in"
+#line 4199 "runtime.in"
static triple zero;
{Stack->push<triple>(zero); return;}
}
-#line 4226 "runtime.in"
+#line 4205 "runtime.in"
void realRealRealToTriple(stack *Stack)
{
real z=vm::pop<real>(Stack);
real y=vm::pop<real>(Stack);
real x=vm::pop<real>(Stack);
-#line 4227 "runtime.in"
+#line 4206 "runtime.in"
{Stack->push<triple>(triple(x,y,z)); return;}
}
-#line 4231 "runtime.in"
+#line 4210 "runtime.in"
// real xpart(triple v);
void tripleXPart(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4232 "runtime.in"
+#line 4211 "runtime.in"
{Stack->push<real>(v.getx()); return;}
}
-#line 4236 "runtime.in"
+#line 4215 "runtime.in"
// real ypart(triple v);
void tripleYPart(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4237 "runtime.in"
+#line 4216 "runtime.in"
{Stack->push<real>(v.gety()); return;}
}
-#line 4241 "runtime.in"
+#line 4220 "runtime.in"
// real zpart(triple v);
void tripleZPart(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4242 "runtime.in"
+#line 4221 "runtime.in"
{Stack->push<real>(v.getz()); return;}
}
-#line 4246 "runtime.in"
+#line 4225 "runtime.in"
// triple *(real x, triple v);
-void gen386(stack *Stack)
+void gen_runtime387(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
real x=vm::pop<real>(Stack);
-#line 4247 "runtime.in"
+#line 4226 "runtime.in"
{Stack->push<triple>(x*v); return;}
}
-#line 4251 "runtime.in"
+#line 4230 "runtime.in"
// triple *(triple v, real x);
-void gen387(stack *Stack)
+void gen_runtime388(stack *Stack)
{
real x=vm::pop<real>(Stack);
triple v=vm::pop<triple>(Stack);
-#line 4252 "runtime.in"
+#line 4231 "runtime.in"
{Stack->push<triple>(v*x); return;}
}
-#line 4256 "runtime.in"
+#line 4235 "runtime.in"
// triple /(triple v, real x);
-void gen388(stack *Stack)
+void gen_runtime389(stack *Stack)
{
real x=vm::pop<real>(Stack);
triple v=vm::pop<triple>(Stack);
-#line 4257 "runtime.in"
+#line 4236 "runtime.in"
{Stack->push<triple>(v/x); return;}
}
-#line 4261 "runtime.in"
+#line 4240 "runtime.in"
// real length(triple v);
-void gen389(stack *Stack)
+void gen_runtime390(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4262 "runtime.in"
+#line 4241 "runtime.in"
{Stack->push<real>(v.length()); return;}
}
-#line 4266 "runtime.in"
+#line 4245 "runtime.in"
// real abs(triple v);
-void gen390(stack *Stack)
+void gen_runtime391(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4267 "runtime.in"
+#line 4246 "runtime.in"
{Stack->push<real>(v.length()); return;}
}
-#line 4271 "runtime.in"
+#line 4250 "runtime.in"
// real polar(triple v, bool warn=true);
-void gen391(stack *Stack)
+void gen_runtime392(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
triple v=vm::pop<triple>(Stack);
-#line 4272 "runtime.in"
+#line 4251 "runtime.in"
if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(v.polar()); return;}
}
-#line 4277 "runtime.in"
+#line 4256 "runtime.in"
// real azimuth(triple v, bool warn=true);
-void gen392(stack *Stack)
+void gen_runtime393(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
triple v=vm::pop<triple>(Stack);
-#line 4278 "runtime.in"
+#line 4257 "runtime.in"
if(!warn && v.getx() == 0.0 && v.gety() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(v.azimuth()); return;}
}
-#line 4283 "runtime.in"
+#line 4262 "runtime.in"
// real colatitude(triple v, bool warn=true);
-void gen393(stack *Stack)
+void gen_runtime394(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
triple v=vm::pop<triple>(Stack);
-#line 4284 "runtime.in"
+#line 4263 "runtime.in"
if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(degrees(v.polar())); return;}
}
-#line 4289 "runtime.in"
+#line 4268 "runtime.in"
// real latitude(triple v, bool warn=true);
-void gen394(stack *Stack)
+void gen_runtime395(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
triple v=vm::pop<triple>(Stack);
-#line 4290 "runtime.in"
+#line 4269 "runtime.in"
if(!warn && v.getx() == 0.0 && v.gety() == 0.0 && v.getz() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(90.0-degrees(v.polar())); return;}
}
// Return the longitude of v in [0,360).
-#line 4296 "runtime.in"
+#line 4275 "runtime.in"
// real longitude(triple v, bool warn=true);
-void gen395(stack *Stack)
+void gen_runtime396(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
triple v=vm::pop<triple>(Stack);
-#line 4297 "runtime.in"
+#line 4276 "runtime.in"
if(!warn && v.getx() == 0.0 && v.gety() == 0.0) {Stack->push<real>(0.0); return;}
{Stack->push<real>(principalBranch(degrees(v.azimuth()))); return;}
}
-#line 4302 "runtime.in"
+#line 4281 "runtime.in"
// triple unit(triple v);
-void gen396(stack *Stack)
+void gen_runtime397(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
-#line 4303 "runtime.in"
+#line 4282 "runtime.in"
{Stack->push<triple>(unit(v)); return;}
}
-#line 4307 "runtime.in"
+#line 4286 "runtime.in"
// real dot(triple u, triple v);
-void gen397(stack *Stack)
+void gen_runtime398(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
triple u=vm::pop<triple>(Stack);
-#line 4308 "runtime.in"
+#line 4287 "runtime.in"
{Stack->push<real>(dot(u,v)); return;}
}
-#line 4312 "runtime.in"
+#line 4291 "runtime.in"
// triple cross(triple u, triple v);
-void gen398(stack *Stack)
+void gen_runtime399(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
triple u=vm::pop<triple>(Stack);
-#line 4313 "runtime.in"
+#line 4292 "runtime.in"
{Stack->push<triple>(cross(u,v)); return;}
}
-#line 4317 "runtime.in"
+#line 4296 "runtime.in"
+// triple dir(explicit triple z);
+void gen_runtime400(stack *Stack)
+{
+ triple z=vm::pop<triple>(Stack);
+#line 4297 "runtime.in"
+ {Stack->push<triple>(unit(z)); return;}
+}
+
+#line 4301 "runtime.in"
// triple expi(real polar, real azimuth);
-void gen399(stack *Stack)
+void gen_runtime401(stack *Stack)
{
real azimuth=vm::pop<real>(Stack);
real polar=vm::pop<real>(Stack);
-#line 4318 "runtime.in"
+#line 4302 "runtime.in"
{Stack->push<triple>(expi(polar,azimuth)); return;}
}
-#line 4322 "runtime.in"
+#line 4306 "runtime.in"
// triple dir(real colatitude, real longitude);
-void gen400(stack *Stack)
+void gen_runtime402(stack *Stack)
{
real longitude=vm::pop<real>(Stack);
real colatitude=vm::pop<real>(Stack);
-#line 4323 "runtime.in"
+#line 4307 "runtime.in"
{Stack->push<triple>(expi(radians(colatitude),radians(longitude))); return;}
}
// System routines
-#line 4329 "runtime.in"
+#line 4313 "runtime.in"
// void atupdate(callable *f);
-void gen401(stack *Stack)
+void gen_runtime403(stack *Stack)
{
callable * f=vm::pop<callable *>(Stack);
-#line 4330 "runtime.in"
+#line 4314 "runtime.in"
processData().atUpdateFunction=f;
}
-#line 4335 "runtime.in"
+#line 4319 "runtime.in"
// callable* atupdate();
-void gen402(stack *Stack)
+void gen_runtime404(stack *Stack)
{
-#line 4336 "runtime.in"
+#line 4320 "runtime.in"
{Stack->push<callable*>(processData().atUpdateFunction); return;}
}
-#line 4340 "runtime.in"
+#line 4324 "runtime.in"
// void atexit(callable *f);
-void gen403(stack *Stack)
+void gen_runtime405(stack *Stack)
{
callable * f=vm::pop<callable *>(Stack);
-#line 4341 "runtime.in"
+#line 4325 "runtime.in"
processData().atExitFunction=f;
}
-#line 4345 "runtime.in"
+#line 4329 "runtime.in"
// callable* atexit();
-void gen404(stack *Stack)
+void gen_runtime406(stack *Stack)
{
-#line 4346 "runtime.in"
+#line 4330 "runtime.in"
{Stack->push<callable*>(processData().atExitFunction); return;}
}
-#line 4350 "runtime.in"
+#line 4334 "runtime.in"
// void atbreakpoint(callableBp *f);
-void gen405(stack *Stack)
+void gen_runtime407(stack *Stack)
{
callableBp * f=vm::pop<callableBp *>(Stack);
-#line 4351 "runtime.in"
+#line 4335 "runtime.in"
processData().atBreakpointFunction=f;
}
-#line 4355 "runtime.in"
+#line 4339 "runtime.in"
// void breakpoint(runnable *s=NULL);
-void gen406(stack *Stack)
+void gen_runtime408(stack *Stack)
{
runnable * s=vm::pop<runnable *>(Stack,NULL);
-#line 4356 "runtime.in"
+#line 4340 "runtime.in"
breakpoint(Stack,s);
}
-#line 4360 "runtime.in"
+#line 4344 "runtime.in"
// string locatefile(string file);
-void gen407(stack *Stack)
+void gen_runtime409(stack *Stack)
{
string file=vm::pop<string>(Stack);
-#line 4361 "runtime.in"
+#line 4345 "runtime.in"
{Stack->push<string>(locateFile(file)); return;}
}
-#line 4365 "runtime.in"
+#line 4349 "runtime.in"
// void stop(string file, Int line, runnable *s=NULL);
-void gen408(stack *Stack)
+void gen_runtime410(stack *Stack)
{
runnable * s=vm::pop<runnable *>(Stack,NULL);
Int line=vm::pop<Int>(Stack);
string file=vm::pop<string>(Stack);
-#line 4366 "runtime.in"
+#line 4350 "runtime.in"
file=locateFile(file);
clear(file,line);
cout << "setting breakpoint at " << file << ": " << line << endl;
bplist.push_back(bpinfo(file,line,s));
}
-#line 4373 "runtime.in"
+#line 4357 "runtime.in"
// void breakpoints();
-void gen409(stack *)
+void gen_runtime411(stack *)
{
-#line 4374 "runtime.in"
+#line 4358 "runtime.in"
for(mem::list<bpinfo>::iterator p=bplist.begin(); p != bplist.end(); ++p)
cout << p->f.name() << ": " << p->f.line() << endl;
}
-#line 4379 "runtime.in"
+#line 4363 "runtime.in"
// void clear(string file, Int line);
-void gen410(stack *Stack)
+void gen_runtime412(stack *Stack)
{
Int line=vm::pop<Int>(Stack);
string file=vm::pop<string>(Stack);
-#line 4380 "runtime.in"
+#line 4364 "runtime.in"
file=locateFile(file);
clear(file,line,true);
}
-#line 4385 "runtime.in"
+#line 4369 "runtime.in"
// void clear();
-void gen411(stack *)
+void gen_runtime413(stack *)
{
-#line 4386 "runtime.in"
+#line 4370 "runtime.in"
bplist.clear();
}
-#line 4390 "runtime.in"
+#line 4374 "runtime.in"
// void warn(string s);
-void gen412(stack *Stack)
+void gen_runtime414(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 4391 "runtime.in"
+#line 4375 "runtime.in"
Warn(s);
}
-#line 4395 "runtime.in"
+#line 4379 "runtime.in"
// void nowarn(string s);
-void gen413(stack *Stack)
+void gen_runtime415(stack *Stack)
{
string s=vm::pop<string>(Stack);
-#line 4396 "runtime.in"
+#line 4380 "runtime.in"
noWarn(s);
}
+#line 4384 "runtime.in"
+// void warning(string s, string t, bool position=false);
+void gen_runtime416(stack *Stack)
+{
+ bool position=vm::pop<bool>(Stack,false);
+ string t=vm::pop<string>(Stack);
+ string s=vm::pop<string>(Stack);
+#line 4385 "runtime.in"
+ if(settings::warn(s)) {
+ em.warning(position ? getPos() : nullPos,s);
+ em << t;
+ }
+}
+
// Strip directory from string
-#line 4401 "runtime.in"
+#line 4393 "runtime.in"
// string stripdirectory(string *s);
-void gen414(stack *Stack)
+void gen_runtime417(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 4402 "runtime.in"
+#line 4394 "runtime.in"
{Stack->push<string>(stripDir(*s)); return;}
}
// Strip directory from string
-#line 4407 "runtime.in"
+#line 4399 "runtime.in"
// string stripfile(string *s);
-void gen415(stack *Stack)
+void gen_runtime418(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 4408 "runtime.in"
+#line 4400 "runtime.in"
{Stack->push<string>(stripFile(*s)); return;}
}
// Strip file extension from string
-#line 4413 "runtime.in"
+#line 4405 "runtime.in"
// string stripextension(string *s);
-void gen416(stack *Stack)
+void gen_runtime419(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 4414 "runtime.in"
+#line 4406 "runtime.in"
{Stack->push<string>(stripExt(*s)); return;}
}
// Call ImageMagick convert.
-#line 4419 "runtime.in"
+#line 4411 "runtime.in"
// Int convert(string args=emptystring, string file=emptystring, string format=emptystring);
-void gen417(stack *Stack)
+void gen_runtime420(stack *Stack)
{
string format=vm::pop<string>(Stack,emptystring);
string file=vm::pop<string>(Stack,emptystring);
string args=vm::pop<string>(Stack,emptystring);
-#line 4421 "runtime.in"
+#line 4413 "runtime.in"
string name=convertname(file,format);
mem::vector<string> cmd;
cmd.push_back(getSetting<string>("convert"));
@@ -6338,14 +6374,14 @@ void gen417(stack *Stack)
}
// Call ImageMagick animate.
-#line 4438 "runtime.in"
+#line 4430 "runtime.in"
// Int animate(string args=emptystring, string file=emptystring, string format=emptystring);
-void gen418(stack *Stack)
+void gen_runtime421(stack *Stack)
{
string format=vm::pop<string>(Stack,emptystring);
string file=vm::pop<string>(Stack,emptystring);
string args=vm::pop<string>(Stack,emptystring);
-#line 4440 "runtime.in"
+#line 4432 "runtime.in"
#ifndef __CYGWIN__
string name=convertname(file,format,false);
if(view()) {
@@ -6360,12 +6396,12 @@ void gen418(stack *Stack)
}
// Delete file named s.
-#line 4455 "runtime.in"
+#line 4447 "runtime.in"
// Int delete(string *s);
-void gen419(stack *Stack)
+void gen_runtime422(stack *Stack)
{
string * s=vm::pop<string *>(Stack);
-#line 4456 "runtime.in"
+#line 4448 "runtime.in"
checkLocal(*s);
Int rc=unlink(s->c_str());
if(rc == 0 && verbose > 0)
@@ -6374,13 +6410,13 @@ void gen419(stack *Stack)
}
// Rename file "from" to file "to".
-#line 4465 "runtime.in"
+#line 4457 "runtime.in"
// Int rename(string *from, string *to);
-void gen420(stack *Stack)
+void gen_runtime423(stack *Stack)
{
string * to=vm::pop<string *>(Stack);
string * from=vm::pop<string *>(Stack);
-#line 4466 "runtime.in"
+#line 4458 "runtime.in"
checkLocal(*from);
checkLocal(*to);
Int rc=rename(from->c_str(),to->c_str());
@@ -6393,10 +6429,10 @@ void gen420(stack *Stack)
// Array operations
// Create an empty array.
-#line 4479 "runtime.in"
+#line 4471 "runtime.in"
void emptyArray(stack *Stack)
{
-#line 4480 "runtime.in"
+#line 4472 "runtime.in"
{Stack->push<array*>(new array(0)); return;}
}
@@ -6405,11 +6441,11 @@ void emptyArray(stack *Stack)
// is popped off the stack, followed by each dimension in reverse order.
// The array itself is technically a one dimensional array of one
// dimension arrays and so on.
-#line 4489 "runtime.in"
+#line 4481 "runtime.in"
void newDeepArray(stack *Stack)
{
Int depth=vm::pop<Int>(Stack);
-#line 4490 "runtime.in"
+#line 4482 "runtime.in"
assert(depth > 0);
Int *dims = new Int[depth];
@@ -6428,11 +6464,11 @@ void newDeepArray(stack *Stack)
// Creates an array with elements already specified. First, the number
// of elements is popped off the stack, followed by each element in
// reverse order.
-#line 4509 "runtime.in"
+#line 4501 "runtime.in"
void newInitializedArray(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 4510 "runtime.in"
+#line 4502 "runtime.in"
assert(n >= 0);
array *a = new array(n);
@@ -6445,12 +6481,12 @@ void newInitializedArray(stack *Stack)
// Similar to newInitializedArray, but after the n elements, append another
// array to it.
-#line 4523 "runtime.in"
+#line 4515 "runtime.in"
void newAppendedArray(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
array* tail=vm::pop<array*>(Stack);
-#line 4524 "runtime.in"
+#line 4516 "runtime.in"
assert(n >= 0);
array *a = new array(n);
@@ -6465,13 +6501,13 @@ void newAppendedArray(stack *Stack)
// The function T[] array(int n, T value, int depth=0) produces a array of n
// copies of x, where each copy is copied up to depth.
-#line 4539 "runtime.in"
+#line 4531 "runtime.in"
void newDuplicateArray(stack *Stack)
{
Int depth=vm::pop<Int>(Stack,Int_MAX);
item value=vm::pop(Stack);
Int n=vm::pop<Int>(Stack);
-#line 4540 "runtime.in"
+#line 4532 "runtime.in"
if(n < 0) error("cannot create a negative length array");
if(depth < 0) error("cannot copy to a negative depth");
@@ -6479,12 +6515,12 @@ void newDuplicateArray(stack *Stack)
}
// Read an element from an array. Checks for initialization & bounds.
-#line 4548 "runtime.in"
+#line 4540 "runtime.in"
void arrayRead(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4549 "runtime.in"
+#line 4541 "runtime.in"
item& i=arrayRead(a,n);
if (i.empty()) {
ostringstream buf;
@@ -6495,50 +6531,50 @@ void arrayRead(stack *Stack)
}
// Slice a substring from an array.
-#line 4560 "runtime.in"
+#line 4552 "runtime.in"
void arraySliceRead(stack *Stack)
{
Int right=vm::pop<Int>(Stack);
Int left=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4561 "runtime.in"
+#line 4553 "runtime.in"
checkArray(a);
{Stack->push(a->slice(left, right)); return;}
}
// Slice a substring from an array. This implements the cases a[i:] and a[:]
// where the endpoint is not given, and assumed to be the length of the array.
-#line 4568 "runtime.in"
+#line 4560 "runtime.in"
void arraySliceReadToEnd(stack *Stack)
{
Int left=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4569 "runtime.in"
+#line 4561 "runtime.in"
size_t len=checkArray(a);
{Stack->push(a->slice(left, (Int)len)); return;}
}
// Read an element from an array of arrays. Check bounds and initialize
// as necessary.
-#line 4576 "runtime.in"
+#line 4568 "runtime.in"
void arrayArrayRead(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4577 "runtime.in"
+#line 4569 "runtime.in"
item& i=arrayRead(a,n);
if (i.empty()) i=new array(0);
{Stack->push(i); return;}
}
// Write an element to an array. Increase size if necessary.
-#line 4584 "runtime.in"
+#line 4576 "runtime.in"
void arrayWrite(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
array * a=vm::pop<array *>(Stack);
item value=vm::pop(Stack);
-#line 4585 "runtime.in"
+#line 4577 "runtime.in"
size_t len=checkArray(a);
bool cyclic=a->cyclic();
if(cyclic && len > 0) n=imod(n,len);
@@ -6552,27 +6588,27 @@ void arrayWrite(stack *Stack)
{Stack->push(value); return;}
}
-#line 4599 "runtime.in"
+#line 4591 "runtime.in"
void arraySliceWrite(stack *Stack)
{
Int right=vm::pop<Int>(Stack);
Int left=vm::pop<Int>(Stack);
array * dest=vm::pop<array *>(Stack);
array * src=vm::pop<array *>(Stack);
-#line 4600 "runtime.in"
+#line 4592 "runtime.in"
checkArray(src);
checkArray(dest);
dest->setSlice(left, right, src);
{Stack->push<array*>(src); return;}
}
-#line 4607 "runtime.in"
+#line 4599 "runtime.in"
void arraySliceWriteToEnd(stack *Stack)
{
Int left=vm::pop<Int>(Stack);
array * dest=vm::pop<array *>(Stack);
array * src=vm::pop<array *>(Stack);
-#line 4608 "runtime.in"
+#line 4600 "runtime.in"
checkArray(src);
size_t len=checkArray(dest);
dest->setSlice(left, (Int) len, src);
@@ -6580,20 +6616,20 @@ void arraySliceWriteToEnd(stack *Stack)
}
// Returns the length of an array.
-#line 4616 "runtime.in"
+#line 4608 "runtime.in"
void arrayLength(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4617 "runtime.in"
+#line 4609 "runtime.in"
{Stack->push<Int>((Int) checkArray(a)); return;}
}
// Returns an array of integers representing the keys of the array.
-#line 4622 "runtime.in"
+#line 4614 "runtime.in"
void arrayKeys(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4623 "runtime.in"
+#line 4615 "runtime.in"
size_t size=checkArray(a);
array *keys=new array();
@@ -6607,22 +6643,33 @@ void arrayKeys(stack *Stack)
}
// Return the cyclic flag for an array.
-#line 4637 "runtime.in"
+#line 4629 "runtime.in"
void arrayCyclicFlag(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4638 "runtime.in"
+#line 4630 "runtime.in"
checkArray(a);
{Stack->push<bool>(a->cyclic()); return;}
}
+#line 4635 "runtime.in"
+void arraySetCyclicFlag(stack *Stack)
+{
+ array * a=vm::pop<array *>(Stack);
+ bool b=vm::pop<bool>(Stack);
+#line 4636 "runtime.in"
+ checkArray(a);
+ a->cyclic(b);
+ {Stack->push<bool>(b); return;}
+}
+
// Check to see if an array element is initialized.
-#line 4644 "runtime.in"
+#line 4643 "runtime.in"
void arrayInitializedHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
Int n=vm::pop<Int>(Stack);
-#line 4645 "runtime.in"
+#line 4644 "runtime.in"
size_t len=checkArray(a);
bool cyclic=a->cyclic();
if(cyclic && len > 0) n=imod(n,len);
@@ -6632,62 +6679,62 @@ void arrayInitializedHelper(stack *Stack)
}
// Returns the initialize method for an array.
-#line 4655 "runtime.in"
+#line 4654 "runtime.in"
void arrayInitialized(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4656 "runtime.in"
+#line 4655 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayInitializedHelper),a)); return;}
}
// The helper function for the cyclic method that sets the cyclic flag.
-#line 4661 "runtime.in"
+#line 4660 "runtime.in"
void arrayCyclicHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
bool b=vm::pop<bool>(Stack);
-#line 4662 "runtime.in"
+#line 4661 "runtime.in"
checkArray(a);
a->cyclic(b);
}
// Set the cyclic flag for an array.
-#line 4668 "runtime.in"
+#line 4667 "runtime.in"
void arrayCyclic(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4669 "runtime.in"
+#line 4668 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayCyclicHelper),a)); return;}
}
// The helper function for the push method that does the actual operation.
-#line 4674 "runtime.in"
+#line 4673 "runtime.in"
void arrayPushHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
item x=vm::pop(Stack);
-#line 4675 "runtime.in"
+#line 4674 "runtime.in"
checkArray(a);
a->push(x);
{Stack->push(x); return;}
}
// Returns the push method for an array.
-#line 4682 "runtime.in"
+#line 4681 "runtime.in"
void arrayPush(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4683 "runtime.in"
+#line 4682 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayPushHelper),a)); return;}
}
// The helper function for the append method that appends b to a.
-#line 4688 "runtime.in"
+#line 4687 "runtime.in"
void arrayAppendHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
array * b=vm::pop<array *>(Stack);
-#line 4689 "runtime.in"
+#line 4688 "runtime.in"
checkArray(a);
size_t size=checkArray(b);
for(size_t i=0; i < size; i++)
@@ -6695,20 +6742,20 @@ void arrayAppendHelper(stack *Stack)
}
// Returns the append method for an array.
-#line 4697 "runtime.in"
+#line 4696 "runtime.in"
void arrayAppend(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4698 "runtime.in"
+#line 4697 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayAppendHelper),a)); return;}
}
// The helper function for the pop method.
-#line 4703 "runtime.in"
+#line 4702 "runtime.in"
void arrayPopHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4704 "runtime.in"
+#line 4703 "runtime.in"
size_t asize=checkArray(a);
if(asize == 0)
error("cannot pop element from empty array");
@@ -6716,22 +6763,22 @@ void arrayPopHelper(stack *Stack)
}
// Returns the pop method for an array.
-#line 4712 "runtime.in"
+#line 4711 "runtime.in"
void arrayPop(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4713 "runtime.in"
+#line 4712 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayPopHelper),a)); return;}
}
// The helper function for the insert method.
-#line 4718 "runtime.in"
+#line 4717 "runtime.in"
void arrayInsertHelper(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
array * x=vm::pop<array *>(Stack);
Int i=vm::pop<Int>(Stack);
-#line 4719 "runtime.in"
+#line 4718 "runtime.in"
size_t asize=checkArray(a);
checkArray(x);
if(a->cyclic() && asize > 0) i=imod(i,asize);
@@ -6741,39 +6788,39 @@ void arrayInsertHelper(stack *Stack)
}
// Returns the insert method for an array.
-#line 4729 "runtime.in"
+#line 4728 "runtime.in"
void arrayInsert(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4730 "runtime.in"
+#line 4729 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayInsertHelper),a)); return;}
}
// Returns the delete method for an array.
-#line 4735 "runtime.in"
+#line 4734 "runtime.in"
void arrayDelete(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4736 "runtime.in"
+#line 4735 "runtime.in"
{Stack->push<callable*>(new thunk(new bfunc(arrayDeleteHelper),a)); return;}
}
-#line 4740 "runtime.in"
+#line 4739 "runtime.in"
void arrayAlias(stack *Stack)
{
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4741 "runtime.in"
+#line 4740 "runtime.in"
{Stack->push<bool>(a==b); return;}
}
// Return array formed by indexing array a with elements of integer array b
-#line 4746 "runtime.in"
+#line 4745 "runtime.in"
void arrayIntArray(stack *Stack)
{
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4747 "runtime.in"
+#line 4746 "runtime.in"
size_t asize=checkArray(a);
size_t bsize=checkArray(b);
array *r=new array(bsize);
@@ -6791,13 +6838,13 @@ void arrayIntArray(stack *Stack)
// returns the complement of the integer array a in {0,2,...,n-1},
// so that b[complement(a,b.length)] yields the complement of b[a].
-#line 4765 "runtime.in"
+#line 4764 "runtime.in"
// Intarray* complement(Intarray *a, Int n);
-void gen451(stack *Stack)
+void gen_runtime455(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
Intarray * a=vm::pop<Intarray *>(Stack);
-#line 4766 "runtime.in"
+#line 4765 "runtime.in"
size_t asize=checkArray(a);
array *r=new array(0);
bool *keep=new bool[n];
@@ -6814,12 +6861,12 @@ void gen451(stack *Stack)
}
// Generate the sequence {f(i) : i=0,1,...n-1} given a function f and integer n
-#line 4783 "runtime.in"
+#line 4782 "runtime.in"
void arraySequence(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
callable * f=vm::pop<callable *>(Stack);
-#line 4784 "runtime.in"
+#line 4783 "runtime.in"
if(n < 0) n=0;
array *a=new array(n);
for(Int i=0; i < n; ++i) {
@@ -6831,12 +6878,12 @@ void arraySequence(stack *Stack)
}
// Return the array {0,1,...n-1}
-#line 4796 "runtime.in"
+#line 4795 "runtime.in"
// Intarray* sequence(Int n);
-void gen453(stack *Stack)
+void gen_runtime457(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 4797 "runtime.in"
+#line 4796 "runtime.in"
if(n < 0) n=0;
array *a=new array(n);
for(Int i=0; i < n; ++i) {
@@ -6846,12 +6893,12 @@ void gen453(stack *Stack)
}
// Apply a function to each element of an array
-#line 4807 "runtime.in"
+#line 4806 "runtime.in"
void arrayFunction(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
callable * f=vm::pop<callable *>(Stack);
-#line 4808 "runtime.in"
+#line 4807 "runtime.in"
size_t size=checkArray(a);
array *b=new array(size);
for(size_t i=0; i < size; ++i) {
@@ -6862,12 +6909,12 @@ void arrayFunction(stack *Stack)
{Stack->push<array*>(b); return;}
}
-#line 4819 "runtime.in"
+#line 4818 "runtime.in"
void arraySort(stack *Stack)
{
callable * f=vm::pop<callable *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4820 "runtime.in"
+#line 4819 "runtime.in"
array *c=copyArray(a);
compareFunc=f;
FuncStack=Stack;
@@ -6875,12 +6922,12 @@ void arraySort(stack *Stack)
{Stack->push<array*>(c); return;}
}
-#line 4828 "runtime.in"
+#line 4827 "runtime.in"
// bool all(boolarray *a);
-void gen456(stack *Stack)
+void gen_runtime460(stack *Stack)
{
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 4829 "runtime.in"
+#line 4828 "runtime.in"
size_t size=checkArray(a);
bool c=true;
for(size_t i=0; i < size; i++)
@@ -6888,12 +6935,12 @@ void gen456(stack *Stack)
{Stack->push<bool>(c); return;}
}
-#line 4837 "runtime.in"
+#line 4836 "runtime.in"
// boolarray* !(boolarray* a);
-void gen457(stack *Stack)
+void gen_runtime461(stack *Stack)
{
boolarray* a=vm::pop<boolarray*>(Stack);
-#line 4838 "runtime.in"
+#line 4837 "runtime.in"
size_t size=checkArray(a);
array *c=new array(size);
for(size_t i=0; i < size; i++)
@@ -6901,12 +6948,12 @@ void gen457(stack *Stack)
{Stack->push<boolarray*>(c); return;}
}
-#line 4846 "runtime.in"
+#line 4845 "runtime.in"
// Int sum(boolarray *a);
-void gen458(stack *Stack)
+void gen_runtime462(stack *Stack)
{
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 4847 "runtime.in"
+#line 4846 "runtime.in"
size_t size=checkArray(a);
Int sum=0;
for(size_t i=0; i < size; i++)
@@ -6914,19 +6961,19 @@ void gen458(stack *Stack)
{Stack->push<Int>(sum); return;}
}
-#line 4855 "runtime.in"
+#line 4854 "runtime.in"
void arrayCopy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4856 "runtime.in"
+#line 4855 "runtime.in"
{Stack->push<array*>(copyArray(a)); return;}
}
-#line 4860 "runtime.in"
+#line 4859 "runtime.in"
void arrayConcat(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4861 "runtime.in"
+#line 4860 "runtime.in"
// a is an array of arrays to be concatenated together.
// The signature is
// T[] concat(... T[][] a);
@@ -6953,27 +7000,27 @@ void arrayConcat(stack *Stack)
{Stack->push<array*>(result); return;}
}
-#line 4888 "runtime.in"
+#line 4887 "runtime.in"
void array2Copy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4889 "runtime.in"
+#line 4888 "runtime.in"
{Stack->push<array*>(copyArray2(a)); return;}
}
-#line 4893 "runtime.in"
+#line 4892 "runtime.in"
void array3Copy(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4894 "runtime.in"
+#line 4893 "runtime.in"
{Stack->push<array*>(copyArray3(a)); return;}
}
-#line 4898 "runtime.in"
+#line 4897 "runtime.in"
void array2Transpose(stack *Stack)
{
array * a=vm::pop<array *>(Stack);
-#line 4899 "runtime.in"
+#line 4898 "runtime.in"
size_t asize=checkArray(a);
array *c=new array(0);
for(size_t i=0; i < asize; i++) {
@@ -7000,12 +7047,12 @@ void array2Transpose(stack *Stack)
// permutation (021 or 120, etc; original is 012).
// Transpose by sending respective members to the permutated locations:
// return the array obtained by putting a[i][j][k] into position perm{ijk}.
-#line 4926 "runtime.in"
+#line 4925 "runtime.in"
void array3Transpose(stack *Stack)
{
array * perm=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 4927 "runtime.in"
+#line 4926 "runtime.in"
const size_t DIM=3;
if(checkArray(perm) != DIM) {
@@ -7089,13 +7136,13 @@ void array3Transpose(stack *Stack)
// In a boolean array, find the index of the nth true value or -1 if not found
// If n is negative, search backwards.
-#line 5011 "runtime.in"
+#line 5010 "runtime.in"
// Int find(boolarray *a, Int n=1);
-void gen465(stack *Stack)
+void gen_runtime469(stack *Stack)
{
Int n=vm::pop<Int>(Stack,1);
boolarray * a=vm::pop<boolarray *>(Stack);
-#line 5012 "runtime.in"
+#line 5011 "runtime.in"
size_t size=checkArray(a);
Int j=-1;
if(n > 0)
@@ -7113,13 +7160,13 @@ void gen465(stack *Stack)
// construct vector obtained by replacing those elements of b for which the
// corresponding elements of a are false by the corresponding element of c.
-#line 5030 "runtime.in"
+#line 5029 "runtime.in"
void arrayConditional(stack *Stack)
{
array * c=vm::pop<array *>(Stack);
array * b=vm::pop<array *>(Stack);
array * a=vm::pop<array *>(Stack);
-#line 5031 "runtime.in"
+#line 5030 "runtime.in"
size_t size=checkArray(a);
array *r=new array(size);
if(b && c) {
@@ -7143,21 +7190,21 @@ void arrayConditional(stack *Stack)
}
// Return an n x n identity matrix.
-#line 5055 "runtime.in"
+#line 5054 "runtime.in"
// realarray2* identity(Int n);
-void gen467(stack *Stack)
+void gen_runtime471(stack *Stack)
{
Int n=vm::pop<Int>(Stack);
-#line 5056 "runtime.in"
+#line 5055 "runtime.in"
{Stack->push<realarray2*>(Identity(n)); return;}
}
// Return the diagonal matrix with diagonal entries given by a.
-#line 5061 "runtime.in"
+#line 5060 "runtime.in"
void diagonal(stack *Stack)
{
realarray * a=vm::pop<realarray *>(Stack);
-#line 5062 "runtime.in"
+#line 5061 "runtime.in"
size_t n=checkArray(a);
array *c=new array(n);
for(size_t i=0; i < n; ++i) {
@@ -7173,12 +7220,12 @@ void diagonal(stack *Stack)
}
// Return the inverse of an n x n matrix a using Gauss-Jordan elimination.
-#line 5078 "runtime.in"
+#line 5077 "runtime.in"
// realarray2* inverse(realarray2 *a);
-void gen469(stack *Stack)
+void gen_runtime473(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5079 "runtime.in"
+#line 5078 "runtime.in"
a=copyArray2(a);
size_t n=checkArray(a);
checkSquare(a);
@@ -7271,14 +7318,14 @@ void gen469(stack *Stack)
// Solve the linear equation ax=b by LU decomposition, returning the
// solution x, where a is an n x n matrix and b is an array of length n.
// If no solution exists, return an empty array.
-#line 5172 "runtime.in"
+#line 5171 "runtime.in"
// realarray* solve(realarray2 *a, realarray *b, bool warn=true);
-void gen470(stack *Stack)
+void gen_runtime474(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
realarray * b=vm::pop<realarray *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5173 "runtime.in"
+#line 5172 "runtime.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<realarray*>(new array(0)); return;}
@@ -7328,14 +7375,14 @@ void gen470(stack *Stack)
// Solve the linear equation ax=b by LU decomposition, returning the
// solution x, where a is an n x n matrix and b is an n x m matrix.
// If no solution exists, return an empty array.
-#line 5223 "runtime.in"
+#line 5222 "runtime.in"
// realarray2* solve(realarray2 *a, realarray2 *b, bool warn=true);
-void gen471(stack *Stack)
+void gen_runtime475(stack *Stack)
{
bool warn=vm::pop<bool>(Stack,true);
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5224 "runtime.in"
+#line 5223 "runtime.in"
size_t n=checkArray(a);
if(n == 0) {Stack->push<realarray2*>(new array(0)); return;}
@@ -7396,12 +7443,12 @@ void gen471(stack *Stack)
}
// Compute the determinant of an n x n matrix.
-#line 5285 "runtime.in"
+#line 5284 "runtime.in"
// real determinant(realarray2 *a);
-void gen472(stack *Stack)
+void gen_runtime476(stack *Stack)
{
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5286 "runtime.in"
+#line 5285 "runtime.in"
real *A=copyArray2C(a);
size_t n=checkArray(a);
@@ -7415,13 +7462,13 @@ void gen472(stack *Stack)
{Stack->push<real>(det); return;}
}
-#line 5300 "runtime.in"
+#line 5299 "runtime.in"
// realarray* *(realarray2 *a, realarray *b);
-void gen473(stack *Stack)
+void gen_runtime477(stack *Stack)
{
realarray * b=vm::pop<realarray *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5301 "runtime.in"
+#line 5300 "runtime.in"
size_t n=checkArray(a);
size_t m=checkArray(b);
array *c=new array(n);
@@ -7438,13 +7485,13 @@ void gen473(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 5318 "runtime.in"
+#line 5317 "runtime.in"
// realarray* *(realarray *a, realarray2 *b);
-void gen474(stack *Stack)
+void gen_runtime478(stack *Stack)
{
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 5319 "runtime.in"
+#line 5318 "runtime.in"
size_t n=checkArray(a);
if(n != checkArray(b)) error(incommensurate);
real *A=copyArrayC(a);
@@ -7471,13 +7518,13 @@ void gen474(stack *Stack)
{Stack->push<realarray*>(c); return;}
}
-#line 5346 "runtime.in"
+#line 5345 "runtime.in"
// realarray2* *(realarray2 *a, realarray2 *b);
-void gen475(stack *Stack)
+void gen_runtime479(stack *Stack)
{
realarray2 * b=vm::pop<realarray2 *>(Stack);
realarray2 * a=vm::pop<realarray2 *>(Stack);
-#line 5347 "runtime.in"
+#line 5346 "runtime.in"
size_t n=checkArray(a);
size_t nb=checkArray(b);
@@ -7511,23 +7558,23 @@ void gen475(stack *Stack)
{Stack->push<realarray2*>(c); return;}
}
-#line 5381 "runtime.in"
+#line 5380 "runtime.in"
// triple *(realarray2 *t, triple v);
-void gen476(stack *Stack)
+void gen_runtime480(stack *Stack)
{
triple v=vm::pop<triple>(Stack);
realarray2 * t=vm::pop<realarray2 *>(Stack);
-#line 5382 "runtime.in"
+#line 5381 "runtime.in"
{Stack->push<triple>(*t*v); return;}
}
-#line 5386 "runtime.in"
+#line 5385 "runtime.in"
// pair project(triple v, realarray2 *t);
-void gen477(stack *Stack)
+void gen_runtime481(stack *Stack)
{
realarray2 * t=vm::pop<realarray2 *>(Stack);
triple v=vm::pop<triple>(Stack);
-#line 5387 "runtime.in"
+#line 5386 "runtime.in"
size_t n=checkArray(t);
if(n != 4) error(incommensurate);
array *t0=read<array*>(t,0);
@@ -7552,13 +7599,13 @@ void gen477(stack *Stack)
}
// Compute the dot product of vectors a and b.
-#line 5412 "runtime.in"
+#line 5411 "runtime.in"
// real dot(realarray *a, realarray *b);
-void gen478(stack *Stack)
+void gen_runtime482(stack *Stack)
{
realarray * b=vm::pop<realarray *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 5413 "runtime.in"
+#line 5412 "runtime.in"
size_t n=checkArrays(a,b);
real sum=0.0;
for(size_t i=0; i < n; ++i)
@@ -7573,15 +7620,15 @@ void gen478(stack *Stack)
// [ a[2] b[2] c[2] ]
// [ ... ]
// [ c[n-1] a[n-1] b[n-1] ]
-#line 5428 "runtime.in"
+#line 5427 "runtime.in"
// realarray* tridiagonal(realarray *a, realarray *b, realarray *c, realarray *f);
-void gen479(stack *Stack)
+void gen_runtime483(stack *Stack)
{
realarray * f=vm::pop<realarray *>(Stack);
realarray * c=vm::pop<realarray *>(Stack);
realarray * b=vm::pop<realarray *>(Stack);
realarray * a=vm::pop<realarray *>(Stack);
-#line 5429 "runtime.in"
+#line 5428 "runtime.in"
size_t n=checkArrays(a,b);
checkEqual(n,checkArray(c));
checkEqual(n,checkArray(f));
@@ -7678,16 +7725,16 @@ void gen479(stack *Stack)
}
// Root solve by Newton-Raphson
-#line 5526 "runtime.in"
+#line 5525 "runtime.in"
// real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x, bool verbose=false);
-void gen480(stack *Stack)
+void gen_runtime484(stack *Stack)
{
bool verbose=vm::pop<bool>(Stack,false);
real x=vm::pop<real>(Stack);
callableReal * fprime=vm::pop<callableReal *>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
Int iterations=vm::pop<Int>(Stack,100);
-#line 5528 "runtime.in"
+#line 5527 "runtime.in"
static const real fuzz=1000.0*DBL_EPSILON;
Int i=0;
size_t oldPrec=0;
@@ -7733,9 +7780,9 @@ void gen480(stack *Stack)
// Root solve by Newton-Raphson bisection
// cf. routine rtsafe (Press et al., Numerical Recipes, 1991).
-#line 5574 "runtime.in"
+#line 5573 "runtime.in"
// real newton(Int iterations=100, callableReal *f, callableReal *fprime, real x1, real x2, bool verbose=false);
-void gen481(stack *Stack)
+void gen_runtime485(stack *Stack)
{
bool verbose=vm::pop<bool>(Stack,false);
real x2=vm::pop<real>(Stack);
@@ -7743,7 +7790,7 @@ void gen481(stack *Stack)
callableReal * fprime=vm::pop<callableReal *>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
Int iterations=vm::pop<Int>(Stack,100);
-#line 5576 "runtime.in"
+#line 5575 "runtime.in"
static const real fuzz=1000.0*DBL_EPSILON;
size_t oldPrec=0;
if(verbose)
@@ -7821,16 +7868,16 @@ void gen481(stack *Stack)
{Stack->push<real>((j == iterations) ? DBL_MAX : x); return;}
}
-#line 5654 "runtime.in"
+#line 5653 "runtime.in"
// real simpson(callableReal *f, real a, real b, real acc=DBL_EPSILON, real dxmax=0);
-void gen482(stack *Stack)
+void gen_runtime486(stack *Stack)
{
real dxmax=vm::pop<real>(Stack,0);
real acc=vm::pop<real>(Stack,DBL_EPSILON);
real b=vm::pop<real>(Stack);
real a=vm::pop<real>(Stack);
callableReal * f=vm::pop<callableReal *>(Stack);
-#line 5656 "runtime.in"
+#line 5655 "runtime.in"
real integral;
if(dxmax == 0) dxmax=b-a;
Func=f;
@@ -7841,12 +7888,12 @@ void gen482(stack *Stack)
}
// Compute the fast Fourier transform of a pair array
-#line 5667 "runtime.in"
+#line 5666 "runtime.in"
void pairArrayFFT(stack *Stack)
{
Int sign=vm::pop<Int>(Stack,1);
pairarray * a=vm::pop<pairarray *>(Stack);
-#line 5668 "runtime.in"
+#line 5667 "runtime.in"
unsigned n=(unsigned) checkArray(a);
#ifdef HAVE_LIBFFTW3
array *c=new array(n);
@@ -7874,12 +7921,12 @@ void pairArrayFFT(stack *Stack)
{Stack->push<pairarray*>(c); return;}
}
-#line 5696 "runtime.in"
+#line 5695 "runtime.in"
// Intarray2* triangulate(pairarray *z);
-void gen484(stack *Stack)
+void gen_runtime488(stack *Stack)
{
pairarray * z=vm::pop<pairarray *>(Stack);
-#line 5697 "runtime.in"
+#line 5696 "runtime.in"
size_t nv=checkArray(z);
// Call robust version of Gilles Dumoulin's port of Paul Bourke's
// triangulation code.
@@ -7915,55 +7962,55 @@ void gen484(stack *Stack)
// File operations
-#line 5733 "runtime.in"
+#line 5732 "runtime.in"
// bool ==(file *a, file *b);
-void gen485(stack *Stack)
+void gen_runtime489(stack *Stack)
{
file * b=vm::pop<file *>(Stack);
file * a=vm::pop<file *>(Stack);
-#line 5734 "runtime.in"
+#line 5733 "runtime.in"
{Stack->push<bool>(a == b); return;}
}
-#line 5739 "runtime.in"
+#line 5738 "runtime.in"
// bool !=(file *a, file *b);
-void gen486(stack *Stack)
+void gen_runtime490(stack *Stack)
{
file * b=vm::pop<file *>(Stack);
file * a=vm::pop<file *>(Stack);
-#line 5740 "runtime.in"
+#line 5739 "runtime.in"
{Stack->push<bool>(a != b); return;}
}
-#line 5744 "runtime.in"
+#line 5743 "runtime.in"
void nullFile(stack *Stack)
{
-#line 5745 "runtime.in"
+#line 5744 "runtime.in"
{Stack->push<file*>(&camp::nullfile); return;}
}
-#line 5749 "runtime.in"
+#line 5748 "runtime.in"
// file* input(string name, bool check=true, string comment=commentchar);
-void gen488(stack *Stack)
+void gen_runtime492(stack *Stack)
{
string comment=vm::pop<string>(Stack,commentchar);
bool check=vm::pop<bool>(Stack,true);
string name=vm::pop<string>(Stack);
-#line 5750 "runtime.in"
+#line 5749 "runtime.in"
char c=comment.empty() ? (char) 0 : comment[0];
file *f=new ifile(name,c,check);
f->open();
{Stack->push<file*>(f); return;}
}
-#line 5757 "runtime.in"
+#line 5756 "runtime.in"
// file* output(string name, bool update=false, string comment=commentchar);
-void gen489(stack *Stack)
+void gen_runtime493(stack *Stack)
{
string comment=vm::pop<string>(Stack,commentchar);
bool update=vm::pop<bool>(Stack,false);
string name=vm::pop<string>(Stack);
-#line 5758 "runtime.in"
+#line 5757 "runtime.in"
file *f;
if(update) {
char c=comment.empty() ? (char) 0 : comment[0];
@@ -7974,13 +8021,13 @@ void gen489(stack *Stack)
{Stack->push<file*>(f); return;}
}
-#line 5769 "runtime.in"
+#line 5768 "runtime.in"
// file* xinput(string name, bool check=true);
-void gen490(stack *Stack)
+void gen_runtime494(stack *Stack)
{
bool check=vm::pop<bool>(Stack,true);
string name=vm::pop<string>(Stack);
-#line 5770 "runtime.in"
+#line 5769 "runtime.in"
#ifdef HAVE_RPC_RPC_H
file *f=new ixfile(name,check);
f->open();
@@ -7993,13 +8040,13 @@ void gen490(stack *Stack)
#endif
}
-#line 5783 "runtime.in"
+#line 5782 "runtime.in"
// file* xoutput(string name, bool update=false);
-void gen491(stack *Stack)
+void gen_runtime495(stack *Stack)
{
bool update=vm::pop<bool>(Stack,false);
string name=vm::pop<string>(Stack);
-#line 5784 "runtime.in"
+#line 5783 "runtime.in"
#ifdef HAVE_RPC_RPC_H
file *f;
if(update)
@@ -8016,25 +8063,25 @@ void gen491(stack *Stack)
#endif
}
-#line 5801 "runtime.in"
+#line 5800 "runtime.in"
// file* binput(string name, bool check=true);
-void gen492(stack *Stack)
+void gen_runtime496(stack *Stack)
{
bool check=vm::pop<bool>(Stack,true);
string name=vm::pop<string>(Stack);
-#line 5802 "runtime.in"
+#line 5801 "runtime.in"
file *f=new ibfile(name,check);
f->open();
{Stack->push<file*>(f); return;}
}
-#line 5808 "runtime.in"
+#line 5807 "runtime.in"
// file* boutput(string name, bool update=false);
-void gen493(stack *Stack)
+void gen_runtime497(stack *Stack)
{
bool update=vm::pop<bool>(Stack,false);
string name=vm::pop<string>(Stack);
-#line 5809 "runtime.in"
+#line 5808 "runtime.in"
file *f;
if(update) f=new iobfile(name);
else f=new obfile(name);
@@ -8043,77 +8090,77 @@ void gen493(stack *Stack)
{Stack->push<file*>(f); return;}
}
-#line 5818 "runtime.in"
+#line 5817 "runtime.in"
// bool eof(file *f);
-void gen494(stack *Stack)
+void gen_runtime498(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5819 "runtime.in"
+#line 5818 "runtime.in"
{Stack->push<bool>(f->eof()); return;}
}
-#line 5823 "runtime.in"
+#line 5822 "runtime.in"
// bool eol(file *f);
-void gen495(stack *Stack)
+void gen_runtime499(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5824 "runtime.in"
+#line 5823 "runtime.in"
{Stack->push<bool>(f->eol()); return;}
}
-#line 5828 "runtime.in"
+#line 5827 "runtime.in"
// bool error(file *f);
-void gen496(stack *Stack)
+void gen_runtime500(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5829 "runtime.in"
+#line 5828 "runtime.in"
{Stack->push<bool>(f->error()); return;}
}
-#line 5833 "runtime.in"
+#line 5832 "runtime.in"
// void clear(file *f);
-void gen497(stack *Stack)
+void gen_runtime501(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5834 "runtime.in"
+#line 5833 "runtime.in"
f->clear();
}
-#line 5838 "runtime.in"
+#line 5837 "runtime.in"
// void close(file *f);
-void gen498(stack *Stack)
+void gen_runtime502(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5839 "runtime.in"
+#line 5838 "runtime.in"
f->close();
}
-#line 5843 "runtime.in"
+#line 5842 "runtime.in"
// Int precision(file *f=NULL, Int digits=0);
-void gen499(stack *Stack)
+void gen_runtime503(stack *Stack)
{
Int digits=vm::pop<Int>(Stack,0);
file * f=vm::pop<file *>(Stack,NULL);
-#line 5844 "runtime.in"
+#line 5843 "runtime.in"
if(f == 0) f=&camp::Stdout;
{Stack->push<Int>(f->precision(digits)); return;}
}
-#line 5849 "runtime.in"
+#line 5848 "runtime.in"
// void flush(file *f);
-void gen500(stack *Stack)
+void gen_runtime504(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5850 "runtime.in"
+#line 5849 "runtime.in"
f->flush();
}
-#line 5854 "runtime.in"
+#line 5853 "runtime.in"
// string getc(file *f);
-void gen501(stack *Stack)
+void gen_runtime505(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5855 "runtime.in"
+#line 5854 "runtime.in"
char c=0;
if(f->isOpen()) f->read(c);
static char str[1];
@@ -8121,236 +8168,288 @@ void gen501(stack *Stack)
{Stack->push<string>(string(str)); return;}
}
-#line 5863 "runtime.in"
+#line 5862 "runtime.in"
// Int tell(file *f);
-void gen502(stack *Stack)
+void gen_runtime506(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5864 "runtime.in"
+#line 5863 "runtime.in"
{Stack->push<Int>(f->tell()); return;}
}
-#line 5868 "runtime.in"
+#line 5867 "runtime.in"
// void seek(file *f, Int pos);
-void gen503(stack *Stack)
+void gen_runtime507(stack *Stack)
{
Int pos=vm::pop<Int>(Stack);
file * f=vm::pop<file *>(Stack);
-#line 5869 "runtime.in"
+#line 5868 "runtime.in"
f->seek(pos,pos >= 0);
}
-#line 5873 "runtime.in"
+#line 5872 "runtime.in"
// void seekeof(file *f);
-void gen504(stack *Stack)
+void gen_runtime508(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5874 "runtime.in"
+#line 5873 "runtime.in"
f->seek(0,false);
}
-// Set file dimensions
-#line 5879 "runtime.in"
-// file* dimension(file *f, Int nx);
-void gen505(stack *Stack)
+#line 5877 "runtime.in"
+void namePart(stack *Stack)
{
- Int nx=vm::pop<Int>(Stack);
- file * f=vm::pop<file *>(Stack);
-#line 5880 "runtime.in"
- f->dimension(nx);
- {Stack->push<file*>(f); return;}
+ file f=vm::pop<file>(Stack);
+#line 5878 "runtime.in"
+ {Stack->push<string>(f.filename()); return;}
}
-#line 5885 "runtime.in"
-// file* dimension(file *f, Int nx, Int ny);
-void gen506(stack *Stack)
+#line 5882 "runtime.in"
+void modePart(stack *Stack)
{
- Int ny=vm::pop<Int>(Stack);
- Int nx=vm::pop<Int>(Stack);
- file * f=vm::pop<file *>(Stack);
-#line 5886 "runtime.in"
- f->dimension(nx,ny);
- {Stack->push<file*>(f); return;}
+ file f=vm::pop<file>(Stack);
+#line 5883 "runtime.in"
+ {Stack->push<string>(f.FileMode()); return;}
}
-#line 5891 "runtime.in"
-// file* dimension(file *f, Int nx, Int ny, Int nz);
-void gen507(stack *Stack)
+// Set file dimensions
+#line 5888 "runtime.in"
+void dimensionSetHelper(stack *Stack)
{
- Int nz=vm::pop<Int>(Stack);
- Int ny=vm::pop<Int>(Stack);
- Int nx=vm::pop<Int>(Stack);
file * f=vm::pop<file *>(Stack);
-#line 5892 "runtime.in"
+ Int nz=vm::pop<Int>(Stack,-1);
+ Int ny=vm::pop<Int>(Stack,-1);
+ Int nx=vm::pop<Int>(Stack,-1);
+#line 5889 "runtime.in"
f->dimension(nx,ny,nz);
{Stack->push<file*>(f); return;}
}
-// Set file to read comma-separated values
-#line 5898 "runtime.in"
-// file* csv(file *f, bool b=true);
-void gen508(stack *Stack)
+#line 5894 "runtime.in"
+void dimensionSet(stack *Stack)
{
- bool b=vm::pop<bool>(Stack,true);
file * f=vm::pop<file *>(Stack);
-#line 5899 "runtime.in"
- f->CSVMode(b);
- {Stack->push<file*>(f); return;}
+#line 5895 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(dimensionSetHelper),f)); return;}
}
-// Set file to read whitespace-separated values
-#line 5905 "runtime.in"
-// file* word(file *f, bool b=true);
-void gen509(stack *Stack)
+#line 5899 "runtime.in"
+void dimensionPart(stack *Stack)
{
- bool b=vm::pop<bool>(Stack,true);
- file * f=vm::pop<file *>(Stack);
-#line 5906 "runtime.in"
- f->WordMode(b);
- {Stack->push<file*>(f); return;}
+ file f=vm::pop<file>(Stack);
+#line 5900 "runtime.in"
+ array *a=new array(3);
+ (*a)[0]=f.Nx();
+ (*a)[1]=f.Ny();
+ (*a)[2]=f.Nz();
+ {Stack->push<array*>(a); return;}
}
-// Set file to read arrays in line-at-a-time mode
-#line 5912 "runtime.in"
-// file* line(file *f, bool b=true);
-void gen510(stack *Stack)
+// Set file f to read arrays in line-at-a-time mode
+#line 5909 "runtime.in"
+void lineSetHelper(stack *Stack)
{
- bool b=vm::pop<bool>(Stack,true);
file * f=vm::pop<file *>(Stack);
-#line 5913 "runtime.in"
+ bool b=vm::pop<bool>(Stack,true);
+#line 5910 "runtime.in"
f->LineMode(b);
{Stack->push<file*>(f); return;}
}
-// Set file to read/write signed int XDR values.
-#line 5919 "runtime.in"
-// file* signed(file *f, bool b=true);
-void gen511(stack *Stack)
+#line 5915 "runtime.in"
+void lineSet(stack *Stack)
{
- bool b=vm::pop<bool>(Stack,true);
file * f=vm::pop<file *>(Stack);
-#line 5920 "runtime.in"
- f->SignedInt(b);
- {Stack->push<file*>(f); return;}
+#line 5916 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(lineSetHelper),f)); return;}
}
-#line 5925 "runtime.in"
-void namePart(stack *Stack)
+#line 5920 "runtime.in"
+void linePart(stack *Stack)
{
file f=vm::pop<file>(Stack);
+#line 5921 "runtime.in"
+ {Stack->push<bool>(f.LineMode()); return;}
+}
+
+// Set file to read comma-separated values
#line 5926 "runtime.in"
- {Stack->push<string>(f.filename()); return;}
+void csvSetHelper(stack *Stack)
+{
+ file * f=vm::pop<file *>(Stack);
+ bool b=vm::pop<bool>(Stack,true);
+#line 5927 "runtime.in"
+ f->CSVMode(b);
+ {Stack->push<file*>(f); return;}
}
-#line 5930 "runtime.in"
-void modePart(stack *Stack)
+#line 5932 "runtime.in"
+void csvSet(stack *Stack)
{
- file f=vm::pop<file>(Stack);
-#line 5931 "runtime.in"
- {Stack->push<string>(f.FileMode()); return;}
+ file * f=vm::pop<file *>(Stack);
+#line 5933 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(csvSetHelper),f)); return;}
}
-#line 5935 "runtime.in"
-void dimensionPart(stack *Stack)
+#line 5937 "runtime.in"
+void csvPart(stack *Stack)
{
file f=vm::pop<file>(Stack);
-#line 5936 "runtime.in"
- array *a=new array(3);
- (*a)[0]=f.Nx();
- (*a)[1]=f.Ny();
- (*a)[2]=f.Nz();
- {Stack->push<array*>(a); return;}
+#line 5938 "runtime.in"
+ {Stack->push<bool>(f.CSVMode()); return;}
}
-#line 5944 "runtime.in"
-void lineModePart(stack *Stack)
+// Set file to read whitespace-separated values
+#line 5943 "runtime.in"
+void wordSetHelper(stack *Stack)
{
- file f=vm::pop<file>(Stack);
-#line 5945 "runtime.in"
- {Stack->push<bool>(f.LineMode()); return;}
+ file * f=vm::pop<file *>(Stack);
+ bool b=vm::pop<bool>(Stack,true);
+#line 5944 "runtime.in"
+ f->WordMode(b);
+ {Stack->push<file*>(f); return;}
}
#line 5949 "runtime.in"
-void csvModePart(stack *Stack)
+void wordSet(stack *Stack)
{
- file f=vm::pop<file>(Stack);
+ file * f=vm::pop<file *>(Stack);
#line 5950 "runtime.in"
- {Stack->push<bool>(f.CSVMode()); return;}
+ {Stack->push<callable*>(new thunk(new bfunc(wordSetHelper),f)); return;}
}
#line 5954 "runtime.in"
-void wordModePart(stack *Stack)
+void wordPart(stack *Stack)
{
file f=vm::pop<file>(Stack);
#line 5955 "runtime.in"
{Stack->push<bool>(f.WordMode()); return;}
}
-#line 5959 "runtime.in"
-void singleRealModePart(stack *Stack)
+// Set file to read/write single precision real XDR values.
+#line 5960 "runtime.in"
+void singlerealSetHelper(stack *Stack)
+{
+ file * f=vm::pop<file *>(Stack);
+ bool b=vm::pop<bool>(Stack,true);
+#line 5961 "runtime.in"
+ f->SingleReal(b);
+ {Stack->push<file*>(f); return;}
+}
+
+#line 5966 "runtime.in"
+void singlerealSet(stack *Stack)
+{
+ file * f=vm::pop<file *>(Stack);
+#line 5967 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(singlerealSetHelper),f)); return;}
+}
+
+#line 5971 "runtime.in"
+void singlerealPart(stack *Stack)
{
file f=vm::pop<file>(Stack);
-#line 5960 "runtime.in"
+#line 5972 "runtime.in"
{Stack->push<bool>(f.SingleReal()); return;}
}
-#line 5964 "runtime.in"
-void singleIntModePart(stack *Stack)
+// Set file to read/write single precision int XDR values.
+#line 5977 "runtime.in"
+void singleintSetHelper(stack *Stack)
{
- file f=vm::pop<file>(Stack);
-#line 5965 "runtime.in"
- {Stack->push<bool>(f.SingleInt()); return;}
+ file * f=vm::pop<file *>(Stack);
+ bool b=vm::pop<bool>(Stack,true);
+#line 5978 "runtime.in"
+ f->SingleInt(b);
+ {Stack->push<file*>(f); return;}
+}
+
+#line 5983 "runtime.in"
+void singleintSet(stack *Stack)
+{
+ file * f=vm::pop<file *>(Stack);
+#line 5984 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(singleintSetHelper),f)); return;}
}
-#line 5969 "runtime.in"
-void signedIntModePart(stack *Stack)
+#line 5988 "runtime.in"
+void singleintPart(stack *Stack)
{
file f=vm::pop<file>(Stack);
-#line 5970 "runtime.in"
- {Stack->push<bool>(f.SignedInt()); return;}
+#line 5989 "runtime.in"
+ {Stack->push<bool>(f.SingleInt()); return;}
}
-// Set file to read an array1 (1 int size followed by a 1d array)
-#line 5975 "runtime.in"
-// file* read1(file *f);
-void gen521(stack *Stack)
+// Set file to read/write signed int XDR values.
+#line 5994 "runtime.in"
+void signedintSetHelper(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5976 "runtime.in"
- f->dimension(-2);
+ bool b=vm::pop<bool>(Stack,true);
+#line 5995 "runtime.in"
+ f->SignedInt(b);
{Stack->push<file*>(f); return;}
}
-// Set file to read an array2 (2 int sizes followed by a 2d array)
-#line 5982 "runtime.in"
-// file* read2(file *f);
-void gen522(stack *Stack)
+#line 6000 "runtime.in"
+void signedintSet(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5983 "runtime.in"
- f->dimension(-2,-2);
- {Stack->push<file*>(f); return;}
+#line 6001 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(signedintSetHelper),f)); return;}
}
-// Set file to read an array3 (3 int sizes followed by a 3d array)
-#line 5989 "runtime.in"
-// file* read3(file *f);
-void gen523(stack *Stack)
+#line 6005 "runtime.in"
+void signedintPart(stack *Stack)
+{
+ file f=vm::pop<file>(Stack);
+#line 6006 "runtime.in"
+ {Stack->push<bool>(f.SignedInt()); return;}
+}
+
+// Set file to read an arrayi (i int sizes followed by an i-dimensional array)
+#line 6011 "runtime.in"
+void readSetHelper(stack *Stack)
{
file * f=vm::pop<file *>(Stack);
-#line 5990 "runtime.in"
- f->dimension(-2,-2,-2);
+ Int i=vm::pop<Int>(Stack);
+#line 6012 "runtime.in"
+ switch(i) {
+ case 1:
+ f->dimension(-2);
+ break;
+
+ case 2:
+ f->dimension(-2,-2);
+ break;
+
+ case 3:
+ f->dimension(-2,-2,-2);
+ break;
+
+ default:
+ f->dimension();
+ }
+
{Stack->push<file*>(f); return;}
}
+#line 6033 "runtime.in"
+void readSet(stack *Stack)
+{
+ file * f=vm::pop<file *>(Stack);
+#line 6034 "runtime.in"
+ {Stack->push<callable*>(new thunk(new bfunc(readSetHelper),f)); return;}
+}
+
// Return the last n lines of the history named name.
-#line 5996 "runtime.in"
+#line 6039 "runtime.in"
// stringarray* history(string name, Int n=1);
-void gen524(stack *Stack)
+void gen_runtime534(stack *Stack)
{
Int n=vm::pop<Int>(Stack,1);
string name=vm::pop<string>(Stack);
-#line 5997 "runtime.in"
+#line 6040 "runtime.in"
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
bool newhistory=historyMap.find(name) == historyMap.end();
@@ -8382,12 +8481,12 @@ void gen524(stack *Stack)
}
// Return the last n lines of the interactive history.
-#line 6029 "runtime.in"
+#line 6072 "runtime.in"
// stringarray* history(Int n=0);
-void gen525(stack *Stack)
+void gen_runtime535(stack *Stack)
{
Int n=vm::pop<Int>(Stack,0);
-#line 6030 "runtime.in"
+#line 6073 "runtime.in"
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
{Stack->push<stringarray*>(get_history(n)); return;}
#else
@@ -8398,15 +8497,15 @@ void gen525(stack *Stack)
// Prompt for a string using prompt, the GNU readline library, and a
// local history named name.
-#line 6041 "runtime.in"
+#line 6084 "runtime.in"
// string readline(string prompt=emptystring, string name=emptystring, bool tabcompletion=false);
-void gen526(stack *Stack)
+void gen_runtime536(stack *Stack)
{
bool tabcompletion=vm::pop<bool>(Stack,false);
string name=vm::pop<string>(Stack,emptystring);
string prompt=vm::pop<string>(Stack,emptystring);
-#line 6043 "runtime.in"
- if(!isatty(STDIN_FILENO))
+#line 6086 "runtime.in"
+ if(!(isatty(STDIN_FILENO) || getSetting<bool>("interactive")))
{Stack->push<string>(emptystring); return;}
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
init_readline(tabcompletion);
@@ -8447,14 +8546,14 @@ void gen526(stack *Stack)
// Save a string in a local history named name.
// If store=true, store the local history in the file historyfilename(name).
-#line 6085 "runtime.in"
+#line 6128 "runtime.in"
// void saveline(string name, string value, bool store=true);
-void gen527(stack *Stack)
+void gen_runtime537(stack *Stack)
{
bool store=vm::pop<bool>(Stack,true);
string value=vm::pop<string>(Stack);
string name=vm::pop<string>(Stack);
-#line 6086 "runtime.in"
+#line 6129 "runtime.in"
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
store_history(&history_save);
bool newhistory=historyMap.find(name) == historyMap.end();
@@ -8481,912 +8580,1088 @@ void gen527(stack *Stack)
#endif
}
-#line 6113 "runtime.in"
-// void generate_random_backtrace();
-void gen528(stack *)
-{
-#line 6114 "runtime.in"
-#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
- GC_generate_random_backtrace();
-#else
- error("generate_random_backtrace() requires ./configure --enable-gc-debug");
-#endif
-}
-
-#line 6122 "runtime.in"
-// void print_random_addresses(Int n=1);
-void gen529(stack *Stack)
-{
- Int n=vm::pop<Int>(Stack,1);
-#line 6123 "runtime.in"
-#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
- GC_gcollect();
- for (Int i=0; i < n; ++i)
- GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address()));
-#else
- error("print_random_addresses() requires ./configure --enable-gc-debug");
- unused(&n); // Avoid unused variable warning message.
-#endif
-}
-
} // namespace run
namespace trans {
-void gen_base_venv(venv &ve)
-{
-#line 1179 "runtime.in"
- addFunc(ve, run::gen8, primBoolean(), "!", formal(primBoolean(), "b", false, false));
-#line 1207 "runtime.in"
- addFunc(ve, run::gen13, primInt(), "AND", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
-#line 1215 "runtime.in"
- addFunc(ve, run::gen14, primInt(), "OR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
-#line 1220 "runtime.in"
- addFunc(ve, run::gen15, primInt(), "XOR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
-#line 1225 "runtime.in"
- addFunc(ve, run::gen16, primInt(), "NOT", formal(primInt(), "a", false, false));
-#line 1256 "runtime.in"
- addFunc(ve, run::gen21, primBoolean(), "empty", formal(primPicture(), "f", false, false));
-#line 1261 "runtime.in"
- addFunc(ve, run::gen22, primVoid(), "erase", formal(primPicture(), "f", false, false));
-#line 1266 "runtime.in"
- addFunc(ve, run::gen23, primPair(), "min", formal(primPicture(), "f", false, false));
-#line 1271 "runtime.in"
- addFunc(ve, run::gen24, primPair(), "max", formal(primPicture(), "f", false, false));
-#line 1276 "runtime.in"
- addFunc(ve, run::gen25, primVoid(), "label", formal(primPicture(), "f", false, false), formal(primString(), "s", false, false), formal(primString(), "size", false, false), formal(primTransform(), "t", false, false), formal(primPair(), "position", false, false), formal(primPair(), "align", false, false), formal(primPen(), "p", false, false));
-#line 1282 "runtime.in"
- addFunc(ve, run::gen26, primBoolean(), "labels", formal(primPicture(), "f", false, false));
-#line 1287 "runtime.in"
- addFunc(ve, run::gen27, realArray(), "texsize", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
-#line 1307 "runtime.in"
- addFunc(ve, run::gen28, pathArray() , "_texpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
-#line 1405 "runtime.in"
- addFunc(ve, run::gen29, pathArray() , "textpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
-#line 1476 "runtime.in"
- addFunc(ve, run::gen30, pathArray() , "_strokepath", formal(primPath(), "g", false, false), formal(primPen(), "p", true, false));
+void gen_runtime_venv(venv &ve)
+{
+#line 1097 "runtime.in"
+ REGISTER_BLTIN(run::IntZero,"IntZero");
+#line 1105 "runtime.in"
+ REGISTER_BLTIN(run::realZero,"realZero");
+#line 1110 "runtime.in"
+ REGISTER_BLTIN(run::boolFalse,"boolFalse");
+#line 1115 "runtime.in"
+ REGISTER_BLTIN(run::pushNullArray,"pushNullArray");
+#line 1120 "runtime.in"
+ REGISTER_BLTIN(run::pushNullRecord,"pushNullRecord");
+#line 1125 "runtime.in"
+ REGISTER_BLTIN(run::pushNullFunction,"pushNullFunction");
+#line 1130 "runtime.in"
+ REGISTER_BLTIN(run::pushDefault,"pushDefault");
+#line 1140 "runtime.in"
+ REGISTER_BLTIN(run::isDefault,"isDefault");
+#line 1147 "runtime.in"
+ addFunc(ve, run::gen_runtime8, primBoolean(), "!", formal(primBoolean(), "b", false, false));
+#line 1155 "runtime.in"
+ REGISTER_BLTIN(run::boolMemEq,"boolMemEq");
+#line 1160 "runtime.in"
+ REGISTER_BLTIN(run::boolMemNeq,"boolMemNeq");
+#line 1165 "runtime.in"
+ REGISTER_BLTIN(run::boolFuncEq,"boolFuncEq");
+#line 1170 "runtime.in"
+ REGISTER_BLTIN(run::boolFuncNeq,"boolFuncNeq");
+#line 1175 "runtime.in"
+ addFunc(ve, run::gen_runtime13, primInt(), "AND", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+#line 1183 "runtime.in"
+ addFunc(ve, run::gen_runtime14, primInt(), "OR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+#line 1188 "runtime.in"
+ addFunc(ve, run::gen_runtime15, primInt(), "XOR", formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+#line 1193 "runtime.in"
+ addFunc(ve, run::gen_runtime16, primInt(), "NOT", formal(primInt(), "a", false, false));
+#line 1198 "runtime.in"
+ REGISTER_BLTIN(run::pairToGuide,"pairToGuide");
+#line 1206 "runtime.in"
+ REGISTER_BLTIN(run::pathToGuide,"pathToGuide");
+#line 1211 "runtime.in"
+ REGISTER_BLTIN(run::guideToPath,"guideToPath");
+#line 1216 "runtime.in"
+ REGISTER_BLTIN(run::newPicture,"newPicture");
+#line 1224 "runtime.in"
+ addFunc(ve, run::gen_runtime21, primBoolean(), "empty", formal(primPicture(), "f", false, false));
+#line 1229 "runtime.in"
+ addFunc(ve, run::gen_runtime22, primVoid(), "erase", formal(primPicture(), "f", false, false));
+#line 1234 "runtime.in"
+ addFunc(ve, run::gen_runtime23, primPair(), "min", formal(primPicture(), "f", false, false));
+#line 1239 "runtime.in"
+ addFunc(ve, run::gen_runtime24, primPair(), "max", formal(primPicture(), "f", false, false));
+#line 1244 "runtime.in"
+ addFunc(ve, run::gen_runtime25, primVoid(), "label", formal(primPicture(), "f", false, false), formal(primString(), "s", false, false), formal(primString(), "size", false, false), formal(primTransform(), "t", false, false), formal(primPair(), "position", false, false), formal(primPair(), "align", false, false), formal(primPen(), "p", false, false));
+#line 1250 "runtime.in"
+ addFunc(ve, run::gen_runtime26, primBoolean(), "labels", formal(primPicture(), "f", false, false));
+#line 1255 "runtime.in"
+ addFunc(ve, run::gen_runtime27, realArray(), "texsize", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
+#line 1275 "runtime.in"
+ addFunc(ve, run::gen_runtime28, pathArray() , "_texpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
+#line 1373 "runtime.in"
+ addFunc(ve, run::gen_runtime29, pathArray() , "textpath", formal(primString(), "s", false, false), formal(primPen(), "p", true, false));
+#line 1444 "runtime.in"
+ addFunc(ve, run::gen_runtime30, pathArray() , "_strokepath", formal(primPath(), "g", false, false), formal(primPen(), "p", true, false));
+#line 1469 "runtime.in"
+ addFunc(ve, run::gen_runtime31, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath(), "g", false, false), formal(primPen(), "p", false, false));
+#line 1474 "runtime.in"
+ addFunc(ve, run::gen_runtime32, primVoid(), "fill", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primPen(), "p", true, false), formal(primBoolean(), "copy", true, false));
+#line 1480 "runtime.in"
+ addFunc(ve, run::gen_runtime33, primVoid(), "latticeshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(primBoolean(), "copy", true, false));
+#line 1487 "runtime.in"
+ addFunc(ve, run::gen_runtime34, primVoid(), "axialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primBoolean(), "copy", true, false));
+#line 1494 "runtime.in"
+ addFunc(ve, run::gen_runtime35, primVoid(), "radialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primReal(), "ra", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primReal(), "rb", false, false), formal(primBoolean(), "copy", true, false));
#line 1501 "runtime.in"
- addFunc(ve, run::gen31, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath(), "g", false, false), formal(primPen(), "p", false, false));
-#line 1506 "runtime.in"
- addFunc(ve, run::gen32, primVoid(), "fill", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primPen(), "p", true, false), formal(primBoolean(), "copy", true, false));
+ addFunc(ve, run::gen_runtime36, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(pairArray(), "z", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false));
#line 1512 "runtime.in"
- addFunc(ve, run::gen33, primVoid(), "latticeshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(primBoolean(), "copy", true, false));
-#line 1519 "runtime.in"
- addFunc(ve, run::gen34, primVoid(), "axialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primBoolean(), "copy", true, false));
-#line 1526 "runtime.in"
- addFunc(ve, run::gen35, primVoid(), "radialshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "pena", false, false), formal(primPair(), "a", false, false), formal(primReal(), "ra", false, false), formal(primPen(), "penb", false, false), formal(primPair(), "b", false, false), formal(primReal(), "rb", false, false), formal(primBoolean(), "copy", true, false));
-#line 1533 "runtime.in"
- addFunc(ve, run::gen36, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(pairArray(), "z", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false));
-#line 1544 "runtime.in"
- addFunc(ve, run::gen37, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false));
-#line 1568 "runtime.in"
- addFunc(ve, run::gen38, primVoid(), "tensorshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(pathArray() , "b", true, false), formal(pairArray2(), "z", true, false), formal(primBoolean(), "copy", true, false));
-#line 1583 "runtime.in"
- addFunc(ve, run::gen39, primVoid(), "functionshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primString() , "shader", true, false), formal(primBoolean(), "copy", true, false));
+ addFunc(ve, run::gen_runtime37, primVoid(), "gouraudshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray() , "p", false, false), formal(IntArray(), "edges", false, false), formal(primBoolean(), "copy", true, false));
+#line 1536 "runtime.in"
+ addFunc(ve, run::gen_runtime38, primVoid(), "tensorshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(penArray2() , "p", false, false), formal(pathArray() , "b", true, false), formal(pairArray2(), "z", true, false), formal(primBoolean(), "copy", true, false));
+#line 1551 "runtime.in"
+ addFunc(ve, run::gen_runtime39, primVoid(), "functionshade", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primString() , "shader", true, false), formal(primBoolean(), "copy", true, false));
+#line 1559 "runtime.in"
+ addFunc(ve, run::gen_runtime40, primVoid(), "clip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false));
+#line 1569 "runtime.in"
+ addFunc(ve, run::gen_runtime41, primVoid(), "beginclip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false));
+#line 1576 "runtime.in"
+ addFunc(ve, run::gen_runtime42, primVoid(), "endclip", formal(primPicture(), "f", false, false));
+#line 1581 "runtime.in"
+ addFunc(ve, run::gen_runtime43, primVoid(), "gsave", formal(primPicture(), "f", false, false));
+#line 1586 "runtime.in"
+ addFunc(ve, run::gen_runtime44, primVoid(), "grestore", formal(primPicture(), "f", false, false));
#line 1591 "runtime.in"
- addFunc(ve, run::gen40, primVoid(), "clip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false));
+ addFunc(ve, run::gen_runtime45, primVoid(), "begingroup", formal(primPicture(), "f", false, false));
+#line 1596 "runtime.in"
+ addFunc(ve, run::gen_runtime46, primVoid(), "endgroup", formal(primPicture(), "f", false, false));
#line 1601 "runtime.in"
- addFunc(ve, run::gen41, primVoid(), "beginclip", formal(primPicture(), "f", false, false), formal(pathArray() , "g", false, false), formal(primBoolean(), "stroke", true, false), formal(primPen(), "fillrule", true, false), formal(primBoolean(), "copy", true, false));
-#line 1608 "runtime.in"
- addFunc(ve, run::gen42, primVoid(), "endclip", formal(primPicture(), "f", false, false));
-#line 1613 "runtime.in"
- addFunc(ve, run::gen43, primVoid(), "gsave", formal(primPicture(), "f", false, false));
-#line 1618 "runtime.in"
- addFunc(ve, run::gen44, primVoid(), "grestore", formal(primPicture(), "f", false, false));
-#line 1623 "runtime.in"
- addFunc(ve, run::gen45, primVoid(), "begingroup", formal(primPicture(), "f", false, false));
-#line 1628 "runtime.in"
- addFunc(ve, run::gen46, primVoid(), "endgroup", formal(primPicture(), "f", false, false));
-#line 1633 "runtime.in"
- addFunc(ve, run::gen47, primVoid(), "add", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false));
-#line 1638 "runtime.in"
- addFunc(ve, run::gen48, primVoid(), "prepend", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false));
-#line 1643 "runtime.in"
- addFunc(ve, run::gen49, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false));
-#line 1648 "runtime.in"
- addFunc(ve, run::gen50, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false));
-#line 1653 "runtime.in"
- addFunc(ve, run::gen51, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false));
-#line 1658 "runtime.in"
- addFunc(ve, run::gen52, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false));
-#line 1663 "runtime.in"
- addFunc(ve, run::gen53, primVoid(), "texpreamble", formal(primString() , "s", false, false));
-#line 1671 "runtime.in"
- addFunc(ve, run::gen54, primVoid(), "deletepreamble");
-#line 1678 "runtime.in"
- addFunc(ve, run::gen55, primVoid(), "_labelpath", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primString() , "size", false, false), formal(primPath(), "g", false, false), formal(primString() , "justify", false, false), formal(primPair(), "offset", false, false), formal(primPen(), "p", false, false));
-#line 1684 "runtime.in"
- addFunc(ve, run::gen56, primVoid(), "texreset");
+ addFunc(ve, run::gen_runtime47, primVoid(), "add", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false));
+#line 1606 "runtime.in"
+ addFunc(ve, run::gen_runtime48, primVoid(), "prepend", formal(primPicture(), "dest", false, false), formal(primPicture(), "src", false, false));
+#line 1611 "runtime.in"
+ addFunc(ve, run::gen_runtime49, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false));
+#line 1616 "runtime.in"
+ addFunc(ve, run::gen_runtime50, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false));
+#line 1621 "runtime.in"
+ addFunc(ve, run::gen_runtime51, primVoid(), "postscript", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false));
+#line 1626 "runtime.in"
+ addFunc(ve, run::gen_runtime52, primVoid(), "tex", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primPair(), "min", false, false), formal(primPair(), "max", false, false));
+#line 1631 "runtime.in"
+ addFunc(ve, run::gen_runtime53, primVoid(), "texpreamble", formal(primString() , "s", false, false));
+#line 1639 "runtime.in"
+ addFunc(ve, run::gen_runtime54, primVoid(), "deletepreamble");
+#line 1646 "runtime.in"
+ addFunc(ve, run::gen_runtime55, primVoid(), "_labelpath", formal(primPicture(), "f", false, false), formal(primString() , "s", false, false), formal(primString() , "size", false, false), formal(primPath(), "g", false, false), formal(primString() , "justify", false, false), formal(primPair(), "offset", false, false), formal(primPen(), "p", false, false));
+#line 1652 "runtime.in"
+ addFunc(ve, run::gen_runtime56, primVoid(), "texreset");
+#line 1660 "runtime.in"
+ addFunc(ve, run::gen_runtime57, primVoid(), "layer", formal(primPicture(), "f", false, false));
+#line 1665 "runtime.in"
+ addFunc(ve, run::gen_runtime58, primVoid(), "newpage", formal(primPicture(), "f", false, false));
+#line 1670 "runtime.in"
+ addFunc(ve, run::gen_runtime59, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(realArray2(), "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(penArray() , "palette", true, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false));
+#line 1680 "runtime.in"
+ addFunc(ve, run::gen_runtime60, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(penArray2() , "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false));
+#line 1687 "runtime.in"
+ addFunc(ve, run::gen_runtime61, primString() , "nativeformat");
#line 1692 "runtime.in"
- addFunc(ve, run::gen57, primVoid(), "layer", formal(primPicture(), "f", false, false));
+ addFunc(ve, run::gen_runtime62, primBoolean(), "latex");
#line 1697 "runtime.in"
- addFunc(ve, run::gen58, primVoid(), "newpage", formal(primPicture(), "f", false, false));
+ addFunc(ve, run::gen_runtime63, primBoolean(), "pdf");
#line 1702 "runtime.in"
- addFunc(ve, run::gen59, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(realArray2(), "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(penArray() , "palette", true, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false));
-#line 1712 "runtime.in"
- addFunc(ve, run::gen60, primVoid(), "_image", formal(primPicture(), "f", false, false), formal(penArray2() , "data", false, false), formal(primPair(), "initial", false, false), formal(primPair(), "final", false, false), formal(primTransform(), "t", true, false), formal(primBoolean(), "copy", true, false), formal(primBoolean(), "antialias", true, false));
-#line 1719 "runtime.in"
- addFunc(ve, run::gen61, primString() , "nativeformat");
-#line 1724 "runtime.in"
- addFunc(ve, run::gen62, primBoolean(), "latex");
-#line 1729 "runtime.in"
- addFunc(ve, run::gen63, primBoolean(), "pdf");
-#line 1734 "runtime.in"
- addFunc(ve, run::gen64, primVoid(), "shipout", formal(primString() , "prefix", true, false), formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primString() , "format", true, false), formal(primBoolean(), "wait", true, false), formal(primBoolean(), "view", true, false), formal(transformFunction(), "xform", false, false));
-#line 1780 "runtime.in"
- addFunc(ve, run::gen65, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(primString() , "format", true, false), formal(primReal(), "width", false, false), formal(primReal(), "height", false, false), formal(primReal(), "angle", false, false), formal(primReal(), "zoom", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(primPair(), "shift", false, false), formal(realArray2(), "t", false, false), formal(realArray(), "background", false, false), formal(tripleArray(), "lights", false, false), formal(realArray2(), "diffuse", false, false), formal(realArray2(), "ambient", false, false), formal(realArray2(), "specular", false, false), formal(primBoolean(), "viewportlighting", false, false), formal(primBoolean(), "view", true, false));
-#line 1798 "runtime.in"
- addFunc(ve, run::gen66, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false));
-#line 1803 "runtime.in"
- addFunc(ve, run::gen67, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false));
-#line 1926 "runtime.in"
- addFunc(ve, run::gen68, primVoid(), "purge", formal(primInt(), "divisor", true, false));
-#line 1939 "runtime.in"
- addFunc(ve, run::gen70, primBoolean(), "==", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
-#line 1944 "runtime.in"
- addFunc(ve, run::gen71, primBoolean(), "!=", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
-#line 1949 "runtime.in"
- addFunc(ve, run::gen72, primPen(), "+", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
-#line 1954 "runtime.in"
- addFunc(ve, run::gen73, primPen(), "*", formal(primReal(), "a", false, false), formal(primPen(), "b", false, false));
-#line 1959 "runtime.in"
- addFunc(ve, run::gen74, primPen(), "*", formal(primPen(), "a", false, false), formal(primReal(), "b", false, false));
-#line 1964 "runtime.in"
- addFunc(ve, run::gen75, primPair(), "max", formal(primPen(), "p", false, false));
-#line 1969 "runtime.in"
- addFunc(ve, run::gen76, primPair(), "min", formal(primPen(), "p", false, false));
+ addFunc(ve, run::gen_runtime64, primVoid(), "shipout", formal(primString() , "prefix", true, false), formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primString() , "format", true, false), formal(primBoolean(), "wait", true, false), formal(primBoolean(), "view", true, false), formal(transformFunction(), "xform", false, false));
+#line 1748 "runtime.in"
+ addFunc(ve, run::gen_runtime65, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false), formal(primString() , "format", true, false), formal(primReal(), "width", false, false), formal(primReal(), "height", false, false), formal(primReal(), "angle", false, false), formal(primReal(), "zoom", false, false), formal(primTriple(), "m", false, false), formal(primTriple(), "m", false, false), formal(primPair(), "shift", false, false), formal(realArray2(), "t", false, false), formal(realArray(), "background", false, false), formal(tripleArray(), "lights", false, false), formal(realArray2(), "diffuse", false, false), formal(realArray2(), "ambient", false, false), formal(realArray2(), "specular", false, false), formal(primBoolean(), "viewportlighting", false, false), formal(primBoolean(), "view", true, false));
+#line 1766 "runtime.in"
+ addFunc(ve, run::gen_runtime66, primVoid(), "shipout3", formal(primString() , "prefix", false, false), formal(primPicture(), "f", false, false));
+#line 1771 "runtime.in"
+ addFunc(ve, run::gen_runtime67, primVoid(), "deconstruct", formal(primPicture(), "f", false, false), formal(primPicture(), "preamble", true, false), formal(primReal(), "magnification", true, false), formal(transformFunction(), "xform", false, false));
+#line 1894 "runtime.in"
+ addFunc(ve, run::gen_runtime68, primVoid(), "purge", formal(primInt(), "divisor", true, false));
+#line 1899 "runtime.in"
+ REGISTER_BLTIN(run::newPen,"newPen");
+#line 1907 "runtime.in"
+ addFunc(ve, run::gen_runtime70, primBoolean(), "==", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
+#line 1912 "runtime.in"
+ addFunc(ve, run::gen_runtime71, primBoolean(), "!=", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
+#line 1917 "runtime.in"
+ addFunc(ve, run::gen_runtime72, primPen(), "+", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false));
+#line 1922 "runtime.in"
+ addFunc(ve, run::gen_runtime73, primPen(), "*", formal(primReal(), "a", false, false), formal(primPen(), "b", false, false));
+#line 1927 "runtime.in"
+ addFunc(ve, run::gen_runtime74, primPen(), "*", formal(primPen(), "a", false, false), formal(primReal(), "b", false, false));
+#line 1932 "runtime.in"
+ addFunc(ve, run::gen_runtime75, primPair(), "max", formal(primPen(), "p", false, false));
+#line 1937 "runtime.in"
+ addFunc(ve, run::gen_runtime76, primPair(), "min", formal(primPen(), "p", false, false));
+#line 1942 "runtime.in"
+ addFunc(ve, run::gen_runtime77, primVoid(), "resetdefaultpen");
+#line 1948 "runtime.in"
+ addFunc(ve, run::gen_runtime78, primVoid(), "defaultpen", formal(primPen(), "p", false, false));
+#line 1953 "runtime.in"
+ addFunc(ve, run::gen_runtime79, primPen(), "defaultpen");
+#line 1958 "runtime.in"
+ addFunc(ve, run::gen_runtime80, primBoolean(), "invisible", formal(primPen(), "p", false, false));
+#line 1963 "runtime.in"
+ addFunc(ve, run::gen_runtime81, primPen(), "invisible");
+#line 1968 "runtime.in"
+ addFunc(ve, run::gen_runtime82, primPen(), "gray", formal(primPen(), "p", false, false));
#line 1974 "runtime.in"
- addFunc(ve, run::gen77, primVoid(), "resetdefaultpen");
+ addFunc(ve, run::gen_runtime83, primPen(), "rgb", formal(primPen(), "p", false, false));
#line 1980 "runtime.in"
- addFunc(ve, run::gen78, primVoid(), "defaultpen", formal(primPen(), "p", false, false));
-#line 1985 "runtime.in"
- addFunc(ve, run::gen79, primPen(), "defaultpen");
-#line 1990 "runtime.in"
- addFunc(ve, run::gen80, primBoolean(), "invisible", formal(primPen(), "p", false, false));
-#line 1995 "runtime.in"
- addFunc(ve, run::gen81, primPen(), "invisible");
-#line 2000 "runtime.in"
- addFunc(ve, run::gen82, primPen(), "gray", formal(primPen(), "p", false, false));
+ addFunc(ve, run::gen_runtime84, primPen(), "cmyk", formal(primPen(), "p", false, false));
+#line 1986 "runtime.in"
+ addFunc(ve, run::gen_runtime85, primPen(), "interp", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false), formal(primReal(), "t", false, false));
+#line 1991 "runtime.in"
+ addFunc(ve, run::gen_runtime86, primPen(), "rgb", formal(primReal(), "r", false, false), formal(primReal(), "g", false, false), formal(primReal(), "b", false, false));
+#line 1996 "runtime.in"
+ addFunc(ve, run::gen_runtime87, primPen(), "cmyk", formal(primReal(), "c", false, false), formal(primReal(), "m", false, false), formal(primReal(), "y", false, false), formal(primReal(), "k", false, false));
+#line 2001 "runtime.in"
+ addFunc(ve, run::gen_runtime88, primPen(), "gray", formal(primReal(), "gray", false, false));
#line 2006 "runtime.in"
- addFunc(ve, run::gen83, primPen(), "rgb", formal(primPen(), "p", false, false));
-#line 2012 "runtime.in"
- addFunc(ve, run::gen84, primPen(), "cmyk", formal(primPen(), "p", false, false));
-#line 2018 "runtime.in"
- addFunc(ve, run::gen85, primPen(), "interp", formal(primPen(), "a", false, false), formal(primPen(), "b", false, false), formal(primReal(), "t", false, false));
-#line 2023 "runtime.in"
- addFunc(ve, run::gen86, primPen(), "rgb", formal(primReal(), "r", false, false), formal(primReal(), "g", false, false), formal(primReal(), "b", false, false));
-#line 2028 "runtime.in"
- addFunc(ve, run::gen87, primPen(), "cmyk", formal(primReal(), "c", false, false), formal(primReal(), "m", false, false), formal(primReal(), "y", false, false), formal(primReal(), "k", false, false));
-#line 2033 "runtime.in"
- addFunc(ve, run::gen88, primPen(), "gray", formal(primReal(), "gray", false, false));
-#line 2038 "runtime.in"
- addFunc(ve, run::gen89, realArray(), "colors", formal(primPen(), "p", false, false));
-#line 2066 "runtime.in"
- addFunc(ve, run::gen90, primString() , "colorspace", formal(primPen(), "p", false, false));
-#line 2073 "runtime.in"
- addFunc(ve, run::gen91, primPen(), "pattern", formal(primString(), "s", false, false));
-#line 2078 "runtime.in"
- addFunc(ve, run::gen92, primString() , "pattern", formal(primPen(), "p", false, false));
-#line 2083 "runtime.in"
- addFunc(ve, run::gen93, primPen(), "fillrule", formal(primInt(), "n", false, false));
-#line 2088 "runtime.in"
- addFunc(ve, run::gen94, primInt(), "fillrule", formal(primPen(), "p", false, false));
-#line 2093 "runtime.in"
- addFunc(ve, run::gen95, primPen(), "opacity", formal(primReal(), "opacity", true, false), formal(primString() , "blend", true, false));
-#line 2103 "runtime.in"
- addFunc(ve, run::gen96, primReal(), "opacity", formal(primPen(), "p", false, false));
-#line 2108 "runtime.in"
- addFunc(ve, run::gen97, primString() , "blend", formal(primPen(), "p", false, false));
-#line 2113 "runtime.in"
- addFunc(ve, run::gen98, primPen(), "linetype", formal(primString(), "s", false, false), formal(primReal(), "offset", true, false), formal(primBoolean(), "scale", true, false), formal(primBoolean(), "adjust", true, false));
-#line 2118 "runtime.in"
- addFunc(ve, run::gen99, primString() , "linetype", formal(primPen(), "p", true, false));
-#line 2123 "runtime.in"
- addFunc(ve, run::gen100, primReal(), "offset", formal(primPen(), "p", false, false));
-#line 2128 "runtime.in"
- addFunc(ve, run::gen101, primBoolean(), "scale", formal(primPen(), "p", false, false));
-#line 2133 "runtime.in"
- addFunc(ve, run::gen102, primBoolean(), "adjust", formal(primPen(), "p", false, false));
-#line 2138 "runtime.in"
- addFunc(ve, run::gen103, primPen(), "adjust", formal(primPen(), "p", false, false), formal(primReal(), "arclength", false, false), formal(primBoolean(), "cyclic", false, false));
-#line 2143 "runtime.in"
- addFunc(ve, run::gen104, primPen(), "linecap", formal(primInt(), "n", false, false));
-#line 2148 "runtime.in"
- addFunc(ve, run::gen105, primInt(), "linecap", formal(primPen(), "p", true, false));
-#line 2153 "runtime.in"
- addFunc(ve, run::gen106, primPen(), "linejoin", formal(primInt(), "n", false, false));
-#line 2158 "runtime.in"
- addFunc(ve, run::gen107, primInt(), "linejoin", formal(primPen(), "p", true, false));
-#line 2163 "runtime.in"
- addFunc(ve, run::gen108, primPen(), "miterlimit", formal(primReal(), "x", false, false));
-#line 2168 "runtime.in"
- addFunc(ve, run::gen109, primReal(), "miterlimit", formal(primPen(), "p", true, false));
-#line 2173 "runtime.in"
- addFunc(ve, run::gen110, primPen(), "linewidth", formal(primReal(), "x", false, false));
-#line 2178 "runtime.in"
- addFunc(ve, run::gen111, primReal(), "linewidth", formal(primPen(), "p", true, false));
+ addFunc(ve, run::gen_runtime89, realArray(), "colors", formal(primPen(), "p", false, false));
+#line 2034 "runtime.in"
+ addFunc(ve, run::gen_runtime90, primString() , "colorspace", formal(primPen(), "p", false, false));
+#line 2041 "runtime.in"
+ addFunc(ve, run::gen_runtime91, primPen(), "pattern", formal(primString(), "s", false, false));
+#line 2046 "runtime.in"
+ addFunc(ve, run::gen_runtime92, primString() , "pattern", formal(primPen(), "p", false, false));
+#line 2051 "runtime.in"
+ addFunc(ve, run::gen_runtime93, primPen(), "fillrule", formal(primInt(), "n", false, false));
+#line 2056 "runtime.in"
+ addFunc(ve, run::gen_runtime94, primInt(), "fillrule", formal(primPen(), "p", false, false));
+#line 2061 "runtime.in"
+ addFunc(ve, run::gen_runtime95, primPen(), "opacity", formal(primReal(), "opacity", true, false), formal(primString() , "blend", true, false));
+#line 2071 "runtime.in"
+ addFunc(ve, run::gen_runtime96, primReal(), "opacity", formal(primPen(), "p", false, false));
+#line 2076 "runtime.in"
+ addFunc(ve, run::gen_runtime97, primString() , "blend", formal(primPen(), "p", false, false));
+#line 2081 "runtime.in"
+ addFunc(ve, run::gen_runtime98, primPen(), "linetype", formal(primString(), "s", false, false), formal(primReal(), "offset", true, false), formal(primBoolean(), "scale", true, false), formal(primBoolean(), "adjust", true, false));
+#line 2086 "runtime.in"
+ addFunc(ve, run::gen_runtime99, primString() , "linetype", formal(primPen(), "p", true, false));
+#line 2091 "runtime.in"
+ addFunc(ve, run::gen_runtime100, primReal(), "offset", formal(primPen(), "p", false, false));
+#line 2096 "runtime.in"
+ addFunc(ve, run::gen_runtime101, primBoolean(), "scale", formal(primPen(), "p", false, false));
+#line 2101 "runtime.in"
+ addFunc(ve, run::gen_runtime102, primBoolean(), "adjust", formal(primPen(), "p", false, false));
+#line 2106 "runtime.in"
+ addFunc(ve, run::gen_runtime103, primPen(), "adjust", formal(primPen(), "p", false, false), formal(primReal(), "arclength", false, false), formal(primBoolean(), "cyclic", false, false));
+#line 2111 "runtime.in"
+ addFunc(ve, run::gen_runtime104, primPen(), "linecap", formal(primInt(), "n", false, false));
+#line 2116 "runtime.in"
+ addFunc(ve, run::gen_runtime105, primInt(), "linecap", formal(primPen(), "p", true, false));
+#line 2121 "runtime.in"
+ addFunc(ve, run::gen_runtime106, primPen(), "linejoin", formal(primInt(), "n", false, false));
+#line 2126 "runtime.in"
+ addFunc(ve, run::gen_runtime107, primInt(), "linejoin", formal(primPen(), "p", true, false));
+#line 2131 "runtime.in"
+ addFunc(ve, run::gen_runtime108, primPen(), "miterlimit", formal(primReal(), "x", false, false));
+#line 2136 "runtime.in"
+ addFunc(ve, run::gen_runtime109, primReal(), "miterlimit", formal(primPen(), "p", true, false));
+#line 2141 "runtime.in"
+ addFunc(ve, run::gen_runtime110, primPen(), "linewidth", formal(primReal(), "x", false, false));
+#line 2146 "runtime.in"
+ addFunc(ve, run::gen_runtime111, primReal(), "linewidth", formal(primPen(), "p", true, false));
+#line 2151 "runtime.in"
+ addFunc(ve, run::gen_runtime112, primPen(), "fontcommand", formal(primString(), "s", false, false));
+#line 2156 "runtime.in"
+ addFunc(ve, run::gen_runtime113, primString() , "font", formal(primPen(), "p", true, false));
+#line 2161 "runtime.in"
+ addFunc(ve, run::gen_runtime114, primPen(), "fontsize", formal(primReal(), "size", false, false), formal(primReal(), "lineskip", false, false));
+#line 2167 "runtime.in"
+ addFunc(ve, run::gen_runtime115, primReal(), "fontsize", formal(primPen(), "p", true, false));
+#line 2172 "runtime.in"
+ addFunc(ve, run::gen_runtime116, primReal(), "lineskip", formal(primPen(), "p", true, false));
+#line 2177 "runtime.in"
+ addFunc(ve, run::gen_runtime117, primPen(), "overwrite", formal(primInt(), "n", false, false));
#line 2183 "runtime.in"
- addFunc(ve, run::gen112, primPen(), "fontcommand", formal(primString(), "s", false, false));
+ addFunc(ve, run::gen_runtime118, primInt(), "overwrite", formal(primPen(), "p", true, false));
#line 2188 "runtime.in"
- addFunc(ve, run::gen113, primString() , "font", formal(primPen(), "p", true, false));
+ addFunc(ve, run::gen_runtime119, primPen(), "basealign", formal(primInt(), "n", false, false));
#line 2193 "runtime.in"
- addFunc(ve, run::gen114, primPen(), "fontsize", formal(primReal(), "size", false, false), formal(primReal(), "lineskip", false, false));
-#line 2199 "runtime.in"
- addFunc(ve, run::gen115, primReal(), "fontsize", formal(primPen(), "p", true, false));
-#line 2204 "runtime.in"
- addFunc(ve, run::gen116, primReal(), "lineskip", formal(primPen(), "p", true, false));
-#line 2209 "runtime.in"
- addFunc(ve, run::gen117, primPen(), "overwrite", formal(primInt(), "n", false, false));
-#line 2215 "runtime.in"
- addFunc(ve, run::gen118, primInt(), "overwrite", formal(primPen(), "p", true, false));
-#line 2220 "runtime.in"
- addFunc(ve, run::gen119, primPen(), "basealign", formal(primInt(), "n", false, false));
-#line 2225 "runtime.in"
- addFunc(ve, run::gen120, primInt(), "basealign", formal(primPen(), "p", true, false));
-#line 2230 "runtime.in"
- addFunc(ve, run::gen121, primTransform(), "transform", formal(primPen(), "p", false, false));
-#line 2235 "runtime.in"
- addFunc(ve, run::gen122, primPath(), "nib", formal(primPen(), "p", false, false));
-#line 2240 "runtime.in"
- addFunc(ve, run::gen123, primPen(), "makepen", formal(primPath(), "p", false, false));
+ addFunc(ve, run::gen_runtime120, primInt(), "basealign", formal(primPen(), "p", true, false));
+#line 2198 "runtime.in"
+ addFunc(ve, run::gen_runtime121, primTransform(), "transform", formal(primPen(), "p", false, false));
+#line 2203 "runtime.in"
+ addFunc(ve, run::gen_runtime122, primPath(), "nib", formal(primPen(), "p", false, false));
+#line 2208 "runtime.in"
+ addFunc(ve, run::gen_runtime123, primPen(), "makepen", formal(primPath(), "p", false, false));
+#line 2213 "runtime.in"
+ addFunc(ve, run::gen_runtime124, primPen(), "colorless", formal(primPen(), "p", false, false));
+#line 2219 "runtime.in"
+ addFunc(ve, run::gen_runtime125, primBoolean(), "interactive");
+#line 2226 "runtime.in"
+ addFunc(ve, run::gen_runtime126, primBoolean(), "uptodate");
+#line 2231 "runtime.in"
+ addFunc(ve, run::gen_runtime127, primInt(), "system", formal(stringArray(), "s", false, false));
#line 2245 "runtime.in"
- addFunc(ve, run::gen124, primPen(), "colorless", formal(primPen(), "p", false, false));
-#line 2251 "runtime.in"
- addFunc(ve, run::gen125, primBoolean(), "interactive");
-#line 2258 "runtime.in"
- addFunc(ve, run::gen126, primBoolean(), "uptodate");
-#line 2263 "runtime.in"
- addFunc(ve, run::gen127, primInt(), "system", formal(stringArray(), "s", false, false));
-#line 2277 "runtime.in"
- addFunc(ve, run::gen128, primBoolean(), "view");
-#line 2282 "runtime.in"
- addFunc(ve, run::gen129, primString() , "asydir");
-#line 2287 "runtime.in"
- addFunc(ve, run::gen130, primString() , "locale", formal(primString() , "s", true, false));
-#line 2293 "runtime.in"
- addFunc(ve, run::gen131, primVoid(), "abort", formal(primString() , "s", true, false));
-#line 2299 "runtime.in"
- addFunc(ve, run::gen132, primVoid(), "exit");
-#line 2304 "runtime.in"
- addFunc(ve, run::gen133, primVoid(), "assert", formal(primBoolean(), "b", false, false), formal(primString() , "s", true, false));
-#line 2315 "runtime.in"
- addFunc(ve, run::gen134, primVoid(), "sleep", formal(primInt(), "seconds", false, false));
-#line 2321 "runtime.in"
- addFunc(ve, run::gen135, primVoid(), "usleep", formal(primInt(), "microseconds", false, false));
-#line 2327 "runtime.in"
- addFunc(ve, run::gen136, primVoid(), "_eval", formal(primString(), "s", false, false), formal(primBoolean(), "embedded", false, false), formal(primBoolean(), "interactivewrite", true, false));
+ addFunc(ve, run::gen_runtime128, primBoolean(), "view");
+#line 2250 "runtime.in"
+ addFunc(ve, run::gen_runtime129, primString() , "asydir");
+#line 2255 "runtime.in"
+ addFunc(ve, run::gen_runtime130, primString() , "locale", formal(primString() , "s", true, false));
+#line 2261 "runtime.in"
+ addFunc(ve, run::gen_runtime131, primVoid(), "abort", formal(primString() , "s", true, false));
+#line 2267 "runtime.in"
+ addFunc(ve, run::gen_runtime132, primVoid(), "exit");
+#line 2272 "runtime.in"
+ addFunc(ve, run::gen_runtime133, primVoid(), "assert", formal(primBoolean(), "b", false, false), formal(primString() , "s", true, false));
+#line 2283 "runtime.in"
+ addFunc(ve, run::gen_runtime134, primVoid(), "sleep", formal(primInt(), "seconds", false, false));
+#line 2289 "runtime.in"
+ addFunc(ve, run::gen_runtime135, primVoid(), "usleep", formal(primInt(), "microseconds", false, false));
+#line 2295 "runtime.in"
+ addFunc(ve, run::gen_runtime136, primVoid(), "_eval", formal(primString(), "s", false, false), formal(primBoolean(), "embedded", false, false), formal(primBoolean(), "interactivewrite", true, false));
+#line 2308 "runtime.in"
+ addFunc(ve, run::gen_runtime137, primVoid(), "_eval", formal(primCode(), "s", false, false), formal(primBoolean(), "embedded", false, false));
+#line 2324 "runtime.in"
+ addFunc(ve, run::gen_runtime138, primString() , "location");
+#line 2330 "runtime.in"
+ REGISTER_BLTIN(run::loadModule,"loadModule");
+#line 2336 "runtime.in"
+ addFunc(ve, run::gen_runtime140, primString() , "cd", formal(primString() , "s", true, false));
#line 2342 "runtime.in"
- addFunc(ve, run::gen137, primVoid(), "_eval", formal(primCode(), "s", false, false), formal(primBoolean(), "embedded", false, false));
-#line 2360 "runtime.in"
- addFunc(ve, run::gen138, primString() , "location");
-#line 2372 "runtime.in"
- addFunc(ve, run::gen140, primString() , "cd", formal(primString() , "s", true, false));
-#line 2378 "runtime.in"
- addFunc(ve, run::gen141, primVoid(), "list", formal(primString(), "s", false, false), formal(primBoolean(), "imports", true, false));
-#line 2395 "runtime.in"
- addFunc(ve, run::gen143, primBoolean(), "==", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false));
-#line 2400 "runtime.in"
- addFunc(ve, run::gen144, primBoolean(), "!=", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false));
-#line 2405 "runtime.in"
- addFunc(ve, run::gen145, primPair(), "point", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2410 "runtime.in"
- addFunc(ve, run::gen146, primPair(), "point", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2415 "runtime.in"
- addFunc(ve, run::gen147, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2420 "runtime.in"
- addFunc(ve, run::gen148, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2425 "runtime.in"
- addFunc(ve, run::gen149, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2430 "runtime.in"
- addFunc(ve, run::gen150, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2435 "runtime.in"
- addFunc(ve, run::gen151, primPair(), "dir", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false));
-#line 2440 "runtime.in"
- addFunc(ve, run::gen152, primPair(), "dir", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false));
-#line 2445 "runtime.in"
- addFunc(ve, run::gen153, primPair(), "accel", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false));
-#line 2450 "runtime.in"
- addFunc(ve, run::gen154, primPair(), "accel", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2455 "runtime.in"
- addFunc(ve, run::gen155, primReal(), "radius", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+ addFunc(ve, run::gen_runtime141, primVoid(), "list", formal(primString(), "s", false, false), formal(primBoolean(), "imports", true, false));
+#line 2351 "runtime.in"
+ REGISTER_BLTIN(run::nullPath,"nullPath");
+#line 2359 "runtime.in"
+ addFunc(ve, run::gen_runtime143, primBoolean(), "==", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false));
+#line 2364 "runtime.in"
+ addFunc(ve, run::gen_runtime144, primBoolean(), "!=", formal(primPath(), "a", false, false), formal(primPath(), "b", false, false));
+#line 2369 "runtime.in"
+ addFunc(ve, run::gen_runtime145, primPair(), "point", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2374 "runtime.in"
+ addFunc(ve, run::gen_runtime146, primPair(), "point", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2379 "runtime.in"
+ addFunc(ve, run::gen_runtime147, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2384 "runtime.in"
+ addFunc(ve, run::gen_runtime148, primPair(), "precontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2389 "runtime.in"
+ addFunc(ve, run::gen_runtime149, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2394 "runtime.in"
+ addFunc(ve, run::gen_runtime150, primPair(), "postcontrol", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2399 "runtime.in"
+ addFunc(ve, run::gen_runtime151, primPair(), "dir", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false));
+#line 2404 "runtime.in"
+ addFunc(ve, run::gen_runtime152, primPair(), "dir", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false));
+#line 2409 "runtime.in"
+ addFunc(ve, run::gen_runtime153, primPair(), "accel", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false));
+#line 2414 "runtime.in"
+ addFunc(ve, run::gen_runtime154, primPair(), "accel", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2419 "runtime.in"
+ addFunc(ve, run::gen_runtime155, primReal(), "radius", formal(primPath(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2431 "runtime.in"
+ addFunc(ve, run::gen_runtime156, primPath(), "reverse", formal(primPath(), "p", false, false));
+#line 2436 "runtime.in"
+ addFunc(ve, run::gen_runtime157, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+#line 2441 "runtime.in"
+ addFunc(ve, run::gen_runtime158, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false));
+#line 2446 "runtime.in"
+ addFunc(ve, run::gen_runtime159, primPath(), "nurb", formal(primPair(), "z0", false, false), formal(primPair(), "z1", false, false), formal(primPair(), "z2", false, false), formal(primPair(), "z3", false, false), formal(primReal(), "w0", false, false), formal(primReal(), "w1", false, false), formal(primReal(), "w2", false, false), formal(primReal(), "w3", false, false), formal(primInt(), "m", false, false));
+#line 2452 "runtime.in"
+ addFunc(ve, run::gen_runtime160, primInt(), "length", formal(primPath(), "p", false, false));
+#line 2457 "runtime.in"
+ addFunc(ve, run::gen_runtime161, primBoolean(), "cyclic", formal(primPath(), "p", false, false));
+#line 2462 "runtime.in"
+ addFunc(ve, run::gen_runtime162, primBoolean(), "straight", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
#line 2467 "runtime.in"
- addFunc(ve, run::gen156, primPath(), "reverse", formal(primPath(), "p", false, false));
+ addFunc(ve, run::gen_runtime163, primPath(), "unstraighten", formal(primPath(), "p", false, false));
#line 2472 "runtime.in"
- addFunc(ve, run::gen157, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+ addFunc(ve, run::gen_runtime164, primBoolean(), "piecewisestraight", formal(primPath(), "p", false, false));
#line 2477 "runtime.in"
- addFunc(ve, run::gen158, primPath(), "subpath", formal(primPath(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false));
+ addFunc(ve, run::gen_runtime165, primReal(), "arclength", formal(primPath(), "p", false, false));
#line 2482 "runtime.in"
- addFunc(ve, run::gen159, primPath(), "nurb", formal(primPair(), "z0", false, false), formal(primPair(), "z1", false, false), formal(primPair(), "z2", false, false), formal(primPair(), "z3", false, false), formal(primReal(), "w0", false, false), formal(primReal(), "w1", false, false), formal(primReal(), "w2", false, false), formal(primReal(), "w3", false, false), formal(primInt(), "m", false, false));
-#line 2488 "runtime.in"
- addFunc(ve, run::gen160, primInt(), "length", formal(primPath(), "p", false, false));
-#line 2493 "runtime.in"
- addFunc(ve, run::gen161, primBoolean(), "cyclic", formal(primPath(), "p", false, false));
-#line 2498 "runtime.in"
- addFunc(ve, run::gen162, primBoolean(), "straight", formal(primPath(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2503 "runtime.in"
- addFunc(ve, run::gen163, primPath(), "unstraighten", formal(primPath(), "p", false, false));
-#line 2508 "runtime.in"
- addFunc(ve, run::gen164, primBoolean(), "piecewisestraight", formal(primPath(), "p", false, false));
-#line 2513 "runtime.in"
- addFunc(ve, run::gen165, primReal(), "arclength", formal(primPath(), "p", false, false));
-#line 2518 "runtime.in"
- addFunc(ve, run::gen166, primReal(), "arctime", formal(primPath(), "p", false, false), formal(primReal(), "dval", false, false));
-#line 2523 "runtime.in"
- addFunc(ve, run::gen167, primReal(), "dirtime", formal(primPath(), "p", false, false), formal(primPair(), "z", false, false));
-#line 2528 "runtime.in"
- addFunc(ve, run::gen168, realArray(), "intersect", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false));
-#line 2545 "runtime.in"
- addFunc(ve, run::gen169, realArray2(), "intersections", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false));
+ addFunc(ve, run::gen_runtime166, primReal(), "arctime", formal(primPath(), "p", false, false), formal(primReal(), "dval", false, false));
+#line 2487 "runtime.in"
+ addFunc(ve, run::gen_runtime167, primReal(), "dirtime", formal(primPath(), "p", false, false), formal(primPair(), "z", false, false));
+#line 2492 "runtime.in"
+ addFunc(ve, run::gen_runtime168, realArray(), "intersect", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false));
+#line 2509 "runtime.in"
+ addFunc(ve, run::gen_runtime169, realArray2(), "intersections", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false), formal(primReal(), "fuzz", true, false));
+#line 2540 "runtime.in"
+ addFunc(ve, run::gen_runtime170, realArray(), "intersections", formal(primPath(), "p", false, false), formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primReal(), "fuzz", true, false));
+#line 2555 "runtime.in"
+ addFunc(ve, run::gen_runtime171, primPair(), "extension", formal(primPair(), "p", false, false), formal(primPair(), "q", false, false), formal(primPair(), "p", false, false), formal(primPair(), "q", false, false));
+#line 2566 "runtime.in"
+ addFunc(ve, run::gen_runtime172, primInt(), "size", formal(primPath(), "p", false, false));
+#line 2571 "runtime.in"
+ addFunc(ve, run::gen_runtime173, primPath(), "&", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false));
#line 2576 "runtime.in"
- addFunc(ve, run::gen170, realArray(), "intersections", formal(primPath(), "p", false, false), formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primReal(), "fuzz", true, false));
-#line 2591 "runtime.in"
- addFunc(ve, run::gen171, primPair(), "extension", formal(primPair(), "p", false, false), formal(primPair(), "q", false, false), formal(primPair(), "p", false, false), formal(primPair(), "q", false, false));
-#line 2602 "runtime.in"
- addFunc(ve, run::gen172, primInt(), "size", formal(primPath(), "p", false, false));
-#line 2607 "runtime.in"
- addFunc(ve, run::gen173, primPath(), "&", formal(primPath(), "p", false, false), formal(primPath(), "q", false, false));
-#line 2612 "runtime.in"
- addFunc(ve, run::gen174, primPair(), "min", formal(primPath(), "p", false, false));
-#line 2617 "runtime.in"
- addFunc(ve, run::gen175, primPair(), "max", formal(primPath(), "p", false, false));
-#line 2622 "runtime.in"
- addFunc(ve, run::gen176, realArray(), "mintimes", formal(primPath(), "p", false, false));
+ addFunc(ve, run::gen_runtime174, primPair(), "min", formal(primPath(), "p", false, false));
+#line 2581 "runtime.in"
+ addFunc(ve, run::gen_runtime175, primPair(), "max", formal(primPath(), "p", false, false));
+#line 2586 "runtime.in"
+ addFunc(ve, run::gen_runtime176, realArray(), "mintimes", formal(primPath(), "p", false, false));
+#line 2595 "runtime.in"
+ addFunc(ve, run::gen_runtime177, realArray(), "maxtimes", formal(primPath(), "p", false, false));
+#line 2604 "runtime.in"
+ addFunc(ve, run::gen_runtime178, primReal(), "relativedistance", formal(primReal(), "theta", false, false), formal(primReal(), "phi", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "atleast", false, false));
+#line 2609 "runtime.in"
+ addFunc(ve, run::gen_runtime179, primInt(), "windingnumber", formal(pathArray() , "p", false, false), formal(primPair(), "z", false, false));
+#line 2614 "runtime.in"
+ addFunc(ve, run::gen_runtime180, primBoolean(), "inside", formal(pathArray() , "g", false, true), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false));
+#line 2619 "runtime.in"
+ addFunc(ve, run::gen_runtime181, primBoolean(), "inside", formal(primPath(), "g", false, false), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false));
+#line 2624 "runtime.in"
+ addFunc(ve, run::gen_runtime182, primReal(), "side", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false));
#line 2631 "runtime.in"
- addFunc(ve, run::gen177, realArray(), "maxtimes", formal(primPath(), "p", false, false));
-#line 2640 "runtime.in"
- addFunc(ve, run::gen178, primReal(), "relativedistance", formal(primReal(), "theta", false, false), formal(primReal(), "phi", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "atleast", false, false));
-#line 2645 "runtime.in"
- addFunc(ve, run::gen179, primInt(), "windingnumber", formal(pathArray() , "p", false, false), formal(primPair(), "z", false, false));
-#line 2650 "runtime.in"
- addFunc(ve, run::gen180, primBoolean(), "inside", formal(pathArray() , "g", false, true), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false));
-#line 2655 "runtime.in"
- addFunc(ve, run::gen181, primBoolean(), "inside", formal(primPath(), "g", false, false), formal(primPair(), "z", false, false), formal(primPen(), "fillrule", true, false));
-#line 2660 "runtime.in"
- addFunc(ve, run::gen182, primReal(), "side", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false));
-#line 2667 "runtime.in"
- addFunc(ve, run::gen183, primReal(), "incircle", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false));
-#line 2675 "runtime.in"
- addFunc(ve, run::gen184, primPath3(), "path3", formal(tripleArray(), "pre", false, false), formal(tripleArray(), "point", false, false), formal(tripleArray(), "post", false, false), formal(boolArray(), "straight", false, false), formal(primBoolean(), "cyclic", false, false));
-#line 2700 "runtime.in"
- addFunc(ve, run::gen186, primBoolean(), "==", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false));
-#line 2705 "runtime.in"
- addFunc(ve, run::gen187, primBoolean(), "!=", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false));
-#line 2710 "runtime.in"
- addFunc(ve, run::gen188, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2715 "runtime.in"
- addFunc(ve, run::gen189, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2720 "runtime.in"
- addFunc(ve, run::gen190, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2725 "runtime.in"
- addFunc(ve, run::gen191, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2730 "runtime.in"
- addFunc(ve, run::gen192, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2735 "runtime.in"
- addFunc(ve, run::gen193, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2740 "runtime.in"
- addFunc(ve, run::gen194, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false));
-#line 2745 "runtime.in"
- addFunc(ve, run::gen195, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false));
-#line 2750 "runtime.in"
- addFunc(ve, run::gen196, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false));
-#line 2755 "runtime.in"
- addFunc(ve, run::gen197, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2760 "runtime.in"
- addFunc(ve, run::gen198, primReal(), "radius", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
-#line 2772 "runtime.in"
- addFunc(ve, run::gen199, primReal(), "radius", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false), formal(primReal(), "t", false, false));
+ addFunc(ve, run::gen_runtime183, primReal(), "incircle", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false));
+#line 2639 "runtime.in"
+ addFunc(ve, run::gen_runtime184, primPath3(), "path3", formal(tripleArray(), "pre", false, false), formal(tripleArray(), "point", false, false), formal(tripleArray(), "post", false, false), formal(booleanArray(), "straight", false, false), formal(primBoolean(), "cyclic", false, false));
+#line 2659 "runtime.in"
+ REGISTER_BLTIN(run::nullPath3,"nullPath3");
+#line 2664 "runtime.in"
+ addFunc(ve, run::gen_runtime186, primBoolean(), "==", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false));
+#line 2669 "runtime.in"
+ addFunc(ve, run::gen_runtime187, primBoolean(), "!=", formal(primPath3(), "a", false, false), formal(primPath3(), "b", false, false));
+#line 2674 "runtime.in"
+ addFunc(ve, run::gen_runtime188, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2679 "runtime.in"
+ addFunc(ve, run::gen_runtime189, primTriple(), "point", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2684 "runtime.in"
+ addFunc(ve, run::gen_runtime190, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2689 "runtime.in"
+ addFunc(ve, run::gen_runtime191, primTriple(), "precontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2694 "runtime.in"
+ addFunc(ve, run::gen_runtime192, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2699 "runtime.in"
+ addFunc(ve, run::gen_runtime193, primTriple(), "postcontrol", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2704 "runtime.in"
+ addFunc(ve, run::gen_runtime194, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false), formal(primBoolean(), "normalize", true, false));
+#line 2709 "runtime.in"
+ addFunc(ve, run::gen_runtime195, primTriple(), "dir", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false), formal(primBoolean(), "normalize", true, false));
+#line 2714 "runtime.in"
+ addFunc(ve, run::gen_runtime196, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false), formal(primInt(), "sign", true, false));
+#line 2719 "runtime.in"
+ addFunc(ve, run::gen_runtime197, primTriple(), "accel", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2724 "runtime.in"
+ addFunc(ve, run::gen_runtime198, primReal(), "radius", formal(primPath3(), "p", false, false), formal(primReal(), "t", false, false));
+#line 2736 "runtime.in"
+ addFunc(ve, run::gen_runtime199, primReal(), "radius", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false), formal(primReal(), "t", false, false));
+#line 2748 "runtime.in"
+ addFunc(ve, run::gen_runtime200, primPath3(), "reverse", formal(primPath3(), "p", false, false));
+#line 2753 "runtime.in"
+ addFunc(ve, run::gen_runtime201, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
+#line 2758 "runtime.in"
+ addFunc(ve, run::gen_runtime202, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false));
+#line 2763 "runtime.in"
+ addFunc(ve, run::gen_runtime203, primInt(), "length", formal(primPath3(), "p", false, false));
+#line 2768 "runtime.in"
+ addFunc(ve, run::gen_runtime204, primBoolean(), "cyclic", formal(primPath3(), "p", false, false));
+#line 2773 "runtime.in"
+ addFunc(ve, run::gen_runtime205, primBoolean(), "straight", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2778 "runtime.in"
+ addFunc(ve, run::gen_runtime206, primTriple(), "perp", formal(primTriple(), "v", false, false), formal(primTriple(), "u", false, false));
#line 2784 "runtime.in"
- addFunc(ve, run::gen200, primPath3(), "reverse", formal(primPath3(), "p", false, false));
-#line 2789 "runtime.in"
- addFunc(ve, run::gen201, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primInt(), "a", false, false), formal(primInt(), "b", false, false));
-#line 2794 "runtime.in"
- addFunc(ve, run::gen202, primPath3(), "subpath", formal(primPath3(), "p", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false));
-#line 2799 "runtime.in"
- addFunc(ve, run::gen203, primInt(), "length", formal(primPath3(), "p", false, false));
-#line 2804 "runtime.in"
- addFunc(ve, run::gen204, primBoolean(), "cyclic", formal(primPath3(), "p", false, false));
-#line 2809 "runtime.in"
- addFunc(ve, run::gen205, primBoolean(), "straight", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2814 "runtime.in"
- addFunc(ve, run::gen206, primTriple(), "perp", formal(primTriple(), "v", false, false), formal(primTriple(), "u", false, false));
-#line 2820 "runtime.in"
- addFunc(ve, run::gen207, primReal(), "straightness", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
-#line 2831 "runtime.in"
- addFunc(ve, run::gen208, primReal(), "straightness", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false));
-#line 2839 "runtime.in"
- addFunc(ve, run::gen209, primBoolean(), "piecewisestraight", formal(primPath3(), "p", false, false));
-#line 2844 "runtime.in"
- addFunc(ve, run::gen210, primReal(), "arclength", formal(primPath3(), "p", false, false));
-#line 2849 "runtime.in"
- addFunc(ve, run::gen211, primReal(), "arctime", formal(primPath3(), "p", false, false), formal(primReal(), "dval", false, false));
-#line 2854 "runtime.in"
- addFunc(ve, run::gen212, realArray(), "intersect", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false));
-#line 2872 "runtime.in"
- addFunc(ve, run::gen213, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false));
-#line 2905 "runtime.in"
- addFunc(ve, run::gen214, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false));
-#line 2925 "runtime.in"
- addFunc(ve, run::gen215, primInt(), "size", formal(primPath3(), "p", false, false));
-#line 2930 "runtime.in"
- addFunc(ve, run::gen216, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false));
-#line 2935 "runtime.in"
- addFunc(ve, run::gen217, primTriple(), "min", formal(primPath3(), "p", false, false));
-#line 2940 "runtime.in"
- addFunc(ve, run::gen218, primTriple(), "max", formal(primPath3(), "p", false, false));
-#line 2945 "runtime.in"
- addFunc(ve, run::gen219, realArray(), "mintimes", formal(primPath3(), "p", false, false));
-#line 2955 "runtime.in"
- addFunc(ve, run::gen220, realArray(), "maxtimes", formal(primPath3(), "p", false, false));
-#line 2965 "runtime.in"
- addFunc(ve, run::gen221, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false));
+ addFunc(ve, run::gen_runtime207, primReal(), "straightness", formal(primPath3(), "p", false, false), formal(primInt(), "t", false, false));
+#line 2795 "runtime.in"
+ addFunc(ve, run::gen_runtime208, primReal(), "straightness", formal(primTriple(), "z0", false, false), formal(primTriple(), "c0", false, false), formal(primTriple(), "c1", false, false), formal(primTriple(), "z1", false, false));
+#line 2803 "runtime.in"
+ addFunc(ve, run::gen_runtime209, primBoolean(), "piecewisestraight", formal(primPath3(), "p", false, false));
+#line 2808 "runtime.in"
+ addFunc(ve, run::gen_runtime210, primReal(), "arclength", formal(primPath3(), "p", false, false));
+#line 2813 "runtime.in"
+ addFunc(ve, run::gen_runtime211, primReal(), "arctime", formal(primPath3(), "p", false, false), formal(primReal(), "dval", false, false));
+#line 2818 "runtime.in"
+ addFunc(ve, run::gen_runtime212, realArray(), "intersect", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false));
+#line 2836 "runtime.in"
+ addFunc(ve, run::gen_runtime213, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false), formal(primReal(), "fuzz", true, false));
+#line 2869 "runtime.in"
+ addFunc(ve, run::gen_runtime214, realArray2(), "intersections", formal(primPath3(), "p", false, false), formal(tripleArray2(), "p", false, false), formal(primReal(), "fuzz", true, false));
+#line 2889 "runtime.in"
+ addFunc(ve, run::gen_runtime215, primInt(), "size", formal(primPath3(), "p", false, false));
+#line 2894 "runtime.in"
+ addFunc(ve, run::gen_runtime216, primPath3(), "&", formal(primPath3(), "p", false, false), formal(primPath3(), "q", false, false));
+#line 2899 "runtime.in"
+ addFunc(ve, run::gen_runtime217, primTriple(), "min", formal(primPath3(), "p", false, false));
+#line 2904 "runtime.in"
+ addFunc(ve, run::gen_runtime218, primTriple(), "max", formal(primPath3(), "p", false, false));
+#line 2909 "runtime.in"
+ addFunc(ve, run::gen_runtime219, realArray(), "mintimes", formal(primPath3(), "p", false, false));
+#line 2919 "runtime.in"
+ addFunc(ve, run::gen_runtime220, realArray(), "maxtimes", formal(primPath3(), "p", false, false));
+#line 2929 "runtime.in"
+ addFunc(ve, run::gen_runtime221, primPath3(), "*", formal(realArray2(), "t", false, false), formal(primPath3(), "g", false, false));
+#line 2934 "runtime.in"
+ REGISTER_BLTIN(run::nullGuide,"nullGuide");
+#line 2942 "runtime.in"
+ REGISTER_BLTIN(run::dotsGuide,"dotsGuide");
+#line 2952 "runtime.in"
+ REGISTER_BLTIN(run::dashesGuide,"dashesGuide");
+#line 2979 "runtime.in"
+ REGISTER_BLTIN(run::newCycleToken,"newCycleToken");
+#line 2984 "runtime.in"
+ addFunc(ve, run::gen_runtime226, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false));
+#line 2991 "runtime.in"
+ addFunc(ve, run::gen_runtime227, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false));
+#line 2999 "runtime.in"
+ addFunc(ve, run::gen_runtime228, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false));
+#line 3005 "runtime.in"
+ REGISTER_BLTIN(run::curlSpecifierValuePart,"curlSpecifierValuePart");
+#line 3010 "runtime.in"
+ REGISTER_BLTIN(run::curlSpecifierSidePart,"curlSpecifierSidePart");
+#line 3015 "runtime.in"
+ addFunc(ve, run::gen_runtime231, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false));
#line 3020 "runtime.in"
- addFunc(ve, run::gen226, primGuide(), "operator cast", formal(primCycleToken(), "tok", false, false));
-#line 3027 "runtime.in"
- addFunc(ve, run::gen227, primGuide(), "operator spec", formal(primPair(), "z", false, false), formal(primInt(), "p", false, false));
+ addFunc(ve, run::gen_runtime232, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false));
+#line 3025 "runtime.in"
+ REGISTER_BLTIN(run::tensionSpecifierOutPart,"tensionSpecifierOutPart");
+#line 3030 "runtime.in"
+ REGISTER_BLTIN(run::tensionSpecifierInPart,"tensionSpecifierInPart");
#line 3035 "runtime.in"
- addFunc(ve, run::gen228, primCurlSpecifier(), "operator curl", formal(primReal(), "gamma", false, false), formal(primInt(), "p", false, false));
-#line 3051 "runtime.in"
- addFunc(ve, run::gen231, primGuide(), "operator cast", formal(primCurlSpecifier(), "spec", false, false));
-#line 3056 "runtime.in"
- addFunc(ve, run::gen232, primTensionSpecifier(), "operator tension", formal(primReal(), "tout", false, false), formal(primReal(), "tin", false, false), formal(primBoolean(), "atleast", false, false));
-#line 3076 "runtime.in"
- addFunc(ve, run::gen236, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false));
-#line 3081 "runtime.in"
- addFunc(ve, run::gen237, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false));
-#line 3086 "runtime.in"
- addFunc(ve, run::gen238, primInt(), "size", formal(primGuide(), "g", false, false));
-#line 3093 "runtime.in"
- addFunc(ve, run::gen239, primInt(), "length", formal(primGuide(), "g", false, false));
-#line 3100 "runtime.in"
- addFunc(ve, run::gen240, primBoolean(), "cyclic", formal(primGuide(), "g", false, false));
+ REGISTER_BLTIN(run::tensionSpecifierAtleastPart,"tensionSpecifierAtleastPart");
+#line 3040 "runtime.in"
+ addFunc(ve, run::gen_runtime236, primGuide(), "operator cast", formal(primTensionSpecifier(), "t", false, false));
+#line 3045 "runtime.in"
+ addFunc(ve, run::gen_runtime237, primGuide(), "operator controls", formal(primPair(), "zout", false, false), formal(primPair(), "zin", false, false));
+#line 3050 "runtime.in"
+ addFunc(ve, run::gen_runtime238, primInt(), "size", formal(primGuide(), "g", false, false));
+#line 3057 "runtime.in"
+ addFunc(ve, run::gen_runtime239, primInt(), "length", formal(primGuide(), "g", false, false));
+#line 3064 "runtime.in"
+ addFunc(ve, run::gen_runtime240, primBoolean(), "cyclic", formal(primGuide(), "g", false, false));
+#line 3071 "runtime.in"
+ addFunc(ve, run::gen_runtime241, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
+#line 3078 "runtime.in"
+ addFunc(ve, run::gen_runtime242, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
+#line 3090 "runtime.in"
+ addFunc(ve, run::gen_runtime243, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
#line 3107 "runtime.in"
- addFunc(ve, run::gen241, primPair(), "point", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
-#line 3114 "runtime.in"
- addFunc(ve, run::gen242, pairArray(), "dirSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
-#line 3126 "runtime.in"
- addFunc(ve, run::gen243, pairArray(), "controlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
-#line 3143 "runtime.in"
- addFunc(ve, run::gen244, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
-#line 3153 "runtime.in"
- addFunc(ve, run::gen245, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
-#line 3167 "runtime.in"
- addFunc(ve, run::gen246, primGuide(), "reverse", formal(primGuide(), "g", false, false));
-#line 3221 "runtime.in"
- addFunc(ve, run::gen247, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false));
-#line 3230 "runtime.in"
- addFunc(ve, run::gen248, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "g", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(primBoolean(), "lighton", false, false), formal(penArray() , "colors", false, false));
-#line 3238 "runtime.in"
- addFunc(ve, run::gen249, primTriple(), "min3", formal(primPicture(), "f", false, false));
-#line 3243 "runtime.in"
- addFunc(ve, run::gen250, primTriple(), "max3", formal(primPicture(), "f", false, false));
-#line 3248 "runtime.in"
- addFunc(ve, run::gen251, primPair(), "min", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false));
-#line 3256 "runtime.in"
- addFunc(ve, run::gen252, primPair(), "max", formal(primPicture(), "f", false, false), formal(realArray2(), "t", false, false));
-#line 3264 "runtime.in"
- addFunc(ve, run::gen253, primPair(), "minratio", formal(primPicture(), "f", false, false));
-#line 3269 "runtime.in"
- addFunc(ve, run::gen254, primPair(), "maxratio", formal(primPicture(), "f", false, false));
-#line 3274 "runtime.in"
- addFunc(ve, run::gen255, primTriple(), "minbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false));
-#line 3284 "runtime.in"
- addFunc(ve, run::gen256, primTriple(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false));
-#line 3294 "runtime.in"
- addFunc(ve, run::gen257, primPair(), "minbezier", formal(tripleArray2(), "p", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false));
-#line 3306 "runtime.in"
- addFunc(ve, run::gen258, primPair(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(realArray2(), "t", false, false), formal(primPair(), "b", false, false));
-#line 3318 "runtime.in"
- addFunc(ve, run::gen259, primPair(), "max", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false));
-#line 3326 "runtime.in"
- addFunc(ve, run::gen260, primPair(), "min", formal(primPath3(), "g", false, false), formal(realArray2(), "t", false, false));
-#line 3334 "runtime.in"
- addFunc(ve, run::gen261, primReal(), "change2", formal(tripleArray2(), "a", false, false));
-#line 3356 "runtime.in"
- addFunc(ve, run::gen262, primBoolean(), "is3D", formal(primPicture(), "f", false, false));
-#line 3361 "runtime.in"
- addFunc(ve, run::gen263, primPair(), "bezier", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3368 "runtime.in"
- addFunc(ve, run::gen264, primPair(), "bezierP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3373 "runtime.in"
- addFunc(ve, run::gen265, primPair(), "bezierPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3378 "runtime.in"
- addFunc(ve, run::gen266, primPair(), "bezierPPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false));
-#line 3383 "runtime.in"
- addFunc(ve, run::gen267, primTriple(), "bezier", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3390 "runtime.in"
- addFunc(ve, run::gen268, primTriple(), "bezierP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3395 "runtime.in"
- addFunc(ve, run::gen269, primTriple(), "bezierPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
-#line 3400 "runtime.in"
- addFunc(ve, run::gen270, primTriple(), "bezierPPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false));
-#line 3413 "runtime.in"
- addFunc(ve, run::gen272, primInt(), "length", formal(primString(), "s", false, false));
-#line 3418 "runtime.in"
- addFunc(ve, run::gen273, primInt(), "find", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false));
-#line 3424 "runtime.in"
- addFunc(ve, run::gen274, primInt(), "rfind", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false));
-#line 3430 "runtime.in"
- addFunc(ve, run::gen275, primString() , "reverse", formal(primString() , "s", false, false));
+ addFunc(ve, run::gen_runtime244, primTensionSpecifier(), "tensionSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
+#line 3117 "runtime.in"
+ addFunc(ve, run::gen_runtime245, realArray(), "curlSpecifier", formal(primGuide(), "g", false, false), formal(primInt(), "t", false, false));
+#line 3131 "runtime.in"
+ addFunc(ve, run::gen_runtime246, primGuide(), "reverse", formal(primGuide(), "g", false, false));
+#line 3185 "runtime.in"
+ addFunc(ve, run::gen_runtime247, primVoid(), "_draw", formal(primPicture(), "f", false, false), formal(primPath3(), "g", false, false), formal(primPen(), "p", false, false));
+#line 3194 "runtime.in"
+ addFunc(ve, run::gen_runtime248, primVoid(), "draw", formal(primPicture(), "f", false, false), formal(tripleArray2(), "g", false, false), formal(primBoolean(), "straight", false, false), formal(penArray() , "p", false, false), formal(primReal(), "opacity", false, false), formal(primReal(), "shininess", false, false), formal(primReal(), "prcshininess", false, false), formal(primReal(), "granularity", false, false), formal(primTriple(), "normal", false, false), formal(primBoolean(), "lighton", false, false), formal(penArray() , "colors", false, false));
+#line 3202 "runtime.in"
+ addFunc(ve, run::gen_runtime249, primTriple(), "min3", formal(primPicture(), "f", false, false));
+#line 3207 "runtime.in"
+ addFunc(ve, run::gen_runtime250, primTriple(), "max3", formal(primPicture(), "f", false, false));
+#line 3212 "runtime.in"
+ addFunc(ve, run::gen_runtime251, primPair(), "minratio", formal(primPicture(), "f", false, false));
+#line 3217 "runtime.in"
+ addFunc(ve, run::gen_runtime252, primPair(), "maxratio", formal(primPicture(), "f", false, false));
+#line 3222 "runtime.in"
+ addFunc(ve, run::gen_runtime253, primTriple(), "minbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false));
+#line 3232 "runtime.in"
+ addFunc(ve, run::gen_runtime254, primTriple(), "maxbezier", formal(tripleArray2(), "p", false, false), formal(primTriple(), "b", false, false));
+#line 3242 "runtime.in"
+ addFunc(ve, run::gen_runtime255, primPair(), "minratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false));
+#line 3252 "runtime.in"
+ addFunc(ve, run::gen_runtime256, primPair(), "maxratio", formal(tripleArray2(), "p", false, false), formal(primPair(), "b", false, false));
+#line 3262 "runtime.in"
+ addFunc(ve, run::gen_runtime257, primPair(), "minratio", formal(primPath3(), "g", false, false));
+#line 3267 "runtime.in"
+ addFunc(ve, run::gen_runtime258, primPair(), "maxratio", formal(primPath3(), "g", false, false));
+#line 3272 "runtime.in"
+ addFunc(ve, run::gen_runtime259, primReal(), "norm", formal(realArray(), "a", false, false));
+#line 3283 "runtime.in"
+ addFunc(ve, run::gen_runtime260, primReal(), "norm", formal(realArray2(), "a", false, false));
+#line 3298 "runtime.in"
+ addFunc(ve, run::gen_runtime261, primReal(), "norm", formal(tripleArray2(), "a", false, false));
+#line 3313 "runtime.in"
+ addFunc(ve, run::gen_runtime262, primReal(), "change2", formal(tripleArray2(), "a", false, false));
+#line 3335 "runtime.in"
+ addFunc(ve, run::gen_runtime263, primBoolean(), "is3D", formal(primPicture(), "f", false, false));
+#line 3340 "runtime.in"
+ addFunc(ve, run::gen_runtime264, primPair(), "bezier", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3347 "runtime.in"
+ addFunc(ve, run::gen_runtime265, primPair(), "bezierP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3352 "runtime.in"
+ addFunc(ve, run::gen_runtime266, primPair(), "bezierPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3357 "runtime.in"
+ addFunc(ve, run::gen_runtime267, primPair(), "bezierPPP", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false), formal(primPair(), "c", false, false), formal(primPair(), "d", false, false));
+#line 3362 "runtime.in"
+ addFunc(ve, run::gen_runtime268, primTriple(), "bezier", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3369 "runtime.in"
+ addFunc(ve, run::gen_runtime269, primTriple(), "bezierP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3374 "runtime.in"
+ addFunc(ve, run::gen_runtime270, primTriple(), "bezierPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false), formal(primReal(), "t", false, false));
+#line 3379 "runtime.in"
+ addFunc(ve, run::gen_runtime271, primTriple(), "bezierPPP", formal(primTriple(), "a", false, false), formal(primTriple(), "b", false, false), formal(primTriple(), "c", false, false), formal(primTriple(), "d", false, false));
+#line 3384 "runtime.in"
+ REGISTER_BLTIN(run::emptyString,"emptyString");
+#line 3392 "runtime.in"
+ addFunc(ve, run::gen_runtime273, primInt(), "length", formal(primString(), "s", false, false));
+#line 3397 "runtime.in"
+ addFunc(ve, run::gen_runtime274, primInt(), "find", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false));
+#line 3403 "runtime.in"
+ addFunc(ve, run::gen_runtime275, primInt(), "rfind", formal(primString(), "s", false, false), formal(primString() , "t", false, false), formal(primInt(), "pos", true, false));
+#line 3409 "runtime.in"
+ addFunc(ve, run::gen_runtime276, primString() , "reverse", formal(primString() , "s", false, false));
+#line 3415 "runtime.in"
+ addFunc(ve, run::gen_runtime277, primString() , "insert", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primString() , "t", false, false));
+#line 3422 "runtime.in"
+ addFunc(ve, run::gen_runtime278, primString() , "substr", formal(primString(), "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", true, false));
+#line 3429 "runtime.in"
+ addFunc(ve, run::gen_runtime279, primString() , "erase", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", false, false));
#line 3436 "runtime.in"
- addFunc(ve, run::gen276, primString() , "insert", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primString() , "t", false, false));
-#line 3443 "runtime.in"
- addFunc(ve, run::gen277, primString() , "substr", formal(primString(), "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", true, false));
-#line 3450 "runtime.in"
- addFunc(ve, run::gen278, primString() , "erase", formal(primString() , "s", false, false), formal(primInt(), "pos", false, false), formal(primInt(), "n", false, false));
-#line 3457 "runtime.in"
- addFunc(ve, run::gen279, primString() , "downcase", formal(primString() , "s", false, false));
-#line 3463 "runtime.in"
- addFunc(ve, run::gen280, primString() , "upcase", formal(primString() , "s", false, false));
-#line 3469 "runtime.in"
- addFunc(ve, run::gen281, primString() , "replace", formal(primString(), "s", false, false), formal(stringArray2(), "translate", false, false));
-#line 3496 "runtime.in"
- addFunc(ve, run::gen282, primString() , "format", formal(primString(), "format", false, false), formal(primInt(), "x", false, false));
-#line 3511 "runtime.in"
- addFunc(ve, run::gen283, primString() , "format", formal(primString(), "format", false, false), formal(primReal(), "x", false, false), formal(primString() , "locale", true, false));
-#line 3636 "runtime.in"
- addFunc(ve, run::gen284, primInt(), "hex", formal(primString() , "s", false, false));
-#line 3647 "runtime.in"
- addFunc(ve, run::gen285, primString() , "string", formal(primInt(), "x", false, false));
-#line 3654 "runtime.in"
- addFunc(ve, run::gen286, primString() , "string", formal(primReal(), "x", false, false), formal(primInt(), "digits", true, false));
-#line 3662 "runtime.in"
- addFunc(ve, run::gen287, primString() , "time", formal(primString() , "format", true, false));
-#line 3673 "runtime.in"
- addFunc(ve, run::gen288, primString() , "time", formal(primInt(), "seconds", false, false), formal(primString() , "format", true, false));
-#line 3686 "runtime.in"
- addFunc(ve, run::gen289, primInt(), "seconds", formal(primString() , "t", true, false), formal(primString() , "format", true, false));
-#line 3698 "runtime.in"
- addFunc(ve, run::gen290, realArray(), "_cputime");
+ addFunc(ve, run::gen_runtime280, primString() , "downcase", formal(primString() , "s", false, false));
+#line 3442 "runtime.in"
+ addFunc(ve, run::gen_runtime281, primString() , "upcase", formal(primString() , "s", false, false));
+#line 3448 "runtime.in"
+ addFunc(ve, run::gen_runtime282, primString() , "replace", formal(primString(), "s", false, false), formal(stringArray2(), "translate", false, false));
+#line 3475 "runtime.in"
+ addFunc(ve, run::gen_runtime283, primString() , "format", formal(primString(), "format", false, false), formal(primInt(), "x", false, false));
+#line 3490 "runtime.in"
+ addFunc(ve, run::gen_runtime284, primString() , "format", formal(primString(), "format", false, false), formal(primReal(), "x", false, false), formal(primString() , "locale", true, false));
+#line 3615 "runtime.in"
+ addFunc(ve, run::gen_runtime285, primInt(), "hex", formal(primString() , "s", false, false));
+#line 3626 "runtime.in"
+ addFunc(ve, run::gen_runtime286, primString() , "string", formal(primInt(), "x", false, false));
+#line 3633 "runtime.in"
+ addFunc(ve, run::gen_runtime287, primString() , "string", formal(primReal(), "x", false, false), formal(primInt(), "digits", true, false));
+#line 3641 "runtime.in"
+ addFunc(ve, run::gen_runtime288, primString() , "time", formal(primString() , "format", true, false));
+#line 3652 "runtime.in"
+ addFunc(ve, run::gen_runtime289, primString() , "time", formal(primInt(), "seconds", false, false), formal(primString() , "format", true, false));
+#line 3665 "runtime.in"
+ addFunc(ve, run::gen_runtime290, primInt(), "seconds", formal(primString() , "t", true, false), formal(primString() , "format", true, false));
+#line 3677 "runtime.in"
+ addFunc(ve, run::gen_runtime291, realArray(), "_cputime");
+#line 3691 "runtime.in"
+ addFunc(ve, run::gen_runtime292, primReal(), "^", formal(primReal(), "x", false, false), formal(primInt(), "y", false, false));
+#line 3699 "runtime.in"
+ addFunc(ve, run::gen_runtime293, primPair(), "^", formal(primPair(), "z", false, false), formal(primInt(), "y", false, false));
+#line 3704 "runtime.in"
+ addFunc(ve, run::gen_runtime294, primInt(), "quotient", formal(primInt(), "x", false, false), formal(primInt(), "y", false, false));
#line 3712 "runtime.in"
- addFunc(ve, run::gen291, primReal(), "^", formal(primReal(), "x", false, false), formal(primInt(), "y", false, false));
-#line 3720 "runtime.in"
- addFunc(ve, run::gen292, primPair(), "^", formal(primPair(), "z", false, false), formal(primInt(), "y", false, false));
-#line 3725 "runtime.in"
- addFunc(ve, run::gen293, primInt(), "quotient", formal(primInt(), "x", false, false), formal(primInt(), "y", false, false));
-#line 3733 "runtime.in"
- addFunc(ve, run::gen294, primInt(), "abs", formal(primInt(), "x", false, false));
+ addFunc(ve, run::gen_runtime295, primInt(), "abs", formal(primInt(), "x", false, false));
+#line 3717 "runtime.in"
+ addFunc(ve, run::gen_runtime296, primInt(), "sgn", formal(primReal(), "x", false, false));
+#line 3722 "runtime.in"
+ addFunc(ve, run::gen_runtime297, primInt(), "rand");
+#line 3727 "runtime.in"
+ addFunc(ve, run::gen_runtime298, primVoid(), "srand", formal(primInt(), "seed", false, false));
+#line 3732 "runtime.in"
+ addFunc(ve, run::gen_runtime299, primReal(), "unitrand");
#line 3738 "runtime.in"
- addFunc(ve, run::gen295, primInt(), "sgn", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime300, primInt(), "ceil", formal(primReal(), "x", false, false));
#line 3743 "runtime.in"
- addFunc(ve, run::gen296, primInt(), "rand");
+ addFunc(ve, run::gen_runtime301, primInt(), "floor", formal(primReal(), "x", false, false));
#line 3748 "runtime.in"
- addFunc(ve, run::gen297, primVoid(), "srand", formal(primInt(), "seed", false, false));
-#line 3753 "runtime.in"
- addFunc(ve, run::gen298, primReal(), "unitrand");
+ addFunc(ve, run::gen_runtime302, primInt(), "round", formal(primReal(), "x", false, false));
+#line 3754 "runtime.in"
+ addFunc(ve, run::gen_runtime303, primInt(), "Ceil", formal(primReal(), "x", false, false));
#line 3759 "runtime.in"
- addFunc(ve, run::gen299, primInt(), "ceil", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime304, primInt(), "Floor", formal(primReal(), "x", false, false));
#line 3764 "runtime.in"
- addFunc(ve, run::gen300, primInt(), "floor", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime305, primInt(), "Round", formal(primReal(), "x", false, false));
#line 3769 "runtime.in"
- addFunc(ve, run::gen301, primInt(), "round", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime306, primReal(), "fmod", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
#line 3775 "runtime.in"
- addFunc(ve, run::gen302, primInt(), "Ceil", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime307, primReal(), "atan2", formal(primReal(), "y", false, false), formal(primReal(), "x", false, false));
#line 3780 "runtime.in"
- addFunc(ve, run::gen303, primInt(), "Floor", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime308, primReal(), "hypot", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
#line 3785 "runtime.in"
- addFunc(ve, run::gen304, primInt(), "Round", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime309, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
#line 3790 "runtime.in"
- addFunc(ve, run::gen305, primReal(), "fmod", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
-#line 3796 "runtime.in"
- addFunc(ve, run::gen306, primReal(), "atan2", formal(primReal(), "y", false, false), formal(primReal(), "x", false, false));
-#line 3801 "runtime.in"
- addFunc(ve, run::gen307, primReal(), "hypot", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
-#line 3806 "runtime.in"
- addFunc(ve, run::gen308, primReal(), "remainder", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
-#line 3811 "runtime.in"
- addFunc(ve, run::gen309, primReal(), "J", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false));
-#line 3816 "runtime.in"
- addFunc(ve, run::gen310, primReal(), "Y", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false));
-#line 3821 "runtime.in"
- addFunc(ve, run::gen311, primReal(), "erf", formal(primReal(), "x", false, false));
+ addFunc(ve, run::gen_runtime310, primReal(), "J", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false));
+#line 3795 "runtime.in"
+ addFunc(ve, run::gen_runtime311, primReal(), "Y", formal(primInt(), "n", false, false), formal(primReal(), "x", false, false));
+#line 3800 "runtime.in"
+ addFunc(ve, run::gen_runtime312, primReal(), "erf", formal(primReal(), "x", false, false));
+#line 3805 "runtime.in"
+ addFunc(ve, run::gen_runtime313, primReal(), "erfc", formal(primReal(), "x", false, false));
+#line 3810 "runtime.in"
+ addFunc(ve, run::gen_runtime314, primInt(), "factorial", formal(primInt(), "n", false, false));
+#line 3815 "runtime.in"
+ addFunc(ve, run::gen_runtime315, primInt(), "choose", formal(primInt(), "n", false, false), formal(primInt(), "k", false, false));
#line 3826 "runtime.in"
- addFunc(ve, run::gen312, primReal(), "erfc", formal(primReal(), "x", false, false));
-#line 3831 "runtime.in"
- addFunc(ve, run::gen313, primInt(), "factorial", formal(primInt(), "n", false, false));
+ addFunc(ve, run::gen_runtime316, primReal(), "gamma", formal(primReal(), "x", false, false));
#line 3836 "runtime.in"
- addFunc(ve, run::gen314, primInt(), "choose", formal(primInt(), "n", false, false), formal(primInt(), "k", false, false));
-#line 3847 "runtime.in"
- addFunc(ve, run::gen315, primReal(), "gamma", formal(primReal(), "x", false, false));
-#line 3857 "runtime.in"
- addFunc(ve, run::gen316, primPair(), "gamma", formal(primPair(), "z", false, true));
-#line 3863 "runtime.in"
- addFunc(ve, run::gen317, realArray(), "quadraticroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false));
-#line 3872 "runtime.in"
- addFunc(ve, run::gen318, pairArray(), "quadraticroots", formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primPair(), "c", false, true));
-#line 3881 "runtime.in"
- addFunc(ve, run::gen319, realArray(), "cubicroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false), formal(primReal(), "d", false, false));
-#line 3891 "runtime.in"
- addFunc(ve, run::gen320, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
-#line 3899 "runtime.in"
- addFunc(ve, run::gen321, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
-#line 3904 "runtime.in"
- addFunc(ve, run::gen322, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
-#line 3909 "runtime.in"
- addFunc(ve, run::gen323, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
-#line 3914 "runtime.in"
- addFunc(ve, run::gen324, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false));
-#line 3919 "runtime.in"
- addFunc(ve, run::gen325, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false));
-#line 3924 "runtime.in"
- addFunc(ve, run::gen326, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false));
+ addFunc(ve, run::gen_runtime317, primPair(), "gamma", formal(primPair(), "z", false, true));
+#line 3842 "runtime.in"
+ addFunc(ve, run::gen_runtime318, realArray(), "quadraticroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false));
+#line 3851 "runtime.in"
+ addFunc(ve, run::gen_runtime319, pairArray(), "quadraticroots", formal(primPair(), "a", false, true), formal(primPair(), "b", false, true), formal(primPair(), "c", false, true));
+#line 3860 "runtime.in"
+ addFunc(ve, run::gen_runtime320, realArray(), "cubicroots", formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "c", false, false), formal(primReal(), "d", false, false));
+#line 3870 "runtime.in"
+ addFunc(ve, run::gen_runtime321, primBoolean(), "==", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
+#line 3878 "runtime.in"
+ addFunc(ve, run::gen_runtime322, primBoolean(), "!=", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
+#line 3883 "runtime.in"
+ addFunc(ve, run::gen_runtime323, primTransform(), "+", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
+#line 3888 "runtime.in"
+ addFunc(ve, run::gen_runtime324, primTransform(), "*", formal(primTransform(), "a", false, false), formal(primTransform(), "b", false, false));
+#line 3893 "runtime.in"
+ addFunc(ve, run::gen_runtime325, primPair(), "*", formal(primTransform(), "t", false, false), formal(primPair(), "z", false, false));
+#line 3898 "runtime.in"
+ addFunc(ve, run::gen_runtime326, primPath(), "*", formal(primTransform(), "t", false, false), formal(primPath(), "g", false, false));
+#line 3903 "runtime.in"
+ addFunc(ve, run::gen_runtime327, primPen(), "*", formal(primTransform(), "t", false, false), formal(primPen(), "p", false, false));
+#line 3908 "runtime.in"
+ addFunc(ve, run::gen_runtime328, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false));
+#line 3913 "runtime.in"
+ addFunc(ve, run::gen_runtime329, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false));
+#line 3918 "runtime.in"
+ addFunc(ve, run::gen_runtime330, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false));
#line 3929 "runtime.in"
- addFunc(ve, run::gen327, primPicture(), "*", formal(primTransform(), "t", false, false), formal(primPicture(), "f", false, false));
+ REGISTER_BLTIN(run::transformXPart,"transformXPart");
#line 3934 "runtime.in"
- addFunc(ve, run::gen328, primPicture(), "*", formal(realArray2(), "t", false, false), formal(primPicture(), "f", false, false));
+ REGISTER_BLTIN(run::transformYPart,"transformYPart");
#line 3939 "runtime.in"
- addFunc(ve, run::gen329, primTransform(), "^", formal(primTransform(), "t", false, false), formal(primInt(), "n", false, false));
-#line 3986 "runtime.in"
- addFunc(ve, run::gen337, primTransform(), "shift", formal(primTransform(), "t", false, false));
-#line 3991 "runtime.in"
- addFunc(ve, run::gen338, primTransform(), "shiftless", formal(primTransform(), "t", false, false));
-#line 3996 "runtime.in"
+ REGISTER_BLTIN(run::transformXXPart,"transformXXPart");
+#line 3944 "runtime.in"
+ REGISTER_BLTIN(run::transformXYPart,"transformXYPart");
+#line 3949 "runtime.in"
+ REGISTER_BLTIN(run::transformYXPart,"transformYXPart");
+#line 3954 "runtime.in"
+ REGISTER_BLTIN(run::transformYYPart,"transformYYPart");
+#line 3959 "runtime.in"
+ REGISTER_BLTIN(run::real6ToTransform,"real6ToTransform");
+#line 3965 "runtime.in"
+ addFunc(ve, run::gen_runtime338, primTransform(), "shift", formal(primTransform(), "t", false, false));
+#line 3970 "runtime.in"
+ addFunc(ve, run::gen_runtime339, primTransform(), "shiftless", formal(primTransform(), "t", false, false));
+#line 3975 "runtime.in"
addFunc(ve, run::transformIdentity, primTransform(), "identity");
-#line 4001 "runtime.in"
- addFunc(ve, run::gen340, primTransform(), "inverse", formal(primTransform(), "t", false, false));
-#line 4006 "runtime.in"
- addFunc(ve, run::gen341, primTransform(), "shift", formal(primPair(), "z", false, false));
-#line 4011 "runtime.in"
- addFunc(ve, run::gen342, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
-#line 4016 "runtime.in"
- addFunc(ve, run::gen343, primTransform(), "xscale", formal(primReal(), "x", false, false));
-#line 4021 "runtime.in"
- addFunc(ve, run::gen344, primTransform(), "yscale", formal(primReal(), "y", false, false));
-#line 4026 "runtime.in"
- addFunc(ve, run::gen345, primTransform(), "scale", formal(primReal(), "x", false, false));
-#line 4031 "runtime.in"
- addFunc(ve, run::gen346, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
-#line 4036 "runtime.in"
- addFunc(ve, run::gen347, primTransform(), "slant", formal(primReal(), "s", false, false));
-#line 4041 "runtime.in"
- addFunc(ve, run::gen348, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false));
-#line 4046 "runtime.in"
- addFunc(ve, run::gen349, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false));
-#line 4069 "runtime.in"
+#line 3980 "runtime.in"
+ addFunc(ve, run::gen_runtime341, primTransform(), "inverse", formal(primTransform(), "t", false, false));
+#line 3985 "runtime.in"
+ addFunc(ve, run::gen_runtime342, primTransform(), "shift", formal(primPair(), "z", false, false));
+#line 3990 "runtime.in"
+ addFunc(ve, run::gen_runtime343, primTransform(), "shift", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
+#line 3995 "runtime.in"
+ addFunc(ve, run::gen_runtime344, primTransform(), "xscale", formal(primReal(), "x", false, false));
+#line 4000 "runtime.in"
+ addFunc(ve, run::gen_runtime345, primTransform(), "yscale", formal(primReal(), "y", false, false));
+#line 4005 "runtime.in"
+ addFunc(ve, run::gen_runtime346, primTransform(), "scale", formal(primReal(), "x", false, false));
+#line 4010 "runtime.in"
+ addFunc(ve, run::gen_runtime347, primTransform(), "scale", formal(primReal(), "x", false, false), formal(primReal(), "y", false, false));
+#line 4015 "runtime.in"
+ addFunc(ve, run::gen_runtime348, primTransform(), "slant", formal(primReal(), "s", false, false));
+#line 4020 "runtime.in"
+ addFunc(ve, run::gen_runtime349, primTransform(), "rotate", formal(primReal(), "angle", false, false), formal(primPair(), "z", true, false));
+#line 4025 "runtime.in"
+ addFunc(ve, run::gen_runtime350, primTransform(), "reflect", formal(primPair(), "a", false, false), formal(primPair(), "b", false, false));
+#line 4030 "runtime.in"
+ REGISTER_BLTIN(run::pairZero,"pairZero");
+#line 4038 "runtime.in"
+ REGISTER_BLTIN(run::realRealToPair,"realRealToPair");
+#line 4043 "runtime.in"
+ REGISTER_BLTIN(run::pairNegate,"pairNegate");
+#line 4048 "runtime.in"
addFunc(ve, run::pairXPart, primReal(), "xpart", formal(primPair(), "z", false, false));
-#line 4074 "runtime.in"
+#line 4053 "runtime.in"
addFunc(ve, run::pairYPart, primReal(), "ypart", formal(primPair(), "z", false, false));
-#line 4079 "runtime.in"
- addFunc(ve, run::gen355, primReal(), "length", formal(primPair(), "z", false, false));
-#line 4084 "runtime.in"
- addFunc(ve, run::gen356, primReal(), "abs", formal(primPair(), "z", false, false));
-#line 4089 "runtime.in"
- addFunc(ve, run::gen357, primPair(), "sqrt", formal(primPair(), "z", false, true));
-#line 4094 "runtime.in"
- addFunc(ve, run::gen358, primReal(), "angle", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false));
-#line 4101 "runtime.in"
- addFunc(ve, run::gen359, primReal(), "degrees", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false));
-#line 4108 "runtime.in"
- addFunc(ve, run::gen360, primReal(), "radians", formal(primReal(), "degrees", false, false));
-#line 4114 "runtime.in"
- addFunc(ve, run::gen361, primReal(), "degrees", formal(primReal(), "radians", false, false));
+#line 4058 "runtime.in"
+ addFunc(ve, run::gen_runtime356, primReal(), "length", formal(primPair(), "z", false, false));
+#line 4063 "runtime.in"
+ addFunc(ve, run::gen_runtime357, primReal(), "abs", formal(primPair(), "z", false, false));
+#line 4068 "runtime.in"
+ addFunc(ve, run::gen_runtime358, primPair(), "sqrt", formal(primPair(), "z", false, true));
+#line 4073 "runtime.in"
+ addFunc(ve, run::gen_runtime359, primReal(), "angle", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false));
+#line 4080 "runtime.in"
+ addFunc(ve, run::gen_runtime360, primReal(), "degrees", formal(primPair(), "z", false, false), formal(primBoolean(), "warn", true, false));
+#line 4087 "runtime.in"
+ addFunc(ve, run::gen_runtime361, primReal(), "radians", formal(primReal(), "degrees", false, false));
+#line 4093 "runtime.in"
+ addFunc(ve, run::gen_runtime362, primReal(), "degrees", formal(primReal(), "radians", false, false));
+#line 4099 "runtime.in"
+ addFunc(ve, run::gen_runtime363, primReal(), "Degrees", formal(primReal(), "radians", false, false));
+#line 4105 "runtime.in"
+ addFunc(ve, run::gen_runtime364, primReal(), "Sin", formal(primReal(), "deg", false, false));
+#line 4110 "runtime.in"
+ addFunc(ve, run::gen_runtime365, primReal(), "Cos", formal(primReal(), "deg", false, false));
+#line 4115 "runtime.in"
+ addFunc(ve, run::gen_runtime366, primReal(), "Tan", formal(primReal(), "deg", false, false));
#line 4120 "runtime.in"
- addFunc(ve, run::gen362, primReal(), "Degrees", formal(primReal(), "radians", false, false));
-#line 4126 "runtime.in"
- addFunc(ve, run::gen363, primReal(), "Sin", formal(primReal(), "deg", false, false));
-#line 4131 "runtime.in"
- addFunc(ve, run::gen364, primReal(), "Cos", formal(primReal(), "deg", false, false));
-#line 4136 "runtime.in"
- addFunc(ve, run::gen365, primReal(), "Tan", formal(primReal(), "deg", false, false));
-#line 4141 "runtime.in"
- addFunc(ve, run::gen366, primReal(), "aSin", formal(primReal(), "x", false, false));
-#line 4146 "runtime.in"
- addFunc(ve, run::gen367, primReal(), "aCos", formal(primReal(), "x", false, false));
-#line 4151 "runtime.in"
- addFunc(ve, run::gen368, primReal(), "aTan", formal(primReal(), "x", false, false));
-#line 4156 "runtime.in"
- addFunc(ve, run::gen369, primPair(), "unit", formal(primPair(), "z", false, false));
-#line 4161 "runtime.in"
- addFunc(ve, run::gen370, primPair(), "dir", formal(primReal(), "degrees", false, false));
-#line 4166 "runtime.in"
- addFunc(ve, run::gen371, primPair(), "dir", formal(primPair(), "z", false, true));
-#line 4171 "runtime.in"
- addFunc(ve, run::gen372, primPair(), "expi", formal(primReal(), "angle", false, false));
-#line 4176 "runtime.in"
- addFunc(ve, run::gen373, primPair(), "exp", formal(primPair(), "z", false, true));
-#line 4181 "runtime.in"
- addFunc(ve, run::gen374, primPair(), "log", formal(primPair(), "z", false, true));
-#line 4186 "runtime.in"
- addFunc(ve, run::gen375, primPair(), "sin", formal(primPair(), "z", false, true));
-#line 4191 "runtime.in"
- addFunc(ve, run::gen376, primPair(), "cos", formal(primPair(), "z", false, true));
+ addFunc(ve, run::gen_runtime367, primReal(), "aSin", formal(primReal(), "x", false, false));
+#line 4125 "runtime.in"
+ addFunc(ve, run::gen_runtime368, primReal(), "aCos", formal(primReal(), "x", false, false));
+#line 4130 "runtime.in"
+ addFunc(ve, run::gen_runtime369, primReal(), "aTan", formal(primReal(), "x", false, false));
+#line 4135 "runtime.in"
+ addFunc(ve, run::gen_runtime370, primPair(), "unit", formal(primPair(), "z", false, false));
+#line 4140 "runtime.in"
+ addFunc(ve, run::gen_runtime371, primPair(), "dir", formal(primReal(), "degrees", false, false));
+#line 4145 "runtime.in"
+ addFunc(ve, run::gen_runtime372, primPair(), "dir", formal(primPair(), "z", false, true));
+#line 4150 "runtime.in"
+ addFunc(ve, run::gen_runtime373, primPair(), "expi", formal(primReal(), "angle", false, false));
+#line 4155 "runtime.in"
+ addFunc(ve, run::gen_runtime374, primPair(), "exp", formal(primPair(), "z", false, true));
+#line 4160 "runtime.in"
+ addFunc(ve, run::gen_runtime375, primPair(), "log", formal(primPair(), "z", false, true));
+#line 4165 "runtime.in"
+ addFunc(ve, run::gen_runtime376, primPair(), "sin", formal(primPair(), "z", false, true));
+#line 4170 "runtime.in"
+ addFunc(ve, run::gen_runtime377, primPair(), "cos", formal(primPair(), "z", false, true));
+#line 4175 "runtime.in"
+ addFunc(ve, run::gen_runtime378, primPair(), "conj", formal(primPair(), "z", false, false));
+#line 4180 "runtime.in"
+ addFunc(ve, run::gen_runtime379, primPair(), "realmult", formal(primPair(), "z", false, false), formal(primPair(), "w", false, false));
+#line 4185 "runtime.in"
+ addFunc(ve, run::gen_runtime380, primTriple(), "realmult", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
+#line 4190 "runtime.in"
+ addFunc(ve, run::gen_runtime381, primReal(), "dot", formal(primPair(), "z", false, true), formal(primPair(), "w", false, true));
#line 4196 "runtime.in"
- addFunc(ve, run::gen377, primPair(), "conj", formal(primPair(), "z", false, false));
-#line 4201 "runtime.in"
- addFunc(ve, run::gen378, primPair(), "realmult", formal(primPair(), "z", false, false), formal(primPair(), "w", false, false));
-#line 4206 "runtime.in"
- addFunc(ve, run::gen379, primTriple(), "realmult", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
-#line 4211 "runtime.in"
- addFunc(ve, run::gen380, primReal(), "dot", formal(primPair(), "z", false, true), formal(primPair(), "w", false, true));
-#line 4231 "runtime.in"
+ REGISTER_BLTIN(run::tripleZero,"tripleZero");
+#line 4205 "runtime.in"
+ REGISTER_BLTIN(run::realRealRealToTriple,"realRealRealToTriple");
+#line 4210 "runtime.in"
addFunc(ve, run::tripleXPart, primReal(), "xpart", formal(primTriple(), "v", false, false));
-#line 4236 "runtime.in"
+#line 4215 "runtime.in"
addFunc(ve, run::tripleYPart, primReal(), "ypart", formal(primTriple(), "v", false, false));
-#line 4241 "runtime.in"
+#line 4220 "runtime.in"
addFunc(ve, run::tripleZPart, primReal(), "zpart", formal(primTriple(), "v", false, false));
-#line 4246 "runtime.in"
- addFunc(ve, run::gen386, primTriple(), "*", formal(primReal(), "x", false, false), formal(primTriple(), "v", false, false));
-#line 4251 "runtime.in"
- addFunc(ve, run::gen387, primTriple(), "*", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false));
+#line 4225 "runtime.in"
+ addFunc(ve, run::gen_runtime387, primTriple(), "*", formal(primReal(), "x", false, false), formal(primTriple(), "v", false, false));
+#line 4230 "runtime.in"
+ addFunc(ve, run::gen_runtime388, primTriple(), "*", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false));
+#line 4235 "runtime.in"
+ addFunc(ve, run::gen_runtime389, primTriple(), "/", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false));
+#line 4240 "runtime.in"
+ addFunc(ve, run::gen_runtime390, primReal(), "length", formal(primTriple(), "v", false, false));
+#line 4245 "runtime.in"
+ addFunc(ve, run::gen_runtime391, primReal(), "abs", formal(primTriple(), "v", false, false));
+#line 4250 "runtime.in"
+ addFunc(ve, run::gen_runtime392, primReal(), "polar", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
#line 4256 "runtime.in"
- addFunc(ve, run::gen388, primTriple(), "/", formal(primTriple(), "v", false, false), formal(primReal(), "x", false, false));
-#line 4261 "runtime.in"
- addFunc(ve, run::gen389, primReal(), "length", formal(primTriple(), "v", false, false));
-#line 4266 "runtime.in"
- addFunc(ve, run::gen390, primReal(), "abs", formal(primTriple(), "v", false, false));
-#line 4271 "runtime.in"
- addFunc(ve, run::gen391, primReal(), "polar", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
-#line 4277 "runtime.in"
- addFunc(ve, run::gen392, primReal(), "azimuth", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
-#line 4283 "runtime.in"
- addFunc(ve, run::gen393, primReal(), "colatitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
-#line 4289 "runtime.in"
- addFunc(ve, run::gen394, primReal(), "latitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
-#line 4295 "runtime.in"
- addFunc(ve, run::gen395, primReal(), "longitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
-#line 4302 "runtime.in"
- addFunc(ve, run::gen396, primTriple(), "unit", formal(primTriple(), "v", false, false));
-#line 4307 "runtime.in"
- addFunc(ve, run::gen397, primReal(), "dot", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
-#line 4312 "runtime.in"
- addFunc(ve, run::gen398, primTriple(), "cross", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
-#line 4317 "runtime.in"
- addFunc(ve, run::gen399, primTriple(), "expi", formal(primReal(), "polar", false, false), formal(primReal(), "azimuth", false, false));
-#line 4322 "runtime.in"
- addFunc(ve, run::gen400, primTriple(), "dir", formal(primReal(), "colatitude", false, false), formal(primReal(), "longitude", false, false));
-#line 4327 "runtime.in"
- addFunc(ve, run::gen401, primVoid(), "atupdate", formal(voidFunction(), "f", false, false));
-#line 4335 "runtime.in"
- addFunc(ve, run::gen402, voidFunction(), "atupdate");
-#line 4340 "runtime.in"
- addFunc(ve, run::gen403, primVoid(), "atexit", formal(voidFunction(), "f", false, false));
-#line 4345 "runtime.in"
- addFunc(ve, run::gen404, voidFunction(), "atexit");
-#line 4350 "runtime.in"
- addFunc(ve, run::gen405, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false));
-#line 4355 "runtime.in"
- addFunc(ve, run::gen406, primVoid(), "breakpoint", formal(primCode(), "s", true, false));
-#line 4360 "runtime.in"
- addFunc(ve, run::gen407, primString() , "locatefile", formal(primString() , "file", false, false));
-#line 4365 "runtime.in"
- addFunc(ve, run::gen408, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false));
-#line 4373 "runtime.in"
- addFunc(ve, run::gen409, primVoid(), "breakpoints");
+ addFunc(ve, run::gen_runtime393, primReal(), "azimuth", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
+#line 4262 "runtime.in"
+ addFunc(ve, run::gen_runtime394, primReal(), "colatitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
+#line 4268 "runtime.in"
+ addFunc(ve, run::gen_runtime395, primReal(), "latitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
+#line 4274 "runtime.in"
+ addFunc(ve, run::gen_runtime396, primReal(), "longitude", formal(primTriple(), "v", false, false), formal(primBoolean(), "warn", true, false));
+#line 4281 "runtime.in"
+ addFunc(ve, run::gen_runtime397, primTriple(), "unit", formal(primTriple(), "v", false, false));
+#line 4286 "runtime.in"
+ addFunc(ve, run::gen_runtime398, primReal(), "dot", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
+#line 4291 "runtime.in"
+ addFunc(ve, run::gen_runtime399, primTriple(), "cross", formal(primTriple(), "u", false, false), formal(primTriple(), "v", false, false));
+#line 4296 "runtime.in"
+ addFunc(ve, run::gen_runtime400, primTriple(), "dir", formal(primTriple(), "z", false, true));
+#line 4301 "runtime.in"
+ addFunc(ve, run::gen_runtime401, primTriple(), "expi", formal(primReal(), "polar", false, false), formal(primReal(), "azimuth", false, false));
+#line 4306 "runtime.in"
+ addFunc(ve, run::gen_runtime402, primTriple(), "dir", formal(primReal(), "colatitude", false, false), formal(primReal(), "longitude", false, false));
+#line 4311 "runtime.in"
+ addFunc(ve, run::gen_runtime403, primVoid(), "atupdate", formal(voidFunction(), "f", false, false));
+#line 4319 "runtime.in"
+ addFunc(ve, run::gen_runtime404, voidFunction(), "atupdate");
+#line 4324 "runtime.in"
+ addFunc(ve, run::gen_runtime405, primVoid(), "atexit", formal(voidFunction(), "f", false, false));
+#line 4329 "runtime.in"
+ addFunc(ve, run::gen_runtime406, voidFunction(), "atexit");
+#line 4334 "runtime.in"
+ addFunc(ve, run::gen_runtime407, primVoid(), "atbreakpoint", formal(breakpointFunction(), "f", false, false));
+#line 4339 "runtime.in"
+ addFunc(ve, run::gen_runtime408, primVoid(), "breakpoint", formal(primCode(), "s", true, false));
+#line 4344 "runtime.in"
+ addFunc(ve, run::gen_runtime409, primString() , "locatefile", formal(primString() , "file", false, false));
+#line 4349 "runtime.in"
+ addFunc(ve, run::gen_runtime410, primVoid(), "stop", formal(primString() , "file", false, false), formal(primInt(), "line", false, false), formal(primCode(), "s", true, false));
+#line 4357 "runtime.in"
+ addFunc(ve, run::gen_runtime411, primVoid(), "breakpoints");
+#line 4363 "runtime.in"
+ addFunc(ve, run::gen_runtime412, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false));
+#line 4369 "runtime.in"
+ addFunc(ve, run::gen_runtime413, primVoid(), "clear");
+#line 4374 "runtime.in"
+ addFunc(ve, run::gen_runtime414, primVoid(), "warn", formal(primString() , "s", false, false));
#line 4379 "runtime.in"
- addFunc(ve, run::gen410, primVoid(), "clear", formal(primString() , "file", false, false), formal(primInt(), "line", false, false));
-#line 4385 "runtime.in"
- addFunc(ve, run::gen411, primVoid(), "clear");
-#line 4390 "runtime.in"
- addFunc(ve, run::gen412, primVoid(), "warn", formal(primString() , "s", false, false));
-#line 4395 "runtime.in"
- addFunc(ve, run::gen413, primVoid(), "nowarn", formal(primString() , "s", false, false));
-#line 4400 "runtime.in"
- addFunc(ve, run::gen414, primString() , "stripdirectory", formal(primString(), "s", false, false));
-#line 4406 "runtime.in"
- addFunc(ve, run::gen415, primString() , "stripfile", formal(primString(), "s", false, false));
-#line 4412 "runtime.in"
- addFunc(ve, run::gen416, primString() , "stripextension", formal(primString(), "s", false, false));
-#line 4418 "runtime.in"
- addFunc(ve, run::gen417, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false));
-#line 4437 "runtime.in"
- addFunc(ve, run::gen418, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false));
-#line 4454 "runtime.in"
- addFunc(ve, run::gen419, primInt(), "delete", formal(primString(), "s", false, false));
-#line 4464 "runtime.in"
- addFunc(ve, run::gen420, primInt(), "rename", formal(primString(), "from", false, false), formal(primString(), "to", false, false));
-#line 4763 "runtime.in"
- addFunc(ve, run::gen451, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false));
-#line 4795 "runtime.in"
- addFunc(ve, run::gen453, IntArray(), "sequence", formal(primInt(), "n", false, false));
-#line 4828 "runtime.in"
- addFunc(ve, run::gen456, primBoolean(), "all", formal(boolArray(), "a", false, false));
-#line 4837 "runtime.in"
- addFunc(ve, run::gen457, boolArray(), "!", formal(boolArray(), "a", false, false));
-#line 4846 "runtime.in"
- addFunc(ve, run::gen458, primInt(), "sum", formal(boolArray(), "a", false, false));
-#line 5009 "runtime.in"
- addFunc(ve, run::gen465, primInt(), "find", formal(boolArray(), "a", false, false), formal(primInt(), "n", true, false));
-#line 5054 "runtime.in"
- addFunc(ve, run::gen467, realArray2(), "identity", formal(primInt(), "n", false, false));
-#line 5077 "runtime.in"
- addFunc(ve, run::gen469, realArray2(), "inverse", formal(realArray2(), "a", false, false));
-#line 5169 "runtime.in"
- addFunc(ve, run::gen470, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false));
-#line 5220 "runtime.in"
- addFunc(ve, run::gen471, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false));
-#line 5284 "runtime.in"
- addFunc(ve, run::gen472, primReal(), "determinant", formal(realArray2(), "a", false, false));
-#line 5300 "runtime.in"
- addFunc(ve, run::gen473, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false));
-#line 5318 "runtime.in"
- addFunc(ve, run::gen474, realArray(), "*", formal(realArray(), "a", false, false), formal(realArray2(), "b", false, false));
-#line 5346 "runtime.in"
- addFunc(ve, run::gen475, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false));
-#line 5381 "runtime.in"
- addFunc(ve, run::gen476, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false));
-#line 5386 "runtime.in"
- addFunc(ve, run::gen477, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false));
-#line 5411 "runtime.in"
- addFunc(ve, run::gen478, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false));
-#line 5421 "runtime.in"
- addFunc(ve, run::gen479, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false));
-#line 5525 "runtime.in"
- addFunc(ve, run::gen480, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false));
-#line 5572 "runtime.in"
- addFunc(ve, run::gen481, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false));
-#line 5654 "runtime.in"
- addFunc(ve, run::gen482, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false));
-#line 5696 "runtime.in"
- addFunc(ve, run::gen484, IntArray2(), "triangulate", formal(pairArray(), "z", false, false));
-#line 5731 "runtime.in"
- addFunc(ve, run::gen485, primBoolean(), "==", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false));
-#line 5739 "runtime.in"
- addFunc(ve, run::gen486, primBoolean(), "!=", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false));
-#line 5749 "runtime.in"
- addFunc(ve, run::gen488, primFile(), "input", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false), formal(primString() , "comment", true, false));
-#line 5757 "runtime.in"
- addFunc(ve, run::gen489, primFile(), "output", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false), formal(primString() , "comment", true, false));
-#line 5769 "runtime.in"
- addFunc(ve, run::gen490, primFile(), "xinput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false));
-#line 5783 "runtime.in"
- addFunc(ve, run::gen491, primFile(), "xoutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false));
-#line 5801 "runtime.in"
- addFunc(ve, run::gen492, primFile(), "binput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false));
-#line 5808 "runtime.in"
- addFunc(ve, run::gen493, primFile(), "boutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false));
-#line 5818 "runtime.in"
- addFunc(ve, run::gen494, primBoolean(), "eof", formal(primFile(), "f", false, false));
-#line 5823 "runtime.in"
- addFunc(ve, run::gen495, primBoolean(), "eol", formal(primFile(), "f", false, false));
-#line 5828 "runtime.in"
- addFunc(ve, run::gen496, primBoolean(), "error", formal(primFile(), "f", false, false));
-#line 5833 "runtime.in"
- addFunc(ve, run::gen497, primVoid(), "clear", formal(primFile(), "f", false, false));
-#line 5838 "runtime.in"
- addFunc(ve, run::gen498, primVoid(), "close", formal(primFile(), "f", false, false));
-#line 5843 "runtime.in"
- addFunc(ve, run::gen499, primInt(), "precision", formal(primFile(), "f", true, false), formal(primInt(), "digits", true, false));
-#line 5849 "runtime.in"
- addFunc(ve, run::gen500, primVoid(), "flush", formal(primFile(), "f", false, false));
-#line 5854 "runtime.in"
- addFunc(ve, run::gen501, primString() , "getc", formal(primFile(), "f", false, false));
-#line 5863 "runtime.in"
- addFunc(ve, run::gen502, primInt(), "tell", formal(primFile(), "f", false, false));
-#line 5868 "runtime.in"
- addFunc(ve, run::gen503, primVoid(), "seek", formal(primFile(), "f", false, false), formal(primInt(), "pos", false, false));
-#line 5873 "runtime.in"
- addFunc(ve, run::gen504, primVoid(), "seekeof", formal(primFile(), "f", false, false));
-#line 5878 "runtime.in"
- addFunc(ve, run::gen505, primFile(), "dimension", formal(primFile(), "f", false, false), formal(primInt(), "nx", false, false));
-#line 5885 "runtime.in"
- addFunc(ve, run::gen506, primFile(), "dimension", formal(primFile(), "f", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false));
-#line 5891 "runtime.in"
- addFunc(ve, run::gen507, primFile(), "dimension", formal(primFile(), "f", false, false), formal(primInt(), "nx", false, false), formal(primInt(), "ny", false, false), formal(primInt(), "nz", false, false));
-#line 5897 "runtime.in"
- addFunc(ve, run::gen508, primFile(), "csv", formal(primFile(), "f", false, false), formal(primBoolean(), "b", true, false));
-#line 5904 "runtime.in"
- addFunc(ve, run::gen509, primFile(), "word", formal(primFile(), "f", false, false), formal(primBoolean(), "b", true, false));
-#line 5911 "runtime.in"
- addFunc(ve, run::gen510, primFile(), "line", formal(primFile(), "f", false, false), formal(primBoolean(), "b", true, false));
-#line 5918 "runtime.in"
- addFunc(ve, run::gen511, primFile(), "signed", formal(primFile(), "f", false, false), formal(primBoolean(), "b", true, false));
-#line 5974 "runtime.in"
- addFunc(ve, run::gen521, primFile(), "read1", formal(primFile(), "f", false, false));
-#line 5981 "runtime.in"
- addFunc(ve, run::gen522, primFile(), "read2", formal(primFile(), "f", false, false));
+ addFunc(ve, run::gen_runtime415, primVoid(), "nowarn", formal(primString() , "s", false, false));
+#line 4384 "runtime.in"
+ addFunc(ve, run::gen_runtime416, primVoid(), "warning", formal(primString() , "s", false, false), formal(primString() , "t", false, false), formal(primBoolean(), "position", true, false));
+#line 4392 "runtime.in"
+ addFunc(ve, run::gen_runtime417, primString() , "stripdirectory", formal(primString(), "s", false, false));
+#line 4398 "runtime.in"
+ addFunc(ve, run::gen_runtime418, primString() , "stripfile", formal(primString(), "s", false, false));
+#line 4404 "runtime.in"
+ addFunc(ve, run::gen_runtime419, primString() , "stripextension", formal(primString(), "s", false, false));
+#line 4410 "runtime.in"
+ addFunc(ve, run::gen_runtime420, primInt(), "convert", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false));
+#line 4429 "runtime.in"
+ addFunc(ve, run::gen_runtime421, primInt(), "animate", formal(primString() , "args", true, false), formal(primString() , "file", true, false), formal(primString() , "format", true, false));
+#line 4446 "runtime.in"
+ addFunc(ve, run::gen_runtime422, primInt(), "delete", formal(primString(), "s", false, false));
+#line 4456 "runtime.in"
+ addFunc(ve, run::gen_runtime423, primInt(), "rename", formal(primString(), "from", false, false), formal(primString(), "to", false, false));
+#line 4467 "runtime.in"
+ REGISTER_BLTIN(run::emptyArray,"emptyArray");
+#line 4476 "runtime.in"
+ REGISTER_BLTIN(run::newDeepArray,"newDeepArray");
+#line 4498 "runtime.in"
+ REGISTER_BLTIN(run::newInitializedArray,"newInitializedArray");
+#line 4513 "runtime.in"
+ REGISTER_BLTIN(run::newAppendedArray,"newAppendedArray");
+#line 4529 "runtime.in"
+ REGISTER_BLTIN(run::newDuplicateArray,"newDuplicateArray");
+#line 4539 "runtime.in"
+ REGISTER_BLTIN(run::arrayRead,"arrayRead");
+#line 4551 "runtime.in"
+ REGISTER_BLTIN(run::arraySliceRead,"arraySliceRead");
+#line 4558 "runtime.in"
+ REGISTER_BLTIN(run::arraySliceReadToEnd,"arraySliceReadToEnd");
+#line 4566 "runtime.in"
+ REGISTER_BLTIN(run::arrayArrayRead,"arrayArrayRead");
+#line 4575 "runtime.in"
+ REGISTER_BLTIN(run::arrayWrite,"arrayWrite");
+#line 4591 "runtime.in"
+ REGISTER_BLTIN(run::arraySliceWrite,"arraySliceWrite");
+#line 4599 "runtime.in"
+ REGISTER_BLTIN(run::arraySliceWriteToEnd,"arraySliceWriteToEnd");
+#line 4607 "runtime.in"
+ REGISTER_BLTIN(run::arrayLength,"arrayLength");
+#line 4613 "runtime.in"
+ REGISTER_BLTIN(run::arrayKeys,"arrayKeys");
+#line 4628 "runtime.in"
+ REGISTER_BLTIN(run::arrayCyclicFlag,"arrayCyclicFlag");
+#line 4635 "runtime.in"
+ REGISTER_BLTIN(run::arraySetCyclicFlag,"arraySetCyclicFlag");
+#line 4642 "runtime.in"
+ REGISTER_BLTIN(run::arrayInitializedHelper,"arrayInitializedHelper");
+#line 4653 "runtime.in"
+ REGISTER_BLTIN(run::arrayInitialized,"arrayInitialized");
+#line 4659 "runtime.in"
+ REGISTER_BLTIN(run::arrayCyclicHelper,"arrayCyclicHelper");
+#line 4666 "runtime.in"
+ REGISTER_BLTIN(run::arrayCyclic,"arrayCyclic");
+#line 4672 "runtime.in"
+ REGISTER_BLTIN(run::arrayPushHelper,"arrayPushHelper");
+#line 4680 "runtime.in"
+ REGISTER_BLTIN(run::arrayPush,"arrayPush");
+#line 4686 "runtime.in"
+ REGISTER_BLTIN(run::arrayAppendHelper,"arrayAppendHelper");
+#line 4695 "runtime.in"
+ REGISTER_BLTIN(run::arrayAppend,"arrayAppend");
+#line 4701 "runtime.in"
+ REGISTER_BLTIN(run::arrayPopHelper,"arrayPopHelper");
+#line 4710 "runtime.in"
+ REGISTER_BLTIN(run::arrayPop,"arrayPop");
+#line 4716 "runtime.in"
+ REGISTER_BLTIN(run::arrayInsertHelper,"arrayInsertHelper");
+#line 4727 "runtime.in"
+ REGISTER_BLTIN(run::arrayInsert,"arrayInsert");
+#line 4733 "runtime.in"
+ REGISTER_BLTIN(run::arrayDelete,"arrayDelete");
+#line 4739 "runtime.in"
+ REGISTER_BLTIN(run::arrayAlias,"arrayAlias");
+#line 4744 "runtime.in"
+ REGISTER_BLTIN(run::arrayIntArray,"arrayIntArray");
+#line 4762 "runtime.in"
+ addFunc(ve, run::gen_runtime455, IntArray(), "complement", formal(IntArray(), "a", false, false), formal(primInt(), "n", false, false));
+#line 4781 "runtime.in"
+ REGISTER_BLTIN(run::arraySequence,"arraySequence");
+#line 4794 "runtime.in"
+ addFunc(ve, run::gen_runtime457, IntArray(), "sequence", formal(primInt(), "n", false, false));
+#line 4805 "runtime.in"
+ REGISTER_BLTIN(run::arrayFunction,"arrayFunction");
+#line 4818 "runtime.in"
+ REGISTER_BLTIN(run::arraySort,"arraySort");
+#line 4827 "runtime.in"
+ addFunc(ve, run::gen_runtime460, primBoolean(), "all", formal(booleanArray(), "a", false, false));
+#line 4836 "runtime.in"
+ addFunc(ve, run::gen_runtime461, booleanArray(), "!", formal(booleanArray(), "a", false, false));
+#line 4845 "runtime.in"
+ addFunc(ve, run::gen_runtime462, primInt(), "sum", formal(booleanArray(), "a", false, false));
+#line 4854 "runtime.in"
+ REGISTER_BLTIN(run::arrayCopy,"arrayCopy");
+#line 4859 "runtime.in"
+ REGISTER_BLTIN(run::arrayConcat,"arrayConcat");
+#line 4887 "runtime.in"
+ REGISTER_BLTIN(run::array2Copy,"array2Copy");
+#line 4892 "runtime.in"
+ REGISTER_BLTIN(run::array3Copy,"array3Copy");
+#line 4897 "runtime.in"
+ REGISTER_BLTIN(run::array2Transpose,"array2Transpose");
+#line 4921 "runtime.in"
+ REGISTER_BLTIN(run::array3Transpose,"array3Transpose");
+#line 5008 "runtime.in"
+ addFunc(ve, run::gen_runtime469, primInt(), "find", formal(booleanArray(), "a", false, false), formal(primInt(), "n", true, false));
+#line 5027 "runtime.in"
+ REGISTER_BLTIN(run::arrayConditional,"arrayConditional");
+#line 5053 "runtime.in"
+ addFunc(ve, run::gen_runtime471, realArray2(), "identity", formal(primInt(), "n", false, false));
+#line 5059 "runtime.in"
+ REGISTER_BLTIN(run::diagonal,"diagonal");
+#line 5076 "runtime.in"
+ addFunc(ve, run::gen_runtime473, realArray2(), "inverse", formal(realArray2(), "a", false, false));
+#line 5168 "runtime.in"
+ addFunc(ve, run::gen_runtime474, realArray(), "solve", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false), formal(primBoolean(), "warn", true, false));
+#line 5219 "runtime.in"
+ addFunc(ve, run::gen_runtime475, realArray2(), "solve", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false), formal(primBoolean(), "warn", true, false));
+#line 5283 "runtime.in"
+ addFunc(ve, run::gen_runtime476, primReal(), "determinant", formal(realArray2(), "a", false, false));
+#line 5299 "runtime.in"
+ addFunc(ve, run::gen_runtime477, realArray(), "*", formal(realArray2(), "a", false, false), formal(realArray(), "b", false, false));
+#line 5317 "runtime.in"
+ addFunc(ve, run::gen_runtime478, realArray(), "*", formal(realArray(), "a", false, false), formal(realArray2(), "b", false, false));
+#line 5345 "runtime.in"
+ addFunc(ve, run::gen_runtime479, realArray2(), "*", formal(realArray2(), "a", false, false), formal(realArray2(), "b", false, false));
+#line 5380 "runtime.in"
+ addFunc(ve, run::gen_runtime480, primTriple(), "*", formal(realArray2(), "t", false, false), formal(primTriple(), "v", false, false));
+#line 5385 "runtime.in"
+ addFunc(ve, run::gen_runtime481, primPair(), "project", formal(primTriple(), "v", false, false), formal(realArray2(), "t", false, false));
+#line 5410 "runtime.in"
+ addFunc(ve, run::gen_runtime482, primReal(), "dot", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false));
+#line 5420 "runtime.in"
+ addFunc(ve, run::gen_runtime483, realArray(), "tridiagonal", formal(realArray(), "a", false, false), formal(realArray(), "b", false, false), formal(realArray(), "c", false, false), formal(realArray(), "f", false, false));
+#line 5524 "runtime.in"
+ addFunc(ve, run::gen_runtime484, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x", false, false), formal(primBoolean(), "verbose", true, false));
+#line 5571 "runtime.in"
+ addFunc(ve, run::gen_runtime485, primReal(), "newton", formal(primInt(), "iterations", true, false), formal(realRealFunction(), "f", false, false), formal(realRealFunction(), "fprime", false, false), formal(primReal(), "x1", false, false), formal(primReal(), "x2", false, false), formal(primBoolean(), "verbose", true, false));
+#line 5653 "runtime.in"
+ addFunc(ve, run::gen_runtime486, primReal(), "simpson", formal(realRealFunction(), "f", false, false), formal(primReal(), "a", false, false), formal(primReal(), "b", false, false), formal(primReal(), "acc", true, false), formal(primReal(), "dxmax", true, false));
+#line 5665 "runtime.in"
+ REGISTER_BLTIN(run::pairArrayFFT,"pairArrayFFT");
+#line 5695 "runtime.in"
+ addFunc(ve, run::gen_runtime488, IntArray2(), "triangulate", formal(pairArray(), "z", false, false));
+#line 5730 "runtime.in"
+ addFunc(ve, run::gen_runtime489, primBoolean(), "==", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false));
+#line 5738 "runtime.in"
+ addFunc(ve, run::gen_runtime490, primBoolean(), "!=", formal(primFile(), "a", false, false), formal(primFile(), "b", false, false));
+#line 5743 "runtime.in"
+ REGISTER_BLTIN(run::nullFile,"nullFile");
+#line 5748 "runtime.in"
+ addFunc(ve, run::gen_runtime492, primFile(), "input", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false), formal(primString() , "comment", true, false));
+#line 5756 "runtime.in"
+ addFunc(ve, run::gen_runtime493, primFile(), "output", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false), formal(primString() , "comment", true, false));
+#line 5768 "runtime.in"
+ addFunc(ve, run::gen_runtime494, primFile(), "xinput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false));
+#line 5782 "runtime.in"
+ addFunc(ve, run::gen_runtime495, primFile(), "xoutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false));
+#line 5800 "runtime.in"
+ addFunc(ve, run::gen_runtime496, primFile(), "binput", formal(primString() , "name", false, false), formal(primBoolean(), "check", true, false));
+#line 5807 "runtime.in"
+ addFunc(ve, run::gen_runtime497, primFile(), "boutput", formal(primString() , "name", false, false), formal(primBoolean(), "update", true, false));
+#line 5817 "runtime.in"
+ addFunc(ve, run::gen_runtime498, primBoolean(), "eof", formal(primFile(), "f", false, false));
+#line 5822 "runtime.in"
+ addFunc(ve, run::gen_runtime499, primBoolean(), "eol", formal(primFile(), "f", false, false));
+#line 5827 "runtime.in"
+ addFunc(ve, run::gen_runtime500, primBoolean(), "error", formal(primFile(), "f", false, false));
+#line 5832 "runtime.in"
+ addFunc(ve, run::gen_runtime501, primVoid(), "clear", formal(primFile(), "f", false, false));
+#line 5837 "runtime.in"
+ addFunc(ve, run::gen_runtime502, primVoid(), "close", formal(primFile(), "f", false, false));
+#line 5842 "runtime.in"
+ addFunc(ve, run::gen_runtime503, primInt(), "precision", formal(primFile(), "f", true, false), formal(primInt(), "digits", true, false));
+#line 5848 "runtime.in"
+ addFunc(ve, run::gen_runtime504, primVoid(), "flush", formal(primFile(), "f", false, false));
+#line 5853 "runtime.in"
+ addFunc(ve, run::gen_runtime505, primString() , "getc", formal(primFile(), "f", false, false));
+#line 5862 "runtime.in"
+ addFunc(ve, run::gen_runtime506, primInt(), "tell", formal(primFile(), "f", false, false));
+#line 5867 "runtime.in"
+ addFunc(ve, run::gen_runtime507, primVoid(), "seek", formal(primFile(), "f", false, false), formal(primInt(), "pos", false, false));
+#line 5872 "runtime.in"
+ addFunc(ve, run::gen_runtime508, primVoid(), "seekeof", formal(primFile(), "f", false, false));
+#line 5877 "runtime.in"
+ REGISTER_BLTIN(run::namePart,"namePart");
+#line 5882 "runtime.in"
+ REGISTER_BLTIN(run::modePart,"modePart");
+#line 5887 "runtime.in"
+ REGISTER_BLTIN(run::dimensionSetHelper,"dimensionSetHelper");
+#line 5894 "runtime.in"
+ REGISTER_BLTIN(run::dimensionSet,"dimensionSet");
+#line 5899 "runtime.in"
+ REGISTER_BLTIN(run::dimensionPart,"dimensionPart");
+#line 5908 "runtime.in"
+ REGISTER_BLTIN(run::lineSetHelper,"lineSetHelper");
+#line 5915 "runtime.in"
+ REGISTER_BLTIN(run::lineSet,"lineSet");
+#line 5920 "runtime.in"
+ REGISTER_BLTIN(run::linePart,"linePart");
+#line 5925 "runtime.in"
+ REGISTER_BLTIN(run::csvSetHelper,"csvSetHelper");
+#line 5932 "runtime.in"
+ REGISTER_BLTIN(run::csvSet,"csvSet");
+#line 5937 "runtime.in"
+ REGISTER_BLTIN(run::csvPart,"csvPart");
+#line 5942 "runtime.in"
+ REGISTER_BLTIN(run::wordSetHelper,"wordSetHelper");
+#line 5949 "runtime.in"
+ REGISTER_BLTIN(run::wordSet,"wordSet");
+#line 5954 "runtime.in"
+ REGISTER_BLTIN(run::wordPart,"wordPart");
+#line 5959 "runtime.in"
+ REGISTER_BLTIN(run::singlerealSetHelper,"singlerealSetHelper");
+#line 5966 "runtime.in"
+ REGISTER_BLTIN(run::singlerealSet,"singlerealSet");
+#line 5971 "runtime.in"
+ REGISTER_BLTIN(run::singlerealPart,"singlerealPart");
+#line 5976 "runtime.in"
+ REGISTER_BLTIN(run::singleintSetHelper,"singleintSetHelper");
+#line 5983 "runtime.in"
+ REGISTER_BLTIN(run::singleintSet,"singleintSet");
#line 5988 "runtime.in"
- addFunc(ve, run::gen523, primFile(), "read3", formal(primFile(), "f", false, false));
-#line 5995 "runtime.in"
- addFunc(ve, run::gen524, stringArray(), "history", formal(primString() , "name", false, false), formal(primInt(), "n", true, false));
-#line 6028 "runtime.in"
- addFunc(ve, run::gen525, stringArray(), "history", formal(primInt(), "n", true, false));
-#line 6039 "runtime.in"
- addFunc(ve, run::gen526, primString() , "readline", formal(primString() , "prompt", true, false), formal(primString() , "name", true, false), formal(primBoolean(), "tabcompletion", true, false));
-#line 6083 "runtime.in"
- addFunc(ve, run::gen527, primVoid(), "saveline", formal(primString() , "name", false, false), formal(primString() , "value", false, false), formal(primBoolean(), "store", true, false));
-#line 6113 "runtime.in"
- addFunc(ve, run::gen528, primVoid(), "generate_random_backtrace");
-#line 6122 "runtime.in"
- addFunc(ve, run::gen529, primVoid(), "print_random_addresses", formal(primInt(), "n", true, false));
+ REGISTER_BLTIN(run::singleintPart,"singleintPart");
+#line 5993 "runtime.in"
+ REGISTER_BLTIN(run::signedintSetHelper,"signedintSetHelper");
+#line 6000 "runtime.in"
+ REGISTER_BLTIN(run::signedintSet,"signedintSet");
+#line 6005 "runtime.in"
+ REGISTER_BLTIN(run::signedintPart,"signedintPart");
+#line 6010 "runtime.in"
+ REGISTER_BLTIN(run::readSetHelper,"readSetHelper");
+#line 6033 "runtime.in"
+ REGISTER_BLTIN(run::readSet,"readSet");
+#line 6038 "runtime.in"
+ addFunc(ve, run::gen_runtime534, stringArray(), "history", formal(primString() , "name", false, false), formal(primInt(), "n", true, false));
+#line 6071 "runtime.in"
+ addFunc(ve, run::gen_runtime535, stringArray(), "history", formal(primInt(), "n", true, false));
+#line 6082 "runtime.in"
+ addFunc(ve, run::gen_runtime536, primString() , "readline", formal(primString() , "prompt", true, false), formal(primString() , "name", true, false), formal(primBoolean(), "tabcompletion", true, false));
+#line 6126 "runtime.in"
+ addFunc(ve, run::gen_runtime537, primVoid(), "saveline", formal(primString() , "name", false, false), formal(primString() , "value", false, false), formal(primBoolean(), "store", true, false));
}
} // namespace trans
diff --git a/Build/source/utils/asymptote/runtime.h b/Build/source/utils/asymptote/runtime.h
index 024cd7d19ff..6d8b0c602ae 100644
--- a/Build/source/utils/asymptote/runtime.h
+++ b/Build/source/utils/asymptote/runtime.h
@@ -1,8 +1,7 @@
/***** Autogenerated from runtime.in; changes will be overwritten *****/
-#ifndef RUNTIME_H
-#define RUNTIME_H
-
+#ifndef runtime_H
+#define runtime_H
namespace run {
void IntZero(vm::stack *);
void realZero(vm::stack *);
@@ -67,6 +66,7 @@ void arraySliceWriteToEnd(vm::stack *);
void arrayLength(vm::stack *);
void arrayKeys(vm::stack *);
void arrayCyclicFlag(vm::stack *);
+void arraySetCyclicFlag(vm::stack *);
void arrayInitializedHelper(vm::stack *);
void arrayInitialized(vm::stack *);
void arrayCyclicHelper(vm::stack *);
@@ -97,13 +97,29 @@ void pairArrayFFT(vm::stack *);
void nullFile(vm::stack *);
void namePart(vm::stack *);
void modePart(vm::stack *);
+void dimensionSetHelper(vm::stack *);
+void dimensionSet(vm::stack *);
void dimensionPart(vm::stack *);
-void lineModePart(vm::stack *);
-void csvModePart(vm::stack *);
-void wordModePart(vm::stack *);
-void singleRealModePart(vm::stack *);
-void singleIntModePart(vm::stack *);
-void signedIntModePart(vm::stack *);
+void lineSetHelper(vm::stack *);
+void lineSet(vm::stack *);
+void linePart(vm::stack *);
+void csvSetHelper(vm::stack *);
+void csvSet(vm::stack *);
+void csvPart(vm::stack *);
+void wordSetHelper(vm::stack *);
+void wordSet(vm::stack *);
+void wordPart(vm::stack *);
+void singlerealSetHelper(vm::stack *);
+void singlerealSet(vm::stack *);
+void singlerealPart(vm::stack *);
+void singleintSetHelper(vm::stack *);
+void singleintSet(vm::stack *);
+void singleintPart(vm::stack *);
+void signedintSetHelper(vm::stack *);
+void signedintSet(vm::stack *);
+void signedintPart(vm::stack *);
+void readSetHelper(vm::stack *);
+void readSet(vm::stack *);
}
-#endif // RUNTIME_H
+#endif // runtime_H
diff --git a/Build/source/utils/asymptote/runtime.in b/Build/source/utils/asymptote/runtime.in
index 31a752b121c..d4e80bd8b9a 100644
--- a/Build/source/utils/asymptote/runtime.in
+++ b/Build/source/utils/asymptote/runtime.in
@@ -17,14 +17,6 @@
// Use Void f() instead of void f() to force an explicit Stack argument.
-void => primVoid()
-Void => primVoid()
-Int => primInt()
-bool => primBoolean()
-double => primReal()
-real => primReal()
-string* => primString()
-string => primString()
pen => primPen()
pair => primPair()
triple => primTriple()
@@ -42,7 +34,7 @@ callableBp* => breakpointFunction()
callableReal* => realRealFunction()
callableTransform* => transformFunction()
runnable* => primCode()
-boolarray* => boolArray()
+boolarray* => booleanArray()
Intarray* => IntArray()
Intarray2* => IntArray2()
realarray* => realArray()
@@ -169,7 +161,7 @@ using types::function;
#include <primitives.h>
#undef PRIMITIVE
-using types::boolArray;
+using types::booleanArray;
using types::IntArray;
using types::IntArray2;
using types::realArray;
@@ -223,6 +215,7 @@ namespace run {
const char *invalidargument="invalid argument";
const char *arrayempty="cannot take min or max of empty array";
+const char *noruntime="no runtime environment for embedded eval";
// Return the factorial of a non-negative integer using a lookup table.
Int factorial(Int n)
@@ -324,7 +317,7 @@ inline size_t checkdimension(array *a, size_t dim)
size_t size=checkArray(a);
if(dim && size != dim) {
ostringstream buf;
- buf << "array of length " << dim << " expected" << endl;
+ buf << "array of length " << dim << " expected";
error(buf);
}
return size;
@@ -390,7 +383,7 @@ double *copyArray2C(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -414,7 +407,7 @@ triple *copyTripleArray2C(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -438,7 +431,7 @@ double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0)
size_t m=(square || n == 0) ? n : checkArray(read<array*>(a,0));
if(n > 0 && dim2 && m != dim2) {
ostringstream buf;
- buf << "second matrix dimension must be " << dim2 << endl;
+ buf << "second matrix dimension must be " << dim2;
error(buf);
}
@@ -465,24 +458,6 @@ double *copyTripleArray2Components(array *a, bool square=true, size_t dim2=0)
return cx;
}
-double norm(double *a, size_t n)
-{
- if(n == 0) return 0.0;
- double M=fabs(a[0]);
- for(size_t i=1; i < n; ++i)
- M=::max(M,fabs(a[i]));
- return M;
-}
-
-double norm(triple *a, size_t n)
-{
- if(n == 0) return 0.0;
- double M=a[0].abs2();
- for(size_t i=1; i < n; ++i)
- M=::max(M,a[i].abs2());
- return sqrt(M);
-}
-
static const char *incommensurate="Incommensurate matrices";
static const char *singular="Singular matrix";
static size_t *pivot,*Row,*Col;
@@ -738,11 +713,6 @@ void init_readline(bool tabcompletion=true)
void cleanup()
{
- processDataStruct &pd=processData();
- pd.atExitFunction=NULL;
- pd.atUpdateFunction=NULL;
- pd.atBreakpointFunction=NULL;
-
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
store_history(&history_save);
int nlines=intcast(getSetting<Int>("historylines"));
@@ -776,7 +746,6 @@ void exitFunction(stack *Stack)
callable *atExitFunction=processData().atExitFunction;
if(atExitFunction && !nullfunc::instance()->compare(atExitFunction))
atExitFunction->call(Stack);
- cleanup();
}
default_t def;
@@ -881,7 +850,6 @@ inline double principalBranch(double deg)
}
static string defaulttransparency=string("Compatible");
-
static const string defaulttimeformat=string("%a %b %d %T %Z %Y");
#ifdef HAVE_STRFTIME
static const size_t nTime=256;
@@ -1112,14 +1080,14 @@ pair gamma(pair z)
void cannotread(const string& s)
{
ostringstream buf;
- buf << "Cannot read from " << s << endl;
+ buf << "Cannot read from " << s;
error(buf);
}
void cannotwrite(const string& s)
{
ostringstream buf;
- buf << "Cannot write to " << s << endl;
+ buf << "Cannot write to " << s;
error(buf);
}
@@ -1326,7 +1294,7 @@ patharray *_texpath(string *s, pen p=CURRENTPEN)
tex.verbatimline(ASYx);
tex.verbatimline(ASYy);
tex.verbatimline("/ASY1 true def");
- tex.verbatimline("/v {neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYy ASYx (L) print ASYy add ASYx (L) print add ASYy add ASYx (L) print add ASYy ASYx (c) print} bind def");
+ tex.verbatimline("/v {"+ASY1+"neg exch 4 copy 4 2 roll 2 copy 6 2 roll 2 copy (M) print ASYy ASYx (L) print ASYy add ASYx (L) print add ASYy add ASYx (L) print add ASYy ASYx (c) print} bind def");
tex.verbatimline("/show {"+ASY1+
"currentpoint newpath moveto false charpath "+
pathforall+"} bind def}");
@@ -2307,7 +2275,7 @@ void assert(bool b, string s=emptystring)
if(!b) {
ostringstream buf;
buf << "assert FAILED";
- if(s != "") buf << ": " << s << endl;
+ if(s != "") buf << ": " << s;
error(buf);
}
}
@@ -2326,17 +2294,15 @@ void usleep(Int microseconds)
void _eval(string *s, bool embedded, bool interactiveWrite=false)
{
- if (embedded) {
+ if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
- if (e && is) {
+ if(e && is)
runStringEmbedded(*s, *e, *is);
- } else {
- cerr << "no runtime environment for embedded eval" << endl;
- }
- } else {
+ else
+ error(noruntime);
+ } else
runString(*s,interactiveWrite);
- }
}
void _eval(runnable *s, bool embedded)
@@ -2344,17 +2310,15 @@ void _eval(runnable *s, bool embedded)
absyntax::block *ast=new absyntax::block(s->getPos(), false);
ast->add(s);
- if (embedded) {
+ if(embedded) {
trans::coenv *e=Stack->getEnvironment();
vm::interactiveStack *is=dynamic_cast<vm::interactiveStack *>(Stack);
- if (e && is) {
+ if(e && is)
runCodeEmbedded(ast, *e, *is);
- } else {
- cerr << "no runtime environment for embedded eval" << endl;
- }
- } else {
+ else
+ error(noruntime);
+ } else
runCode(ast);
- }
}
string location() {
@@ -2814,7 +2778,7 @@ bool straight(path3 p, Int t)
// Return the component of vector v perpendicular to a unit vector u.
triple perp(triple v, triple u)
{
- return v-dot(v,u)*u;
+ return perp(v,u);
}
// Return the maximum perpendicular deviation of segment i of path3 g
@@ -3228,11 +3192,11 @@ void _draw(picture *f, path3 g, pen p)
}
void draw(picture *f, triplearray2 *g, bool straight, penarray *p, real opacity,
- real shininess, real granularity, triple normal, bool lighton,
- penarray *colors)
+ real shininess, real PRCshininess, real granularity, triple normal,
+ bool lighton, penarray *colors)
{
- f->append(new drawSurface(*g,straight,*p,opacity,shininess,granularity,
- normal,lighton,*colors));
+ f->append(new drawSurface(*g,straight,*p,opacity,shininess,PRCshininess,
+ granularity,normal,lighton,*colors));
}
triple min3(picture *f)
@@ -3245,30 +3209,14 @@ triple max3(picture *f)
return f->bounds3().Max();
}
-pair min(picture *f, realarray2 *t)
-{
- real *T=copyArray2C(t,4);
- pair m=f->bounds(::min,xproject,yproject,T);
- delete[] T;
- return m;
-}
-
-pair max(picture *f, realarray2 *t)
-{
- real *T=copyArray2C(t,4);
- pair M=f->bounds(::max,xproject,yproject,T);
- delete[] T;
- return M;
-}
-
pair minratio(picture *f)
{
- return f->bounds(::min,xratio,yratio);
+ return f->ratio(::min);
}
pair maxratio(picture *f)
{
- return f->bounds(::max,xratio,yratio);
+ return f->ratio(::max);
}
triple minbezier(triplearray2 *P, triple b)
@@ -3291,44 +3239,75 @@ triple maxbezier(triplearray2 *P, triple b)
return b;
}
-pair minbezier(triplearray2 *P, realarray2 *t, pair b)
+pair minratio(triplearray2 *P, pair b)
{
triple *A=copyTripleArray2C(P,true,4);
- real *T=copyArray2C(t,4);
real fuzz=sqrtFuzz*norm(A,16);
- b=pair(bound(A,::min,xproject,T,b.getx(),fuzz),
- bound(A,::min,yproject,T,b.gety(),fuzz));
- delete[] T;
+ b=pair(bound(A,::min,xratio,b.getx(),fuzz),
+ bound(A,::min,yratio,b.gety(),fuzz));
delete[] A;
return b;
}
-pair maxbezier(triplearray2 *P, realarray2 *t, pair b)
+pair maxratio(triplearray2 *P, pair b)
{
triple *A=copyTripleArray2C(P,true,4);
- real *T=copyArray2C(t,4);
real fuzz=sqrtFuzz*norm(A,16);
- b=pair(bound(A,::max,xproject,T,b.getx(),fuzz),
- bound(A,::max,yproject,T,b.gety(),fuzz));
- delete[] T;
+ b=pair(bound(A,::max,xratio,b.getx(),fuzz),
+ bound(A,::max,yratio,b.gety(),fuzz));
delete[] A;
return b;
}
-pair max(path3 g, realarray2 *t)
+pair minratio(path3 g)
{
- real *T=copyArray2C(t,4);
- pair b=g.bounds(::max,xproject,yproject,T);
- delete[] T;
- return b;
+ return g.ratio(::min);
}
-pair min(path3 g, realarray2 *t)
+pair maxratio(path3 g)
{
- real *T=copyArray2C(t,4);
- pair b=g.bounds(::min,xproject,yproject,T);
- delete[] T;
- return b;
+ return g.ratio(::max);
+}
+
+real norm(realarray *a)
+{
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ real x=fabs(vm::read<real>(a,i));
+ if(x > M) M=x;
+ }
+ return M;
+}
+
+real norm(realarray2 *a)
+{
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ vm::array *ai=vm::read<vm::array*>(a,i);
+ size_t m=checkArray(ai);
+ for(size_t j=0; j < m; ++j) {
+ real a=fabs(vm::read<real>(ai,j));
+ if(a > M) M=a;
+ }
+ }
+ return M;
+}
+
+real norm(triplearray2 *a)
+{
+ size_t n=checkArray(a);
+ real M=0.0;
+ for(size_t i=0; i < n; ++i) {
+ vm::array *ai=vm::read<vm::array*>(a,i);
+ size_t m=checkArray(ai);
+ for(size_t j=0; j < m; ++j) {
+ real a=vm::read<triple>(ai,j).abs2();
+ if(a > M) M=a;
+ }
+ }
+ return sqrt(M);
}
real change2(triplearray2 *a)
@@ -4314,6 +4293,11 @@ triple cross(triple u, triple v)
return cross(u,v);
}
+triple dir(explicit triple z)
+{
+ return unit(z);
+}
+
triple expi(real polar, real azimuth)
{
return expi(polar,azimuth);
@@ -4397,6 +4381,14 @@ void nowarn(string s)
noWarn(s);
}
+void warning(string s, string t, bool position=false)
+{
+ if(settings::warn(s)) {
+ em.warning(position ? getPos() : nullPos,s);
+ em << t;
+ }
+}
+
// Strip directory from string
string stripdirectory(string *s)
{
@@ -4640,6 +4632,13 @@ bool :arrayCyclicFlag(array *a)
return a->cyclic();
}
+bool :arraySetCyclicFlag(bool b, array *a)
+{
+ checkArray(a);
+ a->cyclic(b);
+ return b;
+}
+
// Check to see if an array element is initialized.
bool :arrayInitializedHelper(Int n, array *a)
{
@@ -5875,123 +5874,167 @@ void seekeof(file *f)
f->seek(0,false);
}
+string :namePart(file f)
+{
+ return f.filename();
+}
+
+string :modePart(file f)
+{
+ return f.FileMode();
+}
+
// Set file dimensions
-file* dimension(file *f, Int nx)
+file* :dimensionSetHelper(Int nx=-1, Int ny=-1, Int nz=-1, file *f)
{
- f->dimension(nx);
+ f->dimension(nx,ny,nz);
return f;
}
-file* dimension(file *f, Int nx, Int ny)
+callable* :dimensionSet(file *f)
{
- f->dimension(nx,ny);
- return f;
+ return new thunk(new bfunc(dimensionSetHelper),f);
}
-file* dimension(file *f, Int nx, Int ny, Int nz)
+array * :dimensionPart(file f)
{
- f->dimension(nx,ny,nz);
+ array *a=new array(3);
+ (*a)[0]=f.Nx();
+ (*a)[1]=f.Ny();
+ (*a)[2]=f.Nz();
+ return a;
+}
+
+// Set file f to read arrays in line-at-a-time mode
+file* :lineSetHelper(bool b=true, file *f)
+{
+ f->LineMode(b);
return f;
}
+callable* :lineSet(file *f)
+{
+ return new thunk(new bfunc(lineSetHelper),f);
+}
+
+bool :linePart(file f)
+{
+ return f.LineMode();
+}
+
// Set file to read comma-separated values
-file* csv(file *f, bool b=true)
+file* :csvSetHelper(bool b=true, file *f)
{
f->CSVMode(b);
return f;
}
-// Set file to read whitespace-separated values
-file* word(file *f, bool b=true)
+callable* :csvSet(file *f)
{
- f->WordMode(b);
- return f;
+ return new thunk(new bfunc(csvSetHelper),f);
}
-// Set file to read arrays in line-at-a-time mode
-file* line(file *f, bool b=true)
+bool :csvPart(file f)
{
- f->LineMode(b);
- return f;
+ return f.CSVMode();
}
-// Set file to read/write signed int XDR values.
-file* signed(file *f, bool b=true)
+// Set file to read whitespace-separated values
+file* :wordSetHelper(bool b=true, file *f)
{
- f->SignedInt(b);
+ f->WordMode(b);
return f;
}
-string :namePart(file f)
+callable* :wordSet(file *f)
{
- return f.filename();
+ return new thunk(new bfunc(wordSetHelper),f);
}
-string :modePart(file f)
+bool :wordPart(file f)
{
- return f.FileMode();
+ return f.WordMode();
}
-array * :dimensionPart(file f)
+// Set file to read/write single precision real XDR values.
+file* :singlerealSetHelper(bool b=true, file *f)
{
- array *a=new array(3);
- (*a)[0]=f.Nx();
- (*a)[1]=f.Ny();
- (*a)[2]=f.Nz();
- return a;
+ f->SingleReal(b);
+ return f;
}
-bool :lineModePart(file f)
+callable* :singlerealSet(file *f)
{
- return f.LineMode();
+ return new thunk(new bfunc(singlerealSetHelper),f);
}
-bool :csvModePart(file f)
+bool :singlerealPart(file f)
{
- return f.CSVMode();
+ return f.SingleReal();
}
-bool :wordModePart(file f)
+// Set file to read/write single precision int XDR values.
+file* :singleintSetHelper(bool b=true, file *f)
{
- return f.WordMode();
+ f->SingleInt(b);
+ return f;
}
-bool :singleRealModePart(file f)
+callable* :singleintSet(file *f)
{
- return f.SingleReal();
+ return new thunk(new bfunc(singleintSetHelper),f);
}
-bool :singleIntModePart(file f)
+bool :singleintPart(file f)
{
return f.SingleInt();
}
-bool :signedIntModePart(file f)
+// Set file to read/write signed int XDR values.
+file* :signedintSetHelper(bool b=true, file *f)
{
- return f.SignedInt();
+ f->SignedInt(b);
+ return f;
}
-// Set file to read an array1 (1 int size followed by a 1d array)
-file* read1(file *f)
+callable* :signedintSet(file *f)
{
- f->dimension(-2);
- return f;
+ return new thunk(new bfunc(signedintSetHelper),f);
}
-// Set file to read an array2 (2 int sizes followed by a 2d array)
-file* read2(file *f)
+bool :signedintPart(file f)
{
- f->dimension(-2,-2);
- return f;
+ return f.SignedInt();
}
-// Set file to read an array3 (3 int sizes followed by a 3d array)
-file* read3(file *f)
+// Set file to read an arrayi (i int sizes followed by an i-dimensional array)
+file* :readSetHelper(Int i, file *f)
{
- f->dimension(-2,-2,-2);
+ switch(i) {
+ case 1:
+ f->dimension(-2);
+ break;
+
+ case 2:
+ f->dimension(-2,-2);
+ break;
+
+ case 3:
+ f->dimension(-2,-2,-2);
+ break;
+
+ default:
+ f->dimension();
+ }
+
return f;
}
+callable* :readSet(file *f)
+{
+ return new thunk(new bfunc(readSetHelper),f);
+}
+
// Return the last n lines of the history named name.
stringarray* history(string name, Int n=1)
{
@@ -6041,7 +6084,7 @@ stringarray* history(Int n=0)
string readline(string prompt=emptystring, string name=emptystring,
bool tabcompletion=false)
{
- if(!isatty(STDIN_FILENO))
+ if(!(isatty(STDIN_FILENO) || getSetting<bool>("interactive")))
return emptystring;
#if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES)
init_readline(tabcompletion);
@@ -6109,24 +6152,3 @@ void saveline(string name, string value, bool store=true)
unused(&store);
#endif
}
-
-void generate_random_backtrace()
-{
-#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
- GC_generate_random_backtrace();
-#else
- error("generate_random_backtrace() requires ./configure --enable-gc-debug");
-#endif
-}
-
-void print_random_addresses(Int n=1)
-{
-#if defined(USEGC) && defined(GC_DEBUG) && defined(GC_BACKTRACE)
- GC_gcollect();
- for (Int i=0; i < n; ++i)
- GC_debug_print_heap_obj_proc(GC_base(GC_generate_random_valid_address()));
-#else
- error("print_random_addresses() requires ./configure --enable-gc-debug");
- unused(&n); // Avoid unused variable warning message.
-#endif
-}
diff --git a/Build/source/utils/asymptote/runtime.pl b/Build/source/utils/asymptote/runtime.pl
index 74dde0506aa..e43813ad1c4 100755
--- a/Build/source/utils/asymptote/runtime.pl
+++ b/Build/source/utils/asymptote/runtime.pl
@@ -7,8 +7,31 @@
#
#####
+$prefix = shift(@ARGV);
+if (not $prefix) {
+ print STDERR "usage: ./runtime.pl module_name\n";
+ exit(1);
+}
+
$stack = "Stack";
+my $errors = 0;
+
+sub report_error {
+ my $filename = shift;
+ my $line = shift;
+ my $error = shift;
+ print STDERR "$filename:$line: $error\n";
+ $errors = 1;
+}
+
+sub assoc_error {
+ my $filename = shift;
+ my $line = shift;
+ my $type = shift;
+ report_error($filename, $line, "no asy type associated to '$type'");
+}
+
sub clean_type {
for (@_) {
s/\s//g;
@@ -24,19 +47,34 @@ sub clean_params {
my %type_map;
sub read_types {
my @types = split /\n/, shift;
+ my $filename = shift;
+ my $line = shift;
for (@types) {
+ ++$line;
+ # Remove // comments.
+ s/\/\/.*//g;
+
+ # Skip blank lines.
+ next if /^\s*$/;
+
my ($type,$code) =
m|(\w*(?:\s*\*)?)
\s*=>\s*
(.*)
|x;
+ if (not $type) {
+ report_error($filename, $line, "bad type declaration");
+ }
clean_type($type);
$type_map{$type} = $code;
}
}
sub asy_params {
- my @params = @_;
+ my $params = shift;
+ my @params = split m/,\s*/, $params;
+ my $filename = shift;
+ my $line = shift;
for (@params) {
my ($explicit, $type, $name, $default) =
m|^\s*
@@ -44,6 +82,9 @@ sub asy_params {
\s*
(\w*)(=*)|xs;
clean_type($type);
+ if (not $type_map{$type}) {
+ assoc_error($filename, $line, $type);
+ }
$_ = "formal(" . $type_map{$type} . ", \"" . lc($name) . "\"" . ", " .
($default ? "true" : "false") . ", " .
($explicit ? "true" : "false") . ")";
@@ -67,37 +108,57 @@ sub c_params {
$/ = "\f\n";
-open STDIN, "<runtime.in";
-open STDOUT, ">runtime.cc";
+open STDIN, "<$prefix.in" or die "can't open input file $prefix.in";
+open BASE, "<runtimebase.in" or die "can't open runtimebase.in";
+open STDOUT, ">$prefix.cc" or die "can't open output file $prefix.cc";
my $autogenerated=
-"/***** Autogenerated from runtime.in; changes will be overwritten *****/\n\n";
+"/***** Autogenerated from $prefix.in; changes will be overwritten *****/\n\n";
+my $base_source_line = 1;
my $source_line = 1;
print $autogenerated;
-print "#line $source_line \"runtime.in\"\n";
+print "#line $base_source_line \"runtimebase.in\"\n";
+$baseheader = <BASE>;
+print $baseheader;
+$basesource_line += ($baseheader =~ tr/\n//);;
+my $basesource_type_line = $basesource_line;
+
+print "#line $source_line \"$prefix.in\"\n";
$header = <>;
print $header;
$source_line += ($header =~ tr/\n//);;
+my $source_type_line = $source_line;
+
+$basetypes = <BASE>;
+$basesource_line += ($basetypes =~ tr/\n//);;
$types = <>;
$source_line += ($types =~ tr/\n//);;
-print "#line $source_line \"runtime.in\"\n";
+print "#line $base_source_line \"runtimebase.in\"\n";
+$baseheader = <BASE>;
+print $baseheader;
+$basesource_line += ($baseheader =~ tr/\n//);;
+
+print "#line $source_line \"$prefix.in\"\n";
$header = <>;
print $header;
$source_line += ($header =~ tr/\n//);;
print "\nnamespace run {\n";
-read_types($types);
+read_types($basetypes, "runtimebase.in", $basesource_type_line);
+
+read_types($types, "$prefix.in", $source_type_line);
-### Begining of `runtime.h'
+### Begining of `$prefix.h'
push @header, $autogenerated;
-push @header, "#ifndef RUNTIME_H\n";
-push @header, "#define RUNTIME_H\n\n";
+# TODO: Capitalize prefix
+push @header, "#ifndef " . $prefix . "_H\n";
+push @header, "#define " . $prefix . "_H\n";
push @header, "namespace run {\n";
my $count = 0;
@@ -114,8 +175,12 @@ while (<>) {
\{(.*)} # body
|xs;
+ if (not $type) {
+ report_error("$prefix.in", $source_line, "bad function definition");
+ }
+
if($cname) {push @header, "void $cname(vm::stack *);\n";}
- else {$cname="gen${count}";} # Unique C++ function name
+ else {$cname="gen_$prefix${count}";} # Unique C++ function name
clean_type($type);
@@ -124,15 +189,27 @@ while (<>) {
# Build addFunc call for asymptote
if($name) {
$name =~ s/Operator\s*//;
- push @builtin, "#line $source_line \"runtime.in\"\n"
+ if (not $type_map{$type}) {
+ assoc_error("$prefix.in", $source_line, $type);
+ }
+ my @asy_params = asy_params($params, "$prefix.in", $source_line);
+ push @builtin, "#line $source_line \"$prefix.in\"\n"
. " addFunc(ve, run::" . $cname
. ", " . $type_map{$type}
. ", " . '"' . $name . '"'
- . ( @params ? ", " . join(", ",asy_params(@params))
+ . ( @params ? ", " . join(", ",@asy_params)
: "" )
. ");\n";
}
+ # Build REGISTER_BLTIN command for builtin functions which are not added to
+ # the environment.
+ if (not $name and $cname) {
+ push @builtin, "#line $source_line \"$prefix.in\"\n"
+ . " REGISTER_BLTIN(run::" . $cname
+ . ',"' . $cname . '"' . ");\n";
+ }
+
# Handle marshalling of values to/from stack
$qualifier = ($type eq "item" ? "" : "<$type>");
$code =~ s/\breturn ([^;]*);/{$stack->push$qualifier($1); return;}/g;
@@ -141,7 +218,7 @@ while (<>) {
print $comments;
$ncomments = ($comments =~ tr/\n//);
$source_line += $ncomments;
- print "#line $source_line \"runtime.in\"\n";
+ print "#line $source_line \"$prefix.in\"\n";
my $prototype=$type . " " . $name . "(" . $params . ");";
$nprototype = ($prototype =~ tr/\n//)+1;
$source_line += $nprototype;
@@ -152,7 +229,7 @@ while (<>) {
print "void $cname(stack *";
if($type ne "void" or $params ne "") {print $stack;}
print ")\n{\n$args";
- print "#line $source_line \"runtime.in\"";
+ print "#line $source_line \"$prefix.in\"";
print "$code}\n\n";
$source_line -= $ncomments+$nprototype;
@@ -163,20 +240,26 @@ while (<>) {
print "} // namespace run\n";
print "\nnamespace trans {\n\n";
-print "void gen_base_venv(venv &ve)\n{\n";
+print "void gen_${prefix}_venv(venv &ve)\n{\n";
print @builtin;
print "}\n\n";
print "} // namespace trans\n";
### End of `header.h'
push @header, "}\n\n";
-push @header, "#endif // RUNTIME_H\n";
+push @header, "#endif // ". $prefix . "_H\n";
undef $/;
-open HEADER, "<", "runtime.h";
+open HEADER, "<", "$prefix.h";
$orig_header = <HEADER>;
$new_header = join "", @header;
if ($new_header ne $orig_header) {
- open HEADER, ">", "runtime.h";
+ open HEADER, ">", "$prefix.h";
print HEADER $new_header;
}
+
+if ($errors) {
+ unlink("$prefix.h");
+ unlink("$prefix.cc");
+}
+exit($errors);
diff --git a/Build/source/utils/asymptote/runtimebase.in b/Build/source/utils/asymptote/runtimebase.in
new file mode 100644
index 00000000000..b7c13d590fd
--- /dev/null
+++ b/Build/source/utils/asymptote/runtimebase.in
@@ -0,0 +1,38 @@
+/*****
+ * runtimebase.in
+ * Andy Hammerlindl 2009/07/28
+ *
+ * Common declarations needed for all code-generating .in files.
+ *
+ *****/
+
+
+// Basic types need by almost all .in files.
+
+// Use Void f() instead of void f() to force an explicit Stack argument.
+void => primVoid()
+Void => primVoid()
+
+Int => primInt()
+bool => primBoolean()
+double => primReal()
+real => primReal()
+string* => primString()
+string => primString()
+
+#include "stack.h"
+#include "types.h"
+#include "builtin.h"
+#include "entry.h"
+#include "errormsg.h"
+
+using vm::stack;
+using vm::error;
+using types::formal;
+
+#define PRIMITIVE(name,Name,asyName) using types::prim##Name;
+#include <primitives.h>
+#undef PRIMITIVE
+
+void unused(void *);
+
diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc
index 1c7a539663d..0cb6e22fea2 100644
--- a/Build/source/utils/asymptote/settings.cc
+++ b/Build/source/utils/asymptote/settings.cc
@@ -231,9 +231,9 @@ types::record *getSettingsModule() {
return settingsModule;
}
-void Warn(const string& s)
+void noWarn(const string& s)
{
- array *Warn=getSetting<array *>("warnings");
+ array *Warn=getSetting<array *>("suppress");
size_t size=checkArray(Warn);
if(s.empty()) return;
for(size_t i=0; i < size; i++)
@@ -241,23 +241,23 @@ void Warn(const string& s)
Warn->push(s);
}
-void noWarn(const string& s)
+void Warn(const string& s)
{
- array *Warn=getSetting<array *>("warnings");
+ array *Warn=getSetting<array *>("suppress");
size_t size=checkArray(Warn);
for(size_t i=0; i < size; i++)
if(vm::read<string>(Warn,i) == s)
(*Warn).erase((*Warn).begin()+i,(*Warn).begin()+i+1);
}
-string warn(const string& s)
+bool warn(const string& s)
{
- if(getSetting<bool>("debug")) return s;
- array *Warn=getSetting<array *>("warnings");
+ if(getSetting<bool>("debug")) return true;
+ array *Warn=getSetting<array *>("suppress");
size_t size=checkArray(Warn);
for(size_t i=0; i < size; i++)
- if(vm::read<string>(Warn,i) == s) return s;
- return "";
+ if(vm::read<string>(Warn,i) == s) return false;
+ return true;
}
// The dictionaries of long options and short options.
@@ -1046,14 +1046,12 @@ void initSettings() {
// WHEEL_DOWN: zoomout
const char *wheeldown[]={"zoomout",NULL};
- const char *Warn[]={"writeoverloaded",NULL};
-
addOption(new stringArraySetting("leftbutton", stringArray(leftbutton)));
addOption(new stringArraySetting("middlebutton", stringArray(middlebutton)));
addOption(new stringArraySetting("rightbutton", stringArray(rightbutton)));
addOption(new stringArraySetting("wheelup", stringArray(wheelup)));
addOption(new stringArraySetting("wheeldown", stringArray(wheeldown)));
- addOption(new stringArraySetting("warnings", stringArray(Warn)));
+ addOption(new stringArraySetting("suppress", new array));
addOption(new warnSetting("warn", 0, "string", "Enable warning"));
@@ -1130,6 +1128,8 @@ void initSettings() {
addOption(new boolSetting("embed", 0, "Embed rendered preview image", true));
addOption(new boolSetting("auto3D", 0, "Automatically activate 3D scene",
true));
+ addOption(new boolSetting("autoplay", 0, "Autoplay 3D animations", false));
+ addOption(new boolSetting("loop", 0, "Loop 3D animations", false));
addOption(new boolSetting("inlineimage", 0,
"Generate inline embedded image"));
@@ -1325,13 +1325,16 @@ void initDir() {
string texmf=s+dirsep+"texmf"+dirsep;
docdir=texmf+"doc"+dirsep+"asymptote";
Setting("sysdir")=texmf+"asymptote";
- s=lookup("TEXMFCONFIG");
+ s=lookup("ASYMPTOTE_HOME");
if(s.size() > 1)
- initdir=s+dirsep+"asymptote";
+ initdir=s;
}
}
if(initdir.empty())
+ initdir=Getenv("ASYMPTOTE_HOME",msdos);
+
+ if(initdir.empty())
initdir=Getenv(HOME.c_str(),msdos)+dirsep+"."+suffix;
#ifdef __CYGWIN__
@@ -1462,7 +1465,7 @@ const char *beginpicture(const string& texengine) {
if(latex(texengine))
return "\\begin{picture}";
if(context(texengine))
- return "%";
+ return "";
else
return "\\picture";
}
diff --git a/Build/source/utils/asymptote/settings.h b/Build/source/utils/asymptote/settings.h
index 92ecb3959cd..7327bd2aa82 100644
--- a/Build/source/utils/asymptote/settings.h
+++ b/Build/source/utils/asymptote/settings.h
@@ -47,7 +47,7 @@ extern char *argv0;
void Warn(const string& s);
void noWarn(const string& s);
-string warn(const string& s);
+bool warn(const string& s);
extern string systemDir;
extern string docdir;
extern const string dirsep;
diff --git a/Build/source/utils/asymptote/stack.cc b/Build/source/utils/asymptote/stack.cc
index ffec3d9b056..cbd8b5a4998 100644
--- a/Build/source/utils/asymptote/stack.cc
+++ b/Build/source/utils/asymptote/stack.cc
@@ -14,8 +14,6 @@
#include "util.h"
#include "runtime.h"
-//#define DEBUG_STACK
-
#ifdef DEBUG_STACK
#include <iostream>
@@ -37,12 +35,22 @@ position curPos = nullPos;
const program::label nulllabel;
}
+#ifdef DEBUG_FRAME
+inline stack::vars_t stack::make_frame(string name,
+ size_t size, vars_t closure)
+{
+ vars_t vars = new frame(name, 1+size);
+ (*vars)[0] = closure;
+ return vars;
+}
+#else
inline stack::vars_t stack::make_frame(size_t size, vars_t closure)
{
vars_t vars = new frame(1+size);
(*vars)[0] = closure;
return vars;
}
+#endif
void run(lambda *l)
{
@@ -63,13 +71,22 @@ void stack::run(func *f)
lambda *body = f->body;
#ifdef DEBUG_STACK
+#ifdef DEBUG_FRAME
+ cout << "running lambda " + body->name + ": \n";
+#else
cout << "running lambda: \n";
+#endif
print(cout, body->code);
cout << endl;
#endif
/* make new activation record */
+#ifdef DEBUG_FRAME
+ assert(!body->name.empty());
+ vars_t vars = make_frame(body->name, body->params, f->closure);
+#else
vars_t vars = make_frame(body->params, f->closure);
+#endif
marshall(body->params, vars);
run(body->code, vars);
@@ -141,7 +158,7 @@ void stack::run(program *code, vars_t vars)
#ifdef DEBUG_STACK
cerr << curPos << "\n";
- printInst(cerr, ip, body->code->begin());
+ printInst(cerr, ip, code->begin());
cerr << "\n";
#endif
@@ -234,7 +251,11 @@ void stack::run(program *code, vars_t vars)
}
case inst::pushframe: {
+#ifdef DEBUG_FRAME
+ vars=make_frame("<pushed frame>", 0, vars);
+#else
vars=make_frame(0, vars);
+#endif
break;
}
@@ -276,30 +297,8 @@ void stack::load(string index) {
#ifdef DEBUG_STACK
-#if __GNUC__
-#include <cxxabi.h>
-string demangle(const char *s)
-{
- int status;
- char *demangled = abi::__cxa_demangle(s,NULL,NULL,&status);
- if (status == 0 && demangled) {
- string str(demangled);
- free(demangled);
- return str;
- } else if (status == -2) {
- free(demangled);
- return s;
- } else {
- free(demangled);
- return string("Unknown(") + s + ")";
- }
-};
-#else
-string demangle(const char* s)
-{
- return s;
-}
-#endif
+
+const size_t MAX_ITEMS=20;
void stack::draw(ostream& out)
{
@@ -307,14 +306,18 @@ void stack::draw(ostream& out)
out << "operands:";
stack_t::const_iterator left = theStack.begin();
- if (theStack.size() > 10) {
- left = theStack.end()-10;
+ if (theStack.size() > MAX_ITEMS) {
+ left = theStack.end()-MAX_ITEMS;
out << " ...";
}
+ else
+ out << " ";
while (left != theStack.end())
{
- out << " " << demangle(left->type().name());
+ if (left != theStack.begin())
+ out << " | " ;
+ out << *left;
left++;
}
out << "\n";
@@ -322,18 +325,29 @@ void stack::draw(ostream& out)
void draw(ostream& out, frame* v)
{
- out << "vars: ";
+ out << "vars:" << endl;
- if (!!v) {
- out << (!get<frame*>((*v)[0]) ? " 0" : " link");
- for (size_t i = 1; i < 10 && i < v->size(); i++)
- out << " " << demangle((*v)[i].type().name());
- if (v->size() > 10)
+ while (!!v) {
+ out << " " << v->getName() << ":";
+
+ frame *parent=0;
+ item link=(*v)[0];
+ try {
+ parent = get<frame *>(link);
+ out << (parent ? " link" : " ----");
+ } catch (bad_item_value&) {
+ out << " " << (*v)[0];
+ }
+
+ for (size_t i = 1; i < MAX_ITEMS && i < v->size(); i++) {
+ out << " | " << i << ": " << (*v)[i];
+ }
+ if (v->size() > MAX_ITEMS)
out << "...";
out << "\n";
+
+ v = parent;
}
- else
- out << "\n";
}
#endif // DEBUG_STACK
@@ -360,7 +374,12 @@ void error(const ostringstream& message)
}
interactiveStack::interactiveStack()
- : globals(new frame(1)) {}
+#ifdef DEBUG_FRAME
+ : globals(new frame("globals", 0)) {}
+#else
+ : globals(new frame(0)) {}
+#endif
+
void interactiveStack::run(lambda *codelet) {
stack::run(codelet->code, globals);
diff --git a/Build/source/utils/asymptote/stack.h b/Build/source/utils/asymptote/stack.h
index 3f1cd983076..bb42074800d 100644
--- a/Build/source/utils/asymptote/stack.h
+++ b/Build/source/utils/asymptote/stack.h
@@ -56,7 +56,11 @@ private:
typedef mem::vector<item> stack_t;
stack_t theStack;
+#ifdef DEBUG_FRAME
+ vars_t make_frame(string name, size_t, vars_t closure);
+#else
vars_t make_frame(size_t, vars_t closure);
+#endif
void draw(ostream& out);
diff --git a/Build/source/utils/asymptote/stm.cc b/Build/source/utils/asymptote/stm.cc
index d55015d7c01..f2bbe2e0df4 100644
--- a/Build/source/utils/asymptote/stm.cc
+++ b/Build/source/utils/asymptote/stm.cc
@@ -59,46 +59,73 @@ void expStm::trans(coenv &e) {
baseTrans(e, body);
}
+// For an object such as currentpicture, write 'picture currentpicture' to
+// give some information. Only do this when the object has a name.
+void tryToWriteTypeOfExp(types::ty *t, exp *body)
+{
+ symbol *name=body->getName();
+ if (!name)
+ return;
+
+ overloaded *set = dynamic_cast<overloaded *>(t);
+ if (set)
+ for(ty_vector::iterator ot=set->sub.begin(); ot!=set->sub.end(); ++ot)
+ tryToWriteTypeOfExp(*ot, body);
+ else {
+ cout << "<";
+ t->printVar(cout, name);
+ cout << ">" << endl;
+ }
+}
+
+
exp *tryToWriteExp(coenv &e, exp *body)
{
// First check if it is the kind of expression that should be written.
- if (body->writtenToPrompt() &&
- settings::getSetting<bool>("interactiveWrite"))
- {
- types::ty *t=body->cgetType(e);
- if (t->kind == ty_error) {
- return body;
- }
- else {
- exp *callee=new nameExp(body->getPos(), symbol::trans("write"));
- exp *call=new callExp(body->getPos(), callee, body);
-
- types::ty *ct=call->getType(e);
- if (ct->kind == ty_error || ct->kind == ty_overloaded) {
- return body;
- }
- else {
- // Issue a warning if the act of writing turns an ambiguous expression
- // into an unambiguous one.
- if (t->kind == ty_overloaded) {
- string s=settings::warn("writeoverloaded");
- if(!s.empty()) {
- em.warning(body->getPos());
- em << "writing overloaded";
- if (body->getName())
- em << " variable '" << *body->getName() << "'";
- else
- em << " expression";
- em.disable(s);
- }
- }
- return call;
- }
- }
- }
- else {
+ if (!body->writtenToPrompt() ||
+ !settings::getSetting<bool>("interactiveWrite"))
+ return body;
+
+ types::ty *t=body->cgetType(e);
+ if (t->kind == ty_error)
return body;
+
+ exp *callee=new nameExp(body->getPos(), symbol::trans("write"));
+ exp *call=new callExp(body->getPos(), callee, body);
+
+ types::ty *ct=call->getType(e);
+ if (ct->kind == ty_error || ct->kind == ty_overloaded) {
+ if (t->kind == ty_overloaded) {
+ // Translate the body in order to print the ambiguity error first.
+ body->trans(e);
+ em.sync();
+ assert(em.errors());
+
+ // Then, write out all of the types.
+ tryToWriteTypeOfExp(t, body);
+
+ // Return an innocuous expression to avoid more errors.
+ return new nullExp(body->getPos());
+ }
+ else {
+ tryToWriteTypeOfExp(t, body);
+ return body;
+ }
}
+
+ // If the exp is overloaded, but the act of writing makes it
+ // unambiguous, add a suffix to the output to warn the user of this.
+ if (t->kind == ty_overloaded) {
+ exp *suffix=new nameExp(body->getPos(),
+ symbol::trans("overloadedMessage"));
+ exp *callWithSuffix=new callExp(body->getPos(),
+ callee, body, suffix);
+
+ if (callWithSuffix->getType(e)->kind != ty_error)
+ return callWithSuffix;
+ }
+
+ return call;
}
void expStm::interactiveTrans(coenv &e)
diff --git a/Build/source/utils/asymptote/tests/array/delete.asy b/Build/source/utils/asymptote/tests/array/delete.asy
index 0b00e3f0e46..d92a3c082c6 100644
--- a/Build/source/utils/asymptote/tests/array/delete.asy
+++ b/Build/source/utils/asymptote/tests/array/delete.asy
@@ -24,17 +24,17 @@ a.delete(2,3);
assert(all(a == new int[] {0,1}));
int[] a=sequence(4);
-a.cyclic(true);
+a.cyclic=true;
a.delete(2,3);
assert(all(a == new int[] {0,1}));
int[] a=sequence(4);
-a.cyclic(true);
+a.cyclic=true;
a.delete(2,4);
assert(all(a == new int[] {1}));
int[] a=sequence(4);
-a.cyclic(true);
+a.cyclic=true;
a.delete(3,1);
assert(all(a == new int[] {2}));
diff --git a/Build/source/utils/asymptote/tests/array/fields.asy b/Build/source/utils/asymptote/tests/array/fields.asy
new file mode 100644
index 00000000000..8435551aceb
--- /dev/null
+++ b/Build/source/utils/asymptote/tests/array/fields.asy
@@ -0,0 +1,79 @@
+import TestLib;
+
+StartTest("fields");
+
+{
+ int[] z = {1, 2, 3};
+ assert(z.length == 3);
+ int[] keys = z.keys;
+ assert(keys.length == 3);
+ for (int i; i<3; ++i)
+ assert(keys[i] == i);
+ for (int j = 0; j < 10; ++j) {
+ assert(z.cyclic == false);
+ z.cyclic=true;
+ assert(z.cyclic == true);
+ z.cyclic=false;
+ }
+}
+{
+ int[] z = {2, 3, 5};
+ for (int k = -100; k <= 100; ++k)
+ assert(z.initialized(k) == (k >= 0 && k < 3));
+}
+{
+ int[] z;
+ for (int i=0; i<10; ++i) {
+ for (int k = 0; k <= 100; ++k) {
+ assert(z.length == k);
+ z.push(k*k+3k+1);
+ assert(z.length == k+1);
+ }
+ for (int k = 100; k >= 0; --k) {
+ assert(z.length == k+1);
+ assert(z.pop() == k*k+3k+1);
+ assert(z.length == k);
+ }
+ }
+ z.cyclic=true;
+ for (int i=0; i<10; ++i) {
+ for (int k = 0; k <= 100; ++k) {
+ assert(z.length == k);
+ z.push(k*k+3k+1);
+ assert(z.length == k+1);
+ }
+ for (int k = 100; k >= 0; --k) {
+ assert(z.length == k+1);
+ z.delete(quotient(k,2));
+ assert(z.length == k);
+ }
+ }
+}
+
+{
+ int[] base={4,5,9,5,0,2,3};
+ int[] z;
+ for (int i=0; i<99; ++i) {
+ assert(z.length == i*base.length);
+ for (int j : z.keys)
+ assert(z[j] == base[j%base.length]);
+ z.append(base);
+ }
+}
+
+{
+ int[] z = {1,2,3,4,6,7,8,9};
+ assert(z.length == 8);
+ z.insert(4, 5);
+ assert(z.length == 9);
+ z.insert(0, 0);
+ assert(z.length == 10);
+ for (int i=0; i<10; ++i)
+ assert(z[i] == i);
+ z.insert(7, 100, 101, 102, 103);
+ assert(z.length == 14);
+
+ // TODO: Test inserting/deleting lengths more seriously.
+}
+
+EndTest();
diff --git a/Build/source/utils/asymptote/tests/array/slice.asy b/Build/source/utils/asymptote/tests/array/slice.asy
index 709263504ce..9010f0b5d8e 100644
--- a/Build/source/utils/asymptote/tests/array/slice.asy
+++ b/Build/source/utils/asymptote/tests/array/slice.asy
@@ -18,14 +18,14 @@ assert(all(x[3:3] == new int[] {} ));
assert(all(x[3:4] == new int[] {3} ));
assert(all(x[98:99] == new int[] {} ));
-assert(x[:].cyclicflag == false);
-assert(x[2:].cyclicflag == false);
-assert(x[:7].cyclicflag == false);
-assert(x[3:3].cyclicflag == false);
-assert(x[2:9].cyclicflag == false);
+assert(x[:].cyclic == false);
+assert(x[2:].cyclic == false);
+assert(x[:7].cyclic == false);
+assert(x[3:3].cyclic == false);
+assert(x[2:9].cyclic == false);
// Cyclic cases
-x.cyclic(true);
+x.cyclic=true;
assert(all(x[:] == new int[] {0,1,2,3,4,5,6,7,8,9} ));
assert(all(x[0:4] == new int[] {0,1,2,3} ));
@@ -46,12 +46,12 @@ assert(all(x[-15:15] == new int[] {5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,
assert(all(x[6728:6729] == new int[] {8} ));
assert(all(x[-6729:-6728] == new int[] {1} ));
-assert(x[:].cyclicflag == false);
-assert(x[2:].cyclicflag == false);
-assert(x[:7].cyclicflag == false);
-assert(x[3:3].cyclicflag == false);
-assert(x[2:9].cyclicflag == false);
-assert(x[5:100].cyclicflag == false);
+assert(x[:].cyclic == false);
+assert(x[2:].cyclic == false);
+assert(x[:7].cyclic == false);
+assert(x[3:3].cyclic == false);
+assert(x[2:9].cyclic == false);
+assert(x[5:100].cyclic == false);
pair[] z={(1,2), (3,4), (5,6)};
assert(all(z[1:1] == new pair[] {}));
@@ -72,12 +72,12 @@ assert(all(z[1:2] == new pair[] {(3,4)}));
{
int[] y={0,1,2,3,4,5,6,7,8,9};
int[] z={56,67,78};
- z.cyclic(true);
+ z.cyclic=true;
y[:] = z;
assert(all(y == z));
assert(!alias(y,z));
- assert(y.cyclicflag == false);
+ assert(y.cyclic == false);
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
@@ -99,91 +99,91 @@ assert(all(z[1:2] == new pair[] {(3,4)}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
int[] z={56,67,78};
y[:] = z;
assert(all(y == z));
assert(!alias(y,z));
- assert(y.cyclicflag == true);
+ assert(y.cyclic == true);
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
int[] z={56,67,78};
- z.cyclic(true);
+ z.cyclic=true;
y[:] = z;
assert(all(y == z));
assert(!alias(y,z));
- assert(y.cyclicflag == true);
+ assert(y.cyclic == true);
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[2:3] = y[5:6] = new int[] {77};
assert(all(y == new int[] {0,1,77,3,4,77,6,7,8,9}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[:3] = y[7:] = new int[] {};
assert(all(y == new int[] {3,4,5,6}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[8:] = new int[] {18,19,20,21,22};
assert(all(y == new int[] {0,1,2,3,4,5,6,7,18,19,20,21,22}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[-2:0] = new int[] {18,19,20,21,22};
assert(all(y == new int[] {0,1,2,3,4,5,6,7,18,19,20,21,22}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[18:20] = new int[] {18,19,20,21,22};
assert(all(y == new int[] {0,1,2,3,4,5,6,7,18,19,20,21,22}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[3:5] = new int[] {13,14,15,16,17};
assert(all(y == new int[] {0,1,2,13,14,15,16,17,5,6,7,8,9}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[13:15] = new int[] {13,14,15,16,17};
assert(all(y == new int[] {0,1,2,13,14,15,16,17,5,6,7,8,9}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[3-10:5-10] = new int[] {13,14,15,16,17};
assert(all(y == new int[] {0,1,2,13,14,15,16,17,5,6,7,8,9}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[8:12] = new int[] {18,19,20,21};
assert(all(y == new int[] {20,21,2,3,4,5,6,7,18,19}));
}
{
int[] y={0,1,2,3,4,5,6,7,8,9};
- y.cyclic(true);
+ y.cyclic=true;
y[-2:2] = new int[] {18,19,20,21};
assert(all(y == new int[] {20,21,2,3,4,5,6,7,18,19}));
diff --git a/Build/source/utils/asymptote/texfile.cc b/Build/source/utils/asymptote/texfile.cc
index b1cf4bfcd77..075826d5ca8 100644
--- a/Build/source/utils/asymptote/texfile.cc
+++ b/Build/source/utils/asymptote/texfile.cc
@@ -29,6 +29,7 @@ texfile::texfile(const string& texname, const bbox& box, bool pipe)
out->precision(6);
texdocumentclass(*out,pipe);
resetpen();
+ level=0;
}
texfile::~texfile()
diff --git a/Build/source/utils/asymptote/texfile.h b/Build/source/utils/asymptote/texfile.h
index 5980cf51e16..d7adf0087de 100644
--- a/Build/source/utils/asymptote/texfile.h
+++ b/Build/source/utils/asymptote/texfile.h
@@ -151,7 +151,8 @@ class texfile : public psfile {
bbox box;
bool inlinetex;
double Hoffset;
-
+ int level;
+
public:
string texengine;
@@ -179,6 +180,12 @@ public:
void endraw();
+ void begingroup() {++level;}
+
+ void endgroup() {--level;}
+
+ bool toplevel() {return level == 0;}
+
void writepair(pair z) {
*out << z;
}
diff --git a/Build/source/utils/asymptote/types.cc b/Build/source/utils/asymptote/types.cc
index ddc4a07317a..6fa8489eb31 100644
--- a/Build/source/utils/asymptote/types.cc
+++ b/Build/source/utils/asymptote/types.cc
@@ -13,71 +13,27 @@
#include "types.h"
#include "runtime.h"
#include "access.h"
+#include "virtualfieldaccess.h"
namespace types {
/* Base types */
#define PRIMITIVE(name,Name,asyName) \
primitiveTy p##Name(ty_##name); \
- ty *prim##Name() { return &p##Name; }
+ ty *prim##Name() { return &p##Name; } \
+ array name##Array_(prim##Name()); \
+ ty *name##Array() { return &name##Array_; } \
+ array name##Array2_(name##Array()); \
+ ty *name##Array2() { return &name##Array2_; } \
+ array name##Array3_(name##Array2()); \
+ ty *name##Array3() { return &name##Array3_; }
#define PRIMERROR
-#include <primitives.h>
+#include "primitives.h"
#undef PRIMERROR
#undef PRIMITIVE
nullTy pNull;
ty *primNull() { return &pNull; }
-
-array boolArray_(primBoolean());
-ty *boolArray() { return &boolArray_; }
-array IntArray_(primInt());
-ty *IntArray() { return &IntArray_; }
-array realArray_(primReal());
-ty *realArray() { return &realArray_; }
-array pairArray_(primPair());
-ty *pairArray() { return &pairArray_; }
-array tripleArray_(primTriple());
-ty *tripleArray() { return &tripleArray_; }
-array stringArray_(primString());
-ty *stringArray() { return &stringArray_; }
-array transformArray_(primTransform());
-ty *transformArray() { return &transformArray_; }
-array pathArray_(primPath());
-ty *pathArray() { return &pathArray_; }
-array penArray_(primPen());
-ty *penArray() { return &penArray_; }
-array guideArray_(primGuide());
-ty *guideArray() { return &guideArray_; }
-
-array boolArray2_(boolArray());
-ty *boolArray2() { return &boolArray2_; }
-array IntArray2_(IntArray());
-ty *IntArray2() { return &IntArray2_; }
-array realArray2_(realArray());
-ty *realArray2() { return &realArray2_; }
-array pairArray2_(pairArray());
-ty *pairArray2() { return &pairArray2_; }
-array tripleArray2_(tripleArray());
-ty *tripleArray2() { return &tripleArray2_; }
-array stringArray2_(stringArray());
-ty *stringArray2() { return &stringArray2_; }
-array pathArray2_(pathArray());
-ty *pathArray2() { return &pathArray2_; }
-array penArray2_(penArray());
-ty *penArray2() { return &penArray2_; }
-
-array boolArray3_(boolArray2());
-ty *boolArray3() { return &boolArray3_; }
-array IntArray3_(IntArray2());
-ty *IntArray3() { return &IntArray3_; }
-array realArray3_(realArray2());
-ty *realArray3() { return &realArray3_; }
-array pairArray3_(pairArray2());
-ty *pairArray3() { return &pairArray3_; }
-array tripleArray3_(tripleArray2());
-ty *tripleArray3() { return &tripleArray3_; }
-array stringArray3_(stringArray2());
-ty *stringArray3() { return &stringArray3_; }
const char *names[] = {
"null",
@@ -85,7 +41,7 @@ const char *names[] = {
#define PRIMITIVE(name,Name,asyName) #asyName,
#define PRIMERROR
-#include <primitives.h>
+#include "primitives.h"
#undef PRIMERROR
#undef PRIMITIVE
@@ -100,15 +56,63 @@ void ty::print(ostream& out) const
out << names[kind];
}
-trans::varEntry *primitiveTy::virtualField(symbol *id, signature *sig)
-{
+// Used for primitive virtual fields and array virtual fields.
#define FIELD(Type, name, func) \
if (sig == 0 && id == symbol::trans(name)) { \
- static trans::bltinAccess a(run::func); \
- static trans::varEntry v(Type(), &a, 0, position()); \
+ static trans::virtualFieldAccess a(run::func); \
+ static trans::varEntry v(Type(), &a, 0, position()); \
return &v; \
}
+#define RWFIELD(Type, name, getter, setter) \
+ if (sig == 0 && id == symbol::trans(name)) { \
+ static trans::virtualFieldAccess a(run::getter, run::setter); \
+ static trans::varEntry v(Type(), &a, 0, position()); \
+ return &v; \
+ }
+
+#define SIGFIELD(Type, name, func) \
+ if (id == symbol::trans(name) && \
+ equivalent(sig, Type()->getSignature())) \
+ { \
+ static trans::virtualFieldAccess a(run::func); \
+ static trans::varEntry v(Type(), &a, 0, position()); \
+ return &v; \
+ }
+
+#define DSIGFIELD(name, func) \
+ if (id == symbol::trans(#name) && \
+ equivalent(sig, name##Type()->getSignature())) \
+ { \
+ static trans::virtualFieldAccess a(run::func); \
+ /* for some fields, v needs to be dynamic */ \
+ /* e.g. when the function type depends on an array type. */ \
+ trans::varEntry *v = \
+ new trans::varEntry(name##Type(), &a, 0, position()); \
+ return v; \
+ }
+
+#define FILEFIELD(GetType, SetType, name) \
+ FIELD(GetType,#name,name##Part); \
+ SIGFIELD(SetType,#name,name##Set);
+
+ty *dimensionType() {
+ return new function(primFile(),
+ formal(primInt(),"nx",true),
+ formal(primInt(),"ny",true),
+ formal(primInt(),"nz",true));
+}
+
+ty *modeType() {
+ return new function(primFile(),formal(primBoolean(),"b", true));
+}
+
+ty *readType() {
+ return new function(primFile(), formal(primInt(), "i"));
+}
+
+trans::varEntry *primitiveTy::virtualField(symbol *id, signature *sig)
+{
switch (kind) {
case ty_pair:
FIELD(primReal,"x",pairXPart);
@@ -139,19 +143,33 @@ trans::varEntry *primitiveTy::virtualField(symbol *id, signature *sig)
case ty_file:
FIELD(primString,"name",namePart);
FIELD(primString,"mode",modePart);
- FIELD(IntArray,"dimension",dimensionPart);
- FIELD(primBoolean,"line",lineModePart);
- FIELD(primBoolean,"csv",csvModePart);
- FIELD(primBoolean,"word",wordModePart);
- FIELD(primBoolean,"singlereal",singleRealModePart);
- FIELD(primBoolean,"singleint",singleIntModePart);
- FIELD(primBoolean,"signed",signedIntModePart);
+ FILEFIELD(IntArray,dimensionType,dimension);
+ FILEFIELD(primBoolean,modeType,line);
+ FILEFIELD(primBoolean,modeType,csv);
+ FILEFIELD(primBoolean,modeType,word);
+ FILEFIELD(primBoolean,modeType,singlereal);
+ FILEFIELD(primBoolean,modeType,singleint);
+ FILEFIELD(primBoolean,modeType,signedint);
+ SIGFIELD(readType,"read",readSet);
+ break;
default:
break;
}
return 0;
+}
-#undef FIELD
+ty *overloadedDimensionType() {
+ overloaded *o=new overloaded;
+ o->add(dimensionType());
+ o->add(IntArray());
+ return o;
+}
+
+ty *overloadedModeType() {
+ overloaded *o=new overloaded;
+ o->add(modeType());
+ o->add(primBoolean());
+ return o;
}
ty *ty::virtualFieldGetType(symbol *id)
@@ -160,19 +178,42 @@ ty *ty::virtualFieldGetType(symbol *id)
return v ? v->getType() : 0;
}
+ty *primitiveTy::virtualFieldGetType(symbol *id)
+{
+ if(kind == ty_file) {
+ if (id == symbol::trans("dimension"))
+ return overloadedDimensionType();
+
+ if (id == symbol::trans("line") || id == symbol::trans("csv") ||
+ id == symbol::trans("word") || id == symbol::trans("singlereal") ||
+ id == symbol::trans("singleint") || id == symbol::trans("signedint"))
+ return overloadedModeType();
+
+ if (id == symbol::trans("read"))
+ return readType();
+ }
+
+ trans::varEntry *v = virtualField(id, 0);
+
+ return v ? v->getType() : 0;
+}
+
+#define RETURN_STATIC_BLTIN(func) \
+ { \
+ static trans::bltinAccess a(run::func); \
+ return &a; \
+ }
+
trans::access *nullTy::castTo(ty *target, caster &) {
switch (target->kind) {
case ty_array: {
- static trans::bltinAccess a(run::pushNullArray);
- return &a;
+ RETURN_STATIC_BLTIN(pushNullArray);
}
case ty_record: {
- static trans::bltinAccess a(run::pushNullRecord);
- return &a;
+ RETURN_STATIC_BLTIN(pushNullRecord);
}
case ty_function: {
- static trans::bltinAccess a(run::pushNullFunction);
- return &a;
+ RETURN_STATIC_BLTIN(pushNullFunction);
}
default:
return 0;
@@ -181,8 +222,7 @@ trans::access *nullTy::castTo(ty *target, caster &) {
trans::access *array::initializer()
{
- static trans::bltinAccess a(run::emptyArray);
- return &a;
+ RETURN_STATIC_BLTIN(emptyArray)
}
ty *array::pushType()
@@ -229,110 +269,49 @@ ty *array::deleteType()
return deletetype;
}
-ty *cyclicType() {
- return new function(primVoid(),formal(primBoolean(),"b"));
-}
-
ty *initializedType() {
return new function(primBoolean(),formal(primInt(),"i"));
}
+#define SIGFIELDLIST \
+ ASIGFIELD(initialized, arrayInitialized); \
+ ASIGFIELD(push, arrayPush); \
+ ASIGFIELD(pop, arrayPop); \
+ ASIGFIELD(append, arrayAppend); \
+ ASIGFIELD(insert, arrayInsert); \
+ ASIGFIELD(delete, arrayDelete); \
+
ty *array::virtualFieldGetType(symbol *id)
{
- return
- id == symbol::trans("cyclic") ? cyclicType() :
- id == symbol::trans("push") ? pushType() :
- id == symbol::trans("pop") ? popType() :
- id == symbol::trans("append") ? appendType() :
- id == symbol::trans("insert") ? insertType() :
- id == symbol::trans("delete") ? deleteType() :
- id == symbol::trans("initialized") ? initializedType() :
- ty::virtualFieldGetType(id);
+ #define ASIGFIELD(name, func) \
+ if (id == symbol::trans(#name)) \
+ return name##Type();
+
+ SIGFIELDLIST
+
+ #undef ASIGFIELD
+
+ return ty::virtualFieldGetType(id);
}
trans::varEntry *array::virtualField(symbol *id, signature *sig)
{
- if (sig == 0 && id == symbol::trans("length"))
- {
- static trans::bltinAccess a(run::arrayLength);
- static trans::varEntry v(primInt(), &a, 0, position());
- return &v;
- }
- if (sig == 0 && id == symbol::trans("keys"))
- {
- static trans::bltinAccess a(run::arrayKeys);
- static trans::varEntry v(IntArray(), &a, 0, position());
- return &v;
- }
- if (sig == 0 && id == symbol::trans("cyclicflag"))
- {
- static trans::bltinAccess a(run::arrayCyclicFlag);
- static trans::varEntry v(primBoolean(), &a, 0, position());
- return &v;
- }
- if (id == symbol::trans("cyclic") &&
- equivalent(sig, cyclicType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayCyclic);
- static trans::varEntry v(cyclicType(), &a, 0, position());
- return &v;
- }
- if (id == symbol::trans("initialized") &&
- equivalent(sig, initializedType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayInitialized);
- static trans::varEntry v(initializedType(), &a, 0, position());
- return &v;
- }
- if (id == symbol::trans("push") &&
- equivalent(sig, pushType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayPush);
- // v needs to be dynamic, as the push type differs among arrays.
- trans::varEntry *v = new trans::varEntry(pushType(), &a, 0, position());
-
- return v;
- }
- if (id == symbol::trans("pop") &&
- equivalent(sig, popType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayPop);
- // v needs to be dynamic, as the pop type differs among arrays.
- trans::varEntry *v = new trans::varEntry(popType(), &a, 0, position());
-
- return v;
- }
- if (id == symbol::trans("append") &&
- equivalent(sig, appendType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayAppend);
- // v needs to be dynamic, as the append type differs among arrays.
- trans::varEntry *v = new trans::varEntry(appendType(), &a, 0, position());
-
- return v;
- }
- if (id == symbol::trans("insert") &&
- equivalent(sig, insertType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayInsert);
- // v needs to be dynamic, as the insert type differs among arrays.
- trans::varEntry *v = new trans::varEntry(insertType(), &a, 0, position());
-
- return v;
- }
- if (id == symbol::trans("delete") &&
- equivalent(sig, deleteType()->getSignature()))
- {
- static trans::bltinAccess a(run::arrayDelete);
- // v needs to be dynamic, as the delete type differs among arrays.
- trans::varEntry *v = new trans::varEntry(deleteType(), &a, 0, position());
-
- return v;
- }
- else
- return ty::virtualField(id, sig);
+ FIELD(primInt, "length", arrayLength);
+ FIELD(IntArray, "keys", arrayKeys);
+ RWFIELD(primBoolean, "cyclic", arrayCyclicFlag, arraySetCyclicFlag);
+
+ #define ASIGFIELD(name, func) DSIGFIELD(name,func)
+
+ SIGFIELDLIST
+
+ #undef ASIGFIELD
+
+ // Fall back on base class to handle no match.
+ return ty::virtualField(id, sig);
}
+#undef SIGFIELDLIST
+
ostream& operator<< (ostream& out, const formal& f)
{
if (f.Explicit)
@@ -448,8 +427,7 @@ size_t signature::hash() {
}
trans::access *function::initializer() {
- static trans::bltinAccess a(run::pushNullFunction);
- return &a;
+ RETURN_STATIC_BLTIN(pushNullFunction);
}
#if 0
@@ -532,4 +510,9 @@ bool equivalent(ty *t1, ty *t2, bool special) {
equivalent(t1->getSignature(), t2->getSignature());
}
+#undef FIELD
+#undef RWFIELD
+#undef SIGFIELD
+#undef DSIGFIELD
+
} // namespace types
diff --git a/Build/source/utils/asymptote/types.h b/Build/source/utils/asymptote/types.h
index 4b51c0d56e8..1cb31869c80 100644
--- a/Build/source/utils/asymptote/types.h
+++ b/Build/source/utils/asymptote/types.h
@@ -43,7 +43,7 @@ enum ty_kind {
#define PRIMITIVE(name,Name,asyName) ty_##name,
#define PRIMERROR
-#include <primitives.h>
+#include "primitives.h"
#undef PRIMERROR
#undef PRIMITIVE
@@ -170,7 +170,8 @@ public:
return false;
}
- virtual trans::varEntry *virtualField(symbol *, signature *);
+ ty *virtualFieldGetType(symbol *);
+ trans::varEntry *virtualField(symbol *, signature *);
bool equiv(ty *other)
{
@@ -254,41 +255,19 @@ struct array : public ty {
};
/* Base types */
-#define PRIMITIVE(name,Name,asyName) ty *prim##Name();
+#define PRIMITIVE(name,Name,asyName) \
+ ty *prim##Name(); \
+ ty *name##Array(); \
+ ty *name##Array2(); \
+ ty *name##Array3();
#define PRIMERROR
-#include <primitives.h>
+#include "primitives.h"
#undef PRIMERROR
#undef PRIMITIVE
ty *primNull();
-
-ty *boolArray();
-ty *IntArray();
-ty *realArray();
-ty *pairArray();
-ty *tripleArray();
-ty *stringArray();
-ty *transformArray();
-ty *pathArray();
-ty *penArray();
-ty *guideArray();
-
-ty *boolArray2();
-ty *IntArray2();
-ty *realArray2();
-ty *pairArray2();
-ty *tripleArray2();
-ty *stringArray2();
-ty *pathArray2();
-ty *penArray2();
-
-ty *boolArray3();
-ty *IntArray3();
-ty *realArray3();
-ty *pairArray3();
-ty *tripleArray3();
-ty *stringArray3();
-
+
+
struct formal {
ty *t;
symbol *name;
diff --git a/Build/source/utils/asymptote/util.cc b/Build/source/utils/asymptote/util.cc
index 33fb56ad104..46f99ab669d 100644
--- a/Build/source/utils/asymptote/util.cc
+++ b/Build/source/utils/asymptote/util.cc
@@ -17,7 +17,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <signal.h>
#include <cstring>
#include <algorithm>
@@ -35,6 +34,31 @@ namespace vm {
void error(const char* message);
}
+#if __GNUC__
+#include <cxxabi.h>
+string demangle(const char *s)
+{
+ int status;
+ char *demangled = abi::__cxa_demangle(s,NULL,NULL,&status);
+ if (status == 0 && demangled) {
+ string str(demangled);
+ free(demangled);
+ return str;
+ } else if (status == -2) {
+ free(demangled);
+ return s;
+ } else {
+ free(demangled);
+ return string("Unknown(") + s + ")";
+ }
+};
+#else
+string demangle(const char* s)
+{
+ return s;
+}
+#endif
+
char *Strdup(string s)
{
size_t size=s.size()+1;
@@ -162,6 +186,16 @@ string auxname(string filename, string suffix)
return buildname(filename,suffix,"_");
}
+sighandler_t Signal(int signum, sighandler_t handler)
+{
+ struct sigaction action,oldaction;
+ action.sa_handler=handler;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags=0;
+ return sigaction(signum,&action,&oldaction) == 0 ? oldaction.sa_handler :
+ SIG_ERR;
+}
+
void push_split(mem::vector<string>& a, const string& S)
{
const char *p=S.c_str();
diff --git a/Build/source/utils/asymptote/util.h b/Build/source/utils/asymptote/util.h
index 76614aadc6d..57712ae78f0 100644
--- a/Build/source/utils/asymptote/util.h
+++ b/Build/source/utils/asymptote/util.h
@@ -11,11 +11,15 @@
#include <sys/types.h>
#include <iostream>
#include <cstdlib>
+#include <csignal>
#include "common.h"
#include <strings.h>
+// Demangle a typeid name (if the proper library is installed.
+string demangle(const char *s);
+
// Duplicate a string.
char *Strdup(string s);
char *StrdupNoGC(string s);
@@ -52,6 +56,11 @@ string String(T x)
return buf.str();
}
+typedef void (*sighandler_t)(int);
+
+// Portable signal (sigaction wrapper).
+sighandler_t Signal(int signum, sighandler_t handler);
+
// Split string S and push the pieces onto vector a.
void push_split(mem::vector<string>& a, const string& S);
diff --git a/Build/source/utils/asymptote/virtualfieldaccess.cc b/Build/source/utils/asymptote/virtualfieldaccess.cc
new file mode 100644
index 00000000000..13cb088d2ac
--- /dev/null
+++ b/Build/source/utils/asymptote/virtualfieldaccess.cc
@@ -0,0 +1,41 @@
+/*****
+ * virtualfieldaccess.cc
+ * Andy Hammerlindl 2009/07/23
+ *
+ * Implements the access subclass used to read and write virtual fields.
+ *****/
+
+#include "virtualfieldaccess.h"
+#include "coder.h"
+
+namespace trans {
+
+inline void virtualFieldAccess::encode(action act, position pos, coder &e)
+{
+ switch(act) {
+ case CALL:
+ this->encode(READ, pos, e);
+ e.encode(inst::popcall);
+ return;
+ case READ:
+ assert(getter);
+ getter->encode(CALL, pos, e);
+ return;
+ case WRITE:
+ if (setter)
+ setter->encode(CALL, pos, e);
+ else {
+ em.error(pos);
+ em << "virtual field is read-only";
+ }
+ return;
+ }
+}
+
+void virtualFieldAccess::encode(action act, position pos, coder &e, frame *)
+{
+ e.encode(inst::pop);
+ encode(act, pos, e);
+}
+
+} // namespace trans
diff --git a/Build/source/utils/asymptote/virtualfieldaccess.h b/Build/source/utils/asymptote/virtualfieldaccess.h
new file mode 100644
index 00000000000..115900733ce
--- /dev/null
+++ b/Build/source/utils/asymptote/virtualfieldaccess.h
@@ -0,0 +1,49 @@
+/*****
+ * virtualfieldaccess.h
+ * Andy Hammerlindl 2009/07/23
+ *
+ * Implements the access subclass used to read and write virtual fields.
+ *****/
+
+#include "access.h"
+
+namespace trans {
+// In code such as
+// pair z; write(z.x);
+// to evaluate the expression z.x, first z is pushed onto the stack, then as
+// it is not a record, instead of accessing its field in the usual way for a
+// record, a builtin function is called which pops z off the stack and
+// replaces it with z.x. virtualFieldAccess provides the access for the
+// virtualField 'x', and 'getter' is the access to the builtin function which
+// replaces z with z.x.
+//
+// If the virtual field z.x were mutable, then setter would access a builtin
+// function, which pops a real number and then z off of the stack, sets the
+// z.x to that new value, and puts the value back on the stack. In this case,
+// pairs are immutable, but other virtual fields may not be.
+class virtualFieldAccess : public access {
+ access *getter;
+ access *setter;
+
+ // As an optimization could add a 'caller' field, to handle calls to
+ // functions such as 'a.push(x)' where a is an array more efficiently.
+public:
+ virtualFieldAccess(access *getter, access *setter = 0)
+ : getter(getter), setter(setter) {}
+
+ virtualFieldAccess(vm::bltin getter, vm::bltin setter = 0)
+ : getter(new bltinAccess(getter)),
+ setter(setter ? new bltinAccess(setter) : 0) {}
+
+ void encode(action act, position pos, coder &e);
+ void encode(action act, position pos, coder &e, frame *);
+
+ // Attempting to WRITE a read-only field will give an error, but if the
+ // error is caught at a higher level, a better error message (including the
+ // name of the field) can be given. This function allows such handling.
+ bool readonly() {
+ return (bool)setter;
+ }
+};
+
+} // namespace trans
diff --git a/Build/source/utils/asymptote/vm.h b/Build/source/utils/asymptote/vm.h
index ba666dc64d5..fd332dd99cb 100644
--- a/Build/source/utils/asymptote/vm.h
+++ b/Build/source/utils/asymptote/vm.h
@@ -15,6 +15,18 @@ namespace vm {
class lambda; class stack;
typedef void (*bltin)(stack *s);
+#ifdef DEBUG_BLTIN
+// This associates names to bltin functions, so that the output of 'asy -s'
+// can print the names of the bltin functions that appear in the bytecode.
+void registerBltin(bltin b, string s);
+string lookupBltin(bltin b);
+
+#define REGISTER_BLTIN(b, s) \
+ registerBltin((b), (s))
+#else
+#define REGISTER_BLTIN(b, s)
+#endif
+
void run(lambda *l);
position getPos();
void errornothrow(const char* message);
diff --git a/Master/bin/i386-cygwin/asy.exe b/Master/bin/i386-cygwin/asy.exe
index d4c45f1dfc0..f8424f9c35f 100755
--- a/Master/bin/i386-cygwin/asy.exe
+++ b/Master/bin/i386-cygwin/asy.exe
Binary files differ
diff --git a/Master/bin/win32/asy.exe b/Master/bin/win32/asy.exe
index a93ef24732b..f8424f9c35f 100755
--- a/Master/bin/win32/asy.exe
+++ b/Master/bin/win32/asy.exe
Binary files differ
diff --git a/Master/texmf/asymptote/GUI/xasyVersion.py b/Master/texmf/asymptote/GUI/xasyVersion.py
index a1ab6b203c5..5d5a51724f2 100755
--- a/Master/texmf/asymptote/GUI/xasyVersion.py
+++ b/Master/texmf/asymptote/GUI/xasyVersion.py
@@ -1,2 +1,2 @@
#!/usr/bin/env python
-xasyVersion = "1.82"
+xasyVersion = "1.83"
diff --git a/Master/texmf/asymptote/animation.asy b/Master/texmf/asymptote/animation.asy
index 6fcd2ad70e2..27f7171a639 100644
--- a/Master/texmf/asymptote/animation.asy
+++ b/Master/texmf/asymptote/animation.asy
@@ -8,16 +8,17 @@
// animation delay is in milliseconds
real animationdelay=50;
-typedef frame fit(string prefix="",picture);
+typedef frame enclosure(frame);
-frame NoBox(string prefix="", picture pic) {
- return pic.fit(prefix);
+frame NoBox(frame f) {
+ return f;
}
-fit BBox(string prefix="", real xmargin=0, real ymargin=xmargin,
- pen p=currentpen, filltype filltype=NoFill) {
- return new frame(string prefix, picture pic) {
- return bbox(prefix,pic,xmargin,ymargin,p,filltype);
+enclosure BBox(real xmargin=0, real ymargin=xmargin,
+ pen p=currentpen, filltype filltype=NoFill) {
+ return new frame(frame f) {
+ box(f,xmargin,ymargin,p,filltype,above=false);
+ return f;
};
}
@@ -59,11 +60,11 @@ struct animation {
shipped=false;
}
- void add(picture pic=currentpicture, fit fit=NoBox) {
+ void add(picture pic=currentpicture, enclosure enclosure=NoBox) {
if(global) {
++index;
pictures.push(pic.copy());
- } else this.shipout(fit(prefix,pic));
+ } else this.shipout(enclosure(pic.fit()));
}
void purge(bool keep=settings.keep) {
@@ -86,30 +87,33 @@ struct animation {
return rc;
}
+ void glmovie(string prefix=prefix, projection P=currentprojection) {
+ if(!view() || settings.render == 0) return;
+ fit(prefix,pictures,view=true,P);
+ }
+
// Export all frames with the same scaling.
- void export(string prefix=prefix, fit fit=NoBox,
- bool multipage=false, bool view=false) {
+ void export(string prefix=prefix, enclosure enclosure=NoBox,
+ bool multipage=false, bool view=false,
+ projection P=currentprojection) {
if(pictures.length == 0) return;
if(!global) multipage=false;
- rescale(pictures);
- frame multi;
bool inlinetex=settings.inlinetex;
if(multipage)
settings.inlinetex=false;
- for(int i=0; i < pictures.length; ++i) {
+ frame multi;
+ frame[] fits=fit(prefix,pictures,view=false,P);
+ for(int i=0; i < fits.length; ++i) {
+ string s=name(prefix,i);
if(multipage) {
- add(multi,fit(prefix,pictures[i]));
+ add(multi,enclosure(fits[i]));
newpage(multi);
+ files.push(s+"."+nativeformat());
} else {
- if(pictures[i].empty3() || settings.render <= 0) {
- real render=settings.render;
- settings.render=0;
- this.shipout(name(prefix,i),fit(prefix,pictures[i]));
- settings.render=render;
- } else { // Render 3D frames
- files.push(name(prefix,i)+"."+nativeformat());
- fit(prefix,pictures[i]);
- }
+ if(pictures[i].empty3() || settings.render <= 0)
+ this.shipout(s,enclosure(fits[i]));
+ else // 3D frames
+ files.push(s+"."+nativeformat());
}
}
if(multipage) {
@@ -129,8 +133,8 @@ struct animation {
return s;
}
- string pdf(fit fit=NoBox, real delay=animationdelay, string options="",
- bool keep=settings.keep, bool multipage=true) {
+ string pdf(enclosure enclosure=NoBox, real delay=animationdelay,
+ string options="", bool keep=settings.keep, bool multipage=true) {
if(settings.inlinetex) multipage=true;
if(!global) multipage=false;
if(settings.tex != "pdflatex")
@@ -141,16 +145,17 @@ struct animation {
string pdfname=filename+".pdf";
if(global)
- export(filename,fit,multipage=multipage);
+ export(filename,enclosure,multipage=multipage);
shipped=false;
- if(!keep && !settings.inlinetex) {
+ if(!keep) {
exitfcn currentexitfunction=atexit();
void exitfunction() {
if(currentexitfunction != null) currentexitfunction();
- this.purge();
- if(multipage)
+ if(multipage || !settings.inlinetex)
+ this.purge();
+ if(multipage && !settings.inlinetex)
delete(pdfname);
}
atexit(exitfunction);
@@ -162,15 +167,15 @@ struct animation {
return load(index,delay,options,multipage);
}
- int movie(fit fit=NoBox, int loops=0, real delay=animationdelay,
+ int movie(enclosure enclosure=NoBox, int loops=0, real delay=animationdelay,
string format=settings.outformat == "" ? "gif" : settings.outformat,
string options="", bool keep=settings.keep) {
if(global) {
if(format == "pdf") {
- export(fit,multipage=true,view=true);
+ export(enclosure,multipage=true,view=true);
return 0;
}
- export(fit);
+ export(enclosure);
}
return merge(loops,delay,format,options,keep);
}
diff --git a/Master/texmf/asymptote/bezulate.asy b/Master/texmf/asymptote/bezulate.asy
index 2b852623faf..d935d358989 100644
--- a/Master/texmf/asymptote/bezulate.asy
+++ b/Master/texmf/asymptote/bezulate.asy
@@ -238,7 +238,7 @@ path[] bezulate(path[] p)
// avoid infinite recursion
++refinements;
if(refinements > mantissaBits) {
- write("warning: too many subdivisions");
+ warning("subdivisions","too many subdivisions",position=true);
} else {
p=subdivide(p);
i=-1;
diff --git a/Master/texmf/asymptote/geometry.asy b/Master/texmf/asymptote/geometry.asy
index 12e35339dcc..0db3172d365 100644
--- a/Master/texmf/asymptote/geometry.asy
+++ b/Master/texmf/asymptote/geometry.asy
@@ -228,24 +228,6 @@ pair[] intersectionpoints(pair A, pair B, real[] equation)
// *=======================================================*
// *......................COORDINATES......................*
-// Copyright (c) 2007, Philippe Ivaldi.
-// Version: $Id: coordinates.asy,v 0.0 2007/02/03 16:06:23 Philippe Ivaldi Exp$
-// Last modified: Wed Aug 15 15:53:01 CEST 2007
-
-// This program 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
-// 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.
-
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-// 02110-1301, USA.
real EPS=sqrt(realEpsilon);
@@ -492,8 +474,9 @@ bool samecoordsys(bool warn=true ... point[] M)
t=M[i].coordsys;
}
if(warn && !ret)
- write("Warning, the coordinate system of two objects are not the same.
-The operation will be done relatively to the default coordinate system.");
+ warning("coodinatesystem",
+ "the coordinate system of two objects are not the same.
+The operation will be done relative to the default coordinate system.");
return ret;
}
@@ -2418,8 +2401,10 @@ bool samecoordsys(bool warn=true ... bqe[] bqes)
t=bqes[i].coordsys;
}
if(warn && !ret)
- write("Warning, the coordinate system of two bivariate quadratic equations are not the same.
-The operation will be done relatively to the default coordinate system.");
+ warning("coodinatesystem",
+ "the coordinate system of two bivariate quadratic equations are not
+the same. The operation will be done relatively to the default coordinate
+system.");
return ret;
}
@@ -2710,7 +2695,9 @@ int circlenodesnumberfactor=100;/*<asyxml></code><documentation>Factor for the n
/*<asyxml><function type="int" signature="circlenodesnumber(real)"><code></asyxml>*/
int circlenodesnumber(real r)
{/*<asyxml></code><documentation>Return the number of nodes for drawing a circle of radius 'r'.</documentation></function></asyxml>*/
- if (circlenodesnumberfactor < 100) write("Warning: variable 'circlenodesnumberfactor' maybe too small.");
+ if (circlenodesnumberfactor < 100)
+ warning("circlenodesnumberfactor",
+ "variable 'circlenodesnumberfactor' may be too small.");
int oi=ceil(circlenodesnumberfactor*abs(r)^0.1);
oi=45*floor(oi/45);
return oi == 0 ? 4 : conicnodesfactor*oi;
@@ -2729,7 +2716,9 @@ int ellipsenodesnumberfactor=250;/*<asyxml></code><documentation>Factor for the
/*<asyxml><function type="int" signature="ellipsenodesnumber(real,real)"><code></asyxml>*/
int ellipsenodesnumber(real a, real b)
{/*<asyxml></code><documentation>Return the number of nodes to draw a ellipse of axis 'a' and 'b'.</documentation></function></asyxml>*/
- if (ellipsenodesnumberfactor < 250) write("Warning: variable 'ellipsenodesnumberfactor' maybe too small.");
+ if (ellipsenodesnumberfactor < 250)
+ write("ellipsenodesnumberfactor",
+ "variable 'ellipsenodesnumberfactor' maybe too small.");
int tmp=circlenodesnumberfactor;
circlenodesnumberfactor=ellipsenodesnumberfactor;
int oi=circlenodesnumber(max(abs(a),abs(b))/min(abs(a),abs(b)));
@@ -5481,7 +5470,7 @@ circle excircle(point A, point B, point C)
}
private int[] numarray={1,2,3};
-numarray.cyclic(true);
+numarray.cyclic=true;
/*<asyxml><struct signature="triangle"><code></asyxml>*/
struct triangle {/*<asyxml></code><documentation></documentation></asyxml>*/
@@ -6440,13 +6429,19 @@ point operator *(inversion i, point P)
return inverse(i.k,i.C,P);
}
+void lineinversion()
+{
+ warning("lineinversion","the inversion of the line is not a circle.
+The returned circle has an infinite radius, circle.l has been set.");
+}
+
+
/*<asyxml><function type="circle" signature="inverse(real,point,line)"><code></asyxml>*/
circle inverse(real k, point A, line l)
{/*<asyxml></code><documentation>Return the inverse circle of 'l' with
respect to point 'A' and inversion radius 'k'.</documentation></function></asyxml>*/
if(A @ l) {
- write("Warning: the inversion of the line is not a circle.");
- write("The returned circle has an infinite radius, cirlce.l have been set.");
+ lineinversion();
circle C=circle(A, infinity);
C.l=l;
return C;
@@ -6467,8 +6462,7 @@ circle inverse(real k, point A, circle c)
respect to point A and inversion radius 'k'.</documentation></function></asyxml>*/
if(degenerate(c)) return inverse(k,A,c.l);
if(A @ c) {
- write("Warning: the inversion of the circle is not a circle.");
- write("The returned circle has an infinite radius, cirlce.l have been set.");
+ lineinversion();
point M=rotate(180,c.C)*A, Mp=rotate(90,c.C)*A;
circle oc=circle(A,infinity);
oc.l=line(inverse(k,A,M),inverse(k,A,Mp));
@@ -7123,7 +7117,7 @@ path square(pair z1, pair z2)
// relative to the path z--z+dir.
void perpendicular(picture pic=currentpicture, pair z, pair align,
pair dir=E, real size=0, pen p=currentpen,
- margin margin=NoMargin, filltype filltype=NoFill)
+ margin margin=NoMargin, filltype filltype=NoFill)
{
perpendicularmark(pic,(point) z,align,dir,size,p,margin,filltype);
}
@@ -7133,7 +7127,7 @@ void perpendicular(picture pic=currentpicture, pair z, pair align,
// relative to the path z--z+dir(g,0)
void perpendicular(picture pic=currentpicture, pair z, pair align, path g,
real size=0, pen p=currentpen, margin margin=NoMargin,
- filltype filltype=NoFill)
+ filltype filltype=NoFill)
{
perpendicularmark(pic,(point) z,align,dir(g,0),size,p,margin,filltype);
}
diff --git a/Master/texmf/asymptote/graph.asy b/Master/texmf/asymptote/graph.asy
index 2983137b612..55974c63f7d 100644
--- a/Master/texmf/asymptote/graph.asy
+++ b/Master/texmf/asymptote/graph.asy
@@ -1,6 +1,6 @@
private import math;
-import splinetype;
+import graph_splinetype;
import graph_settings;
scaleT Linear;
@@ -1893,7 +1893,7 @@ interpolate Hermite(splinetype splinetype)
};
}
-interpolate Hermite=Hermite(defaultspline);
+interpolate Hermite=Hermite(Spline);
guide graph(picture pic=currentpicture, real f(real), real a, real b,
int n=ngraph, real T(real)=identity, interpolate join=operator --)
diff --git a/Master/texmf/asymptote/graph3.asy b/Master/texmf/asymptote/graph3.asy
index 8fe6c9ed5c6..c2630e10f11 100644
--- a/Master/texmf/asymptote/graph3.asy
+++ b/Master/texmf/asymptote/graph3.asy
@@ -1509,6 +1509,27 @@ path3[] segment(triple[] v, bool[] cond, interpolate3 join=operator --)
segment.length);
}
+bool uperiodic(triple[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length;
+ triple[] a0=a[0];
+ triple[] a1=a[n-1];
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int j=0; j < m; ++j)
+ if(abs(a0[j]-a1[j]) > epsilon) return false;
+ return true;
+}
+bool vperiodic(triple[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length-1;
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int i=0; i < n; ++i)
+ if(abs(a[i][0]-a[i][m]) > epsilon) return false;
+ return true;
+}
+
// return the surface described by a matrix f
surface surface(triple[][] f, bool[][] cond={})
{
@@ -1533,6 +1554,7 @@ surface surface(triple[][] f, bool[][] cond={})
}
surface s=surface(count);
+ s.index=new int[nx][ny];
int k=-1;
for(int i=0; i < nx; ++i) {
bool[] condi,condp;
@@ -1542,122 +1564,18 @@ surface surface(triple[][] f, bool[][] cond={})
}
triple[] fi=f[i];
triple[] fp=f[i+1];
+ int[] indexi=s.index[i];
for(int j=0; j < ny; ++j) {
if(all || (condi[j] && condi[j+1] && condp[j] && condp[j+1]))
s.s[++k]=patch(new triple[] {fi[j],fp[j],fp[j+1],fi[j+1]});
- }
- }
- return s;
-}
-
-private surface bispline(real[][] z, real[][] p, real[][] q, real[][] r,
- real[] x, real[] y, bool[][] cond={})
-{ // z[i][j] is the value at (x[i],y[j])
- // p and q are the first derivatives with respect to x and y, respectively
- // r is the second derivative ddu/dxdy
- int n=x.length-1;
- int m=y.length-1;
-
- bool all=cond.length == 0;
-
- int count;
- if(all)
- count=n*m;
- else {
- count=0;
- for(int i=0; i < n; ++i) {
- bool[] condi=cond[i];
- for(int j=0; j < m; ++j)
- if(condi[j]) ++count;
- }
- }
-
- surface g=surface(count);
- int k=-1;
- for(int i=0; i < n; ++i) {
- bool[] condi=all ? null : cond[i];
- real xi=x[i];
- real[] zi=z[i];
- real[] zp=z[i+1];
- real[] ri=r[i];
- real[] rp=r[i+1];
- real[] pi=p[i];
- real[] pp=p[i+1];
- real[] qi=q[i];
- real[] qp=q[i+1];
- real xp=x[i+1];
- real hx=(xp-xi)/3;
- for(int j=0; j < m; ++j) {
- real yj=y[j];
- real yp=y[j+1];
- if(all || condi[j]) {
- triple[][] P=array(4,array(4,O));
- real hy=(yp-yj)/3;
- real hxy=hx*hy;
- // first x and y directions
- for(int k=0; k < 4; ++k) {
- P[k][0] += xi*X;
- P[0][k] += yj*Y;
- P[k][1] += (xp+2*xi)/3*X;
- P[1][k] += (yp+2*yj)/3*Y;
- P[k][2] += (2*xp+xi)/3*X;
- P[2][k] += (2*yp+yj)/3*Y;
- P[k][3] += xp*X;
- P[3][k] += yp*Y;
- }
- // now z, first the value
- P[0][0] += zi[j]*Z;
- P[0][3] += zp[j]*Z;
- P[3][0] += zi[j+1]*Z;
- P[3][3] += zp[j+1]*Z;
- // 2nd, first derivative
- P[0][1] += (P[0][0].z+hx*pi[j])*Z;
- P[3][1] += (P[3][0].z+hx*pi[j+1])*Z;
- P[0][2] += (P[0][3].z-hx*pp[j])*Z;
- P[3][2] += (P[3][3].z-hx*pp[j+1])*Z;
- P[1][0] += (P[0][0].z+hy*qi[j])*Z;
- P[1][3] += (P[0][3].z+hy*qp[j])*Z;
- P[2][0] += (P[3][0].z-hy*qi[j+1])*Z;
- P[2][3] += (P[3][3].z-hy*qp[j+1])*Z;
- // 3nd, second derivative
- P[1][1] += (P[1][0].z+P[0][1].z-P[0][0].z+hxy*ri[j])*Z;
- P[2][1] += (P[2][0].z+P[3][1].z-P[3][0].z-hxy*ri[j+1])*Z;
- P[1][2] += (P[0][2].z+P[1][3].z-P[0][3].z-hxy*rp[j])*Z;
- P[2][2] += (P[3][2].z+P[2][3].z-P[3][3].z+hxy*rp[j+1])*Z;
- g.s[++k]=patch(P);
+ indexi[j]=k;
}
- }
}
- return g;
-}
-// return the surface described by a real matrix f, interpolated with
-// xsplinetype and ysplinetype.
-surface surface(real[][] f, real[] x, real[] y,
- splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
- bool[][] cond={})
-{
- real epsilon=sqrtEpsilon*max(abs(y));
- if(xsplinetype == null)
- xsplinetype=(abs(x[0]-x[x.length-1]) <= epsilon) ? periodic : notaknot;
- if(ysplinetype == null)
- ysplinetype=(abs(y[0]-y[y.length-1]) <= epsilon) ? periodic : notaknot;
- int n=x.length; int m=y.length;
- real[][] ft=transpose(f);
- real[][] tp=new real[m][];
- for(int j=0; j < m; ++j)
- tp[j]=xsplinetype(x,ft[j]);
- real[][] q=new real[n][];
- for(int i=0; i < n; ++i)
- q[i]=ysplinetype(y,f[i]);
- real[][] qt=transpose(q);
- real[] d1=xsplinetype(x,qt[0]);
- real[] d2=xsplinetype(x,qt[m-1]);
- real[][] r=new real[n][];
- real[][] p=transpose(tp);
- for(int i=0; i < n; ++i)
- r[i]=clamped(d1[i],d2[i])(y,p[i]);
- return bispline(f,p,q,r,x,y,cond);
+ if(uperiodic(f)) s.ucyclic(true);
+ if(vperiodic(f)) s.vcyclic(true);
+
+ return s;
}
// return the surface described by a real matrix f, interpolated with
@@ -1738,74 +1656,8 @@ 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)
{
- real[] upt=uniform(a.x,b.x,nu);
- real[] vpt=uniform(a.y,b.y,nv);
- real[] ipt=sequence(nu+1);
- real[] jpt=sequence(nv+1);
- real[][] fx=new real[nu+1][nv+1];
- real[][] fy=new real[nu+1][nv+1];
- real[][] fz=new real[nu+1][nv+1];
-
- bool[][] active;
- bool all=cond == null;
- if(!all) active=new bool[nu+1][nv+1];
-
- real norm;
- for(int i=0; i <= nu; ++i) {
- real upti=upt[i];
- real[] fxi=fx[i];
- real[] fyi=fy[i];
- real[] fzi=fz[i];
- bool[] activei=all ? null : active[i];
- for(int j=0; j <= nv; ++j) {
- pair z=(upti,vpt[j]);
- triple f=(all || (activei[j]=cond(z))) ? f(z) : O;
- norm=max(norm,abs(f));
- fxi[j]=f.x;
- fyi[j]=f.y;
- fzi[j]=f.z;
- }
- }
-
- real epsilon=sqrtEpsilon*norm;
-
- if(usplinetype.length == 0) {
- bool uperiodic(real[][] a) {
- for(int j=0; j < nv; ++j)
- if(abs(a[0][j]-a[nu][j]) > epsilon) return false;
- return true;
- }
- usplinetype=new splinetype[] {uperiodic(fx) ? periodic : notaknot,
- uperiodic(fy) ? periodic : notaknot,
- uperiodic(fz) ? periodic : notaknot};
- } else if(usplinetype.length != 3) abort("usplinetype must have length 3");
-
- if(vsplinetype.length == 0) {
- bool vperiodic(real[][] a) {
- for(int i=0; i < nu; ++i)
- if(abs(a[i][0]-a[i][nv]) > epsilon) return false;
- return true;
- }
- vsplinetype=new splinetype[] {vperiodic(fx) ? periodic : notaknot,
- vperiodic(fy) ? periodic : notaknot,
- vperiodic(fz) ? periodic : notaknot};
- } else if(vsplinetype.length != 3) abort("vsplinetype must have length 3");
-
- surface sx=surface(fx,ipt,jpt,usplinetype[0],vsplinetype[0],active);
- surface sy=surface(fy,ipt,jpt,usplinetype[1],vsplinetype[1],active);
- surface sz=surface(fz,ipt,jpt,usplinetype[2],vsplinetype[2],active);
-
- surface s=surface(sx.s.length);
- for(int k=0; k < sx.s.length; ++k) {
- triple[][] Q=new triple[4][4];
- for(int i=0; i < 4 ; ++i) {
- for(int j=0; j < 4 ; ++j) {
- Q[i][j]=(sx.s[k].P[i][j].z,sy.s[k].P[i][j].z,sz.s[k].P[i][j].z);
- }
- s.s[k]=patch(Q);
- }
- }
- return s;
+ return surface(f,uniform(a.x,b.x,nu),uniform(a.y,b.y,nv),
+ usplinetype,vsplinetype,cond);
}
// return the surface described by a real function f over box(a,b),
diff --git a/Master/texmf/asymptote/graph_splinetype.asy b/Master/texmf/asymptote/graph_splinetype.asy
new file mode 100644
index 00000000000..fbcb1b00c75
--- /dev/null
+++ b/Master/texmf/asymptote/graph_splinetype.asy
@@ -0,0 +1,251 @@
+typedef real[] splinetype(real[], real[]);
+
+restricted real[] Spline(real[] x, real[] y);
+restricted splinetype[] Spline;
+
+string morepoints="interpolation requires at least 2 points";
+string differentlengths="arrays have different lengths";
+void checklengths(int x, int y, string text=differentlengths)
+{
+ if(x != y)
+ abort(text+": "+string(x)+" != "+string(y));
+}
+
+// Linear interpolation
+real[] linear(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d=new real[n];
+ for(int i=0; i < n-1; ++i)
+ d[i]=(y[i+1]-y[i])/(x[i+1]-x[i]);
+ d[n-1]=d[n-2];
+ return d;
+}
+
+// Standard cubic spline interpolation with not-a-knot condition:
+// s'''(x_2^-)=s'''(x_2^+) et s'''(x_(n_2)^-)=s'''(x_(n-2)^+)
+// if n=2, linear interpolation is returned
+// if n=3, an interpolation polynomial of degree <= 2 is returned:
+// p(x_1)=y_1, p(x_2)=y_2, p(x_3)=y_3
+real[] notaknot(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 3) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=x[2]-x[1];
+ c[0]=x[2]-x[0];
+ a[0]=0;
+ g[0]=((x[1]-x[0])^2*(y[2]-y[1])/b[0]+b[0]*(2*b[0]+3*(x[1]-x[0]))*
+ (y[1]-y[0])/(x[1]-x[0]))/c[0];
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ b[n-1]=x[n-2]-x[n-3];
+ a[n-1]=x[n-1]-x[n-3];
+ g[n-1]=((x[n-1]-x[n-2])^2*(y[n-2]-y[n-3])/b[n-1]+
+ b[n-1]*(2*b[n-1]+3(x[n-1]-x[n-2]))*
+ (y[n-1]-y[n-2])/(x[n-1]-x[n-2]))/a[n-1];
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ real val=(y[1]-y[0])/(x[1]-x[0]);
+ d=new real[] {val,val};
+ } else if(n == 3) {
+ real a=(y[1]-y[0])/(x[1]-x[0]);
+ real b=(y[2]-y[1])/(x[2]-x[1]);
+ real c=(b-a)/(x[2]-x[0]);
+ d=new real[] {a+c*(x[0]-x[1]),a+c*(x[1]-x[0]),a+c*(2*x[2]-x[0]-x[1])};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with periodic condition
+// s'(a)=s'(b), s''(a)=s''(b), assuming that f(a)=f(b)
+// if n=2, linear interpolation is returned
+real[] periodic(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ if(abs(y[n-1]-y[0]) > sqrtEpsilon*norm(y))
+ abort("function values are not periodic");
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n-1];
+ real[] b=new real[n-1];
+ real[] c=new real[n-1];
+ real[] g=new real[n-1];
+ c[0]=x[n-1]-x[n-2];
+ a[0]=x[1]-x[0];
+ b[0]=2*(a[0]+c[0]);
+ g[0]=3*c[0]*(y[1]-y[0])/a[0]+3*a[0]*(y[n-1]-y[n-2])/c[0];
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ d=tridiagonal(a,b,c,g);
+ d.push(d[0]);
+ } else if(n == 2) {
+ d=new real[] {0,0};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with the natural condition
+// s''(a)=s''(b)=0.
+// if n=2, linear interpolation is returned
+// Don't use the natural type unless the underlying function
+// has zero second end points derivatives.
+real[] natural(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=2*(x[1]-x[0]);
+ c[0]=x[1]-x[0];
+ a[0]=0;
+ g[0]=3*(y[1]-y[0]);
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ a[n-1]=x[n-1]-x[n-2];
+ b[n-1]=2*a[n-1];
+ g[n-1]=3*(y[n-1]-y[n-2]);
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ real val=(y[1]-y[0])/(x[1]-x[0]);
+ d=new real[] {val,val};
+ } else abort(morepoints);
+ return d;
+}
+
+// Standard cubic spline interpolation with clamped conditions f'(a), f'(b)
+splinetype clamped(real slopea, real slopeb)
+{
+ return new real[] (real[] x, real[] y) {
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d;
+ if(n > 2) {
+ real[] a=new real[n];
+ real[] b=new real[n];
+ real[] c=new real[n];
+ real[] g=new real[n];
+ b[0]=x[1]-x[0];
+ g[0]=b[0]*slopea;
+ c[0]=0;
+ a[0]=0;
+ for(int i=1; i < n-1; ++i) {
+ a[i]=x[i+1]-x[i];
+ c[i]=x[i]-x[i-1];
+ b[i]=2*(a[i]+c[i]);
+ g[i]=3*(c[i]*(y[i+1]-y[i])/a[i]+a[i]*(y[i]-y[i-1])/c[i]);
+ }
+ c[n-1]=0;
+ a[n-1]=0;
+ b[n-1]=x[n-1]-x[n-2];
+ g[n-1]=b[n-1]*slopeb;
+ d=tridiagonal(a,b,c,g);
+ } else if(n == 2) {
+ d=new real[] {slopea,slopeb};
+ } else abort(morepoints);
+ return d;
+ };
+}
+
+// Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)
+// Modified MATLAB code
+// [1] Fritsch, F. N. and R. E. Carlson,
+// "Monotone Piecewise Cubic Interpolation,"
+// SIAM J. Numerical Analysis, Vol. 17, 1980, pp.238-246.
+// [2] Kahaner, David, Cleve Moler, Stephen Nash,
+// Numerical Methods and Software, Prentice Hall, 1988.
+real[] monotonic(real[] x, real[] y)
+{
+ int n=x.length;
+ checklengths(n,y.length);
+ real[] d=new real[n];
+ if(n > 2) {
+ real[] h=new real[n-1];
+ real[] del=new real[n-1];
+ for(int i=0; i < n-1; ++i) {
+ h[i]=x[i+1]-x[i];
+ del[i]=(y[i+1]-y[i])/h[i];
+ }
+ int j=0;
+ int k[]=new int[];
+ for(int i=0; i < n-2; ++i)
+ if((sgn(del[i])*sgn(del[i+1])) > 0) {k[j]=i; j=j+1;}
+
+ real[] hs=new real[j];
+ for(int i=0; i < j; ++i) hs[i]=h[k[i]]+h[k[i]+1];
+ real w1[]=new real[j];
+ real w2[]=new real[j];
+ real dmax[]=new real[j];
+ real dmin[]=new real[j];
+ for(int i=0; i < j; ++i) {
+ w1[i]=(h[k[i]]+hs[i])/(3*hs[i]);
+ w2[i]=(h[k[i]+1]+hs[i])/(3*hs[i]);
+ dmax[i]=max(abs(del[k[i]]),abs(del[k[i]+1]));
+ dmin[i]=min(abs(del[k[i]]),abs(del[k[i]+1]));
+ }
+ for(int i=0; i < n; ++i) d[i]=0;
+ for(int i=0; i < j; ++i)
+ d[k[i]+1]=dmin[i]/(w1[i]*(del[k[i]]/dmax[i])+w2[i]*(del[k[i]+1]/dmax[i]));
+ d[0]=((2*h[0]+h[1])*del[0]-h[0]*del[1])/(h[0]+h[1]);
+ if(sgn(d[0]) != sgn(del[0])) {d[0]=0;}
+ else if((sgn(del[0]) != sgn(del[1])) && (abs(d[0]) > abs(3*del[0])))
+ d[0]=3*del[0];
+
+ d[n-1]=((2*h[n-2]+h[n-3])*del[n-2]-h[n-2]*del[n-2])/(h[n-2]+h[n-3]);
+ if(sgn(d[n-1]) != sgn(del[n-2])) {d[n-1]=0;}
+ else if((sgn(del[n-2]) != sgn(del[n-3])) &&
+ (abs(d[n-1]) > abs(3*del[n-2])))
+ d[n-1]=3*del[n-2];
+ } else if(n == 2) {
+ d[0]=d[1]=(y[1]-y[0])/(x[1]-x[0]);
+ } else abort(morepoints);
+ return d;
+}
+
+// Return standard cubic spline interpolation as a guide
+guide hermite(real[] x, real[] y, splinetype splinetype=null)
+{
+ int n=x.length;
+ if(n == 0) return nullpath;
+
+ guide g=(x[0],y[0]);
+ if(n == 1) return g;
+ if(n == 2) return g--(x[1],y[1]);
+
+ if(splinetype == null)
+ splinetype=(x[0] == x[x.length-1] && y[0] == y[y.length-1]) ?
+ periodic : notaknot;
+
+ real[] dy=splinetype(x,y);
+ for(int i=1; i < n; ++i) {
+ pair z=(x[i],y[i]);
+ real dx=x[i]-x[i-1];
+ g=g..controls((x[i-1],y[i-1])+dx*(1,dy[i-1])/3) and (z-dx*(1,dy[i])/3)..z;
+ }
+ return g;
+}
diff --git a/Master/texmf/asymptote/interpolate.asy b/Master/texmf/asymptote/interpolate.asy
index a6b820bc7d5..a600c94c125 100644
--- a/Master/texmf/asymptote/interpolate.asy
+++ b/Master/texmf/asymptote/interpolate.asy
@@ -29,7 +29,7 @@
// Here s is a real function that is constant on (-infinity,a] and [b,infinity).
private import math;
-import splinetype;
+import graph_splinetype;
typedef real fhorner(real);
diff --git a/Master/texmf/asymptote/labelpath.asy b/Master/texmf/asymptote/labelpath.asy
index fe597a1608d..39c1908efd3 100644
--- a/Master/texmf/asymptote/labelpath.asy
+++ b/Master/texmf/asymptote/labelpath.asy
@@ -12,7 +12,7 @@ void labelpath(frame f, Label L, path g, string justify=Centered,
_labelpath(f,L.s,L.size,g,justify,(L.T.x,L.T.y+0.5linewidth(p)),p);
return;
}
- write("warning: labelpath requires -tex latex");
+ warning("labelpathlatex","labelpath requires -tex latex");
}
void labelpath(picture pic=currentpicture, Label L, path g,
diff --git a/Master/texmf/asymptote/labelpath3.asy b/Master/texmf/asymptote/labelpath3.asy
index bf2e6d4c084..8483a76a047 100644
--- a/Master/texmf/asymptote/labelpath3.asy
+++ b/Master/texmf/asymptote/labelpath3.asy
@@ -41,11 +41,11 @@ triple[] nextframe(path3 p, real reltimestart, triple[] start, real
return bf[subdiv];
}
-surface labelpath(string txt, path3 p, real angle=90, triple optional=O)
+surface labelpath(string s, path3 p, real angle=90, triple optional=O)
{
real Cos=Cos(angle);
real Sin=Sin(angle);
- path[] text=texpath(Label(txt,(0,0),Align,basealign));
+ path[] text=texpath(Label(s,(0,0),Align,basealign));
text=scale(1/(max(text).x-min(text).x))*text;
path[][] decompose=containmentTree(text);
diff --git a/Master/texmf/asymptote/obj.asy b/Master/texmf/asymptote/obj.asy
index 02f839b594d..158d417c136 100644
--- a/Master/texmf/asymptote/obj.asy
+++ b/Master/texmf/asymptote/obj.asy
@@ -21,7 +21,7 @@ struct obj {
pen[] meshpen;
path3[][] read(string datafile, bool verbose=false) {
- file in=word(line(input(datafile)));
+ file in=input(datafile).word().line();
triple[] vert;
path3[][] g;
g[0]=new path3[] ;
@@ -92,8 +92,8 @@ struct obj {
material surfacepen, pen meshpen=nullpen) {
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
operator init(read(datafile,verbose),surfacepen,meshpen);
}
}
diff --git a/Master/texmf/asymptote/plain.asy b/Master/texmf/asymptote/plain.asy
index 8424c767ffa..f9e18b883ea 100644
--- a/Master/texmf/asymptote/plain.asy
+++ b/Master/texmf/asymptote/plain.asy
@@ -20,8 +20,8 @@ include plain_constants;
access version;
if(version.VERSION != VERSION) {
- write(stdout,"warning: using possibly incompatible version "+
- version.VERSION+" of plain.asy"+'\n');
+ warning("version","using possibly incompatible version "+
+ version.VERSION+" of plain.asy"+'\n');
}
include plain_pens;
@@ -68,7 +68,7 @@ saveFunction[] saveFunctions={};
// When save is called, this will be redefined to do the corresponding restore.
void restore()
{
- write("warning: restore called with no matching save");
+ warning("nomatchingsave","restore called with no matching save");
}
void addSaveFunction(saveFunction s)
@@ -113,7 +113,8 @@ restoreThunk save()
void restoredefaults()
{
- write("warning: restoredefaults called with no matching savedefaults");
+ warning("nomatchingsavedefaults",
+ "restoredefaults called with no matching savedefaults");
}
restoreThunk buildRestoreDefaults()
diff --git a/Master/texmf/asymptote/plain_Label.asy b/Master/texmf/asymptote/plain_Label.asy
index 3c11a2cedbd..b75d0de3967 100644
--- a/Master/texmf/asymptote/plain_Label.asy
+++ b/Master/texmf/asymptote/plain_Label.asy
@@ -335,7 +335,13 @@ struct Label {
pic.add(new void (frame f, transform t) {
out(f,t,point(g,position),
alignrelative ? -Align*dir(t*g,position)*I : Align);
- },true);
+ },!alignrelative);
+
+ frame f;
+ pair align=alignrelative ? -Align*dir(g,position)*I : Align;
+ label(f,(0,0),align);
+ pair position=point(g,position);
+ pic.addBox(position,position,min(f),max(f));
}
void write(file file=stdout, suffix suffix=endl) {
diff --git a/Master/texmf/asymptote/plain_arrows.asy b/Master/texmf/asymptote/plain_arrows.asy
index 0ef8c2b2d5c..18618c2b5b8 100644
--- a/Master/texmf/asymptote/plain_arrows.asy
+++ b/Master/texmf/asymptote/plain_arrows.asy
@@ -543,27 +543,36 @@ void arrow(picture pic=currentpicture, Label L="", pair b, pair dir,
draw(b,pic,L,a--(0,0),align,p,arrow,margin);
}
-// Force an array of 2D pictures to be as least as large as picture all.
-void rescale2(picture[] pictures, picture all)
-{
- if(!all.empty2()) {
- transform t=inverse(all.calculateTransform()*pictures[0].T);
- pair m=t*min(all);
- pair M=t*max(all);
- for(int i=0; i < pictures.length; ++i) {
- draw(pictures[i],m,nullpen);
- draw(pictures[i],M,nullpen);
- }
- }
-}
-
-// Force an array of pictures to have a uniform scaling.
-void rescale(picture[] pictures)
-{
- if(pictures.length == 0) return;
+// Fit an array of pictures simultaneously using the sizing of picture all.
+frame[] fit2(picture[] pictures, picture all)
+{
+ frame[] out;
+ if(!all.empty2()) {
+ transform t=all.calculateTransform();
+ pair m=all.min(t);
+ pair M=all.max(t);
+ for(picture pic : pictures) {
+ frame f=pic.fit(t);
+ draw(f,m,nullpen);
+ draw(f,M,nullpen);
+ out.push(f);
+ }
+ }
+ return out;
+}
+
+// Fit an array of pictures simultaneously using the size of the first picture.
+frame[] fit(string prefix="", picture[] pictures, string format="",
+ bool view=true, string options="", string script="",
+ projection P=currentprojection)
+{
+ if(pictures.length == 0)
+ return new frame[];
+
picture all;
size(all,pictures[0]);
for(picture pic : pictures)
add(all,pic);
- rescale2(pictures,all);
+
+ return fit2(pictures,all);
}
diff --git a/Master/texmf/asymptote/plain_boxes.asy b/Master/texmf/asymptote/plain_boxes.asy
index 7fb82c37c1f..ff82a0b0b32 100644
--- a/Master/texmf/asymptote/plain_boxes.asy
+++ b/Master/texmf/asymptote/plain_boxes.asy
@@ -126,11 +126,11 @@ pair point(object F, pair dir, transform t=identity())
return z+point(F.g,T[0]);
}
-frame bbox(string prefix="", picture pic=currentpicture,
+frame bbox(picture pic=currentpicture,
real xmargin=0, real ymargin=xmargin,
pen p=currentpen, filltype filltype=NoFill)
{
- frame f=pic.fit(prefix,max(pic.xsize-2*xmargin,0),max(pic.ysize-2*ymargin,0));
+ frame f=pic.fit(max(pic.xsize-2*xmargin,0),max(pic.ysize-2*ymargin,0));
box(f,xmargin,ymargin,p,filltype,above=false);
return f;
}
diff --git a/Master/texmf/asymptote/plain_constants.asy b/Master/texmf/asymptote/plain_constants.asy
index c1d8c086f71..32138756891 100644
--- a/Master/texmf/asymptote/plain_constants.asy
+++ b/Master/texmf/asymptote/plain_constants.asy
@@ -67,6 +67,13 @@ void tab(file file) {write(file,'\t');}
void comma(file file) {write(file,',');}
typedef void suffix(file);
+// Used by interactive write to warn that the outputted type is the resolution
+// of an overloaded name.
+void overloadedMessage(file file) {
+ write(file,' <overloaded>');
+ endl(file);
+}
+
void write(suffix suffix=endl) {suffix(stdout);}
void write(file file, suffix suffix=none) {suffix(file);}
diff --git a/Master/texmf/asymptote/plain_paths.asy b/Master/texmf/asymptote/plain_paths.asy
index d457fa5bc28..bf3f2790c1d 100644
--- a/Master/texmf/asymptote/plain_paths.asy
+++ b/Master/texmf/asymptote/plain_paths.asy
@@ -178,7 +178,7 @@ slice cut(path p, path knife, int n)
slice s;
real[][] T=intersections(p,knife);
if(T.length == 0) {s.before=p; s.after=nullpath; return s;}
- T.cyclic(true);
+ T.cyclic=true;
real t=T[n][0];
s.before=subpath(p,0,t);
s.after=subpath(p,t,length(p));
diff --git a/Master/texmf/asymptote/plain_pens.asy b/Master/texmf/asymptote/plain_pens.asy
index fd2dfadde68..a8a0d0c7461 100644
--- a/Master/texmf/asymptote/plain_pens.asy
+++ b/Master/texmf/asymptote/plain_pens.asy
@@ -139,11 +139,11 @@ pen[] colorPen={red,blue,green,magenta,cyan,orange,purple,brown,
deepblue,deepgreen,chartreuse,fuchsia,lightred,
lightblue,black,pink,yellow,gray};
-colorPen.cyclic(true);
+colorPen.cyclic=true;
pen[] monoPen={solid,dashed,dotted,longdashed,dashdotted,
longdashdotted};
-monoPen.cyclic(true);
+monoPen.cyclic=true;
pen Pen(int n)
{
diff --git a/Master/texmf/asymptote/plain_picture.asy b/Master/texmf/asymptote/plain_picture.asy
index b3836d7ef51..432a4a6ae6d 100644
--- a/Master/texmf/asymptote/plain_picture.asy
+++ b/Master/texmf/asymptote/plain_picture.asy
@@ -401,10 +401,18 @@ struct transformation {
transform3 compute() {
return projection*modelview;
}
+ transformation copy() {
+ transformation T=new transformation;
+ T.modelview=copy(modelview);
+ T.projection=copy(projection);
+ T.infinity=infinity;
+ T.oblique=oblique;
+ return T;
+ }
}
struct projection {
- transform3 t; // projection*modelview (cached)
+ transform3 t; // projection*modelview (cached)
bool infinity;
bool oblique;
bool absolute=false;
@@ -420,21 +428,16 @@ struct projection {
bool autoadjust=true; // Adjust camera to lie outside bounding volume?
bool center=false; // Center target within bounding volume?
int ninterpolate; // Used for projecting nurbs to 2D Bezier curves.
+ transformation T;
void calculate() {
- transformation T=projector(camera,up,target);
+ T=projector(camera,up,target);
t=T.compute();
infinity=T.infinity;
oblique=T.oblique;
ninterpolate=infinity ? 1 : 16;
}
- transformation transformation() {
- return projector(camera,up,target);
- }
-
- transform3 modelview() {return transformation().modelview;}
-
triple vector() {
return camera-target;
}
@@ -473,6 +476,7 @@ struct projection {
P.center=center;
P.projector=projector;
P.ninterpolate=ninterpolate;
+ P.T=T.copy();
return P;
}
@@ -500,6 +504,71 @@ struct projection {
projection currentprojection;
+struct light {
+ real[][] diffuse;
+ real[][] ambient;
+ real[][] specular;
+ pen background=nullpen; // Background color of the 3D canvas.
+ real specularfactor;
+ bool viewport; // Are the lights specified (and fixed) in the viewport frame?
+ triple[] position; // Only directional lights are currently implemented.
+
+ transform3 T=identity(4); // Transform to apply to normal vectors.
+
+ bool on() {return position.length > 0;}
+
+ void operator init(pen[] diffuse,
+ pen[] ambient=array(diffuse.length,black),
+ pen[] specular=diffuse, pen background=nullpen,
+ real specularfactor=1,
+ bool viewport=false, triple[] position) {
+ int n=diffuse.length;
+ assert(ambient.length == n && specular.length == n && position.length == n);
+
+ this.diffuse=new real[n][];
+ this.ambient=new real[n][];
+ this.specular=new real[n][];
+ this.background=background;
+ this.position=new triple[n];
+ for(int i=0; i < position.length; ++i) {
+ this.diffuse[i]=rgba(diffuse[i]);
+ this.ambient[i]=rgba(ambient[i]);
+ this.specular[i]=rgba(specular[i]);
+ this.position[i]=unit(position[i]);
+ }
+ this.specularfactor=specularfactor;
+ this.viewport=viewport;
+ }
+
+ void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
+ pen background=nullpen, real specularfactor=1,
+ bool viewport=false...triple[] position) {
+ int n=position.length;
+ operator init(array(n,diffuse),array(n,ambient),array(n,specular),
+ background,specularfactor,viewport,position);
+ }
+
+ void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
+ pen background=nullpen, bool viewport=false,
+ real x, real y, real z) {
+ operator init(diffuse,ambient,specular,background,viewport,(x,y,z));
+ }
+
+ void operator init(explicit light light) {
+ diffuse=copy(light.diffuse);
+ ambient=copy(light.ambient);
+ specular=copy(light.specular);
+ background=light.background;
+ specularfactor=light.specularfactor;
+ viewport=light.viewport;
+ position=copy(light.position);
+ }
+
+ real[] background() {return rgba(background == nullpen ? white : background);}
+}
+
+light currentlight;
+
triple min3(pen p)
{
return linewidth(p)*(-0.5,-0.5,-0.5);
@@ -990,7 +1059,7 @@ struct picture {
if(status == simplex.problem.OPTIMAL) {
return scaling.build(p.a(),p.b()).a;
} else if(status == simplex.problem.UNBOUNDED) {
- if(warn) write("warning: "+dir+" scaling in picture unbounded");
+ if(warn) warning("unbounded",dir+" scaling in picture unbounded");
return 0;
} else {
if(!warn) return 1;
@@ -1001,8 +1070,8 @@ struct picture {
abort("unbounded picture");
}
if(userzero) return 1;
- write("warning: cannot fit picture to "+dir+"size "+(string) size
- +"...enlarging...");
+ warning("cannotfit","cannot fit picture to "+dir+"size "+(string) size
+ +"...enlarging...");
return calculateScaling(dir,coords,sqrt(2)*size,warn);
}
}
@@ -1184,11 +1253,11 @@ struct picture {
pair d=size(f);
static real epsilon=100*realEpsilon;
if(d.x > xsize*(1+epsilon))
- write("warning: frame exceeds xlimit: "+(string) d.x+" > "+
- (string) xsize);
+ warning("xlimit","frame exceeds xlimit: "+(string) d.x+" > "+
+ (string) xsize);
if(d.y > ysize*(1+epsilon))
- write("warning: frame exceeds ylimit: "+(string) d.y+" > "+
- (string) ysize);
+ warning("ylimit","frame exceeds ylimit: "+(string) d.y+" > "+
+ (string) ysize);
return f;
}
@@ -1290,14 +1359,15 @@ struct picture {
}
static frame fitter(string,picture,string,real,real,bool,bool,string,string,
- projection);
+ light,projection);
frame fit(string prefix="", string format="",
real xsize=this.xsize, real ysize=this.ysize,
bool keepAspect=this.keepAspect, bool view=false,
- string options="", string script="",
+ string options="", string script="", light light=currentlight,
projection P=currentprojection) {
return fitter == null ? fit2(xsize,ysize,keepAspect) :
- fitter(prefix,this,format,xsize,ysize,keepAspect,view,options,script,P);
+ fitter(prefix,this,format,xsize,ysize,keepAspect,view,options,script,
+ light,P);
}
// In case only an approximate picture size estimate is available, return the
diff --git a/Master/texmf/asymptote/plain_shipout.asy b/Master/texmf/asymptote/plain_shipout.asy
index 22aeef7121f..2e86822cad0 100644
--- a/Master/texmf/asymptote/plain_shipout.asy
+++ b/Master/texmf/asymptote/plain_shipout.asy
@@ -27,7 +27,7 @@ typedef frame orientation(frame);
orientation orientation=Portrait;
// Forward references to functions defined in module three.
-object embed3(string, frame, string, string, string, projection);
+object embed3(string, frame, string, string, string, light, projection);
string Embed(string name, string options="", real width=0, real height=0);
string Link(string label, string text, string options="");
@@ -59,10 +59,10 @@ include plain_xasy;
void shipout(string prefix=defaultfilename, frame f,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection)
+ light light=currentlight, projection P=currentprojection)
{
if(is3D(f)) {
- f=enclose(prefix,embed3(prefix,f,format,options,script,P));
+ f=enclose(prefix,embed3(prefix,f,format,options,script,light,P));
if(settings.render != 0 && !prc(format)) {
shipped=true;
return;
@@ -88,14 +88,14 @@ void shipout(string prefix=defaultfilename, picture pic=currentpicture,
orientation orientation=orientation,
string format="", bool wait=false, bool view=true,
string options="", string script="",
- projection P=currentprojection)
+ light light=currentlight, projection P=currentprojection)
{
if(!uptodate()) {
bool inlinetex=settings.inlinetex;
bool prc=prc(format);
if(prc && !pic.empty3())
settings.inlinetex=settings.inlineimage;
- frame f=pic.fit(prefix,format,view=view,options,script,P);
+ frame f=pic.fit(prefix,format,view=view,options,script,light,P);
if(!pic.empty2() || settings.render == 0 || prc)
shipout(prefix,orientation(f),format,wait,view);
settings.inlinetex=inlinetex;
diff --git a/Master/texmf/asymptote/slide.asy b/Master/texmf/asymptote/slide.asy
index b154c1d4746..b23a352fc5d 100644
--- a/Master/texmf/asymptote/slide.asy
+++ b/Master/texmf/asymptote/slide.asy
@@ -217,11 +217,10 @@ bool checkposition()
return true;
}
-void step()
-{
+void erasestep(int erasenode) {
if(!stepping || !allowstepping) return;
if(!checkposition()) return;
- lastnode.push(currentpicture.nodes.length-1);
+ lastnode.push(erasenode);
nextpage(steppagenumberpen);
for(int i=0; i < firstnode.length; ++i) {
for(int j=firstnode[i]; j <= lastnode[i]; ++j) {
@@ -233,6 +232,12 @@ void step()
tex(bulletcolor(newbulletcolor));
}
+void step()
+{
+ // Step without erasing anything.
+ erasestep(currentpicture.nodes.length-1);
+}
+
void incrementposition(pair z)
{
currentposition += z;
@@ -279,11 +284,13 @@ void remark(bool center=false, string s, pair align=0, pen p=itempen,
pair M=tinv*min(f);
if(abs(offset.x+M.x) > 1)
- write("warning: slide too wide on page "+(string) page+':\n'+(string) s);
+ warning("slidetoowide","slide too wide on page "+(string) page+':\n'+
+ (string) s);
if(abs(offset.y+M.y) > 1) {
void toohigh() {
- write("warning: slide too high on page "+(string) page+':\n'+(string) s);
+ warning("slidetoohigh","slide too high on page "+(string) page+':\n'+
+ (string) s);
}
if(M.y-m.y < 2) {
newslide(); offset=(offset.x,currentposition.y);
@@ -326,7 +333,7 @@ void skip(real n=1)
}
void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
if(f.length == 0) return;
real[] width=new real[f.length];
@@ -336,7 +343,7 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
sum += width[i];
}
if(sum > pagewidth)
- write("warning: slide too wide on page "+(string) page);
+ warning("toowide","slide too wide on page "+(string) page);
else margin=(pagewidth-sum)/(f.length+1);
real pos;
frame F;
@@ -347,19 +354,22 @@ void display(frame[] f, real margin=0, pair align=S, pen p=itempen,
pos += w;
}
add(F,(0,currentposition.y),align);
- real a=0.5(unit(align).y-1);
- incrementposition((0,(tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ if (final) {
+ real a=0.5(unit(align).y-1);
+ incrementposition(
+ (0, (tinv*(a*(max(F)-min(F))-itemskip*I*lineskip(p)*pt)).y));
+ }
}
void display(frame f, real margin=0, pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new frame[] {f},margin,align,p,figuremattpen);
+ display(new frame[] {f},margin,align,p,figuremattpen, final);
}
void display(string[] s, real margin=0, string[] captions=new string[],
string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
frame[] f=new frame[s.length];
frame F;
@@ -374,32 +384,59 @@ void display(string[] s, real margin=0, string[] captions=new string[],
if(captions[i] != "")
label(f[i],captions[i],point(f[i],S).x+I*y,S);
}
- display(f,margin,align,p,figuremattpen);
+ display(f,margin,align,p,figuremattpen, final);
if(caption != "") center(caption,p);
}
void display(string s, string caption="", pair align=S, pen p=itempen,
- pen figuremattpen=figuremattpen)
+ pen figuremattpen=figuremattpen, bool final=true)
{
- display(new string[] {s},caption,align,p,figuremattpen);
+ display(new string[] {s},caption,align,p,figuremattpen, final);
}
void figure(string[] s, string options="", real margin=0,
string[] captions=new string[], string caption="",
- pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen,
+ bool final=true)
{
string[] S;
for(int i=0; i < s.length; ++i) {
S[i]=graphic(s[i],options);
}
- display(S,margin,captions,caption,align,itempen,figuremattpen);
+ display(S,margin,captions,caption,align,itempen,figuremattpen, final);
}
void figure(string s, string options="", string caption="", pair align=S,
- pen p=itempen, pen figuremattpen=figuremattpen)
+ pen p=itempen, pen figuremattpen=figuremattpen, bool final=true)
+{
+ figure(new string[] {s},options,caption,align,p,figuremattpen, final);
+}
+
+void multifigure(string[] slist, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
+{
+ if (stepping) {
+ int lastnode = currentpicture.nodes.length-1;
+ for (int i=0; i<slist.length-1; ++i) {
+ figure(slist[i], options, caption, align, p, figuremattpen, final=false);
+ erasestep(lastnode);
+ }
+ }
+ figure(slist[slist.length-1], options, caption, align, p, figuremattpen,
+ final=true);
+
+ if(!firststep) step();
+ firststep=false;
+}
+
+void indexedfigure(string prefix, int n, string options="", string caption="",
+ pair align=S, pen p=itempen, pen figuremattpen=figuremattpen)
{
- figure(new string[] {s},options,caption,align,p,figuremattpen);
+ string[] s;
+ for (int i=0; i<n; ++i)
+ s.push(prefix+"+"+string(i));
+ multifigure(s, options, caption, align, p, figuremattpen);
}
string[] codefile;
diff --git a/Master/texmf/asymptote/solids.asy b/Master/texmf/asymptote/solids.asy
index 0b2ffa2a508..db98af3088c 100644
--- a/Master/texmf/asymptote/solids.asy
+++ b/Master/texmf/asymptote/solids.asy
@@ -212,7 +212,8 @@ struct revolution {
// must be recomputed if camera is adjusted
path3[] silhouette(int m=64, projection P=currentprojection) {
if(is3D())
- write("warning: silhouette routine is intended only for 2d projections");
+ warning("2Dsilhouette",
+ "silhouette routine is intended only for 2d projections");
path3 G,H;
int N=size(g);
int M=(m == 0) ? N : m;
diff --git a/Master/texmf/asymptote/syzygy.asy b/Master/texmf/asymptote/syzygy.asy
index dce87805c9d..93889b252e5 100644
--- a/Master/texmf/asymptote/syzygy.asy
+++ b/Master/texmf/asymptote/syzygy.asy
@@ -669,16 +669,6 @@ Braid apply(Relation r, Braid b, int step, int place) {
}
// Tableau {{{1
-frame[] fit(picture[] pics) {
- frame[] f;
- for (int i=0; i<pics.length; ++i) {
- frame ff=pics[i].fit();
- //label(ff, (string)i, (10,10));
- //f.push(pics[i].fit());
- f.push(ff);
- }
- return f;
-}
// Draw a number of frames in a nice circular arrangement.
picture tableau(frame[] cards, bool number=false) {
diff --git a/Master/texmf/asymptote/three.asy b/Master/texmf/asymptote/three.asy
index 39075193073..1f9392ee094 100644
--- a/Master/texmf/asymptote/three.asy
+++ b/Master/texmf/asymptote/three.asy
@@ -13,13 +13,11 @@ if(prc0()) {
real defaultshininess=0.25;
real defaultgranularity=0;
-real linegranularity=0.01;
-real tubegranularity=0.003;
+real linegranularity=0.005;
+int linesectors=8; // Number of angular sectors.
real dotgranularity=0.0001;
-real viewportfactor=1.002; // Factor used to expand orthographic viewport.
-real angleprecision=1e-3; // Precision for centering perspective projections.
-real anglefactor=max(1.01,1+angleprecision);
-// Factor used to expand perspective viewport.
+real angleprecision=1e-5; // Precision for centering perspective projections.
+real rendermargin=0.02;
string defaultembed3Doptions;
string defaultembed3Dscript;
@@ -137,7 +135,9 @@ triple project(triple u, triple v)
triple perp(triple v)
{
triple u=cross(v,Y);
- return (abs(u) > sqrtEpsilon) ? unit(u) : unit(cross(v,Z));
+ if(abs(u) > sqrtEpsilon) return unit(u);
+ u=cross(v,Z);
+ return (abs(u) > sqrtEpsilon) ? unit(u) : X;
}
// Return the transformation corresponding to moving the camera from the target
@@ -757,7 +757,7 @@ real[] theta(triple[] v, real[] alpha, real[] beta,
{
real[] a,b,c,f,l,psi;
int n=alpha.length;
- bool cyclic=v.cyclicflag;
+ bool cyclic=v.cyclic;
for(int i=0; i < n; ++i)
l[i]=1/length(v[i+1]-v[i]);
int i0,in;
@@ -766,8 +766,8 @@ real[] theta(triple[] v, real[] alpha, real[] beta,
for(int i=0; i < in; ++i)
psi[i]=angle(v[i+1]-v[i],v[i+2]-v[i+1],reference);
if(cyclic) {
- l.cyclic(true);
- psi.cyclic(true);
+ l.cyclic=true;
+ psi.cyclic=true;
} else {
psi[n-1]=0;
if(dir0 == O) {
@@ -869,9 +869,9 @@ void aim(flatguide3 g, int N)
beta[k]=g.Tension[K].in;
}
if(cyclic) {
- v.cyclic(true);
- alpha.cyclic(true);
- beta.cyclic(true);
+ v.cyclic=true;
+ alpha.cyclic=true;
+ beta.cyclic=true;
} else v[n]=g.nodes[(start+n) % N];
int final=(end-1) % N;
@@ -883,8 +883,8 @@ void aim(flatguide3 g, int N)
real[] theta=theta(v,alpha,beta,d0,d1,g.out[start].gamma,g.in[final].gamma,
reference);
- v.cyclic(true);
- theta.cyclic(true);
+ v.cyclic=true;
+ theta.cyclic=true;
for(int k=1; k < (cyclic ? n+1 : n); ++k) {
triple w=dir(theta[k],v[k]-v[k-1],v[k+1]-v[k],reference);
@@ -1029,6 +1029,17 @@ path3[] path3(explicit path[] g, triple plane(pair)=XYplane)
return sequence(new path3(int i) {return path3(g[i],plane);},g.length);
}
+path3 invert(path p, triple normal, triple point,
+ projection P=currentprojection)
+{
+ return path3(p,new triple(pair z) {return invert(z,normal,point,P);});
+}
+
+path3 invert(path p, projection P=currentprojection)
+{
+ return path3(p,new triple(pair z) {return invert(z,P);});
+}
+
// Construct a path from a path3 by applying P to each control point.
path path(path3 p, pair P(triple)=xypart)
{
@@ -1801,6 +1812,16 @@ triple[] operator * (transform3 t, triple[] v)
return sequence(new triple(int i) {return t*v[i];},v.length);
}
+triple[][] operator * (transform3 t, triple[][] v)
+{
+ triple[][] V=new triple[v.length][];
+ for(int i=0; i < v.length; ++i) {
+ triple[] vi=v[i];
+ V[i]=sequence(new triple(int j) {return t*vi[j];},vi.length);
+ }
+ return V;
+}
+
triple min(explicit path3[] p)
{
checkEmpty(p.length);
@@ -1978,6 +1999,38 @@ void addPath(picture pic, path3 g, pen p)
include three_surface;
include three_margins;
+pair min(path3 p, projection P)
+{
+ path3 q=P.T.modelview*p;
+ if(P.infinity)
+ return xypart(min(q));
+ return maxratio(q)/P.T.projection[3][2];
+}
+
+pair max(path3 p, projection P)
+{
+ path3 q=P.T.modelview*p;
+ if(P.infinity)
+ return xypart(max(q));
+ return minratio(q)/P.T.projection[3][2];
+}
+
+pair min(frame f, projection P)
+{
+ frame g=P.T.modelview*f;
+ if(P.infinity)
+ return xypart(min3(g));
+ return maxratio(g)/P.T.projection[3][2];
+}
+
+pair max(frame f, projection P)
+{
+ frame g=P.T.modelview*f;
+ if(P.infinity)
+ return xypart(max3(g));
+ return minratio(g)/P.T.projection[3][2];
+}
+
void draw(picture pic=currentpicture, Label L="", path3 g,
align align=NoAlign, material p=currentpen, margin3 margin=NoMargin3,
light light=nolight)
@@ -1988,8 +2041,8 @@ void draw(picture pic=currentpicture, Label L="", path3 g,
if(is3D()) {
draw(f,G,p,light,null);
if(pic != null && size(G) > 0) {
- pic.addPoint(min(G,P.t));
- pic.addPoint(max(G,P.t));
+ pic.addPoint(min(G,P));
+ pic.addPoint(max(G,P));
}
}
if(pic != null)
@@ -2004,7 +2057,7 @@ void draw(picture pic=currentpicture, Label L="", path3 g,
addPath(pic,g,q);
}
-include three_arrows;
+include three_tube;
draw=new void(frame f, path3 g, material p=currentpen,
light light=nolight, projection P=currentprojection) {
@@ -2015,7 +2068,7 @@ draw=new void(frame f, path3 g, material p=currentpen,
if(settings.thick) {
real width=linewidth(q);
if(width > 0) {
- tube T=tube(g,width,p.granularity);
+ tube T=tube(g,width,linesectors);
int L=length(g);
if(L >= 0) {
if(!cyclic(g)) {
@@ -2050,7 +2103,7 @@ draw=new void(frame f, path3 g, material p=currentpen,
else {
real[] dash=(real[]) split(type," ");
if(sum(dash) > 0) {
- dash.cyclic(true);
+ dash.cyclic=true;
real offset=offset(q);
real L=arclength(g);
int i=0;
@@ -2081,6 +2134,8 @@ void draw(picture pic=currentpicture, explicit path3[] g,
for(int i=0; i < g.length; ++i) draw(pic,g[i],p,margin,light);
}
+include three_arrows;
+
void draw(picture pic=currentpicture, Label L="", path3 g,
align align=NoAlign, material p=currentpen, arrowbar3 arrow,
arrowbar3 bar=None, margin3 margin=NoMargin3, light light=nolight,
@@ -2321,7 +2376,7 @@ pair viewportmargin(pair lambda)
string embed3D(string label="", string text=label, string prefix,
frame f, string format="",
- real width=0, real height=0, real angle=30,
+ real width=0, real height=0,
string options="", string script="",
light light=currentlight, projection P=currentprojection)
{
@@ -2341,7 +2396,7 @@ string embed3D(string label="", string text=label, string prefix,
pair margin=viewportmargin((lambda.x,lambda.y));
viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/(cm*P.zoom);
} else
- if(!P.absolute) angle=2*aTan(Tan(0.5*angle));
+ if(!P.absolute) P.angle=2*aTan(Tan(0.5*P.angle));
string name=prefix+".js";
writeJavaScript(name,lightscript+projection(P.infinity,viewplanesize),script);
@@ -2375,7 +2430,7 @@ string embed3D(string label="", string text=label, string prefix,
options3 += ",poster";
options3 += ",text={"+text+"},label="+label+
",toolbar="+(settings.toolbar ? "true" : "false")+
- ",3Daac="+Format(P.absolute ? P.angle : angle)+
+ ",3Daac="+Format(P.angle)+
",3Dc2c="+Format(u)+
",3Dcoo="+Format(target/cm)+
",3Droll="+Format(roll)+
@@ -2387,302 +2442,350 @@ string embed3D(string label="", string text=label, string prefix,
return Embed(stripdirectory(prefix),options3,width,height);
}
-object embed(string label="", string text=label,
- string prefix=defaultfilename,
- frame f, string format="",
- real width=0, real height=0, real angle=30,
- string options="", string script="",
- light light=currentlight, projection P=currentprojection)
-{
- object F;
-
- if(is3D(format))
- F.L=embed3D(label,text,prefix,f,format,width,height,angle,options,script,
- light,P);
- else
- F.f=f;
- return F;
-}
-
-object embed(string label="", string text=label,
- string prefix=defaultfilename,
- picture pic, string format="",
- real xsize=pic.xsize, real ysize=pic.ysize,
- bool keepAspect=pic.keepAspect, bool view=true, string options="",
- string script="", real angle=0,
- light light=currentlight, projection P=currentprojection)
+struct scene
{
- object F;
- real xsize3=pic.xsize3, ysize3=pic.ysize3, zsize3=pic.zsize3;
- bool warn=true;
- transform3 modelview;
-
- if(xsize3 == 0 && ysize3 == 0 && zsize3 == 0) {
- xsize3=ysize3=zsize3=max(xsize,ysize);
- warn=false;
+ frame f;
+ transform3 t;
+ projection P;
+ bool adjusted;
+ real width,height;
+ transform3 T=identity4;
+ picture pic2;
+
+ void operator init(frame f, projection P=currentprojection) {
+ this.f=f;
+ this.t=identity4;
+ this.P=P;
}
+
+ void operator init(picture pic, real xsize=pic.xsize, real ysize=pic.ysize,
+ bool keepAspect=pic.keepAspect, bool is3D=true,
+ projection P=currentprojection) {
+ real xsize3=pic.xsize3, ysize3=pic.ysize3, zsize3=pic.zsize3;
+ bool warn=true;
+
+ if(xsize3 == 0 && ysize3 == 0 && zsize3 == 0) {
+ xsize3=ysize3=zsize3=max(xsize,ysize);
+ warn=false;
+ }
- projection P=P.copy();
+ if(P.absolute)
+ this.P=P.copy();
+ else if(P.showtarget)
+ draw(pic,P.target,nullpen);
- if(!P.absolute && P.showtarget)
- draw(pic,P.target,nullpen);
+ t=pic.scaling(xsize3,ysize3,zsize3,keepAspect,warn);
+ adjusted=false;
+ triple m=pic.min(t);
+ triple M=pic.max(t);
- transform3 t=pic.scaling(xsize3,ysize3,zsize3,keepAspect,warn);
- bool adjusted=false;
- transform3 tinv=inverse(t);
- triple m=pic.min(t);
- triple M=pic.max(t);
+ if(!P.absolute) {
+ this.P=t*P;
+ if(this.P.center) {
+ bool recalculate=false;
+ triple target=0.5*(m+M);
+ this.P.target=target;
+ recalculate=true;
+ if(recalculate) this.P.calculate();
+ }
+ if(this.P.autoadjust || this.P.infinity)
+ adjusted=adjusted | this.P.adjust(m,M);
+ }
- if(!P.absolute) {
- P=t*P;
- if(P.center) {
- bool recalculate=false;
- triple target=0.5*(m+M);
- P.target=target;
- recalculate=true;
- if(recalculate) P.calculate();
+ f=pic.fit3(t,pic.bounds3.exact ? pic2 : null,this.P);
+
+ if(!pic.bounds3.exact) {
+ transform3 s=pic.scale3(f,xsize3,ysize3,zsize3,keepAspect);
+ t=s*t;
+ this.P=s*this.P;
+ f=pic.fit3(t,pic2,this.P);
}
- if(P.autoadjust || P.infinity)
- adjusted=adjusted | P.adjust(m,M);
- }
- picture pic2;
-
- frame f=pic.fit3(t,pic.bounds3.exact ? pic2 : null,P);
+ bool scale=xsize != 0 || ysize != 0;
+
+ if(is3D || scale) {
+ pic2.bounds.exact=true;
+ transform s=pic2.scaling(xsize,ysize,keepAspect);
+
+ pair m2=pic2.min(s);
+ pair M2=pic2.max(s);
+ pair lambda=M2-m2;
+ pair viewportmargin=viewportmargin(lambda);
+ width=ceil(lambda.x+2*viewportmargin.x);
+ height=ceil(lambda.y+2*viewportmargin.y);
+
+ if(!this.P.absolute) {
+ if(scale && this.P.autoadjust) {
+ pair v=(s.xx,s.yy);
+ transform3 T=this.P.t;
+ pair x=project(X,T);
+ pair y=project(Y,T);
+ pair z=project(Z,T);
+ real f(pair a, pair b) {
+ return b == 0 ? (0.5*(a.x+a.y)) :
+ (b.x^2*a.x+b.y^2*a.y)/(b.x^2+b.y^2);
+ }
+ pic2.erase();
+ transform3 s=keepAspect ? scale3(min(f(v,x),f(v,y),f(v,z))) :
+ xscale3(f(v,x))*yscale3(f(v,y))*zscale3(f(v,z));
+ s=shift(this.P.target)*s*shift(-this.P.target);
+ t=s*t;
+ this.P=s*this.P;
+ f=pic.fit3(t,is3D ? null : pic2,this.P);
+ }
- if(!pic.bounds3.exact) {
- transform3 s=pic.scale3(f,xsize3,ysize3,zsize3,keepAspect);
- t=s*t;
- tinv=inverse(t);
- P=s*P;
- f=pic.fit3(t,pic2,P);
+ if(this.P.autoadjust || this.P.infinity)
+ adjusted=adjusted | this.P.adjust(min3(f),max3(f));
+ }
+ }
}
- bool is3D=is3D(format);
- bool scale=xsize != 0 || ysize != 0;
-
- if(is3D || scale) {
- pic2.bounds.exact=true;
- transform s=pic2.scaling(xsize,ysize,keepAspect);
- pair m2=pic2.min(s);
- pair M2=pic2.max(s);
- pair lambda=M2-m2;
- pair viewportmargin=viewportmargin(lambda);
- real width=ceil(lambda.x+2*viewportmargin.x);
- real height=ceil(lambda.y+2*viewportmargin.y);
-
- projection Q;
- if(!P.absolute) {
- if(scale && P.autoadjust) {
- pair v=(s.xx,s.yy);
- transform3 T=P.t;
- pair x=project(X,T);
- pair y=project(Y,T);
- pair z=project(Z,T);
- real f(pair a, pair b) {
- return b == 0 ? (0.5*(a.x+a.y)) : (b.x^2*a.x+b.y^2*a.y)/(b.x^2+b.y^2);
+ // Choose the angle to be just large enough to view the entire image.
+ real angle(projection P) {
+ T=identity4;
+ int maxiterations=100;
+ real h=-0.5*P.target.z;
+ pair r,R;
+ real diff=realMax;
+ pair s;
+ int i;
+ do {
+ r=minratio(f);
+ R=maxratio(f);
+ pair lasts=s;
+ if(P.autoadjust) {
+ s=r+R;
+ if(s != 0) {
+ transform3 t=shift(h*s.x,h*s.y,0);
+ f=t*f;
+ T=t*T;
+ adjusted=true;
}
- pic2.erase();
- transform3 s=keepAspect ? scale3(min(f(v,x),f(v,y),f(v,z))) :
- xscale3(f(v,x))*yscale3(f(v,y))*zscale3(f(v,z));
- s=shift(P.target)*s*shift(-P.target);
- t=s*t;
- P=s*P;
- f=pic.fit3(t,is3D ? null : pic2,P);
}
+ diff=abs(s-lasts);
+ ++i;
+ } while (diff > angleprecision && i < maxiterations);
+ real aspect=width > 0 ? height/width : 1;
+ real rx=-r.x*aspect;
+ real Rx=R.x*aspect;
+ real ry=-r.y;
+ real Ry=R.y;
+ if(!P.autoadjust) {
+ if(rx > Rx) Rx=rx;
+ else rx=Rx;
+ if(ry > Ry) Ry=ry;
+ else ry=Ry;
+ }
+ return (1+angleprecision)*max(aTan(rx)+aTan(Rx),aTan(ry)+aTan(Ry));
+ }
+}
- if(P.autoadjust || P.infinity)
- adjusted=adjusted | P.adjust(min3(f),max3(f));
+object embed(string label="", string text=label, string prefix=defaultfilename,
+ scene S, string format="", bool view=true, string options="",
+ string script="", light light=currentlight)
+{
+ object F;
+ transform3 modelview;
+ projection P=S.P;
+ transform3 tinv=inverse(S.t);
- triple target=P.target;
- modelview=P.modelview();
- f=modelview*f;
- P=modelview*P;
- Q=P.copy();
- light=modelview*light;
-
- if(P.infinity) {
- triple m=min3(f);
- triple M=max3(f);
- triple lambda=M-m;
- viewportmargin=viewportmargin((lambda.x,lambda.y));
- width=lambda.x+2*viewportmargin.x;
- height=lambda.y+2*viewportmargin.y;
- f=shift((-0.5(m.x+M.x),-0.5*(m.y+M.y),0))*f; // Eye will be at (0,0,0).
- } else {
- transform3 T=identity4;
- // Choose the angle to be just large enough to view the entire image:
- if(angle == 0) angle=P.angle;
- int maxiterations=100;
- if(is3D && angle == 0) {
- real h=-0.5*P.target.z;
- pair r,R;
- real diff=realMax;
- pair s;
- int i;
- do {
- r=minratio(f);
- R=maxratio(f);
- pair lasts=s;
- if(P.autoadjust) {
- s=r+R;
- if(s != 0) {
- transform3 t=shift(h*s.x,h*s.y,0);
- f=t*f;
- T=t*T;
- adjusted=true;
- }
- }
- diff=abs(s-lasts);
- ++i;
- } while (diff > angleprecision && i < maxiterations);
- real aspect=width > 0 ? height/width : 1;
- real rx=-r.x*aspect;
- real Rx=R.x*aspect;
- real ry=-r.y;
- real Ry=R.y;
- if(!P.autoadjust) {
- if(rx > Rx) Rx=rx;
- else rx=Rx;
- if(ry > Ry) Ry=ry;
- else ry=Ry;
- }
-
- angle=anglefactor*max(aTan(rx)+aTan(Rx),aTan(ry)+aTan(Ry));
- if(viewportmargin.y != 0)
- angle=2*aTan(Tan(0.5*angle)-viewportmargin.y/P.target.z);
-
- modelview=T*modelview;
- }
- if(settings.verbose > 0) {
- transform3 inv=inverse(modelview);
- if(adjusted)
- write("adjusting camera to ",tinv*inv*P.camera);
- target=inv*P.target;
- }
- P=T*P;
+ projection Q;
+ modelview=P.T.modelview;
+ if(P.absolute) {
+ Q=modelview*P;
+ } else {
+ triple target=P.target;
+ S.f=modelview*S.f;
+ P=modelview*P;
+ Q=P.copy();
+ light=modelview*light;
+
+ pair viewportmargin=viewportmargin;
+ if(P.infinity) {
+ triple m=min3(S.f);
+ triple M=max3(S.f);
+ triple lambda=M-m;
+ viewportmargin=viewportmargin((lambda.x,lambda.y));
+ S.width=lambda.x+2*viewportmargin.x;
+ S.height=lambda.y+2*viewportmargin.y;
+ S.f=shift((-0.5(m.x+M.x),-0.5*(m.y+M.y),0))*S.f; // Eye will be at (0,0,0)
+ } else {
+ if(P.angle == 0) {
+ Q.angle=P.angle=S.angle(P);
+ modelview=S.T*modelview;
+ if(viewportmargin.y != 0)
+ P.angle=2*aTan(Tan(0.5*P.angle)-viewportmargin.y/P.target.z);
}
if(settings.verbose > 0) {
- if(P.center || (!P.infinity && P.autoadjust))
- write("adjusting target to ",tinv*target);
+ transform3 inv=inverse(modelview);
+ if(S.adjusted)
+ write("adjusting camera to ",tinv*inv*P.camera);
+ target=inv*P.target;
}
+ P=S.T*P;
}
+ if(settings.verbose > 0) {
+ if(P.center || (!P.infinity && P.autoadjust))
+ write("adjusting target to ",tinv*target);
+ }
+ }
- if(prefix == "") prefix=outprefix();
- bool prc=prc(format);
- bool preview=settings.render > 0;
- if(prc) {
- // The movie15.sty package cannot handle spaces or dots in filenames.
- prefix=replace(prefix,new string[][]{{" ","_"},{".","_"}});
- if(settings.embed || nativeformat() == "pdf")
- prefix += "+"+(string) file3.length;
- } else
- preview=false;
- if(preview || (!prc && settings.render != 0)) {
- frame f=f;
- triple m,M;
- real zcenter;
- if(P.absolute) {
- modelview=P.modelview();
- f=modelview*f;
- Q=modelview*P;
- m=min3(f);
- M=max3(f);
- real r=0.5*abs(M-m);
- zcenter=0.5*(M.z+m.z);
- M=(M.x,M.y,zcenter+r);
- m=(m.x,m.y,zcenter-r);
- angle=P.angle;
- } else {
- m=min3(f);
- M=max3(f);
- zcenter=P.target.z;
- real d=P.distance(m,M);
- M=(M.x,M.y,zcenter+d);
- m=(m.x,m.y,zcenter-d);
- }
-
- if(P.infinity) {
- triple margin=(viewportfactor-1.0)*(abs(M.x-m.x),abs(M.y-m.y),0)
- +(viewportmargin.x,viewportmargin.y,0);
- M += margin;
- m -= margin;
- } else if(M.z >= 0) abort("camera too close");
-
- shipout3(prefix,f,preview ? nativeformat() : format,
- width,height,P.infinity ? 0 : 2aTan(Tan(0.5*angle)*P.zoom),
- P.zoom,m,M,P.viewportshift,
- tinv*inverse(modelview)*shift(0,0,zcenter),light.background(),
- P.absolute ? (modelview*light).position : light.position,
- light.diffuse,light.ambient,light.specular,
- light.viewport,view && !preview);
- if(!preview) return F;
+ if(prefix == "") prefix=outprefix();
+ bool prc=prc(format);
+ bool preview=settings.render > 0;
+ if(prc) {
+ // The movie15.sty package cannot handle spaces or dots in filenames.
+ prefix=replace(prefix,new string[][]{{" ","_"},{".","_"}});
+ if(settings.embed || nativeformat() == "pdf")
+ prefix += "+"+(string) file3.length;
+ } else
+ preview=false;
+ if(preview || (!prc && settings.render != 0)) {
+ frame f=S.f;
+ triple m,M;
+ real zcenter;
+ real r;
+ if(P.absolute) {
+ f=modelview*f;
+ m=min3(f);
+ M=max3(f);
+ r=0.5*abs(M-m);
+ zcenter=0.5*(M.z+m.z);
+ } else {
+ m=min3(f);
+ M=max3(f);
+ zcenter=P.target.z;
+ r=P.distance(m,M);
}
+ M=(M.x,M.y,zcenter+r);
+ m=(m.x,m.y,zcenter-r);
+
+ if(P.infinity) {
+ triple margin=(viewportmargin.x,viewportmargin.y,0);
+ M += margin;
+ m -= margin;
+ } else if(M.z >= 0) abort("camera too close");
+
+ shipout3(prefix,f,preview ? nativeformat() : format,
+ S.width-rendermargin,S.height-rendermargin,
+ P.infinity ? 0 : 2aTan(Tan(0.5*P.angle)*P.zoom),
+ P.zoom,m,M,P.viewportshift,
+ tinv*inverse(modelview)*shift(0,0,zcenter),light.background(),
+ P.absolute ? (modelview*light).position : light.position,
+ light.diffuse,light.ambient,light.specular,
+ light.viewport,view && !preview);
+ if(!preview) return F;
+ }
+
+ string image;
+ if(preview && settings.embed) {
+ image=prefix;
+ if(settings.inlinetex) image += "_0";
+ image += "."+nativeformat();
+ if(!settings.inlinetex) file3.push(image);
+ image=graphic(image,"hiresbb");
+ }
+ if(prc) {
+ if(!P.infinity && P.viewportshift != 0)
+ warning("offaxis",
+ "PRC does not support off-axis projections; use pan instead of
+shift");
+ F.L=embed3D(label,text=image,prefix,S.f,format,
+ S.width-2,S.height-2,options,script,light,Q);
+ }
+ return F;
+}
- string image;
- if(preview && settings.embed) {
- image=prefix;
- if(settings.inlinetex) image += "_0";
- image += "."+nativeformat();
- if(!settings.inlinetex) file3.push(image);
- image=graphic(image,"hiresbb");
- }
- if(prc) {
- if(!P.infinity && P.viewportshift != 0)
- write("warning: PRC does not support off-axis projections; use pan instead of shift");
- F.L=embed3D(label,text=image,prefix,f,format,
- width,height,angle,options,script,light,Q);
- }
-
+object embed(string label="", string text=label,
+ string prefix=defaultfilename,
+ picture pic, string format="",
+ real xsize=pic.xsize, real ysize=pic.ysize,
+ bool keepAspect=pic.keepAspect, bool view=true, string options="",
+ string script="", light light=currentlight,
+ projection P=currentprojection)
+{
+ bool is3D=is3D(format);
+ scene S=scene(pic,xsize,ysize,keepAspect,is3D,P);
+ if(is3D)
+ return embed(label,text,prefix,S,format,view,options,script,light);
+ else {
+ object F;
+ transform T=S.pic2.scaling(xsize,ysize,keepAspect);
+ F.f=pic.fit(scale(S.t[0][0])*T);
+ add(F.f,S.pic2.fit(T));
+ return F;
}
+}
- if(!is3D) {
- transform T=pic2.scaling(xsize,ysize,keepAspect);
- F.f=pic.fit(scale(t[0][0])*T);
- add(F.f,pic2.fit(T));
+object embed(string label="", string text=label,
+ string prefix=defaultfilename,
+ frame f, string format="", real width=0, real height=0,
+ bool view=true, string options="", string script="",
+ light light=currentlight, projection P=currentprojection)
+{
+ if(is3D(format))
+ return embed(label,text,prefix,scene(f,P),format,view,options,script,light);
+ else {
+ object F;
+ F.f=f;
+ return F;
}
-
- return F;
}
embed3=new object(string prefix, frame f, string format, string options,
- string script, projection P) {
- return embed(prefix=prefix,f,format,options,script,P);
+ string script, light light, projection P) {
+ return embed(prefix=prefix,f,format,options,script,light,P);
};
+frame embedder(object embedder(string prefix, string format),
+ string prefix, string format, bool view, light light)
+{
+ frame f;
+ bool prc=prc(format);
+ if(!prc && settings.render != 0 && !view) {
+ static int previewcount=0;
+ bool keep=prefix != "";
+ prefix=outprefix(prefix)+"+"+(string) previewcount;
+ ++previewcount;
+ format=nativeformat();
+ if(!keep) file3.push(prefix+"."+format);
+ }
+ object F=embedder(prefix,format);
+ if(prc)
+ label(f,F.L);
+ else {
+ if(settings.render == 0) {
+ add(f,F.f);
+ if(light.background != nullpen)
+ box(f,light.background,Fill,above=false);
+ } else if(!view)
+ label(f,graphic(prefix,"hiresbb"));
+ }
+ return f;
+}
+
currentpicture.fitter=new frame(string prefix, picture pic, string format,
- real xsize, real ysize,
- bool keepAspect, bool view,
- string options, string script, projection P) {
+ real xsize, real ysize, bool keepAspect,
+ bool view, string options, string script,
+ light light, projection P) {
frame f;
bool empty3=pic.empty3();
+ if(!empty3) f=embedder(new object(string prefix, string format) {
+ return embed(prefix=prefix,pic,format,xsize,ysize,keepAspect,view,
+ options,script,light,P);
+ },prefix,format,view,light);
if(is3D(format) || empty3) add(f,pic.fit2(xsize,ysize,keepAspect));
- if(!empty3) {
- bool prc=prc(format);
- if(!prc && settings.render != 0 && !view) {
- static int previewcount=0;
- bool keep=prefix != "";
- prefix=outprefix(prefix)+"+"+(string) previewcount;
- ++previewcount;
- format=nativeformat();
- if(!keep) file3.push(prefix+"."+format);
- }
- object F=embed(prefix=prefix,pic,format,xsize,ysize,keepAspect,view,
- options,script,currentlight,P);
- if(prc)
- label(f,F.L);
- else {
- if(settings.render == 0) {
- add(f,F.f);
- if(currentlight.background != nullpen)
- box(f,currentlight.background,Fill,above=false);
- } else if(!view)
- label(f,graphic(prefix,"hiresbb"));
- }
- }
return f;
};
+frame embedder(string prefix, frame f, string format, bool view,
+ string options, string script, light light, projection P)
+{
+ return embedder(new object(string prefix, string format) {
+ return embed(prefix=prefix,f,format,view,options,script,light,P);
+ },prefix,format,view,light);
+}
+
void addViews(picture dest, picture src, bool group=true,
filltype filltype=NoFill)
{
@@ -2733,29 +2836,53 @@ void addAllViews(picture src, bool group=true, filltype filltype=NoFill)
addAllViews(currentpicture,src,group,filltype);
}
-// Force an array of 3D pictures to be as least as large as picture all.
-void rescale3(picture[] pictures, picture all, projection P=currentprojection)
+// Fit an array of 3D pictures simultaneously using the sizing of picture all.
+frame[] fit3(string prefix="", picture[] pictures, picture all,
+ string format="", bool view=true, string options="",
+ string script="", light light=currentlight,
+ projection P=currentprojection)
{
- if(!all.empty3()) {
- transform3 t=inverse(all.calculateTransform3(P)*pictures[0].T3);
- triple m=t*min3(all);
- triple M=t*max3(all);
+ frame[] out;
+ scene S=scene(all,P);
+ triple m=all.min(S.t);
+ triple M=all.max(S.t);
+ out=new frame[pictures.length];
+ int i=0;
+ bool loop=settings.loop;
+ for(picture pic : pictures) {
+ picture pic2;
+ frame f=pic.fit3(S.t,pic2,S.P);
+ if(loop && !settings.loop) break;
+ add(f,pic2.fit2());
+ draw(f,m,nullpen);
+ draw(f,M,nullpen);
+ out[i]=loop ? f : embedder(prefix,f,format,view,options,script,light,S.P);
+ ++i;
+ }
+
+ while(settings.loop)
for(int i=0; i < pictures.length; ++i) {
- draw(pictures[i],m,nullpen);
- draw(pictures[i],M,nullpen);
+ if(!settings.loop) break;
+ embedder(prefix,out[i],format,view,options,script,light,S.P);
}
- }
+
+ return out;
}
-// Force an array of pictures to have a uniform scaling using currenprojection.
-rescale=new void(picture[] pictures) {
- if(pictures.length == 0) return;
+// Fit an array of pictures simultaneously using the size of the first picture.
+fit=new frame[](string prefix="", picture[] pictures, string format="",
+ bool view=true, string options="", string script="",
+ projection P=currentprojection) {
+ if(pictures.length == 0)
+ return new frame[];
+
picture all;
size(all,pictures[0]);
for(picture pic : pictures)
add(all,pic);
- rescale2(pictures,all);
- rescale3(pictures,all);
+
+ return all.empty3() ? fit2(pictures,all) :
+ fit3(prefix,pictures,all,format,view,options,script,P);
};
exitfcn currentexitfunction=atexit();
diff --git a/Master/texmf/asymptote/three_arrows.asy b/Master/texmf/asymptote/three_arrows.asy
index 841c4f731f4..161a716bca6 100644
--- a/Master/texmf/asymptote/three_arrows.asy
+++ b/Master/texmf/asymptote/three_arrows.asy
@@ -48,91 +48,20 @@ void bend(surface s, path3 g, real L)
}
}
-void render(path3 s, real granularity=tubegranularity, void f(path3, real))
-{
- static int maxdepth=ceil(-log(realEpsilon)/log(2))+1;
- void Split(triple z0, triple c0, triple c1, triple z1, real t0=0, real t1=1,
- real depth=mantissaBits) {
- if(depth > 0) {
- real S=straightness(z0,c0,c1,z1);
- real R=infinity;
- int nintervals=3;
- real fuzz=sqrtEpsilon*max(abs(z0),abs(z1));
- if(S > 0) {
- --depth;
- for(int i=0; i <= nintervals; ++i) {
- R=min(R,radius(z0,c0,c1,z1,i/nintervals));
- if(S > max(granularity*R,fuzz)) {
- triple m0=0.5*(z0+c0);
- triple m1=0.5*(c0+c1);
- triple m2=0.5*(c1+z1);
- triple m3=0.5*(m0+m1);
- triple m4=0.5*(m1+m2);
- triple m5=0.5*(m3+m4);
- real tm=0.5*(t0+t1);
- Split(z0,m0,m3,m5,t0,tm,depth);
- Split(m5,m4,m2,z1,tm,t1,depth);
- return;
- }
- }
- }
- }
- f(z0..controls c0 and c1..z1,t0);
- }
- Split(point(s,0),postcontrol(s,0),precontrol(s,1),point(s,1));
-}
-
-struct tube
-{
- surface s;
- path3 center;
-
- void operator init(path3 g, real width, real granularity=tubegranularity) {
- real r=0.5*width;
-
- transform3 t=scale3(r);
-
- int n=length(g);
- for(int i=0; i < n; ++i) {
- path3 gi=subpath(g,i,i+1);
- real S=straightness(g,i);
- if(S < sqrtEpsilon*r) {
- triple v=point(g,i);
- triple u=point(g,i+1)-v;
- s.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder);
- center=center&gi;
- } else {
- render(gi,granularity,new void(path3 q, real) {
- real L=arclength(q);
- surface segment=scale(r,r,L)*unitcylinder;
- bend(segment,q,L);
- s.s.append(segment.s);
- triple a=L*Z/3;
- center=center&bend(O,q,L)..controls bend(a,q,L) and bend(2a,q,L)..
- bend(3a,q,L);
- });
- }
-
- if((cyclic(g) || i > 0) && abs(dir(g,i,1)-dir(g,i,-1)) > sqrtEpsilon)
- s.append(shift(point(g,i))*t*align(dir(g,i,-1))*unithemisphere);
- }
- }
-}
-
// Refine a noncyclic path3 g so that it approaches its endpoint in
// geometrically spaced steps.
-path3 approach(path3 g, int n, real radix=3)
+path3 approach(path3 p, int n, real radix=3)
{
guide3 G;
- real L=length(g);
+ real L=length(p);
real tlast=0;
real r=1/radix;
for(int i=1; i < n; ++i) {
real t=L*(1-r^i);
- G=G&subpath(g,tlast,t);
+ G=G&subpath(p,tlast,t);
tlast=t;
}
- return G&subpath(g,tlast,L);
+ return G&subpath(p,tlast,L);
}
struct arrowhead3
@@ -176,7 +105,7 @@ struct arrowhead3
}
if(draw)
for(path3 g : H)
- s.append(tube(g,width).s);
+ s.append(tube(g,width,linesectors).s);
return shift(v)*s;
}
@@ -231,8 +160,7 @@ DefaultHead3.head=new surface(path3 g, position position=EndPoint,
for(int i=0; i < 4; ++i) {
for(int j=0; j < 4; ++j) {
real k=1-p.P[i][j].z/remainL;
- p.P[i][j]=(k*p.P[i][j].x,k*p.P[i][j].y,p.P[i][j].z);
- p.P[i][j]=bend(p.P[i][j],q,l);
+ p.P[i][j]=bend((k*p.P[i][j].x,k*p.P[i][j].y,p.P[i][j].z),q,l);
}
}
}
diff --git a/Master/texmf/asymptote/three_light.asy b/Master/texmf/asymptote/three_light.asy
index 8e5a6281795..36ba9a34c19 100644
--- a/Master/texmf/asymptote/three_light.asy
+++ b/Master/texmf/asymptote/three_light.asy
@@ -75,88 +75,27 @@ material emissive(material m, real granularity=m.granularity)
granularity);
}
-struct light {
- real[][] diffuse;
- real[][] ambient;
- real[][] specular;
- pen background; // Background color of the 3D canvas.
- real specularfactor;
- bool viewport; // Are the lights specified (and fixed) in the viewport frame?
- triple[] position; // Only directional lights are currently implemented.
-
- transform3 T=identity(4); // Transform to apply to normal vectors.
-
- bool on() {return position.length > 0;}
-
- void operator init(pen[] diffuse,
- pen[] ambient=array(diffuse.length,black),
- pen[] specular=diffuse, pen background=nullpen,
- real specularfactor=1,
- bool viewport=true, triple[] position) {
- int n=diffuse.length;
- assert(ambient.length == n && specular.length == n && position.length == n);
-
- this.diffuse=new real[n][];
- this.ambient=new real[n][];
- this.specular=new real[n][];
- this.background=background;
- this.position=new triple[n];
- for(int i=0; i < position.length; ++i) {
- this.diffuse[i]=rgba(diffuse[i]);
- this.ambient[i]=rgba(ambient[i]);
- this.specular[i]=rgba(specular[i]);
- this.position[i]=unit(position[i]);
- }
- this.specularfactor=specularfactor;
- this.viewport=viewport;
- }
-
- void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
- pen background=nullpen, real specularfactor=1,
- bool viewport=true...triple[] position) {
- int n=position.length;
- operator init(array(n,diffuse),array(n,ambient),array(n,specular),
- background,specularfactor,viewport,position);
- }
-
- void operator init(pen diffuse=white, pen ambient=black, pen specular=diffuse,
- pen background=nullpen, bool viewport=true,
- real x, real y, real z) {
- operator init(diffuse,ambient,specular,background,viewport,(x,y,z));
+pen color(triple normal, material m, light light, transform3 T=light.T) {
+ triple[] position=light.position;
+ if(invisible((pen) m)) return invisible;
+ if(position.length == 0) return m.diffuse();
+ normal=unit(T*normal);
+ if(settings.twosided) normal *= sgn(normal.z);
+ real s=m.shininess*128;
+ real[] Diffuse=rgba(m.diffuse());
+ real[] Ambient=rgba(m.ambient());
+ real[] Specular=rgba(m.specular());
+ real[] p=rgba(m.emissive());
+ for(int i=0; i < position.length; ++i) {
+ triple L=light.viewport ? position[i] : T*position[i];
+ real Ldotn=max(dot(normal,L),0);
+ p += light.ambient[i]*Ambient+Ldotn*light.diffuse[i]*Diffuse;
+ // Apply specularfactor to partially compensate non-pixel-based rendering.
+ if(Ldotn > 0) // Phong-Blinn model of specular reflection
+ p += dot(normal,unit(L+Z))^s*light.specularfactor*
+ light.specular[i]*Specular;
}
-
- void operator init(explicit light light) {
- diffuse=copy(light.diffuse);
- ambient=copy(light.ambient);
- specular=copy(light.specular);
- background=light.background;
- specularfactor=light.specularfactor;
- viewport=light.viewport;
- position=copy(light.position);
- }
-
- pen color(triple normal, material m, transform3 T=T) {
- if(invisible((pen) m)) return invisible;
- if(position.length == 0) return m.diffuse();
- normal=unit(T*normal);
- if(settings.twosided) normal *= sgn(normal.z);
- real s=m.shininess*128;
- real[] Diffuse=rgba(m.diffuse());
- real[] Ambient=rgba(m.ambient());
- real[] Specular=rgba(m.specular());
- real[] p=rgba(m.emissive());
- for(int i=0; i < position.length; ++i) {
- triple L=viewport ? position[i] : T*position[i];
- real Ldotn=max(dot(normal,L),0);
- p += ambient[i]*Ambient+Ldotn*diffuse[i]*Diffuse;
- // Apply specularfactor to partially compensate non-pixel-based rendering.
- if(Ldotn > 0) // Phong-Blinn model of specular reflection
- p += dot(normal,unit(L+Z))^s*specularfactor*specular[i]*Specular;
- }
- return rgb(p[0],p[1],p[2])+opacity(opacity(m.diffuse()));
- }
-
- real[] background() {return rgba(background == nullpen ? white : background);}
+ return rgb(p[0],p[1],p[2])+opacity(opacity(m.diffuse()));
}
light operator * (transform3 t, light light)
@@ -168,14 +107,16 @@ light operator * (transform3 t, light light)
light operator cast(triple v) {return light(v);}
-light currentlight=light(ambient=gray(0.1),specularfactor=3,
- (0.25,-0.25,1));
+light Viewport=light(ambient=gray(0.1),specularfactor=3,viewport=true,
+ (0.25,-0.25,1));
light White=light(new pen[] {rgb(0.38,0.38,0.45),rgb(0.6,0.6,0.67),
- rgb(0.5,0.5,0.57)},specularfactor=3,viewport=false,
+ rgb(0.5,0.5,0.57)},specularfactor=3,
new triple[] {(-2,-1.5,-0.5),(2,1.1,-2.5),(-0.5,0,2)});
-light Headlamp=light(gray(0.9),ambient=gray(0.1),specularfactor=3,
- (0.5,0.5,1/sqrt(2)),specular=gray(0.7));
+light Headlamp=light(gray(0.8),ambient=gray(0.1),specular=gray(0.7),
+ specularfactor=3,viewport=true,dir(42,48));
+
+currentlight=Headlamp;
light nolight;
diff --git a/Master/texmf/asymptote/three_surface.asy b/Master/texmf/asymptote/three_surface.asy
index f2ad86dfe7e..e545d87cf7b 100644
--- a/Master/texmf/asymptote/three_surface.asy
+++ b/Master/texmf/asymptote/three_surface.asy
@@ -1,4 +1,5 @@
import bezulate;
+private import interpolate;
int nslice=12;
real camerafactor=1.2;
@@ -15,24 +16,24 @@ struct patch {
path3 external() {
return
- P[0][0]..controls P[0][1] and P[0][2]..
- P[0][3]..controls P[1][3] and P[2][3]..
- P[3][3]..controls P[3][2] and P[3][1]..
- P[3][0]..controls P[2][0] and P[1][0]..cycle;
+ P[0][0]..controls P[1][0] and P[2][0]..
+ P[3][0]..controls P[3][1] and P[3][2]..
+ P[3][3]..controls P[2][3] and P[1][3]..
+ P[0][3]..controls P[0][2] and P[0][1]..cycle;
}
triple[] internal() {
- return new triple[] {P[1][1],P[1][2],P[2][2],P[2][1]};
+ return new triple[] {P[1][1],P[2][1],P[2][2],P[1][2]};
}
triple cornermean() {
- return 0.25*(P[0][0]+P[0][3]+P[3][3]+P[3][0]);
+ return 0.25*(P[0][0]+P[0][3]+P[3][0]+P[3][3]);
}
- triple[] corners() {return new triple[] {P[0][0],P[0][3],P[3][3],P[3][0]};}
+ triple[] corners() {return new triple[] {P[0][0],P[3][0],P[3][3],P[0][3]};}
real[] map(real f(triple)) {
- return new real[] {f(P[0][0]),f(P[0][3]),f(P[3][3]),f(P[3][0])};
+ return new real[] {f(P[0][0]),f(P[3][0]),f(P[3][3]),f(P[0][3])};
}
triple Bu(int j, real u) {return bezier(P[0][j],P[1][j],P[2][j],P[3][j],u);}
@@ -43,8 +44,10 @@ struct patch {
triple BuPPP(int j) {return bezierPPP(P[0][j],P[1][j],P[2][j],P[3][j]);}
path3 uequals(real u) {
- return straight ? Bu(0,u)--Bu(3,u) :
- Bu(0,u)..controls Bu(1,u) and Bu(2,u)..Bu(3,u);
+ triple z0=Bu(0,u);
+ triple z1=Bu(3,u);
+ return path3(new triple[] {z0,Bu(2,u)},new triple[] {z0,z1},
+ new triple[] {Bu(1,u),z1},new bool[] {straight,false},false);
}
triple Bv(int i, real v) {return bezier(P[i][0],P[i][1],P[i][2],P[i][3],v);}
@@ -55,8 +58,10 @@ struct patch {
triple BvPPP(int i) {return bezierPPP(P[i][0],P[i][1],P[i][2],P[i][3]);}
path3 vequals(real v) {
- return straight ? Bv(0,v)--Bv(3,v) :
- Bv(0,v)..controls Bv(1,v) and Bv(2,v)..Bv(3,v);
+ triple z0=Bv(0,v);
+ triple z1=Bv(3,v);
+ return path3(new triple[] {z0,Bv(2,v)},new triple[] {z0,z1},
+ new triple[] {Bv(1,v),z1},new bool[] {straight,false},false);
}
triple point(real u, real v) {
@@ -65,76 +70,76 @@ struct patch {
// compute normal vectors for degenerate cases
private triple normal0(real u, real v, real epsilon) {
- triple n=0.5*(cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))+
- cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v)));
+ triple n=0.5*(cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u))+
+ cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u)));
return abs(n) > epsilon ? n :
- 0.25*cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v))+
- 1/6*(cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))+
- cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v)))+
- 1/12*(cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v))+
- cross(bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v)))+
- 1/36*cross(bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u),
- bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v));
+ 0.25*cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u))+
+ 1/6*(cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u))+
+ cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u)))+
+ 1/12*(cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvPP(0,v),BvPP(1,v),BvPP(2,v),BvPP(3,v),u))+
+ cross(bezier(BuPP(0,u),BuPP(1,u),BuPP(2,u),BuPP(3,u),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u)))+
+ 1/36*cross(bezier(BuPPP(0),BuPPP(1),BuPPP(2),BuPPP(3),v),
+ bezier(BvPPP(0),BvPPP(1),BvPPP(2),BvPPP(3),u));
}
static real fuzz=1000*realEpsilon;
triple normal(real u, real v) {
- triple n=cross(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u),
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v));
+ triple n=cross(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v),
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u));
real epsilon=fuzz*change2(P);
return (abs(n) > epsilon) ? n : normal0(u,v,epsilon);
}
triple normal00() {
- triple n=9*cross(P[0][1]-P[0][0],P[1][0]-P[0][0]);
+ triple n=9*cross(P[1][0]-P[0][0],P[0][1]-P[0][0]);
real epsilon=fuzz*change2(P);
return abs(n) > epsilon ? n : normal0(0,0,epsilon);
}
- triple normal01() {
- triple n=9*cross(P[0][3]-P[0][2],P[1][3]-P[0][3]);
+ triple normal10() {
+ triple n=9*cross(P[3][0]-P[2][0],P[3][1]-P[3][0]);
real epsilon=fuzz*change2(P);
- return abs(n) > epsilon ? n : normal0(0,1,epsilon);
+ return abs(n) > epsilon ? n : normal0(1,0,epsilon);
}
triple normal11() {
- triple n=9*cross(P[3][3]-P[3][2],P[3][3]-P[2][3]);
+ triple n=9*cross(P[3][3]-P[2][3],P[3][3]-P[3][2]);
real epsilon=fuzz*change2(P);
return abs(n) > epsilon ? n : normal0(1,1,epsilon);
}
- triple normal10() {
- triple n=9*cross(P[3][1]-P[3][0],P[3][0]-P[2][0]);
+ triple normal01() {
+ triple n=9*cross(P[1][3]-P[0][3],P[0][3]-P[0][2]);
real epsilon=fuzz*change2(P);
- return abs(n) > epsilon ? n : normal0(1,0,epsilon);
+ return abs(n) > epsilon ? n : normal0(0,1,epsilon);
}
pen[] colors(material m, light light=currentlight) {
bool nocolors=colors.length == 0;
if(normals.length > 0)
- return new pen[] {light.color(normals[0],nocolors ? m : colors[0]),
- light.color(normals[1],nocolors ? m : colors[1]),
- light.color(normals[2],nocolors ? m : colors[2]),
- light.color(normals[3],nocolors ? m : colors[3])};
+ return new pen[] {color(normals[0],nocolors ? m : colors[0],light),
+ color(normals[1],nocolors ? m : colors[1],light),
+ color(normals[2],nocolors ? m : colors[2],light),
+ color(normals[3],nocolors ? m : colors[3],light)};
if(planar) {
triple normal=normal(0.5,0.5);
- return new pen[] {light.color(normal,nocolors ? m : colors[0]),
- light.color(normal,nocolors ? m : colors[1]),
- light.color(normal,nocolors ? m : colors[2]),
- light.color(normal,nocolors ? m : colors[3])};
+ return new pen[] {color(normal,nocolors ? m : colors[0],light),
+ color(normal,nocolors ? m : colors[1],light),
+ color(normal,nocolors ? m : colors[2],light),
+ color(normal,nocolors ? m : colors[3],light)};
}
- return new pen[] {light.color(normal00(),nocolors ? m : colors[0]),
- light.color(normal01(),nocolors ? m : colors[1]),
- light.color(normal11(),nocolors ? m : colors[2]),
- light.color(normal10(),nocolors ? m : colors[3])};
+ return new pen[] {color(normal00(),nocolors ? m : colors[0],light),
+ color(normal10(),nocolors ? m : colors[1],light),
+ color(normal11(),nocolors ? m : colors[2],light),
+ color(normal01(),nocolors ? m : colors[3],light)};
}
triple min3,max3;
@@ -162,11 +167,19 @@ struct patch {
}
pair min(projection P, pair bound=project(this.P[0][0],P.t)) {
- return minbezier(this.P,P.t,bound);
+ triple[][] Q=P.T.modelview*this.P;
+ if(P.infinity)
+ return xypart(minbezier(Q,(bound.x,bound.y,0)));
+ real d=P.T.projection[3][2];
+ return maxratio(Q,d*bound)/d; // d is negative
}
pair max(projection P, pair bound=project(this.P[0][0],P.t)) {
- return maxbezier(this.P,P.t,bound);
+ triple[][] Q=P.T.modelview*this.P;
+ if(P.infinity)
+ return xypart(maxbezier(Q,(bound.x,bound.y,0)));
+ real d=P.T.projection[3][2];
+ return minratio(Q,d*bound)/d; // d is negative
}
void operator init(triple[][] P, triple[] normals=new triple[],
@@ -242,11 +255,11 @@ struct patch {
} else straight=false;
P=new triple[][] {
- {point(external,0),postcontrol(external,0),precontrol(external,1),
- point(external,1)},
- {precontrol(external,0),internal[0],internal[1],postcontrol(external,1)},
- {postcontrol(external,3),internal[3],internal[2],precontrol(external,2)},
- {point(external,3),precontrol(external,3),postcontrol(external,2),
+ {point(external,0),precontrol(external,0),postcontrol(external,3),
+ point(external,3)},
+ {postcontrol(external,0),internal[0],internal[3],precontrol(external,3)},
+ {precontrol(external,1),internal[1],internal[2],postcontrol(external,2)},
+ {point(external,1),postcontrol(external,1),precontrol(external,2),
point(external,2)}
};
}
@@ -280,10 +293,10 @@ struct patch {
delta[j]=(external[(j+1)% 4]-external[j])/3;
P=new triple[][] {
- {external[0],external[0]+delta[0],external[1]-delta[0],external[1]},
- {external[0]-delta[3],internal[0],internal[1],external[1]+delta[1]},
- {external[3]+delta[3],internal[3],internal[2],external[2]-delta[1]},
- {external[3],external[3]-delta[2],external[2]+delta[2],external[2]}
+ {external[0],external[0]-delta[3],external[3]+delta[3],external[3]},
+ {external[0]+delta[0],internal[0],internal[3],external[3]-delta[2]},
+ {external[1]-delta[0],internal[1],internal[2],external[2]+delta[2]},
+ {external[1],external[1]+delta[1],external[2]-delta[1],external[2]}
};
}
}
@@ -322,8 +335,243 @@ patch reverse(patch s)
return S;
}
+// Return the Coons patch control points corresponding to path p.
+pair[][] coons(path p)
+{
+ int L=length(p);
+ if(L == 1)
+ p=p--cycle--cycle--cycle;
+ else if(L == 2)
+ p=p--cycle--cycle;
+ else if(L == 3)
+ p=p--cycle;
+
+ pair[] internal=new pair[4];
+ for(int j=0; j < 4; ++j) {
+ internal[j]=nineth*(-4*point(p,j)
+ +6*(precontrol(p,j)+postcontrol(p,j))
+ -2*(point(p,j-1)+point(p,j+1))
+ +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)}
+ };
+}
+
+// Decompose a possibly nonconvex cyclic path into an array of paths that
+// yield nondegenerate Coons patches.
+path[] regularize(path p, bool checkboundary=true)
+{
+ path[] s;
+
+ if(!cyclic(p))
+ abort("cyclic path expected");
+
+ int L=length(p);
+
+ if(L > 4) {
+ for(path g : bezulate(p))
+ s.append(regularize(g,checkboundary));
+ return s;
+ }
+
+ bool straight=piecewisestraight(p);
+ if(L <= 3 && straight) {
+ return new path[] {p};
+ }
+
+ // Split p along the angle bisector at t.
+ bool split(path p, real t) {
+ pair dir=dir(p,t);
+ if(dir != 0) {
+ path g=subpath(p,t,t+length(p));
+ int L=length(g);
+ pair z=point(g,0);
+ real[] T=intersections(g,z,z+I*dir);
+ for(int i=0; i < T.length; ++i) {
+ real cut=T[i];
+ if(cut > sqrtEpsilon && cut < L-sqrtEpsilon) {
+ pair w=point(g,cut);
+ if(!inside(p,0.5*(z+w),zerowinding)) continue;
+ pair delta=sqrtEpsilon*(w-z);
+ if(intersections(g,z-delta--w+delta).length != 2) continue;
+ s.append(regularize(subpath(g,0,cut)--cycle,checkboundary));
+ s.append(regularize(subpath(g,cut,L)--cycle,checkboundary));
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ // Ensure that all interior angles are less than 180 degrees.
+ real fuzz=1e-4;
+ int sign=sgn(windingnumber(p,inside(p,zerowinding)));
+ for(int i=0; i < L; ++i) {
+ if(sign*(conj(dir(p,i,-1))*dir(p,i,1)).y < -fuzz) {
+ if(split(p,i)) return s;
+ }
+ }
+
+ if(straight)
+ return new path[] {p};
+
+ pair[][] P=coons(p);
+
+ // Check for degeneracy.
+ pair[][] U=new pair[3][4];
+ pair[][] V=new pair[4][3];
+
+ for(int i=0; i < 3; ++i) {
+ for(int j=0; j < 4; ++j)
+ U[i][j]=P[i+1][j]-P[i][j];
+ }
+
+ for(int i=0; i < 4; ++i) {
+ for(int j=0; j < 3; ++j)
+ V[i][j]=P[i][j+1]-P[i][j];
+ }
+
+ int[] choose2={1,2,1};
+ int[] choose3={1,3,3,1};
+
+ real T[][]=new real[6][6];
+ for(int p=0; p < 6; ++p) {
+ int kstart=max(p-2,0);
+ int kstop=min(p,3);
+ real[] Tp=T[p];
+ for(int q=0; q < 6; ++q) {
+ real Tpq;
+ int jstop=min(q,3);
+ int jstart=max(q-2,0);
+ for(int k=kstart; k <= kstop; ++k) {
+ int choose3k=choose3[k];
+ for(int j=jstart; j <= jstop; ++j) {
+ int i=p-k;
+ int l=q-j;
+ Tpq += (conj(U[i][j])*V[k][l]).y*
+ choose2[i]*choose3k*choose3[j]*choose2[l];
+ }
+ }
+ Tp[q]=Tpq;
+ }
+ }
+
+ bool3 aligned=default;
+ bool degenerate=false;
+
+ for(int p=0; p < 6; ++p) {
+ for(int q=0; q < 6; ++q) {
+ if(aligned == default) {
+ if(T[p][q] > sqrtEpsilon) aligned=true;
+ if(T[p][q] < -sqrtEpsilon) aligned=false;
+ } else {
+ if((T[p][q] > sqrtEpsilon && aligned == false) ||
+ (T[p][q] < -sqrtEpsilon && aligned == true)) degenerate=true;
+ }
+ }
+ }
+
+ if(!degenerate) {
+ if(aligned == (sign >= 0))
+ return new path[] {p};
+ return s;
+ }
+
+ if(checkboundary) {
+ // Polynomial coefficients of (B_i'' B_j + B_i' B_j')/3.
+ static real[][][] fpv0={
+ {{5, -20, 30, -20, 5},
+ {-3, 24, -54, 48, -15},
+ {0, -6, 27, -36, 15},
+ {0, 0, -3, 8, -5}},
+ {{-7, 36, -66, 52, -15},
+ {3, -36, 108, -120, 45},
+ {0, 6, -45, 84, -45},
+ {0, 0, 3, -16, 15}},
+ {{2, -18, 45, -44, 15},
+ {0, 12, -63, 96, -45},
+ {0, 0, 18, -60, 45},
+ {0, 0, 0, 8, -15}},
+ {{0, 2, -9, 12, -5},
+ {0, 0, 9, -24, 15},
+ {0, 0, 0, 12, -15},
+ {0, 0, 0, 0, 5}}
+ };
+
+ // Compute one-ninth of the derivative of the Jacobian along the boundary.
+ real[][] c=array(4,array(5,0.0));
+ for(int i=0; i < 4; ++i) {
+ real[][] fpv0i=fpv0[i];
+ for(int j=0; j < 4; ++j) {
+ real[] w=fpv0i[j];
+ c[0] += w*(conj(P[i][0])*(P[j][1]-P[j][0])).y; // v=0
+ c[1] += w*(conj(P[3][j]-P[2][j])*P[3][i]).y; // u=1
+ c[2] += w*(conj(P[i][3])*(P[j][3]-P[j][2])).y; // v=1
+ c[3] += w*(conj(P[0][j]-P[1][j])*P[0][i]).y; // u=0
+ }
+ }
+
+ pair BuP(int j, real u) {
+ return bezierP(P[0][j],P[1][j],P[2][j],P[3][j],u);
+ }
+ pair BvP(int i, real v) {
+ return bezierP(P[i][0],P[i][1],P[i][2],P[i][3],v);
+ }
+ real normal(real u, real v) {
+ return (conj(bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v))*
+ bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u)).y;
+ }
+
+ // Use Rolle's theorem to check for degeneracy on the boundary.
+ real M=0;
+ real cut;
+ for(int i=0; i < 4; ++i) {
+ if(!straight(p,i)) {
+ real[] ci=c[i];
+ pair[] R=quarticroots(ci[4],ci[3],ci[2],ci[1],ci[0]);
+ for(pair r : R) {
+ if(fabs(r.y) < sqrtEpsilon) {
+ real t=r.x;
+ if(0 <= t && t <= 1) {
+ real[] U={t,1,t,0};
+ real[] V={0,t,1,t};
+ real[] T={t,t,1-t,1-t};
+ real N=sign*normal(U[i],V[i]);
+ if(N < M) {
+ M=N; cut=i+T[i];
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Split at the worst boundary degeneracy.
+ if(M < 0 && split(p,cut)) return s;
+ }
+
+ // Split arbitrarily to resolve any remaining (internal) degeneracy.
+ checkboundary=false;
+ for(int i=0; i < L; ++i)
+ if(!straight(p,i) && split(p,i+0.5)) return s;
+
+ while(true)
+ for(int i=0; i < L; ++i)
+ if(!straight(p,i) && split(p,i+unitrand())) return s;
+
+ return s;
+}
+
struct surface {
patch[] s;
+ int index[][];
+ bool vcyclic;
bool empty() {
return s.length == 0;
@@ -341,6 +589,8 @@ struct surface {
this.s=new patch[s.s.length];
for(int i=0; i < s.s.length; ++i)
this.s[i]=patch(s.s[i]);
+ this.index=copy(s.index);
+ this.vcyclic=s.vcyclic;
}
void operator init(triple[][][] P, triple[][] normals=new triple[][],
@@ -352,10 +602,8 @@ struct surface {
}
void colors(pen[][] palette) {
- for(int i=0; i < s.length; ++i) {
- pen[] palettei=palette[i];
- s[i].colors=new pen[] {palettei[0],palettei[1],palettei[2],palettei[3]};
- }
+ for(int i=0; i < s.length; ++i)
+ s[i].colors=copy(palette[i]);
}
triple[][] corners() {
@@ -376,232 +624,66 @@ struct surface {
return sequence(new triple(int i) {return s[i].cornermean();},s.length);
}
- // A constructor for a possibly nonconvex cyclic path in a given plane.
- void operator init (path p, triple plane(pair)=XYplane,
- bool checkboundary=true) {
- if(!cyclic(p))
- abort("cyclic path expected");
-
- int L=length(p);
+ triple point(real u, real v) {
+ int U=floor(u);
+ int V=floor(v);
+ int index=index.length == 0 ? U+V : index[U][V];
+ return s[index].point(u-U,v-V);
+ }
- if(L > 4) {
- for(path g : bezulate(p))
- s.append(surface(g,plane,checkboundary).s);
- return;
- }
-
- pair[][] P(path p) {
- if(L == 1)
- p=p--cycle--cycle--cycle;
- else if(L == 2)
- p=p--cycle--cycle;
- else if(L == 3)
- p=p--cycle;
-
- pair[] internal=new pair[4];
- for(int j=0; j < 4; ++j) {
- internal[j]=nineth*(-4*point(p,j)
- +6*(precontrol(p,j)+postcontrol(p,j))
- -2*(point(p,j-1)+point(p,j+1))
- +3*(precontrol(p,j-1)+postcontrol(p,j+1))
- -point(p,j+2));
- }
-
- return new pair[][] {
- {point(p,0),postcontrol(p,0),precontrol(p,1),point(p,1)},
- {precontrol(p,0),internal[0],internal[1],postcontrol(p,1)},
- {postcontrol(p,3),internal[3],internal[2],precontrol(p,2)},
- {point(p,3),precontrol(p,3),postcontrol(p,2),point(p,2)}
- };
- }
+ triple normal(real u, real v) {
+ int U=floor(u);
+ int V=floor(v);
+ int index=index.length == 0 ? U+V : index[U][V];
+ return s[index].normal(u-U,v-V);
+ }
+
+ void ucyclic(bool f)
+ {
+ index.cyclic=f;
+ }
+
+ void vcyclic(bool f)
+ {
+ for(int[] i : index)
+ i.cyclic=f;
+ vcyclic=f;
+ }
+
+ bool ucyclic()
+ {
+ return index.cyclic;
+ }
+
+ bool vcyclic()
+ {
+ return vcyclic;
+ }
+ path3 uequals(real u) {
+ if(index.length == 0) return nullpath3;
+ int U=floor(u);
+ int[] index=index[U];
+ path3 g;
+ for(int i : index)
+ g=g&s[i].uequals(u-U);
+ return vcyclic() ? g&cycle : g;
+ }
+
+ path3 vequals(real v) {
+ if(index.length == 0) return nullpath3;
+ int V=floor(v);
+ path3 g;
+ for(int[] i : index)
+ g=g&s[i[V]].vequals(v-V);
+ return ucyclic() ? g&cycle : g;
+ }
+
+ // A constructor for a possibly nonconvex cyclic path in a given plane.
+ void operator init(path p, triple plane(pair)=XYplane) {
bool straight=piecewisestraight(p);
- if(L <= 3 && straight) {
- s=new patch[] {patch(P(p),plane,straight)};
- return;
- }
-
- // Split p along the angle bisector at t.
- bool split(path p, real t) {
- pair dir=dir(p,t);
- if(dir != 0) {
- path g=subpath(p,t,t+length(p));
- int L=length(g);
- pair z=point(g,0);
- real[] T=intersections(g,z,z+I*dir);
- for(int i=0; i < T.length; ++i) {
- real cut=T[i];
- if(cut > sqrtEpsilon && cut < L-sqrtEpsilon) {
- pair w=point(g,cut);
- if(!inside(p,0.5*(z+w),zerowinding)) continue;
- pair delta=sqrtEpsilon*(w-z);
- if(intersections(g,z-delta--w+delta).length != 2) continue;
- s=surface(subpath(g,0,cut)--cycle,plane,checkboundary).s;
- s.append(surface(subpath(g,cut,L)--cycle,plane,checkboundary).s);
- return true;
- }
- }
- }
- return false;
- }
-
- // Ensure that all interior angles are less than 180 degrees.
- real fuzz=1e-4;
- int sign=sgn(windingnumber(p,inside(p,zerowinding)));
- for(int i=0; i < L; ++i) {
- if(sign*(conj(dir(p,i,-1))*dir(p,i,1)).y < -fuzz) {
- if(split(p,i)) return;
- }
- }
-
- pair[][] P=P(p);
-
- if(straight) {
- s=new patch[] {patch(P,plane,straight)};
- return;
- }
-
- // Check for degeneracy.
- pair[][] U=new pair[3][4];
- pair[][] V=new pair[4][3];
-
- for(int i=0; i < 3; ++i) {
- for(int j=0; j < 4; ++j)
- U[i][j]=P[i+1][j]-P[i][j];
- }
-
- for(int i=0; i < 4; ++i) {
- for(int j=0; j < 3; ++j)
- V[i][j]=P[i][j+1]-P[i][j];
- }
-
- int[] choose2={1,2,1};
- int[] choose3={1,3,3,1};
-
- real T[][]=new real[6][6];
- for(int p=0; p < 6; ++p) {
- int kstart=max(p-2,0);
- int kstop=min(p,3);
- real[] Tp=T[p];
- for(int q=0; q < 6; ++q) {
- real Tpq;
- int jstop=min(q,3);
- int jstart=max(q-2,0);
- for(int k=kstart; k <= kstop; ++k) {
- int choose3k=choose3[k];
- for(int j=jstart; j <= jstop; ++j) {
- int i=p-k;
- int l=q-j;
- Tpq += (conj(U[i][j])*V[k][l]).y*
- choose2[i]*choose3k*choose3[j]*choose2[l];
- }
- }
- Tp[q]=Tpq;
- }
- }
-
- bool3 aligned=default;
- bool degenerate=false;
-
- for(int p=0; p < 6; ++p) {
- for(int q=0; q < 6; ++q) {
- if(aligned == default) {
- if(T[p][q] < -sqrtEpsilon) aligned=true;
- if(T[p][q] > sqrtEpsilon) aligned=false;
- } else {
- if((T[p][q] < -sqrtEpsilon && aligned == false) ||
- (T[p][q] > sqrtEpsilon && aligned == true)) degenerate=true;
- }
- }
- }
-
- if(!degenerate) {
- if(aligned == (sign >= 0))
- s=new patch[] {patch(P,plane)};
- return;
- }
-
- if(checkboundary) {
- // Polynomial coefficients of (B_i'' B_j + B_i' B_j')/3.
- static real[][][] fpv0={
- {{5, -20, 30, -20, 5},
- {-3, 24, -54, 48, -15},
- {0, -6, 27, -36, 15},
- {0, 0, -3, 8, -5}},
- {{-7, 36, -66, 52, -15},
- {3, -36, 108, -120, 45},
- {0, 6, -45, 84, -45},
- {0, 0, 3, -16, 15}},
- {{2, -18, 45, -44, 15},
- {0, 12, -63, 96, -45},
- {0, 0, 18, -60, 45},
- {0, 0, 0, 8, -15}},
- {{0, 2, -9, 12, -5},
- {0, 0, 9, -24, 15},
- {0, 0, 0, 12, -15},
- {0, 0, 0, 0, 5}}
- };
-
- // Compute one-ninth of the derivative of the Jacobian along the boundary.
- real[][] c=array(4,array(5,0.0));
- for(int i=0; i < 4; ++i) {
- real[][] fpv0i=fpv0[i];
- for(int j=0; j < 4; ++j) {
- real[] w=fpv0i[j];
- c[0] += w*(conj(P[0][j]-P[1][j])*P[0][i]).y; // u=0
- c[1] += w*(conj(P[i][3])*(P[j][3]-P[j][2])).y; // v=1
- c[2] += w*(conj(P[3][j]-P[2][j])*P[3][i]).y; // u=1
- c[3] += w*(conj(P[i][0])*(P[j][1]-P[j][0])).y; // v=0
- }
- }
-
- pair BuP(int j, real u) {
- return bezierP(P[0][j],P[1][j],P[2][j],P[3][j],u);
- }
- pair BvP(int i, real v) {
- return bezierP(P[i][0],P[i][1],P[i][2],P[i][3],v);
- }
- real normal(real u, real v) {
- return (conj(bezier(BvP(0,v),BvP(1,v),BvP(2,v),BvP(3,v),u))*
- bezier(BuP(0,u),BuP(1,u),BuP(2,u),BuP(3,u),v)).y;
- }
-
- // Use Rolle's theorem to check for degeneracy on the boundary.
- real M=0;
- real cut;
- for(int i=0; i < 4; ++i) {
- if(!straight(p,i)) {
- real[] ci=c[i];
- pair[] R=quarticroots(ci[4],ci[3],ci[2],ci[1],ci[0]);
- for(pair r : R) {
- if(fabs(r.y) < sqrtEpsilon) {
- real t=r.x;
- if(0 <= t && t <= 1) {
- real[] U={0,t,1,t};
- real[] V={t,1,t,0};
- real[] T={t,t,1-t,1-t};
- real N=sign*normal(U[i],V[i]);
- if(N < M) {
- M=N; cut=i+T[i];
- }
- }
- }
- }
- }
- }
-
- // Split at the worst boundary degeneracy.
- if(M < 0 && split(p,cut)) return;
- }
-
- // Split arbitrarily to resolve any remaining (internal) degeneracy.
- checkboundary=false;
- for(int i=0; i < L; ++i)
- if(!straight(p,i) && split(p,i+0.5)) return;
-
- while(true)
- for(int i=0; i < L; ++i)
- if(!straight(p,i) && split(p,i+unitrand())) return;
+ for(path g : regularize(p))
+ s.push(patch(coons(g),plane,straight));
}
void operator init(explicit path[] g, triple plane(pair)=XYplane) {
@@ -715,12 +797,13 @@ struct surface {
// An optional surface pen color(int i, real j) may be specified
// to override the color at vertex(i,j).
void operator init(triple c, path3 g, triple axis, int n=nslice,
- real angle1=0, real angle2= 360,
+ real angle1=0, real angle2=360,
pen color(int i, real j)=null) {
axis=unit(axis);
real w=(angle2-angle1)/n;
int L=length(g);
s=new patch[L*n];
+ index=new int[n][L];
int m=-1;
transform3[] T=new transform3[n+1];
transform3 t=rotate(w,c,c+axis);
@@ -728,6 +811,9 @@ struct surface {
for(int k=1; k <= n; ++k)
T[k]=T[k-1]*t;
+ typedef pen colorfcn(int i, real j);
+ bool defaultcolors=(colorfcn) color == null;
+
for(int i=0; i < L; ++i) {
path3 h=subpath(g,i,i+1);
path3 r=reverse(h);
@@ -754,13 +840,16 @@ struct surface {
for(int k=0; k < n; ++k, j += w) {
transform3 Tp=T[k+1];
triple dirp=dir(j+w);
- path3 G=Tk*h{dirj}..{dirp}Tp*r{-dirp}..{-dirj}cycle;
+ path3 G=reverse(Tk*h{dirj}..{dirp}Tp*r{-dirp}..{-dirj}cycle);
Tk=Tp;
dirj=dirp;
- s[++m]=color == null ? patch(G) :
- patch(G,new pen[] {color(i,j),color(i+1,j),color(i+1,j+w),
- color(i,j+w)});
+ s[++m]=defaultcolors ? patch(G) :
+ patch(G,new pen[] {color(i,j),color(i,j+w),color(i+1,j+w),
+ color(i+1,j)});
+ index[k][i]=m;
}
+ ucyclic((angle2-angle1) % 360 == 0);
+ vcyclic(cyclic(g));
}
}
@@ -784,6 +873,9 @@ surface operator * (transform3 t, surface s)
S.s=new patch[s.s.length];
for(int i=0; i < s.s.length; ++i)
S.s[i]=t*s.s[i];
+ S.index=copy(s.index);
+ S.vcyclic=(bool) s.vcyclic;
+
return S;
}
@@ -894,10 +986,11 @@ triple[][] subpatchend(triple[][] P, real u, real v)
{c4[2],c5[2],c6[2],c7[2]}};
}
-patch subpatch(patch s, real ua, real va, real ub, real vb)
+patch subpatch(patch s, pair a, pair b)
{
- assert(ua >= 0 && va >= 0 && ub <= 1 && vb <= 1 && ua < ub && va < vb);
- return patch(subpatchbegin(subpatchend(s.P,ub,vb),ua/ub,va/vb),
+ assert(a.x >= 0 && a.y >= 0 && b.x <= 1 && b.y <= 1 &&
+ a.x < b.x && a.y < b.y);
+ return patch(subpatchbegin(subpatchend(s.P,b.x,b.y),a.x/b.x,a.y/b.y),
s.straight,s.planar);
}
@@ -958,8 +1051,17 @@ void draw3D(frame f, patch s, material m, light light=currentlight)
bool lighton=light.on();
if(!lighton && !invisible((pen) m))
m=emissive(m);
+ real PRCshininess;
+ if(prc()) {
+ // Empirical translation table from Phong-Blinn to PRC shininess model:
+ static real[] x={0.015,0.025,0.05,0.07,0.1,0.14,0.23,0.5,0.65,0.75,0.85,
+ 0.875,0.9,1};
+ static real[] y={0.05,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.55,0.6,0.7,0.8,0.9,1};
+ static realfunction s=fspline(x,y,monotonic);
+ PRCshininess=s(m.shininess);
+ }
real granularity=m.granularity >= 0 ? m.granularity : defaultgranularity;
- draw(f,s.P,s.straight,m.p,m.opacity,m.shininess,granularity,
+ draw(f,s.P,s.straight,m.p,m.opacity,m.shininess,PRCshininess,granularity,
s.planar ? s.normal(0.5,0.5) : O,lighton,s.colors);
}
@@ -972,7 +1074,7 @@ void tensorshade(transform t=identity(), frame f, patch s,
}
restricted pen[] nullpens={nullpen};
-nullpens.cyclic(true);
+nullpens.cyclic=true;
void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
material[] surfacepen, pen[] meshpen=nullpens,
@@ -1011,7 +1113,7 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
depth=sort(depth);
- light.T=shiftless(P.modelview());
+ light.T=shiftless(P.T.modelview);
// Draw from farthest to nearest
while(depth.length > 0) {
@@ -1033,8 +1135,8 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1,
{
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
draw(t,f,s,nu,nv,surfacepen,meshpen,light,meshlight,P);
}
@@ -1082,8 +1184,8 @@ void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
{
material[] surfacepen={surfacepen};
pen[] meshpen={meshpen};
- surfacepen.cyclic(true);
- meshpen.cyclic(true);
+ surfacepen.cyclic=true;
+ meshpen.cyclic=true;
draw(pic,s,nu,nv,surfacepen,meshpen,light,meshlight);
}
@@ -1092,18 +1194,26 @@ void draw(picture pic=currentpicture, surface s, int nu=1, int nv=1,
light light=currentlight, light meshlight=light)
{
pen[] meshpen={meshpen};
- meshpen.cyclic(true);
+ meshpen.cyclic=true;
draw(pic,s,nu,nv,surfacepen,meshpen,light,meshlight);
}
-surface extrude(path p, triple axis=Z)
+surface extrude(path3 p, path3 q)
{
static patch[] allocate;
- path3 G=path3(p);
- path3 G2=shift(axis)*G;
return surface(...sequence(new patch(int i) {
- return patch(subpath(G,i,i+1)--subpath(G2,i+1,i)--cycle);
- },length(G)));
+ return patch(subpath(p,i,i+1)--subpath(q,i+1,i)--cycle);
+ },length(p)));
+}
+
+surface extrude(path3 p, triple axis=Z)
+{
+ return extrude(p,shift(axis)*p);
+}
+
+surface extrude(path p, triple axis=Z)
+{
+ return extrude(path3(p),axis);
}
surface extrude(explicit path[] p, triple axis=Z)
@@ -1179,11 +1289,11 @@ void label(frame f, Label L, triple position, align align=NoAlign,
} else {
if(L.filltype == NoFill)
fill(f,path(L,project(position,P.t),P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
else {
frame d;
fill(d,path(L,project(position,P.t),P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
add(f,d,L.filltype);
}
}
@@ -1215,11 +1325,11 @@ void label(picture pic=currentpicture, Label L, triple position,
if(pic != null) {
if(L.filltype == NoFill)
fill(project(v,P.t),pic,path(L,P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
else {
picture d;
fill(project(v,P.t),d,path(L,P),
- light.color(L.T3*Z,L.p,shiftless(P.modelview())));
+ color(L.T3*Z,L.p,light,shiftless(P.T.modelview)));
add(pic,d,L.filltype);
}
}
@@ -1271,30 +1381,74 @@ surface extrude(Label L, triple axis=Z)
restricted surface nullsurface;
+surface labelsurface(Label L, surface s, real uoffset, real voffset,
+ real height=0, bool bottom=false, bool top=true)
+{
+ int nu=s.index.length;
+ if(nu == 0) return nullsurface;
+ int nv=s.index[0].length;
+ if(nv == 0) return nullsurface;
+
+ path[] g=texpath(L);
+ pair m=min(g);
+ pair M=max(g);
+ pair lambda=inverse(L.T*scale(nu-epsilon,nv-epsilon))*(M-m);
+ lambda=(abs(lambda.x),abs(lambda.y));
+ path[] G=bezulate(g);
+
+ path3 transpath(path p, real height) {
+ return path3(unstraighten(p),new triple(pair z) {
+ real u=uoffset+(z.x-m.x)/lambda.x;
+ real v=voffset+(z.y-m.y)/lambda.y;
+ if(((u < 0 || u >= nu) && !s.ucyclic()) ||
+ ((v < 0 || v >= nv) && !s.vcyclic()))
+ abort("cannot fit string to surface");
+ return s.point(u,v)+height*unit(s.normal(u,v));
+ });
+ }
+
+ surface s;
+ for(path p : G) {
+ for(path g : regularize(p)) {
+ path3 b;
+ bool extrude=height > 0;
+ if(bottom || extrude)
+ b=transpath(g,0);
+ if(bottom) s.s.push(patch(b));
+ if(top || extrude) {
+ path3 h=transpath(g,height);
+ if(top) s.s.push(patch(h));
+ if(extrude) s.append(extrude(b,h));
+ }
+ }
+ }
+ return s;
+}
+
private real a=4/3*(sqrt(2)-1);
-private transform3 t=rotate(90,O,Z);
-private transform3 t2=t*t;
-private transform3 t3=t2*t;
+private transform3 t1=rotate(90,O,Z);
+private transform3 t2=t1*t1;
+private transform3 t3=t2*t1;
private transform3 i=xscale3(-1)*zscale3(-1);
-restricted patch octant1=patch(X{Z}..{-X}Z..Z{Y}..{-Z}Y{X}..{-Y}cycle,
- new triple[] {(1,a,a),(a,a^2,1),(a^2,a,1),
- (a,1,a)});
+restricted patch octant1=patch(X{Y}..{-X}Y{Z}..{-Y}Z..Z{X}..{-Z}cycle,
+ new triple[] {(1,a,a),(a,1,a),(a^2,a,1),
+ (a,a^2,1)});
-restricted surface unithemisphere=surface(octant1,t*octant1,t2*octant1,
+restricted surface unithemisphere=surface(octant1,t1*octant1,t2*octant1,
t3*octant1);
-restricted surface unitsphere=surface(octant1,t*octant1,t2*octant1,t3*octant1,
- i*octant1,i*t*octant1,i*t2*octant1,
+restricted surface unitsphere=surface(octant1,t1*octant1,t2*octant1,t3*octant1,
+ i*octant1,i*t1*octant1,i*t2*octant1,
i*t3*octant1);
restricted patch unitfrustum(real t1, real t2)
{
real s1=interp(t1,t2,1/3);
real s2=interp(t1,t2,2/3);
- return patch(interp(Z,X,t2)--interp(Z,X,t1){Y}..{-X}interp(Z,Y,t1)--
- interp(Z,Y,t2){X}..{-Y}cycle,
- new triple[] {(s2,s2*a,1-s2),(s1,s1*a,1-s1),(s1*a,s1,1-s1),
- (s2*a,s2,1-s2)});
+ return patch(interp(Z,X,t2){Y}..{-X}interp(Z,Y,t2)--interp(Z,Y,t1){X}..{-Y}
+ interp(Z,X,t1)--cycle,
+ new triple[] {(s2,s2*a,1-s2),(s2*a,s2,1-s2),(s1*a,s1,1-s1),
+ (s1,s1*a,1-s1)});
}
// Return a unitcone constructed from n frusta (the final one being degenerate)
@@ -1306,7 +1460,7 @@ surface unitcone(int n=6)
for(int i=0; i < n; ++i) {
patch s=unitfrustum(i < n-1 ? r^(i+1) : 0,r^i);
unitcone.s[i]=s;
- unitcone.s[n+i]=t*s;
+ unitcone.s[n+i]=t1*s;
unitcone.s[2n+i]=t2*s;
unitcone.s[3n+i]=t3*s;
}
@@ -1316,9 +1470,9 @@ surface unitcone(int n=6)
restricted surface unitcone=unitcone();
restricted surface unitsolidcone=surface(patch(unitcircle3)...unitcone.s);
-private patch unitcylinder1=patch(X--X+Z{Y}..{-X}Y+Z--Y{X}..{-Y}cycle);
+private patch unitcylinder1=patch(X{Y}..{-X}Y--Y+Z{X}..{-Y}X+Z--cycle);
-restricted surface unitcylinder=surface(unitcylinder1,t*unitcylinder1,
+restricted surface unitcylinder=surface(unitcylinder1,t1*unitcylinder1,
t2*unitcylinder1,t3*unitcylinder1);
private patch unitplane=patch(new triple[] {O,X,X+Y,Y});
diff --git a/Master/texmf/asymptote/three_tube.asy b/Master/texmf/asymptote/three_tube.asy
new file mode 100644
index 00000000000..c79ae3f619f
--- /dev/null
+++ b/Master/texmf/asymptote/three_tube.asy
@@ -0,0 +1,373 @@
+void render(path3 s, real granularity=linegranularity, void f(path3, real))
+{
+ void Split(triple z0, triple c0, triple c1, triple z1, real t0=0, real t1=1,
+ real depth=mantissaBits) {
+ if(depth > 0) {
+ real S=straightness(z0,c0,c1,z1);
+ if(S > 0) {
+ --depth;
+ if(S > max(granularity*max(abs(z0),abs(c0),abs(c1),abs(z1)))) {
+ triple m0=0.5*(z0+c0);
+ triple m1=0.5*(c0+c1);
+ triple m2=0.5*(c1+z1);
+ triple m3=0.5*(m0+m1);
+ triple m4=0.5*(m1+m2);
+ triple m5=0.5*(m3+m4);
+ real tm=0.5*(t0+t1);
+ Split(z0,m0,m3,m5,t0,tm,depth);
+ Split(m5,m4,m2,z1,tm,t1,depth);
+ return;
+ }
+ }
+ }
+ f(z0..controls c0 and c1..z1,t0);
+ }
+ Split(point(s,0),postcontrol(s,0),precontrol(s,1),point(s,1));
+}
+
+struct rmf
+{
+ triple p,r,t,s;
+ void operator init(triple p, triple r, triple t)
+ {
+ this.p=p;
+ this.r=r;
+ this.t=t;
+ s=cross(t,r);
+ }
+}
+
+// Rotation minimizing frame
+// http://www.cs.hku.hk/research/techreps/document/TR-2007-07.pdf
+rmf[] rmf(path3 g, real[] t)
+{
+ rmf[] R=new rmf[t.length];
+ triple d=dir(g,0);
+ R[0]=rmf(point(g,0),perp(d),d);
+ for(int i=1; i < t.length; ++i) {
+ rmf Ri=R[i-1];
+ real t=t[i];
+ triple p=point(g,t);
+ triple v1=p-Ri.p;
+ if(v1 != O) {
+ triple r=Ri.r;
+ triple u1=unit(v1);
+ triple ti=Ri.t;
+ triple tp=ti-2*dot(u1,ti)*u1;
+ ti=dir(g,t);
+ triple rp=r-2*dot(u1,r)*u1;
+ triple u2=unit(ti-tp);
+ rp=rp-2*dot(u2,rp)*u2;
+ R[i]=rmf(p,unit(rp),unit(ti));
+ } else
+ R[i]=R[i-1];
+ }
+ return R;
+}
+
+surface bispline(real[][] z, real[][] p, real[][] q, real[][] r,
+ real[] x, real[] y, bool[][] cond={})
+{ // z[i][j] is the value at (x[i],y[j])
+ // p and q are the first derivatives with respect to x and y, respectively
+ // r is the second derivative ddu/dxdy
+ int n=x.length-1;
+ int m=y.length-1;
+
+ bool all=cond.length == 0;
+
+ int count;
+ if(all)
+ count=n*m;
+ else {
+ count=0;
+ for(int i=0; i < n; ++i) {
+ bool[] condi=cond[i];
+ for(int j=0; j < m; ++j)
+ if(condi[j]) ++count;
+ }
+ }
+
+ surface s=surface(count);
+ s.index=new int[n][m];
+ int k=-1;
+ for(int i=0; i < n; ++i) {
+ bool[] condi=all ? null : cond[i];
+ real xi=x[i];
+ real[] zi=z[i];
+ real[] zp=z[i+1];
+ real[] ri=r[i];
+ real[] rp=r[i+1];
+ real[] pi=p[i];
+ real[] pp=p[i+1];
+ real[] qi=q[i];
+ real[] qp=q[i+1];
+ real xp=x[i+1];
+ real hx=(xp-xi)/3;
+ int[] indexi=s.index[i];
+ for(int j=0; j < m; ++j) {
+ real yj=y[j];
+ real yp=y[j+1];
+ if(all || condi[j]) {
+ triple[][] P=array(4,array(4,O));
+ real hy=(yp-yj)/3;
+ real hxy=hx*hy;
+ // x and y directions
+ for(int k=0; k < 4; ++k) {
+ P[0][k] += xi*X;
+ P[k][0] += yj*Y;
+ P[1][k] += (xp+2*xi)/3*X;
+ P[k][1] += (yp+2*yj)/3*Y;
+ P[2][k] += (2*xp+xi)/3*X;
+ P[k][2] += (2*yp+yj)/3*Y;
+ P[3][k] += xp*X;
+ P[k][3] += yp*Y;
+ }
+ // z: value
+ P[0][0] += zi[j]*Z;
+ P[3][0] += zp[j]*Z;
+ P[0][3] += zi[j+1]*Z;
+ P[3][3] += zp[j+1]*Z;
+ // z: first derivative
+ P[1][0] += (P[0][0].z+hx*pi[j])*Z;
+ P[1][3] += (P[0][3].z+hx*pi[j+1])*Z;
+ P[2][0] += (P[3][0].z-hx*pp[j])*Z;
+ P[2][3] += (P[3][3].z-hx*pp[j+1])*Z;
+ P[0][1] += (P[0][0].z+hy*qi[j])*Z;
+ P[3][1] += (P[3][0].z+hy*qp[j])*Z;
+ P[0][2] += (P[0][3].z-hy*qi[j+1])*Z;
+ P[3][2] += (P[3][3].z-hy*qp[j+1])*Z;
+ // z: second derivative
+ P[1][1] += (P[0][1].z+P[1][0].z-P[0][0].z+hxy*ri[j])*Z;
+ P[1][2] += (P[0][2].z+P[1][3].z-P[0][3].z-hxy*ri[j+1])*Z;
+ P[2][1] += (P[2][0].z+P[3][1].z-P[3][0].z-hxy*rp[j])*Z;
+ P[2][2] += (P[2][3].z+P[3][2].z-P[3][3].z+hxy*rp[j+1])*Z;
+ s.s[++k]=patch(P);
+ indexi[j]=k;
+ }
+ }
+ }
+
+ return s;
+}
+
+// return the surface described by a real matrix f, interpolated with
+// xsplinetype and ysplinetype.
+surface surface(real[][] f, real[] x, real[] y,
+ splinetype xsplinetype=null, splinetype ysplinetype=xsplinetype,
+ bool[][] cond={})
+{
+ real epsilon=sqrtEpsilon*norm(y);
+ if(xsplinetype == null)
+ xsplinetype=(abs(x[0]-x[x.length-1]) <= epsilon) ? periodic : notaknot;
+ if(ysplinetype == null)
+ ysplinetype=(abs(y[0]-y[y.length-1]) <= epsilon) ? periodic : notaknot;
+ int n=x.length; int m=y.length;
+ real[][] ft=transpose(f);
+ real[][] tp=new real[m][];
+ for(int j=0; j < m; ++j)
+ tp[j]=xsplinetype(x,ft[j]);
+ real[][] q=new real[n][];
+ for(int i=0; i < n; ++i)
+ q[i]=ysplinetype(y,f[i]);
+ real[][] qt=transpose(q);
+ real[] d1=xsplinetype(x,qt[0]);
+ real[] d2=xsplinetype(x,qt[m-1]);
+ real[][] r=new real[n][];
+ real[][] p=transpose(tp);
+ for(int i=0; i < n; ++i)
+ r[i]=clamped(d1[i],d2[i])(y,p[i]);
+ surface s=bispline(f,p,q,r,x,y,cond);
+ if(xsplinetype == periodic) s.ucyclic(true);
+ if(ysplinetype == periodic) s.vcyclic(true);
+ return s;
+}
+
+bool uperiodic(real[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length;
+ real[] a0=a[0];
+ real[] a1=a[n-1];
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int j=0; j < m; ++j)
+ if(abs(a0[j]-a1[j]) > epsilon) return false;
+ return true;
+}
+bool vperiodic(real[][] a) {
+ int n=a.length;
+ if(n == 0) return false;
+ int m=a[0].length-1;
+ real epsilon=sqrtEpsilon*norm(a);
+ for(int i=0; i < n; ++i)
+ if(abs(a[i][0]-a[i][m]) > epsilon) return false;
+ return true;
+}
+
+// return the surface described by a parametric function f evaluated at u and v
+// and interpolated with usplinetype and vsplinetype.
+surface surface(triple f(pair z), real[] u, real[] v,
+ splinetype[] usplinetype, splinetype[] vsplinetype=Spline,
+ bool cond(pair z)=null)
+{
+ int nu=u.length-1;
+ int nv=v.length-1;
+ real[] ipt=sequence(u.length);
+ real[] jpt=sequence(v.length);
+ real[][] fx=new real[u.length][v.length];
+ real[][] fy=new real[u.length][v.length];
+ real[][] fz=new real[u.length][v.length];
+
+ bool[][] active;
+ bool all=cond == null;
+ if(!all) active=new bool[u.length][v.length];
+
+ for(int i=0; i <= nu; ++i) {
+ real ui=u[i];
+ real[] fxi=fx[i];
+ real[] fyi=fy[i];
+ real[] fzi=fz[i];
+ bool[] activei=all ? null : active[i];
+ for(int j=0; j <= nv; ++j) {
+ pair z=(ui,v[j]);
+ triple f=(all || (activei[j]=cond(z))) ? f(z) : O;
+ fxi[j]=f.x;
+ fyi[j]=f.y;
+ fzi[j]=f.z;
+ }
+ }
+
+ if(usplinetype.length == 0) {
+ usplinetype=new splinetype[] {uperiodic(fx) ? periodic : notaknot,
+ uperiodic(fy) ? periodic : notaknot,
+ uperiodic(fz) ? periodic : notaknot};
+ } else if(usplinetype.length != 3) abort("usplinetype must have length 3");
+
+ if(vsplinetype.length == 0) {
+ vsplinetype=new splinetype[] {vperiodic(fx) ? periodic : notaknot,
+ vperiodic(fy) ? periodic : notaknot,
+ vperiodic(fz) ? periodic : notaknot};
+ } else if(vsplinetype.length != 3) abort("vsplinetype must have length 3");
+
+ surface sx=surface(fx,ipt,jpt,usplinetype[0],vsplinetype[0],active);
+ surface sy=surface(fy,ipt,jpt,usplinetype[1],vsplinetype[1],active);
+ surface sz=surface(fz,ipt,jpt,usplinetype[2],vsplinetype[2],active);
+
+ surface s=surface(sx.s.length);
+ s.index=new int[nu][nv];
+ int k=-1;
+ for(int i=0; i < nu; ++i) {
+ int[] indexi=s.index[i];
+ for(int j=0; j < nv; ++j)
+ indexi[j]=++k;
+ }
+
+ for(int k=0; k < sx.s.length; ++k) {
+ triple[][] Q=new triple[4][];
+ for(int i=0; i < 4 ; ++i)
+ Q[i]=sequence(new triple(int j) {
+ return (sx.s[k].P[i][j].z,sy.s[k].P[i][j].z,sz.s[k].P[i][j].z);
+ },4);
+ s.s[k]=patch(Q);
+ }
+
+ if(usplinetype[0] == periodic && usplinetype[1] == periodic &&
+ usplinetype[1] == periodic) s.ucyclic(true);
+
+ if(vsplinetype[0] == periodic && vsplinetype[1] == periodic &&
+ vsplinetype[1] == periodic) s.vcyclic(true);
+
+ return s;
+}
+
+path3 interp(path3 a, path3 b, real t)
+{
+ int n=size(a);
+ return path3(sequence(new triple(int i) {return interp(precontrol(a,i),
+ precontrol(b,i),t);},n),
+ sequence(new triple(int i) {return interp(point(a,i),point(b,i),t);},n),
+ sequence(new triple(int i) {return interp(postcontrol(a,i),
+ postcontrol(b,i),t);},n),
+ sequence(new bool(int i) {return straight(a,i) && straight(b,i);},n),
+ cyclic(a) && cyclic(b));
+}
+
+struct tube
+{
+ surface s;
+ path3 center;
+
+ void operator init(path3 p, real width, int sectors=4,
+ real granularity=linegranularity) {
+ sectors += sectors % 2; // Must be even.
+ int h=quotient(sectors,2);
+ real r=0.5*width;
+
+ void generate(path3 p) {
+ int n=length(p);
+ if(piecewisestraight(p)) {
+ for(int i=0; i < n; ++i) {
+ triple v=point(p,i);
+ triple u=point(p,i+1)-v;
+ s.append(shift(v)*align(unit(u))*scale(r,r,abs(u))*unitcylinder);
+ }
+ center=center&p;
+ } else {
+ real[] T;
+ path3 G;
+ for(int i=0; i < n; ++i)
+ render(subpath(p,i,i+1),granularity,
+ new void(path3 g, real s) {
+ G=G&g;
+ T.push(i+s);
+ });
+ T.push(n);
+ T.cyclic=cyclic(p);
+ rmf[] rmf=rmf(p,T);
+ triple f(pair t) {
+ rmf R=rmf[round(t.x)];
+ return point(G,t.x)+r*(R.r*cos(t.y)-R.s*sin(t.y));
+ }
+
+ real[] v=uniform(0,2pi,sectors);
+ static splinetype[] Monotonic={monotonic,monotonic,monotonic};
+ static splinetype[] Periodic={periodic,periodic,periodic};
+ if(T.length > 0) {
+ surface S=surface(f,sequence(T.length),v,Monotonic,Periodic);
+ s.append(S);
+
+ // Compute center of tube:
+ int n=S.index.length;
+ if(T.cyclic) --n;
+ triple[] pre=new triple[n+1];
+ triple[] point=new triple[n+1];
+ triple[] post=new triple[n+1];
+ int[] index=S.index[0];
+ pre[0]=point[0]=0.5*(S.s[index[0]].P[0][0]+S.s[index[h]].P[0][0]);
+ for(int i=0; i < n; ++i) {
+ index=S.index[i];
+ triple [][] P=S.s[index[0]].P;
+ triple [][] Q=S.s[index[h]].P;
+ post[i]=0.5*(P[1][0]+Q[1][0]);
+ pre[i+1]=0.5*(P[2][0]+Q[2][0]);
+ point[i+1]=0.5*(P[3][0]+Q[3][0]);
+ }
+ index=S.index[n-1];
+ post[n]=0.5*(S.s[index[0]].P[3][0]+S.s[index[h]].P[3][0]);
+ center=center&path3(pre,point,post,array(n+1,false),T.cyclic);
+ }
+ }
+ }
+
+ transform3 t=scale3(r);
+ bool cyclic=cyclic(p);
+ int begin=0;
+ int n=length(p);
+ for(int i=cyclic ? 0 : 1; i < n; ++i)
+ if(abs(dir(p,i,1)-dir(p,i,-1)) > sqrtEpsilon) {
+ generate(subpath(p,begin,i));
+ s.append(shift(point(p,i))*t*align(dir(p,i,-1))*unithemisphere);
+ begin=i;
+ }
+ generate(subpath(p,begin,n));
+ }
+}
diff --git a/Master/texmf/asymptote/tree.asy b/Master/texmf/asymptote/tree.asy
index 0f3559112c3..1e603ec4b6b 100644
--- a/Master/texmf/asymptote/tree.asy
+++ b/Master/texmf/asymptote/tree.asy
@@ -7,8 +7,8 @@
struct tree
{
- tree left = null;
- tree right = null;
+ tree left;
+ tree right;
int key = 0;
int value = 0;
}
diff --git a/Master/texmf/asymptote/trembling.asy b/Master/texmf/asymptote/trembling.asy
index fc50ce9b7f5..b01d572d6e2 100644
--- a/Master/texmf/asymptote/trembling.asy
+++ b/Master/texmf/asymptote/trembling.asy
@@ -84,7 +84,7 @@ real atime(pair m, path g, real fuzz=trembleFuzz())
// if(t.length <= 0) { // degenerated case
// r=initr;
// T *= shift(shx,0);
- // write("warning: atime needs numerical adjustment.");
+ // warning("atime","atime needs numerical adjustment.",position=true);
// }
// } while(t.length <= 0);
if(t.length > 0) ot=t[1];
diff --git a/Master/texmf/asymptote/tube.asy b/Master/texmf/asymptote/tube.asy
index 1f8ef950251..844a39c92f0 100644
--- a/Master/texmf/asymptote/tube.asy
+++ b/Master/texmf/asymptote/tube.asy
@@ -58,20 +58,7 @@ real[] sample(path3 g, real r, real relstep=0)
return t;
}
-struct Rmf
-{
- triple p,r,t; // s=cross(t,r);
- real reltime;
- void operator init(triple p, triple r, triple t, real reltime)
- {
- this.p=p;
- this.r=r;
- this.t=t;
- this.reltime=reltime;
- }
-}
-
-real degrees(Rmf a, Rmf b)
+real degrees(rmf a, rmf b)
{
real d=degrees(acos1(dot(a.r,b.r)));
real dt=dot(cross(a.r,b.r),a.t);
@@ -79,37 +66,6 @@ real degrees(Rmf a, Rmf b)
return d%360;
}
-private Rmf[] rmf(path3 g, Rmf U0=Rmf(O,O,O,0), real[] t)
-{
- if(U0.t == O) {
- triple d=dir(g,0);
- U0=Rmf(point(g,0),perp(d),d,0);
- }
- int l=length(g);
- Rmf[] R={U0};
- triple rp,v1,v2,tp,ti,p;
- real c;
-
- for(int i=0; i < t.length-1; ++i) {
- p=point(g,t[i+1]);
- v1=p-R[i].p;
- c=dot(v1,v1);
- if(c != 0) {
- rp=R[i].r-2*dot(v1,R[i].r)*v1/c;
- ti=R[i].t;
- tp=ti-2*dot(v1,ti)*v1/c;
- ti=dir(g,t[i+1]);
- v2=ti-tp;
- rp=rp-2*dot(v2,rp)*v2/dot(v2,v2);
- R.push(Rmf(p,unit(rp),unit(ti),t[i+1]/l));
- } else {
- write("Warning: path3 has duplicated point in Rmf.");
- R.push(R[R.length-1]);
- }
- }
- return R;
-}
-
restricted int coloredNodes=1;
restricted int coloredSegments=2;
@@ -158,8 +114,7 @@ coloredpath operator cast(guide p)
return coloredpath(p);
}
-private surface surface(Rmf[] R, coloredpath cp,transform T(real)=
- new transform(real t) {return identity();},
+private surface surface(rmf[] R, real[] t, coloredpath cp, transform T(real),
bool cyclic)
{
path g=cp.p;
@@ -169,22 +124,22 @@ private surface surface(Rmf[] R, coloredpath cp,transform T(real)=
planar[i]=straight(g,i);
surface s;
- path3 sec=path3(T(R[0].reltime)*g);
+ path3 sec=path3(T(t[0]/l)*g);
real adjust=0;
if(cyclic) adjust=-degrees(R[0],R[R.length-1])/(R.length-1);
- path3 sec1=shift(R[0].p)*transform3(R[0].r,cross(R[0].t,R[0].r),R[0].t)*sec,
+ path3 sec1=shift(R[0].p)*transform3(R[0].r,R[0].s,R[0].t)*sec,
sec2;
for(int i=1; i < R.length; ++i) {
- sec=path3(T(R[i].reltime)*g);
+ sec=path3(T(t[i]/l)*g);
sec2=shift(R[i].p)*transform3(R[i].r,cross(R[i].t,R[i].r),R[i].t)*
rotate(i*adjust,Z)*sec;
for(int j=0; j < l; ++j) {
surface st=surface(subpath(sec1,j,j+1)--subpath(sec2,j+1,j)--cycle,
planar=planar[j]);
if(cp.usepens) {
- pen[] tp1=cp.pens(R[i-1].reltime), tp2=cp.pens(R[i].reltime);
- tp1.cyclic(true); tp2.cyclic(true);
+ pen[] tp1=cp.pens(t[i-1]/l), tp2=cp.pens(t[i]/l);
+ tp1.cyclic=true; tp2.cyclic=true;
if(cp.colortype == coloredSegments) {
st.colors(new pen[][] {{tp1[j],tp1[j],tp2[j],tp2[j]}});
} else {
@@ -206,6 +161,6 @@ surface tube(path3 g, coloredpath section,
real[] t=sample(g,max(M.x-m.x,M.y-m.y)/max(realEpsilon,abs(corner)),
min(abs(relstep),1));
bool cyclic=cyclic(g);
- t.cyclic(cyclic);
- return surface(rmf(g,t),section,T,cyclic);
+ t.cyclic=cyclic;
+ return surface(rmf(g,t),t,section,T,cyclic);
}
diff --git a/Master/texmf/asymptote/version.asy b/Master/texmf/asymptote/version.asy
index 713dc924f1c..d6c18f1b6de 100644
--- a/Master/texmf/asymptote/version.asy
+++ b/Master/texmf/asymptote/version.asy
@@ -1 +1 @@
-string VERSION="1.82";
+string VERSION="1.83";
diff --git a/Master/texmf/doc/info/asy-faq.info b/Master/texmf/doc/info/asy-faq.info
index 08d26f6dc61..085a3a3aca6 100644
--- a/Master/texmf/doc/info/asy-faq.info
+++ b/Master/texmf/doc/info/asy-faq.info
@@ -9,7 +9,7 @@ END-INFO-DIR-ENTRY
File: $prefix.info, Node: Top, Next: Question 1.1, Up: (dir)
ASYMPTOTE FREQUENTLY ASKED QUESTIONS
- 19 Jul 2009
+ 15 Aug 2009
This is the list of Frequently Asked Questions about Asymptote (asy).
diff --git a/Master/texmf/doc/man/man1/asy.1 b/Master/texmf/doc/man/man1/asy.1
index 18992ffb7b3..5bd2e78daa0 100644
--- a/Master/texmf/doc/man/man1/asy.1
+++ b/Master/texmf/doc/man/man1/asy.1
@@ -50,6 +50,9 @@ Module to automatically import.
.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
@@ -137,6 +140,9 @@ List available global functions and variables [false].
.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
diff --git a/Master/texmf/tex/latex/asymptote/asymptote.sty b/Master/texmf/tex/latex/asymptote/asymptote.sty
index e1f059bf46d..44aa0371e61 100644
--- a/Master/texmf/tex/latex/asymptote/asymptote.sty
+++ b/Master/texmf/tex/latex/asymptote/asymptote.sty
@@ -3,18 +3,21 @@
%%% Modified by John Bowman
%%% Adapted from comment.sty (Under GPL v2)
-\ProvidesPackage{asymptote}[2009/06/18 v1.08 Asymptote style file for LaTeX]
+\ProvidesPackage{asymptote}[2009/08/15 v1.10 Asymptote style file for LaTeX]
\RequirePackage{keyval}
\RequirePackage{ifthen}
\newif\ifASYinline
\DeclareOption{inline}{\ASYinlinetrue}
\ProcessOptions*
+\def\unquoteJobname#1"#2"#3\relax{\def\rawJobname{#1}%
+ \ifx\rawJobname\empty\def\rawJobname{#2}\fi}
+\expandafter\unquoteJobname\jobname""\relax
% Work around jobname bug in MiKTeX 2.5 and 2.6:
% Turn stars in file names (resulting from spaces, etc.) into minus signs
\def\fixstar#1*#2\relax{\def\argtwo{#2}\ifx\argtwo\empty\gdef\Jobname{#1}\else
\fixstar#1-#2\relax\fi}
-\expandafter\fixstar\jobname*\relax
+\expandafter\fixstar\rawJobname*\relax
\RequirePackage{color,graphicx}
@@ -119,13 +122,13 @@
\immediate\write\AsyStream{size(\ASYwidth,\ASYheight);}%
\fi
\fi
- \ASYtexfalse
+ \ASYtexfalse%
\ifASYattach
- \def\ASYdefaultviewportwidth{0}
+ \def\ASYdefaultviewportwidth{0}%
\else
- \def\ASYdefaultviewportwidth{\the\linewidth}
+ \def\ASYdefaultviewportwidth{\the\linewidth}%
\ifASYinline
- \ASYtextrue
+ \ASYtextrue%
\fi
\fi
\ifx\ASYviewportwidth\empty
@@ -141,10 +144,10 @@
\AsyStream{viewportsize=(\ASYviewportwidth,\ASYviewportheight);}%
\fi
\fi
- \gdef\ASYwidth{}
- \gdef\ASYheight{}
- \gdef\ASYviewportwidth{\ASYdefaultviewportwidth}
- \gdef\ASYviewportheight{}
+ \gdef\ASYwidth{}%
+ \gdef\ASYheight{}%
+ \gdef\ASYviewportwidth{\ASYdefaultviewportwidth}%
+ \gdef\ASYviewportheight{}%
\immediate\write\AsyStream{\@charrb);}%
\immediate\write\AsyStream{// End of Asymptote Figure \the\c@asy}%
\ifASYtex