diff options
Diffstat (limited to 'Build/source/utils')
112 files changed, 6303 insertions, 7467 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README index 79bf90d62fd..481a194dd60 100644 --- a/Build/source/utils/README +++ b/Build/source/utils/README @@ -4,7 +4,7 @@ Public domain. Originally written 2005 by Karl Berry. Extra utilities we (optionally) compile for TeX Live. See comments in ../texk/README. -asymptote 2.16 - checked 31may12 +asymptote 2.21 - checked 3apr13 update to TL from CTAN, to include prebuilt doc. see http://tug.org/texlive/build.html#asymptote and tlpkg/bin/tl-update-asy diff --git a/Build/source/utils/asymptote/ChangeLog b/Build/source/utils/asymptote/ChangeLog index efcc9018d4e..7fc30354b07 100644 --- a/Build/source/utils/asymptote/ChangeLog +++ b/Build/source/utils/asymptote/ChangeLog @@ -1,4 +1,869 @@ ------------------------------------------------------------------------ +r5536 | jcbowman | 2012-10-07 06:33:22 -0600 (Sun, 07 Oct 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Fix typo. + +------------------------------------------------------------------------ +r5535 | jcbowman | 2012-10-06 00:38:24 -0600 (Sat, 06 Oct 2012) | 2 lines +Changed paths: + M /trunk/asymptote/runhistory.in + +Fix history recall bug. + +------------------------------------------------------------------------ +r5534 | jcbowman | 2012-10-04 11:53:09 -0600 (Thu, 04 Oct 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/doc/asymptote.texi + +Add extend parameter to axes (default true) and axes3 (default false) routines. + +------------------------------------------------------------------------ +r5533 | jcbowman | 2012-09-30 21:14:47 -0600 (Sun, 30 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Fix alignment point of OpenGL billboard labels. + +------------------------------------------------------------------------ +r5532 | jcbowman | 2012-09-27 23:37:22 -0600 (Thu, 27 Sep 2012) | 4 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + M /trunk/asymptote/base/three_surface.asy + +Reinstate billboard rotation for explicitly transformed labels. + +Don't request bbox only in label(frame,Label,triple). + +------------------------------------------------------------------------ +r5531 | jcbowman | 2012-09-27 17:03:39 -0600 (Thu, 27 Sep 2012) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + +Increment version to 2.21svn. +------------------------------------------------------------------------ +r5530 | jcbowman | 2012-09-27 15:45:43 -0600 (Thu, 27 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Work around dvipdfmx bug. + +------------------------------------------------------------------------ +r5529 | jcbowman | 2012-09-27 12:19:08 -0600 (Thu, 27 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain.asy + M /trunk/asymptote/base/plain_prethree.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + +Disable billboard rotation for explicitly transformed labels. + +------------------------------------------------------------------------ +r5528 | jcbowman | 2012-09-25 09:18:30 -0600 (Tue, 25 Sep 2012) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 2.20svn. +------------------------------------------------------------------------ +r5527 | jcbowman | 2012-09-25 08:31:54 -0600 (Tue, 25 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/examples/projectrevolution.asy + +Update example. + +------------------------------------------------------------------------ +r5526 | jcbowman | 2012-09-25 04:49:46 -0600 (Tue, 25 Sep 2012) | 1 line +Changed paths: + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/glrender.cc + +Fix warning messages. +------------------------------------------------------------------------ +r5525 | jcbowman | 2012-09-25 04:30:00 -0600 (Tue, 25 Sep 2012) | 5 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Pass inverse of modelview matrix directly to media9 to work around numerical +resolution issues. + +Fix PRC viewportshift. + +------------------------------------------------------------------------ +r5524 | jcbowman | 2012-09-20 01:58:07 -0600 (Thu, 20 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/examples/BezierPatch.asy + M /trunk/asymptote/examples/cheese.asy + +Fix lighting of NURBS surfaces. + +------------------------------------------------------------------------ +r5523 | jcbowman | 2012-09-20 00:13:48 -0600 (Thu, 20 Sep 2012) | 1 line +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/configure.ac + +Increment version to 2.19svn. +------------------------------------------------------------------------ +r5522 | jcbowman | 2012-09-19 19:18:37 -0600 (Wed, 19 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + +Set secondary picture size (so that, for example, markthin works properly). + +------------------------------------------------------------------------ +r5521 | jcbowman | 2012-09-19 19:13:46 -0600 (Wed, 19 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Move include. + +------------------------------------------------------------------------ +r5520 | jcbowman | 2012-09-19 01:47:10 -0600 (Wed, 19 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/examples/animations/externalmovie.asy + +Update example to mp4. + +------------------------------------------------------------------------ +r5519 | jcbowman | 2012-09-18 20:31:13 -0600 (Tue, 18 Sep 2012) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 2.18svn. +------------------------------------------------------------------------ +r5518 | jcbowman | 2012-09-18 19:10:38 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_arrows.asy + +Handle 3D degenerate arrows. + +------------------------------------------------------------------------ +r5517 | jcbowman | 2012-09-18 13:37:36 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Fix warning message. + +------------------------------------------------------------------------ +r5516 | jcbowman | 2012-09-18 13:27:25 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Fix warning message. + +------------------------------------------------------------------------ +r5515 | jcbowman | 2012-09-18 13:25:39 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + +Remove obsolete file reference. + +------------------------------------------------------------------------ +r5514 | jcbowman | 2012-09-18 13:07:43 -0600 (Tue, 18 Sep 2012) | 4 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + A /trunk/asymptote/examples/triangles.asy + +Make tessellation normals optional. + +Add example and documentation for tessellations. + +------------------------------------------------------------------------ +r5513 | jcbowman | 2012-09-18 12:56:16 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/Makefile.in + +Add missing -P options to dvipdf (required for media9 support). + +------------------------------------------------------------------------ +r5512 | jcbowman | 2012-09-18 08:38:11 -0600 (Tue, 18 Sep 2012) | 3 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Implement improved workaround for media9 preview bug, as suggested by +Alexander Grahn. + +------------------------------------------------------------------------ +r5511 | jcbowman | 2012-09-18 02:44:29 -0600 (Tue, 18 Sep 2012) | 3 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/runpicture.in + +Implement efficient 3D routine for drawing many triangles, with specified +vertices and normals and optional vertex colors. + +------------------------------------------------------------------------ +r5510 | jcbowman | 2012-09-18 02:39:06 -0600 (Tue, 18 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Workaround media9 blank poster image bug under latex+dvips. + +------------------------------------------------------------------------ +r5509 | jcbowman | 2012-09-17 07:39:11 -0600 (Mon, 17 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Fix warning message. + +------------------------------------------------------------------------ +r5508 | hammera | 2012-09-17 00:49:14 -0600 (Mon, 17 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/program.h + +Include stddef for ptrdiff_t. + +------------------------------------------------------------------------ +r5507 | hammera | 2012-09-17 00:30:52 -0600 (Mon, 17 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/base/plain_bounds.asy + +Fix asymptote.so dependencies. + +------------------------------------------------------------------------ +r5506 | jcbowman | 2012-09-13 23:49:20 -0600 (Thu, 13 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + A /trunk/asymptote/base/asy_filetype.vim + +Add simple vim ftdetect file that set asy filetype for *.asy files. + +------------------------------------------------------------------------ +r5505 | jcbowman | 2012-09-13 23:42:03 -0600 (Thu, 13 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/binarytree.asy + M /trunk/asymptote/doc/binarytreetest.asy + +Add condensed binarytree mode (contributed by Gerasimos Dimitriadis). + +------------------------------------------------------------------------ +r5504 | jcbowman | 2012-09-13 23:23:27 -0600 (Thu, 13 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/ocg.sty + +Add global macros to find the number of a PDF OCG object. + +------------------------------------------------------------------------ +r5503 | jcbowman | 2012-09-13 12:21:09 -0600 (Thu, 13 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Omit redundant billboard group name. + +------------------------------------------------------------------------ +r5502 | jcbowman | 2012-09-13 11:04:58 -0600 (Thu, 13 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_arrows.asy + +Fix degenerate arrows (partially revert r2969). + +------------------------------------------------------------------------ +r5501 | jcbowman | 2012-09-13 07:40:24 -0600 (Thu, 13 Sep 2012) | 3 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + +Mention that media9 v0.13 is required (to support the default 3Dmenu option and +billboard labels). + +------------------------------------------------------------------------ +r5500 | jcbowman | 2012-09-11 13:11:46 -0600 (Tue, 11 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_tube.asy + +Fix PRC linecap for draw(unitsquare3). + +------------------------------------------------------------------------ +r5499 | jcbowman | 2012-09-11 11:09:24 -0600 (Tue, 11 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/examples/vertexshading.asy + +Fix lighting; consolidate duplicate code. + +------------------------------------------------------------------------ +r5498 | jcbowman | 2012-09-11 10:32:35 -0600 (Tue, 11 Sep 2012) | 4 lines +Changed paths: + D /trunk/asymptote/asylabels.js + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/glrender.cc + M /trunk/asymptote/picture.cc + M /trunk/asymptote/picture.h + M /trunk/asymptote/runpicture.in + +Make PRC and OpenGL lighting consistent. + +Remove asylabels.js (now included in media9 verion 0.12). + +------------------------------------------------------------------------ +r5497 | jcbowman | 2012-09-10 08:58:07 -0600 (Mon, 10 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + +Simplify media9 inclusion (now that version 0.12 is required). + +------------------------------------------------------------------------ +r5496 | jcbowman | 2012-09-10 08:49:18 -0600 (Mon, 10 Sep 2012) | 3 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Make use of 3Dortho and asylabels.js facilities included in version 0.12 of +media9. + +------------------------------------------------------------------------ +r5495 | jcbowman | 2012-09-10 07:26:03 -0600 (Mon, 10 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + M /trunk/asymptote/doc/asymptote.texi + D /trunk/asymptote/doc/media9patch.sty + +Upgrade to media9 version 0.12. + +------------------------------------------------------------------------ +r5494 | jcbowman | 2012-09-09 09:17:35 -0600 (Sun, 09 Sep 2012) | 2 lines +Changed paths: + A /trunk/asymptote/seconds.h + +Add missing file. + +------------------------------------------------------------------------ +r5493 | jcbowman | 2012-09-09 04:12:41 -0600 (Sun, 09 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + +Restore lighting effects for vertex shading. + +------------------------------------------------------------------------ +r5492 | jcbowman | 2012-09-09 03:43:27 -0600 (Sun, 09 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/asylabels.js + 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 + +Fix vertex shading lighting. + +------------------------------------------------------------------------ +r5491 | jcbowman | 2012-09-08 14:46:13 -0600 (Sat, 08 Sep 2012) | 2 lines +Changed paths: + A /trunk/asymptote/asylabels.js + M /trunk/asymptote/base/three.asy + +Add updated asylabels.js file and future hook. + +------------------------------------------------------------------------ +r5490 | jcbowman | 2012-09-08 14:32:33 -0600 (Sat, 08 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawgroup.h + M /trunk/asymptote/drawpath3.cc + M /trunk/asymptote/drawpath3.h + M /trunk/asymptote/drawsurface.cc + M /trunk/asymptote/drawsurface.h + M /trunk/asymptote/picture.cc + M /trunk/asymptote/picture.h + M /trunk/asymptote/runpicture.in + +Simplify code. + +------------------------------------------------------------------------ +r5489 | jcbowman | 2012-09-08 10:58:09 -0600 (Sat, 08 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/fftw++.cc + M /trunk/asymptote/fftw++.h + +Update FFTW++. + +------------------------------------------------------------------------ +r5488 | jcbowman | 2012-09-08 10:15:52 -0600 (Sat, 08 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_bounds.asy + M /trunk/asymptote/base/plain_paths.asy + M /trunk/asymptote/path.cc + M /trunk/asymptote/path.h + M /trunk/asymptote/runpath.in + +Consolidate and standardize min(path[]) and max(path[]) functions. + +------------------------------------------------------------------------ +r5487 | jcbowman | 2012-09-07 12:47:56 -0600 (Fri, 07 Sep 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/media9patch.sty + +Improved media9 patch, thanks to Alexander Grahn. + +------------------------------------------------------------------------ +r5486 | jcbowman | 2012-08-29 10:47:45 -0600 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/prc/Makefile + +Fix Makefile dependencies. + +------------------------------------------------------------------------ +r5485 | jcbowman | 2012-08-29 10:46:54 -0600 (Wed, 29 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/settings.cc + +Add settings.axes3 to control visibility of PRC axis. + +------------------------------------------------------------------------ +r5484 | jcbowman | 2012-08-28 09:09:17 -0600 (Tue, 28 Aug 2012) | 4 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/base/embed.asy + A /trunk/asymptote/doc/media9patch.sty + +Provide interim media9 bigfile patch. + +Don't require media9 bigfile support for pdf tex engines. + +------------------------------------------------------------------------ +r5483 | jcbowman | 2012-08-26 13:28:14 -0600 (Sun, 26 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_strings.asy + +Support prune=false again. + +------------------------------------------------------------------------ +r5482 | jcbowman | 2012-08-26 13:16:21 -0600 (Sun, 26 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_strings.asy + +Fix split(" "). + +------------------------------------------------------------------------ +r5481 | jcbowman | 2012-08-26 03:16:16 -0600 (Sun, 26 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/texfile.h + +Initialize ASYprefix with output directory. + +------------------------------------------------------------------------ +r5480 | jcbowman | 2012-08-26 03:15:15 -0600 (Sun, 26 Aug 2012) | 4 lines +Changed paths: + M /trunk/asymptote/picture.cc + +Tolerate missing inline option on 3D content embedded within latex files. + +Cleanup intermediate media9 files. + +------------------------------------------------------------------------ +r5479 | jcbowman | 2012-08-26 03:10:13 -0600 (Sun, 26 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asy-latex.dtx + +Cleanly handle missing files. + +------------------------------------------------------------------------ +r5478 | jcbowman | 2012-08-26 03:09:14 -0600 (Sun, 26 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + +Remove newlines from texpath labels for xasy. + +------------------------------------------------------------------------ +r5477 | jcbowman | 2012-08-24 00:31:17 -0600 (Fri, 24 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asyRefCard.tex + +Improve formatting. + +------------------------------------------------------------------------ +r5476 | jcbowman | 2012-08-24 00:30:52 -0600 (Fri, 24 Aug 2012) | 4 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/runlabel.in + M /trunk/asymptote/runsystem.in + +Use prefix for media9 label to avoid duplicate label warnings. + +Run ghostscript for texpath in the output directory. + +------------------------------------------------------------------------ +r5475 | jcbowman | 2012-08-24 00:27:29 -0600 (Fri, 24 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/patches/dvipdf + +Add -DSAFER -P default options to improved dvipdf script. + +------------------------------------------------------------------------ +r5474 | jcbowman | 2012-08-20 08:45:07 -0600 (Mon, 20 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Fix orthoshift. + +------------------------------------------------------------------------ +r5473 | jcbowman | 2012-08-19 14:53:13 -0600 (Sun, 19 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Further lighting fixes. + +------------------------------------------------------------------------ +r5472 | jcbowman | 2012-08-19 14:40:51 -0600 (Sun, 19 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Fix lighting. + +------------------------------------------------------------------------ +r5471 | jcbowman | 2012-08-18 07:40:50 -0600 (Sat, 18 Aug 2012) | 3 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Look for history_list (which seems to be missing from editline) when checking +for GNU readline. + +------------------------------------------------------------------------ +r5470 | jcbowman | 2012-08-17 12:41:23 -0600 (Fri, 17 Aug 2012) | 3 lines +Changed paths: + M /trunk/asymptote/base/bezulate.asy + +Choose a wider connection when searching near the connecting line +(patch contributed by Orest). + +------------------------------------------------------------------------ +r5469 | jcbowman | 2012-08-17 08:07:21 -0600 (Fri, 17 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/Makefile.in + M /trunk/asymptote/configure.ac + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/util.cc + +Update to gc-7.2d. + +------------------------------------------------------------------------ +r5468 | jcbowman | 2012-08-17 08:06:43 -0600 (Fri, 17 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/drawsurface.cc + +Rename displacement routines. + +------------------------------------------------------------------------ +r5467 | jcbowman | 2012-08-15 09:04:24 -0600 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Change defaultrender.defaultnames to true. + +------------------------------------------------------------------------ +r5466 | jcbowman | 2012-08-15 07:53:45 -0600 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/runpair.in + +Tweak special trigonometric cases to improve PRC compression. + +------------------------------------------------------------------------ +r5465 | jcbowman | 2012-08-15 07:52:54 -0600 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph3.asy + M /trunk/asymptote/base/solids.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + +Don't autogenerate RPC part names by default. + +------------------------------------------------------------------------ +r5464 | jcbowman | 2012-08-15 05:14:26 -0600 (Wed, 15 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/loggraph.asy + M /trunk/asymptote/doc/parametricgraph.asy + +Use limits rather than separate xlimits and ylimits commands in examples. + +------------------------------------------------------------------------ +r5463 | jcbowman | 2012-08-14 19:55:56 -0600 (Tue, 14 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + +Add missing render argument. + +------------------------------------------------------------------------ +r5462 | jcbowman | 2012-08-14 19:00:45 -0600 (Tue, 14 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_arrows.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/examples/tvgen.asy + +Add missing factor to arrowheads. + +------------------------------------------------------------------------ +r5461 | jcbowman | 2012-08-14 17:51:38 -0600 (Tue, 14 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + M /trunk/asymptote/examples/soccerball.asy + M /trunk/asymptote/picture.cc + M /trunk/asymptote/runlabel.in + +Support large PRC files (requires media9 version dated 10 August 2012). + +------------------------------------------------------------------------ +r5460 | jcbowman | 2012-08-10 05:56:58 -0600 (Fri, 10 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/triple.h + +Address clang compiler warning. + +------------------------------------------------------------------------ +r5459 | jcbowman | 2012-08-10 05:40:09 -0600 (Fri, 10 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three_surface.asy + +Restore label grouping. + +------------------------------------------------------------------------ +r5458 | jcbowman | 2012-08-09 19:38:52 -0600 (Thu, 09 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asyRefCard.tex + +Update copyright of reference card. + +------------------------------------------------------------------------ +r5457 | jcbowman | 2012-08-09 10:05:37 -0600 (Thu, 09 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/examples/100d.views + M /trunk/asymptote/picture.cc + +Fix garbage collection issues. + +------------------------------------------------------------------------ +r5456 | jcbowman | 2012-08-09 03:41:55 -0600 (Thu, 09 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/examples/soccerball.asy + +Work around LaTeX limitation. + +------------------------------------------------------------------------ +r5455 | jcbowman | 2012-08-09 02:36:28 -0600 (Thu, 09 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/examples/animations/embeddedu3d.asy + +Update U3D example. + +------------------------------------------------------------------------ +r5454 | jcbowman | 2012-08-08 22:34:01 -0600 (Wed, 08 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/bbox3.h + M /trunk/asymptote/drawelement.h + M /trunk/asymptote/drawgroup.h + M /trunk/asymptote/drawpath3.cc + 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/prc/oPRCFile.cc + M /trunk/asymptote/prc/oPRCFile.h + M /trunk/asymptote/prc/writePRC.cc + M /trunk/asymptote/prc/writePRC.h + M /trunk/asymptote/runstring.in + M /trunk/asymptote/triple.h + +Add simplified version of Michail's local coordinate patch. + +------------------------------------------------------------------------ +r5453 | jcbowman | 2012-08-08 10:55:30 -0600 (Wed, 08 Aug 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/plain_Label.asy + M /trunk/asymptote/base/plain_strings.asy + +Improve support for none TeX engines. + +------------------------------------------------------------------------ +r5452 | jcbowman | 2012-07-31 09:55:09 -0600 (Tue, 31 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + +Remove unnecessary xelatex detection. + +------------------------------------------------------------------------ +r5451 | jcbowman | 2012-07-30 09:58:52 -0600 (Mon, 30 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/three.asy + +Remove spurious code. + +------------------------------------------------------------------------ +r5450 | jcbowman | 2012-07-29 23:46:15 -0600 (Sun, 29 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/patches/README + D /trunk/asymptote/patches/movie15_dvipdfmx.patch + D /trunk/asymptote/patches/movie15_dvipdfmx.sty + +Remove obsolete movie15 patches. + +------------------------------------------------------------------------ +r5449 | jcbowman | 2012-07-29 23:44:19 -0600 (Sun, 29 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/asymptote.spec + M /trunk/asymptote/base/three.asy + +Remove duplicate code. + +------------------------------------------------------------------------ +r5448 | jcbowman | 2012-07-29 14:46:18 -0600 (Sun, 29 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/embed.asy + M /trunk/asymptote/base/external.asy + M /trunk/asymptote/base/plain_shipout.asy + M /trunk/asymptote/base/three.asy + M /trunk/asymptote/base/three_surface.asy + M /trunk/asymptote/doc/asymptote.texi + M /trunk/asymptote/examples/BezierSurface.asy + M /trunk/asymptote/examples/animations/embeddedmovie.asy + M /trunk/asymptote/examples/animations/embeddedu3d.asy + M /trunk/asymptote/examples/animations/externalmovie.asy + M /trunk/asymptote/examples/animations/slidemovies.asy + M /trunk/asymptote/examples/pdb.asy + +Upgrade from movie15 to media9 LaTeX style file. + +------------------------------------------------------------------------ +r5447 | jcbowman | 2012-07-28 00:53:19 -0600 (Sat, 28 Jul 2012) | 3 lines +Changed paths: + M /trunk/asymptote/configure.ac + M /trunk/asymptote/settings.cc + +Compile with offscreen rendering if and only if both libOSMesa and libglapi +are available. Make settings.offscreen default to false. + +------------------------------------------------------------------------ +r5446 | jcbowman | 2012-07-27 23:45:26 -0600 (Fri, 27 Jul 2012) | 3 lines +Changed paths: + M /trunk/asymptote/configure.ac + +Support OSMesa version 8 (which allows offscreen and non-offscreen +rendering in a single binary). + +------------------------------------------------------------------------ +r5445 | jcbowman | 2012-07-27 22:59:28 -0600 (Fri, 27 Jul 2012) | 1 line +Changed paths: + M /trunk/asymptote/policy.h + +Fix string length type. +------------------------------------------------------------------------ +r5444 | jcbowman | 2012-07-27 16:26:37 -0600 (Fri, 27 Jul 2012) | 2 lines +Changed paths: + M /trunk/asymptote/doc/asyRefCard.tex + +Fix typo. + +------------------------------------------------------------------------ +r5443 | jcbowman | 2012-06-19 23:47:52 -0600 (Tue, 19 Jun 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph3.asy + +Fix autoscale3. + +------------------------------------------------------------------------ +r5442 | jcbowman | 2012-06-19 22:42:00 -0600 (Tue, 19 Jun 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/graph.asy + M /trunk/asymptote/base/graph3.asy + +Partially revert r5283 (which broke autoscaled logarithmic axes). + +------------------------------------------------------------------------ +r5441 | jcbowman | 2012-06-04 05:44:19 -0600 (Mon, 04 Jun 2012) | 3 lines +Changed paths: + M /trunk/asymptote/Makefile.in + +Propogate -m64 flag to the linker to fix solaris 64 bit builds (will cause +a clang warning message, though). + +------------------------------------------------------------------------ +r5440 | jcbowman | 2012-06-01 10:33:18 -0600 (Fri, 01 Jun 2012) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Simplify code. + +------------------------------------------------------------------------ +r5439 | jcbowman | 2012-05-31 21:34:02 -0600 (Thu, 31 May 2012) | 2 lines +Changed paths: + M /trunk/asymptote/interact.cc + +Declare strlen. + +------------------------------------------------------------------------ +r5438 | jcbowman | 2012-05-31 11:24:27 -0600 (Thu, 31 May 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/palette.asy + M /trunk/asymptote/psfile.cc + +Fix bug with non-square pen function images. + +------------------------------------------------------------------------ +r5437 | jcbowman | 2012-05-31 09:46:34 -0600 (Thu, 31 May 2012) | 1 line +Changed paths: + M /trunk/asymptote/configure.ac + +Increment version to 2.17svn. +------------------------------------------------------------------------ +r5436 | jcbowman | 2012-05-31 09:41:14 -0600 (Thu, 31 May 2012) | 2 lines +Changed paths: + M /trunk/asymptote/LICENSE.LESSER + M /trunk/asymptote/base/asy-kate.sh + M /trunk/asymptote/base/graph_splinetype.asy + M /trunk/asymptote/base/nopapersize.ps + M /trunk/asymptote/base/palette.asy + M /trunk/asymptote/examples/NURBSsurface.asy + M /trunk/asymptote/examples/condor.asy + M /trunk/asymptote/examples/functionshading.asy + M /trunk/asymptote/examples/layers.asy + M /trunk/asymptote/examples/oneoverx.asy + M /trunk/asymptote/examples/pipeintersection.asy + M /trunk/asymptote/examples/spheresilhouette.asy + M /trunk/asymptote/examples/splitpatch.asy + M /trunk/asymptote/examples/threeviews.asy + M /trunk/asymptote/examples/trefoilknot.asy + M /trunk/asymptote/psfile.cc + M /trunk/asymptote/runbacktrace.in + +Revert r5435. + +------------------------------------------------------------------------ +r5435 | jcbowman | 2012-05-31 07:38:33 -0600 (Thu, 31 May 2012) | 2 lines +Changed paths: + M /trunk/asymptote/base/palette.asy + M /trunk/asymptote/psfile.cc + +Fix bug with non-square pen function images. + +------------------------------------------------------------------------ r5434 | jcbowman | 2012-05-30 13:45:48 -0600 (Wed, 30 May 2012) | 2 lines Changed paths: M /trunk/asymptote/GUI/xasy2asy.py diff --git a/Build/source/utils/asymptote/Makefile.in b/Build/source/utils/asymptote/Makefile.in index 8460880d319..fc96e4ff9ed 100644 --- a/Build/source/utils/asymptote/Makefile.in +++ b/Build/source/utils/asymptote/Makefile.in @@ -46,16 +46,16 @@ NAME = asy XNAME = x$(NAME) CLEAN = camp.output svnrevision.cc base/version.asy doc/version.texi \ GUI/xasyVersion.py $(XNAME) doc/asy-latex.pdf -EXTRA = asy-mode.el asy-init.el asy.vim asy-kate.sh asymptote.py reload.js \ - nopapersize.ps +EXTRA = asy-mode.el asy-init.el asy.vim asy_filetype.vim asy-kate.sh \ + asymptote.py reload.js nopapersize.ps EXEXTRA = piicon.eps *.views *.dat DOCEXTRA = *.asy *.csv *.dat latexusage.tex externalprc.tex pixel.pdf KEYWORDS = base $(ASYMPTOTE_SITEDIR) -LATEXFILES = asymptote.sty asycolors.sty ocg.sty latexmkrc +LATEXFILES = asymptote.sty asycolors.sty ocg.sty latexmkrc CONTEXTFILES = colo-asy.tex ASY = ./asy -dir base -config "" -render=0 -DEFS = @DEFS@ @OPTIONS@ @PTHREAD_CFLAGS@ +DEFS = @DEFS@ @OPTIONS@ @PTHREAD_CFLAGS@ -DFFTWPP_SINGLE_THREAD CFLAGS = @CPPFLAGS@ @CFLAGS@ OPTS = $(DEFS) $(CFLAGS) INCL = -I . @INCL@ @@ -100,7 +100,7 @@ asy: version GUIversion $(CXX) $(OPTS) -o $(NAME) $(FILES:=.o) asy.o $(LIBS) -s -static; \ else \ ln -sf GUI/xasy.py $(XNAME); \ - $(CXX) $(DEFS) -o $(NAME) $(FILES:=.o) $(LIBS); \ + $(CXX) $(OPTS) -o $(NAME) $(FILES:=.o) $(LIBS); \ fi version: $(GCLIB) $(FILES:=.o) @@ -116,7 +116,7 @@ GUIversion: echo "#!/usr/bin/env python" > GUI/xasyVersion.py echo xasyVersion = \"@VERSION@$(revision)\" >> GUI/xasyVersion.py -asymptote.so: version +asymptote.so: $(COREFILES:=.pic.o) $(CXX) $(OPTS) -shared -o asymptote.so $(COREFILES:=.pic.o) $(SHAREDLIBS) svnrevision.cc: @@ -138,6 +138,12 @@ $(GCLIB): $(GC).tar.gz if test "$(GC)" = "gc-7.2b"; then \ mv gc-7.2 gc-7.2b; \ fi + if test "$(GC)" = "gc-7.2c"; then \ + mv gc-7.2 gc-7.2c; \ + fi + if test "$(GC)" = "gc-7.2d"; then \ + mv gc-7.2 gc-7.2d; \ + fi cd $(GC); \ ./configure $(GCOPTIONS); \ $(MAKE) check diff --git a/Build/source/utils/asymptote/ReleaseNotes b/Build/source/utils/asymptote/ReleaseNotes index 784b628639d..5b187a9ca43 100644 --- a/Build/source/utils/asymptote/ReleaseNotes +++ b/Build/source/utils/asymptote/ReleaseNotes @@ -1,3 +1,44 @@ +Release Notes for Version 2.21 + +Explicitly transformed billboard labels now work correctly again. +The alignment point of OpenGL billboard labels was fixed. An extend +parameter was added to the axes (default true) and axes3 (default false) +routines. A history recall bug was fixed. A typo was corrected in the +documentation of the Jacobi elliptic functions sncndn. + +Release Notes for Version 2.20 + +A work around was implemented for a dvipdfmx bug that prevents the +xelatex tex engine from properly embedding PRC objects. Billboard rotation +is now disabled for explicitly transformed labels. + +Release Notes for Version 2.19 + +Numerical resolution issues with the PRC camera orientation and viewportshift +were fixed. The lighting of NURBS surfaces was fixed. The special 8192 +strlen NSIS build was now correctly reinstated, with stubs, to prevent the +installer from overwriting Windows PATH environment variables > 1023 bytes. + +Release Notes for Version 2.18 + +A compilation issue on MacOSX was addressed. Secondary axes pictures now +inherit the size of the primary picture, so that the markthin marker works +properly. The special 8192 strlen NSIS build was reinstated to prevent the +installer from overwriting extremely long Windows PATH environment variables. + +Release Notes for Version 2.17 + +A bug with non-square pen function images was fixed. Autoscaled +logarithmic axes were fixed. Offscreen and non-offscreen rendering are now +supported in a single binary (requiring OSMesa version 8), with +settings.offscreen defaulting to false. The media9 LaTeX style file is now +used to embed 3D PRC content instead of movie15. Local 3D coordinates are +now used. PRC Part names are nolonger generated by default. A bug in +bezulate was fixed. A settings.axes3 flag was added to control the +visibility of PRC axes. An efficient 3D routine for drawing many +triangles, with specified vertices and optional normals or vertex colors, +was implemented. + Release Notes for Version 2.16 Ticks are no longer autoscaled when the number of major intervals is @@ -823,7 +864,7 @@ filldraw(polygon(5),red); should be replaced by -draw(surface(bezulate(polygon(5))),red); +draw(surface(polygon(5)),red); Also, the solids module has been improved so that diff --git a/Build/source/utils/asymptote/asy-keywords.el b/Build/source/utils/asymptote/asy-keywords.el index 0bb5b66e7ab..4298d20ef11 100644 --- a/Build/source/utils/asymptote/asy-keywords.el +++ b/Build/source/utils/asymptote/asy-keywords.el @@ -2,7 +2,7 @@ ;; This file is automatically generated by asy-list.pl. ;; Changes will be overwritten. ;; -(defvar asy-keywords-version "2.16") +(defvar asy-keywords-version "2.21") (defvar asy-keyword-name '( and controls tension atleast curl if else while for do return break continue struct typedef new access import unravel from include quote static public private restricted this explicit true false null cycle newframe operator )) @@ -11,7 +11,7 @@ and controls tension atleast curl if else while for do return break continue str Braid FitResult Label Legend Segment Solution TreeNode abscissa arc arrowhead binarytree binarytreeNode block bool bool3 bounds bqe circle conic coord coordsys cputime ellipse file filltype frame grid3 guide horner hsv hyperbola indexedTransform int inversion key light line linefit marginT marker mass object pair parabola path path3 pen picture point position projection real revolution scaleT scientific segment side slice solution splitface string surface tensionSpecifier ticklocate ticksgridT tickvalues transform transformation tree triangle trilinear triple vector vertex void )) (defvar asy-function-name '( -AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DOSendl DOSnewl DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Link Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade RadialShadeDraw Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _begingroup3 _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addpenarc addpenline adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize ascii asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial bins bisector bisectorpoint bispline blend blockconnector box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte calculateScaling canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy copyPairOrTriple cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPRCcylinder drawPRCdisk drawPRCsphere drawPRCtube drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawpixel drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 empty enclose end endScript endclip endgroup endgroup3 endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW isDuplicate isnan isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item jobname key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lexorder lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markthin markuniform mass masscenter massformat math max max3 maxAfterTransform maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minAfterTransform minbezier minbound minipage minratio mintimes miterlimit mktemp momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend printBytecode print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setcontour setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile stripsuffix strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose trembleFuzz triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim truepoint tube uncycle unfill uniform unique unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xlimits xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) +AND Arc ArcArrow ArcArrows Arrow Arrows Automatic AvantGarde BBox BWRainbow BWRainbow2 Bar Bars BeginArcArrow BeginArrow BeginBar BeginDotMargin BeginMargin BeginPenMargin Blank Bookman Bottom BottomTop Bounds Break Broken BrokenLog CLZ CTZ Ceil Circle CircleBarIntervalMarker Cos Courier CrossIntervalMarker DOSendl DOSnewl DefaultFormat DefaultLogFormat Degrees Dir DotMargin DotMargins Dotted Draw Drawline Embed EndArcArrow EndArrow EndBar EndDotMargin EndMargin EndPenMargin Fill FillDraw Floor Format Full Gaussian Gaussrand Gaussrandpair Gradient Grayscale Helvetica Hermite HookHead InOutTicks InTicks Jn Label Landscape Left LeftRight LeftTicks Legend Linear Log LogFormat Margin Margins Mark MidArcArrow MidArrow NOT NewCenturySchoolBook NoBox NoMargin NoModifier NoTicks NoTicks3 NoZero NoZeroFormat None OR OmitFormat OmitTick OmitTickInterval OmitTickIntervals OutTicks Ox Oy Palatino PaletteTicks Pen PenMargin PenMargins Pentype Portrait RadialShade RadialShadeDraw Rainbow Range Relative Right RightTicks Rotate Round SQR Scale ScaleX ScaleY ScaleZ Seascape Segment Shift Sin Slant Spline StickIntervalMarker Straight Symbol Tan TeXify Ticks Ticks3 TildeIntervalMarker TimesRoman Top TrueMargin UnFill UpsideDown Wheel X XEquals XOR XY XYEquals XYZero XYgrid XZEquals XZZero XZero XZgrid Y YEquals YXgrid YZ YZEquals YZZero YZero YZgrid Yn Z ZX ZXgrid ZYgrid ZapfChancery ZapfDingbats _begingroup3 _cputime _draw _eval _image _labelpath _projection _strokepath _texpath aCos aSin aTan abort abs accel acos acosh acot acsc activatequote add addArrow addMargins addSaveFunction addpenarc addpenline adjust alias align all altitude angabscissa angle angpoint animate annotate anticomplementary antipedal apply approximate arc arcarrowsize arccircle arcdir arcfromcenter arcfromfocus arclength arcnodesnumber arcpoint arcsubtended arcsubtendedcenter arctime arctopath array arrow arrow2 arrowbase arrowbasepoints arrowsize ascii asec asin asinh ask assert asy asycode asydir asyfigure asyfilecode asyinclude asywrite atan atan2 atanh atbreakpoint atexit attach attract atupdate autoformat autoscale autoscale3 axes axes3 axialshade axis axiscoverage azimuth babel background bangles bar barmarksize barsize basealign baseline bbox beep begin beginclip begingroup beginpoint between bevel bezier bezierP bezierPP bezierPPP bezulate bibliography bibliographystyle binarytree binarytreeNode binomial bins bisector bisectorpoint bispline blend blockconnector box bqe breakpoint breakpoints brick buildRestoreDefaults buildRestoreThunk buildcycle bulletcolor byte calculateScaling canonical canonicalcartesiansystem cartesiansystem case1 case2 case3 case4 cbrt cd ceil center centerToFocus centroid cevian change2 changecoordsys checkSegment checkconditionlength checker checkincreasing checklengths checkposition checktriangle choose circle circlebarframe circlemarkradius circlenodesnumber circumcenter circumcircle clamped clear clip clipdraw close cmyk code colatitude collect collinear color colorless colors colorspace comma compassmark complement complementary concat concurrent cone conic conicnodesnumber conictype conj connect connected connectedindex containmentTree contains contour contour3 contouredges controlSpecifier convert coordinates coordsys copy copyPairOrTriple cos cosh cot countIntersections cputime crop cropcode cross crossframe crosshatch crossmarksize csc cubicroots curabscissa curlSpecifier curpoint currentarrow currentexitfunction currentmomarrow currentpolarconicroutine curve cut cutafter cutbefore cyclic cylinder deactivatequote debugger deconstruct defaultdir defaultformat defaultpen defined degenerate degrees delete deletepreamble determinant diagonal diamond diffdiv dir dirSpecifier dirtime display distance divisors do_overpaint dot dotframe dotsize downcase draw drawAll drawDoubleLine drawFermion drawGhost drawGluon drawMomArrow drawPRCcylinder drawPRCdisk drawPRCsphere drawPRCtube drawPhoton drawScalar drawVertex drawVertexBox drawVertexBoxO drawVertexBoxX drawVertexO drawVertexOX drawVertexTriangle drawVertexTriangleO drawVertexX drawarrow drawarrow2 drawline drawpixel drawtick duplicate elle ellipse ellipsenodesnumber embed embed3 embedplayer empty enclose end endScript endclip endgroup endgroup3 endl endpoint endpoints eof eol equation equations erase erasestep erf erfc error errorbar errorbars eval excenter excircle exit exitXasyMode exitfunction exp expfactors expi expm1 exradius extend extension extouch fabs factorial fermat fft fhorner figure file filecode fill filldraw filloutside fillrule filltype find finite finiteDifferenceJacobian firstcut firstframe fit fit2 fixedscaling floor flush fmdefaults fmod focusToCenter font fontcommand fontsize foot format frac frequency fromCenter fromFocus fspline functionshade gamma generate_random_backtrace generateticks gergonne getc getint getpair getreal getstring gettriple gluon gouraudshade graph graphic gray grestore grid grid3 gsave halfbox hatch hdiffdiv hermite hex histogram history hline hprojection hsv hyperbola hyperbolanodesnumber hyperlink hypot identity image incenter incentral incircle increasing incrementposition indexedTransform indexedfigure initXasyMode initdefaults input inradius insert inside integrate interactive interior interp interpolate intersect intersection intersectionpoint intersectionpoints intersections intouch inverse inversion invisible is3D isCCW isDuplicate isnan isogonal isogonalconjugate isotomic isotomicconjugate isparabola italic item jobname key kurtosis kurtosisexcess label labelaxis labelmargin labelpath labels labeltick labelx labelx3 labely labely3 labelz labelz3 lastcut latex latitude latticeshade layer layout ldexp leastsquares legend legenditem length lexorder lift light limits line linear linecap lineinversion linejoin linemargin lineskip linetype linewidth link list lm_enorm lm_evaluate_default lm_lmdif lm_lmpar lm_minimize lm_print_default lm_print_quiet lm_qrfac lm_qrsolv locale locate locatefile location log log10 log1p logaxiscoverage longitude lookup makeNode makedraw makepen map margin markangle markangleradius markanglespace markarc marker markinterval marknodes markrightangle markthin markuniform mass masscenter massformat math max max3 maxAfterTransform maxbezier maxbound maxcoords maxlength maxratio maxtimes mean medial median midpoint min min3 minAfterTransform minbezier minbound minipage minratio mintimes miterlimit mktemp momArrowPath momarrowsize monotonic multifigure nativeformat natural needshipout newl newpage newslide newton newtree nextframe nextnormal nextpage nib nodabscissa none norm normalvideo notaknot nowarn numberpage nurb object offset onpath opacity opposite orientation origin orthic orthocentercenter outformat outline outname outprefix output overloadedMessage overwrite pack pad pairs palette parabola parabolanodesnumber parallel parallelogram partialsum path path3 pattern pause pdf pedal periodic perp perpendicular perpendicularmark phantom phi1 phi2 phi3 photon piecewisestraight point polar polarconicroutine polargraph polygon postcontrol postscript pow10 ppoint prc prc0 precision precontrol prepend printBytecode print_random_addresses project projection purge pwhermite quadrant quadraticroots quantize quarticroots quotient radialshade radians radicalcenter radicalline radius rand randompath rd readline realmult realquarticroots rectangle rectangular rectify reflect relabscissa relative relativedistance reldir relpoint reltime remainder remark removeDuplicates rename replace report resetdefaultpen restore restoredefaults reverse reversevideo rf rfind rgb rgba rgbint rms rotate rotateO rotation round roundbox roundedpath roundrectangle same samecoordsys sameside sample save savedefaults saveline scale scale3 scaleO scaleT scaleless scientific search searchindex searchtree sec secondaryX secondaryY seconds section sector seek seekeof segment sequence setcontour setpens sgn sgnd sharpangle sharpdegrees shift shiftless shipout shipout3 show side simeq simpson sin sinh size size3 skewness skip slant sleep slope slopefield solve solveBVP sort sourceline sphere split sqrt square srand standardizecoordsys startScript stdev step stickframe stickmarksize stickmarkspace stop straight straightness string stripdirectory stripextension stripfile stripsuffix strokepath subdivide subitem subpath substr sum surface symmedial symmedian system tab tableau tan tangent tangential tangents tanh tell tensionSpecifier tensorshade tex texcolor texify texpath texpreamble texreset texshipout texsize textpath thick thin tick tickMax tickMax3 tickMin tickMin3 ticklabelshift ticklocate tildeframe tildemarksize tile tiling time times title titlepage topbox transform transformation transpose trembleFuzz triangle triangleAbc triangleabc triangulate tricoef tridiagonal trilinear trim truepoint tube uncycle unfill uniform unique unit unitrand unitsize unityroot unstraighten upcase updatefunction uperiodic upscale uptodate usepackage usersetting usetypescript usleep value variance variancebiased vbox vector vectorfield verbatim view vline vperiodic vprojection warn warning windingnumber write xaxis xaxis3 xaxis3At xaxisAt xequals xlimits xpart xscale xscaleO xtick xtick3 xtrans yaxis yaxis3 yaxis3At yaxisAt yequals ylimits ypart yscale yscaleO ytick ytick3 ytrans zaxis3 zaxis3At zero zero3 zlimits zpart ztick ztick3 ztrans )) (defvar asy-variable-name '( AliceBlue Align Allow AntiqueWhite Apricot Aqua Aquamarine Aspect Azure BeginPoint Beige Bisque Bittersweet Black BlanchedAlmond Blue BlueGreen BlueViolet Both Break BrickRed Brown BurlyWood BurntOrange CCW CW CadetBlue CarnationPink Center Centered Cerulean Chartreuse Chocolate Coeff Coral CornflowerBlue Cornsilk Crimson Crop Cyan Dandelion DarkBlue DarkCyan DarkGoldenrod DarkGray DarkGreen DarkKhaki DarkMagenta DarkOliveGreen DarkOrange DarkOrchid DarkRed DarkSalmon DarkSeaGreen DarkSlateBlue DarkSlateGray DarkTurquoise DarkViolet DeepPink DeepSkyBlue DefaultHead DimGray DodgerBlue Dotted Down Draw E ENE EPS ESE E_Euler E_PC E_RK2 E_RK3BS Emerald EndPoint Euler Fill FillDraw FireBrick FloralWhite ForestGreen Fuchsia Gainsboro GhostWhite Gold Goldenrod Gray Green GreenYellow Honeydew HookHead Horizontal HotPink I IgnoreAspect IndianRed Indigo Ivory JOIN_IN JOIN_OUT JungleGreen Khaki LM_DWARF LM_MACHEP LM_SQRT_DWARF LM_SQRT_GIANT LM_USERTOL Label Lavender LavenderBlush LawnGreen Left LeftJustified LeftSide LemonChiffon LightBlue LightCoral LightCyan LightGoldenrodYellow LightGreen LightGrey LightPink LightSalmon LightSeaGreen LightSkyBlue LightSlateGray LightSteelBlue LightYellow Lime LimeGreen Linear Linen Log Logarithmic Magenta Mahogany Mark MarkFill MarkPath Maroon Max MediumAquamarine MediumBlue MediumOrchid MediumPurple MediumSeaGreen MediumSlateBlue MediumSpringGreen MediumTurquoise MediumVioletRed Melon MidPoint MidnightBlue Min MintCream MistyRose Moccasin Move MoveQuiet Mulberry N NE NNE NNW NW NavajoWhite Navy NavyBlue NoAlign NoCrop NoFill NoSide OldLace Olive OliveDrab OliveGreen Orange OrangeRed Orchid Ox Oy PC PaleGoldenrod PaleGreen PaleTurquoise PaleVioletRed PapayaWhip Peach PeachPuff Periwinkle Peru PineGreen Pink Plum PowderBlue ProcessBlue Purple RK2 RK3 RK3BS RK4 RK5 RK5DP RK5F RawSienna Red RedOrange RedViolet Rhodamine Right RightJustified RightSide RosyBrown RoyalBlue RoyalPurple RubineRed S SE SSE SSW SW SaddleBrown Salmon SandyBrown SeaGreen Seashell Sepia Sienna Silver SimpleHead SkyBlue SlateBlue SlateGray Snow SpringGreen SteelBlue Suppress SuppressQuiet Tan TeXHead Teal TealBlue Thistle Ticksize Tomato Turquoise UnFill Up VERSION Value Vertical Violet VioletRed W WNW WSW Wheat White WhiteSmoke WildStrawberry XYAlign YAlign Yellow YellowGreen YellowOrange addpenarc addpenline align allowstepping angularsystem animationdelay appendsuffix arcarrowangle arcarrowfactor arrow2sizelimit arrowangle arrowbarb arrowdir arrowfactor arrowhookfactor arrowlength arrowsizelimit arrowtexfactor authorpen axis axiscoverage axislabelfactor background backgroundcolor backgroundpen barfactor barmarksizefactor basealign baselinetemplate beveljoin bigvertexpen bigvertexsize black blue bm bottom bp brown bullet byfoci byvertices camerafactor chartreuse circlemarkradiusfactor circlenodesnumberfactor circleprecision circlescale cm codefile codepen codeskip colorPen coloredNodes coloredSegments conditionlength conicnodesfactor count cputimeformat crossmarksizefactor currentcoordsys currentlight currentpatterns currentpen currentpicture currentposition currentprojection curvilinearsystem cuttings cyan darkblue darkbrown darkcyan darkgray darkgreen darkgrey darkmagenta darkolive darkred dashdotted dashed datepen dateskip debuggerlines debugging deepblue deepcyan deepgray deepgreen deepgrey deepmagenta deepred default defaultControl defaultS defaultbackpen defaultcoordsys defaultexcursion defaultfilename defaultformat defaultmassformat defaultpen defaultseparator diagnostics differentlengths dot dotfactor dotframe dotted doublelinepen doublelinespacing down duplicateFuzz edge ellipsenodesnumberfactor eps epsgeo epsilon evenodd expansionfactor extendcap exterior fermionpen figureborder figuremattpen file3 firstnode firststep foregroundcolor fuchsia fuzz gapfactor ghostpen gluonamplitude gluonpen gluonratio gray green grey hatchepsilon havepagenumber heavyblue heavycyan heavygray heavygreen heavygrey heavymagenta heavyred hline hwratio hyperbola hyperbolanodesnumberfactor identity4 ignore inXasyMode inch inches includegraphicscommand inf infinity institutionpen intMax intMin interior invert invisible itempen itemskip itemstep labelmargin landscape lastnode left legendhskip legendlinelength legendmargin legendmarkersize legendmaxrelativewidth legendvskip lightblue lightcyan lightgray lightgreen lightgrey lightmagenta lightolive lightred lightyellow line linemargin lm_infmsg lm_shortmsg longdashdotted longdashed magenta magneticRadius mantissaBits markangleradius markangleradiusfactor markanglespace markanglespacefactor mediumblue mediumcyan mediumgray mediumgreen mediumgrey mediummagenta mediumred mediumyellow middle minDistDefault minblockheight minblockwidth mincirclediameter minipagemargin minipagewidth minvertexangle miterjoin mm momarrowfactor momarrowlength momarrowmargin momarrowoffset momarrowpen monoPen morepoints nCircle newbulletcolor ngraph nil nmesh nobasealign nodeMarginDefault nodesystem nomarker nopoint noprimary nullpath nullpen numarray ocgindex oldbulletcolor olive orange origin overpaint page pageheight pagemargin pagenumberalign pagenumberpen pagenumberposition pagewidth paleblue palecyan palegray palegreen palegrey palemagenta palered paleyellow parabolanodesnumberfactor perpfactor phi photonamplitude photonpen photonratio pi pink plain plain_bounds plain_scaling plus preamblenodes pt purple r3 r4a r4b randMax realDigits realEpsilon realMax realMin red relativesystem reverse right roundcap roundjoin royalblue salmon saveFunctions scalarpen sequencereal settings shipped signedtrailingzero solid springgreen sqrtEpsilon squarecap squarepen startposition stdin stdout stepfactor stepfraction steppagenumberpen stepping stickframe stickmarksizefactor stickmarkspacefactor swap textpen ticksize tildeframe tildemarksizefactor tinv titlealign titlepagepen titlepageposition titlepen titleskip top trailingzero treeLevelStep treeMinNodeWidth treeNodeStep trembleAngle trembleFrequency trembleRandom undefined unitcircle unitsquare up urlpen urlskip version vertexpen vertexsize viewportmargin viewportsize vline white wye xformStack yellow ylabelwidth zerotickfuzz zerowinding )) diff --git a/Build/source/utils/asymptote/asy.list b/Build/source/utils/asymptote/asy.list index 6e94649b60b..f2ef45381c4 100644 --- a/Build/source/utils/asymptote/asy.list +++ b/Build/source/utils/asymptote/asy.list @@ -64,8 +64,8 @@ path3 subpath(path3 p, real a, real b); bool isnan(real x); string jobname(string name); void print_random_addresses(int n=<default>); -void attach(picture dest=<default>, frame src, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>); void attach(picture dest=<default>, frame src, pair position, pair align, bool group=<default>, filltype filltype=<default>, bool above=<default>); +void attach(picture dest=<default>, frame src, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>); real[] quadraticroots(real a, real b, real c); pair[] quadraticroots(explicit pair a, explicit pair b, explicit pair c); pen darkcyan; @@ -100,8 +100,8 @@ void atupdate(void f()); void atupdate()(); void unfill(frame f, path[] g, bool copy=<default>); void unfill(picture pic=<default>, path[] g, bool copy=<default>); -bool Bar(picture, path, pen, marginT(path, pen)); bool Bar(picture, path, pen, marginT(path, pen))(real size=<default>); +bool Bar(picture, path, pen, marginT(path, pen)); bool eol(file f); pen zerowinding; void atbreakpoint(string f(string, int, int, code)); @@ -141,8 +141,8 @@ pen rgb(pen p); pen rgb(real r, real g, real b); pen rgb(string s); real inch; -bool ArcArrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); bool ArcArrow(picture, path, pen, marginT(path, pen)); +bool ArcArrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); bool ArcArrows(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>); bool ArcArrows(picture, path, pen, marginT(path, pen)); pen currentpen; @@ -236,10 +236,10 @@ string min(string[][][] a); pair min(pen p); pair min(frame f); pair min(path p); -pair min(explicit path[] p); +pair min(path[] p); triple min(path3 p); -real min(... real[] a); pair min(picture pic, bool user=<default>); +real min(... real[] a); real min(real m, scaling s, coord[] c); real min(real m, scaling s, coord[] c); int min(... int[] a); @@ -248,17 +248,17 @@ int search(int[] a, int key); int search(real[] a, real key); int search(string[] a, string key); int search(void()()[] a, void key()(), bool less(void()(), void()())); -int search(object[] a, object key, bool less(object, object)); int search(real[] a, real key, bool less(real, real)); int search(guide[] a, guide key, bool less(guide, guide)); int search(coord[] a, coord key, bool less(coord, coord)); -int search(Label[] a, Label key, bool less(Label, Label)); int search(pair[] a, pair key, bool less(pair, pair)); -int search(frame[] a, frame key, bool less(frame, frame)); int search(coord[] a, coord key, bool less(coord, coord)); +int search(object[] a, object key, bool less(object, object)); +int search(picture[] a, picture key, bool less(picture, picture)); +int search(frame[] a, frame key, bool less(frame, frame)); +int search(Label[] a, Label key, bool less(Label, Label)); int search(int[] a, int key, bool less(int, int)); int search(bool3[] a, bool3 key, bool less(bool3, bool3)); -int search(picture[] a, picture key, bool less(picture, picture)); int search(marker[] a, marker key, bool less(marker, marker)); int search(string[] a, string key, bool less(string, string)); int search(path[] a, path key, bool less(path, path)); @@ -290,7 +290,7 @@ void shipout(string prefix=<default>, frame f, frame preamble=<default>, string void shipout(string prefix=<default>, frame f, string format=<default>, bool wait=<default>, bool view=<default>, string options=<default>, string script=<default>, light light=<default>, projection P=<default>); void shipout(string prefix=<default>, picture pic=<default>, frame orientation(frame)=<default>, string format=<default>, bool wait=<default>, bool view=<default>, string options=<default>, string script=<default>, light light=<default>, projection P=<default>); void shipout3(string prefix, frame f, string format=<default>, real width, real height, real angle, real zoom, triple m, triple m, pair shift, real[][] t, real[] background, triple[] lights, real[][] diffuse, real[][] ambient, real[][] specular, bool viewportlighting, bool view=<default>); -void shipout3(string prefix, frame f, int[] index, triple[] center); +void shipout3(string prefix, frame f); string getstring(string name=<default>, string default=<default>, string prompt=<default>, bool store=<default>); int debuggerlines; frame bbox(picture pic=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>); @@ -309,7 +309,7 @@ pair maxbound(pair[][][] a); triple maxbound(triple[] a); triple maxbound(triple[][] a); triple maxbound(triple[][][] a); -string Embed(string name, string options=<default>, real width=<default>, real height=<default>); +string Embed(string name, string text=<default>, string options=<default>, real width=<default>, real height=<default>); pair postcontrol(path p, int t); pair postcontrol(path p, real t); triple postcontrol(path3 p, int t); @@ -338,21 +338,21 @@ string max(string[][][] a); pair max(pen p); pair max(frame f); pair max(path p); -pair max(explicit path[] p); +pair max(path[] p); triple max(path3 p); -pair max(picture pic, bool user=<default>); -real max(real M, scaling s, coord[] c); real max(real M, scaling s, coord[] c); int max(... int[] a); +pair max(picture pic, bool user=<default>); real max(... real[] a); -Label Label(Label L, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); +real max(real M, scaling s, coord[] c); Label Label(Label L, pair position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); Label Label(string s, string size=<default>, explicit position position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); Label Label(Label L, explicit position position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); -Label Label; Label Label(explicit pair position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); +Label Label; Label Label(string s=<default>, string size=<default>, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); Label Label(string s, string size=<default>, pair position, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); +Label Label(Label L, align align=<default>, pen p=<default>, transform embed(transform)=<default>, filltype filltype=<default>); string font(pen p=<default>); pen font(string name, string options=<default>); pen font(string encoding, string family, string series, string shape); @@ -371,8 +371,8 @@ pen squarepen; bool EndArrow(picture, path, pen, marginT(path, pen)); bool EndArrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); real barsize(pen p=<default>); -bool EndArcArrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); bool EndArcArrow(picture, path, pen, marginT(path, pen)); +bool EndArcArrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); void tensorshade(frame f, path[] g, bool stroke=<default>, pen fillrule=<default>, pen[][] p, path[] b=<default>, pair[][] z=<default>, bool copy=<default>); void tensorshade(picture pic=<default>, path[] g, bool stroke=<default>, pen fillrule=<default>, pen[][] p, path[] b=<default>, pair[][] z=<default>, bool copy=<default>); void tensorshade(frame f, path[] g, bool stroke=<default>, pen fillrule=<default>, pen[] p, path b=<default>, pair[] z); @@ -424,10 +424,10 @@ pen fuchsia; bool needshipout(); filltype filltype(int type=<default>, pen fillpen=<default>, pen drawpen=<default>, void fill2(frame f, path[] g, pen fillpen)); frame[] fit(string prefix=<default>, picture[] pictures, string format=<default>, bool view=<default>, string options=<default>, string script=<default>, projection P=<default>); -path box(pair a, pair b); +pen Bookman(string series=<default>, string shape=<default>); path box(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); path box(frame f, Label L, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); -pen Bookman(string series=<default>, string shape=<default>); +path box(pair a, pair b); void seekeof(file f); path unitcircle; framedTransformStack xformStack; @@ -460,7 +460,7 @@ hsv hsv(pen p); void deconstruct(frame f, frame preamble=<default>, real magnification=<default>, transform xform()); void deconstruct(picture pic=<default>, real magnification=<default>); int sgn(real x); -pair minAfterTransform(transform t, path[] a); +pair minAfterTransform(transform t, path[] p); int seconds(string t=<default>, string format=<default>); pen cyan; pen grey; @@ -483,11 +483,10 @@ void drawpixel(frame f, triple v, pen p, real width=<default>); pen fontsize(real size, real lineskip); real fontsize(pen p=<default>); pen fontsize(real size); -string Link(string label, string text, string options=<default>); void close(file f); real lineskip(pen p=<default>); pen dashed; -pair maxAfterTransform(transform t, path[] a); +pair maxAfterTransform(transform t, path[] p); int[][] triangulate(pair[] z); void fill(frame f, path[] g, pen p=<default>, bool copy=<default>); path fill(frame dest, frame src, filltype filltype=<default>, real xmargin=<default>, real ymargin=<default>); @@ -519,8 +518,6 @@ bool[] copy(bool[] a, int depth=<default>); real[][] copy(real[][] a, int depth=<default>); pen[] copy(pen[] a, int depth=<default>); coord[] copy(coord[] a, int depth=<default>); -coord[] copy(coord[] a, int depth=<default>); -picture[] copy(picture[] a, int depth=<default>); marker[] copy(marker[] a, int depth=<default>); Legend[] copy(Legend[] a, int depth=<default>); Label[] copy(Label[] a, int depth=<default>); @@ -533,7 +530,9 @@ string[][] copy(string[][] a, int depth=<default>); frame[] copy(frame[] a, int depth=<default>); pair[] copy(pair[] a, int depth=<default>); bool3[] copy(bool3[] a, int depth=<default>); +coord[] copy(coord[] a, int depth=<default>); object[] copy(object[] a, int depth=<default>); +picture[] copy(picture[] a, int depth=<default>); pair[][] copy(pair[][] a, int depth=<default>); real[] abs(pair[] a); real[] abs(triple[] a); @@ -567,15 +566,16 @@ real[] map(real f(pair), pair[] a); int[] map(int f(real), real[] a); bool3[] map(bool3 f(bool3), bool3[] a); frame[] map(frame f(frame), frame[] a); -coord[] map(coord f(coord), coord[] a); +Label[] map(Label f(Label), Label[] a); pen[][] map(pen[] f(pen[]), pen[][] a); triple[] map(triple f(triple), triple[] a); pen[] map(pen f(pen), pen[] a); +coord[] map(coord f(coord), coord[] a); +object[] map(object f(object), object[] a); +picture[] map(picture f(picture), picture[] a); pair[] map(pair f(pair), pair[] a); coord[] map(coord f(coord), coord[] a); -Label[] map(Label f(Label), Label[] a); string[] map(string f(string), string[] a); -object[] map(object f(object), object[] a); void()()[] map(void f()()(void()()), void()()[] a); pair[][] map(pair[] f(pair[]), pair[][] a); real[] map(real f(real), real[] a); @@ -585,7 +585,6 @@ string[][] map(string[] f(string[]), string[][] a); bool[] map(bool f(bool), bool[] a); path[] map(path f(path), path[] a); real[][] map(real[] f(real[]), real[][] a); -picture[] map(picture f(picture), picture[] a); marker[] map(marker f(marker), marker[] a); guide[] map(guide f(guide), guide[] a); path unstraighten(path p); @@ -602,8 +601,6 @@ pair minratio(path3 g); int[] sequence(int n); pen[][] sequence(pen[] f(int), int n); coord[] sequence(coord f(int), int n); -coord[] sequence(coord f(int), int n); -picture[] sequence(picture f(int), int n); marker[] sequence(marker f(int), int n); Legend[] sequence(Legend f(int), int n); Label[] sequence(Label f(int), int n); @@ -617,7 +614,9 @@ bool[] sequence(bool f(int), int n); string[] sequence(string f(int), int n); pair[][] sequence(pair[] f(int), int n); bool3[] sequence(bool3 f(int), int n); +coord[] sequence(coord f(int), int n); object[] sequence(object f(int), int n); +picture[] sequence(picture f(int), int n); real[][] sequence(real[] f(int), int n); real[] sequence(real f(int), int n); int[] sequence(int n, int m); @@ -635,10 +634,11 @@ string cd(string s=<default>); int size(guide g); pair size(frame f); int size(path p); +int size(path[] p); int size(path3 p); +void size(picture dest, picture src); pair size(picture pic, bool user=<default>); void size(picture pic=<default>, real x, real y=<default>, bool keepAspect=<default>); -void size(picture dest, picture src); void size(picture pic=<default>, real xsize, real ysize, pair min, pair max); void clear(file f); void clear(string file, int line); @@ -694,23 +694,23 @@ void report(string text); void report(int i); void report(transform t); void add(frame dest, frame src); -void add(picture pic=<default>, Label L); -void add(picture pic=<default>, void d(frame f, transform t), bool exact=<default>); -void add(frame dest, frame src, filltype filltype, bool above=<default>); -void add(frame dest, frame src, bool group, filltype filltype=<default>, bool above=<default>); -void add(picture pic=<default>, void d(picture, real[][]), bool exact=<default>); -void add(frame dest, frame src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>); -void add(picture dest=<default>, frame src, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>); -void add(picture src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>); void add(picture dest=<default>, frame src, pair position, pair align, bool group=<default>, filltype filltype=<default>, bool above=<default>); void add(frame dest, frame src, pair position, pair align, bool group=<default>, filltype filltype=<default>, bool above=<default>); void add(picture src, bool group=<default>, filltype filltype=<default>, bool above=<default>); -void add(picture pic=<default>, void d(frame f, real[][] t, picture pic, projection P), bool exact=<default>); -void add(frame f, transform t=<default>, Label L); -void add(picture pic=<default>, void d(picture, transform), bool exact=<default>); +void add(picture pic=<default>, void d(frame f, transform t), bool exact=<default>); +void add(picture pic=<default>, void d(picture, real[][]), bool exact=<default>); void add(picture dest, picture src, bool group=<default>, filltype filltype=<default>, bool above=<default>); void add(picture dest, picture src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>); void add(picture dest=<default>, object F, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>); +void add(frame dest, frame src, filltype filltype, bool above=<default>); +void add(frame dest, frame src, bool group, filltype filltype=<default>, bool above=<default>); +void add(picture pic=<default>, void d(frame f, real[][] t, picture pic, projection P), bool exact=<default>); +void add(frame dest, frame src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>); +void add(picture dest=<default>, frame src, pair position=<default>, bool group=<default>, filltype filltype=<default>, bool above=<default>); +void add(picture pic=<default>, void d(picture, transform), bool exact=<default>); +void add(picture pic=<default>, Label L); +void add(frame f, transform t=<default>, Label L); +void add(picture src, pair position, bool group=<default>, filltype filltype=<default>, bool above=<default>); plain plain; void purge(int divisor=<default>); int Round(real x); @@ -728,16 +728,18 @@ plain_scaling plain_scaling; string file(string s); plain_bounds plain_bounds; string outprefix(string prefix=<default>); +object object(Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); object object(frame f); object object(Label L); -object object(Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); file stdin; void()()[] array(int n, void value()(), int depth=<default>); bool[] array(int n, bool value, int depth=<default>); string[] array(int n, string value, int depth=<default>); pair[][] array(int n, pair[] value, int depth=<default>); bool3[] array(int n, bool3 value, int depth=<default>); +coord[] array(int n, coord value, int depth=<default>); object[] array(int n, object value, int depth=<default>); +picture[] array(int n, picture value, int depth=<default>); real[][] array(int n, real[] value, int depth=<default>); real[] array(int n, real value, int depth=<default>); triple[] array(int n, triple value, int depth=<default>); @@ -745,8 +747,6 @@ path[] array(int n, path value, int depth=<default>); frame[] array(int n, frame value, int depth=<default>); pen[][] array(int n, pen[] value, int depth=<default>); coord[] array(int n, coord value, int depth=<default>); -coord[] array(int n, coord value, int depth=<default>); -picture[] array(int n, picture value, int depth=<default>); marker[] array(int n, marker value, int depth=<default>); Legend[] array(int n, Legend value, int depth=<default>); Label[] array(int n, Label value, int depth=<default>); @@ -790,22 +790,23 @@ real inf; real arctime(path p, real l); real arctime(path3 p, real dval); pen palemagenta; -void draw(frame f, triple[][] p, triple center, bool straight, pen[] p, real opacity, real shininess, real prcshininess, triple normal, pen[] colors, bool lighton, int interaction, bool prc=<default>); +void draw(frame f, triple[][] p, triple center, bool straight, pen[] p, real opacity, real shininess, real prcshininess, triple normal, pen[] colors, int interaction, bool prc=<default>); void draw(frame f, triple[] p, real[] knot, real[] weights=<default>, pen p); -void draw(frame f, triple[][] p, real[] uknot, real[] vknot, real[][] weights=<default>, pen[] p, real opacity, real shininess, real prcshininess, pen[] colors, bool lighton); +void draw(frame f, triple[][] p, real[] uknot, real[] vknot, real[][] weights=<default>, pen[] p, real opacity, real shininess, real prcshininess, pen[] colors); +void draw(frame f, triple[] v, int[][] vi, triple[] n, int[][] ni, pen[] p, real opacity, real shininess, real prcshininess, pen[] c=<default>, int[][] ci=<default>); void draw(picture pic=<default>, path[] g, pen fillrule=<default>, pen[] p); -object draw(picture pic=<default>, Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); +object draw(picture pic=<default>, Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), pair position, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); void draw(frame f, explicit path[] g, pen p=<default>); -void draw(frame f, path g, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))); void draw(picture pic=<default>, Label L=<default>, path g, align align=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, bool bar(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, Label legend=<default>, marker marker=<default>); void draw(pair origin, picture pic=<default>, Label L=<default>, path g, align align=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, bool bar(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, Label legend=<default>, marker marker=<default>); void draw(picture pic=<default>, guide[] g, pen p=<default>, Label legend=<default>, marker marker=<default>); void draw(pair origin, picture pic=<default>, guide[] g, pen p=<default>, Label legend=<default>, marker marker=<default>); -object draw(picture pic=<default>, Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), pair position, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); +object draw(picture pic=<default>, Label L, path e(frame dest, frame src=<default>, real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>), real xmargin=<default>, real ymargin=<default>, pen p=<default>, filltype filltype=<default>, bool above=<default>); void draw(picture pic=<default>, explicit path[] g, pen p=<default>, Label legend=<default>, marker marker=<default>); void draw(pair origin, picture pic=<default>, explicit path[] g, pen p=<default>, Label legend=<default>, marker marker=<default>); void draw(frame f, guide[] g, pen p=<default>); void draw(frame f, path g, pen p=<default>); +void draw(frame f, path g, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))); int mantissaBits; real identity(real x); real[] identity(real[] a); @@ -870,19 +871,19 @@ void write(file file=<default>, string s=<default>, transform x, void suffix(fil void write(file file=<default>, string s=<default>, guide x, void suffix(file)=<default> ... guide[]); void write(file file=<default>, string s=<default>, pen x, void suffix(file)=<default> ... pen[]); void write(file file, string s=<default>, explicit guide[] x, void suffix(file)=<default>); -void write(pairOrTriple a); void write(string s=<default>, cputime c, string format=<default>, void suffix(file)=<default>); void write(string s=<default>, explicit path[] x, void suffix(file)=<default>); void write(file file, void suffix(file)=<default>); void write(file file=<default>, string s=<default>, pen[] p); void write(void suffix(file)=<default>); void write(file file, string s=<default>, explicit path[] x, void suffix(file)=<default>); -void write(file file=<default>, align align, void suffix(file)=<default>); void write(file file=<default>, Label L, void suffix(file)=<default>); void write(file file, string s=<default>, cputime c, string format=<default>, void suffix(file)=<default>); +void write(pairOrTriple a); void write(string s=<default>, bool3 b, void suffix(file)=<default>); void write(file file, string s=<default>, bool3 b, void suffix(file)=<default>); void write(string s=<default>, explicit guide[] x, void suffix(file)=<default>); +void write(file file=<default>, align align, void suffix(file)=<default>); void save()(); marginT EndPenMargin(path, pen); pair NNE; @@ -936,18 +937,18 @@ arrowhead HookHead; arrowhead HookHead(real dir=<default>, real barb=<default>); Legend[] concat(... Legend[][]); real[] concat(... real[][]); -object[] concat(... object[][]); pair[] concat(... pair[][]); coord[] concat(... coord[][]); -Label[] concat(... Label[][]); pen[] concat(... pen[][]); -path[] concat(... path[][]); coord[] concat(... coord[][]); +object[] concat(... object[][]); +picture[] concat(... picture[][]); +path[] concat(... path[][]); +Label[] concat(... Label[][]); int[] concat(... int[][]); void()()[] concat(... void()()[][]); bool3[] concat(... bool3[][]); string[] concat(... string[][]); -picture[] concat(... picture[][]); marker[] concat(... marker[][]); triple[] concat(... triple[][]); frame[] concat(... frame[][]); @@ -959,68 +960,68 @@ real[] log1p(real[] a); real infinity; bool alias(pair[][] a, pair[][] b); bool alias(guide[] a, guide[] b); -bool alias(hsv a, hsv b); -bool alias(coord[] a, coord[] b); +bool alias(marginT a, marginT b); bool alias(projection a, projection b); -bool alias(picture a, picture b); +bool alias(side a, side b); bool alias(marker a, marker b); +bool alias(Label[] a, Label[] b); bool alias(pair[] a, pair[] b); -bool alias(scaling a, scaling b); +bool alias(coord a, coord b); bool alias(bounds a, bounds b); bool alias(scaleT a, scaleT b); -bool alias(position a, position b); +bool alias(picture a, picture b); +bool alias(object a, object b); bool alias(cputime a, cputime b); bool alias(int[] a, int[] b); bool alias(string[][] a, string[][] b); -bool alias(filltype a, filltype b); +bool alias(slice a, slice b); bool alias(coord[] a, coord[] b); bool alias(coords2 a, coords2 b); bool alias(Legend a, Legend b); -bool alias(align a, align b); bool alias(framedTransformStack a, framedTransformStack b); -bool alias(Label[] a, Label[] b); bool alias(real[][] a, real[][] b); bool alias(bool3 a, bool3 b); bool alias(bool3[] a, bool3[] b); bool alias(light a, light b); -bool alias(indexedTransform a, indexedTransform b); +bool alias(position a, position b); bool alias(arrowhead a, arrowhead b); bool alias(string[] a, string[] b); bool alias(frame[] a, frame[] b); -bool alias(coords2 a, coords2 b); +bool alias(scaling a, scaling b); bool alias(coord a, coord b); bool alias(autoscaleT a, autoscaleT b); -bool alias(Label a, Label b); bool alias(Legend[] a, Legend[] b); bool alias(bool[] a, bool[] b); bool alias(void()()[] a, void()()[] b); bool alias(pen[][] a, pen[][] b); -bool alias(marginT a, marginT b); +bool alias(filltype a, filltype b); +bool alias(coord[] a, coord[] b); bool alias(freezableBounds a, freezableBounds b); bool alias(transformation a, transformation b); -bool alias(pairOrTriple a, pairOrTriple b); +bool alias(align a, align b); +bool alias(object[] a, object[] b); +bool alias(picture[] a, picture[] b); bool alias(path[] a, path[] b); bool alias(triple[] a, triple[] b); -bool alias(coord a, coord b); bool alias(coords3 a, coords3 b); -bool alias(side a, side b); -bool alias(picture[] a, picture[] b); +bool alias(pairOrTriple a, pairOrTriple b); +bool alias(Label a, Label b); bool alias(marker[] a, marker[] b); bool alias(processtime a, processtime b); bool alias(real[] a, real[] b); bool alias(pen[] a, pen[] b); -bool alias(slice a, slice b); +bool alias(hsv a, hsv b); +bool alias(coords2 a, coords2 b); bool alias(scaling a, scaling b); bool alias(ScaleT a, ScaleT b); -bool alias(object a, object b); -bool alias(object[] a, object[] b); +bool alias(indexedTransform a, indexedTransform b); real pi; int getint(string name=<default>, int default=<default>, string prompt=<default>, bool store=<default>); bool IgnoreAspect; void postscript(frame f, string s); void postscript(frame f, string s, pair min, pair max); -void postscript(picture pic=<default>, string s, pair min, pair max); void postscript(picture pic=<default>, string s); +void postscript(picture pic=<default>, string s, pair min, pair max); transform slant(real s); void breakpoint(code s=<default>); void breakpoints(); @@ -1045,21 +1046,21 @@ pair[] sort(pair[] a, bool less(pair, pair)); void()()[] sort(void()()[] a, bool less(void()(), void()())); real[] sort(real[] a, bool less(real, real)); bool[] sort(bool[] a, bool less(bool, bool)); -object[] sort(object[] a, bool less(object, object)); coord[] sort(coord[] a, bool less(coord, coord)); -Label[] sort(Label[] a, bool less(Label, Label)); pen[] sort(pen[] a, bool less(pen, pen)); pen[][] sort(pen[][] a, bool less(pen[], pen[])); +coord[] sort(coord[] a, bool less(coord, coord)); +object[] sort(object[] a, bool less(object, object)); +picture[] sort(picture[] a, bool less(picture, picture)); guide[] sort(guide[] a, bool less(guide, guide)); real[][] sort(real[][] a, bool less(real[], real[])); triple[] sort(triple[] a, bool less(triple, triple)); -coord[] sort(coord[] a, bool less(coord, coord)); +Label[] sort(Label[] a, bool less(Label, Label)); string[] sort(string[] a, bool less(string, string)); int[] sort(int[] a, bool less(int, int)); string[][] sort(string[][] a, bool less(string[], string[])); bool3[] sort(bool3[] a, bool less(bool3, bool3)); pair[][] sort(pair[][] a, bool less(pair[], pair[])); -picture[] sort(picture[] a, bool less(picture, picture)); marker[] sort(marker[] a, bool less(marker, marker)); frame[] sort(frame[] a, bool less(frame, frame)); pen salmon; @@ -1071,8 +1072,8 @@ void latticeshade(picture pic=<default>, path[] g, bool stroke=<default>, pen fi pair[] pairs(real[] x, real[] y); void eval(code s, bool embedded=<default>); void eval(string s, bool embedded=<default>); -bool Arrow(picture, path, pen, marginT(path, pen)); bool Arrow(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>); +bool Arrow(picture, path, pen, marginT(path, pen)); bool Arrows(picture, path, pen, marginT(path, pen))(arrowhead arrowhead=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>); bool Arrows(picture, path, pen, marginT(path, pen)); int tell(file f); @@ -1099,9 +1100,9 @@ pen mean(pen[] p, real opacity(real[])=<default>); pen[] mean(pen[][] palette, real opacity(real[])=<default>); string mktemp(string s); void sleep(int seconds); -void unitsize(picture pic=<default>, real x, real y=<default>, real z=<default>); void arrow(picture pic=<default>, Label L=<default>, pair b, pair dir, real length=<default>, align align=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>); picture arrow(arrowhead arrowhead=<default>, path g, pen p=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, position position=<default>, bool forwards=<default>, marginT margin(path, pen)=<default>, bool center=<default>); +void unitsize(picture pic=<default>, real x, real y=<default>, real z=<default>); picture arrow2(arrowhead arrowhead=<default>, path g, pen p=<default>, real size=<default>, real angle=<default>, filltype filltype=<default>, marginT margin(path, pen)=<default>); path unitsquare; real arrowdir; @@ -1271,9 +1272,9 @@ triple[] operator +(triple[] a); pen operator +(pen a, pen b); transform operator +(transform a, transform b); pen operator +(pen p, real w); -marginT operator +(path, pen)(marginT ma(path, pen), marginT mb(path, pen)); pen[] operator +(pen a, pen[] b); pen operator +(real w, pen p); +marginT operator +(path, pen)(marginT ma(path, pen), marginT mb(path, pen)); pen[] operator +(pen[] a, pen b); int operator -(int a, int b); int[] operator -(int a, int[] b); @@ -1346,15 +1347,15 @@ triple operator *(real[][] t, triple v); triple operator *(real x, triple v); triple operator *(triple v, real x); path3 operator *(real[][] t, path3 g); -object operator *(transform t, explicit object F); -Label operator *(transform t, Label L); picture operator *(real[][] t, picture orig); +side operator *(real x, side s); +Label operator *(real[][] t, Label L); path[] operator *(transform t, explicit path[] p); bounds operator *(transform t, bounds b); -pair[] operator *(transform t, pair[] z); picture operator *(transform t, picture orig); -side operator *(real x, side s); -Label operator *(real[][] t, Label L); +object operator *(transform t, explicit object F); +pair[] operator *(transform t, pair[] z); +Label operator *(transform t, Label L); bool operator init(); int operator init(); real operator init(); @@ -1368,38 +1369,38 @@ path3 operator init(); pen operator init(); frame operator init(); file operator init(); -hsv operator init(); +marginT operator init(); projection operator init(); -picture operator init(); +side operator init(); marker operator init(); -marginT operator init(); -transformation operator init(); -pairOrTriple operator init(); filltype operator init(); +transformation operator init(); +align operator init(); +slice operator init(); coords2 operator init(); Legend operator init(); -align operator init(); framedTransformStack operator init(); -slice operator init(); +hsv operator init(); +coords2 operator init(); scaling operator init(); ScaleT operator init(); -object operator init(); -coords2 operator init(); +indexedTransform operator init(); +scaling operator init(); coord operator init(); autoscaleT operator init(); -Label operator init(); -scaling operator init(); +coord operator init(); bounds operator init(); scaleT operator init(); -position operator init(); +picture operator init(); +object operator init(); cputime operator init(); -coord operator init(); coords3 operator init(); -side operator init(); +pairOrTriple operator init(); +Label operator init(); processtime operator init(); bool3 operator init(); light operator init(); -indexedTransform operator init(); +position operator init(); arrowhead operator init(); real operator cast(int); pair operator cast(int); @@ -1442,33 +1443,33 @@ string[][][] operator cast(file); guide operator cast(cycleToken tok); guide operator cast(curlSpecifier spec); guide operator cast(tensionSpecifier t); -object operator cast(Label L); -Label operator cast(object F); guide[] operator cast(path[] g); -position operator cast(pair x); -align operator cast(side side); -pair operator cast(position P); +position operator cast(real x); +hsv operator cast(pen p); +Label operator cast(string s); +frame operator cast(object F); bool3[] operator cast(bool[] b); -object operator cast(frame f); +align operator cast(side side); +pair operator cast(pairOrTriple a); +triple operator cast(pairOrTriple a); +position operator cast(pair x); guide[] operator cast(pair[] z); path[] operator cast(guide[] g); bool operator cast(bool3 b); +pair operator cast(position P); +object operator cast(frame f); path[] operator cast(guide g); -pen operator cast(hsv hsv); +object operator cast(Label L); +Label operator cast(object F); +align operator cast(pair dir); path[] operator cast(pair[] z); path[] operator cast(path p); -pair operator cast(pairOrTriple a); -triple operator cast(pairOrTriple a); bool[] operator cast(bool3[] b); +align operator cast(triple dir); +bool3 operator cast(bool b); +pen operator cast(hsv hsv); position operator cast(int x); -hsv operator cast(pen p); object operator cast(string s); -align operator cast(pair dir); -bool3 operator cast(bool b); -position operator cast(real x); -Label operator cast(string s); -align operator cast(triple dir); -frame operator cast(object F); pen deepred; bool error(file f); string operator ecast(int); @@ -1502,6 +1503,7 @@ real[] operator /(int[] a, int b); real[] operator /(int a, int[] b); real[] operator /(int[] a, int[] b); triple operator /(triple v, real x); +path[] texpath(string s, pen p, bool tex=<default>, bool bbox=<default>); path[] texpath(Label L, bool tex=<default>, bool bbox=<default>); bool uptodate(); int operator %(int a, int b); @@ -1569,39 +1571,39 @@ bool operator ==(path a, path b); bool operator ==(path3 a, path3 b); bool operator ==(bool3 a, bool3 b); bool operator ==(light a, light b); -bool operator ==(indexedTransform a, indexedTransform b); +bool operator ==(position a, position b); bool operator ==(arrowhead a, arrowhead b); -bool operator ==(coords2 a, coords2 b); +bool operator ==(scaling a, scaling b); bool operator ==(coord a, coord b); bool operator ==(autoscaleT a, autoscaleT b); -bool operator ==(Label a, Label b); -bool operator ==(marginT a, marginT b); +bool operator ==(filltype a, filltype b); bool operator ==(freezableBounds a, freezableBounds b); bool operator ==(transformation a, transformation b); -bool operator ==(pairOrTriple a, pairOrTriple b); -bool operator ==(coord a, coord b); +bool operator ==(align a, align b); bool operator ==(coords3 a, coords3 b); -bool operator ==(side a, side b); +bool operator ==(pairOrTriple a, pairOrTriple b); +bool operator ==(Label a, Label b); bool operator ==(processtime a, processtime b); -bool operator ==(slice a, slice b); +bool operator ==(hsv a, hsv b); +bool operator ==(coords2 a, coords2 b); bool operator ==(scaling a, scaling b); bool operator ==(ScaleT a, ScaleT b); -bool operator ==(object a, object b); +bool operator ==(indexedTransform a, indexedTransform b); bool operator ==(bool3 a, bool b); -bool operator ==(hsv a, hsv b); +bool operator ==(marginT a, marginT b); bool operator ==(projection a, projection b); -bool operator ==(picture a, picture b); +bool operator ==(side a, side b); bool operator ==(marker a, marker b); -bool operator ==(scaling a, scaling b); +bool operator ==(coord a, coord b); bool operator ==(bounds a, bounds b); bool operator ==(scaleT a, scaleT b); -bool operator ==(position a, position b); +bool operator ==(picture a, picture b); +bool operator ==(object a, object b); bool operator ==(cputime a, cputime b); bool operator ==(bool a, bool3 b); -bool operator ==(filltype a, filltype b); +bool operator ==(slice a, slice b); bool operator ==(coords2 a, coords2 b); bool operator ==(Legend a, Legend b); -bool operator ==(align a, align b); bool operator ==(framedTransformStack a, framedTransformStack b); bool operator !=(bool a, bool b); bool[] operator !=(bool a, bool[] b); @@ -1641,39 +1643,39 @@ bool operator !=(path a, path b); bool operator !=(path3 a, path3 b); bool operator !=(bool3 a, bool3 b); bool operator !=(light a, light b); -bool operator !=(indexedTransform a, indexedTransform b); +bool operator !=(position a, position b); bool operator !=(arrowhead a, arrowhead b); -bool operator !=(coords2 a, coords2 b); +bool operator !=(scaling a, scaling b); bool operator !=(coord a, coord b); bool operator !=(autoscaleT a, autoscaleT b); -bool operator !=(Label a, Label b); -bool operator !=(marginT a, marginT b); +bool operator !=(filltype a, filltype b); bool operator !=(freezableBounds a, freezableBounds b); bool operator !=(transformation a, transformation b); -bool operator !=(pairOrTriple a, pairOrTriple b); -bool operator !=(coord a, coord b); +bool operator !=(align a, align b); bool operator !=(coords3 a, coords3 b); -bool operator !=(side a, side b); +bool operator !=(pairOrTriple a, pairOrTriple b); +bool operator !=(Label a, Label b); bool operator !=(processtime a, processtime b); -bool operator !=(slice a, slice b); +bool operator !=(hsv a, hsv b); +bool operator !=(coords2 a, coords2 b); bool operator !=(scaling a, scaling b); bool operator !=(ScaleT a, ScaleT b); -bool operator !=(object a, object b); +bool operator !=(indexedTransform a, indexedTransform b); bool operator !=(bool3 a, bool b); -bool operator !=(hsv a, hsv b); +bool operator !=(marginT a, marginT b); bool operator !=(projection a, projection b); -bool operator !=(picture a, picture b); +bool operator !=(side a, side b); bool operator !=(marker a, marker b); -bool operator !=(scaling a, scaling b); +bool operator !=(coord a, coord b); bool operator !=(bounds a, bounds b); bool operator !=(scaleT a, scaleT b); -bool operator !=(position a, position b); +bool operator !=(picture a, picture b); +bool operator !=(object a, object b); bool operator !=(cputime a, cputime b); bool operator !=(bool a, bool3 b); -bool operator !=(filltype a, filltype b); +bool operator !=(slice a, slice b); bool operator !=(coords2 a, coords2 b); bool operator !=(Legend a, Legend b); -bool operator !=(align a, align b); bool operator !=(framedTransformStack a, framedTransformStack b); bool operator <(int a, int b); bool[] operator <(int a, int[] b); @@ -1821,9 +1823,9 @@ marker dot(pen p=<default>, filltype filltype=<default>); void dot(picture pic=<default>, pair z, pen p=<default>, filltype filltype=<default>); void dot(frame f, pair z, pen p=<default>, filltype filltype=<default>); void dot(picture pic=<default>, Label L, pen p=<default>, filltype filltype=<default>); -marker dot; void dot(picture pic=<default>, Label[] L=<default>, pair[] z, align align=<default>, string format=<default>, pen p=<default>, filltype filltype=<default>); void dot(picture pic=<default>, path[] g, pen p=<default>, filltype filltype=<default>); +marker dot; void dot(picture pic=<default>, Label L, pair z, align align=<default>, string format=<default>, pen p=<default>, filltype filltype=<default>); void list(string s, bool imports=<default>); pair NNW; @@ -1909,8 +1911,8 @@ real expm1(real x); real[] expm1(real[] a); void activatequote(picture pic=<default>); int undefined; -frame[] fit2(picture[] pictures, picture all); string ask(string prompt); +frame[] fit2(picture[] pictures, picture all); pen linecap(int n); int linecap(pen p=<default>); string outname(); @@ -1924,8 +1926,8 @@ triple accel(path3 p, real t); frame Portrait(frame f); void tex(frame f, string s); void tex(frame f, string s, pair min, pair max); -void tex(picture pic=<default>, string s, pair min, pair max); void tex(picture pic=<default>, string s); +void tex(picture pic=<default>, string s, pair min, pair max); pen Black; triple size3(frame f); void size3(picture pic=<default>, real x, real y=<default>, real z=<default>, bool keepAspect=<default>); @@ -1965,8 +1967,8 @@ path section(path p, real t1, real t2, bool loop=<default>); real fuzz; path[][] containmentTree(path[] paths); binarytree searchtree(... int[] keys); -object draw(picture pic=<default>, binarytreeNode node, pair pos, int height, real minDist, real levelDist, real nodeDiameter, pen p=<default>); -void draw(picture pic=<default>, binarytree tree, real minDist=<default>, real nodeMargin=<default>, pen p=<default>); +object draw(picture pic=<default>, binarytreeNode node, pair pos, int height, real minDist, real levelDist, real nodeDiameter, pen p=<default>, bool condensed=<default>); +void draw(picture pic=<default>, binarytree tree, real minDist=<default>, real nodeMargin=<default>, pen p=<default>, bool condensed=<default>); real nodeMarginDefault; key key(int n, bool active=<default>); binarytree binarytree(... key[] keys); @@ -1998,11 +2000,11 @@ void draw(picture pic=<default>, Label L, guide[] g, pen p=<default>); int interior; pen[][] interior(picture pic=<default>, guide[][] g, pen[] palette); pen[] extend(pen[] palette, pen below, pen above); -bool same(gridpoint gp1, gridpoint gp2); guide connect(Segment S, pair[][] z, guide join(... guide[])); guide[] connect(Segment[] S, pair[][] z, guide join(... guide[])); guide[][] connect(Segment[][] S, pair[][] z, guide join(... guide[])); guide[][] connect(pair[][][] points, real[] c, guide join(... guide[])); +bool same(gridpoint gp1, gridpoint gp2); bool connected(boxcontour bc1, boxcontour bc2); int exterior; int connectedindex(boxcontour bc, boxcontour[] bca, bool activeonly=<default>); @@ -2052,14 +2054,16 @@ real treeLevelStep; real treeMinNodeWidth; TreeNode makeNode(TreeNode parent=<default>, frame f); TreeNode makeNode(TreeNode parent=<default>, Label label); -string link(string label, string text, string options=<default>); -string embed(string name, string options=<default>, real width=<default>, real height=<default>); -string hyperlink(string url, string text); -string link(string url, string text, string options=<default>); -string embed(string name, string options=<default>, real width=<default>, real height=<default>, string image=<default>); +string link(string label, string text=<default>); +string embed(string name, string text=<default>, string options=<default>, real width=<default>, real height=<default>); +string embedplayer(string name, string text=<default>, string options=<default>, real width=<default>, real height=<default>); +string link(string label, string text=<default>); +string embed(string name, string text=<default>, string options=<default>, real width=<default>, real height=<default>, string image=<default>); string hyperlink(string url, string text); real gluonratio; real gluonamplitude; +pen doublelinepen; +real doublelinespacing; void drawGluon(picture pic=<default>, path p, real amp=<default>, real width=<default>, pen fgpen=<default>, bool erasebg=<default>, pen bgpen=<default>, real vertexangle=<default>, real margin=<default>); void drawGhost(picture pic=<default>, path p, pen fgpen=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, bool erasebg=<default>, pen bgpen=<default>, real vertexangle=<default>, real margin=<default>); void drawVertex(picture pic=<default>, pair xy, real r=<default>, pen fgpen=<default>); @@ -2071,8 +2075,8 @@ void drawVertexOX(picture pic=<default>, pair xy, real r=<default>, pen fgpen=<d void drawVertexTriangle(picture pic=<default>, pair xy, real r=<default>, pen fgpen=<default>); void drawVertexTriangleO(picture pic=<default>, pair xy, real r=<default>, pen fgpen=<default>, bool erasebg=<default>, pen bgpen=<default>); void drawVertexBoxX(picture pic=<default>, pair xy, real r=<default>, pen fgpen=<default>, bool erasebg=<default>, pen bgpen=<default>); -bool XYAlign; void do_overpaint(picture pic, path p, pen bgpen, real halfwidth, real vertexangle); +bool XYAlign; void texshipout(string stem, picture pic=<default>, bool xalign=<default>); void drawDoubleLine(picture pic=<default>, path p, pen fgpen=<default>, real dlspacing=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, bool erasebg=<default>, pen bgpen=<default>, real vertexangle=<default>, real margin=<default>); void drawScalar(picture pic=<default>, path p, pen fgpen=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, bool erasebg=<default>, pen bgpen=<default>, real vertexangle=<default>, real margin=<default>); @@ -2094,8 +2098,8 @@ path momArrowPath(path p, align align, position pos, real offset=<default>, real void drawPhoton(picture pic=<default>, path p, real amp=<default>, real width=<default>, pen fgpen=<default>, bool erasebg=<default>, pen bgpen=<default>, real vertexangle=<default>, real margin=<default>); bool YAlign; pen backgroundpen; -pen ghostpen; pen scalarpen; +pen ghostpen; pen fermionpen; pen bigvertexpen; real bigvertexsize; @@ -2107,8 +2111,6 @@ void drawFermion(picture pic=<default>, path p, pen fgpen=<default>, bool arrow( bool currentarrow(picture, path, pen, marginT(path, pen)); bool currentmomarrow(picture, path, pen, marginT(path, pen)); bool appendsuffix; -pen doublelinepen; -real doublelinespacing; path gluon(path p, real amp=<default>, real width=<default>); pen gluonpen; Dir Left; @@ -2216,7 +2218,6 @@ int ellipsenodesnumber(real a, real b); int ellipsenodesnumber(real a, real b, real angle1, real angle2, bool dir); int ellipsenodesnumberfactor; bool byfoci; -point[] standardizecoordsys(coordsys R=<default>, bool warn=<default> ... point[] M); transform reflect(line l); transform reflect(line l1, line l2, bool safe=<default>); abscissa relabscissa(real x); @@ -2233,6 +2234,7 @@ vector unit(point M); vector unit(vector u); line Ox(coordsys R=<default>); line Ox; +point[] standardizecoordsys(coordsys R=<default>, bool warn=<default> ... point[] M); conic conic(point F, line l, real e); conic conic(point M1, point M2, point M3, point M4, point M5); conic conic(bqe bqe); @@ -2333,7 +2335,6 @@ line bisector(point A, point B, real angle=<default>); line bisector(vertex V, real angle=<default>); line bisector(side side); bqe canonical(bqe bqe); -bool between(point M, point O, point N); point bisectorpoint(side side); abscissa angabscissa(real x, path polarconicroutine(conic co, real angle1, real angle2, int n, bool direction)=<default>); abscissa angabscissa(int x, path polarconicroutine(conic co, real angle1, real angle2, int n, bool direction)=<default>); @@ -2361,6 +2362,7 @@ arc arc(explicit arc a, abscissa x1, abscissa x2); arc arc(explicit arc a, point M, point N); path arc(explicit pair B, explicit pair A, explicit pair C, real r); void markrightangle(picture pic=<default>, point A, point O, point B, real size=<default>, pen p=<default>, marginT margin(path, pen)=<default>, filltype filltype=<default>); +bool between(point M, point O, point N); real epsgeo; real sharpangle(line l1, line l2); bool isparabola(bqe bqe); @@ -2687,9 +2689,6 @@ bool operator @(point m, line l); bool operator @(point M, conic co); bool operator @(point M, explicit circle c); bool operator @(point M, arc a); -triangle cevian(triangle t, point P); -point cevian(side side, point P); -line cevian(vertex V, point P); triangle triangle(line l1, line l2, line l3); trilinear trilinear(triangle t, real a, real b, real c); trilinear trilinear(triangle t, point M); @@ -2705,6 +2704,9 @@ real degrees(line l1, line l2); real degrees(arc a); real linemargin; real linemargin(); +triangle cevian(triangle t, point P); +point cevian(side side, point P); +line cevian(vertex V, point P); line Oy(coordsys R=<default>); line Oy; path fromCenter(conic co, real angle1, real angle2, int n, bool direction); @@ -2728,8 +2730,6 @@ bool onpath(picture pic=<default>, path g, point M, pen p=<default>); int parabolanodesnumber(parabola p, real angle1, real angle2); int parabolanodesnumberfactor; path NoModifier(path); -real[] bangles(picture pic=<default>, parabola p); -real[][] bangles(picture pic=<default>, hyperbola h); coordsys currentcoordsys; point foot(vertex V); point foot(side side); @@ -2739,6 +2739,8 @@ transform rotate(explicit vector dir); transform rotate(explicit point dir); real EPS; transform rotateO(real a); +real[] bangles(picture pic=<default>, parabola p); +real[][] bangles(picture pic=<default>, hyperbola h); pair attract(pair m, path g, real fuzz=<default>); point attract(point M, path g, real fuzz=<default>); line perpendicular(point M, line l); @@ -2753,10 +2755,6 @@ void perpendicularmark(picture pic=<default>, point z, vector align, vector dir= void perpendicularmark(picture pic=<default>, point z, explicit pair align, path g, real size=<default>, pen p=<default>, marginT margin(path, pen)=<default>, filltype filltype=<default>); void perpendicularmark(picture pic=<default>, point z, vector align, path g, real size=<default>, pen p=<default>, marginT margin(path, pen)=<default>, filltype filltype=<default>); void perpendicularmark(picture pic=<default>, line l1, line l2, real size=<default>, pen p=<default>, int quarter=<default>, marginT margin(path, pen)=<default>, filltype filltype=<default>); -point isogonalconjugate(triangle t, point M); -point isogonal(side side, point M); -line isogonal(vertex V, point M); -triangle isogonal(triangle t, point M); void Drawline(picture pic=<default>, Label L=<default>, pair P, bool dirP=<default>, pair Q, bool dirQ=<default>, align align=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, Label legend=<default>, marker marker=<default>, path pathModifier(path)=<default>); bool simeq(point A, point B, real fuzz=<default>); bool simeq(point a, real b, real fuzz=<default>); @@ -2769,7 +2767,11 @@ inversion inversion(point C, real k); inversion inversion(circle c1, circle c2, real sgn=<default>); inversion inversion(circle c1, circle c2, circle c3); inversion inversion(circle c); +point isogonalconjugate(triangle t, point M); coordsys cartesiansystem(pair O=<default>, pair i, pair j); +point isogonal(side side, point M); +line isogonal(vertex V, point M); +triangle isogonal(triangle t, point M); line tangent(circle c, abscissa x); line tangent(circle c, point M); line tangent(circle c, explicit vector v); @@ -2833,15 +2835,15 @@ void Left(picture, axisT); autoscaleT defaultS; void XEquals(picture, axisT)(real x, bool extend=<default>); void YEquals(picture, axisT)(real y, bool extend=<default>); -tickvalues OmitTickIntervals(tickvalues)(real[] a, real[] b); -tickvalues OmitTickInterval(tickvalues)(real a, real b); -tickvalues OmitTick(tickvalues)(... real[] x); string LogFormat(real)(int base); string LogFormat(real); axisT axis; void axis(picture pic=<default>, Label L=<default>, path g, path g2=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>), ticklocate locate, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, int[] divisor=<default>, bool above=<default>, bool opposite=<default>); void drawtick(frame f, transform T, path g, path g2, ticklocate locate, real val, real Size, int sign, pen p, bool extend); +tickvalues OmitTickIntervals(tickvalues)(real[] a, real[] b); real maxlength(pair a, pair b, int nx, int ny); +tickvalues OmitTickInterval(tickvalues)(real a, real b); +tickvalues OmitTick(tickvalues)(... real[] x); void errorbar(picture pic, pair z, pair dp, pair dm, pen p=<default>, real size=<default>); void errorbars(picture pic=<default>, pair[] z, pair[] dp, pair[] dm=<default>, bool[] cond=<default>, pen p=<default>, real size=<default>); void errorbars(picture pic=<default>, real[] x, real[] y, real[] dpx, real[] dpy, real[] dmx=<default>, real[] dmy=<default>, bool[] cond=<default>, pen p=<default>, real size=<default>); @@ -2874,11 +2876,11 @@ void labelaxis(frame f, transform T, Label L, path g, ticklocate locate=<default void xaxisAt(picture pic=<default>, Label L=<default>, void axis(picture, axisT), real xmin=<default>, real xmax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool opposite=<default>); void yaxisAt(picture pic=<default>, Label L=<default>, void axis(picture, axisT), real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool opposite=<default>); void xaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real xmin=<default>, real xmax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>); -void yaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool autorotate=<default>); void xtick(picture pic=<default>, explicit pair z, pair dir=<default>, real size=<default>, pen p=<default>); void xtick(picture pic=<default>, real x, pair dir=<default>, real size=<default>, pen p=<default>); void xtick(picture pic=<default>, Label L, explicit pair z, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>); void xtick(picture pic=<default>, Label L, real x, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>); +void yaxis(picture pic=<default>, Label L=<default>, void axis(picture, axisT)=<default>, real ymin=<default>, real ymax=<default>, pen p=<default>, void ticks(frame, transform, Label, pair, path, path, pen, bool(picture, path, pen, marginT(path, pen)), marginT(path, pen), ticklocate, int[], bool opposite=<default>)=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>, bool autorotate=<default>); void ytick(picture pic=<default>, explicit pair z, pair dir=<default>, real size=<default>, pen p=<default>); void ytick(picture pic=<default>, real y, pair dir=<default>, real size=<default>, pen p=<default>); void ytick(picture pic=<default>, Label L, explicit pair z, pair dir=<default>, string format=<default>, real size=<default>, pen p=<default>); @@ -2936,7 +2938,7 @@ tickvalues operator init(); axisT operator init(); path[] segment(pair[] z, bool[] cond, guide join(... guide[])=<default>); int Both; -void axes(picture pic=<default>, Label xlabel=<default>, Label ylabel=<default>, pair min=<default>, pair max=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>); +void axes(picture pic=<default>, Label xlabel=<default>, Label ylabel=<default>, bool extend=<default>, pair min=<default>, pair max=<default>, pen p=<default>, bool arrow(picture, path, pen, marginT(path, pen))=<default>, marginT margin(path, pen)=<default>, bool above=<default>); string signedtrailingzero; ticklocate ticklocate(real a, real b, autoscaleT S=<default>, real tickmin=<default>, real tickmax=<default>, real time(real)=<default>, pair dir(real)=<default>); pair ticklabelshift(pair align, pen p=<default>); @@ -3038,7 +3040,7 @@ void Spline(flatguide3)(... void(flatguide3)[]); void InOutTicks(picture, real[][], Label, path3, path3, pen, bool(picture, path3, material, marginT3(path3, pen), light, light), marginT3(path3, pen), ticklocate, int[], bool opposite=<default>, bool primary=<default>)(Label format=<default>, string ticklabel(real)=<default>, bool beginlabel=<default>, bool endlabel=<default>, int N=<default>, int n=<default>, real Step=<default>, real step=<default>, bool begin=<default>, bool end=<default>, tickvalues modify(tickvalues)=<default>, real Size=<default>, real size=<default>, bool extend=<default>, pen pTick=<default>, pen ptick=<default>); void InOutTicks(picture, real[][], Label, path3, path3, pen, bool(picture, path3, material, marginT3(path3, pen), light, light), marginT3(path3, pen), ticklocate, int[], bool opposite=<default>, bool primary=<default>)(Label format=<default>, string ticklabel(real)=<default>, bool beginlabel=<default>, bool endlabel=<default>, real[] Ticks, real[] ticks=<default>, real Size=<default>, real size=<default>, bool extend=<default>, pen pTick=<default>, pen ptick=<default>); void InOutTicks(picture, real[][], Label, path3, path3, pen, bool(picture, path3, material, marginT3(path3, pen), light, light), marginT3(path3, pen), ticklocate, int[], bool opposite=<default>, bool primary=<default>); -void axes3(picture pic=<default>, Label xlabel=<default>, Label ylabel=<default>, Label zlabel=<default>, triple min=<default>, triple max=<default>, pen p=<default>, bool arrow(picture, path3, material, marginT3(path3, pen), light, light)=<default>, marginT3 margin(path3, pen)=<default>); +void axes3(picture pic=<default>, Label xlabel=<default>, Label ylabel=<default>, Label zlabel=<default>, bool extend=<default>, triple min=<default>, triple max=<default>, pen p=<default>, bool arrow(picture, path3, material, marginT3(path3, pen), light, light)=<default>, marginT3 margin(path3, pen)=<default>); void label(picture pic, Label L, triple v, real x, align align, string format, pen p); void labelx(picture pic=<default>, Label L=<default>, triple v, align align=<default>, string format=<default>, pen p=<default>); void labely(picture pic=<default>, Label L=<default>, triple v, align align=<default>, string format=<default>, pen p=<default>); @@ -3149,11 +3151,11 @@ grid3 YXgrid(picture pic)(position pos=<default>); grid3 YXgrid(picture pic); grid3 ZXgrid(picture pic)(position pos=<default>); grid3 ZXgrid(picture pic); +triple XY(picture pic); grid3 XZgrid(picture pic)(position pos=<default>); grid3 XZgrid(picture pic); grid3 YZgrid(picture pic)(position pos=<default>); grid3 YZgrid(picture pic); -triple XY(picture pic); position middle; grid3(picture pic)[][] XYZgrid(position pos=<default>); grid3(picture pic)[][] XYZgrid; @@ -3358,9 +3360,9 @@ void add(string name, picture pic, pair lb=<default>, pair rt=<default>); frame tiling(string name, picture pic, pair lb=<default>, pair rt=<default>); picture tile(real Hx=<default>, real Hy=<default>, pen p=<default>, filltype filltype=<default>); void grestore(picture pic=<default>); +pen textpen; void gsave(picture pic=<default>); pair align; -pen textpen; path roundedpath(path A, real R, real S=<default>); problem operator init(); real infinity; @@ -3386,14 +3388,12 @@ void asyfilecode(bool center=<default>, string s, string options=<default>, stri bool itemstep; real itemskip; void remark(bool center=<default>, string s, pair align=<default>, pen p=<default>, real indent=<default>, bool minipage=<default>, real skip=<default>, filltype filltype=<default>, bool step=<default>); -int page; void usersetting(); bool landscape; real codeskip; +int page; void newslide(bool stepping=<default>); -void nextpage(pen p=<default>); pen itempen; -void filecode(bool center=<default>, string s, pen p=<default>, real indent=<default>, real skip=<default>, filltype filltype=<default>); bool reverse; void reversevideo(); void vbox(string s, pen p=<default>); @@ -3405,6 +3405,7 @@ real pagewidth; picture background; void background(); pen backgroundcolor; +void nextpage(pen p=<default>); void normalvideo(); void title(string s, pair position=<default>, pair align=<default>, pen p=<default>, bool newslide=<default>); pen titlepen; @@ -3415,6 +3416,7 @@ pen titlepagepen; void titlepage(string title, string author, string institution=<default>, string date=<default>, string url=<default>, bool newslide=<default>); pair titlepageposition; pen codepen; +void filecode(bool center=<default>, string s, pen p=<default>, real indent=<default>, real skip=<default>, filltype filltype=<default>); void erasestep(int erasenode); bool checkposition(); void setpens(pen red=<default>, pen blue=<default>, pen steppen=<default>); @@ -3423,7 +3425,6 @@ transform tinv; pair urlskip; void numberpage(pen p=<default>); pen urlpen; -void item(string s, pen p=<default>, bool step=<default>); int[] firstnode; bool firststep; string asywrite(string s, string preamble=<default>); @@ -3433,17 +3434,16 @@ string newbulletcolor; pen datepen; void incrementposition(pair z); pen institutionpen; -string cropcode(string s); +void item(string s, pen p=<default>, bool step=<default>); void skip(real n=<default>); bool stepping; real pagemargin; pen steppagenumberpen; -bool allowstepping; -pair currentposition; bool empty(); void currentexitfunction(); void step(); string[] codefile; +string cropcode(string s); void outline(string s=<default>, pair position=<default>, pair align=<default>, pen p=<default>); void center(string s, pen p=<default>); void equation(string s, pen p=<default>); @@ -3454,6 +3454,8 @@ void figure(string s, string options=<default>, string caption=<default>, pair a real figureborder; pen figuremattpen; string bullet; +bool allowstepping; +pair currentposition; int preamblenodes; string bulletcolor(string color); real minipagewidth; @@ -3483,8 +3485,8 @@ int[][] frequency(real[] x, real[] y, pair a, pair b, int nx, int ny=<default>); int[][] frequency(pair[] z, pair a, pair b, int nx, int ny=<default>); real mean(real[] A); int bins(real[] data, int max=<default>); -real stdev(real[] A); path topbox(pair a, pair b); +real stdev(real[] A); path halfbox(pair a, pair b); real Gaussian(real x, real sigma); real Gaussian(real x); @@ -3505,22 +3507,23 @@ Relation r3; picture tableau(frame[] cards, bool number=<default>); pair min(pair[] z); Component bp; -Braid apply(Relation r, Braid b, int step, int place); Component phi; real gapfactor; +Braid apply(Relation r, Braid b, int step, int place); Component bm; -Component wye; Relation operator -(Relation r); Component operator init(); Braid operator init(); Relation operator init(); Syzygy operator init(); Relation r4b; +Component wye; real hwratio; Relation r4a; pair max(pair[] z); pen Orchid; pen Magenta; +pen Salmon; pen BrickRed; pen CadetBlue; pen CarnationPink; @@ -3528,26 +3531,23 @@ pen SpringGreen; pen MidnightBlue; pen OliveGreen; pen Apricot; -pen Aquamarine; pen Cyan; -pen Lavender; pen Red; pen RawSienna; pen Mahogany; pen Gray; +pen Aquamarine; pen Plum; pen BlueGreen; pen Cerulean; pen Blue; +pen Lavender; pen BlueViolet; pen RedOrange; pen Goldenrod; pen ForestGreen; pen BurntOrange; pen Tan; -pen YellowOrange; -pen Maroon; -pen YellowGreen; pen Brown; pen RubineRed; pen TealBlue; @@ -3557,31 +3557,33 @@ pen Bittersweet; pen Orange; pen OrangeRed; pen Fuchsia; +pen YellowOrange; +pen Maroon; pen Peach; -pen Sepia; +pen YellowGreen; pen PineGreen; pen Dandelion; pen Black; -pen VioletRed; pen NavyBlue; -pen Violet; pen Rhodamine; pen ProcessBlue; +pen Sepia; pen LimeGreen; -pen Thistle; pen Green; pen GreenYellow; -pen DarkOrchid; +pen VioletRed; +pen Violet; pen Emerald; pen Mulberry; pen RedViolet; +pen Thistle; pen SkyBlue; pen SeaGreen; -pen WildStrawberry; pen Periwinkle; +pen DarkOrchid; pen Yellow; +pen WildStrawberry; pen JungleGreen; -pen Salmon; pen CornflowerBlue; pen RoyalBlue; pen Melon; @@ -3616,20 +3618,19 @@ pen Beige; pen SlateBlue; pen SlateGray; pen Magenta; -pen SteelBlue; +pen Salmon; pen CadetBlue; pen DeepPink; +pen LavenderBlush; pen SpringGreen; +pen Wheat; pen MidnightBlue; pen Olive; pen OliveDrab; -pen LemonChiffon; -pen Aquamarine; pen Chocolate; +pen SteelBlue; pen Cyan; pen Gainsboro; -pen Lavender; -pen Aqua; pen Ivory; pen PapayaWhip; pen Red; @@ -3644,22 +3645,24 @@ pen MediumSeaGreen; pen MediumSlateBlue; pen MediumAquamarine; pen MediumSpringGreen; +pen LemonChiffon; pen MediumTurquoise; pen MediumVioletRed; +pen Aquamarine; pen Plum; pen Blue; pen Gold; pen Sienna; +pen Lavender; pen BlueViolet; pen Goldenrod; +pen Aqua; pen ForestGreen; pen Chartreuse; pen NavajoWhite; pen Tan; pen DarkMagenta; -pen Maroon; pen AntiqueWhite; -pen YellowGreen; pen PaleTurquoise; pen IndianRed; pen Crimson; @@ -3674,51 +3677,51 @@ pen White; pen Purple; pen WhiteSmoke; pen DimGray; -pen DarkOliveGreen; -pen DarkOrange; pen Orange; pen OrangeRed; pen Fuchsia; +pen Maroon; pen PeachPuff; +pen YellowGreen; pen Honeydew; pen Bisque; pen RosyBrown; -pen Silver; pen Black; pen Khaki; pen FireBrick; -pen Violet; pen Snow; -pen SandyBrown; +pen DarkOliveGreen; +pen DarkOrange; pen LimeGreen; pen Lime; -pen Thistle; -pen DeepSkyBlue; +pen Silver; pen OldLace; pen Green; pen GreenYellow; +pen Violet; pen DarkCyan; pen FloralWhite; pen DarkRed; -pen DarkOrchid; -pen Cornsilk; +pen SandyBrown; pen BlanchedAlmond; pen PowderBlue; +pen Thistle; pen DarkGray; pen DarkGreen; pen DarkGoldenrod; pen SkyBlue; pen SeaGreen; pen DarkViolet; +pen DeepSkyBlue; pen Teal; pen AliceBlue; pen HotPink; -pen Seashell; +pen DarkOrchid; pen DodgerBlue; pen SaddleBrown; pen Tomato; pen DarkKhaki; -pen GhostWhite; +pen Cornsilk; pen LightBlue; pen LightCoral; pen LightCyan; @@ -3736,18 +3739,17 @@ pen Navy; pen LightSkyBlue; pen LightSlateGray; pen PaleVioletRed; -pen Salmon; pen LightSteelBlue; pen LightYellow; pen CornflowerBlue; +pen Seashell; pen rgbint(int r, int g, int b); pen Coral; pen MistyRose; -pen LavenderBlush; pen DarkSalmon; -pen Wheat; pen DarkSeaGreen; pen RoyalBlue; pen DarkSlateBlue; pen DarkSlateGray; pen Turquoise; +pen GhostWhite; diff --git a/Build/source/utils/asymptote/asymptote.spec b/Build/source/utils/asymptote/asymptote.spec index b3ec070547b..aba8814705a 100644 --- a/Build/source/utils/asymptote/asymptote.spec +++ b/Build/source/utils/asymptote/asymptote.spec @@ -1,7 +1,7 @@ %{!?_texmf: %define _texmf %(eval "echo `kpsewhich -expand-var '$TEXMFLOCAL'`")} Name: asymptote -Version: 2.16 +Version: 2.21 Release: 1%{?dist} Summary: Descriptive vector graphics language diff --git a/Build/source/utils/asymptote/base/asy_filetype.vim b/Build/source/utils/asymptote/base/asy_filetype.vim new file mode 100644 index 00000000000..3b614edf12b --- /dev/null +++ b/Build/source/utils/asymptote/base/asy_filetype.vim @@ -0,0 +1,3 @@ +" Vim filetype detection file +" Language: Asymptote +au BufNewFile,BufRead *.asy setfiletype asy diff --git a/Build/source/utils/asymptote/base/bezulate.asy b/Build/source/utils/asymptote/base/bezulate.asy index 5b21d8c1605..a0f6689b504 100644 --- a/Build/source/utils/asymptote/base/bezulate.asy +++ b/Build/source/utils/asymptote/base/bezulate.asy @@ -32,7 +32,7 @@ path[][] containmentTree(path[] paths) resultj.insert(0,g); // check to see if any other groups are contained within this curve for(int k=j+1; k < result.length;) { - if(inside(g,result[k][0]) == 1) { + if(inside(g,result[k][0],zerowinding) == 1) { resultj.append(result[k]); result.delete(k); } else ++k; @@ -101,22 +101,45 @@ void connect(path[] paths, path[] result, path[] patch) real d=2*abs(max(outer)-min(outer)); while(inners.length > 0) { int curveIndex = 0; - pair direction=I*dir(inners[curveIndex],0,1); // Use outgoing direction - if(direction == 0) // Try a random direction - direction=expi(2pi*unitrand()); - pair start=point(inners[curveIndex],0); - + //pair direction=I*dir(inners[curveIndex],0,1); // Use outgoing direction + //if(direction == 0) // Try a random direction + // direction=expi(2pi*unitrand()); + //pair start=point(inners[curveIndex],0); + + // find shortest distance between a node on the inner curve and a node + // on the outer curve + + real mindist = d; + int inner_i = 0; + int outer_i = 0; + for(int ni = 0; ni < length(inners[curveIndex]); ++ni) + { + for(int no = 0; no < length(outer); ++no) + { + real dist = abs(point(inners[curveIndex],ni)-point(outer,no)); + if(dist < mindist) + { + inner_i = ni; + outer_i = no; + mindist = dist; + } + } + } + pair start=point(inners[curveIndex],inner_i); + pair end = point(outer,outer_i); + // find first intersection of line segment with outer curve - real[][] ints=intersections(start,start+d*direction,outer); + //real[][] ints=intersections(start,start+d*direction,outer); + real[][] ints=intersections(start,end,outer); assert(ints.length != 0); real endtime=ints[0][1]; // endtime is time on outer - pair end = point(outer,endtime); - + end = point(outer,endtime); // find first intersection of end--start with any inner curve - real starttime=0; // starttime is time on inners[curveIndex] + real starttime=inner_i; // starttime is time on inners[curveIndex] real earliestTime=1; for(int j=0; j < inners.length; ++j) { real[][] ints=intersections(end,start,inners[j]); + if(ints.length > 0 && ints[0][0] < earliestTime) { earliestTime=ints[0][0]; // time on end--start starttime=ints[0][1]; // time on inner curve @@ -124,49 +147,80 @@ void connect(path[] paths, path[] result, path[] patch) } } start=point(inners[curveIndex],starttime); - - real timeoffset=2; - bool found=false; - path portion; + + + bool found_forward = false; + real timeoffset_forward = 2; + path portion_forward; path[] allCurves = {outer}; allCurves.append(inners); - while(!found && timeoffset > fuzz) { - timeoffset /= 2; + while(!found_forward && timeoffset_forward > fuzz) { + timeoffset_forward /= 2; if(countIntersections(allCurves,start, - point(outer,endtime+timeoffset)) == 2) + point(outer,endtime+timeoffset_forward)) == 2) { - portion = subpath(outer,endtime,endtime+timeoffset)--start--cycle; - found=true; + portion_forward = subpath(outer,endtime,endtime+timeoffset_forward)--start--cycle; + + found_forward=true; // check if an inner curve is inside the portion - for(int k = 0; found && k < inners.length; ++k) + for(int k = 0; found_forward && k < inners.length; ++k) { if(k!=curveIndex && - inside(portion,point(inners[k],0),zerowinding)) - found = false; + inside(portion_forward,point(inners[k],0),zerowinding)) + found_forward = false; } } } - - if(!found) timeoffset=-2; - while(!found && timeoffset < -fuzz) { - timeoffset /= 2; + + bool found_backward = false; + real timeoffset_backward = -2; + path portion_backward; + while(!found_backward && timeoffset_backward < -fuzz) { + timeoffset_backward /= 2; if(countIntersections(allCurves,start, - point(outer,endtime+timeoffset))==2) + point(outer,endtime+timeoffset_backward))==2) { - portion = subpath(outer,endtime+timeoffset,endtime)--start--cycle; - found = true; + portion_backward = subpath(outer,endtime+timeoffset_backward,endtime)--start--cycle; + found_backward = true; // check if an inner curve is inside the portion - for(int k = 0; found && k < inners.length; ++k) + for(int k = 0; found_backward && k < inners.length; ++k) { if(k!=curveIndex && - inside(portion,point(inners[k],0),zerowinding)) - found = false; + inside(portion_backward,point(inners[k],0),zerowinding)) + found_backward = false; } } } - assert(found); + assert(found_forward || found_backward); + real timeoffset; + path portion; + if(found_forward && !found_backward) + { + timeoffset = timeoffset_forward; + portion = portion_forward; + } + else if(found_backward && !found_forward) + { + timeoffset = timeoffset_backward; + portion = portion_backward; + } + else // assert handles case of neither found + { + if(timeoffset_forward > -timeoffset_backward) + { + timeoffset = timeoffset_forward; + portion = portion_forward; + } + else + { + timeoffset = timeoffset_backward; + portion = portion_backward; + } + } + endtime=min(endtime,endtime+timeoffset); + // or go from timeoffset+timeoffset_backward to timeoffset+timeoffset_forward? timeoffset=abs(timeoffset); // depends on the curves having opposite orientations diff --git a/Build/source/utils/asymptote/base/binarytree.asy b/Build/source/utils/asymptote/base/binarytree.asy index 0a80aec4b66..31e0e3aab61 100644 --- a/Build/source/utils/asymptote/base/binarytree.asy +++ b/Build/source/utils/asymptote/base/binarytree.asy @@ -1,17 +1,21 @@ /* ********************************************************************** * binarytree: An Asymptote module to draw binary trees * * * - * Copyright (C) 2006 * + * Copyright(C) 2006 * * Tobias Langner tobias[at]langner[dot]nightlabs[dot]de * * * * Modified by John Bowman * * * + * Condensed mode: * + * Copyright(C) 2012 * + * Gerasimos Dimitriadis dimeg [at] intracom [dot] gr * + * * ************************************************************************ * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * - * version 3 of the License, or (at your option) any later version. * + * version 3 of the License, or(at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -25,51 +29,105 @@ * Boston, MA 02110-1301 USA * * * * Or get it online: * - * http://www.gnu.org/copyleft/lesser.html * + * http: //www.gnu.org/copyleft/lesser.html * * * ***********************************************************************/ -/** - * default values - */ +// default values real minDistDefault=0.2cm; real nodeMarginDefault=0.1cm; -/** - * structure to represent nodes in a binary tree - */ +// structure to represent nodes in a binary tree struct binarytreeNode { int key; binarytreeNode left; binarytreeNode right; binarytreeNode parent; - - /** - * sets the left child of this node - */ + bool spans_calculated=false; + int left_span,total_left_span; + int right_span,total_right_span; + void update_spans(); + + // Get the horizontal span of the tree consisting of the current + // node plus the whole subtree that is rooted at the right child + // (condensed mode) + int getTotalRightSpan() { + if(spans_calculated == false) { + update_spans(); + } + + return total_right_span; + } + + // Get the horizontal span of the tree consisting of the current + // node plus the whole subtree that is rooted at the left child + // (condensed mode) + int getTotalLeftSpan() { + if(spans_calculated == false) { + update_spans(); + } + return total_left_span; + } + + // Get the horizontal distance between this node and its right child + // (condensed mode) + int getRightSpan() { + if(spans_calculated == false) { + update_spans(); + } + return right_span; + } + + // Get the horizontal distance between this node and its left child + // (condensed mode) + int getLeftSpan() { + if(spans_calculated == false) { + update_spans(); + } + return left_span; + } + + // Update all span figures for this node. + // condensed mode) + update_spans=new void() { + if(spans_calculated == true) + return; + + left_span=0; + total_left_span=0; + right_span=0; + total_right_span=0; + + if(left != null) { + left_span=left.getTotalRightSpan()+1; + total_left_span=left_span+left.getTotalLeftSpan(); + } + + if(right != null) { + right_span=right.getTotalLeftSpan()+1; + total_right_span=right_span+right.getTotalRightSpan(); + } + spans_calculated=true; + }; + + // set the left child of this node void setLeft(binarytreeNode left) { this.left=left; this.left.parent=this; } - /** - * sets the right child of this node - */ + // set the right child of this node void setRight(binarytreeNode right) { this.right=right; this.right.parent=this; } - /** - * returns a boolean indicating whether this node is the root - */ + // return a boolean indicating whether this node is the root bool isRoot() { return parent == null; } - /** - * Returns the level of the subtree rooted at this node. - */ + // return the level of the subtree rooted at this node. int getLevel() { if(isRoot()) return 1; @@ -77,26 +135,20 @@ struct binarytreeNode { return parent.getLevel()+1; } - /** - * sets the children of this binarytreeNode - */ + // set the children of this binarytreeNode void setChildren(binarytreeNode left, binarytreeNode right) { setLeft(left); setRight(right); } - /** - * creates a new binarytreeNode with key <key> - */ + // create a new binarytreeNode with key <key> static binarytreeNode binarytreeNode(int key) { binarytreeNode toReturn=new binarytreeNode; toReturn.key=key; return toReturn; } - /** - * returns the height of the subtree rooted at this node. - */ + // returns the height of the subtree rooted at this node. int getHeight() { if(left == null && right == null) return 1; @@ -111,43 +163,46 @@ struct binarytreeNode { binarytreeNode operator init() {return null;} -/** - * "constructor" for binarytreeNode - */ +// "constructor" for binarytreeNode binarytreeNode binarytreeNode(int key)=binarytreeNode.binarytreeNode; - -/** - * draws the tree rooted at the given <node> at the given position <pos>, with - * <height>: the height of the containing tree, - * <minDist>: the minimal horizontal distance of two nodes at the lowest level, - * <levelDist> the vertical distance between two levels, - * <nodeDiameter>: the diameter of one node. - */ +// draw the tree rooted at the given <node> at the given position <pos>, with +// <height>=the height of the containing tree, +// <minDist>=the minimal horizontal distance of two nodes at the lowest level, +// <levelDist>=the vertical distance between two levels, +// <nodeDiameter>=the diameter of one node. object draw(picture pic=currentpicture, binarytreeNode node, pair pos, int height, real minDist, real levelDist, real nodeDiameter, - pen p=currentpen) { + pen p=currentpen, bool condensed=false) { Label label=Label(math((string) node.key),pos); binarytreeNode left=node.left; binarytreeNode right=node.right; - /** - * returns the distance for two nodes at the given <level> when the - * containing tree has height <height> - * and the minimal distance between two nodes is <minDist>. - */ + // return the distance for two nodes at the given <level> when the + // containing tree has height <height> + // and the minimal distance between two nodes is <minDist> . real getDistance(int level, int height, real minDist) { return(nodeDiameter+minDist)*2^(height-level); } + // return the horiontal distance between node <n> and its left child + // (condensed mode) + real getLeftDistance(binarytreeNode n) { + return(nodeDiameter+minDist) *(real)n.getLeftSpan() * 0.5; + } + + // return the horiontal distance between node <n> and its right child + // (condensed mode) + real getRightDistance(binarytreeNode n) { + return(nodeDiameter+minDist) *(real)n.getRightSpan() * 0.5; + } + real dist=getDistance(node.getLevel(),height,minDist)/2; - /** - * draws the connection between the two nodes at the given positions - * by calculating the connection points - * and then drawing the corresponding arrow. - */ + // draw the connection between the two nodes at the given positions + // by calculating the connection points and drawing the corresponding + // arrow. void deferredDrawNodeConnection(pair parentPos, pair childPos) { pic.add(new void(frame f, transform t) { pair start,end; @@ -161,14 +216,26 @@ object draw(picture pic=currentpicture, binarytreeNode node, pair pos, } if(left != null) { - pair childPos=pos-(0,levelDist)-(dist/2,0); - draw(pic,left,childPos,height,minDist,levelDist,nodeDiameter,p); + pair childPos; + if(condensed == false) { + childPos=pos-(0,levelDist)-(dist/2,0); + } + else { + childPos=pos-(0,levelDist)-((real)getLeftDistance(node),0); + } + draw(pic,left,childPos,height,minDist,levelDist,nodeDiameter,p,condensed); deferredDrawNodeConnection(pos,childPos); } if(right != null) { - pair childPos=pos-(0,levelDist)+(dist/2,0); - draw(pic,right,childPos,height,minDist,levelDist,nodeDiameter,p); + pair childPos; + if(condensed == false) { + childPos=pos-(0,levelDist)+(dist/2,0); + } + else { + childPos=pos-(0,levelDist)+((real)getRightDistance(node),0); + } + draw(pic,right,childPos,height,minDist,levelDist,nodeDiameter,p,condensed); deferredDrawNodeConnection(pos,childPos); } @@ -199,16 +266,13 @@ int[] operator cast(key[] k) { key nil=key(0,false); -/** - * structure to represent a binary tree. - */ +// structure to represent a binary tree. struct binarytree { binarytreeNode root; int[] keys; - /** - * adds the given < key > to the tree by searching for its place and inserting it there. - */ + // add the given <key> to the tree by searching for its place and + // inserting it there. void addKey(int key) { binarytreeNode newNode=binarytreeNode(key); @@ -240,9 +304,7 @@ struct binarytree { } } - /** - * returns the height of the tree - */ + // return the height of the tree int getHeight() { if(root == null) return 0; @@ -250,9 +312,7 @@ struct binarytree { return root.getHeight(); } - /** - * adds all given keys to the tree sequentially - */ + // add all given keys to the tree sequentially void addSearchKeys(int[] keys) { for(int i=0; i < keys.length; ++i) { int key=keys[i]; @@ -283,9 +343,7 @@ struct binarytree { } - /** - * returns all key in the tree - */ + // return all key in the tree int[] getKeys() { return keys; } @@ -305,12 +363,10 @@ binarytree binarytree(...key[] keys) return bt; } -/** - * draws the given binary tree. - */ +// draw the given binary tree. void draw(picture pic=currentpicture, binarytree tree, real minDist=minDistDefault, real nodeMargin=nodeMarginDefault, - pen p=currentpen) + pen p=currentpen, bool condensed=false) { int[] keys=tree.getKeys(); @@ -322,5 +378,6 @@ void draw(picture pic=currentpicture, binarytree tree, real nodeDiameter=abs(max(f)-min(f))+2*nodeMargin; real levelDist=nodeDiameter*1.8; - draw(pic,tree.root,(0,0),tree.getHeight(),minDist,levelDist,nodeDiameter,p); + draw(pic,tree.root,(0,0),tree.getHeight(),minDist,levelDist,nodeDiameter,p, + condensed); } diff --git a/Build/source/utils/asymptote/base/embed.asy b/Build/source/utils/asymptote/base/embed.asy index 165de0b7534..8f982332d86 100644 --- a/Build/source/utils/asymptote/base/embed.asy +++ b/Build/source/utils/asymptote/base/embed.asy @@ -1,38 +1,36 @@ if(latex()) { usepackage("hyperref"); texpreamble("\hypersetup{"+settings.hyperrefOptions+"}"); - texpreamble(" -\ifx\pdfhorigin\undefined% -\usepackage[3D,dvipdfmx]{movie15} -\else% -\usepackage[3D]{movie15} -\fi% -\FPmessagesfalse% -"); + usepackage("media9","bigfiles"); } -// See http://www.ctan.org/tex-archive/macros/latex/contrib/movie15/README +// See http://www.ctan.org/tex-archive/macros/latex/contrib/media9/doc/media9.pdf // for documentation of the options. -// Embed object in pdf file -string embed(string name, string options="", real width=0, real height=0) +// Embed PRC or SWF content in pdf file +string embedplayer(string name, string text="", string options="", + real width=0, real height=0) { - if(options != "") options="["+options+"]{"; - if(width != 0) options += (string) (width/pt)+"pt"; - options += "}{"; - if(height != 0) options += (string) (height/pt)+"pt"; - return "\includemovie"+options+"}{"+name+"}"; + if(width != 0) options += ",width="+(string) (width/pt)+"pt"; + if(height != 0) options += ",height="+(string) (height/pt)+"pt"; + return "\includemedia["+options+"]{"+text+"}{"+name+"}"; } -string hyperlink(string url, string text) +// Embed media in pdf file +string embed(string name, string text="", string options="", + real width=0, real height=0) { - return "\href{"+url+"}{"+text+"}"; + return embedplayer("VPlayer.swf",text,"label="+name+ + ",activate=pageopen,addresource="+name+ + ",flashvars={source="+name+"&scaleMode=letterbox},"+ + options,width,height); } -string link(string label, string text, string options="") +string link(string label, string text="Play") { - // Run LaTeX twice to resolve references. - settings.twice=true; - if(options != "") options="["+options+"]"; - return "\movieref"+options+"{"+label+"}{"+text+"}"; + return "\PushButton[ + onclick={ + annotRM['"+label+"'].activated=true; + annotRM['"+label+"'].callAS('playPause'); + }]{\fbox{"+text+"}}"; } diff --git a/Build/source/utils/asymptote/base/external.asy b/Build/source/utils/asymptote/base/external.asy index 053f1eff4c1..f9ab5365aea 100644 --- a/Build/source/utils/asymptote/base/external.asy +++ b/Build/source/utils/asymptote/base/external.asy @@ -3,10 +3,10 @@ texpreamble("\hypersetup{"+settings.hyperrefOptions+"}"); // Embed object to be run in an external window. An image file name can be // specified; if not given one will be automatically generated. -string embed(string name, string options="", real width=0, real height=0, - string image="") +string embed(string name, string text="", string options="", + real width=0, real height=0, string image="") { - string options; // Ignore movie15 options. + string options; // Ignore passed options. if(image == "") { image=stripdirectory(stripextension(name))+"."+nativeformat(); convert(name+"[0]",image,nativeformat()); @@ -30,8 +30,8 @@ string hyperlink(string url, string text) return "\href{"+url+"}{"+text+"}"; } -string link(string url, string text, string options="") +string link(string label, string text="Play") { - return hyperlink("run:"+url,text); + return hyperlink("run:"+label,text); } diff --git a/Build/source/utils/asymptote/base/graph.asy b/Build/source/utils/asymptote/base/graph.asy index cbcea4aeae3..410c59cf13a 100644 --- a/Build/source/utils/asymptote/base/graph.asy +++ b/Build/source/utils/asymptote/base/graph.asy @@ -1451,9 +1451,9 @@ void autoscale(picture pic=currentpicture, axis axis) if(pic.scale.x.scale.logarithmic && floor(pic.userMin().x) == floor(pic.userMax().x)) { if(pic.scale.x.automin()) - pic.userMinx(floor(pic.userMin().x)); + pic.userMinx2(floor(pic.userMin().x)); if(pic.scale.x.automax()) - pic.userMaxx(ceil(pic.userMax().x)); + pic.userMaxx2(ceil(pic.userMax().x)); } } else {mx.min=mx.max=0; pic.scale.set=false;} @@ -1462,9 +1462,9 @@ void autoscale(picture pic=currentpicture, axis axis) if(pic.scale.y.scale.logarithmic && floor(pic.userMin().y) == floor(pic.userMax().y)) { if(pic.scale.y.automin()) - pic.userMiny(floor(pic.userMin().y)); + pic.userMiny2(floor(pic.userMin().y)); if(pic.scale.y.automax()) - pic.userMaxy(ceil(pic.userMax().y)); + pic.userMaxy2(ceil(pic.userMax().y)); } } else {my.min=my.max=0; pic.scale.set=false;} @@ -1611,12 +1611,13 @@ void yaxis(picture pic=currentpicture, Label L="", axis axis=XZero, // Draw x and y axes. void axes(picture pic=currentpicture, Label xlabel="", Label ylabel="", + bool extend=true, pair min=(-infinity,-infinity), pair max=(infinity,infinity), pen p=currentpen, arrowbar arrow=None, margin margin=NoMargin, bool above=false) { - xaxis(pic,xlabel,min.x,max.x,p,arrow,margin,above); - yaxis(pic,ylabel,min.y,max.y,p,arrow,margin,above); + xaxis(pic,xlabel,YZero(extend),min.x,max.x,p,arrow,margin,above); + yaxis(pic,ylabel,XZero(extend),min.y,max.y,p,arrow,margin,above); } // Draw a yaxis at x. @@ -1788,6 +1789,7 @@ picture secondaryX(picture primary=currentpicture, void f(picture)) { if(!primary.scale.set) abort(noprimary); picture pic; + size(pic,primary); if(primary.userMax().x == primary.userMin().x) return pic; f(pic); if(!pic.userSetx()) return pic; @@ -1817,6 +1819,7 @@ picture secondaryY(picture primary=currentpicture, void f(picture)) { if(!primary.scale.set) abort(noprimary); picture pic; + size(pic,primary); if(primary.userMax().y == primary.userMin().y) return pic; f(pic); if(!pic.userSety()) return pic; diff --git a/Build/source/utils/asymptote/base/graph3.asy b/Build/source/utils/asymptote/base/graph3.asy index 91e5194bea9..fd7871e1547 100644 --- a/Build/source/utils/asymptote/base/graph3.asy +++ b/Build/source/utils/asymptote/base/graph3.asy @@ -931,9 +931,9 @@ void autoscale3(picture pic=currentpicture, axis axis) if(pic.scale.z.scale.logarithmic && floor(pic.userMin().z) == floor(pic.userMax().z)) { if(pic.scale.z.automin()) - pic.userMinz(floor(pic.userMin().z)); + pic.userMinz3(floor(pic.userMin().z)); if(pic.scale.z.automax()) - pic.userMaxz(ceil(pic.userMax().z)); + pic.userMaxz3(ceil(pic.userMax().z)); } } else {mz.min=mz.max=0; pic.scale.set=false;} @@ -1199,13 +1199,14 @@ void limits(picture pic=currentpicture, triple min, triple max) // Draw x, y and z axes. void axes3(picture pic=currentpicture, Label xlabel="", Label ylabel="", Label zlabel="", + bool extend=false, triple min=(-infinity,-infinity,-infinity), triple max=(infinity,infinity,infinity), pen p=currentpen, arrowbar3 arrow=None, margin3 margin=NoMargin3) { - xaxis3(pic,xlabel,min.x,max.x,p,arrow,margin); - yaxis3(pic,ylabel,min.y,max.y,p,arrow,margin); - zaxis3(pic,zlabel,min.z,max.z,p,arrow,margin); + xaxis3(pic,xlabel,YZZero(extend),min.x,max.x,p,arrow,margin); + yaxis3(pic,ylabel,XZZero(extend),min.y,max.y,p,arrow,margin); + zaxis3(pic,zlabel,XYZero(extend),min.z,max.z,p,arrow,margin); } triple Scale(picture pic=currentpicture, triple v) @@ -1884,7 +1885,8 @@ void draw(picture pic=currentpicture, Label[] L=new Label[], interaction interaction=LabelInteraction()) { pen thin=is3D() ? thin() : defaultpen; - if(g.length > 1) + bool group=g.length > 1 && (name != "" || render.defaultnames); + if(group) begingroup3(pic,name == "" ? "contours" : name,render); for(int cnt=0; cnt < g.length; ++cnt) { guide3[] gcnt=g[cnt]; @@ -1899,7 +1901,7 @@ void draw(picture pic=currentpicture, Label[] L=new Label[], } } } - if(g.length > 1) + if(group) endgroup3(pic); } @@ -1945,7 +1947,9 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b, scale=max > 0 ? maxlength/max : 1; } else scale=1; - begingroup3(pic,name == "" ? "vectorfield" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(pic,name == "" ? "vectorfield" : name,render); for(int i=0; i <= nu; ++i) { real x=interp(a.x,b.x,i*du); for(int j=0; j <= nv; ++j) { @@ -1962,7 +1966,8 @@ picture vectorfield(path3 vector(pair v), triple f(pair z), pair a, pair b, } } } - endgroup3(pic); + if(group) + endgroup3(pic); return pic; } diff --git a/Build/source/utils/asymptote/base/palette.asy b/Build/source/utils/asymptote/base/palette.asy index b1d1985a323..62ca83f1c9a 100644 --- a/Build/source/utils/asymptote/base/palette.asy +++ b/Build/source/utils/asymptote/base/palette.asy @@ -92,11 +92,18 @@ bounds image(picture pic=currentpicture, real[][] f, range range=Full, initial=Scale(pic,initial); final=Scale(pic,final); - transform T=transpose ? swap : identity(); + pic.addBox(initial,final); + + transform T; + if(transpose) { + T=swap; + initial=T*initial; + final=T*final; + } + pic.add(new void(frame F, transform t) { - _image(F,f,T*initial,T*final,palette,t*T,copy=false,antialias=antialias); + _image(F,f,initial,final,palette,t*T,copy=false,antialias=antialias); },true); - pic.addBox(initial,final); return bounds; // Return bounds used for color space } @@ -131,11 +138,18 @@ void image(picture pic=currentpicture, pen[][] data, pair initial, pair final, initial=Scale(pic,initial); final=Scale(pic,final); - transform T=transpose ? swap : identity(); + pic.addBox(initial,final); + + transform T; + if(transpose) { + T=swap; + initial=T*initial; + final=T*final; + } + pic.add(new void(frame F, transform t) { - _image(F,data,T*initial,T*final,t*T,copy=false,antialias=antialias); + _image(F,data,initial,final,t*T,copy=false,antialias=antialias); },true); - pic.addBox(initial,final); } void image(picture pic=currentpicture, pen f(int, int), int width, int height, @@ -146,11 +160,21 @@ void image(picture pic=currentpicture, pen f(int, int), int width, int height, initial=Scale(pic,initial); final=Scale(pic,final); - transform T=transpose ? swap : identity(); + pic.addBox(initial,final); + + transform T; + if(transpose) { + T=swap; + int temp=width; + width=height; + height=temp; + initial=T*initial; + final=T*final; + } + pic.add(new void(frame F, transform t) { - _image(F,f,width,height,T*initial,T*final,t*T,antialias=antialias); + _image(F,f,width,height,initial,final,t*T,antialias=antialias); },true); - pic.addBox(initial,final); } bounds image(picture pic=currentpicture, pair[] z, real[] f, @@ -291,9 +315,19 @@ void palette(picture pic=currentpicture, Label L="", bounds bounds, } real[][] pdata={sequence(palette.length)}; - transform T=vertical ? swap : identity(); + transform T; + pair Tinitial,Tfinal; + if(vertical) { + T=swap; + Tinitial=T*initial; + Tfinal=T*final; + } else { + Tinitial=initial; + Tfinal=final; + } + pic.add(new void(frame f, transform t) { - _image(f,pdata,T*initial,T*final,palette,t*T,copy=false, + _image(f,pdata,Tinitial,Tfinal,palette,t*T,copy=false, antialias=antialias); },true); diff --git a/Build/source/utils/asymptote/base/plain.asy b/Build/source/utils/asymptote/base/plain.asy index e06bc66543c..14715bad918 100644 --- a/Build/source/utils/asymptote/base/plain.asy +++ b/Build/source/utils/asymptote/base/plain.asy @@ -39,8 +39,6 @@ include plain_markers; include plain_arrows; include plain_debugger; -pair viewportmargin=(0,0); // Horizontal and vertical 3D viewport margins. - typedef void exitfcn(); bool needshipout() { diff --git a/Build/source/utils/asymptote/base/plain_Label.asy b/Build/source/utils/asymptote/base/plain_Label.asy index a559ae88298..1e424ab1c0a 100644 --- a/Build/source/utils/asymptote/base/plain_Label.asy +++ b/Build/source/utils/asymptote/base/plain_Label.asy @@ -212,6 +212,9 @@ embed Rotate(pair z) { warn=false));}; } +path[] texpath(string s, pen p, bool tex=settings.tex != "none", + bool bbox=false); + struct Label { string s,size; position position; @@ -289,8 +292,11 @@ struct Label { void label(frame f, transform t=identity(), pair position, pair align) { pen p0=p == nullpen ? currentpen : p; align=length(align)*unit(rotation(t)*align); - label(f,s,size,embed(t)*shiftless(T), - t*position+align*labelmargin(p0)+shift(T)*0,align,p0); + pair S=t*position+align*labelmargin(p0)+shift(T)*0; + if(settings.tex != "none") + label(f,s,size,embed(t)*shiftless(T),S,align,p0); + else + fill(f,align(texpath(s,p0),S,align,p0),p0); } void out(frame f, transform t=identity(), pair position=position.position, @@ -352,8 +358,10 @@ struct Label { if(p != nullpen) write(file,", pen=",p); if(!defaulttransform) write(file,", transform=",T); - if(!defaulttransform3) + if(!defaulttransform3) { + write(file,", transform3=",endl); write(file,T3); + } write(file,"",suffix); } @@ -579,7 +587,7 @@ path[] texpath(Label L, bool tex=settings.tex != "none", bool bbox=false) void operator init(Label L) { - s=L.s; + s=replace(L.s,'\n',' '); fontsize=fontsize(L.p); font=font(L.p); } @@ -667,3 +675,8 @@ path[] texpath(Label L, bool tex=settings.tex != "none", bool bbox=false) return transform(pathcache[search(stringcache,stringfont(L),lexorder)],L); } + +texpath=new path[](string s, pen p, bool tex=settings.tex != "none", bool bbox=false) +{ + return texpath(Label(s,p)); +}; diff --git a/Build/source/utils/asymptote/base/plain_arrows.asy b/Build/source/utils/asymptote/base/plain_arrows.asy index 59b65aa4126..3ae60938ed1 100644 --- a/Build/source/utils/asymptote/base/plain_arrows.asy +++ b/Build/source/utils/asymptote/base/plain_arrows.asy @@ -40,8 +40,8 @@ real[] arrowbasepoints(path base, path left, path right) { real[][] Tl=transpose(intersections(left,base)); real[][] Tr=transpose(intersections(right,base)); - return new real[] {Tl.length > 0 ? Tl[0][0] : 1, - Tr.length > 0 ? Tr[0][0] : 1}; + return new real[] {Tl.length > 0 ? Tl[0][0] : 0, + Tr.length > 0 ? Tr[0][0] : 0}; } path arrowbase(path r, pair y, real t, real size) @@ -67,7 +67,7 @@ DefaultHead.head=new path(path g, position position=EndPoint, pen p=currentpen, real[] T=arrowbasepoints(base,left,right); pair denom=point(right,T[1])-y; real factor=denom != 0 ? length((point(left,T[0])-y)/denom) : 1; - path left=rotate(-angle,x)*r; + path left=rotate(-angle*factor,x)*r; path right=rotate(angle*factor,x)*r; real[] T=arrowbasepoints(base,left,right); return subpath(left,0,T[0])--subpath(right,T[1],0)&cycle; @@ -90,7 +90,7 @@ SimpleHead.head=new path(path g, position position=EndPoint, pen p=currentpen, real[] T=arrowbasepoints(base,left,right); pair denom=point(right,T[1])-y; real factor=denom != 0 ? length((point(left,T[0])-y)/denom) : 1; - path left=rotate(-angle,x)*r; + path left=rotate(-angle*factor,x)*r; path right=rotate(angle*factor,x)*r; real[] T=arrowbasepoints(base,left,right); return subpath(left,T[0],0)--subpath(right,0,T[1]); @@ -117,7 +117,7 @@ arrowhead HookHead(real dir=arrowdir, real barb=arrowbarb) real[] T=arrowbasepoints(base,left,right); pair denom=point(right,T[1])-y; real factor=denom != 0 ? length((point(left,T[0])-y)/denom) : 1; - path left=rotate(-angle,x)*r; + path left=rotate(-angle*factor,x)*r; path right=rotate(angle*factor,x)*r; real[] T=arrowbasepoints(base,left,right); left=subpath(left,0,T[0]); diff --git a/Build/source/utils/asymptote/base/plain_bounds.asy b/Build/source/utils/asymptote/base/plain_bounds.asy index 871d82f01b5..b74a6ceee6a 100644 --- a/Build/source/utils/asymptote/base/plain_bounds.asy +++ b/Build/source/utils/asymptote/base/plain_bounds.asy @@ -1,6 +1,6 @@ include plain_scaling; -// After an transformation, produce new coordinate bounds. For paths that +// After a transformation, produce new coordinate bounds. For paths that // have been added, this is only an approximation since it takes the bounds of // their transformed bounding box. private void addTransformedCoords(coords2 dest, transform t, @@ -466,8 +466,9 @@ private struct freezableBounds { acc.pushUserCoords(min, max); if (pathBounds.length > 0) acc.push(min(pathBounds), max(pathBounds)); - for (var pp : pathpenBounds) - acc.push(min(pp.g), max(pp.g)); + for (var pp : pathpenBounds) + if(size(pp.g) > 0) + acc.push(min(pp.g), max(pp.g)); for (var link : links) link.accumulateUserBounds(acc); diff --git a/Build/source/utils/asymptote/base/plain_paths.asy b/Build/source/utils/asymptote/base/plain_paths.asy index c768922ffd1..dad0d13be8e 100644 --- a/Build/source/utils/asymptote/base/plain_paths.asy +++ b/Build/source/utils/asymptote/base/plain_paths.asy @@ -115,26 +115,6 @@ void write(string s="", explicit guide[] x, suffix suffix=endl) write(stdout,s,x,suffix); } -private string nopoints="nullpath has no points"; - -pair min(explicit path[] p) -{ - if(p.length == 0) abort(nopoints); - pair minp=min(p[0]); - for(int i=1; i < p.length; ++i) - minp=minbound(minp,min(p[i])); - return minp; -} - -pair max(explicit path[] p) -{ - if(p.length == 0) abort(nopoints); - pair maxp=max(p[0]); - for(int i=1; i < p.length; ++i) - maxp=maxbound(maxp,max(p[i])); - return maxp; -} - interpolate operator ..(tensionSpecifier t) { return new guide(... guide[] a) { diff --git a/Build/source/utils/asymptote/base/plain_prethree.asy b/Build/source/utils/asymptote/base/plain_prethree.asy index 595bac2fad4..cfc0c3c7411 100644 --- a/Build/source/utils/asymptote/base/plain_prethree.asy +++ b/Build/source/utils/asymptote/base/plain_prethree.asy @@ -1,5 +1,7 @@ // Critical definitions for transform3 needed by projection and picture. +pair viewportmargin=(0.1,0.1); // Horizontal and vertical 3D viewport margins. + typedef real[][] transform3; restricted transform3 identity4=identity(4); diff --git a/Build/source/utils/asymptote/base/plain_shipout.asy b/Build/source/utils/asymptote/base/plain_shipout.asy index ccf94e6c9fd..9b30e6e1947 100644 --- a/Build/source/utils/asymptote/base/plain_shipout.asy +++ b/Build/source/utils/asymptote/base/plain_shipout.asy @@ -27,8 +27,8 @@ orientation orientation=Portrait; // Forward references to functions defined in module three. 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=""); +string Embed(string name, string text="", string options="", real width=0, + real height=0); bool prc0(string format="") { diff --git a/Build/source/utils/asymptote/base/plain_strings.asy b/Build/source/utils/asymptote/base/plain_strings.asy index a466159d9c7..f4c856e8ad9 100644 --- a/Build/source/utils/asymptote/base/plain_strings.asy +++ b/Build/source/utils/asymptote/base/plain_strings.asy @@ -84,7 +84,8 @@ string verbatim(string s) } // Split a string into an array of substrings delimited by delimiter -// If delimiter is an empty string, use space delimiter, discarding duplicates. +// If delimiter is an empty string, use space delimiter but discard empty +// substrings. string[] split(string s, string delimiter="") { bool prune=false; @@ -99,11 +100,9 @@ string[] split(string s, string delimiter="") int N=length(delimiter); int n=length(s); while((i=find(s,delimiter,last)) >= 0) { - if(i >= last) + if(i > last || (i == last && !prune)) S.push(substr(s,last,i-last)); last=i+N; - if(prune) - while(substr(s,last,1) == " ") ++last; } if(n > last || (n == last && !prune)) S.push(substr(s,last,n-last)); @@ -143,7 +142,7 @@ string italic(string s) string baseline(string s, string template="\strut") { - return s != "" ? "\vphantom{"+template+"}"+s : s; + return s != "" && settings.tex != "none" ? "\vphantom{"+template+"}"+s : s; } string math(string s) @@ -221,7 +220,7 @@ string format(real x, string locale="") string phantom(string s) { - return "\phantom{"+s+"}"; + return settings.tex != "none" ? "\phantom{"+s+"}" : ""; } restricted int ocgindex=0; diff --git a/Build/source/utils/asymptote/base/solids.asy b/Build/source/utils/asymptote/base/solids.asy index e6613fc29c5..09bccd32aa9 100644 --- a/Build/source/utils/asymptote/base/solids.asy +++ b/Build/source/utils/asymptote/base/solids.asy @@ -351,7 +351,9 @@ void draw(picture pic=currentpicture, revolution r, int m=0, int n=nslice, } } - begingroup3(pic,name == "" ? "skeleton" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(pic,name == "" ? "skeleton" : name,render); pic.add(new void(frame f, transform3 t, picture pic, projection P) { drawskeleton(f,t,P); if(pic != null) @@ -360,7 +362,8 @@ void draw(picture pic=currentpicture, revolution r, int m=0, int n=nslice, frame f; drawskeleton(f,identity4,P); pic.addBox(min3(f),max3(f)); - endgroup3(pic); + if(group) + endgroup3(pic); } else { skeleton s=r.skeleton(m,n,P); if(frontpen != nullpen) { diff --git a/Build/source/utils/asymptote/base/three.asy b/Build/source/utils/asymptote/base/three.asy index 5d7ae1a8ba5..ceb8cf89574 100644 --- a/Build/source/utils/asymptote/base/three.asy +++ b/Build/source/utils/asymptote/base/three.asy @@ -6,8 +6,7 @@ if(prc0()) { if(settings.tex == "context") settings.prc=false; else { access embed; - Embed=embed.embed; - Link=embed.link; + Embed=embed.embedplayer; } } @@ -40,6 +39,9 @@ struct render real tubegranularity; // granularity for rendering tubes bool labelfill; // fill subdivision cracks in unlighted labels + bool partnames; // assign part name indices to compound objects + bool defaultnames; // assign default names to unnamed objects + static render defaultrender; void operator init(real compression=defaultrender.compression, @@ -50,7 +52,9 @@ struct render int sphere=defaultrender.sphere, real margin=defaultrender.margin, real tubegranularity=defaultrender.tubegranularity, - bool labelfill=defaultrender.labelfill) + bool labelfill=defaultrender.labelfill, + bool partnames=defaultrender.partnames, + bool defaultnames=defaultrender.defaultnames) { this.compression=compression; this.granularity=granularity; @@ -61,6 +65,8 @@ struct render this.margin=margin; this.tubegranularity=tubegranularity; this.labelfill=labelfill; + this.partnames=partnames; + this.defaultnames=defaultnames; } } @@ -76,19 +82,21 @@ defaultrender.margin=0.02; defaultrender.tubegranularity=0.005; defaultrender.sphere=NURBSsphere; defaultrender.labelfill=true; +defaultrender.partnames=false; +defaultrender.defaultnames=true; real defaultshininess=0.25; real angleprecision=1e-5; // Precision for centering perspective projections. int maxangleiterations=25; -string defaultembed3Doptions; +string defaultembed3Doptions="3Dmenu"; string defaultembed3Dscript; real defaulteyetoview=63mm/1000mm; -string partname(int i=0) +string partname(int i, render render=defaultrender) { - return string(i+1); + return render.partnames ? string(i+1) : ""; } triple O=(0,0,0); @@ -2027,7 +2035,7 @@ path3 arc(triple c, triple v1, triple v2, triple normal=O, bool direction=CCW) real t2=t2[0]; int n=length(unitcircle3); if(direction) { - if (t1 >= t2) t1 -= n; + if(t1 >= t2) t1 -= n; } else if(t2 >= t1) t2 -= n; path3 p=subpath(unitcircle3,t1,t2); @@ -2223,7 +2231,7 @@ draw=new void(frame f, path3 g, material p=currentpen, transform3 tL=shift(gL)*align(dirL); transform3 tc0=shift(c0)*align(-dirc0); transform3 tcL=shift(cL)*align(dircL); - if(linecap == 0 || linecap == 2){ + if(linecap == 0 || linecap == 2) { transform3 scale2r=scale(r,r,1); T.s.append(t0*scale2r*unitdisk); disk(tc0*scale2r); @@ -2251,7 +2259,8 @@ draw=new void(frame f, path3 g, material p=currentpen, } else _draw(f,g,q); } else _draw(f,g,q); } - if(q != nullpen) + bool group=q != nullpen && (name != "" || render.defaultnames); + if(group) begingroup3(f,name == "" ? "curve" : name,render); if(linetype(q).length == 0) drawthick(g); else { @@ -2273,7 +2282,7 @@ draw=new void(frame f, path3 g, material p=currentpen, } } } - if(q != nullpen) + if(group) endgroup3(f); } else draw(f,project(g,P),q); }; @@ -2282,11 +2291,12 @@ void draw(frame f, explicit path3[] g, material p=currentpen, light light=nolight, string name="", render render=defaultrender, projection P=currentprojection) { - if(g.length > 1) - begingroup3(f,name == "" ? "curve" : name,render); + bool group=g.length > 1 && (name != "" || render.defaultnames); + if(group) + begingroup3(f,name == "" ? "curves" : name,render); for(int i=0; i < g.length; ++i) - draw(f,g[i],p,light,partname(i),render,P); - if(g.length > 1) + draw(f,g[i],p,light,partname(i,render),render,P); + if(group) endgroup3(f); } @@ -2294,12 +2304,13 @@ void draw(picture pic=currentpicture, explicit path3[] g, material p=currentpen, margin3 margin=NoMargin3, light light=nolight, string name="", render render=defaultrender) { - if(g.length > 1) + bool group=g.length > 1 && (name != "" || render.defaultnames); + if(group) begingroup3(pic,name == "" ? "curves" : name,render); for(int i=0; i < g.length; ++i) - draw(pic,g[i],p,margin,light,partname(i),render); - if(g.length > 1) - endgroup3(pic); + draw(pic,g[i],p,margin,light,partname(i,render),render); + if(group) + endgroup3(pic); } include three_arrows; @@ -2444,12 +2455,6 @@ void add(picture dest=currentpicture, object src, pair position=0, pair align=0, plain.add(dest,src,position,align,group,filltype,above); } -string cameralink(string label, string text="View Parameters") -{ - if(!prc() || Link == null) return ""; - return Link(label,text,"3Dgetview"); -} - private struct viewpoint { triple target,camera,up; real angle; @@ -2498,13 +2503,35 @@ projection perspective(string s) return P; } +projection absorthographic(triple camera=Z, triple target=O, real roll=0) +{ + triple u=unit(target-camera); + triple w=unit(Z-u.z*u); + triple up=rotate(roll,O,u)*w; + projection P= + projection(camera,up,target,1,0,false,false, + new transformation(triple camera, triple up, triple target) + {return transformation(look(camera,up,target));}); + P.absolute=true; + return P; +} + +projection absperspective(triple camera=Z, triple target=O, real roll=0, + real angle=30) +{ + triple u=unit(target-camera); + triple w=unit(Z-u.z*u); + triple up=rotate(roll,O,u)*w; + projection P=perspective(camera,up,target); + P.angle=angle; + P.absolute=true; + return P; +} + private string Format(real x) { - // Work around movie15.sty division by zero bug; - // e.g. u=unit((1e-10,1e-10,0.9)); - if(abs(x) < 1e-9) x=0; assert(abs(x) < 1e17,"Number too large: "+string(x)); - return format("%.18f",x,"C"); + return format("%.9f",x,"C"); } private string Format(triple v, string sep=" ") @@ -2522,116 +2549,13 @@ private string format(triple v, string sep=" ") return string(v.x)+sep+string(v.y)+sep+string(v.z); } -private string projection(bool infinity, real viewplanesize) -{ - return "activeCamera=scene.cameras.getByIndex(0); -function asyProjection() {"+ - (infinity ? "activeCamera.projectionType=activeCamera.TYPE_ORTHOGRAPHIC;" : - "activeCamera.projectionType=activeCamera.TYPE_PERSPECTIVE;")+" -activeCamera.viewPlaneSize="+string(viewplanesize)+"; -activeCamera.binding=activeCamera.BINDING_"+(infinity ? "MAX" : "VERTICAL")+"; -} - -asyProjection(); - -handler=new CameraEventHandler(); -runtime.addEventHandler(handler); -handler.onEvent=function(event) -{ - asyProjection(); - scene.update(); -}"; -} - -private string projection(bool infinity, real viewplanesize) +private string Format(transform3 t, string sep=" ") { - return "activeCamera=scene.cameras.getByIndex(0); -function asyProjection() {"+ - (infinity ? "activeCamera.projectionType=activeCamera.TYPE_ORTHOGRAPHIC;" : - "activeCamera.projectionType=activeCamera.TYPE_PERSPECTIVE;")+" -activeCamera.viewPlaneSize="+string(viewplanesize)+"; -activeCamera.binding=activeCamera.BINDING_"+(infinity ? "MAX" : "VERTICAL")+"; -} - -asyProjection(); - -handler=new CameraEventHandler(); -runtime.addEventHandler(handler); -handler.onEvent=function(event) -{ - asyProjection(); - scene.update(); -}"; -} - -private string billboard(int[] index, triple[] center) -{ - if(index.length == 0) return ""; - string s=" -var zero=new Vector3(0,0,0); -var nodes=scene.nodes; -var count=nodes.count; - -var index=new Array(); -for(i=0; i < count; i++) { - var node=nodes.getByIndex(i); - var name=node.name; - end=name.lastIndexOf(\".\")-1; - if(end > 0) { - if(name.substr(end,1) == \"\001\") { - start=name.lastIndexOf(\"-\")+1; - n=end-start; - if(n > 0) { - index[name.substr(start,n)]=i; - node.name=name.substr(0,start-1); - } - } - } -} - -var center=new Array( -"; - for(int i=0; i < center.length; ++i) - s += "Vector3("+format(center[i],",")+"), -"; - s += "); - -billboardHandler=new RenderEventHandler(); -billboardHandler.onEvent=function(event) -{ - var camera=scene.cameras.getByIndex(0); - var position=camera.position; - var direction=position.subtract(camera.targetPosition); - var up=camera.up.subtract(position); - - function f(i,k) { - j=index[i]; - if(j >= 0) { - var node=nodes.getByIndex(j); - var name=node.name; - var R=Matrix4x4(); - R.setView(zero,direction,up); - var c=center[k]; - var T=node.transform; - T.setIdentity(); - T.translateInPlace(c.scale(-1)); - T.multiplyInPlace(R); - T.translateInPlace(c); - } - } -"; - for(int i=0; i < index.length; ++i) - s += "f("+string(i)+","+string(index[i])+"); -"; - s += " - runtime.refresh(); -} - -runtime.addEventHandler(billboardHandler); - -runtime.refresh(); -"; - return s; + return + Format(t[0][0])+sep+Format(t[1][0])+sep+Format(t[2][0])+sep+ + Format(t[0][1])+sep+Format(t[1][1])+sep+Format(t[2][1])+sep+ + Format(t[0][2])+sep+Format(t[1][2])+sep+Format(t[2][2])+sep+ + Format(t[0][3])+sep+Format(t[1][3])+sep+Format(t[2][3]); } string lightscript(light light) { @@ -2675,11 +2599,12 @@ pair viewportmargin(pair lambda) return maxbound(0.5*(viewportsize-lambda),viewportmargin); } -string embed3D(string label="", string text=label, string prefix, +string embed3D(string prefix, string label=prefix, string text=label, frame f, string format="", real width=0, real height=0, string options="", string script="", - light light=currentlight, projection P=currentprojection) + light light=currentlight, projection P=currentprojection, + real viewplanesize=0) { if(!prc(format) || Embed == null) return ""; @@ -2688,63 +2613,53 @@ string embed3D(string label="", string text=label, string prefix, if(script == "") script=defaultembed3Dscript; - // Adobe Reader doesn't appear to support user-specified viewport lights. - string lightscript=light.on() && light.viewport ? "" : lightscript(light); - - real viewplanesize; if(P.infinity) { - triple lambda=max3(f)-min3(f); - pair margin=viewportmargin((lambda.x,lambda.y)); - viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/P.zoom; + if(viewplanesize==0) { + triple lambda=max3(f)-min3(f); + pair margin=viewportmargin((lambda.x,lambda.y)); + viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/P.zoom; + } } else if(!P.absolute) P.angle=2*aTan(Tan(0.5*P.angle)); - int[] index; - triple[] center; - shipout3(prefix,f,index,center); + shipout3(prefix,f); string name=prefix+".js"; - writeJavaScript(name,lightscript+projection(P.infinity,viewplanesize)+ - billboard(index,center),script); + // Adobe Reader doesn't appear to support user-specified viewport lights. + bool lightscript=light.on() && !light.viewport; + if(lightscript) + writeJavaScript(name,lightscript(light),script); if(!settings.inlinetex) file3.push(prefix+".prc"); - triple target=P.target; - if(P.viewportshift != 0) { - triple lambda=max3(f)-min3(f); - target -= (P.viewportshift.x*lambda.x/P.zoom, - P.viewportshift.y*lambda.y/P.zoom,0); - } + static transform3 flipxz=xscale3(-1)*zscale3(-1); + transform3 inv=inverse(flipxz*P.T.modelview); - triple v=P.vector(); - triple u=unit(v); - triple w=Z-u.z*u; - real roll; - if(abs(w) > sqrtEpsilon) { - w=unit(w); - triple up=unit(perp(P.up,u)); - roll=degrees(acos1(dot(up,w)))*sgn(dot(cross(up,w),u)); - } else roll=0; - - string options3=light.viewport ? "3Dlights=Headlamp" : "3Dlights=File"; + string options3="3Dlights="+ + (light.on() ? (light.viewport ? "Headlamp" : "File") : "None"); if(defaultembed3Doptions != "") options3 += ","+defaultembed3Doptions; + if((settings.render < 0 || !settings.embed) && settings.auto3D) - options3 += ",poster"; - options3 += ",text={"+text+"},label="+label+ - ",toolbar="+(settings.toolbar ? "true" : "false")+ - ",3Daac="+Format(P.angle)+ - ",3Dc2c="+Format(u)+ - ",3Dcoo="+Format(target)+ - ",3Droll="+Format(roll)+ - ",3Droo="+Format(abs(v))+ + options3 += ",activate=pagevisible"; + options3 += ",3Dtoolbar="+(settings.toolbar ? "true" : "false")+ + ",label="+label+ + (P.infinity ? ",3Dortho="+Format(1/viewplanesize) : + ",3Daac="+Format(P.angle))+ + ",3Dc2w="+Format(inv)+ + ",3Droo="+Format(abs(P.vector()))+ + ",3Dpsob="+(P.infinity ? "Max" : "H")+ ",3Dbg="+Format(light.background()); if(options != "") options3 += ","+options; if(settings.inlinetex) prefix=jobname(prefix); - options3 += ",3Djscript="+prefix+".js"; + if(lightscript) + options3 += ",add3Djscript="+prefix+".js"; + options3 += ",add3Djscript=asylabels.js"; - return Embed(prefix+".prc",options3,width,height); + return text == "" ? Embed(prefix+".prc","",options3,width,height) : + "\hbox to 0pt{"+text+"\hss}"+Embed(prefix+".prc","\phantom{"+text+"}", + options3); } struct scene @@ -2895,9 +2810,9 @@ struct scene } } -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 embed(string prefix=outprefix(), string label=prefix, + string text=label, scene S, string format="", bool view=true, + string options="", string script="", light light=currentlight) { object F; transform3 modelview; @@ -2905,15 +2820,17 @@ object embed(string label="", string text=label, string prefix=defaultfilename, transform3 tinv=inverse(S.t); projection Q; + triple orthoshift; modelview=P.T.modelview; + transform3 inv; if(P.absolute) { Q=modelview*P; + inv=inverse(modelview); } else { triple target=P.target; S.f=modelview*S.f; P=modelview*P; Q=P.copy(); - light=modelview*light; if(P.infinity) { triple m=min3(S.f); @@ -2922,7 +2839,9 @@ object embed(string label="", string text=label, string prefix=defaultfilename, S.viewportmargin=viewportmargin((lambda.x,lambda.y)); S.width=ceil(lambda.x+2*S.viewportmargin.x); S.height=ceil(lambda.y+2*S.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) + orthoshift=(-0.5(m.x+M.x),-0.5*(m.y+M.y),0); + S.f=shift(orthoshift)*S.f; // Eye will be at (0,0,0) + inv=inverse(modelview); } else { if(P.angle == 0) { P.angle=S.angle(P); @@ -2930,9 +2849,9 @@ object embed(string label="", string text=label, string prefix=defaultfilename, if(S.viewportmargin.y != 0) P.angle=2*aTan(Tan(0.5*P.angle)-S.viewportmargin.y/P.target.z); } + inv=inverse(modelview); Q.angle=P.angle; if(settings.verbose > 0) { - transform3 inv=inverse(modelview); if(S.adjusted) write("adjusting camera to ",tinv*inv*P.camera); target=inv*P.target; @@ -2944,12 +2863,13 @@ object embed(string label="", string text=label, string prefix=defaultfilename, write("adjusting target to ",tinv*target); } } - + light Light=modelview*light; + 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. + // The media9.sty package cannot handle spaces or dots in filenames. string dir=stripfile(prefix); prefix=dir+replace(stripdirectory(prefix), new string[][]{{" ","_"},{".","_"}}); @@ -2987,10 +2907,9 @@ object embed(string label="", string text=label, string prefix=defaultfilename, S.width-defaultrender.margin,S.height-defaultrender.margin, 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); + tinv*inv*shift(0,0,zcenter),Light.background(),Light.position, + Light.diffuse,Light.ambient,Light.specular, + Light.viewport,view && !preview); if(!preview) return F; } @@ -3008,19 +2927,48 @@ object embed(string label="", string text=label, string prefix=defaultfilename, image=graphic(image,"hiresbb"); } if(prc) { - if(!P.infinity && P.viewportshift != 0) + if(P.viewportshift != 0) { + if(!P.infinity) 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); + + triple lambda=max3(S.f)-min3(S.f); + Q.target -= (P.viewportshift.x*lambda.x/P.zoom, + P.viewportshift.y*lambda.y/P.zoom,0); + } + + real viewplanesize=0; + if(P.absolute) { + if(P.infinity) { + S.f=modelview*S.f; + triple lambda=max3(S.f)-min3(S.f); + pair margin=viewportmargin((lambda.x,lambda.y)); + viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/Q.zoom; + S.f=inv*S.f; + } + Q=inv*Q; + } else { + if(P.infinity) { + triple lambda=max3(S.f)-min3(S.f); + pair margin=viewportmargin((lambda.x,lambda.y)); + viewplanesize=(max(lambda.x+2*margin.x,lambda.y+2*margin.y))/(Q.zoom); + transform3 t=inv*shift(-orthoshift); + Q=t*Q; + S.f=t*S.f; + } else { + Q=inv*Q; + S.f=inv*S.f; + } + } + F.L=embed3D(prefix,label,text=image,S.f,format, + S.width-2,S.height-2,options,script,light,Q,viewplanesize); } return F; } -object embed(string label="", string text=label, - string prefix=defaultfilename, - picture pic, string format="", +object embed(string prefix=outprefix(), string label=prefix, + string text=label, 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, @@ -3029,7 +2977,7 @@ object embed(string label="", string text=label, 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); + return embed(prefix,label,text,S,format,view,options,script,light); else { object F; transform T=S.pic2.scaling(xsize,ysize,keepAspect); @@ -3039,8 +2987,8 @@ object embed(string label="", string text=label, } } -object embed(string label="", string text=label, - string prefix=defaultfilename, +object embed(string prefix=outprefix(), string label=prefix, + string text=label, frame f, string format="", real width=0, real height=0, bool view=true, string options="", string script="", light light=currentlight, projection P=currentprojection) diff --git a/Build/source/utils/asymptote/base/three_arrows.asy b/Build/source/utils/asymptote/base/three_arrows.asy index 8346a5bc6c1..5b9bd45d56f 100644 --- a/Build/source/utils/asymptote/base/three_arrows.asy +++ b/Build/source/utils/asymptote/base/three_arrows.asy @@ -118,7 +118,8 @@ struct arrowhead3 static path[] align(path H, path h) { static real fuzz=1000*realEpsilon; real[][] t=intersections(H,h,fuzz*max(abs(max(h)),abs(min(h)))); - return rotate(-degrees(point(H,t[0][0])-point(H,t[1][0]),warn=false))*H; + return t.length >= 2 ? + rotate(-degrees(point(H,t[0][0])-point(H,t[1][0]),warn=false))*H : H; } } @@ -248,8 +249,8 @@ real[] arrowbasepoints(path3 base, path3 left, path3 right) { real[][] Tl=transpose(intersections(left,base)); real[][] Tr=transpose(intersections(right,base)); - return new real[] {Tl.length > 0 ? Tl[0][0] : 1, - Tr.length > 0 ? Tr[0][0] : 1}; + return new real[] {Tl.length > 0 ? Tl[0][0] : 0, + Tr.length > 0 ? Tr[0][0] : 0}; } path3 arrowbase(path3 r, triple y, real t, real size) diff --git a/Build/source/utils/asymptote/base/three_light.asy b/Build/source/utils/asymptote/base/three_light.asy index eb85ed0c3e5..73f68b62a86 100644 --- a/Build/source/utils/asymptote/base/three_light.asy +++ b/Build/source/utils/asymptote/base/three_light.asy @@ -26,6 +26,11 @@ struct material { void specular(pen q) {p[3]=q;} } +material operator init() +{ + return material(); +} + void write(file file, string s="", material x, suffix suffix=none) { write(file,s); diff --git a/Build/source/utils/asymptote/base/three_surface.asy b/Build/source/utils/asymptote/base/three_surface.asy index 7d356e45e22..0ef497f6d56 100644 --- a/Build/source/utils/asymptote/base/three_surface.asy +++ b/Build/source/utils/asymptote/base/three_surface.asy @@ -689,7 +689,7 @@ struct surface { return ucyclic() ? g&cycle : g; } - // A constructor for a possibly nonconvex cyclic path in a given plane. + // A constructor for a possibly nonconvex simple cyclic path in a given plane. void operator init(path p, triple plane(pair)=XYplane) { bool straight=piecewisestraight(p); for(path g : regularize(p)) @@ -947,54 +947,54 @@ private triple[] split(triple z0, triple c0, triple c1, triple z1, real t=0.5) // produced by a horizontal split of P triple[][][] hsplit(triple[][] P) { - // get control points in rows - triple[] P0=P[0]; - triple[] P1=P[1]; - triple[] P2=P[2]; - triple[] P3=P[3]; - - triple[] c0=split(P0[0],P0[1],P0[2],P0[3]); - triple[] c1=split(P1[0],P1[1],P1[2],P1[3]); - triple[] c2=split(P2[0],P2[1],P2[2],P2[3]); - triple[] c3=split(P3[0],P3[1],P3[2],P3[3]); - // bottom, top - return new triple[][][] { + // get control points in rows + triple[] P0=P[0]; + triple[] P1=P[1]; + triple[] P2=P[2]; + triple[] P3=P[3]; + + triple[] c0=split(P0[0],P0[1],P0[2],P0[3]); + triple[] c1=split(P1[0],P1[1],P1[2],P1[3]); + triple[] c2=split(P2[0],P2[1],P2[2],P2[3]); + triple[] c3=split(P3[0],P3[1],P3[2],P3[3]); + // bottom, top + return new triple[][][] { {{P0[0],c0[0],c0[1],c0[2]}, {P1[0],c1[0],c1[1],c1[2]}, {P2[0],c2[0],c2[1],c2[2]}, {P3[0],c3[0],c3[1],c3[2]}}, - {{c0[2],c0[3],c0[4],P0[3]}, - {c1[2],c1[3],c1[4],P1[3]}, - {c2[2],c2[3],c2[4],P2[3]}, - {c3[2],c3[3],c3[4],P3[3]}} - }; + {{c0[2],c0[3],c0[4],P0[3]}, + {c1[2],c1[3],c1[4],P1[3]}, + {c2[2],c2[3],c2[4],P2[3]}, + {c3[2],c3[3],c3[4],P3[3]}} + }; } // Return the control points of the subpatches // produced by a vertical split of P triple[][][] vsplit(triple[][] P) { - // get control points in rows - triple[] P0=P[0]; - triple[] P1=P[1]; - triple[] P2=P[2]; - triple[] P3=P[3]; - - triple[] c0=split(P0[0],P1[0],P2[0],P3[0]); - triple[] c1=split(P0[1],P1[1],P2[1],P3[1]); - triple[] c2=split(P0[2],P1[2],P2[2],P3[2]); - triple[] c3=split(P0[3],P1[3],P2[3],P3[3]); - // left, right - return new triple[][][] { - {{P0[0],P0[1],P0[2],P0[3]}, - {c0[0],c1[0],c2[0],c3[0]}, - {c0[1],c1[1],c2[1],c3[1]}, - {c0[2],c1[2],c2[2],c3[2]}}, - {{c0[2],c1[2],c2[2],c3[2]}, - {c0[3],c1[3],c2[3],c3[3]}, - {c0[4],c1[4],c2[4],c3[4]}, - {P3[0],P3[1],P3[2],P3[3]}} - }; + // get control points in rows + triple[] P0=P[0]; + triple[] P1=P[1]; + triple[] P2=P[2]; + triple[] P3=P[3]; + + triple[] c0=split(P0[0],P1[0],P2[0],P3[0]); + triple[] c1=split(P0[1],P1[1],P2[1],P3[1]); + triple[] c2=split(P0[2],P1[2],P2[2],P3[2]); + triple[] c3=split(P0[3],P1[3],P2[3],P3[3]); + // left, right + return new triple[][][] { + {{P0[0],P0[1],P0[2],P0[3]}, + {c0[0],c1[0],c2[0],c3[0]}, + {c0[1],c1[1],c2[1],c3[1]}, + {c0[2],c1[2],c2[2],c3[2]}}, + {{c0[2],c1[2],c2[2],c3[2]}, + {c0[3],c1[3],c2[3],c3[3]}, + {c0[4],c1[4],c2[4],c3[4]}, + {P3[0],P3[1],P3[2],P3[3]}} + }; } // Return a 2D array of the control point arrays of the subpatches @@ -1023,7 +1023,7 @@ triple[][][][] split(triple[][] P, real u=1/2, real v=1/2) triple[] c9=split(c0[4],c1[4],c2[4],c3[4],u); triple[] cA=split(P0[3],P1[3],P2[3],P3[3],u); -// {{bottom-left, top-left}, {bottom-right, top-right}} + // {{bottom-left, top-left}, {bottom-right, top-right}} return new triple[][][][] { {{{P0[0],c0[0],c0[1],c0[2]}, {c4[0],c5[0],c6[0],c7[0]}, @@ -1206,7 +1206,7 @@ interaction LabelInteraction() return settings.autobillboard ? Billboard : Embedded; } -private material material(material m, light light) +material material(material m, light light) { return light.on() || invisible((pen) m) ? m : emissive(m); } @@ -1223,8 +1223,96 @@ void draw3D(frame f, int type=0, patch s, triple center=O, material m, PRCshininess=PRCshininess(m.shininess); draw(f,s.P,center,s.straight,m.p,m.opacity,m.shininess,PRCshininess, - s.planar ? s.normal(0.5,0.5) : O,s.colors, - light.on(),interaction.type,prc); + s.planar ? s.normal(0.5,0.5) : O,s.colors,interaction.type,prc); +} + +// Draw triangles on a frame. +void draw(frame f, triple[] v, int[][] vi, + triple[] n={}, int[][] ni={}, material m=currentpen, pen[] p={}, + int[][] pi={}, light light=currentlight) +{ + if(p.length > 0) + m=mean(p); + m=material(m,light); + real PRCshininess; + if(prc()) + PRCshininess=PRCshininess(m.shininess); + draw(f,v,vi,n,ni,m.p,m.opacity,m.shininess,PRCshininess,p,pi); +} + +// Draw triangles on a picture. +void draw(picture pic=currentpicture, triple[] v, int[][] vi, + triple[] n={}, int[][] ni={}, material m=currentpen, pen[] p={}, + int[][] pi={}, light light=currentlight) +{ + bool colors=pi.length > 0; + bool normals=ni.length > 0; + if(!colors && !normals) { + n=new triple[]; + ni=new int[vi.length][3]; + triple lastnormal=O; + for(int i=0; i < vi.length; ++i) { + int[] vii=vi[i]; + int[] nii=ni[i]; + triple normal=normal(new triple[] {v[vii[0]],v[vii[1]],v[vii[2]]}); + if(normal != lastnormal || n.length == 0) { + n.push(normal); + lastnormal=normal; + } + nii[0]=nii[1]=nii[2]=n.length-1; + } + } + + pic.add(new void(frame f, transform3 t, picture pic, projection P) { + triple[] v=t*v; + triple[] n=t*n; + + if(is3D()) { + draw(f,v,vi,n,ni,m,p,pi,light); + if(pic != null) { + for(int[] vii : vi) + for(int viij : vii) + pic.addPoint(project(v[viij],P)); + } + } else if(pic != null) { + static int[] edges={0,0,1}; + if(colors) { + for(int i=0; i < vi.length; ++i) { + int[] vii=vi[i]; + int[] pii=pi[i]; + gouraudshade(pic,project(v[vii[0]],P)--project(v[vii[1]],P)-- + project(v[vii[2]],P)--cycle, + new pen[] {p[pii[0]],p[pii[1]],p[pii[2]]},edges); + } + } else { + if(normals) { + for(int i=0; i < vi.length; ++i) { + int[] vii=vi[i]; + int[] nii=ni[i]; + gouraudshade(pic,project(v[vii[0]],P)--project(v[vii[1]],P)-- + project(v[vii[2]],P)--cycle, + new pen[] {color(n[nii[0]],m,light), + color(n[nii[1]],m,light), + color(n[nii[2]],m,light)},edges); + } + } else { + for(int i=0; i < vi.length; ++i) { + int[] vii=vi[i]; + path g=project(v[vii[0]],P)--project(v[vii[1]],P)-- + project(v[vii[2]],P)--cycle; + pen p=color(n[ni[i][0]],m,light); + fill(pic,g,p); + if(opacity(m.diffuse()) == 1) // Fill subdivision cracks + draw(pic,g,p); + } + } + } + } + },true); + + for(int[] vii : vi) + for(int viij : vii) + pic.addPoint(v[viij]); } void drawPRCsphere(frame f, transform3 t=identity4, bool half=false, material m, @@ -1273,25 +1361,30 @@ void draw(transform t=identity(), frame f, surface s, int nu=1, int nv=1, { bool is3D=is3D(); if(is3D) { - begingroup3(f,name == "" ? "surface" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(f,name == "" ? "surface" : name,render); for(int i=0; i < s.s.length; ++i) draw3D(f,s.s[i],surfacepen[i],light); - endgroup3(f); + if(group) + endgroup3(f); pen modifiers=thin()+squarecap; for(int k=0; k < s.s.length; ++k) { pen meshpen=meshpen[k]; if(!invisible(meshpen)) { - begingroup3(f,meshname(name),render); + if(group) + begingroup3(f,meshname(name),render); meshpen=modifiers+meshpen; real step=nu == 0 ? 0 : 1/nu; for(int i=0; i <= nu; ++i) - draw(f,s.s[k].uequals(i*step),meshpen,meshlight,partname(i), + draw(f,s.s[k].uequals(i*step),meshpen,meshlight,partname(i,render), render); step=nv == 0 ? 0 : 1/nv; for(int j=0; j <= nv; ++j) - draw(f,s.s[k].vequals(j*step),meshpen,meshlight,partname(j), + draw(f,s.s[k].vequals(j*step),meshpen,meshlight,partname(j,render), render); - endgroup3(f); + if(group) + endgroup3(f); } } } @@ -1473,6 +1566,46 @@ private path[] path(Label L, pair z=0, projection P) shift(z)*g; } +transform3 alignshift(path3[] g, transform3 t=identity4, triple position, + triple align) +{ + if(determinant(t) == 0) return identity4; + triple m=min(g); + triple dir=rectify(inverse(t)*-align); + triple a=m+realmult(dir,max(g)-m); + return shift(-a); +} + +transform3 alignshift(surface s, transform3 t=identity4, triple position, + triple align) +{ + if(determinant(t) == 0) return identity4; + triple m=min(s); + triple dir=rectify(inverse(t)*-align); + triple a=m+realmult(dir,max(s)-m); + return shift(-a); +} + +transform3 aligntransform(path3[] g, transform3 t=identity4, triple position, + triple align, pen p=currentpen) +{ + if(determinant(t) == 0) return identity4; + triple m=min(g); + triple dir=rectify(inverse(t)*-align); + triple a=m+realmult(dir,max(g)-m); + return shift(position+align*labelmargin(p))*t*shift(-a); +} + +transform3 aligntransform(surface s, transform3 t=identity4, triple position, + triple align, pen p=currentpen) +{ + if(determinant(t) == 0) return identity4; + triple m=min(s); + triple dir=rectify(inverse(t)*-align); + triple a=m+realmult(dir,max(s)-m); + return shift(position+align*labelmargin(p))*t*shift(-a); +} + void label(frame f, Label L, triple position, align align=NoAlign, pen p=currentpen, light light=nolight, string name="", render render=defaultrender, @@ -1484,16 +1617,55 @@ void label(frame f, Label L, triple position, align align=NoAlign, L.p(p); if(interaction.targetsize && settings.render != 0) L.T=L.T*scale(abs(P.camera-position)/abs(P.vector())); + transform3 T=transform3(P); if(L.defaulttransform3) - L.T3=transform3(P); - begingroup3(f,name == "" ? L.s : name,render); + L.T3=T; + if(is3D()) { bool lighton=light.on(); - for(patch S : surface(L,position,bbox=P.bboxonly).s) { - draw3D(f,S,position,L.p,light,interaction); - // Fill subdivision cracks - if(render.labelfill && opacity(L.p) == 1 && !lighton) - _draw(f,S.external(),position,L.p,interaction.type); + if(name == "") name=L.s; + if(prc() && interaction.type == Billboard.type) { + surface s=surface(texpath(L)); + transform3 centering=L.align.is3D ? + alignshift(s,L.T3,position,L.align.dir3) : identity4; + transform3 positioning= + shift(L.align.is3D ? position+L.align.dir3*labelmargin(L.p) : position); + frame f1,f2,f3; + begingroup3(f1,name,render); + if(L.defaulttransform3) + begingroup3(f3,render,position,interaction.type); + else { + begingroup3(f2,render,position,interaction.type); + begingroup3(f3,render,position); + } + for(patch S : s.s) { + S=centering*S; + draw3D(f3,S,position,L.p,light,interaction); + // Fill subdivision cracks + if(render.labelfill && opacity(L.p) == 1 && !lighton) + _draw(f3,S.external(),position,L.p,interaction.type); + } + endgroup3(f3); + if(L.defaulttransform3) + add(f1,T*f3); + else { + add(f2,inverse(T)*L.T3*f3); + endgroup3(f2); + add(f1,T*f2); + } + endgroup3(f1); + add(f,positioning*f1); + } else { + begingroup3(f,name,render); + for(patch S : surface(L,position).s) { + triple V=L.align.is3D ? position+L.align.dir3*labelmargin(L.p) : + position; + draw3D(f,S,V,L.p,light,interaction); + // Fill subdivision cracks + if(render.labelfill && opacity(L.p) == 1 && !lighton) + _draw(f,S.external(),V,L.p,interaction.type); + } + endgroup3(f); } } else { pen p=color(L.T3*Z,L.p,light,shiftless(P.T.modelview)); @@ -1509,7 +1681,6 @@ void label(frame f, Label L, triple position, align align=NoAlign, for(patch S : surface(L,position).s) fill(f,project(S.external(),P,1),p); } - endgroup3(f); } void label(picture pic=currentpicture, Label L, triple position, @@ -1533,18 +1704,54 @@ void label(picture pic=currentpicture, Label L, triple position, if(interaction.targetsize && settings.render != 0) L.T=L.T*scale(abs(P.camera-v)/abs(P.vector())); + transform3 T=transform3(P); if(L.defaulttransform3) - L.T3=transform3(P); + L.T3=T; - begingroup3(f,name == "" ? L.s : name,render,v,interaction.type); - bool lighton=light.on(); - if(is3D()) { - for(patch S : surface(L,v,bbox=P.bboxonly).s) { - draw3D(f,S,v,L.p,light,interaction); - // Fill subdivision cracks - if(render.labelfill && opacity(L.p) == 1 && !lighton) - _draw(f,S.external(),v,L.p,interaction.type); + bool lighton=light.on(); + if(name == "") name=L.s; + if(prc() && interaction.type == Billboard.type) { + surface s=surface(texpath(L,bbox=P.bboxonly)); + transform3 centering=L.align.is3D ? + alignshift(s,L.T3,v,L.align.dir3) : identity4; + transform3 positioning= + shift(L.align.is3D ? v+L.align.dir3*labelmargin(L.p) : v); + frame f1,f2,f3; + begingroup3(f1,name,render); + if(L.defaulttransform3) + begingroup3(f3,render,v,interaction.type); + else { + begingroup3(f2,render,v,interaction.type); + begingroup3(f3,render,v); + } + for(patch S : s.s) { + S=centering*S; + draw3D(f3,S,v,L.p,light,interaction); + // Fill subdivision cracks + if(render.labelfill && opacity(L.p) == 1 && !lighton) + _draw(f3,S.external(),v,L.p,interaction.type); + } + endgroup3(f3); + if(L.defaulttransform3) + add(f1,T*f3); + else { + add(f2,inverse(T)*L.T3*f3); + endgroup3(f2); + add(f1,T*f2); + } + endgroup3(f1); + add(f,positioning*f1); + } else { + begingroup3(f,name,render); + for(patch S : surface(L,v,bbox=P.bboxonly).s) { + triple V=L.align.is3D ? v+L.align.dir3*labelmargin(L.p) : v; + draw3D(f,S,V,L.p,light,interaction); + // Fill subdivision cracks + if(render.labelfill && opacity(L.p) == 1 && !lighton) + _draw(f,S.external(),V,L.p,interaction.type); + } + endgroup3(f); } } @@ -1564,7 +1771,6 @@ void label(picture pic=currentpicture, Label L, triple position, fill(f,T*project(S.external(),P,1),p); }); } - endgroup3(f); },!L.defaulttransform3); @@ -1732,14 +1938,17 @@ void dot(frame f, triple v, material p=currentpen, { pen q=(pen) p; if(is3D()) { - begingroup3(f,name == "" ? "dot" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(f,name == "" ? "dot" : name,render); real size=0.5*linewidth(dotsize(q)+q); transform3 T=shift(v)*scale3(size); for(patch s : unitsphere.s) draw3D(f,T*s,v,p,light,prc=false); if(prc()) drawPRCsphere(f,T,p,light); - endgroup3(f); + if(group) + endgroup3(f); } else dot(f,project(v,P.t),q); } @@ -1752,7 +1961,7 @@ void dot(frame f, triple[] v, material p=currentpen, light light=nolight, v=sort(v,lexorder); triple last=v[0]; - dot(f,last,p,light,name,P); + dot(f,last,p,light,name,render,P); for(int i=1; i < v.length; ++i) { triple V=v[i]; if(V != last) { @@ -1798,13 +2007,16 @@ void dot(picture pic=currentpicture, triple v, material p=currentpen, pic.add(new void(frame f, transform3 t, picture pic, projection P) { triple V=t*v; if(is3D()) { - begingroup3(f,name == "" ? "dot" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(f,name == "" ? "dot" : name,render); transform3 T=shift(V)*scale3(size); for(patch s : unitsphere.s) draw3D(f,T*s,V,p,light,prc=false); if(prc()) drawPRCsphere(f,T,p,light,render); - endgroup3(f); + if(group) + endgroup3(f); } if(pic != null) dot(pic,project(V,P.t),q); @@ -1821,17 +2033,20 @@ void dot(picture pic=currentpicture, triple[] v, material p=currentpen, v=sort(v,lexorder); triple last=v[0]; - begingroup3(pic,name == "" ? "dots" : name,render); - dot(pic,last,p,light,partname(0),render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(pic,name == "" ? "dots" : name,render); + dot(pic,last,p,light,partname(0,render),render); int k=0; for(int i=1; i < v.length; ++i) { triple V=v[i]; if(V != last) { - dot(pic,V,p,light,partname(++k),render); + dot(pic,V,p,light,partname(++k,render),render); last=V; } } - endgroup3(pic); + if(group) + endgroup3(pic); } } @@ -1957,9 +2172,12 @@ void draw(picture pic=currentpicture, triple[] P, real[] knot, pic.add(new void(frame f, transform3 t, picture pic, projection Q) { if(is3D()) { triple[] P=t*P; - begingroup3(f,name == "" ? "curve" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(f,name == "" ? "curve" : name,render); draw(f,P,knot,weights,p); - endgroup3(f); + if(group) + endgroup3(f); if(pic != null) pic.addBox(minbound(P,Q),maxbound(P,Q)); } @@ -1975,6 +2193,7 @@ void draw(picture pic=currentpicture, triple[][] P, real[] uknot, real[] vknot, { if(colors.length > 0) m=mean(colors); + m=material(m,light); bool lighton=light.on(); P=copy(P); uknot=copy(uknot); @@ -1983,14 +2202,17 @@ void draw(picture pic=currentpicture, triple[][] P, real[] uknot, real[] vknot, colors=copy(colors); pic.add(new void(frame f, transform3 t, picture pic, projection Q) { if(is3D()) { - begingroup3(f,name == "" ? "surface" : name,render); + bool group=name != "" || render.defaultnames; + if(group) + begingroup3(f,name == "" ? "surface" : name,render); triple[][] P=t*P; real PRCshininess; if(prc()) PRCshininess=PRCshininess(m.shininess); draw(f,P,uknot,vknot,weights,m.p,m.opacity,m.shininess,PRCshininess, - colors,lighton); - endgroup3(f); + colors); + if(group) + endgroup3(f); if(pic != null) pic.addBox(minbound(P,Q),maxbound(P,Q)); } diff --git a/Build/source/utils/asymptote/base/three_tube.asy b/Build/source/utils/asymptote/base/three_tube.asy index aa5688f081e..8b621e92dda 100644 --- a/Build/source/utils/asymptote/base/three_tube.asy +++ b/Build/source/utils/asymptote/base/three_tube.asy @@ -405,10 +405,9 @@ struct tube if(abs(dir(p,i,1)-dir(p,i,-1)) > sqrtEpsilon) { generate(subpath(p,begin,i)); triple dir=dir(p,i,-1); - s.append(shift(point(p,i))*t*align(dir)* - (dir != O ? unithemisphere : unitsphere)); - int L=length(center); - sphere(shift(point(center,L))*t*align(dir(center,L,-1)), + transform3 T=t*align(dir); + s.append(shift(point(p,i))*T*(dir != O ? unithemisphere : unitsphere)); + sphere(shift(point(center,length(center)))*T, half=straight(p,i-1) && straight(p,i)); begin=i; } diff --git a/Build/source/utils/asymptote/bbox3.h b/Build/source/utils/asymptote/bbox3.h index 5659f24b6ee..b28921c305a 100644 --- a/Build/source/utils/asymptote/bbox3.h +++ b/Build/source/utils/asymptote/bbox3.h @@ -49,11 +49,22 @@ struct bbox3 { { } + // Start a bbox3 with 2 points + bbox3(const triple& m, const triple& M) + : empty(false), + left(m.getx()), bottom(m.gety()), lower(m.getz()), + right(M.getx()), top(M.gety()), upper(M.getz()) + { + } + // Add a point to a bbox3 void add(const triple& v) { - double x = v.getx(), y = v.gety(), z = v.getz(); - + const double x = v.getx(), y = v.gety(), z = v.getz(); + add(x,y,z); + } + void add(double x, double y, double z) + { if (empty) { left = right = x; top = bottom = y; @@ -144,6 +155,33 @@ struct bbox3 { return triple(right,top,upper); } + // transform bbox3 by 4x4 column-major matrix + void transform(const double* m) + { + const double xmin = left; + const double ymin = bottom; + const double zmin = lower; + const double xmax = right; + const double ymax = top; + const double zmax = upper; + + empty = true; + add(m*triple(xmin,ymin,zmin)); + addnonempty(m*triple(xmin,ymin,zmax)); + addnonempty(m*triple(xmin,ymax,zmin)); + addnonempty(m*triple(xmin,ymax,zmax)); + addnonempty(m*triple(xmax,ymin,zmin)); + addnonempty(m*triple(xmax,ymin,zmax)); + addnonempty(m*triple(xmax,ymax,zmin)); + addnonempty(m*triple(xmax,ymax,zmax)); + } + + friend ostream& operator << (ostream& out, const bbox3& b) + { + out << "Min " << b.Min() << " Max " << b.Max(); + return out; + } + }; } // namespace camp diff --git a/Build/source/utils/asymptote/config.guess b/Build/source/utils/asymptote/config.guess index f475ceb4138..f32079abda6 100644 --- a/Build/source/utils/asymptote/config.guess +++ b/Build/source/utils/asymptote/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2013-02-12' +timestamp='2008-01-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,22 +17,26 @@ timestamp='2013-02-12' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see <http://www.gnu.org/licenses/>. +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. # -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. # -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +56,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -137,7 +144,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -163,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ + | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -173,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd ;; esac # The OS release @@ -194,10 +201,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} @@ -220,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on @@ -266,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead @@ -295,12 +295,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo s390-ibm-zvmoe exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 + echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) + arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -324,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -394,23 +375,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; @@ -480,8 +461,8 @@ EOF echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -494,7 +475,7 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; @@ -551,7 +532,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[4567]) + *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -594,52 +575,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -659,7 +640,7 @@ EOF # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -730,22 +711,22 @@ EOF exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; @@ -769,14 +750,14 @@ EOF exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} @@ -788,39 +769,34 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - authenticamd | genuineintel | EM64T) + EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -830,9 +806,6 @@ EOF [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we @@ -862,27 +835,6 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -890,40 +842,20 @@ EOF then echo ${UNAME_MACHINE}-unknown-linux-gnu else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -934,36 +866,74 @@ EOF m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - mips:Linux:*:* | mips64:Linux:*:*) + mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + CPU=mips #else CPU= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - or1k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo or32-unknown-linux-gnu exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level @@ -973,17 +943,14 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -991,18 +958,78 @@ EOF sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1010,11 +1037,11 @@ EOF echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) @@ -1031,7 +1058,7 @@ EOF i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) @@ -1046,7 +1073,7 @@ EOF fi exit ;; i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; @@ -1074,13 +1101,10 @@ EOF exit ;; pc:*:*:*) # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; @@ -1115,18 +1139,8 @@ EOF /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; @@ -1139,7 +1153,7 @@ EOF rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) @@ -1159,10 +1173,10 @@ EOF echo ns32k-sni-sysv fi exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm @@ -1188,11 +1202,11 @@ EOF exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + echo mips-unknown-sysv${UNAME_RELEASE} fi - exit ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; @@ -1202,12 +1216,6 @@ EOF BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; @@ -1235,16 +1243,6 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} @@ -1260,10 +1258,7 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) + NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) @@ -1308,13 +1303,13 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1329,14 +1324,11 @@ EOF i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; esac +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + eval $set_cc_for_build cat >$dummy.c <<EOF #ifdef _SEQUENT_ @@ -1354,11 +1346,11 @@ main () #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" + "" #endif - ); exit (0); + ); exit (0); #endif #endif diff --git a/Build/source/utils/asymptote/config.h.in b/Build/source/utils/asymptote/config.h.in index e59e301b2f6..00322f17611 100644 --- a/Build/source/utils/asymptote/config.h.in +++ b/Build/source/utils/asymptote/config.h.in @@ -63,7 +63,7 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM -/* Define to 1 if you have the `OSMesa' library (-lOSMesa). */ +/* Define if you have the `OSMesa' library (-lOSMesa). */ #undef HAVE_LIBOSMESA /* Define to 1 if you have the `readline' library (-lreadline). */ diff --git a/Build/source/utils/asymptote/config.sub b/Build/source/utils/asymptote/config.sub index 872199acf72..59bb593f109 100644 --- a/Build/source/utils/asymptote/config.sub +++ b/Build/source/utils/asymptote/config.sub @@ -1,18 +1,24 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2013 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2013-02-12' +timestamp='2012-04-18' -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. @@ -20,12 +26,11 @@ timestamp='2013-02-12' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). +# the same distribution terms that you use for the rest of that program. -# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -68,7 +73,9 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright 1992-2013 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -116,7 +123,7 @@ esac maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) @@ -149,7 +156,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; @@ -252,10 +259,8 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ @@ -268,7 +273,7 @@ case $basic_machine in | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -286,17 +291,16 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ + | nios | nios2 \ | ns16k | ns32k \ | open8 \ - | or1k | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ @@ -385,8 +389,7 @@ case $basic_machine in | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -404,13 +407,12 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ @@ -786,13 +788,9 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze*) + microblaze) basic_machine=microblaze-xilinx ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1021,11 +1019,7 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) + rdos) basic_machine=i386-pc os=-rdos ;; @@ -1352,21 +1346,21 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1498,6 +1492,9 @@ case $os in -aros*) os=-aros ;; + -kaos*) + os=-kaos + ;; -zvmoe) os=-zvmoe ;; @@ -1546,9 +1543,6 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; - hexagon-*) - os=-elf - ;; tic54x-*) os=-coff ;; @@ -1589,9 +1583,6 @@ case $basic_machine in mips*-*) os=-elf ;; - or1k-*) - os=-elf - ;; or32-*) os=-coff ;; diff --git a/Build/source/utils/asymptote/configure b/Build/source/utils/asymptote/configure index a7d6ebe3bac..af719ea6d63 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.68 for Asymptote 2.16. +# Generated by GNU Autoconf 2.68 for Asymptote 2.21. # # Report bugs to <http://sourceforge.net/projects/asymptote>. # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='Asymptote' PACKAGE_TARNAME='asymptote' -PACKAGE_VERSION='2.16' -PACKAGE_STRING='Asymptote 2.16' +PACKAGE_VERSION='2.21' +PACKAGE_STRING='Asymptote 2.21' PACKAGE_BUGREPORT='http://sourceforge.net/projects/asymptote' PACKAGE_URL='' @@ -1263,7 +1263,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Asymptote 2.16 to adapt to many kinds of systems. +\`configure' configures Asymptote 2.21 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1328,7 +1328,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Asymptote 2.16:";; + short | recursive ) echo "Configuration of Asymptote 2.21:";; esac cat <<\_ACEOF @@ -1346,7 +1346,8 @@ Optional Features: --enable-gsl[=yes] enable GNU Scientific Library --enable-fftw[=yes] enable FFTW Library --enable-gl[=yes] enable OpenGL Library - --enable-offscreen[=no] enable offscreen rendering using OSMesa library + --enable-offscreen[=yes] + enable offscreen rendering using OSMesa library Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1440,7 +1441,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Asymptote configure 2.16 +Asymptote configure 2.21 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2026,7 +2027,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Asymptote $as_me 2.16, which was +It was created by Asymptote $as_me 2.21, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -5732,7 +5733,7 @@ fi -GCVERSION=gc-7.2b +GCVERSION=gc-7.2d as_ac_File=`$as_echo "ac_cv_file_$GCVERSION.tar.gz" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GCVERSION.tar.gz" >&5 @@ -6683,9 +6684,9 @@ abort } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5 -$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } -if ${ac_cv_lib_readline_rl_completion_matches+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for history_list in -lreadline" >&5 +$as_echo_n "checking for history_list in -lreadline... " >&6; } +if ${ac_cv_lib_readline_history_list+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -6699,27 +6700,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char rl_completion_matches (); +char history_list (); int main () { -return rl_completion_matches (); +return history_list (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_lib_readline_rl_completion_matches=yes + ac_cv_lib_readline_history_list=yes else - ac_cv_lib_readline_rl_completion_matches=no + ac_cv_lib_readline_history_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_rl_completion_matches" >&5 -$as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_history_list" >&5 +$as_echo "$ac_cv_lib_readline_history_list" >&6; } +if test "x$ac_cv_lib_readline_history_list" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBREADLINE 1 _ACEOF @@ -7032,15 +7033,10 @@ if test "${enable_offscreen+set}" = set; then : fi -# First check if GL is enabled. If so, then: -# onscreen rendering requires GL, glut, and GLU libraries -# offscreen rendering require OSMesa and GLU libraries - if test "x$enable_gl" != "xno"; then case "$OSTYPE" in msdos) - if test "x$enable_offscreen" != "xyes"; then - ac_fn_cxx_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default" + ac_fn_cxx_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default" if test "x$ac_cv_header_GL_gl_h" = xyes; then : $as_echo "#define HAVE_LIBGL 1" >>confdefs.h @@ -7052,7 +7048,6 @@ $as_echo "$as_me: *** Could not find libopengl32: will compile without OpenGL su fi - fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluNewNurbsRenderer in -lGLU" >&5 $as_echo_n "checking for gluNewNurbsRenderer in -lGLU... " >&6; } if ${ac_cv_lib_GLU_gluNewNurbsRenderer+:} false; then : @@ -7112,8 +7107,7 @@ fi ;; darwin*) - if test "x$enable_offscreen" != "xyes"; then - ac_fn_cxx_check_header_mongrel "$LINENO" "OpenGL/gl.h" "ac_cv_header_OpenGL_gl_h" "$ac_includes_default" + ac_fn_cxx_check_header_mongrel "$LINENO" "OpenGL/gl.h" "ac_cv_header_OpenGL_gl_h" "$ac_includes_default" if test "x$ac_cv_header_OpenGL_gl_h" = xyes; then : $as_echo "#define HAVE_LIBGL 1" >>confdefs.h @@ -7121,7 +7115,6 @@ $as_echo "#define HAVE_LIBGL 1" >>confdefs.h fi - fi ac_fn_cxx_check_header_mongrel "$LINENO" "OpenGL/glu.h" "ac_cv_header_OpenGL_glu_h" "$ac_includes_default" if test "x$ac_cv_header_OpenGL_glu_h" = xyes; then : @@ -7169,8 +7162,7 @@ fi ;; - *) if test "x$enable_offscreen" != "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glDepthMask in -lGL" >&5 + *) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glDepthMask in -lGL" >&5 $as_echo_n "checking for glDepthMask in -lGL... " >&6; } if ${ac_cv_lib_GL_glDepthMask+:} false; then : $as_echo_n "(cached) " >&6 @@ -7215,7 +7207,6 @@ _ACEOF fi - fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluNewNurbsRenderer in -lGLU" >&5 $as_echo_n "checking for gluNewNurbsRenderer in -lGLU... " >&6; } if ${ac_cv_lib_GLU_gluNewNurbsRenderer+:} false; then : @@ -7313,7 +7304,7 @@ $as_echo "$as_me: *** Could not find libglut: will compile without GLUT support fi esac - if test "x$enable_offscreen" == "xyes"; then + if test "x$enable_offscreen" != "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSMesaCreateContext in -lOSMesa" >&5 $as_echo_n "checking for OSMesaCreateContext in -lOSMesa... " >&6; } if ${ac_cv_lib_OSMesa_OSMesaCreateContext+:} false; then : @@ -7351,11 +7342,51 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_OSMesa_OSMesaCreateContext" >&5 $as_echo "$ac_cv_lib_OSMesa_OSMesaCreateContext" >&6; } if test "x$ac_cv_lib_OSMesa_OSMesaCreateContext" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBOSMESA 1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _glapi_get_context in -lglapi" >&5 +$as_echo_n "checking for _glapi_get_context in -lglapi... " >&6; } +if ${ac_cv_lib_glapi__glapi_get_context+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lglapi $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char _glapi_get_context (); +int +main () +{ +return _glapi_get_context (); + ; + return 0; +} _ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_cv_lib_glapi__glapi_get_context=yes +else + ac_cv_lib_glapi__glapi_get_context=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_glapi__glapi_get_context" >&5 +$as_echo "$ac_cv_lib_glapi__glapi_get_context" >&6; } +if test "x$ac_cv_lib_glapi__glapi_get_context" = xyes; then : - LIBS="-lOSMesa $LIBS" +$as_echo "#define HAVE_LIBOSMESA 1" >>confdefs.h + + LIBS=$LIBS"-lOSMesa -lglapi" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: *** Could not find libglapi: will compile without offscreen rendering support ***" >&5 +$as_echo "$as_me: *** Could not find libglapi: will compile without offscreen rendering support ***" >&6;} +fi else { $as_echo "$as_me:${as_lineno-$LINENO}: *** Could not find libOSMesa: will compile without offscreen rendering support ***" >&5 @@ -8498,7 +8529,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Asymptote $as_me 2.16, which was +This file was extended by Asymptote $as_me 2.21, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8560,7 +8591,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Asymptote config.status 2.16 +Asymptote config.status 2.21 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/Build/source/utils/asymptote/configure.ac b/Build/source/utils/asymptote/configure.ac index e438112730e..1930886e361 100644 --- a/Build/source/utils/asymptote/configure.ac +++ b/Build/source/utils/asymptote/configure.ac @@ -3,7 +3,7 @@ # this file. AC_PREREQ(2) -AC_INIT([Asymptote],[2.16],[http://sourceforge.net/projects/asymptote]) +AC_INIT([Asymptote],[2.21],[http://sourceforge.net/projects/asymptote]) VERSION=$PACKAGE_VERSION AC_SUBST(VERSION) m4_include([ax_pthread.m4]) @@ -118,7 +118,7 @@ fi AC_CHECK_HEADER(tr1/unordered_map,, [AC_CHECK_HEADER(ext/hash_map,,OPTIONS=$OPTIONS"-DNOHASH ")]) -GCVERSION=gc-7.2b +GCVERSION=gc-7.2d AC_CHECK_FILE($GCVERSION.tar.gz, ac_cv_use_gc=$GCVERSION, @@ -242,7 +242,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #ifndef RL_READLINE_VERSION abort #endif -])],AC_CHECK_LIB([readline], [rl_completion_matches],, +])],AC_CHECK_LIB([readline], [history_list],, AC_MSG_NOTICE(*** Could not find GNU readline 4.3 or later: will compile without readline support ***))) fi @@ -283,22 +283,16 @@ AC_ARG_ENABLE(gl, [AS_HELP_STRING(--enable-gl[[[=yes]]],enable OpenGL Library)]) AC_ARG_ENABLE(offscreen, -[AS_HELP_STRING(--enable-offscreen[[[=no]]],enable offscreen rendering using OSMesa library)]) - -# First check if GL is enabled. If so, then: -# onscreen rendering requires GL, glut, and GLU libraries -# offscreen rendering require OSMesa and GLU libraries +[AS_HELP_STRING(--enable-offscreen[[[=yes]]],enable offscreen rendering using OSMesa library)]) if test "x$enable_gl" != "xno"; then case "$OSTYPE" in msdos) - if test "x$enable_offscreen" != "xyes"; then - AC_CHECK_HEADER(GL/gl.h, + AC_CHECK_HEADER(GL/gl.h, [AC_DEFINE(HAVE_LIBGL, 1, [Define if you have the `opengl32' library (-lopengl32).]) LIBS=$LIBS"-lopengl32 "], AC_MSG_NOTICE([*** Could not find libopengl32: will compile without OpenGL support ***])) - fi AC_CHECK_LIB([GLU], [gluNewNurbsRenderer],[AC_DEFINE(HAVE_LIBGLU, 1, [Define to 1 if you have the `glu32' library (-lglu32).]) LIBS=$LIBS"-lglu32 "], AC_MSG_NOTICE([*** Could not find libglu32: will compile without OpenGL support ***])) @@ -309,11 +303,9 @@ case "$OSTYPE" in AC_MSG_NOTICE([*** Could not find libfreeglut: will compile without GLUT support ***])) ;; darwin*) - if test "x$enable_offscreen" != "xyes"; then - AC_CHECK_HEADER(OpenGL/gl.h, - [AC_DEFINE(HAVE_LIBGL, 1, - [Define if you have the `OpenGL' library.])]) - fi + AC_CHECK_HEADER(OpenGL/gl.h, + [AC_DEFINE(HAVE_LIBGL, 1, + [Define if you have the `OpenGL' library.])]) AC_CHECK_HEADER(OpenGL/glu.h, [AC_DEFINE(HAVE_LIBGLU, 1, [Define if you have the `GLU' library.])]) @@ -332,16 +324,19 @@ void f(void) { LIBS=$LIBS"-framework GLUT -framework OpenGL -framework Cocoa"], AC_MSG_NOTICE([*** Could not find glut: will compile without GLUT support ***])) ;; - *) if test "x$enable_offscreen" != "xyes"; then - AC_CHECK_LIB([GL], [glDepthMask]) - fi + *) AC_CHECK_LIB([GL], [glDepthMask]) AC_CHECK_LIB([GLU], [gluNewNurbsRenderer],, AC_MSG_NOTICE([*** Could not find libGLU: will compile without OpenGL support ***])) AC_CHECK_LIB([glut], [glutMainLoop],, AC_MSG_NOTICE([*** Could not find libglut: will compile without GLUT support ***])) esac - if test "x$enable_offscreen" == "xyes"; then - AC_CHECK_LIB([OSMesa],OSMesaCreateContext,, + if test "x$enable_offscreen" != "xno"; then + AC_CHECK_LIB([OSMesa],OSMesaCreateContext, + AC_CHECK_LIB([glapi],_glapi_get_context, + [AC_DEFINE(HAVE_LIBOSMESA, 1, + [Define if you have the `OSMesa' library (-lOSMesa).]) + LIBS=$LIBS"-lOSMesa -lglapi"], + AC_MSG_NOTICE([*** Could not find libglapi: will compile without offscreen rendering support ***])), AC_MSG_NOTICE([*** Could not find libOSMesa: will compile without offscreen rendering support ***])) fi fi diff --git a/Build/source/utils/asymptote/doc/CAD.pdf b/Build/source/utils/asymptote/doc/CAD.pdf Binary files differindex bb61b12dd4d..c5c3fef48b6 100644 --- a/Build/source/utils/asymptote/doc/CAD.pdf +++ b/Build/source/utils/asymptote/doc/CAD.pdf diff --git a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info index ce35b88fc2b..fe63cc4aadf 100644 --- a/Build/source/utils/asymptote/doc/FAQ/asy-faq.info +++ b/Build/source/utils/asymptote/doc/FAQ/asy-faq.info @@ -10,7 +10,7 @@ END-INFO-DIR-ENTRY File: asy-faq.info, Node: Top, Next: Question 1.1, Up: (dir) ASYMPTOTE FREQUENTLY ASKED QUESTIONS - 30 May 2012 + 10 Oct 2012 This is the list of Frequently Asked Questions about Asymptote (asy). diff --git a/Build/source/utils/asymptote/doc/Makefile.in b/Build/source/utils/asymptote/doc/Makefile.in index 0a924bafa82..a9ce4565703 100644 --- a/Build/source/utils/asymptote/doc/Makefile.in +++ b/Build/source/utils/asymptote/doc/Makefile.in @@ -52,7 +52,7 @@ latexusage.eps: latexusage.dvi dvips -o latexusage.eps latexusage latexusage.pdf: latexusage.dvi - dvipdf latexusage + dvipdf -P latexusage options: ../settings.cc $(ASY) -h 2>&1 | grep -iv Asymptote > options @@ -74,16 +74,16 @@ CAD.pdf: CAD.tex CAD1.eps latex CAD latex CAD latex CAD - dvipdf CAD + dvipdf -P CAD TeXShopAndAsymptote.pdf: TeXShopAndAsymptote.tex latex TeXShopAndAsymptote latex TeXShopAndAsymptote - dvipdf TeXShopAndAsymptote + dvipdf -P TeXShopAndAsymptote asyRefCard.pdf: asyRefCard.tex tex asyRefCard - dvipdf asyRefCard + dvipdf -P asyRefCard clean: FORCE -rm -f asy-latex.{aux,idx,ins,log,toc} diff --git a/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf b/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf Binary files differindex 61dfa38cc71..83e2f90ea74 100755 --- a/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf +++ b/Build/source/utils/asymptote/doc/TeXShopAndAsymptote.pdf diff --git a/Build/source/utils/asymptote/doc/asy-latex.dtx b/Build/source/utils/asymptote/doc/asy-latex.dtx index 1e9c795303f..04b3a265b6d 100644 --- a/Build/source/utils/asymptote/doc/asy-latex.dtx +++ b/Build/source/utils/asymptote/doc/asy-latex.dtx @@ -38,7 +38,7 @@ Licence: GPL2+ %</driver> %<pkg>\ProvidesPackage{asymptote} %<*pkg> - [2011/11/29 v1.26 Asymptote style file for LaTeX] + [2012/08/25 v1.27 Asymptote style file for LaTeX] %</pkg> % %<*driver> @@ -633,6 +633,7 @@ Licence: GPL2+ }% }{% \PackageWarning{asymptote}{file #2 not found}% + \def\@tempa{}% }% }% \immediate\write\AsyStream{\unexpanded\expandafter{\@tempa}}% diff --git a/Build/source/utils/asymptote/doc/asy-latex.pdf b/Build/source/utils/asymptote/doc/asy-latex.pdf Binary files differindex 272cb138084..49a797348ee 100755 --- a/Build/source/utils/asymptote/doc/asy-latex.pdf +++ b/Build/source/utils/asymptote/doc/asy-latex.pdf diff --git a/Build/source/utils/asymptote/doc/asy.1 b/Build/source/utils/asymptote/doc/asy.1 index 7f3d2a40772..979fd50ee38 100755 --- a/Build/source/utils/asymptote/doc/asy.1 +++ b/Build/source/utils/asymptote/doc/asy.1 @@ -61,6 +61,9 @@ Autoplay 3D animations [false]. .B \-autorotate Enable automatic PDF page rotation [false]. .TP +.B \-axes3 +Show 3D axes in PDF output [true]. +.TP .B \-batchMask Mask fpu exceptions in batch mode [false]. .TP diff --git a/Build/source/utils/asymptote/doc/asyRefCard.pdf b/Build/source/utils/asymptote/doc/asyRefCard.pdf Binary files differindex bed262c88fd..fa105896284 100644 --- a/Build/source/utils/asymptote/doc/asyRefCard.pdf +++ b/Build/source/utils/asymptote/doc/asyRefCard.pdf diff --git a/Build/source/utils/asymptote/doc/asyRefCard.tex b/Build/source/utils/asymptote/doc/asyRefCard.tex index e058b857d58..45aed3508e8 100644 --- a/Build/source/utils/asymptote/doc/asyRefCard.tex +++ b/Build/source/utils/asymptote/doc/asyRefCard.tex @@ -38,8 +38,8 @@ % (reference card macros due to Stephen Gildea) % -\def\versionnumber{0.0} % Version of this reference card -\def\year{2011} +\def\versionnumber{1.0} % Version of this reference card +\def\year{2012} \def\month{August} \def\version{\month\ \year\ v\versionnumber} @@ -51,9 +51,9 @@ \vskip 1ex plus 100 fill\begingroup\small \centerline{\version. Copyright \copyright\ \year\ John C. Bowman} -Permission is granted to make and distribute copies of -this card provided the copyright notice and this permission notice -are preserved on all copies. +Permission is granted to make and distribute copies of this card, with +or without modifications, provided the copyright notice and this +permission notice are preserved on all copies. \endgroup} % make \bye not \outer so that the \def\bye in the \else clause below @@ -234,7 +234,7 @@ are preserved on all copies. \makedef dim \makedef expr \makedef filename -\makedef fnc +\makedef f \makedef format \makedef member \makedef name @@ -255,9 +255,9 @@ are preserved on all copies. import "\filename"&import module\cr import "\filename" as name&import filename as module name\cr include "\filename"&include verbatim text from file\cr -\type\ \fnc(\type,\dots);&optional function declaration\cr +\type\ \f(\type,\dots);&optional function declaration\cr \type\ \name;&variable declaration\cr -\type\ \fnc(\type\ \arg,\dots) \{&function definition\cr +\type\ \f(\type\ \arg,\dots) \{&function definition\cr \quad\statements\cr \quad return \value;\cr \}\cr @@ -346,35 +346,36 @@ do \statement \endexample \section{Arrays} -\metax{array}{\type[]\ \name} -\metax{array element i}{\name[i]} -\metax{anonymous array}{new \type[\dim]} -\metax{array containing n deep copies of x}{array(n,x)} -\metax{length}{\name.length} -\metax{cyclic flag}{\name.cyclic} -\metax{pop element {\tt x}}{\name.pop()} -\metax{push element {\tt x}}{\name.push(x)} -\metax{append array {\tt a}}{\name.append(a)} -\metax{insert rest arguments at index {\tt i}}{\name.insert(i,\dots)} -\metax{delete element at index {\tt i}}{\name.delete(i)} -\metax{delete elements with indices in [{\tt i},{\tt j}]}{\name.delete(i,j)} -\metax{delete all elements}{\name.delete()} -\metax{test whether element n is initialized}{\name.initialized(n)} -\metax{array of indices of initialized elements}{\name.keys} -\metax{complement of int array in {\tt \{0,\dots,n-1\}}}{complement(a,n)} -\metax{deep copy of array {\tt a}}{copy(a)} -\metax{array {\tt \{0,1,\dots,n-1\}}}{sequence(n)} -\metax{array {\tt \{n,n+1,\dots,m\}}}{sequence(n,m)} -\metax{array {\tt \{n-1,n-2,\dots,0\}}}{reverse(n)} -\metax{array {\tt \{f(0),f(1),\dots,f(n-1)\}}}{sequence(f,n)} -\metax{array obtained by applying {\tt f} to array {\tt a}}{map(f,a)} -\metax{uniform partition of [{\tt a},{\tt b}] into n intervals}{uniform(a,b,n)} -\metax{concat specified 1D arrays}{concat(a,b,\dots)} -\metax{return sorted array}{sort(a)} -\metax{return array sorted using ordering {\tt less}}{sort(a,{\tt less})} -\metax{search sorted array {\tt a} for key}{search(a,key)} -\metax{index of first true value of bool array {\tt a}}{find(a)} -\metax{index of nth true value of bool array {\tt a}}{find(a,n)} +\key{array}{\type[]\ \name;} +\key{array element i}{\name[i]} +\key{array indexed by elements of int array {\tt A}}{\name[A]} +\key{anonymous array}{new \type[\dim]} +\key{array containing {\tt n} deep copies of {\tt x}}{array(n,x)} +\key{length}{\name.length} +\key{cyclic flag}{\name.cyclic} +\key{pop element {\tt x}}{\name.pop()} +\key{push element {\tt x}}{\name.push(x)} +\key{append array {\tt a}}{\name.append(a)} +\key{insert rest arguments at index {\tt i}}{\name.insert(i,\dots)} +\key{delete element at index {\tt i}}{\name.delete(i)} +\key{delete elements with indices in [{\tt i},{\tt j}]}{\name.delete(i,j)} +\key{delete all elements}{\name.delete()} +\key{test whether element n is initialized}{\name.initialized(n)} +\key{array of indices of initialized elements}{\name.keys} +\key{complement of int array in {\tt \{0,\dots,n-1\}}}{complement(a,n)} +\key{deep copy of array {\tt a}}{copy(a)} +\key{array {\tt \{0,1,\dots,n-1\}}}{sequence(n)} +\key{array {\tt \{n,n+1,\dots,m\}}}{sequence(n,m)} +\key{array {\tt \{n-1,n-2,\dots,0\}}}{reverse(n)} +\key{array {\tt \{f(0),f(1),\dots,f(n-1)\}}}{sequence(f,n)} +\key{array obtained by applying {\tt f} to array {\tt a}}{map(f,a)} +\key{uniform partition of [{\tt a},{\tt b}] into n intervals}{uniform(a,b,n)} +\key{concat specified 1D arrays}{concat(a,b,\dots)} +\key{return sorted array}{sort(a)} +\key{return array sorted using ordering {\tt less}}{sort(a,{\tt less})} +\key{search sorted array {\tt a} for key}{search(a,key)} +\key{index of first true value of bool array {\tt a}}{find(a)} +\key{index of nth true value of bool array {\tt a}}{find(a,n)} \section{Initialization} \key{initialize variable}{\type\ \name=\value;} @@ -472,7 +473,7 @@ do \statement \key{arclength of path {\tt p}}{arclength(p)} \key{time at which {\tt arclength(p)=L}}{arctime(p,L)} \key{point on path {\tt p} at arclength {\tt L}}{arcpoint(p,L)} -\key{first value {\tt t} at which {\tt dir(p,t)=z}}{dir(p,z)} +\key{first value {\tt t} at which {\tt dir(p,t)=z}}{dirtime(p,z)} \key{time {\tt t} at relative fraction {\tt l} of {\tt arclength(p)}}{reltime(p,l)} \key{point at relative fraction {\tt l} of {\tt arclength(p)}}{relpoint(p,l)} \key{point midway along arclength of {\tt p}}{midpoint(p)} @@ -542,7 +543,7 @@ s},string [][] table)} %%%%%%%%%%%%%%%%%%%%%%%%%% END LIBRARIES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This goes at the bottom of the last page (column 6) -%\copyrightnotice +\copyrightnotice % \bye diff --git a/Build/source/utils/asymptote/doc/asymptote.pdf b/Build/source/utils/asymptote/doc/asymptote.pdf Binary files differindex 914215456fb..d6463b5390c 100644 --- a/Build/source/utils/asymptote/doc/asymptote.pdf +++ b/Build/source/utils/asymptote/doc/asymptote.pdf diff --git a/Build/source/utils/asymptote/doc/asymptote.sty b/Build/source/utils/asymptote/doc/asymptote.sty index 4433f6d607e..4a2f484caad 100644 --- a/Build/source/utils/asymptote/doc/asymptote.sty +++ b/Build/source/utils/asymptote/doc/asymptote.sty @@ -17,7 +17,7 @@ %% Licence: GPL2+ %% \ProvidesPackage{asymptote} - [2011/11/29 v1.26 Asymptote style file for LaTeX] + [2012/08/25 v1.27 Asymptote style file for LaTeX] \def\Asymptote{{\tt Asymptote}} \InputIfFileExists{\jobname.pre}{}{} \newbox\ASYbox @@ -345,6 +345,7 @@ }% }{% \PackageWarning{asymptote}{file #2 not found}% + \def\@tempa{}% }% }% \immediate\write\AsyStream{\unexpanded\expandafter{\@tempa}}% diff --git a/Build/source/utils/asymptote/doc/asymptote.texi b/Build/source/utils/asymptote/doc/asymptote.texi index 8f87a2eae0e..bd245e2c3cc 100644 --- a/Build/source/utils/asymptote/doc/asymptote.texi +++ b/Build/source/utils/asymptote/doc/asymptote.texi @@ -584,7 +584,7 @@ cd asymptote-x.xx @end verbatim By default the system version of the Boehm garbage collector will be used; if it is old we recommend first putting -@url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2b.tar.gz} +@url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2d.tar.gz} in the @code{Asymptote} source directory. @cindex @code{freeglut} @@ -2468,7 +2468,7 @@ reaches its minimal horizontal and vertical extents, respectively. @cindex @code{maxtimes} @item real[] maxtimes(path p) -returns an array of length 2 containing the times at which path @code{p} +returns an array of length 2 containing times at which path @code{p} reaches its maximal horizontal and vertical extents, respectively. @cindex @code{intersectionpoint} @@ -4948,7 +4948,7 @@ also defined. @cindex @code{F} @cindex @code{E} @cindex @code{P} -@cindex @code{sndncn} +@cindex @code{sncndn} @cindex @code{Ei} @cindex @code{Si} @cindex @code{Ci} @@ -4966,7 +4966,7 @@ defines the airy functions @code{Ai(real)}, @code{J(real, real)}, @code{Y(real, real)}, @code{I(real, real)}, @code{K(real, real)}, @code{zero_J(real, int)}, the elliptic functions @code{F(real, real)}, @code{E(real, real)}, and @code{P(real, real)}, -the Jacobi elliptic functions @code{real[] sndncn(real,real)}, +the Jacobi elliptic functions @code{real[] sncndn(real,real)}, the exponential/trigonometric integrals @code{Ei}, @code{Si}, and @code{Ci}, the Legendre polynomials @code{Pl(int, real)}, and the Riemann zeta function @code{zeta(real)}. For example, to compute the sine integral @@ -6461,45 +6461,23 @@ as described here: This module provides an interface to the @code{LaTeX} package (included with @code{MikTeX}) @quotation -@url{http://www.ctan.org/tex-archive/macros/latex/contrib/movie15} +@url{http://www.ctan.org/tex-archive/macros/latex/contrib/media9} @end quotation @noindent for embedding movies, sounds, and 3D objects into a @acronym{PDF} document. -@noindent -@cindex @code{xelatex} -However, @code{XeLaTeX} users need to rename the modified version -@code{movie15_dvipdfmx.sty} from -@quotation -@url{http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/patches/} -@end quotation -to @code{movie15.sty} and place it in their @code{LaTeX} path. - -The latest version of the @code{movie15} package requires both -@code{pdflatex} version 1.20 or later and the file -@quotation -@url{http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/ifdraft.dtx} -@end quotation -@noindent -which can be installed by placing it in a directory @code{ifdraft} in -the local @code{LaTeX} directory -(e.g.@ @code{/usr/local/share/texmf/tex/latex/ifdraft}) and executing in that -directory the commands: -@verbatim -tex ifdraft.dtx -texhash -@end verbatim +Version 0.13 (2012/09/12) of @code{media9} or later is required. @cindex @code{external} A more portable method for embedding movie files, which should work on any -platform and does not require the @code{movie15} or @code{ifdraft} -packages, is provided by using the @code{external} module instead of -@code{embed}. An example of these -interfaces is provided in the file @code{embeddedmovie.asy} and -@code{externalmovie.asy} in the @code{animations} subdirectory of the -examples directory. For a higher quality movie generated directly by -@code{Asymptote}, use the @code{animate} module along with the -@code{animate.sty} package to embed a portable @acronym{PDF} animation -(@pxref{animate}). +platform and does not require the @code{media9} package, is provided +by using the @code{external} module instead of @code{embed}. + +Examples of the above two interfaces is provided in the file +@code{embeddedmovie.asy} and @code{externalmovie.asy} in the +@code{animations} subdirectory of the examples directory. For a higher +quality embedded movie generated directly by @code{Asymptote}, use the +@code{animate} module along with the @code{animate.sty} package to +embed a portable @acronym{PDF} animation (@pxref{animate}). @cindex @code{U3D} An example of embedding @code{U3D} code is provided in the file @@ -7026,6 +7004,7 @@ or horizontal lines and axes at arbitrary locations. @item @verbatim void axes(picture pic=currentpicture, Label xlabel="", Label ylabel="", + bool extend=true, pair min=(-infinity,-infinity), pair max=(infinity,infinity), pen p=currentpen, arrowbar arrow=None, bool above=false); @end verbatim @@ -7735,6 +7714,24 @@ connected) regions bounded (according to the @code{zerowinding} fill rule) by simple cyclic paths (intersecting only at the endpoints) into subregions bounded by cyclic paths of length @code{4} or less. +A more efficient routine also exists for drawing tessellations +composed of many 3D triangles, with specified vertices, and optional +normals or vertex colors: +@cindex @code{draw} +@cindex @code{triangles} +@cindex @code{tessellation} +@verbatim +void draw(picture pic=currentpicture, triple[] v, int[][] vi, + triple[] n={}, int[][] ni={}, material m=currentpen, pen[] p={}, + int[][] pi={}, light light=currentlight); +@end verbatim +Here, the triple array @code{v} lists the distinct vertices, while +the array @code{vi} lists integer arrays of length 3 containing +the indices of @code{v} corresponding to the vertices of each +triangle. Similarly, the arguments @code{n} and @code{ni} contain +optional normal data and @code{p} and @code{pi} contain optional pen vertex data. +An example of this tessellation facility is given in @code{triangles.asy}. + @cindex @code{thin} @cindex @code{thick} @cindex @code{tube} @@ -7864,8 +7861,8 @@ In addition to the default @code{settings.prc=true}, this requires line option @code{-f pdf}, put in the @code{Asymptote} configuration file (@pxref{configuration file}), or specified in the script before @code{three.asy} (or @code{graph3.asy}) is imported. -Version 2008/10/08 or later of the @code{movie15} package is also -required (@pxref{embed}). The example @code{pdb.asy} illustrates +The @code{media9} LaTeX package is also required (@pxref{embed}). +The example @code{pdb.asy} illustrates how one can generate a list of predefined views (see @code{100d.views}). A stationary preview image with a resolution of @code{n} pixels per @code{bp} can be embedded with the setting @code{render=n}; this allows @@ -8451,6 +8448,7 @@ There is also a routine for drawing all three axis: @verbatim void axes3(picture pic=currentpicture, Label xlabel="", Label ylabel="", Label zlabel="", + bool extend=false, triple min=(-infinity,-infinity,-infinity), triple max=(infinity,infinity,infinity), pen p=currentpen, arrowbar3 arrow=None); @@ -9547,7 +9545,7 @@ Mark Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: dirtime currentpen colorspaces grayscale cmyk defaultpen x cx @c LocalWords: linetype longdashed dashdotted longdashdotted linewidth y XP @c LocalWords: fontsize defaultfilename keepAspect IgnoreAspect ise flushleft -@c LocalWords: src dest XDR txt getc fout stdin stdout endl eof js prc +@c LocalWords: src dest XDR txt getc fout stdin stdout endl eof js prc ni @c LocalWords: Microsystem's eol exponentials postfix sayhi th Ubuntu @c LocalWords: sqr intop addby libm asin acos atan sinh tanh asinh acosh cbrt @c LocalWords: atanh fabs hypot fmod ceil srand dereferenced alice pete sqrtx @@ -9685,7 +9683,7 @@ Mark Henning, Steve Melenchuk, Martin Wiebusch, and Stefan Knorr. @c LocalWords: defaultrender Vidiassov latexmkrc mktemp DOSendl DOSnewl perl @c LocalWords: filename asyinclude latemk penfunctionimage Affine decrement @c LocalWords: affine Redisplay redisplay isnan radians defaultseparator Jens -@c LocalWords: ascii piecewise arcpoint spacings tilings sndncn resizing +@c LocalWords: ascii piecewise arcpoint spacings tilings sncndn resizing @c LocalWords: differentiable vectorization vectorized asydir normals quartic @c LocalWords: wavepacket kerned parametrized specular hyperboloid Bourke's @c LocalWords: Michail diff --git a/Build/source/utils/asymptote/doc/binarytreetest.asy b/Build/source/utils/asymptote/doc/binarytreetest.asy index 0078bb749e0..af55292e4a3 100644 --- a/Build/source/utils/asymptote/doc/binarytreetest.asy +++ b/Build/source/utils/asymptote/doc/binarytreetest.asy @@ -3,10 +3,10 @@ import binarytree; picture pic,pic2; binarytree bt=binarytree(1,2,4,nil,5,nil,nil,0,nil,nil,3,6,nil,nil,7); -draw(pic,bt); +draw(pic,bt,condensed=false); binarytree st=searchtree(10,5,2,1,3,4,7,6,8,9,15,13,12,11,14,17,16,18,19); -draw(pic2,st,blue); +draw(pic2,st,blue,condensed=true); add(pic.fit(),(0,0),10N); add(pic2.fit(),(0,0),10S); diff --git a/Build/source/utils/asymptote/doc/loggraph.asy b/Build/source/utils/asymptote/doc/loggraph.asy index edd9d3e0a67..d496fba1624 100644 --- a/Build/source/utils/asymptote/doc/loggraph.asy +++ b/Build/source/utils/asymptote/doc/loggraph.asy @@ -8,8 +8,7 @@ scale(Log,Log); draw(graph(f,0.1,10)); -//xlimits(1,10,Crop); -//ylimits(0.1,1,Crop); +//limits((1,0.1),(10,0.5),Crop); dot(Label("(3,5)",align=S),Scale((3,5))); diff --git a/Build/source/utils/asymptote/doc/ocg.sty b/Build/source/utils/asymptote/doc/ocg.sty index 3ba555b58e8..87da828a8d2 100644 --- a/Build/source/utils/asymptote/doc/ocg.sty +++ b/Build/source/utils/asymptote/doc/ocg.sty @@ -1,8 +1,10 @@ %% Copyright (C) 2007 by Michael Ritzert <michael.ritz...@gmail.com> %% Spurious spaces removed by John Bowman [2009/06/01]. +%% Global macros to find the number of a PDF OCG object from its LaTeX +%% reference contributed by Paul Gaborit [2012/09/13]. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ocg}[2009/06/01] +\ProvidesPackage{ocg}[2012/09/13] \RequirePackage{ifpdf} \ifpdf @@ -37,6 +39,7 @@ \expandafter\gdef\csname OCG#2\endcsname{#1}% \immediate\pdfobj{<< /Type /OCG /Name (#1) >>}% new ocg \xdef\@ocg@curocg{\the\pdflastobj\space 0 R}% reference to id + \expandafter\xdef\csname OCGpdfobj#2\endcsname{\@ocg@curocg} \xdef\@ocg@ocgs{\@ocg@ocgs\space\@ocg@curocg}% list of all OCGs in "first defined" order \ifnum#3=1 %on \xdef\@ocg@ocgson{\@ocg@ocgson\space\@ocg@curocg}% list of all default-on OCGs diff --git a/Build/source/utils/asymptote/doc/parametricgraph.asy b/Build/source/utils/asymptote/doc/parametricgraph.asy index a5688a6f9dd..61c219d8104 100644 --- a/Build/source/utils/asymptote/doc/parametricgraph.asy +++ b/Build/source/utils/asymptote/doc/parametricgraph.asy @@ -7,8 +7,7 @@ real y(real t) {return sin(2pi*t);} draw(graph(x,y,0,1)); -//xlimits(0,1,Crop); -//ylimits(-1,0,Crop); +//limits((0,-1),(1,0),Crop); xaxis("$x$",BottomTop,LeftTicks); yaxis("$y$",LeftRight,RightTicks(trailingzero)); diff --git a/Build/source/utils/asymptote/doc/png/asymptote.info b/Build/source/utils/asymptote/doc/png/asymptote.info index ee7d4f40b51..5b88055da4c 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 2.16. +This file documents `Asymptote', version 2.21. `http://asymptote.sourceforge.net' @@ -23,7 +23,7 @@ File: asymptote.info, Node: Top, Next: Description, Up: (dir) Asymptote ********* -This file documents `Asymptote', version 2.16. +This file documents `Asymptote', version 2.21. `http://asymptote.sourceforge.net' @@ -499,7 +499,7 @@ tar -xf asymptote-x.xx.src.tar cd asymptote-x.xx By default the system version of the Boehm garbage collector will be used; if it is old we recommend first putting -`http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2b.tar.gz' +`http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.2d.tar.gz' in the `Asymptote' source directory. If your graphics card supports multisampling, we recommend using version @@ -1978,8 +1978,8 @@ File: asymptote.info, Node: Paths and guides, Next: Pens, Prev: Data types, respectively. `real[] maxtimes(path p)' - returns an array of length 2 containing the times at which - path `p' reaches its maximal horizontal and vertical extents, + returns an array of length 2 containing times at which path + `p' reaches its maximal horizontal and vertical extents, respectively. `pair intersectionpoint(path p, path q, real fuzz=-1);' @@ -3852,7 +3852,7 @@ module `gsl' that defines the airy functions `Ai(real)', `Bi(real)', `i_scaled(int, real)', `k_scaled(int, real)', `J(real, real)', `Y(real, real)', `I(real, real)', `K(real, real)', `zero_J(real, int)', the elliptic functions `F(real, real)', `E(real, real)', and `P(real, -real)', the Jacobi elliptic functions `real[] sndncn(real,real)', the +real)', the Jacobi elliptic functions `real[] sncndn(real,real)', the exponential/trigonometric integrals `Ei', `Si', and `Ci', the Legendre polynomials `Pl(int, real)', and the Riemann zeta function `zeta(real)'. For example, to compute the sine integral `Si' of 1.0: @@ -5145,10 +5145,10 @@ import binarytree; picture pic,pic2; binarytree bt=binarytree(1,2,4,nil,5,nil,nil,0,nil,nil,3,6,nil,nil,7); -draw(pic,bt); +draw(pic,bt,condensed=false); binarytree st=searchtree(10,5,2,1,3,4,7,6,8,9,15,13,12,11,14,17,16,18,19); -draw(pic2,st,blue); +draw(pic2,st,blue,condensed=true); add(pic.fit(),(0,0),10N); add(pic2.fit(),(0,0),10S); @@ -5236,33 +5236,19 @@ File: asymptote.info, Node: embed, Next: slide, Prev: animation, Up: Base mo This module provides an interface to the `LaTeX' package (included with `MikTeX') - `http://www.ctan.org/tex-archive/macros/latex/contrib/movie15' - for embedding movies, sounds, and 3D objects into a PDF document. However, -`XeLaTeX' users need to rename the modified version -`movie15_dvipdfmx.sty' from - - `http://asymptote.svn.sourceforge.net/viewvc/asymptote/trunk/asymptote/patches/' - to `movie15.sty' and place it in their `LaTeX' path. - - The latest version of the `movie15' package requires both `pdflatex' -version 1.20 or later and the file - - `http://www.ctan.org/tex-archive/macros/latex/contrib/oberdiek/ifdraft.dtx' - which can be installed by placing it in a directory `ifdraft' in the -local `LaTeX' directory (e.g. -`/usr/local/share/texmf/tex/latex/ifdraft') and executing in that -directory the commands: -tex ifdraft.dtx -texhash + `http://www.ctan.org/tex-archive/macros/latex/contrib/media9' + for embedding movies, sounds, and 3D objects into a PDF document. +Version 0.13 (2012/09/12) of `media9' or later is required. A more portable method for embedding movie files, which should work -on any platform and does not require the `movie15' or `ifdraft' -packages, is provided by using the `external' module instead of -`embed'. An example of these interfaces is provided in the file +on any platform and does not require the `media9' package, is provided +by using the `external' module instead of `embed'. + + Examples of the above two interfaces is provided in the file `embeddedmovie.asy' and `externalmovie.asy' in the `animations' -subdirectory of the examples directory. For a higher quality movie -generated directly by `Asymptote', use the `animate' module along with -the `animate.sty' package to embed a portable PDF animation (*note +subdirectory of the examples directory. For a higher quality embedded +movie generated directly by `Asymptote', use the `animate' module along +with the `animate.sty' package to embed a portable PDF animation (*note animate::). An example of embedding `U3D' code is provided in the file @@ -5703,6 +5689,7 @@ following routines: vertical or horizontal lines and axes at arbitrary locations. * void axes(picture pic=currentpicture, Label xlabel="", Label ylabel="", + bool extend=true, pair min=(-infinity,-infinity), pair max=(infinity,infinity), pen p=currentpen, arrowbar arrow=None, bool above=false); This convenience routine draws both x and y axes on picture `pic' @@ -6050,8 +6037,7 @@ following routines: draw(graph(x,y,0,1)); - //xlimits(0,1,Crop); - //ylimits(-1,0,Crop); + //limits((0,-1),(1,0),Crop); xaxis("$x$",BottomTop,LeftTicks); yaxis("$y$",LeftRight,RightTicks(trailingzero)); @@ -6119,8 +6105,7 @@ following routines: draw(graph(f,0.1,10)); - //xlimits(1,10,Crop); - //ylimits(0.1,1,Crop); + //limits((1,0.1),(10,0.5),Crop); dot(Label("(3,5)",align=S),Scale((3,5))); @@ -6746,6 +6731,19 @@ regions bounded (according to the `zerowinding' fill rule) by simple cyclic paths (intersecting only at the endpoints) into subregions bounded by cyclic paths of length `4' or less. + A more efficient routine also exists for drawing tessellations +composed of many 3D triangles, with specified vertices, and optional +normals or vertex colors: +void draw(picture pic=currentpicture, triple[] v, int[][] vi, + triple[] n={}, int[][] ni={}, material m=currentpen, pen[] p={}, + int[][] pi={}, light light=currentlight); + Here, the triple array `v' lists the distinct vertices, while the +array `vi' lists integer arrays of length 3 containing the indices of +`v' corresponding to the vertices of each triangle. Similarly, the +arguments `n' and `ni' contain optional normal data and `p' and `pi' +contain optional pen vertex data. An example of this tessellation +facility is given in `triangles.asy'. + Arbitrary thick three-dimensional curves and line caps (which the `OpenGL' standard does not require implementations to provide) are constructed with @@ -6873,18 +6871,18 @@ There are four choices for viewing 3D `Asymptote' output: `settings.outformat="pdf"', which can be specified by the command line option `-f pdf', put in the `Asymptote' configuration file (*note configuration file::), or specified in the script before - `three.asy' (or `graph3.asy') is imported. Version 2008/10/08 or - later of the `movie15' package is also required (*note embed::). - The example `pdb.asy' illustrates how one can generate a list of - predefined views (see `100d.views'). A stationary preview image - with a resolution of `n' pixels per `bp' can be embedded with the - setting `render=n'; this allows the file to be viewed with other - `PDF' viewers. Alternatively, the file `externalprc.tex' - illustrates how the resulting PRC and rendered image files can be - extracted and processed in a separate `LaTeX' file. However, see - *note LaTeX usage:: for an easier way to embed three-dimensional - `Asymptote' pictures within `LaTeX'. The open-source PRC - specification is available from + `three.asy' (or `graph3.asy') is imported. The `media9' LaTeX + package is also required (*note embed::). The example `pdb.asy' + illustrates how one can generate a list of predefined views (see + `100d.views'). A stationary preview image with a resolution of + `n' pixels per `bp' can be embedded with the setting `render=n'; + this allows the file to be viewed with other `PDF' viewers. + Alternatively, the file `externalprc.tex' illustrates how the + resulting PRC and rendered image files can be extracted and + processed in a separate `LaTeX' file. However, see *note LaTeX + usage:: for an easier way to embed three-dimensional `Asymptote' + pictures within `LaTeX'. The open-source PRC specification is + available from `http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/API_References/PRCReference/PRC_Format_Specification/'. 4. Project the scene to a two-dimensional vector (EPS or PDF) format @@ -7289,6 +7287,7 @@ axes in three dimensions. There is also a routine for drawing all three axis: void axes3(picture pic=currentpicture, Label xlabel="", Label ylabel="", Label zlabel="", + bool extend=false, triple min=(-infinity,-infinity,-infinity), triple max=(infinity,infinity,infinity), pen p=currentpen, arrowbar3 arrow=None); @@ -7944,6 +7943,7 @@ Options (negate by replacing - with -no): -autoplain Enable automatic importing of plain [true] -autoplay Autoplay 3D animations [false] -autorotate Enable automatic PDF page rotation [false] +-axes3 Show 3D axes in PDF output [true] -batchMask Mask fpu exceptions in batch mode [false] -batchView View output in batch mode [false] -bw Convert all colors to black and white [false] @@ -8492,9 +8492,9 @@ Index * ---: Bezier curves. (line 83) * -=: Self & prefix operators. (line 6) -* -c: Options. (line 174) -* -l: Options. (line 193) -* -u: Options. (line 184) +* -c: Options. (line 175) +* -l: Options. (line 194) +* -u: Options. (line 185) * -V <1>: Tutorial. (line 19) * -V: Configuring. (line 6) * ..: Tutorial. (line 127) @@ -8506,7 +8506,7 @@ Index * 2D graphs: graph. (line 6) * 3D graphs: graph3. (line 6) * 3D grids: grid3. (line 6) -* 3D PostScript: three. (line 581) +* 3D PostScript: three. (line 594) * 3D rendering: Compiling from UNIX source. (line 16) * :: Arithmetic & logical. @@ -8535,7 +8535,7 @@ Index * abs <1>: Mathematical functions. (line 35) * abs: Data types. (line 62) -* accel <1>: three. (line 507) +* accel <1>: three. (line 520) * accel: Paths and guides. (line 115) * access: Import. (line 6) * acknowledgments: Credits. (line 6) @@ -8545,9 +8545,9 @@ Index (line 6) * acosh: Mathematical functions. (line 6) -* add <1>: three. (line 271) +* add <1>: three. (line 284) * add: Frames and pictures. (line 196) -* addViews: three. (line 393) +* addViews: three. (line 406) * adjust: Pens. (line 115) * Ai: Mathematical functions. (line 48) @@ -8557,7 +8557,7 @@ Index (line 48) * alias <1>: Arrays. (line 181) * alias: Structures. (line 52) -* align: Options. (line 168) +* align: Options. (line 169) * Align: label. (line 12) * all: Arrays. (line 329) * Allow: Pens. (line 327) @@ -8570,23 +8570,23 @@ Index * animate: Configuring. (line 67) * animation: animation. (line 6) * annotate: annotate. (line 6) -* antialias <1>: Options. (line 143) -* antialias: three. (line 210) +* antialias <1>: Options. (line 144) +* antialias: three. (line 223) * antialiasing: Compiling from UNIX source. (line 16) * append <1>: Arrays. (line 39) * append: Files. (line 36) -* arc: three. (line 283) +* arc: three. (line 296) * Arc: Paths and guides. (line 32) * arc: Paths and guides. (line 22) * ArcArrow: draw. (line 26) -* ArcArrow3: three. (line 548) +* ArcArrow3: three. (line 561) * ArcArrows: draw. (line 26) -* ArcArrows3: three. (line 548) -* arclength <1>: three. (line 507) +* ArcArrows3: three. (line 561) +* arclength <1>: three. (line 520) * arclength: Paths and guides. (line 142) * arcpoint: Paths and guides. (line 152) -* arctime <1>: three. (line 507) +* arctime <1>: three. (line 520) * arctime: Paths and guides. (line 146) * arguments: Default arguments. (line 6) * arithmetic operators: Arithmetic & logical. @@ -8598,10 +8598,10 @@ Index * Arrow: draw. (line 26) * arrow: Drawing commands. (line 31) * arrow keys: Tutorial. (line 37) -* Arrow3: three. (line 548) +* Arrow3: three. (line 561) * Arrows: draw. (line 26) * arrows: draw. (line 26) -* Arrows3: three. (line 548) +* Arrows3: three. (line 561) * as: Import. (line 68) * ascii: Data types. (line 286) * aSin: Mathematical functions. @@ -8620,7 +8620,7 @@ Index * asyinclude: LaTeX usage. (line 46) * asymptote.sty: LaTeX usage. (line 6) * asymptote.xml: Editing modes. (line 49) -* ASYMPTOTE_CONFIG: Options. (line 115) +* ASYMPTOTE_CONFIG: Options. (line 116) * aTan: Mathematical functions. (line 20) * atan: Mathematical functions. @@ -8630,22 +8630,22 @@ Index * atanh: Mathematical functions. (line 6) * atleast: Bezier curves. (line 56) -* attach <1>: graph. (line 415) +* attach <1>: graph. (line 416) * attach: LaTeX usage. (line 51) -* autoadjust: three. (line 359) -* autoimport: Options. (line 111) +* autoadjust: three. (line 372) +* autoimport: Options. (line 112) * automatic scaling: graph. (line 682) * axialshade: fill. (line 43) -* axis <1>: graph3. (line 66) -* axis: graph. (line 880) +* axis <1>: graph3. (line 67) +* axis: graph. (line 879) * azimuth: Data types. (line 126) * babel: babel. (line 6) * background color: Frames and pictures. (line 168) -* BackView: three. (line 386) +* BackView: three. (line 399) * Bar: draw. (line 19) -* Bar3: three. (line 548) +* Bar3: three. (line 561) * Bars: draw. (line 19) -* Bars3: three. (line 548) +* Bars3: three. (line 561) * barsize: draw. (line 19) * base modules: Base modules. (line 6) * basealign: Pens. (line 168) @@ -8653,18 +8653,18 @@ Index * batch mode: Tutorial. (line 6) * beep: Data types. (line 357) * BeginArcArrow: draw. (line 26) -* BeginArcArrow3: three. (line 548) +* BeginArcArrow3: three. (line 561) * BeginArrow: draw. (line 26) -* BeginArrow3: three. (line 548) +* BeginArrow3: three. (line 561) * BeginBar: draw. (line 19) -* BeginBar3: three. (line 548) +* BeginBar3: three. (line 561) * BeginDotMargin: draw. (line 42) -* BeginDotMargin3: three. (line 564) +* BeginDotMargin3: three. (line 577) * BeginMargin: draw. (line 42) -* BeginMargin3: three. (line 564) +* BeginMargin3: three. (line 577) * BeginPenMargin: draw. (line 42) -* BeginPenMargin2: three. (line 564) -* BeginPenMargin3: three. (line 564) +* BeginPenMargin2: three. (line 577) +* BeginPenMargin3: three. (line 577) * BeginPoint: label. (line 56) * Bessel: Mathematical functions. (line 48) @@ -8676,13 +8676,13 @@ Index (line 48) * Bi_deriv: Mathematical functions. (line 48) -* Billboard: three. (line 477) +* Billboard: three. (line 490) * binary: Files. (line 75) * binary format: Files. (line 75) * binary operators: Arithmetic & logical. (line 6) * binarytree: binarytree. (line 6) -* black stripes: three. (line 210) +* black stripes: three. (line 223) * Blank: draw. (line 26) * block.bottom: flowchart. (line 19) * block.bottomleft: flowchart. (line 19) @@ -8701,16 +8701,16 @@ Index (line 6) * Bottom: graph. (line 134) * BottomTop: graph. (line 140) -* BottomView: three. (line 386) +* BottomView: three. (line 399) * bounding box: Frames and pictures. (line 168) -* Bounds: graph3. (line 20) -* box <1>: three. (line 305) +* Bounds: graph3. (line 21) +* box <1>: three. (line 318) * box: Frames and pictures. (line 22) * bp: Tutorial. (line 26) * break: Programming. (line 29) * breakpoints: Debugger. (line 21) * brick: Pens. (line 251) -* broken axis: graph. (line 783) +* broken axis: graph. (line 782) * bug reports: Help. (line 23) * buildcycle: Paths and guides. (line 258) * Button-1: GUI. (line 6) @@ -8720,14 +8720,14 @@ Index * C string: Data types. (line 191) * CAD: CAD. (line 6) * calculateTransform: Frames and pictures. (line 107) -* camera: three. (line 354) +* camera: three. (line 367) * casts: Casts. (line 6) * cbrt: Mathematical functions. (line 6) * cd: Files. (line 25) * ceil: Mathematical functions. (line 26) -* center: three. (line 338) +* center: three. (line 351) * Center: label. (line 61) * checker: Pens. (line 251) * Chinese: unicode. (line 12) @@ -8736,7 +8736,7 @@ Index * Ci: Mathematical functions. (line 48) * circle <1>: flowchart. (line 64) -* circle: three. (line 279) +* circle: three. (line 292) * Circle: Paths and guides. (line 17) * circle: Paths and guides. (line 10) * circlebarframe: markers. (line 18) @@ -8770,13 +8770,13 @@ Index * conditional <1>: Arithmetic & logical. (line 73) * conditional: Programming. (line 8) -* config: Options. (line 115) -* configuration file <1>: Options. (line 115) +* config: Options. (line 116) +* configuration file <1>: Options. (line 116) * configuration file: Configuring. (line 23) * configuring: Configuring. (line 6) * conj: Data types. (line 59) * constructors: Structures. (line 91) -* context: Options. (line 143) +* context: Options. (line 144) * continue <1>: Debugger. (line 31) * continue: Programming. (line 29) * contour: contour. (line 9) @@ -8784,11 +8784,11 @@ Index * controls <1>: three. (line 6) * controls: Bezier curves. (line 45) * controlSpecifier: Paths and guides. (line 382) -* convert <1>: Options. (line 143) +* convert <1>: Options. (line 144) * convert <2>: animation. (line 6) * convert <3>: Files. (line 154) * convert: Configuring. (line 67) -* convertOptions: Options. (line 130) +* convertOptions: Options. (line 131) * Coons shading: fill. (line 74) * copy: Arrays. (line 174) * Cos: Mathematical functions. @@ -8798,9 +8798,9 @@ Index * cosh: Mathematical functions. (line 6) * cputime: Structures. (line 169) -* crop: graph. (line 636) -* cropping graphs: graph. (line 636) -* cross <1>: graph. (line 484) +* crop: graph. (line 637) +* cropping graphs: graph. (line 637) +* cross <1>: graph. (line 485) * cross: Data types. (line 169) * crossframe: markers. (line 23) * crosshatch: Pens. (line 267) @@ -8812,15 +8812,15 @@ Index * curl: Bezier curves. (line 63) * curlSpecifier: Paths and guides. (line 394) * currentpen: Pens. (line 6) -* currentprojection: three. (line 383) +* currentprojection: three. (line 396) * curve: slopefield. (line 20) * custom axis types: graph. (line 144) -* custom mark routine: graph. (line 576) +* custom mark routine: graph. (line 577) * custom tick locations: graph. (line 249) * cut: Paths and guides. (line 240) * cycle <1>: three. (line 6) * cycle: Tutorial. (line 75) -* cyclic <1>: three. (line 507) +* cyclic <1>: three. (line 520) * cyclic <2>: Arrays. (line 39) * cyclic: Paths and guides. (line 74) * Cyrillic: unicode. (line 7) @@ -8836,7 +8836,7 @@ Index * default arguments: Default arguments. (line 6) * defaultformat: graph. (line 175) * DefaultHead: draw. (line 26) -* DefaultHead3: three. (line 548) +* DefaultHead3: three. (line 561) * defaultpen: Pens. (line 46) * defaultrender: three. (line 47) * deferred drawing: simplex. (line 6) @@ -8851,7 +8851,7 @@ Index * diagonal: Arrays. (line 303) * diamond: flowchart. (line 57) * dimension: Arrays. (line 367) -* dir <1>: three. (line 507) +* dir <1>: three. (line 520) * dir <2>: Paths and guides. (line 98) * dir <3>: Data types. (line 87) * dir: Search paths. (line 10) @@ -8867,12 +8867,13 @@ Index * dot <2>: Data types. (line 100) * dot: draw. (line 83) * DotMargin: draw. (line 42) -* DotMargin3: three. (line 564) +* DotMargin3: three. (line 577) * DotMargins: draw. (line 42) -* DotMargins3: three. (line 564) +* DotMargins3: three. (line 577) * dotted: Pens. (line 95) -* double deferred drawing: three. (line 256) +* double deferred drawing: three. (line 269) * double precision: Files. (line 75) +* draw: three. (line 112) * Draw: Frames and pictures. (line 147) * draw: draw. (line 110) * Draw: draw. (line 26) @@ -8881,7 +8882,7 @@ Index * drawline: math. (line 9) * drawtree: drawtree. (line 9) * dvips: Configuring. (line 67) -* dvipsOptions: Options. (line 130) +* dvipsOptions: Options. (line 131) * dvisvgm: Configuring. (line 67) * E <1>: Mathematical functions. (line 48) @@ -8896,22 +8897,22 @@ Index * else: Programming. (line 8) * emacs: Editing modes. (line 6) * embed: embed. (line 6) -* Embedded: three. (line 477) +* Embedded: three. (line 490) * empty: Frames and pictures. (line 7) * EndArcArrow: draw. (line 26) -* EndArcArrow3: three. (line 548) +* EndArcArrow3: three. (line 561) * EndArrow: draw. (line 26) -* EndArrow3: three. (line 548) +* EndArrow3: three. (line 561) * EndBar: draw. (line 19) -* EndBar3: three. (line 548) +* EndBar3: three. (line 561) * EndDotMargin: draw. (line 42) -* EndDotMargin3: three. (line 564) +* EndDotMargin3: three. (line 577) * endl: Files. (line 61) * EndMargin: draw. (line 42) -* EndMargin3: three. (line 564) +* EndMargin3: three. (line 577) * EndPenMargin: draw. (line 42) -* EndPenMargin2: three. (line 564) -* EndPenMargin3: three. (line 564) +* EndPenMargin2: three. (line 577) +* EndPenMargin3: three. (line 577) * EndPoint: label. (line 56) * envelope: Frames and pictures. (line 22) * environment variables: Configuring. (line 87) @@ -8919,7 +8920,7 @@ Index * eof: Files. (line 92) * eol <1>: Arrays. (line 344) * eol: Files. (line 92) -* EPS <1>: Options. (line 143) +* EPS <1>: Options. (line 144) * EPS: label. (line 79) * erase <1>: Frames and pictures. (line 7) * erase <2>: Data types. (line 241) @@ -8929,8 +8930,8 @@ Index * erfc: Mathematical functions. (line 6) * error: Files. (line 16) -* error bars: graph. (line 532) -* errorbars: graph. (line 484) +* error bars: graph. (line 533) +* errorbars: graph. (line 485) * eval: Import. (line 98) * evenodd <1>: Pens. (line 152) * evenodd: Tutorial. (line 148) @@ -8949,13 +8950,13 @@ Index * extendcap: Pens. (line 129) * extension <1>: MetaPost. (line 10) * extension: Paths and guides. (line 235) -* external: embed. (line 28) -* extrude: three. (line 501) +* external: embed. (line 13) +* extrude: three. (line 514) * F: Mathematical functions. (line 48) * fabs: Mathematical functions. (line 6) -* face: three. (line 589) +* face: three. (line 602) * factorial: Mathematical functions. (line 39) * Fedora: UNIX binary distributions. @@ -8980,7 +8981,7 @@ Index * find: Data types. (line 226) * firstcut: Paths and guides. (line 250) * fit: Frames and pictures. (line 103) -* fit3: three. (line 269) +* fit3: three. (line 282) * fixedscaling: Frames and pictures. (line 74) * floor: Mathematical functions. (line 26) @@ -8993,14 +8994,14 @@ Index * fontcommand: Pens. (line 207) * fontsize: Pens. (line 178) * for: Programming. (line 8) -* format <1>: Options. (line 143) +* format <1>: Options. (line 144) * format: Data types. (line 269) * forum: Help. (line 6) * frame: Frames and pictures. (line 7) * freeglut: Compiling from UNIX source. (line 16) * from: Import. (line 17) -* FrontView: three. (line 386) +* FrontView: three. (line 399) * function declarations: Functions. (line 67) * function shading: fill. (line 96) * Function shading: fill. (line 96) @@ -9018,8 +9019,8 @@ Index * getreal: Files. (line 117) * getstring: Files. (line 117) * gettriple: Files. (line 117) -* glOptions <1>: Options. (line 130) -* glOptions: three. (line 210) +* glOptions <1>: Options. (line 131) +* glOptions: three. (line 223) * GNU Scientific Library: Mathematical functions. (line 48) * gouraudshade: fill. (line 58) @@ -9032,7 +9033,7 @@ Index * gray: Pens. (line 25) * Grayscale: palette. (line 9) * grayscale: Pens. (line 25) -* grid <1>: graph. (line 734) +* grid <1>: graph. (line 733) * grid: Pens. (line 251) * grid3: grid3. (line 6) * gs: Configuring. (line 6) @@ -9040,7 +9041,7 @@ Index (line 48) * GSL: Compiling from UNIX source. (line 58) -* gsOptions: Options. (line 130) +* gsOptions: Options. (line 131) * GUI: GUI. (line 6) * GUI installation: GUI installation. (line 6) * GUI usage: GUI usage. (line 6) @@ -9057,32 +9058,32 @@ Index * hex: Data types. (line 283) * hexidecimal <1>: Pens. (line 59) * hexidecimal: Data types. (line 283) -* hidden surface removal: three. (line 589) +* hidden surface removal: three. (line 602) * histogram: Mathematical functions. (line 39) * history <1>: Interactive mode. (line 59) * history: Files. (line 142) * historylines: Interactive mode. (line 64) * HookHead: draw. (line 26) -* HookHead3: three. (line 548) +* HookHead3: three. (line 561) * Horizontal: flowchart. (line 81) -* hyperrefOptions: Options. (line 130) +* hyperrefOptions: Options. (line 131) * hypot: Mathematical functions. (line 6) * I: Mathematical functions. (line 48) * i_scaled: Mathematical functions. (line 48) -* iconic: three. (line 210) +* iconic: three. (line 223) * identity <1>: Arrays. (line 300) * identity <2>: Mathematical functions. (line 6) * identity: Transforms. (line 24) -* identity4: three. (line 437) +* identity4: three. (line 450) * if: Programming. (line 8) * IgnoreAspect: Frames and pictures. (line 58) * image: palette. (line 34) -* ImageMagick <1>: Options. (line 143) +* ImageMagick <1>: Options. (line 144) * ImageMagick <2>: animation. (line 6) * ImageMagick: Configuring. (line 67) * images: palette. (line 6) @@ -9100,7 +9101,7 @@ Index * initializers: Variable initializers. (line 6) * inline: LaTeX usage. (line 51) -* InOutTicks: graph3. (line 34) +* InOutTicks: graph3. (line 35) * input <1>: Interactive mode. (line 48) * input: Files. (line 10) * insert <1>: Arrays. (line 39) @@ -9117,22 +9118,22 @@ Index * interp: Arithmetic & logical. (line 76) * interpolate: interpolate. (line 6) -* intersect <1>: three. (line 507) +* intersect <1>: three. (line 520) * intersect <2>: math. (line 13) * intersect: Paths and guides. (line 184) -* intersectionpoint <1>: three. (line 507) +* intersectionpoint <1>: three. (line 520) * intersectionpoint <2>: math. (line 17) * intersectionpoint: Paths and guides. (line 227) -* intersectionpoints <1>: three. (line 507) +* intersectionpoints <1>: three. (line 520) * intersectionpoints: Paths and guides. (line 231) -* intersections <1>: three. (line 507) +* intersections <1>: three. (line 520) * intersections: Paths and guides. (line 195) -* InTicks: graph3. (line 34) +* InTicks: graph3. (line 35) * intMax: Data types. (line 28) * intMin: Data types. (line 28) * inverse <1>: Arrays. (line 306) * inverse: Transforms. (line 16) -* invert: three. (line 427) +* invert: three. (line 440) * invisible: Pens. (line 39) * isnan: Data types. (line 33) * J: Mathematical functions. @@ -9146,25 +9147,25 @@ Index * KDE editor: Editing modes. (line 49) * keepAspect <1>: LaTeX usage. (line 51) * keepAspect: Frames and pictures. (line 54) -* keyboard bindings:: three. (line 169) +* keyboard bindings:: three. (line 182) * keys: Arrays. (line 39) * keyword: Named arguments. (line 37) * keyword-only: Named arguments. (line 37) * keywords: Named arguments. (line 6) * Korean: unicode. (line 12) -* label: three. (line 471) -* Label <1>: graph. (line 342) +* label: three. (line 484) +* Label <1>: graph. (line 343) * Label: label. (line 14) * label: clip. (line 16) * Label: draw. (line 98) * labelpath: labelpath. (line 6) * labelpath3: labelpath3. (line 6) -* labelx: graph. (line 342) -* labely: graph. (line 342) +* labelx: graph. (line 343) +* labely: graph. (line 343) * Landscape: Frames and pictures. (line 95) * lastcut: Paths and guides. (line 254) * lasy-mode: Editing modes. (line 6) -* latex: Options. (line 143) +* latex: Options. (line 144) * LaTeX fonts: Pens. (line 192) * LaTeX usage: LaTeX usage. (line 6) * latexmk: LaTeX usage. (line 30) @@ -9172,19 +9173,19 @@ Index * latitude: Data types. (line 136) * latticeshade: fill. (line 32) * layer: Drawing commands. (line 16) -* leastsquares <1>: graph. (line 902) +* leastsquares <1>: graph. (line 901) * leastsquares: stats. (line 6) * Left: graph. (line 284) * LeftRight: graph. (line 290) * LeftSide: label. (line 61) * LeftTicks: graph. (line 161) -* LeftView: three. (line 386) -* legend <1>: graph. (line 431) +* LeftView: three. (line 399) +* legend <1>: graph. (line 432) * legend <2>: draw. (line 64) * legend: Drawing commands. (line 31) * Legendre: Mathematical functions. (line 48) -* length <1>: three. (line 507) +* length <1>: three. (line 520) * length <2>: Arrays. (line 39) * length <3>: Paths and guides. (line 65) * length: Data types. (line 62) @@ -9194,7 +9195,7 @@ Index (line 6) * libsigsegv <1>: Help. (line 33) * libsigsegv: Functions. (line 88) -* limits: graph. (line 636) +* limits: graph. (line 637) * line: Arrays. (line 344) * line mode: Arrays. (line 344) * Linear: graph. (line 682) @@ -9212,7 +9213,7 @@ Index (line 6) * log1p: Mathematical functions. (line 6) -* log2 graph: graph. (line 763) +* log2 graph: graph. (line 762) * logarithmic graph: graph. (line 713) * logical operators: Arithmetic & logical. (line 6) @@ -9225,28 +9226,28 @@ Index * makepen: Pens. (line 300) * map: Arrays. (line 141) * Margin: draw. (line 42) -* Margin3: three. (line 564) -* margins: three. (line 262) +* Margin3: three. (line 577) +* margins: three. (line 275) * Margins: draw. (line 42) -* Margins3: three. (line 564) -* mark: graph. (line 484) +* Margins3: three. (line 577) +* mark: graph. (line 485) * markangle: markers. (line 38) -* marker: graph. (line 484) +* marker: graph. (line 485) * markers: markers. (line 6) -* marknodes: graph. (line 484) -* markuniform: graph. (line 484) +* marknodes: graph. (line 485) +* markuniform: graph. (line 485) * mask: Data types. (line 33) * math: math. (line 6) * mathematical functions: Mathematical functions. (line 6) -* max <1>: three. (line 507) +* max <1>: three. (line 520) * max <2>: Arrays. (line 225) * max <3>: Frames and pictures. (line 7) * max: Paths and guides. (line 267) * maxbound: Data types. (line 106) -* maxtile: three. (line 210) +* maxtile: three. (line 223) * maxtimes: Paths and guides. (line 222) -* maxviewport: three. (line 210) +* maxviewport: three. (line 223) * MetaPost: MetaPost. (line 6) * MetaPost ... : Bezier curves. (line 67) * MetaPost cutafter: Paths and guides. (line 255) @@ -9255,12 +9256,12 @@ Index * MetaPost whatever: MetaPost. (line 10) * Microsoft Windows: Microsoft Windows. (line 6) * MidArcArrow: draw. (line 26) -* MidArcArrow3: three. (line 548) +* MidArcArrow3: three. (line 561) * MidArrow: draw. (line 26) -* MidArrow3: three. (line 548) +* MidArrow3: three. (line 561) * midpoint: Paths and guides. (line 169) * MidPoint: label. (line 56) -* min <1>: three. (line 507) +* min <1>: three. (line 520) * min <2>: Arrays. (line 218) * min <3>: Frames and pictures. (line 7) * min: Paths and guides. (line 263) @@ -9274,10 +9275,10 @@ Index * mode: Files. (line 75) * monotonic: graph. (line 37) * mouse: GUI. (line 6) -* mouse bindings: three. (line 137) +* mouse bindings: three. (line 150) * Move: Pens. (line 339) * MoveQuiet: Pens. (line 345) -* multisample: three. (line 127) +* multisample: three. (line 140) * multisampling: Compiling from UNIX source. (line 16) * N: Tutorial. (line 106) @@ -9296,35 +9297,35 @@ Index * NoFill <1>: Frames and pictures. (line 141) * NoFill: draw. (line 26) * NoMargin: draw. (line 42) -* NoMargin3: three. (line 564) +* NoMargin3: three. (line 577) * none: Files. (line 61) * None: draw. (line 19) -* normal: three. (line 493) -* nosafe: Options. (line 163) +* normal: three. (line 506) +* nosafe: Options. (line 164) * NOT: Arithmetic & logical. (line 80) * notaknot: graph. (line 37) * NoTicks: graph. (line 161) -* NoTicks3: graph3. (line 34) +* NoTicks3: graph3. (line 35) * null: Structures. (line 6) * nullpen <1>: Frames and pictures. (line 127) * nullpen: label. (line 14) -* NURBS: three. (line 363) -* O: three. (line 274) +* NURBS: three. (line 376) +* O: three. (line 287) * obj: obj. (line 9) -* oblique: three. (line 319) -* obliqueX: three. (line 327) -* obliqueY: three. (line 334) -* obliqueZ: three. (line 319) +* oblique: three. (line 332) +* obliqueX: three. (line 340) +* obliqueY: three. (line 347) +* obliqueZ: three. (line 332) * ode: ode. (line 9) -* offset <1>: Options. (line 168) +* offset <1>: Options. (line 169) * offset: Pens. (line 115) * OmitTick: graph. (line 239) * OmitTickInterval: graph. (line 239) * OmitTickIntervals: graph. (line 239) * opacity: Pens. (line 222) * open: Files. (line 12) -* OpenGL: three. (line 127) +* OpenGL: three. (line 140) * operator: User-defined operators. (line 6) * operator --: graph. (line 31) @@ -9340,12 +9341,12 @@ Index * OR: Arithmetic & logical. (line 80) * orientation: Frames and pictures. (line 95) -* orthographic: three. (line 338) -* outformat: three. (line 127) +* orthographic: three. (line 351) +* outformat: three. (line 140) * outprefix: Frames and pictures. (line 83) -* output <1>: Options. (line 143) +* output <1>: Options. (line 144) * output: Files. (line 36) -* OutTicks: graph3. (line 34) +* OutTicks: graph3. (line 35) * overloading functions: Functions. (line 44) * overwrite: Pens. (line 324) * P: Mathematical functions. @@ -9359,51 +9360,51 @@ Index * papertype: Configuring. (line 61) * paperwidth: Configuring. (line 61) * parallelogram: flowchart. (line 50) -* parametric surface: graph3. (line 100) -* parametrized curve: graph. (line 636) +* parametric surface: graph3. (line 101) +* parametrized curve: graph. (line 637) * partialsum: math. (line 53) * patch-dependent colors: three. (line 81) * path <1>: flowchart. (line 81) * path <2>: three. (line 43) * path: Paths and guides. (line 7) -* path markers: graph. (line 484) +* path markers: graph. (line 485) * path3: three. (line 6) * path[]: Tutorial. (line 134) * patterns <1>: patterns. (line 6) * patterns: Pens. (line 238) -* PDF: Options. (line 143) -* pdflatex: Options. (line 143) +* PDF: Options. (line 144) +* pdflatex: Options. (line 144) * pdfviewer: Configuring. (line 6) -* pdfviewerOptions: Options. (line 130) +* pdfviewerOptions: Options. (line 131) * pen: Pens. (line 6) * PenMargin: draw. (line 42) -* PenMargin2: three. (line 564) -* PenMargin3: three. (line 564) +* PenMargin2: three. (line 577) +* PenMargin3: three. (line 577) * PenMargins: draw. (line 42) -* PenMargins2: three. (line 564) -* PenMargins3: three. (line 564) +* PenMargins2: three. (line 577) +* PenMargins3: three. (line 577) * periodic: graph. (line 37) * perl: LaTeX usage. (line 30) * perpendicular: geometry. (line 6) -* perspective: three. (line 363) +* perspective: three. (line 376) * picture: Frames and pictures. (line 35) * picture alignment: Frames and pictures. (line 209) * piecewisestraight: Paths and guides. (line 81) -* pixel: three. (line 571) +* pixel: three. (line 584) * Pl: Mathematical functions. (line 48) * plain: plain. (line 6) * planar: three. (line 89) -* plane: three. (line 301) -* planeproject: three. (line 490) -* point <1>: three. (line 507) +* plane: three. (line 314) +* planeproject: three. (line 503) +* point <1>: three. (line 520) * point: Paths and guides. (line 84) * polar: Data types. (line 121) * polargraph: graph. (line 90) -* polygon: graph. (line 484) +* polygon: graph. (line 485) * pop: Arrays. (line 39) * Portrait: Frames and pictures. (line 95) -* postcontrol <1>: three. (line 507) +* postcontrol <1>: three. (line 520) * postcontrol: Paths and guides. (line 135) * postfix operators: Self & prefix operators. (line 19) @@ -9412,9 +9413,9 @@ Index * PostScript subpath: Tutorial. (line 134) * pow10: Mathematical functions. (line 6) -* prc: three. (line 231) +* prc: three. (line 244) * precision: Files. (line 92) -* precontrol <1>: three. (line 507) +* precontrol <1>: three. (line 520) * precontrol: Paths and guides. (line 128) * prefix operators: Self & prefix operators. (line 6) @@ -9424,7 +9425,7 @@ Index (line 6) * psview: Microsoft Windows. (line 16) * psviewer: Configuring. (line 6) -* psviewerOptions: Options. (line 130) +* psviewerOptions: Options. (line 131) * pt: Tutorial. (line 63) * public: Structures. (line 6) * push: Arrays. (line 39) @@ -9443,7 +9444,7 @@ Index * RadialShadeDraw: Frames and pictures. (line 163) * radians: Mathematical functions. (line 17) -* radius <1>: three. (line 507) +* radius <1>: three. (line 520) * radius: Paths and guides. (line 124) * Rainbow: palette. (line 12) * rand: Mathematical functions. @@ -9470,7 +9471,7 @@ Index * remainder: Mathematical functions. (line 6) * rename: Files. (line 151) -* render <1>: Options. (line 143) +* render <1>: Options. (line 144) * render: three. (line 47) * replace: Data types. (line 254) * resetdefaultpen: Pens. (line 353) @@ -9478,7 +9479,7 @@ Index * restore: Frames and pictures. (line 265) * restricted: Structures. (line 6) * return: Debugger. (line 48) -* reverse <1>: three. (line 507) +* reverse <1>: three. (line 520) * reverse <2>: Arrays. (line 146) * reverse <3>: Paths and guides. (line 172) * reverse: Data types. (line 250) @@ -9490,8 +9491,8 @@ Index * Right: graph. (line 287) * RightSide: label. (line 61) * RightTicks: graph. (line 161) -* RightView: three. (line 386) -* rotate: three. (line 458) +* RightView: three. (line 399) +* rotate: three. (line 471) * Rotate: label. (line 36) * Rotate(pair z): label. (line 39) * round: Mathematical functions. @@ -9505,25 +9506,25 @@ Index * runtime imports: Import. (line 98) * Russian: unicode. (line 7) * S: Tutorial. (line 106) -* safe: Options. (line 163) +* safe: Options. (line 164) * save: Frames and pictures. (line 262) * saveline: Files. (line 134) -* scale: three. (line 457) +* scale: three. (line 470) * Scale: graph. (line 698) * scale <1>: graph. (line 682) * scale <2>: Transforms. (line 39) * scale: Pens. (line 115) * Scale: label. (line 45) -* scale3: three. (line 454) +* scale3: three. (line 467) * scaled graph: graph. (line 663) -* scientific graph: graph. (line 396) +* scientific graph: graph. (line 397) * scroll: Files. (line 108) * search: Arrays. (line 164) * search paths: Search paths. (line 6) * Seascape: Frames and pictures. (line 100) -* secondary axis: graph. (line 813) -* secondaryX: graph. (line 813) -* secondaryY: graph. (line 813) +* secondary axis: graph. (line 812) +* secondaryX: graph. (line 812) +* secondaryY: graph. (line 812) * seconds: Data types. (line 306) * seek: Files. (line 92) * seekeof: Files. (line 92) @@ -9532,17 +9533,17 @@ Index * self operators: Self & prefix operators. (line 6) * sequence: Arrays. (line 128) -* settings <1>: Options. (line 115) +* settings <1>: Options. (line 116) * settings: Configuring. (line 23) * sgn: Mathematical functions. (line 26) * shading: fill. (line 32) -* shift <1>: three. (line 442) +* shift <1>: three. (line 455) * shift: Transforms. (line 27) * Shift: label. (line 33) * shiftless: Transforms. (line 53) * shipout: Frames and pictures. (line 83) -* showtarget: three. (line 338) +* showtarget: three. (line 351) * Si: Mathematical functions. (line 48) * signedint: Files. (line 75) @@ -9559,14 +9560,14 @@ Index * singlereal: Files. (line 75) * sinh: Mathematical functions. (line 6) -* SixViews: three. (line 401) -* SixViewsFR: three. (line 401) -* SixViewsUS: three. (line 401) -* size <1>: Options. (line 143) -* size <2>: three. (line 507) +* SixViews: three. (line 414) +* SixViewsFR: three. (line 414) +* SixViewsUS: three. (line 414) +* size <1>: Options. (line 144) +* size <2>: three. (line 520) * size <3>: Frames and pictures. (line 43) * size: Paths and guides. (line 70) -* size3: three. (line 259) +* size3: three. (line 272) * slant: Transforms. (line 45) * Slant: label. (line 42) * sleep: Data types. (line 351) @@ -9575,13 +9576,13 @@ Index * slide: slide. (line 6) * slope: math. (line 44) * slopefield: slopefield. (line 6) -* sndncn: Mathematical functions. +* sncndn: Mathematical functions. (line 48) * solid: Pens. (line 95) * solids: solids. (line 9) * solve: Arrays. (line 278) * sort: Arrays. (line 184) -* Spline <1>: graph3. (line 100) +* Spline <1>: graph3. (line 101) * Spline: graph. (line 34) * split: Data types. (line 263) * sqrt: Mathematical functions. @@ -9598,7 +9599,7 @@ Index * step: Debugger. (line 39) * stickframe: markers. (line 16) * stop: Debugger. (line 10) -* straight: three. (line 507) +* straight: three. (line 520) * Straight: graph. (line 31) * straight: Paths and guides. (line 77) * strftime: Data types. (line 298) @@ -9608,7 +9609,7 @@ Index * strptime: Data types. (line 306) * struct: Structures. (line 6) * structures: Structures. (line 6) -* subpath <1>: three. (line 507) +* subpath <1>: three. (line 520) * subpath: Paths and guides. (line 175) * subpictures: Frames and pictures. (line 103) * substr: Data types. (line 246) @@ -9617,11 +9618,11 @@ Index * superpath: Tutorial. (line 134) * Suppress: Pens. (line 331) * SuppressQuiet: Pens. (line 335) -* surface <1>: graph3. (line 100) +* surface <1>: graph3. (line 101) * surface: three. (line 47) -* SVG: Options. (line 143) +* SVG: Options. (line 144) * SVN: Subversion. (line 6) -* system <1>: Options. (line 163) +* system <1>: Options. (line 164) * system: Data types. (line 328) * syzygy: syzygy. (line 6) * tab: Files. (line 61) @@ -9632,35 +9633,36 @@ Index (line 6) * tanh: Mathematical functions. (line 6) -* target: three. (line 338) +* target: three. (line 351) * tell: Files. (line 92) * tension <1>: three. (line 6) * tension: Bezier curves. (line 56) * tensionSpecifier: Paths and guides. (line 388) * tensor product shading: fill. (line 74) * tensorshade: fill. (line 74) -* tex <1>: Options. (line 143) +* tessellation: three. (line 112) +* tex <1>: Options. (line 144) * tex: Frames and pictures. (line 278) * TeX fonts: Pens. (line 201) * TeX string: Data types. (line 181) * texcommand: Configuring. (line 67) * TeXHead: draw. (line 26) -* TeXHead3: three. (line 548) +* TeXHead3: three. (line 561) * texpath <1>: label. (line 115) * texpath: Configuring. (line 67) * texpreamble: Frames and pictures. (line 286) * texreset: Frames and pictures. (line 289) -* textbook graph: graph. (line 371) +* textbook graph: graph. (line 372) * tgz: UNIX binary distributions. (line 6) -* thick: three. (line 110) -* thin: three. (line 110) +* thick: three. (line 123) +* thin: three. (line 123) * this: Structures. (line 6) * three: three. (line 6) -* ThreeViews: three. (line 401) -* ThreeViewsFR: three. (line 401) -* ThreeViewsUS: three. (line 401) -* tick: graph. (line 342) +* ThreeViews: three. (line 414) +* ThreeViewsFR: three. (line 414) +* ThreeViewsUS: three. (line 414) +* tick: graph. (line 343) * Ticks: graph. (line 161) * ticks: graph. (line 161) * tildeframe: markers. (line 26) @@ -9670,31 +9672,32 @@ Index * time: Data types. (line 298) * times: Paths and guides. (line 209) * Top: graph. (line 137) -* TopView: three. (line 386) +* TopView: three. (line 399) * trace: Debugger. (line 51) * trailingzero: graph. (line 175) -* transform <1>: three. (line 482) +* transform <1>: three. (line 495) * transform: Transforms. (line 6) -* transform3: three. (line 437) +* transform3: three. (line 450) * transparency: Pens. (line 222) * transpose: Arrays. (line 205) * tree: tree. (line 9) * trembling: trembling. (line 6) * triangle: geometry. (line 6) +* triangles: three. (line 112) * triangulate: contour. (line 157) * tridiagonal: Arrays. (line 266) * trigonometric integrals: Mathematical functions. (line 48) * triple: Data types. (line 110) * TrueMargin: draw. (line 42) -* TrueMargin3: three. (line 564) +* TrueMargin3: three. (line 577) * tube <1>: tube. (line 6) -* tube: three. (line 110) +* tube: three. (line 123) * tutorial: Tutorial. (line 6) * type1cm: Pens. (line 178) * typedef <1>: Functions. (line 36) * typedef: Data types. (line 361) -* U3D: embed. (line 38) +* U3D: embed. (line 24) * undefined: Paths and guides. (line 271) * UnFill: Frames and pictures. (line 152) * unfill: fill. (line 106) @@ -9704,9 +9707,9 @@ Index * Uninstall: Uninstall. (line 6) * unique: math. (line 64) * unit: Data types. (line 80) -* unitbox <1>: three. (line 307) +* unitbox <1>: three. (line 320) * unitbox: Tutorial. (line 155) -* unitcircle <1>: three. (line 274) +* unitcircle <1>: three. (line 287) * unitcircle: Tutorial. (line 128) * unitrand: Mathematical functions. (line 39) @@ -9716,7 +9719,7 @@ Index (line 6) * unpacking: Rest arguments. (line 39) * unravel: Import. (line 30) -* up: three. (line 338) +* up: three. (line 351) * update: Files. (line 36) * UpsideDown: Frames and pictures. (line 95) * usepackage: Frames and pictures. (line 291) @@ -9729,17 +9732,17 @@ Index (line 63) * variable initializers: Variable initializers. (line 6) -* vectorfield: graph. (line 975) -* vectorfield3: graph3. (line 159) +* vectorfield: graph. (line 974) +* vectorfield3: graph3. (line 160) * vectorization: Arrays. (line 323) * verbatim: Frames and pictures. (line 271) * vertex-dependent colors: three. (line 81) * Vertical: flowchart. (line 81) * viewportheight: LaTeX usage. (line 51) -* viewportmargin: three. (line 262) -* viewportsize: three. (line 262) +* viewportmargin: three. (line 275) +* viewportsize: three. (line 275) * viewportwidth: LaTeX usage. (line 51) -* views: three. (line 231) +* views: three. (line 244) * vim: Editing modes. (line 33) * virtual functions: Structures. (line 181) * void: Data types. (line 10) @@ -9754,44 +9757,43 @@ Index * word: Arrays. (line 354) * write <1>: Arrays. (line 394) * write: Files. (line 53) -* X: three. (line 274) +* X: three. (line 287) * xasy: GUI. (line 6) * xaxis3: graph3. (line 7) * xdr: Files. (line 75) -* xelatex <1>: Options. (line 143) -* xelatex: embed. (line 10) +* xelatex: Options. (line 144) * xequals: graph. (line 294) * XEquals: graph. (line 280) -* xlimits: graph. (line 636) +* xlimits: graph. (line 637) * XOR: Arithmetic & logical. (line 80) * xpart: Data types. (line 91) * xscale: Transforms. (line 33) -* xscale3: three. (line 445) -* xtick: graph. (line 342) -* XY: three. (line 467) -* XYEquals: graph3. (line 20) -* XYZero: graph3. (line 20) -* XZEquals: graph3. (line 20) +* xscale3: three. (line 458) +* xtick: graph. (line 343) +* XY: three. (line 480) +* XYEquals: graph3. (line 21) +* XYZero: graph3. (line 21) +* XZEquals: graph3. (line 21) * XZero: graph. (line 275) -* XZZero: graph3. (line 20) -* Y <1>: three. (line 274) +* XZZero: graph3. (line 21) +* Y <1>: three. (line 287) * Y: Mathematical functions. (line 6) * yaxis3: graph3. (line 7) * yequals: graph. (line 294) * YEquals: graph. (line 130) -* ylimits: graph. (line 636) +* ylimits: graph. (line 637) * ypart: Data types. (line 94) * yscale: Transforms. (line 36) -* yscale3: three. (line 448) -* ytick: graph. (line 342) -* YX: three. (line 482) -* YZ: three. (line 482) -* YZEquals: graph3. (line 20) +* yscale3: three. (line 461) +* ytick: graph. (line 343) +* YX: three. (line 495) +* YZ: three. (line 495) +* YZEquals: graph3. (line 21) * YZero: graph. (line 125) -* YZZero: graph3. (line 20) -* Z: three. (line 274) +* YZZero: graph3. (line 21) +* Z: three. (line 287) * zaxis3: graph3. (line 7) * zero_Ai: Mathematical functions. (line 48) @@ -9807,9 +9809,9 @@ Index * zeta: Mathematical functions. (line 48) * zpart: Data types. (line 163) -* zscale3: three. (line 451) -* ZX: three. (line 482) -* ZY: three. (line 482) +* zscale3: three. (line 464) +* ZX: three. (line 495) +* ZY: three. (line 495) * |: Arithmetic & logical. (line 62) * ||: Arithmetic & logical. @@ -9849,115 +9851,115 @@ Node: Data types58494 Ref: format67691 Node: Paths and guides71944 Ref: circle72198 -Ref: extension81622 -Node: Pens88305 -Ref: fillrule95673 -Ref: basealign96570 -Ref: transparency99396 -Ref: makepen102839 -Ref: overwrite103677 -Node: Transforms104887 -Node: Frames and pictures106678 -Ref: envelope107819 -Ref: size108902 -Ref: unitsize109889 -Ref: shipout110949 -Ref: filltype113282 -Ref: add116419 -Ref: add about117365 -Ref: tex120303 -Node: Files121177 -Ref: cd122160 -Ref: scroll126834 -Node: Variable initializers129749 -Node: Structures132474 -Node: Operators139918 -Node: Arithmetic & logical140232 -Node: Self & prefix operators142205 -Node: User-defined operators142993 -Node: Implicit scaling143904 -Node: Functions144467 -Ref: stack overflow147220 -Node: Default arguments147784 -Node: Named arguments148523 -Node: Rest arguments151094 -Node: Mathematical functions154215 -Node: Arrays158880 -Ref: sort165869 -Ref: tridiagonal168273 -Ref: solve169501 -Node: Slices173694 -Node: Casts177584 -Node: Import179549 -Node: Static184786 -Node: LaTeX usage187680 -Node: Base modules194092 -Node: plain196592 -Node: simplex197244 -Node: math197517 -Node: interpolate200222 -Node: geometry200501 -Node: trembling201095 -Node: stats201446 -Node: patterns201706 -Node: markers201942 -Node: tree203725 -Node: binarytree203913 -Node: drawtree204502 -Node: syzygy204706 -Node: feynman204980 -Node: roundedpath205255 -Node: animation205538 -Ref: animate205958 -Node: embed207097 -Node: slide208700 -Node: MetaPost209040 -Node: unicode209756 -Node: latin1210644 -Node: babel211012 -Node: labelpath211241 -Node: labelpath3212061 -Node: annotate212372 -Node: CAD212843 -Node: graph213153 -Ref: ticks220282 -Ref: pathmarkers233576 -Ref: marker234041 -Ref: markuniform234392 -Ref: errorbars236183 -Ref: automatic scaling240239 -Node: palette250885 -Ref: images251003 -Ref: image255175 -Ref: logimage255653 -Ref: penimage256714 -Ref: penfunctionimage256935 -Node: three257659 -Ref: PostScript3D282639 -Node: obj284331 -Node: graph3284583 -Ref: GaussianSurface289708 -Node: grid3290812 -Node: solids291552 -Node: tube292500 -Node: flowchart294735 -Node: contour299304 -Node: contour3304429 -Node: slopefield304736 -Node: ode306173 -Node: Options306433 -Ref: configuration file312421 -Ref: settings312421 -Ref: convert313622 -Node: Interactive mode316589 -Ref: history318742 -Node: GUI320047 -Node: GUI installation320550 -Node: GUI usage321680 -Node: PostScript to Asymptote322583 -Node: Help323339 -Node: Debugger325075 -Node: Credits326860 -Node: Index327792 +Ref: extension81618 +Node: Pens88301 +Ref: fillrule95669 +Ref: basealign96566 +Ref: transparency99392 +Ref: makepen102835 +Ref: overwrite103673 +Node: Transforms104883 +Node: Frames and pictures106674 +Ref: envelope107815 +Ref: size108898 +Ref: unitsize109885 +Ref: shipout110945 +Ref: filltype113278 +Ref: add116415 +Ref: add about117361 +Ref: tex120299 +Node: Files121173 +Ref: cd122156 +Ref: scroll126830 +Node: Variable initializers129745 +Node: Structures132470 +Node: Operators139914 +Node: Arithmetic & logical140228 +Node: Self & prefix operators142201 +Node: User-defined operators142989 +Node: Implicit scaling143900 +Node: Functions144463 +Ref: stack overflow147216 +Node: Default arguments147780 +Node: Named arguments148519 +Node: Rest arguments151090 +Node: Mathematical functions154211 +Node: Arrays158876 +Ref: sort165865 +Ref: tridiagonal168269 +Ref: solve169497 +Node: Slices173690 +Node: Casts177580 +Node: Import179545 +Node: Static184782 +Node: LaTeX usage187676 +Node: Base modules194088 +Node: plain196588 +Node: simplex197240 +Node: math197513 +Node: interpolate200218 +Node: geometry200497 +Node: trembling201091 +Node: stats201442 +Node: patterns201702 +Node: markers201938 +Node: tree203721 +Node: binarytree203909 +Node: drawtree204529 +Node: syzygy204733 +Node: feynman205007 +Node: roundedpath205282 +Node: animation205565 +Ref: animate205985 +Node: embed207124 +Node: slide208151 +Node: MetaPost208491 +Node: unicode209207 +Node: latin1210095 +Node: babel210463 +Node: labelpath210692 +Node: labelpath3211512 +Node: annotate211823 +Node: CAD212294 +Node: graph212604 +Ref: ticks219733 +Ref: pathmarkers233060 +Ref: marker233525 +Ref: markuniform233876 +Ref: errorbars235667 +Ref: automatic scaling239704 +Node: palette250333 +Ref: images250451 +Ref: image254623 +Ref: logimage255101 +Ref: penimage256162 +Ref: penfunctionimage256383 +Node: three257107 +Ref: PostScript3D282792 +Node: obj284484 +Node: graph3284736 +Ref: GaussianSurface289891 +Node: grid3290995 +Node: solids291735 +Node: tube292683 +Node: flowchart294918 +Node: contour299487 +Node: contour3304612 +Node: slopefield304919 +Node: ode306356 +Node: Options306616 +Ref: configuration file312661 +Ref: settings312661 +Ref: convert313862 +Node: Interactive mode316829 +Ref: history318982 +Node: GUI320287 +Node: GUI installation320790 +Node: GUI usage321920 +Node: PostScript to Asymptote322823 +Node: Help323579 +Node: Debugger325315 +Node: Credits327100 +Node: Index328032 End Tag Table diff --git a/Build/source/utils/asymptote/drawelement.h b/Build/source/utils/asymptote/drawelement.h index 618da860ee4..c0761d081b0 100644 --- a/Build/source/utils/asymptote/drawelement.h +++ b/Build/source/utils/asymptote/drawelement.h @@ -24,6 +24,8 @@ namespace camp { enum Interaction {EMBEDDED=0,BILLBOARD}; +void copyArray4x4C(double*& dest, const vm::array *a); + class box { pair p[4]; public: @@ -109,11 +111,33 @@ public: // Adjust the bbox of the picture based on the addition of this // element. The iopipestream is needed for determining label sizes. virtual void bounds(bbox&, iopipestream&, boxvector&, bboxlist&) {} - virtual void bounds(bbox3&) {} + virtual void bounds(const double*, bbox3&) {} + virtual void bounds(bbox3& b) { bounds(NULL, b); } // Compute bounds on ratio (x,y)/z for 3d picture (not cached). + virtual void ratio(const double *t, pair &b, double (*m)(double, double), + double fuzz, bool &first) {} + + virtual void minratio(const double *t, pair &b, double fuzz, bool &first) { + ratio(t, b, camp::min, fuzz, first); + } + + virtual void maxratio(const double *t,pair &b, double fuzz, bool &first) { + ratio(t, b, camp::max, fuzz, first); + } + virtual void ratio(pair &b, double (*m)(double, double), double fuzz, - bool &first){} + bool &first) { + ratio(NULL, b, m, fuzz, first); + } + + virtual void minratio(pair &b, double fuzz, bool &first) { + minratio(NULL, b, fuzz, first); + } + + virtual void maxratio(pair &b, double fuzz, bool &first) { + maxratio(NULL, b, fuzz, first); + } virtual bool islabel() {return false;} @@ -131,8 +155,12 @@ public: virtual bool endclip() {return false;} virtual bool begingroup() {return false;} + virtual bool begingroup3() {return false;} virtual bool endgroup() {return false;} + virtual bool endgroup3() {return false;} + + virtual const double* transf3() {return NULL;} virtual void save(bool b) {} @@ -147,29 +175,69 @@ public: } // Output to a PRC file - // The array origin contains the points about which to rotate billboard labels - virtual bool write(prcfile *out, unsigned int *count, vm::array *index, - vm::array *origin, double compressionlimit, + virtual bool write(prcfile *out, unsigned int *count, double compressionlimit, groupsmap& groups) { return false; } - + // Used to compute deviation of a surface from a quadrilateral. virtual void displacement() {} // Render with OpenGL virtual void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent) {} + double perspective, bool lighton, bool transparent) {} // Transform as part of a picture. virtual drawElement *transformed(const transform&) { return this; } - virtual drawElement *transformed(const vm::array&) { + virtual drawElement *transformed(const double* t) { return this; } + +}; + +// Hold transform of an object. +class drawElementLC : public virtual drawElement { +public: + double *T; // Keep track of accumulative picture transform + + drawElementLC() : T(NULL) {} + + drawElementLC(double t1, double t2, double t3, double t4, + double t5, double t6, double t7, double t8, + double t9, double t10, double t11, double t12, + double t13, double t14, double t15, double t16) { + T=new(UseGC) double[16]; + T[0]=t1; T[4]=t5; T[ 8]=t9; T[12]=t13; + T[1]=t2; T[5]=t6; T[ 9]=t10; T[13]=t14; + T[2]=t3; T[6]=t7; T[10]=t11; T[14]=t15; + T[3]=t4; T[7]=t8; T[11]=t12; T[15]=t16; + } + + drawElementLC(const double *t) : T(NULL) { + copyTransform3(T,t); + } + + drawElementLC(const vm::array& t) : T(NULL) { + copyArray4x4C(T,&t); + } + + drawElementLC(const double* t, const drawElementLC *s) : T(NULL) { + multiplyTransform3(T,t,s->T); + } + + virtual ~drawElementLC() {} + + virtual bool is3D() {return true;} + + virtual const double* transf3() {return T;} + + virtual drawElement* transformed(const double* t) { + return new drawElementLC(t,this); + } }; // Base class for drawElements that involve paths. @@ -330,4 +398,3 @@ GC_DECLARE_PTRFREE(camp::box); GC_DECLARE_PTRFREE(camp::drawElement); #endif - diff --git a/Build/source/utils/asymptote/drawgroup.h b/Build/source/utils/asymptote/drawgroup.h index 6449f6cd08f..872d85b9d86 100644 --- a/Build/source/utils/asymptote/drawgroup.h +++ b/Build/source/utils/asymptote/drawgroup.h @@ -30,7 +30,7 @@ public: bool endgroup() {return true;} }; -class drawBegin3 : public drawElement { +class drawBegin3 : public drawElementLC { string name; double compression; double granularity; @@ -43,8 +43,8 @@ class drawBegin3 : public drawElement { int interaction; public: drawBegin3(string name, double compression, double granularity, - bool closed, bool tessellate, bool dobreak, bool nobreak, - triple center, int interaction) : + bool closed, bool tessellate, bool dobreak, bool nobreak, + triple center, int interaction) : name(name), compression(compression), granularity(granularity), closed(closed), tessellate(tessellate), dobreak(dobreak), nobreak(nobreak), center(center), interaction(interaction) {} @@ -52,9 +52,9 @@ public: virtual ~drawBegin3() {} bool begingroup() {return true;} + bool begingroup3() {return true;} - bool write(prcfile *out, unsigned int *count, vm::array *index, - vm::array *origin, double compressionlimit, + bool write(prcfile *out, unsigned int *count, double compressionlimit, groupsmap& groups) { groupmap& group=groups.back(); if(name.empty()) name="group"; @@ -67,29 +67,26 @@ public: buf << name; if(c > 0) buf << "-" << (c+1); - if(interaction == BILLBOARD) { + if(interaction == BILLBOARD) buf << "-" << (*count)++ << "\001"; - index->push((Int) origin->size()); - origin->push(center); - } PRCoptions options(compression > 0.0 ? max(compression,compressionlimit) : 0.0, granularity,closed,tessellate,dobreak,nobreak); groups.push_back(groupmap()); - out->begingroup(buf.str().c_str(),&options); + out->begingroup(buf.str().c_str(),&options,T); return true; } - drawBegin3(const vm::array& t, const drawBegin3 *s) : - name(s->name), compression(s->compression), granularity(s->granularity), - closed(s->closed), tessellate(s->tessellate), dobreak(s->dobreak), - nobreak(s->nobreak), interaction(s->interaction) { - center=run::operator *(t,s->center); + drawBegin3(const double* t, const drawBegin3 *s) : + drawElementLC(t, s), name(s->name), compression(s->compression), + granularity(s->granularity), closed(s->closed), tessellate(s->tessellate), + dobreak(s->dobreak), nobreak(s->nobreak), interaction(s->interaction) { + center=t*s->center; } - drawElement *transformed(const array& t) { + drawElement *transformed(const double* t) { return new drawBegin3(t,this); } }; @@ -101,9 +98,9 @@ public: virtual ~drawEnd3() {} bool endgroup() {return true;} + bool endgroup3() {return true;} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap& groups) { + bool write(prcfile *out, unsigned int *, double, groupsmap& groups) { groups.pop_back(); out->endgroup(); return true; diff --git a/Build/source/utils/asymptote/drawpath3.cc b/Build/source/utils/asymptote/drawpath3.cc index b41c69a1114..b898892f8a1 100644 --- a/Build/source/utils/asymptote/drawpath3.cc +++ b/Build/source/utils/asymptote/drawpath3.cc @@ -10,8 +10,7 @@ namespace camp { using vm::array; -bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *, - double, groupsmap&) +bool drawPath3::write(prcfile *out, unsigned int *, double, groupsmap&) { Int n=g.length(); if(n == 0 || invisible) @@ -43,7 +42,7 @@ bool drawPath3::write(prcfile *out, unsigned int *count, array *, array *, } void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, - double, bool transparent) + double, bool lighton, bool transparent) { #ifdef HAVE_GL Int n=g.length(); @@ -52,13 +51,14 @@ void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, bool havebillboard=interaction == BILLBOARD; - GLfloat Diffuse[]={0.0,0.0,0.0,color.A}; + GLfloat Diffuse[]={0.0,0.0,0.0,(GLfloat) color.A}; glMaterialfv(GL_FRONT,GL_DIFFUSE,Diffuse); static GLfloat Black[]={0.0,0.0,0.0,1.0}; glMaterialfv(GL_FRONT,GL_AMBIENT,Black); - GLfloat Emissive[]={color.R,color.G,color.B,color.A}; + GLfloat Emissive[]={(GLfloat) color.R,(GLfloat) color.G,(GLfloat) color.B, + (GLfloat) color.A}; glMaterialfv(GL_FRONT,GL_EMISSION,Emissive); glMaterialfv(GL_FRONT,GL_SPECULAR,Black); @@ -103,13 +103,12 @@ void drawPath3::render(GLUnurbs *nurb, double, const triple&, const triple&, #endif } -drawElement *drawPath3::transformed(const array& t) +drawElement *drawPath3::transformed(const double* t) { return new drawPath3(t,this); } -bool drawNurbsPath3::write(prcfile *out, unsigned int *count, array *index, - array *origin, double, groupsmap&) +bool drawNurbsPath3::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; @@ -120,9 +119,16 @@ bool drawNurbsPath3::write(prcfile *out, unsigned int *count, array *index, } // Approximate bounds by bounding box of control polyhedron. -void drawNurbsPath3::bounds(bbox3& b) +void drawNurbsPath3::bounds(const double* t, bbox3& b) { - double *v=controls[0]; + Triple* Controls; + if(t == NULL) Controls=controls; + else { + Controls=new Triple[n]; + transformTriples(t,n,Controls,controls); + } + + double *v=Controls[0]; double x=v[0]; double y=v[1]; double z=v[2]; @@ -130,7 +136,7 @@ void drawNurbsPath3::bounds(bbox3& b) double Y=y; double Z=z; for(size_t i=1; i < n; ++i) { - double *v=controls[i]; + double *v=Controls[i]; double vx=v[0]; x=min(x,vx); X=max(X,vx); @@ -142,23 +148,33 @@ void drawNurbsPath3::bounds(bbox3& b) Z=max(Z,vz); } - Min=triple(x,y,z); - Max=triple(X,Y,Z); - b.add(Min); - b.add(Max); + b.add(x,y,z); + b.add(X,Y,Z); + + if(t == NULL) { + Min=triple(x,y,z); + Max=triple(X,Y,Z); + } else delete[] Controls; } -drawElement *drawNurbsPath3::transformed(const array& t) +drawElement *drawNurbsPath3::transformed(const double* t) { return new drawNurbsPath3(t,this); } -void drawNurbsPath3::ratio(pair &b, double (*m)(double, double), double, - bool &first) +void drawNurbsPath3::ratio(const double* t, pair &b, double (*m)(double, double), + double, bool &first) { + Triple* Controls; + if(t == NULL) Controls=controls; + else { + Controls=new Triple[n]; + transformTriples(t,n,Controls,controls); + } + if(first) { first=false; - double *ci=controls[0]; + double *ci=Controls[0]; triple v=triple(ci[0],ci[1],ci[2]); b=pair(xratio(v),yratio(v)); } @@ -166,12 +182,15 @@ void drawNurbsPath3::ratio(pair &b, double (*m)(double, double), double, double x=b.getx(); double y=b.gety(); for(size_t i=0; i < n; ++i) { - double *ci=controls[i]; + double *ci=Controls[i]; triple v=triple(ci[0],ci[1],ci[2]); x=m(x,xratio(v)); y=m(y,yratio(v)); } b=pair(x,y); + + if(t != NULL) + delete[] Controls; } void drawNurbsPath3::displacement() @@ -195,19 +214,21 @@ void drawNurbsPath3::displacement() } void drawNurbsPath3::render(GLUnurbs *nurb, double, const triple&, - const triple&, double, bool transparent) + const triple&, double, bool lighton, + bool transparent) { #ifdef HAVE_GL if(invisible || ((color.A < 1.0) ^ transparent)) return; - GLfloat Diffuse[]={0.0,0.0,0.0,color.A}; + GLfloat Diffuse[]={0.0,0.0,0.0,(GLfloat) color.A}; glMaterialfv(GL_FRONT,GL_DIFFUSE,Diffuse); static GLfloat Black[]={0.0,0.0,0.0,1.0}; glMaterialfv(GL_FRONT,GL_AMBIENT,Black); - GLfloat Emissive[]={color.R,color.G,color.B,color.A}; + GLfloat Emissive[]={(GLfloat) color.R,(GLfloat) color.G,(GLfloat) color.B, + (GLfloat) color.A}; glMaterialfv(GL_FRONT,GL_EMISSION,Emissive); glMaterialfv(GL_FRONT,GL_SPECULAR,Black); diff --git a/Build/source/utils/asymptote/drawpath3.h b/Build/source/utils/asymptote/drawpath3.h index 721cf177ca1..80c86ae2c03 100644 --- a/Build/source/utils/asymptote/drawpath3.h +++ b/Build/source/utils/asymptote/drawpath3.h @@ -27,37 +27,48 @@ public: invisible(p.invisible()), interaction(interaction), Min(g.min()), Max(g.max()) {} - drawPath3(const vm::array& t, const drawPath3 *s) : + drawPath3(const double* t, const drawPath3 *s) : g(camp::transformed(t,s->g)), straight(s->straight), color(s->color), invisible(s->invisible), interaction(s->interaction), Min(g.min()), Max(g.max()) { - center=run::operator *(t,s->center); + center=t*s->center; } virtual ~drawPath3() {} bool is3D() {return true;} - void bounds(bbox3& B) { - B.add(Min); - B.add(Max); + void bounds(const double* t, bbox3& B) { + if(t != NULL) { + const path3 tg(camp::transformed(t,g)); + B.add(tg.min()); + B.add(tg.max()); + } else { + B.add(Min); + B.add(Max); + } } - void ratio(pair &b, double (*m)(double, double), double, bool &first) { - pair z=g.ratio(m); + void ratio(const double* t, pair &b, double (*m)(double, double), double, + bool &first) { + pair z; + if(t != NULL) { + const path3 tg(camp::transformed(t,g)); + z=tg.ratio(m); + } else z=g.ratio(m); + if(first) { b=z; first=false; } else b=pair(m(b.getx(),z.getx()),m(b.gety(),z.gety())); } - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); void render(GLUnurbs*, double, const triple&, const triple&, double, - bool transparent); + bool lighton, bool transparent); - drawElement *transformed(const vm::array& t); + drawElement *transformed(const double* t); }; class drawNurbsPath3 : public drawElement { @@ -115,17 +126,10 @@ public: #endif } - drawNurbsPath3(const vm::array& t, const drawNurbsPath3 *s) : + drawNurbsPath3(const double* t, const drawNurbsPath3 *s) : degree(s->degree), n(s->n), color(s->color), invisible(s->invisible) { controls=new(UseGC) Triple[n]; - - for(size_t i=0; i < n; ++i) { - const double *c=s->controls[i]; - triple v=run::operator *(t,triple(c[0],c[1],c[2])); - controls[i][0]=v.getx(); - controls[i][1]=v.gety(); - controls[i][2]=v.getz(); - } + transformTriples(t,n,controls,s->controls); if(s->weights) { weights=new(UseGC) double[n]; @@ -146,21 +150,21 @@ public: bool is3D() {return true;} - void bounds(bbox3& b); + void bounds(const double* t, bbox3& b); virtual ~drawNurbsPath3() {} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); void displacement(); - void ratio(pair &b, double (*m)(double, double), double fuzz, bool &first); + void ratio(const double* t, pair &b, double (*m)(double, double), double fuzz, + bool &first); void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent); + double perspective, bool lighton, bool transparent); - drawElement *transformed(const vm::array& t); + drawElement *transformed(const double* t); }; } diff --git a/Build/source/utils/asymptote/drawsurface.cc b/Build/source/utils/asymptote/drawsurface.cc index bc9705e58b0..9775db2cb5c 100644 --- a/Build/source/utils/asymptote/drawsurface.cc +++ b/Build/source/utils/asymptote/drawsurface.cc @@ -7,6 +7,10 @@ #include "drawsurface.h" #include "arrayop.h" +#include <iostream> +#include <iomanip> +#include <fstream> + namespace camp { const double pixel=1.0; // Adaptive rendering constant. @@ -32,15 +36,64 @@ void storecolor(GLfloat *colors, int i, const RGBAColour& p) colors[i+2]=p.B; colors[i+3]=p.A; } + +void setcolors(bool colors, bool lighton, + const RGBAColour& diffuse, + const RGBAColour& ambient, + const RGBAColour& emissive, + const RGBAColour& specular, double shininess) +{ + if(colors) { + glEnable(GL_COLOR_MATERIAL); + if(!lighton) + glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION); + } + + if(colors) { + GLfloat Black[]={0,0,0,(GLfloat) diffuse.A}; + glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Black); + glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Black); + glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,Black); + } else { + GLfloat Diffuse[]={(GLfloat) diffuse.R,(GLfloat) diffuse.G, + (GLfloat) diffuse.B,(GLfloat) diffuse.A}; + glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); + + GLfloat Ambient[]={(GLfloat) ambient.R,(GLfloat) ambient.G, + (GLfloat) ambient.B,(GLfloat) ambient.A}; + glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambient); + + GLfloat Emissive[]={(GLfloat) emissive.R,(GLfloat) emissive.G, + (GLfloat) emissive.B,(GLfloat) emissive.A}; + glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,Emissive); + } + + if(lighton) { + GLfloat Specular[]={(GLfloat) specular.R,(GLfloat) specular.G, + (GLfloat) specular.B,(GLfloat) specular.A}; + glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular); + + glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,128.0*shininess); + } +} + #endif -void drawSurface::bounds(bbox3& b) +void drawSurface::bounds(const double* t, bbox3& b) { double x,y,z; double X,Y,Z; if(straight) { - double *v=vertices[0]; + Triple *Vertices; + if(t == NULL) Vertices=vertices; + else { + static Triple buf[4]; + Vertices=buf; + transformTriples(t,4,Vertices,vertices); + } + + double *v=Vertices[0]; x=v[0]; y=v[1]; z=v[2]; @@ -48,7 +101,7 @@ void drawSurface::bounds(bbox3& b) Y=y; Z=z; for(size_t i=1; i < 4; ++i) { - double *v=vertices[i]; + double *v=Vertices[i]; double vx=v[0]; x=min(x,vx); X=max(X,vx); @@ -60,44 +113,62 @@ void drawSurface::bounds(bbox3& b) Z=max(Z,vz); } } else { + Triple* Controls; + if(t == NULL) Controls=controls; + else { + static Triple buf[16]; + Controls=buf; + transformTriples(t,16,Controls,controls); + } + static double c1[16]; for(int i=0; i < 16; ++i) - c1[i]=controls[i][0]; + c1[i]=Controls[i][0]; double c0=c1[0]; double fuzz=sqrtFuzz*run::norm(c1,16); x=bound(c1,min,b.empty ? c0 : min(c0,b.left),fuzz); X=bound(c1,max,b.empty ? c0 : max(c0,b.right),fuzz); for(int i=0; i < 16; ++i) - c1[i]=controls[i][1]; + c1[i]=Controls[i][1]; c0=c1[0]; fuzz=sqrtFuzz*run::norm(c1,16); y=bound(c1,min,b.empty ? c0 : min(c0,b.bottom),fuzz); Y=bound(c1,max,b.empty ? c0 : max(c0,b.top),fuzz); for(int i=0; i < 16; ++i) - c1[i]=controls[i][2]; + c1[i]=Controls[i][2]; c0=c1[0]; fuzz=sqrtFuzz*run::norm(c1,16); z=bound(c1,min,b.empty ? c0 : min(c0,b.lower),fuzz); Z=bound(c1,max,b.empty ? c0 : max(c0,b.upper),fuzz); } - Min=triple(x,y,z); - Max=triple(X,Y,Z); - - b.add(Min); - b.add(Max); + b.add(x,y,z); + b.add(X,Y,Z); + + if(t == NULL) { + Min=triple(x,y,z); + Max=triple(X,Y,Z); + } } -void drawSurface::ratio(pair &b, double (*m)(double, double), double fuzz, - bool &first) +void drawSurface::ratio(const double* t, pair &b, double (*m)(double, double), + double fuzz, bool &first) { if(straight) { + Triple *Vertices; + if(t == NULL) Vertices=vertices; + else { + static Triple buf[4]; + Vertices=buf; + transformTriples(t,4,Vertices,vertices); + } + if(first) { first=false; - double *ci=vertices[0]; + double *ci=Vertices[0]; triple v=triple(ci[0],ci[1],ci[2]); b=pair(xratio(v),yratio(v)); } @@ -105,16 +176,24 @@ void drawSurface::ratio(pair &b, double (*m)(double, double), double fuzz, double x=b.getx(); double y=b.gety(); for(size_t i=0; i < 4; ++i) { - double *ci=vertices[i]; + double *ci=Vertices[i]; triple v=triple(ci[0],ci[1],ci[2]); x=m(x,xratio(v)); y=m(y,yratio(v)); } b=pair(x,y); } else { + Triple* Controls; + if(t == NULL) Controls=controls; + else { + static Triple buf[16]; + Controls=buf; + transformTriples(t,16,Controls,controls); + } + static triple c3[16]; for(int i=0; i < 16; ++i) { - double *ci=controls[i]; + double *ci=Controls[i]; c3[i]=triple(ci[0],ci[1],ci[2]); } @@ -128,8 +207,7 @@ void drawSurface::ratio(pair &b, double (*m)(double, double), double fuzz, } } -bool drawSurface::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawSurface::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible || !prc) return true; @@ -162,7 +240,7 @@ inline triple maxabs(triple u, triple v) max(fabs(u.getz()),fabs(v.getz()))); } -inline triple displacement(const Triple& z0, const Triple& c0, +inline triple displacement1(const Triple& z0, const Triple& c0, const Triple& c1, const Triple& z1) { triple Z0(z0); @@ -179,16 +257,16 @@ void drawSurface::displacement() if(!straight) { for(size_t i=1; i < 16; ++i) - d=camp::maxabs(d,camp::displacement2(controls[i],controls[0],normal)); + d=maxabs(d,displacement2(controls[i],controls[0],normal)); dperp=d; for(size_t i=0; i < 4; ++i) - d=camp::maxabs(d,camp::displacement(controls[4*i],controls[4*i+1], - controls[4*i+2],controls[4*i+3])); + d=maxabs(d,displacement1(controls[4*i],controls[4*i+1], + controls[4*i+2],controls[4*i+3])); for(size_t i=0; i < 4; ++i) - d=camp::maxabs(d,camp::displacement(controls[i],controls[i+4], - controls[i+8],controls[i+12])); + d=maxabs(d,displacement1(controls[i],controls[i+4], + controls[i+8],controls[i+12])); } } #endif @@ -209,7 +287,7 @@ inline double fraction(const triple& d, const triple& size) void drawSurface::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent) + double perspective, bool lighton, bool transparent) { #ifdef HAVE_GL if(invisible || @@ -219,42 +297,24 @@ void drawSurface::render(GLUnurbs *nurb, double size2, static GLfloat Normal[3]; static GLfloat v[16]; - static GLfloat v1[16]; - static GLfloat v2[16]; - bool havebillboard=interaction == BILLBOARD && + const bool havebillboard=interaction == BILLBOARD && !settings::getSetting<bool>("offscreen"); triple m,M; if(perspective || !havebillboard) { - initMatrix(v1,v2); + static double t[16]; + glGetDoublev(GL_MODELVIEW_MATRIX,t); - glPushMatrix(); - glMultMatrixf(v1); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - bbox3 B(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); - - glPushMatrix(); - glMultMatrixf(v2); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - B.addnonempty(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); + bbox3 B(this->Min,this->Max); + B.transform(t); m=B.Min(); M=B.Max(); } if(perspective) { - double f=m.getz()*perspective; - double F=M.getz()*perspective; + const double f=m.getz()*perspective; + const double F=M.getz()*perspective; s=max(f,F); if(!havebillboard && (M.getx() < min(f*Min.getx(),F*Min.getx()) || m.getx() > max(f*Max.getx(),F*Max.getx()) || @@ -271,40 +331,10 @@ void drawSurface::render(GLUnurbs *nurb, double size2, return; } - bool ambientdiffuse=true; - bool emission=true; - - if(colors) { - glEnable(GL_COLOR_MATERIAL); - if(lighton) { - glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); - ambientdiffuse=false; - } else { - glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION); - emission=false; - } - } + setcolors(colors,lighton,diffuse,ambient,emissive,specular,shininess); - if(ambientdiffuse) { - GLfloat Diffuse[]={diffuse.R,diffuse.G,diffuse.B,diffuse.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - - GLfloat Ambient[]={ambient.R,ambient.G,ambient.B,ambient.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambient); - } - - if(emission) { - GLfloat Emissive[]={emissive.R,emissive.G,emissive.B,emissive.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,Emissive); - } - - GLfloat Specular[]={specular.R,specular.G,specular.B,specular.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular); - - glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,128.0*shininess); - - triple size3=triple(s*(Max.getx()-Min.getx()),s*(Max.gety()-Min.gety()), - Max.getz()-Min.getz()); + const triple size3(s*(Max.getx()-Min.getx()),s*(Max.gety()-Min.gety()), + Max.getz()-Min.getz()); bool havenormal=normal != zero; if(havebillboard) BB.init(); @@ -383,13 +413,12 @@ void drawSurface::render(GLUnurbs *nurb, double size2, #endif } -drawElement *drawSurface::transformed(const array& t) +drawElement *drawSurface::transformed(const double* t) { return new drawSurface(t,this); } -bool drawNurbs::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawNurbs::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; @@ -401,10 +430,17 @@ bool drawNurbs::write(prcfile *out, unsigned int *, array *, array *, double, } // Approximate bounds by bounding box of control polyhedron. -void drawNurbs::bounds(bbox3& b) +void drawNurbs::bounds(const double* t, bbox3& b) { - size_t n=nu*nv; - double *v=controls[0]; + const size_t n=nu*nv; + Triple* Controls; + if(t == NULL) Controls=controls; + else { + Controls=new Triple[n]; + transformTriples(t,n,Controls,controls); + } + + double *v=Controls[0]; double x=v[0]; double y=v[1]; double z=v[2]; @@ -412,7 +448,7 @@ void drawNurbs::bounds(bbox3& b) double Y=y; double Z=z; for(size_t i=1; i < n; ++i) { - double *v=controls[i]; + double *v=Controls[i]; double vx=v[0]; x=min(x,vx); X=max(X,vx); @@ -424,23 +460,34 @@ void drawNurbs::bounds(bbox3& b) Z=max(Z,vz); } - Min=triple(x,y,z); - Max=triple(X,Y,Z); - b.add(Min); - b.add(Max); + b.add(x,y,z); + b.add(X,Y,Z); + + if(t == NULL) { + Min=triple(x,y,z); + Max=triple(X,Y,Z); + } else delete[] Controls; } -drawElement *drawNurbs::transformed(const array& t) +drawElement *drawNurbs::transformed(const double* t) { return new drawNurbs(t,this); } -void drawNurbs::ratio(pair &b, double (*m)(double, double), double, bool &first) +void drawNurbs::ratio(const double *t, pair &b, double (*m)(double, double), + double, bool &first) { - size_t n=nu*nv; + const size_t n=nu*nv; + Triple* Controls; + if(t == NULL) Controls=controls; + else { + Controls=new Triple[n]; + transformTriples(t,n,Controls,controls); + } + if(first) { first=false; - double *ci=controls[0]; + double *ci=Controls[0]; triple v=triple(ci[0],ci[1],ci[2]); b=pair(xratio(v),yratio(v)); } @@ -448,14 +495,18 @@ void drawNurbs::ratio(pair &b, double (*m)(double, double), double, bool &first) double x=b.getx(); double y=b.gety(); for(size_t i=0; i < n; ++i) { - double *ci=controls[i]; + double *ci=Controls[i]; triple v=triple(ci[0],ci[1],ci[2]); x=m(x,xratio(v)); y=m(y,yratio(v)); } b=pair(x,y); + + if(t != NULL) + delete[] Controls; } + void drawNurbs::displacement() { #ifdef HAVE_GL @@ -485,37 +536,17 @@ void drawNurbs::displacement() void drawNurbs::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent) + double perspective, bool lighton, bool transparent) { #ifdef HAVE_GL if(invisible || ((colors ? colors[3]+colors[7]+colors[11]+colors[15] < 4.0 : diffuse.A < 1.0) ^ transparent)) return; - static GLfloat v[16]; - static GLfloat v1[16]; - static GLfloat v2[16]; - - initMatrix(v1,v2); - - glPushMatrix(); - glMultMatrixf(v1); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - bbox3 B(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); - - glPushMatrix(); - glMultMatrixf(v2); - glGetFloatv(GL_MODELVIEW_MATRIX,v); - glPopMatrix(); - - B.addnonempty(v[0],v[1],v[2]); - B.addnonempty(v[4],v[5],v[6]); - B.addnonempty(v[8],v[9],v[10]); - B.addnonempty(v[12],v[13],v[14]); + static double t[16]; // current transform + glGetDoublev(GL_MODELVIEW_MATRIX,t); + + bbox3 B(this->Min,this->Max); + B.transform(t); triple m=B.Min(); triple M=B.Max(); @@ -535,39 +566,8 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, M.getz() < Min.getz() || m.getz() > Max.getz()) return; } - bool ambientdiffuse=true; - bool emission=true; - - if(colors) { - glEnable(GL_COLOR_MATERIAL); - if(lighton) { - glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); - ambientdiffuse=false; - } else { - glColorMaterial(GL_FRONT_AND_BACK,GL_EMISSION); - emission=false; - } - } + setcolors(colors,lighton,diffuse,ambient,emissive,specular,shininess); - if(ambientdiffuse) { - GLfloat Diffuse[]={diffuse.R,diffuse.G,diffuse.B,diffuse.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Diffuse); - - GLfloat Ambient[]={ambient.R,ambient.G,ambient.B,ambient.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Ambient); - } - - if(emission) { - GLfloat Emissive[]={emissive.R,emissive.G,emissive.B,emissive.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,Emissive); - } - - GLfloat Specular[]={specular.R,specular.G,specular.B,specular.A}; - glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,Specular); - - glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,128.0*shininess); - - gluNurbsCallback(nurb,GLU_NURBS_NORMAL,(_GLUfuncptr) glNormal3fv); gluBeginSurface(nurb); int uorder=udegree+1; int vorder=vdegree+1; @@ -575,6 +575,9 @@ void drawNurbs::render(GLUnurbs *nurb, double size2, gluNurbsSurface(nurb,uorder+nu,uKnots,vorder+nv,vKnots,stride*nv,stride, Controls,uorder,vorder, weights ? GL_MAP2_VERTEX_4 : GL_MAP2_VERTEX_3); + if(lighton) + gluNurbsCallback(nurb,GLU_NURBS_NORMAL,(_GLUfuncptr) glNormal3fv); + if(colors) { static GLfloat linear[]={0.0,0.0,1.0,1.0}; gluNurbsSurface(nurb,4,linear,4,linear,8,4,colors,2,2,GL_MAP2_COLOR_4); @@ -593,25 +596,16 @@ void drawSphere::P(Triple& t, double x, double y, double z) double temp=z; z=x; x=-temp; } - double f=T[12]*x+T[13]*y+T[14]*z+T[15]; + double f=T[3]*x+T[7]*y+T[11]*z+T[15]; if(f == 0.0) run::dividebyzero(); f=1.0/f; - t[0]=(T[0]*x+T[1]*y+T[2]*z+T[3])*f; - t[1]=(T[4]*x+T[5]*y+T[6]*z+T[7])*f; - t[2]=(T[8]*x+T[9]*y+T[10]*z+T[11])*f; + t[0]=(T[0]*x+T[4]*y+T[ 8]*z+T[12])*f; + t[1]=(T[1]*x+T[5]*y+T[ 9]*z+T[13])*f; + t[2]=(T[2]*x+T[6]*y+T[10]*z+T[14])*f; } -static const Triple origin={0.0,0.0,0.0}; -static const Triple xaxis={1.0,0.0,0.0}; -static const Triple yaxis={0.0,1.0,0.0}; -static const double Identity4[4][4]={{1.0,0.0,0.0,0.0}, - {0.0,1.0,0.0,0.0}, - {0.0,0.0,1.0,0.0}, - {0.0,0.0,0.0,1.0}}; - -bool drawSphere::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawSphere::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; @@ -622,9 +616,9 @@ bool drawSphere::write(prcfile *out, unsigned int *, array *, array *, double, case 0: // PRCsphere { if(half) - out->addHemisphere(1.0,m,origin,xaxis,yaxis,1.0,(double (*)[4]) T); + out->addHemisphere(1.0,m,NULL,NULL,NULL,1.0,T); else - out->addSphere(1.0,m,origin,xaxis,yaxis,1.0,(double (*)[4]) T); + out->addSphere(1.0,m,NULL,NULL,NULL,1.0,T); break; } case 1: // NURBSsphere @@ -699,34 +693,31 @@ bool drawSphere::write(prcfile *out, unsigned int *, array *, array *, double, return true; } -bool drawCylinder::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawCylinder::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess); - out->addCylinder(1.0,1.0,m,origin,xaxis,yaxis,1.0,(double (*)[4]) T); + out->addCylinder(1.0,1.0,m,NULL,NULL,NULL,1.0,T); return true; } -bool drawDisk::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawDisk::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; PRCmaterial m(ambient,diffuse,emissive,specular,opacity,shininess); - out->addDisk(1.0,m,origin,xaxis,yaxis,1.0,(double (*)[4]) T); + out->addDisk(1.0,m,NULL,NULL,NULL,1.0,T); return true; } -bool drawTube::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawTube::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; @@ -743,8 +734,7 @@ bool drawTube::write(prcfile *out, unsigned int *, array *, array *, double, Triple *controls=new(UseGC) Triple[N]; for(Int i=0; i <= n; ++i) store(controls[i],g.point(i)); - out->addTube(N,centerControls,controls,true,m,origin,xaxis,yaxis,1.0, - Identity4); + out->addTube(N,centerControls,controls,true,m,NULL,NULL,NULL,1.0); } else { size_t N=3*n+1; Triple *centerControls=new(UseGC) Triple[N]; @@ -771,15 +761,13 @@ bool drawTube::write(prcfile *out, unsigned int *, array *, array *, double, store(controls[++k],g.precontrol(n)); store(controls[++k],g.point(n)); - out->addTube(N,centerControls,controls,false,m,origin,xaxis,yaxis,1.0, - Identity4); + out->addTube(N,centerControls,controls,false,m,NULL,NULL,NULL,1.0); } return true; } -bool drawPixel::write(prcfile *out, unsigned int *, array *, array *, double, - groupsmap&) +bool drawPixel::write(prcfile *out, unsigned int *, double, groupsmap&) { if(invisible) return true; @@ -791,7 +779,7 @@ bool drawPixel::write(prcfile *out, unsigned int *, array *, array *, double, void drawPixel::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent) + double perspective, bool lighton, bool transparent) { #ifdef HAVE_GL if(invisible) @@ -822,4 +810,129 @@ void drawPixel::render(GLUnurbs *nurb, double size2, #endif } +const string drawBaseTriangles::wrongsize= + "triangle indices require 3 components"; +const string drawBaseTriangles::outofrange="index out of range"; + +void drawBaseTriangles::bounds(const double* t, bbox3& b) +{ + double x,y,z; + double X,Y,Z; + Triple* tP; + + if(t == NULL) tP=P; + else { + tP=new Triple[nP]; + transformTriples(t,nP,tP,P); + } + + boundsTriples(x,y,z,X,Y,Z,nP,tP); + + b.add(x,y,z); + b.add(X,Y,Z); + + if(t == NULL) { + Min=triple(x,y,z); + Max=triple(X,Y,Z); + } else delete[] tP; +} + +void drawBaseTriangles::ratio(const double* t, pair &b, + double (*m)(double, double), double fuzz, + bool &first) +{ + Triple* tP; + + if(t == NULL) tP=P; + else { + tP=new Triple[nP]; + transformTriples(t,nP,tP,P); + } + + ratioTriples(b,m,first,nP,tP); + + if(t != NULL) + delete[] tP; +} + +bool drawTriangles::write(prcfile *out, unsigned int *, double, groupsmap&) +{ + if(invisible) + return true; + + PRCmaterial m(ambient,diffuse,emissive,specular,opacity,PRCshininess); + + out->addTriangles(nP,P,nI,PI,m,nN,N,NI,0,NULL,NULL,nC,C,CI,0,NULL,NULL,30); + + return true; +} + +void drawTriangles::render(GLUnurbs *nurb, double size2, const triple& Min, + const triple& Max, double perspective, bool lighton, + bool transparent) +{ +#ifdef HAVE_GL + if(invisible) + return; + + if(invisible || ((diffuse.A < 1.0) ^ transparent)) return; + + triple m,M; + static double t[16]; // current transform + glGetDoublev(GL_MODELVIEW_MATRIX,t); + + bbox3 B(this->Min,this->Max); + B.transform(t); + + m=B.Min(); + M=B.Max(); + + if(perspective) { + const double f=m.getz()*perspective; + const double F=M.getz()*perspective; + if((M.getx() < min(f*Min.getx(),F*Min.getx()) || + m.getx() > max(f*Max.getx(),F*Max.getx()) || + M.gety() < min(f*Min.gety(),F*Min.gety()) || + m.gety() > max(f*Max.gety(),F*Max.gety()) || + M.getz() < Min.getz() || + m.getz() > Max.getz())) + return; + } else { + if((M.getx() < Min.getx() || m.getx() > Max.getx() || + M.gety() < Min.gety() || m.gety() > Max.gety() || + M.getz() < Min.getz() || m.getz() > Max.getz())) + return; + } + + setcolors(nC,!nC,diffuse,ambient,emissive,specular,shininess); + if(!nN) lighton=false; + + glBegin(GL_TRIANGLES); + for(size_t i=0; i < nI; i++) { + const uint32_t *pi=PI[i]; + const uint32_t *ni=NI[i]; + const uint32_t *ci=nC ? CI[i] : 0; + if(lighton) + glNormal3f(N[ni[0]][0],N[ni[0]][1],N[ni[0]][2]); + if(nC) + glColor4f(C[ci[0]].R,C[ci[0]].G,C[ci[0]].B,C[ci[0]].A); + glVertex3f(P[pi[0]][0],P[pi[0]][1],P[pi[0]][2]); + if(lighton) + glNormal3f(N[ni[1]][0],N[ni[1]][1],N[ni[1]][2]); + if(nC) + glColor4f(C[ci[1]].R,C[ci[1]].G,C[ci[1]].B,C[ci[1]].A); + glVertex3f(P[pi[1]][0],P[pi[1]][1],P[pi[1]][2]); + if(lighton) + glNormal3f(N[ni[2]][0],N[ni[2]][1],N[ni[2]][2]); + if(nC) + glColor4f(C[ci[2]].R,C[ci[2]].G,C[ci[2]].B,C[ci[2]].A); + glVertex3f(P[pi[2]][0],P[pi[2]][1],P[pi[2]][2]); + } + glEnd(); + + if(nC) + glDisable(GL_COLOR_MATERIAL); +#endif +} + } //namespace camp diff --git a/Build/source/utils/asymptote/drawsurface.h b/Build/source/utils/asymptote/drawsurface.h index c2c71578e82..46a42ad25d9 100644 --- a/Build/source/utils/asymptote/drawsurface.h +++ b/Build/source/utils/asymptote/drawsurface.h @@ -16,27 +16,6 @@ namespace camp { #ifdef HAVE_GL void storecolor(GLfloat *colors, int i, const vm::array &pens, int j); - -inline void initMatrix(GLfloat *v, double x, double ymin, double zmin, - double ymax, double zmax) -{ - v[0]=x; - v[1]=ymin; - v[2]=zmin; - v[3]=1.0; - v[4]=x; - v[5]=ymin; - v[6]=zmax; - v[7]=1.0; - v[8]=x; - v[9]=ymax; - v[10]=zmin; - v[11]=1.0; - v[12]=x; - v[13]=ymax; - v[14]=zmax; - v[15]=1.0; -} #endif class drawSurface : public drawElement { @@ -55,7 +34,6 @@ protected: double PRCshininess; triple normal; bool invisible; - bool lighton; Interaction interaction; triple Min,Max; @@ -70,11 +48,11 @@ public: drawSurface(const vm::array& g, triple center, bool straight, const vm::array&p, double opacity, double shininess, double PRCshininess, triple normal, const vm::array &pens, - bool lighton, Interaction interaction, bool prc) : + Interaction interaction, bool prc) : center(center), straight(straight), opacity(opacity), shininess(shininess), - PRCshininess(PRCshininess), normal(unit(normal)), lighton(lighton), + PRCshininess(PRCshininess), normal(unit(normal)), interaction(interaction), prc(prc) { - string wrongsize= + const string wrongsize= "Bezier surface patch requires 4x4 array of triples and array of 4 pens"; if(checkArray(&g) != 4 || checkArray(&p) != 4) reportError(wrongsize); @@ -121,29 +99,23 @@ public: } else colors=NULL; } - drawSurface(const vm::array& t, const drawSurface *s) : + drawSurface(const double* 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), PRCshininess(s->PRCshininess), - invisible(s->invisible), lighton(s->lighton), + invisible(s->invisible), interaction(s->interaction), prc(s->prc) { - for(size_t i=0; i < 4; ++i) { - const double *c=s->vertices[i]; - store(vertices[i],run::operator *(t,triple(c[0],c[1],c[2]))); - } + transformTriples(t,4,vertices,s->vertices); if(s->controls) { controls=new(UseGC) Triple[16]; - for(size_t i=0; i < 16; ++i) { - const double *c=s->controls[i]; - store(controls[i],run::operator *(t,triple(c[0],c[1],c[2]))); - } + transformTriples(t,16,controls,s->controls); } else controls=NULL; #ifdef HAVE_GL - center=run::operator *(t,s->center); - normal=run::multshiftless(t,s->normal); + center=t*s->center; + normal=multshiftless(t,s->normal); #endif if(s->colors) { @@ -155,28 +127,21 @@ public: bool is3D() {return true;} - void bounds(bbox3& b); + void bounds(const double* t, bbox3& b); - void ratio(pair &b, double (*m)(double, double), double fuzz, bool &first); + void ratio(const double* t, pair &b, double (*m)(double, double), double fuzz, + bool &first); virtual ~drawSurface() {} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); void displacement(); -#ifdef HAVE_GL - void initMatrix(GLfloat *v1, GLfloat *v2) { - camp::initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - camp::initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - } -#endif - void render(GLUnurbs *nurb, double, const triple& Min, const triple& Max, - double perspective, bool transparent); + double perspective, bool lighton, bool transparent); - drawElement *transformed(const vm::array& t); + drawElement *transformed(const double* t); }; class drawNurbs : public drawElement { @@ -195,7 +160,6 @@ protected: double PRCshininess; triple normal; bool invisible; - bool lighton; triple Min,Max; @@ -209,12 +173,12 @@ protected: public: drawNurbs(const vm::array& g, const vm::array* uknot, const vm::array* vknot, const vm::array* weight, const vm::array&p, double opacity, - double shininess, double PRCshininess, const vm::array &pens, - bool lighton) : opacity(opacity), shininess(shininess), - PRCshininess(PRCshininess), lighton(lighton) { + double shininess, double PRCshininess, const vm::array &pens) + : opacity(opacity), shininess(shininess), + PRCshininess(PRCshininess) { size_t weightsize=checkArray(weight); - string wrongsize="Inconsistent NURBS data"; + const string wrongsize="Inconsistent NURBS data"; nu=checkArray(&g); if(nu == 0 || (weightsize != 0 && weightsize != nu) || checkArray(&p) != 4) @@ -281,23 +245,17 @@ public: #endif } - drawNurbs(const vm::array& t, const drawNurbs *s) : + drawNurbs(const double* t, const drawNurbs *s) : udegree(s->udegree), vdegree(s->vdegree), nu(s->nu), nv(s->nv), diffuse(s->diffuse), ambient(s->ambient), emissive(s->emissive), specular(s->specular), opacity(s->opacity), shininess(s->shininess), PRCshininess(s->PRCshininess), - invisible(s->invisible), lighton(s->lighton) { + invisible(s->invisible) { - size_t n=nu*nv; + const size_t n=nu*nv; controls=new(UseGC) Triple[n]; - for(size_t i=0; i < n; ++i) { - const double *c=s->controls[i]; - triple v=run::operator *(t,triple(c[0],c[1],c[2])); - controls[i][0]=v.getx(); - controls[i][1]=v.gety(); - controls[i][2]=v.getz(); - } + transformTriples(t,n,controls,s->controls); if(s->weights) { weights=new(UseGC) double[n]; @@ -328,51 +286,25 @@ public: bool is3D() {return true;} - void bounds(bbox3& b); + void bounds(const double* t, bbox3& b); virtual ~drawNurbs() {} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); void displacement(); - void ratio(pair &b, double (*m)(double, double), double, bool &first); - -#ifdef HAVE_GL - void initMatrix(GLfloat *v1, GLfloat *v2) { - camp::initMatrix(v1,Min.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - camp::initMatrix(v2,Max.getx(),Min.gety(),Min.getz(),Max.gety(),Max.getz()); - } -#endif + void ratio(const double* t, pair &b, double (*m)(double, double), double, + bool &first); void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent); + double perspective, bool lighton, bool transparent); - drawElement *transformed(const vm::array& t); + drawElement *transformed(const double* t); }; -template<class T> -void copyArray4x4C(T* dest, const vm::array *a) -{ - size_t n=checkArray(a); - string fourbyfour="4x4 array of doubles expected"; - if(n != 4) reportError(fourbyfour); - - for(size_t i=0; i < 4; i++) { - vm::array *ai=vm::read<vm::array*>(a,i); - size_t aisize=checkArray(ai); - if(aisize == 4) { - T *desti=dest+4*i; - for(size_t j=0; j < 4; j++) - desti[j]=vm::read<T>(ai,j); - } else reportError(fourbyfour); - } -} - // Draw a transformed PRC object. -class drawPRC : public drawElement { +class drawPRC : public drawElementLC { protected: - double T[16]; RGBAColour diffuse; RGBAColour ambient; RGBAColour emissive; @@ -382,10 +314,8 @@ protected: bool invisible; public: drawPRC(const vm::array& t, const vm::array&p, double opacity, - double shininess) : - opacity(opacity), shininess(shininess) { - - copyArray4x4C<double>(T,&t); + double shininess) : + drawElementLC(t), opacity(opacity), shininess(shininess) { string needfourpens="array of 4 pens required"; if(checkArray(&p) != 4) @@ -400,31 +330,19 @@ public: specular=rgba(vm::read<camp::pen>(p,3)); } - drawPRC(const vm::array& t, const drawPRC *s) : - diffuse(s->diffuse), ambient(s->ambient), emissive(s->emissive), - specular(s->specular), opacity(s->opacity), + drawPRC(const double* t, const drawPRC *s) : + drawElementLC(t, s), diffuse(s->diffuse), ambient(s->ambient), + emissive(s->emissive), specular(s->specular), opacity(s->opacity), shininess(s->shininess), invisible(s->invisible) { - - double S[16]; - copyArray4x4C<double>(S,&t); - - const double *R=s->T; - for(unsigned i=0; i < 16; i += 4) { - double s0=S[i+0]; - double s1=S[i+1]; - double s2=S[i+2]; - double s3=S[i+3]; - T[i]=s0*R[0]+s1*R[4]+s2*R[8]+s3*R[12]; - T[i+1]=s0*R[1]+s1*R[5]+s2*R[9]+s3*R[13]; - T[i+2]=s0*R[2]+s1*R[6]+s2*R[10]+s3*R[14]; - T[i+3]=s0*R[3]+s1*R[7]+s2*R[11]+s3*R[15]; - } } - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&) { + bool write(prcfile *out, unsigned int *, double, groupsmap&) { return true; } + virtual void transformedbounds(const double*, bbox3&) {} + virtual void transformedratio(const double*, pair&, double (*)(double, double), + double, bool&) {} + }; // Draw a PRC unit sphere. @@ -436,16 +354,15 @@ public: double shininess, int type) : drawPRC(t,p,opacity,shininess), half(half), type(type) {} - drawSphere(const vm::array& t, const drawSphere *s) : + drawSphere(const double* t, const drawSphere *s) : drawPRC(t,s), half(s->half), type(s->type) {} void P(Triple& t, double x, double y, double z); - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); - drawElement *transformed(const vm::array& t) { - return new drawSphere(t,this); + drawElement *transformed(const double* t) { + return new drawSphere(t,this); } }; @@ -453,17 +370,16 @@ public: class drawCylinder : public drawPRC { public: drawCylinder(const vm::array& t, const vm::array&p, double opacity, - double shininess) : + double shininess) : drawPRC(t,p,opacity,shininess) {} - drawCylinder(const vm::array& t, const drawCylinder *s) : + drawCylinder(const double* t, const drawCylinder *s) : drawPRC(t,s) {} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); - drawElement *transformed(const vm::array& t) { - return new drawCylinder(t,this); + drawElement *transformed(const double* t) { + return new drawCylinder(t,this); } }; @@ -471,17 +387,16 @@ public: class drawDisk : public drawPRC { public: drawDisk(const vm::array& t, const vm::array&p, double opacity, - double shininess) : + double shininess) : drawPRC(t,p,opacity,shininess) {} - drawDisk(const vm::array& t, const drawDisk *s) : + drawDisk(const double* t, const drawDisk *s) : drawPRC(t,s) {} - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); - drawElement *transformed(const vm::array& t) { - return new drawDisk(t,this); + drawElement *transformed(const double* t) { + return new drawDisk(t,this); } }; @@ -499,7 +414,7 @@ protected: bool invisible; public: drawTube(path3 center, path3 g, const vm::array&p, double opacity, - double shininess) : + double shininess) : center(center), g(g), opacity(opacity), shininess(shininess) { string needfourpens="array of 4 pens required"; if(checkArray(&p) != 4) @@ -514,18 +429,17 @@ public: specular=rgba(vm::read<camp::pen>(p,3)); } - drawTube(const vm::array& t, const drawTube *s) : + drawTube(const double* t, const drawTube *s) : center(camp::transformed(t,s->center)), g(camp::transformed(t,s->g)), diffuse(s->diffuse), ambient(s->ambient), emissive(s->emissive), specular(s->specular), opacity(s->opacity), shininess(s->shininess), invisible(s->invisible) { } - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); - drawElement *transformed(const vm::array& t) { - return new drawTube(t,this); + drawElement *transformed(const double* t) { + return new drawTube(t,this); } }; @@ -542,32 +456,226 @@ public: invisible=p.invisible(); } - drawPixel(const vm::array& t, const drawPixel *s) : + drawPixel(const double* t, const drawPixel *s) : c(s->c), width(s->width), invisible(s->invisible) { - triple V=run::operator *(t,triple(s->v[0],s->v[1],s->v[2])); - v[0]=V.getx(); - v[1]=V.gety(); - v[2]=V.getz(); + transformTriples(t,1,&v,&(s->v)); } - void bounds(bbox3& b) { - triple R=0.5*width*triple(1.0,1.0,1.0); - b.add(v-R); - b.add(v+R); + void bounds(const double* t, bbox3& b) { + const triple R=0.5*width*triple(1.0,1.0,1.0); + if (t != NULL) { + Triple tv; + transformTriples(t,1,&tv,&v); + b.add(tv-R); + b.add(tv+R); + } else { + b.add(v-R); + b.add(v+R); + } } void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - - double perspective, bool transparent); + double perspective, bool lighton, bool transparent); - bool write(prcfile *out, unsigned int *, vm::array *, vm::array *, double, - groupsmap&); + bool write(prcfile *out, unsigned int *, double, groupsmap&); - drawElement *transformed(const vm::array& t) { + drawElement *transformed(const double* t) { return new drawPixel(t,this); } }; +class drawBaseTriangles : public drawElement { +protected: + size_t nP; + Triple* P; + size_t nN; + Triple* N; + size_t nI; + uint32_t (*PI)[3]; + uint32_t (*NI)[3]; + + triple Min,Max; + + static const string wrongsize; + static const string outofrange; + +public: + drawBaseTriangles(const vm::array& v, const vm::array& vi, + const vm::array& n, const vm::array& ni) { + nP=checkArray(&v); + P=new(UseGC) Triple[nP]; + for(size_t i=0; i < nP; ++i) + store(P[i],vm::read<triple>(v,i)); + + nI=checkArray(&vi); + PI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + vm::array *vii=vm::read<vm::array*>(vi,i); + if(checkArray(vii) != 3) reportError(wrongsize); + uint32_t *PIi=PI[i]; + for(size_t j=0; j < 3; ++j) { + size_t index=unsignedcast(vm::read<Int>(vii,j)); + if(index >= nP) reportError(outofrange); + PIi[j]=index; + } + } + + nN=checkArray(&n); + if(nN) { + N=new(UseGC) Triple[nN]; + for(size_t i=0; i < nN; ++i) + store(N[i],vm::read<triple>(n,i)); + + if(checkArray(&ni) != nI) + reportError("Index arrays have different lengths"); + NI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + vm::array *nii=vm::read<vm::array*>(ni,i); + if(checkArray(nii) != 3) reportError(wrongsize); + uint32_t *NIi=NI[i]; + for(size_t j=0; j < 3; ++j) { + size_t index=unsignedcast(vm::read<Int>(nii,j)); + if(index >= nN) reportError(outofrange); + NIi[j]=index; + } + } + } + } + + drawBaseTriangles(const double* t, const drawBaseTriangles *s) : + nP(s->nP), nN(s->nN), nI(s->nI) { + P=new(UseGC) Triple[nP]; + transformTriples(t,nP,P,s->P); + + PI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + uint32_t *PIi=PI[i]; + uint32_t *sPIi=s->PI[i]; + for(size_t j=0; j < 3; ++j) + PIi[j]=sPIi[j]; + } + + if(nN) { + N=new(UseGC) Triple[nN]; + transformNormalsTriples(t,nN,N,s->N); + + NI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + uint32_t *NIi=NI[i]; + uint32_t *sNIi=s->NI[i]; + for(size_t j=0; j < 3; ++j) + NIi[j]=sNIi[j]; + } + } + } + + bool is3D() {return true;} + + void bounds(const double* t, bbox3& b); + + void ratio(const double* t, pair &b, double (*m)(double, double), double fuzz, + bool &first); + + virtual ~drawBaseTriangles() {} + + drawElement *transformed(const double* t) { + return new drawBaseTriangles(t,this); + } +}; + +class drawTriangles : public drawBaseTriangles { + size_t nC; + RGBAColour*C; + uint32_t (*CI)[3]; + + // Asymptote material data + RGBAColour diffuse; + RGBAColour ambient; + RGBAColour emissive; + RGBAColour specular; + double opacity; + double shininess; + double PRCshininess; + bool invisible; + +public: + drawTriangles(const vm::array& v, const vm::array& vi, + const vm::array& n, const vm::array& ni, + const vm::array&p, double opacity, double shininess, + double PRCshininess, const vm::array& c, const vm::array& ci) : + drawBaseTriangles(v,vi,n,ni), + opacity(opacity), shininess(shininess), PRCshininess(PRCshininess) { + + const string needfourpens="array of 4 pens required"; + if(checkArray(&p) != 4) + reportError(needfourpens); + + const pen surfacepen=vm::read<camp::pen>(p,0); + invisible=surfacepen.invisible(); + diffuse=rgba(surfacepen); + + nC=checkArray(&c); + if(nC) { + C=new(UseGC) RGBAColour[nC]; + for(size_t i=0; i < nC; ++i) + C[i]=rgba(vm::read<camp::pen>(c,i)); + + size_t nI=checkArray(&vi); + + if(checkArray(&ci) != nI) + reportError("Index arrays have different lengths"); + CI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + vm::array *cii=vm::read<vm::array*>(ci,i); + if(checkArray(cii) != 3) reportError(wrongsize); + uint32_t *CIi=CI[i]; + for(size_t j=0; j < 3; ++j) { + size_t index=unsignedcast(vm::read<Int>(cii,j)); + if(index >= nC) reportError(outofrange); + CIi[j]=index; + } + } + } else { + ambient=rgba(vm::read<camp::pen>(p,1)); + emissive=rgba(vm::read<camp::pen>(p,2)); + } + specular=rgba(vm::read<camp::pen>(p,3)); + } + + drawTriangles(const double* t, const drawTriangles *s) : + drawBaseTriangles(t,s), nC(s->nC), + diffuse(s->diffuse), ambient(s->ambient), emissive(s->emissive), + specular(s->specular), opacity(s->opacity), + shininess(s->shininess), PRCshininess(s->PRCshininess), + invisible(s->invisible) { + + if(nC) { + C=new(UseGC) RGBAColour[nC]; + for(size_t i=0; i < nC; ++i) + C[i]=s->C[i]; + + CI=new(UseGC) uint32_t[nI][3]; + for(size_t i=0; i < nI; ++i) { + uint32_t *CIi=CI[i]; + uint32_t *sCIi=s->CI[i]; + for(size_t j=0; j < 3; ++j) + CIi[j]=sCIi[j]; + } + } + } + + virtual ~drawTriangles() {} + + void render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, + double perspective, bool lighton, bool transparent); + + bool write(prcfile *out, unsigned int *, double, groupsmap&); + + drawElement *transformed(const double* t) { + return new drawTriangles(t,this); + } +}; + } #endif diff --git a/Build/source/utils/asymptote/examples/100d.views b/Build/source/utils/asymptote/examples/100d.views index 5e73cb0c8b9..82dbb734792 100644 --- a/Build/source/utils/asymptote/examples/100d.views +++ b/Build/source/utils/asymptote/examples/100d.views @@ -1,30 +1,21 @@ -VIEW%={View A} - COO=0.000001944790710695088 -0.000000199754154551 -303.740966796875 - C2C=-0.43931567668914795 -0.011656288057565689 0.8982571363449097 - ROO=367.52660744556164 - ROLL=-75.86431813030065 +VIEW={View A} + COO=95.703857421875 -26.603919982910156 122.73419952392578 + C2C=-0.4144790768623352 0.7603927254676819 0.5000100135803223 + ROO=141.69743417830577 + ROLL=13.566625455930614 AAC=34.903342413559436 - BGCOLOR=1. 1. 1. - LIGHTS=Artwork - RENDERMODE=Solid END -VIEW%={View B} - COO=-52.16141891479492 50.85958480834961 -249.23748779296875 - C2C=-0.0608830563724041 0.722907543182373 -0.6882571578025818 - ROO=117.10558117788756 - ROLL=105.68252665017765 +VIEW={View B} + COO=15.9437837600708 -12.494922637939453 67.1521987915039 + C2C=0.9024380445480347 0.3321097493171692 0.27442431449890137 + ROO=303.7409567061654 + ROLL=66.40207458248847 AAC=34.903342413559436 - BGCOLOR=1. 1. 1. - LIGHTS=Artwork - RENDERMODE=Solid END -VIEW%={View C} - COO=2.2545230388641357 2.9914066791534424 -300.3456115722656 - C2C=0.8536049127578735 0.3032689690589905 -0.42354053258895874 - ROO=303.7410359852936 - ROLL=-126.08445879535664 +VIEW={View C} + COO=-42.11725616455078 -13.32657241821289 18.372915267944336 + C2C=0.6989848017692566 -0.009704185649752617 0.7150706648826599 + ROO=444.70718853041143 + ROLL=78.84753985408712 AAC=34.903342413559436 - BGCOLOR=1. 1. 1. - LIGHTS=Artwork - RENDERMODE=Solid END diff --git a/Build/source/utils/asymptote/examples/BezierPatch.asy b/Build/source/utils/asymptote/examples/BezierPatch.asy index 8d770e058ae..4e3e55cb40e 100644 --- a/Build/source/utils/asymptote/examples/BezierPatch.asy +++ b/Build/source/utils/asymptote/examples/BezierPatch.asy @@ -1,7 +1,7 @@ import three; size(10cm); -currentlight=Viewport; +currentlight=Headlamp; surface s=surface(patch(new triple[][] { {(0,0,0),(1,0,0),(1,0,0),(2,0,0)}, diff --git a/Build/source/utils/asymptote/examples/BezierSurface.asy b/Build/source/utils/asymptote/examples/BezierSurface.asy index f8cbc458ca0..62c01a55717 100644 --- a/Build/source/utils/asymptote/examples/BezierSurface.asy +++ b/Build/source/utils/asymptote/examples/BezierSurface.asy @@ -40,4 +40,3 @@ size3(pic,10cm); draw(pic,surface(P),blue); add(embed("label",pic),(0,0),N); -label(cameralink("label"),(0,0),10S,fontsize(24pt)); diff --git a/Build/source/utils/asymptote/examples/animations/embeddedmovie.asy b/Build/source/utils/asymptote/examples/animations/embeddedmovie.asy index 98dfd424db8..12fdf04dedc 100644 --- a/Build/source/utils/asymptote/examples/animations/embeddedmovie.asy +++ b/Build/source/utils/asymptote/examples/animations/embeddedmovie.asy @@ -6,8 +6,8 @@ import embed; // Add embedded movie //import external; // Add external movie (use this form under Linux). -// Generated needed mpeg file if it doesn't already exist. -asy("mpg","wheel"); +// Generated needed mp4 file if it doesn't already exist. +asy("mp4","wheel"); // Produce a pdf file. settings.outformat="pdf"; @@ -15,10 +15,5 @@ settings.outformat="pdf"; settings.twice=true; // An embedded movie: -label(embed("wheel.mpg","poster,text=wheel.mpg,label=wheel.mpg",20cm,5.6cm), - (0,0),N); - -// An optional button: -label(link("wheel.mpg","Play","play"),(0,0),S); - - +label(embed("wheel.mp4",20cm,5.6cm),(0,0),N); +label(link("wheel.mp4"),(0,0),S); diff --git a/Build/source/utils/asymptote/examples/animations/embeddedu3d.asy b/Build/source/utils/asymptote/examples/animations/embeddedu3d.asy index 1116c216fe2..b30ada927c2 100644 --- a/Build/source/utils/asymptote/examples/animations/embeddedu3d.asy +++ b/Build/source/utils/asymptote/examples/animations/embeddedu3d.asy @@ -1,6 +1,8 @@ // An embedded U3D object; // import embed; +settings.tex="pdflatex"; -label(embed("dice.u3d","poster,text=(dice.u3d),3Droo=27,label=dice",settings.paperwidth,settings.paperheight)); +label(embedplayer("dice.u3d","dice","activate=pagevisible,3Droo=27", + settings.paperwidth,settings.paperheight)); diff --git a/Build/source/utils/asymptote/examples/animations/externalmovie.asy b/Build/source/utils/asymptote/examples/animations/externalmovie.asy index 77c99528307..8dc8af74bb7 100644 --- a/Build/source/utils/asymptote/examples/animations/externalmovie.asy +++ b/Build/source/utils/asymptote/examples/animations/externalmovie.asy @@ -6,12 +6,11 @@ import external; settings.tex="pdflatex"; // Generated needed mpeg file if it doesn't already exist. -asy("mpg","wheel"); +asy("mp4","wheel"); // Produce a pdf file. settings.outformat="pdf"; // External movie: viewable even with the Linux version of acroread. -label(embed("wheel.mpg"),(0,0),N); - -label(link("wheel.mpg","Play"),(0,0),S); +label(embed("wheel.mp4"),(0,0),N); +label(link("wheel.mp4"),(0,0),S); diff --git a/Build/source/utils/asymptote/examples/animations/slidemovies.asy b/Build/source/utils/asymptote/examples/animations/slidemovies.asy index 205f94fbc85..bbfdd21eaba 100644 --- a/Build/source/utils/asymptote/examples/animations/slidemovies.asy +++ b/Build/source/utils/asymptote/examples/animations/slidemovies.asy @@ -33,15 +33,12 @@ display(a.pdf("autoplay,loop,controls",multipage=false)); display(b.pdf("controls",multipage=false)); // Generated needed files if they don't already exist. -asy("mpg","wheel"); +asy("mp4","wheel"); title("External Movie (portable)"); -display(external.embed("wheel.mpg", - "poster,text=wheel.mpg,label=wheel.mpg",20cm,5.6cm)); -display(external.link("wheel.mpg","Play","play")); +display(external.embed("wheel.mp4",20cm,5.6cm)); +display(external.link("wheel.mp4")); title("Embedded Movie (not portable)"); -display(embed.embed("wheel.mpg", - "poster,text=wheel.mpg,label=wheel.mpg", - 20cm,5.6cm)); -display(embed.link("wheel.mpg","Play","play")); +display(embed.embed("wheel.mp4",20cm,5.6cm)); +display(embed.link("wheel.mp4")); diff --git a/Build/source/utils/asymptote/examples/cheese.asy b/Build/source/utils/asymptote/examples/cheese.asy index 9a16e4130dc..05b9181fdf4 100644 --- a/Build/source/utils/asymptote/examples/cheese.asy +++ b/Build/source/utils/asymptote/examples/cheese.asy @@ -9,4 +9,7 @@ real f(real x, real y, real z) { surface sf=surface(contour3(f,(-2pi,-2pi,-2pi),(2pi,2pi,2pi),12)); sf.colors(palette(sf.map(abs),Gradient(red,yellow))); -draw(sf,nolight,render(merge=true)); + +currentlight=nolight; + +draw(sf,render(merge=true)); diff --git a/Build/source/utils/asymptote/examples/pdb.asy b/Build/source/utils/asymptote/examples/pdb.asy index b3b954c8c6a..ad86d5172c4 100644 --- a/Build/source/utils/asymptote/examples/pdb.asy +++ b/Build/source/utils/asymptote/examples/pdb.asy @@ -4,8 +4,6 @@ import cpkcolors; // A sample Protein Data Bank file for this example is available from // http://ndbserver.rutgers.edu/ftp/NDB/coordinates/na-biol/100d.pdb1 -bool getviews=true; - currentlight=White; //currentlight=nolight; @@ -160,13 +158,7 @@ string options; string viewfilename=prefix+".views"; if(!error(input(viewfilename,check=false))) - options="3Dviews2="+viewfilename; - -if(getviews && prc()) { - picture pic; - add(pic,embed("label",currentpicture,options=options),(0,0),N); - label(pic,cameralink("label"),(0,0),S,fontsize(12pt)); - shipout(prefix,pic,options=options); -} else - shipout(prefix,options=options); + options="3Dviews="+viewfilename; + +shipout(prefix,options=options); diff --git a/Build/source/utils/asymptote/examples/projectrevolution.asy b/Build/source/utils/asymptote/examples/projectrevolution.asy index 25cbe6d4902..8bbe7f38c3d 100644 --- a/Build/source/utils/asymptote/examples/projectrevolution.asy +++ b/Build/source/utils/asymptote/examples/projectrevolution.asy @@ -5,8 +5,8 @@ currentprojection=orthographic(20,0,3); size(400,300,IgnoreAspect); -revolution r=revolution(new real(real x) {return sin(x)*exp(-x/2);}, - 0,2pi,operator ..,Z); +revolution r=revolution(graph(new triple(real x) { + return (x,0,sin(x)*exp(-x/2));},0,2pi,operator ..),axis=Z); surface s=surface(r); surface S=planeproject(shift(-Z)*unitsquare3)*s; diff --git a/Build/source/utils/asymptote/examples/triangles.asy b/Build/source/utils/asymptote/examples/triangles.asy new file mode 100644 index 00000000000..c3b3c2aec84 --- /dev/null +++ b/Build/source/utils/asymptote/examples/triangles.asy @@ -0,0 +1,19 @@ +import three; +size(10cm); + +triple[] v={O,X,X+Y,Y}; + +triple[] n={Z,X}; + +int[][] vi={{0,1,2},{2,3,0}}; +int[][] ni={{0,0,0},{1,1,1}}; + +pen[] p={red+opacity(0.5),green+opacity(0.5),blue+opacity(0.5), + black+opacity(0.5)}; + +// Adobe Reader exhibits a PRC rendering bug for opacities in (0.5,1): +//pen[] p={red+opacity(0.9),green+opacity(0.9),blue+opacity(0.9),black+opacity(0.9)}; + +int[][] pi={{0,1,2},{2,3,0}}; +draw(v,vi,n,ni,red); +draw(v+Z,vi,p,pi); diff --git a/Build/source/utils/asymptote/examples/tvgen.asy b/Build/source/utils/asymptote/examples/tvgen.asy index ade90e89211..1a9f151df26 100644 --- a/Build/source/utils/asymptote/examples/tvgen.asy +++ b/Build/source/utils/asymptote/examples/tvgen.asy @@ -23,7 +23,6 @@ * since local variants exist and parameters have varied over time. */ //papertype="a4"; -import plain; int verbose=settings.verbose/*+2*/; /* uncomment for debug info */ /* tv dot coordinates --> PS points */ diff --git a/Build/source/utils/asymptote/examples/vertexshading.asy b/Build/source/utils/asymptote/examples/vertexshading.asy index ea97b98daf3..13821ec0058 100644 --- a/Build/source/utils/asymptote/examples/vertexshading.asy +++ b/Build/source/utils/asymptote/examples/vertexshading.asy @@ -4,6 +4,6 @@ size(200); currentprojection=perspective(4,5,5); -draw(surface(unitcircle3,new pen[] {red,green,blue,white})); +draw(surface(unitcircle3,new pen[] {red,green,blue,black})); draw(surface(shift(Z)*unitsquare3, new pen[] {red,green+opacity(0.5),blue,black})); diff --git a/Build/source/utils/asymptote/fftw++.cc b/Build/source/utils/asymptote/fftw++.cc index 00a24b4c8bd..77a1dabb704 100644 --- a/Build/source/utils/asymptote/fftw++.cc +++ b/Build/source/utils/asymptote/fftw++.cc @@ -11,6 +11,8 @@ std::ifstream fftw::ifWisdom; std::ofstream fftw::ofWisdom; bool fftw::Wise=false; const double fftw::twopi=2.0*acos(-1.0); +unsigned int fftw::maxthreads=1; +double fftw::testseconds=0.1; // Time limit for threading efficiency tests // User settings: unsigned int fftw::effort=FFTW_MEASURE; diff --git a/Build/source/utils/asymptote/fftw++.h b/Build/source/utils/asymptote/fftw++.h index 0ea30502b87..be68c899290 100644 --- a/Build/source/utils/asymptote/fftw++.h +++ b/Build/source/utils/asymptote/fftw++.h @@ -1,5 +1,5 @@ /* Fast Fourier transform C++ header class for the FFTW3 Library - Copyright (C) 2004-10 John C. Bowman, University of Alberta + Copyright (C) 2004-12 John C. Bowman, University of Alberta This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -18,7 +18,7 @@ #ifndef __fftwpp_h__ #define __fftwpp_h__ 1 -#define __FFTWPP_H_VERSION__ 1.08 +#define __FFTWPP_H_VERSION__ 1.12 #include <cstdlib> #include <fstream> @@ -26,11 +26,35 @@ #include <fftw3.h> #include <cerrno> +#ifndef FFTWPP_SINGLE_THREAD +#include <omp.h> +#endif + +inline int get_max_threads() +{ +#ifdef FFTWPP_SINGLE_THREAD + return 1; +#else + return omp_get_max_threads(); +#endif +} + +inline int get_thread_num() +{ +#ifdef FFTWPP_SINGLE_THREAD + return 0; +#else + return omp_get_thread_num(); +#endif +} + #ifndef __Complex_h__ #include <complex> typedef std::complex<double> Complex; #endif +#include "seconds.h" + #ifndef HAVE_POSIX_MEMALIGN #ifdef __GLIBC_PREREQ @@ -167,7 +191,7 @@ inline int GetWisdom(std::ifstream& s) {return s.get();} // class fftw { protected: - unsigned int doubles; // number of double words in dataset + unsigned int doubles; // number of double precision values in dataset int sign; double norm; @@ -194,8 +218,14 @@ protected: static std::ofstream ofWisdom; static bool Wise; static const double twopi; + unsigned int threads; public: + static unsigned int maxthreads; + static double testseconds; + + unsigned int Threads() {return threads;} + // Shift the Fourier origin to (nx/2,0). static void Shift(Complex *data, unsigned int nx, unsigned int ny, int sign=0) { @@ -271,8 +301,15 @@ public: fftw(unsigned int doubles, int sign, unsigned int n=0) : doubles(doubles), sign(sign), norm(1.0/(n ? n : (doubles+1)/2)), - plan(NULL) - {} + plan(NULL) { + static bool initialize=true; + if(initialize) { +#ifndef FFTWPP_SINGLE_THREAD + fftw_init_threads(); +#endif + initialize=false; + } + } virtual ~fftw() {if(plan) fftw_destroy_plan(plan);} @@ -284,6 +321,15 @@ public: << "-byte aligned: address " << p << std::endl; } + double stdev(unsigned int N, double sum, double sum2) { + return N > 1 ? sqrt((sum2-sum*sum/N)/(N-1)) : 0.0; + } + + void noplan() { + std::cerr << "Unable to construct FFTW plan" << std::endl; + exit(1); + } + void Setup(Complex *in, Complex *out=NULL) { if(!Wise) LoadWisdom(); bool alloc=!in; @@ -296,11 +342,62 @@ public: if(!out) out=in; #endif inplace=(out==in); - plan=Plan(in,out); - if(!plan) { - std::cerr << "Unable to construct FFTW plan" << std::endl; - exit(1); - } + +#ifndef FFTWPP_SINGLE_THREAD + fftw_plan_with_nthreads(1); +#endif + fftw_plan plan1=Plan(in,out); + if(!plan1) noplan(); + plan=plan1; + + if(maxthreads > 1) { + double sum=0.0; + double sum2=0.0; + unsigned int N=1; + const unsigned int microseconds=1000000; + unsigned int limit=(int) (testseconds*microseconds); + for(; N < limit; ++N) { + seconds(); + fft(in,out); + double t=seconds(); + sum += t; + sum2 += t*t; + if(sum > testseconds) + break; + } + double mean1=sum/N; + double stdev1=stdev(N,sum,sum2); + + threads=get_max_threads(); + if(maxthreads > threads) maxthreads=threads; +#ifndef FFTWPP_SINGLE_THREAD + fftw_plan_with_nthreads(maxthreads); +#endif + plan=Plan(in,out); + if(!plan) noplan(); + + if(plan) { + sum=0.0; + seconds(); + for(unsigned int i=1; i <= N; ++i) { + seconds(); + fft(in,out); + double t=seconds(); + sum += t; + } + double mean2=sum/N; + + if(mean2 > mean1-stdev1) { + threads=1; + fftw_destroy_plan(plan); + plan=plan1; + } else { + fftw_destroy_plan(plan1); + threads=maxthreads; + } + } + } else + threads=1; if(alloc) Array::deleteAlign(in,(doubles+1)/2); SaveWisdom(); @@ -416,6 +513,9 @@ public: else { out=Setout(in,out); Execute(in,out); +#ifndef FFTWPP_SINGLE_THREAD +#pragma omp parallel for num_threads(threads) +#endif for(unsigned int k=0; k < M; k++) { for(unsigned int j=0; j < nx; j++) { out[j*stride+k*dist] *= norm; @@ -500,8 +600,8 @@ public: {Setup(in,out);} fftw_plan Plan(Complex *in, Complex *out) { - int n[1]={nx}; - return fftw_plan_many_dft(1,n,M, + int n=(int) nx; + return fftw_plan_many_dft(1,&n,M, (fftw_complex *) in,NULL,stride,dist, (fftw_complex *) out,NULL,stride,dist, sign,effort); @@ -648,8 +748,8 @@ public: stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} fftw_plan Plan(Complex *in, Complex *out) { - const int n[1]={nx}; - return fftw_plan_many_dft_r2c(1,n,M, + int n=(int) nx; + return fftw_plan_many_dft_r2c(1,&n,M, (double *) in,NULL,stride,2*dist, (fftw_complex *) out,NULL,stride,dist, effort); @@ -699,8 +799,8 @@ public: nx(nx), M(M), stride(stride), dist(Dist(nx,stride,dist)) {Setup(in,out);} fftw_plan Plan(Complex *in, Complex *out) { - const int n[1]={nx}; - return fftw_plan_many_dft_c2r(1,n,M, + int n=(int) nx; + return fftw_plan_many_dft_c2r(1,&n,M, (fftw_complex *) in,NULL,stride,dist, (double *) out,NULL,stride,2*dist, effort); @@ -1019,11 +1119,11 @@ public: #ifdef __Array_h__ crfft3d(unsigned int nz, const Array::array3<double>& out) : fftw(out.Size(),1,out.Nx()*out.Ny()*nz), - nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);} + nx(out.Nx()), ny(out.Ny()), nz(nz) {Setup(out);} crfft3d(unsigned int nz, const Array::array3<Complex>& in) : fftw(2*in.Size(),1,in.Nx()*in.Ny()*nz), - nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in);} + nx(in.Nx()), ny(in.Ny()), nz(nz) {Setup(in);} crfft3d(unsigned int nz, const Array::array3<Complex>& in, const Array::array3<double>& out) diff --git a/Build/source/utils/asymptote/glrender.cc b/Build/source/utils/asymptote/glrender.cc index bc5a333f0d4..22486129110 100644 --- a/Build/source/utils/asymptote/glrender.cc +++ b/Build/source/utils/asymptote/glrender.cc @@ -192,7 +192,8 @@ void lighting() for(size_t i=0; i < Nlights; ++i) { GLenum index=GL_LIGHT0+i; triple Lighti=Lights[i]; - GLfloat position[]={Lighti.getx(),Lighti.gety(),Lighti.getz(),0.0}; + GLfloat position[]={(GLfloat) Lighti.getx(),(GLfloat) Lighti.gety(), + (GLfloat) Lighti.getz(),0.0}; glLightfv(index,GL_POSITION,position); } } @@ -209,14 +210,16 @@ void initlighting() size_t i4=4*i; - GLfloat diffuse[]={Diffuse[i4],Diffuse[i4+1],Diffuse[i4+2],Diffuse[i4+3]}; + GLfloat diffuse[]={(GLfloat) Diffuse[i4],(GLfloat) Diffuse[i4+1], + (GLfloat) Diffuse[i4+2],(GLfloat) Diffuse[i4+3]}; glLightfv(index,GL_DIFFUSE,diffuse); - GLfloat ambient[]={Ambient[i4],Ambient[i4+1],Ambient[i4+2],Ambient[i4+3]}; + GLfloat ambient[]={(GLfloat) Ambient[i4],(GLfloat) Ambient[i4+1], + (GLfloat) Ambient[i4+2],(GLfloat) Ambient[i4+3]}; glLightfv(index,GL_AMBIENT,ambient); - GLfloat specular[]={Specular[i4],Specular[i4+1],Specular[i4+2], - Specular[i4+3]}; + GLfloat specular[]={(GLfloat) Specular[i4],(GLfloat) Specular[i4+1], + (GLfloat) Specular[i4+2],(GLfloat) Specular[i4+3]}; glLightfv(index,GL_SPECULAR,specular); } @@ -308,13 +311,13 @@ void drawscene(double Width, double Height) double size2=hypot(Width,Height); // Render opaque objects - Picture->render(nurb,size2,m,M,perspective,false); + Picture->render(nurb,size2,m,M,perspective,Nlights,false); // Enable transparency glDepthMask(GL_FALSE); // Render transparent objects - Picture->render(nurb,size2,m,M,perspective,true); + Picture->render(nurb,size2,m,M,perspective,Nlights,true); glDepthMask(GL_TRUE); } diff --git a/Build/source/utils/asymptote/interact.cc b/Build/source/utils/asymptote/interact.cc index 22111c62de8..2a6c37e8811 100644 --- a/Build/source/utils/asymptote/interact.cc +++ b/Build/source/utils/asymptote/interact.cc @@ -12,13 +12,12 @@ #include <sys/types.h> #include <unistd.h> #include <csignal> -#include <cstring> +#include <cstdio> #include "interact.h" #include "runhistory.h" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) -#include <cstdio> #include <readline/readline.h> #include <readline/history.h> #endif @@ -86,14 +85,10 @@ FILE *fin=NULL; char *readpipeline(const char *prompt) { - const int max_size=256; - static char buf[max_size]; - ostringstream s; - do { - if(fgets(buf,max_size-1,fin) == NULL) break; - s << buf; - } while(buf[strlen(buf)-1] != '\n'); - return StrdupMalloc(s.str()); + char *line=NULL; + size_t n; + n=getline(&line,&n,fin); + return line; } void pre_readline() diff --git a/Build/source/utils/asymptote/patches/README b/Build/source/utils/asymptote/patches/README index 44fbd5ba36a..f277e200cfb 100644 --- a/Build/source/utils/asymptote/patches/README +++ b/Build/source/utils/asymptote/patches/README @@ -14,13 +14,6 @@ prototype in the file gc6.8/include/gc.h (version 6.8). The file gc-7.0nomem.patch avoids segmentation faults with gc-7.0 on out-of-memory errors. -The file movie15_dvipdfmx.patch brings the xelatex/dvipdfmx-enhanced -version of movie15.sty available at -http://cvs.ktug.or.kr/viewcvs/dvipdfmx/contrib/latex/movie15.sty.sample?revision=1.1 -up-to-date with the official 2008/10/08 version. For convenience the -patched version is also included as movie15_dvipdfmx.sty; it should be -renamed to movie15.sty and installed in the local latex directory. - The file fixmem.reg patches the Microsoft Windows registry so that the cygwin1.dll library can allocate more than 384MB. It is applied automatically by the Asymptote setup.exe file but may also be applied manually: diff --git a/Build/source/utils/asymptote/patches/dvipdf b/Build/source/utils/asymptote/patches/dvipdf index 5c98e943206..60e978bb424 100755 --- a/Build/source/utils/asymptote/patches/dvipdf +++ b/Build/source/utils/asymptote/patches/dvipdf @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: dvipdf 3949 2009-02-04 05:53:23Z jcbowman $ +# $Id: dvipdf 5475 2012-08-24 06:27:29Z jcbowman $ # Convert DVI to PDF. # # Please contact Andrew Ford <A.Ford@ford-mason.co.uk> with any questions @@ -12,7 +12,7 @@ GS_EXECUTABLE=gs -OPTIONS="" +OPTIONS="-DSAFER -P" DVIPSOPTIONS="" while true do diff --git a/Build/source/utils/asymptote/patches/movie15_dvipdfmx.patch b/Build/source/utils/asymptote/patches/movie15_dvipdfmx.patch deleted file mode 100644 index a748d81c84c..00000000000 --- a/Build/source/utils/asymptote/patches/movie15_dvipdfmx.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- /usr/local/src/dvipdfmx/contrib/latex/movie15.sty.sample 2008-06-07 03:59:38.000000000 -0600 -+++ movie15.sty 2009-02-12 21:21:43.000000000 -0700 -@@ -9,7 +9,7 @@ - % - - \NeedsTeXFormat{LaTeX2e} --\ProvidesPackage{movie15}[2008/01/16] -+\ProvidesPackage{movie15}[2008/10/08] - \RequirePackage{keyval} - \RequirePackage{ifthen} - \RequirePackage{ifpdf} -@@ -809,7 +809,7 @@ - \if@MXV@externalviewer\else% - %appearance dict dummy, to be shared by all 3D annots - \ifthenelse{\isundefined{\@MXV@apdict}}{% -- \pdfobj stream {}\pdfrefobj\pdflastobj% -+ \pdfobj stream attr {/BBox [0 0 0.001 0.001]} {}\pdfrefobj\pdflastobj% - \xdef\@MXV@apdict{/AP << /N \the\pdflastobj\space 0 R >>}% - }{}% - %3D reference dict -@@ -1037,7 +1037,7 @@ - \if@MXV@externalviewer\else% - %appearance dict dummy, to be shared by all 3D annots - \ifthenelse{\isundefined{\@MXV@apdict}}{% -- \special{pdf:stream @apdict\space()}% -+ \special{pdf:stream @apdict\space()<</BBox[0 0 0.001 0.001]>>}% - \xdef\@MXV@apdict{/AP << /N @apdict >>}% - }{}% - %3D reference dict -@@ -1367,6 +1367,13 @@ - ()% - }% - }% -+ \pdfmark{% -+ pdfmark=/PUT,% -+ Raw={% -+ {apdict} -+ <</BBox [0 0 0.001 0.001]>> -+ }% -+ }% - \xdef\@MXV@apdict{/AP << /N {apdict}>>}% - }{}% - %3D reference dict diff --git a/Build/source/utils/asymptote/patches/movie15_dvipdfmx.sty b/Build/source/utils/asymptote/patches/movie15_dvipdfmx.sty deleted file mode 100644 index fa3ac0aa929..00000000000 --- a/Build/source/utils/asymptote/patches/movie15_dvipdfmx.sty +++ /dev/null @@ -1,4259 +0,0 @@ -% Copyright 2004--2008 Alexander Grahn -% -% This material is subject to the LaTeX Project Public License. See -% http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html -% for the details of that license. -% -% This package allows inclusion of multimedia content into PDF files -% following Adobe's PDF-1.5 and 1.6 specifications. -% - -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{movie15}[2008/10/08] -\RequirePackage{keyval} -\RequirePackage{ifthen} -\RequirePackage{ifpdf} -\RequirePackage{ifdraft} - -\newboolean{@MXV@iiiDfeat} % enable 3D features from PDF-1.6 spec? -\setboolean{@MXV@iiiDfeat}{false}% -\newboolean{@MXV@iiid} %set to true if a 3D file is being embedded -\newboolean{@MXV@draft} %according to global setting -\newboolean{@MXV@@draft} %per inclusion setting - -\ifdraft{%globally set by document class - \setboolean{@MXV@draft}{true}% -}{% - \setboolean{@MXV@draft}{false}% -}% - -%override global setting -\DeclareOption{draft}{% - \setboolean{@MXV@draft}{true}% -} -\DeclareOption{final}{% - \setboolean{@MXV@draft}{false}% -} - -\DeclareOption{3D}{% - \setboolean{@MXV@iiiDfeat}{true}% -} - -\newboolean{@MXV@dvips} -\newboolean{@MXV@dvipdfmx} -\ifpdf - \setboolean{@MXV@dvips}{true} -\else - \setboolean{@MXV@dvips}{false} -\fi -\setboolean{@MXV@dvipdfmx}{false} - -\DeclareOption{dvips}{% - \setboolean{@MXV@dvips}{true}% - \setboolean{@MXV@dvipdfmx}{false}% -} -\DeclareOption{dvipdfmx}{% - \setboolean{@MXV@dvips}{false}% - \setboolean{@MXV@dvipdfmx}{true}% -} - -\DeclareOption*{% - \PackageWarning{movie15}{Unknown option \CurrentOption} -} - -\ProcessOptions*\relax - -%testing for correct TeX version, -\ifpdf - \ifnum\pdftexversion<120 - \PackageError{movie15}{% - pdfeTeX, version >= 1.20, required - }{% - Install a more recent version! - }% - \fi -\fi - -\ifx\@undefined\pdfmdfivesum - \def\pdfmdfivesum file #1{#1} -\fi - -%for conditionals where \ifthenelse doesn't work -\gdef\@MXV@if#1{\csname if#1\endcsname}% - -\newboolean{@MXV@beamer} %set to true if beamer class has been loaded -%\newboolean{@MXV@powerdot} %the same for -\newboolean{@MXV@presentation} %used with presentation making package? -\newboolean{@MXV@hide} %contents hidden on the current slide? -\@ifclassloaded{beamer}{% - \setboolean{@MXV@beamer}{true}% - \setboolean{@MXV@presentation}{true}% -}{% - \setboolean{@MXV@beamer}{false}% - \setboolean{@MXV@presentation}{false}% -} -%\@ifclassloaded{powerdot}{% -% \setboolean{@MXV@powerdot}{true}% -% \setboolean{@MXV@presentation}{true}% -%}{% -% \setboolean{@MXV@powerdot}{false}% -% \setboolean{@MXV@presentation}{false}% -%} - -\AtBeginDocument{% - \provideboolean{Hy@colorlinks}% set by hyperref - \ifHy@colorlinks% coloured (movieref-)link text instead of link border - \gdef\@MXV@pdfborder{/Border [0 0 0]}% - \else% - \gdef\@MXV@pdfborder{}% - \fi% -} - -\RequirePackage{everyshi}% -\newcount\@MXV@page% counter for absolute page number -\EveryShipout{% - \global\advance\@MXV@page by 1% -} - -%define our own label making commands -\def\@MXV@newlabel#1#2{{% - \expandafter\xdef\csname#1\endcsname{#2}}}% - -\def\@MXV@getlabelvalue#1{% - \expandafter\ifx\csname#1\endcsname\relax% - undefined% - \else% - \csname#1\endcsname% - \fi% -}% - -%macro for writing labels to external *.aux file -\def\@MXV@labeltoaux#1#2{% - \@bsphack\protected@write\@auxout{}{% - \string\@MXV@newlabel{#1}{#2}% - \string\@MXV@newlabel{@#1@}{\@MXV@getlabelvalue{#1}}% - }\@esphack% - \ifthenelse{% - \equal{\@MXV@getlabelvalue{#1}}{undefined}\OR% - %double check that the value hasn't changed - \NOT\equal{\@MXV@getlabelvalue{#1}}{\@MXV@getlabelvalue{@#1@}}% - }{% - \ifthenelse{\isundefined{\@MXV@warning}}{% issue warning only once, at end - \gdef\@MXV@warning{}% of document - \AtEndDocument{% - \PackageWarningNoLine{movie15}{% - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak - @@ Rerun to get object references right! @@\MessageBreak - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}% - }% - }{}% - }{}% -}% -% -\ifpdf% - %for storing pdf object numbers (must be counters) - \newcount\@MXV@adict% - \newcount\@MXV@aadict% - % - %returns pdf page object number - \def\@MXV@pdfpageref#1{% - \expandafter\ifx\csname#1\endcsname\relax% - 0% - \else% - \expandafter\pdfpageref\csname#1\endcsname\space% - \fi% - }% -\else\if@MXV@dvipdfmx%do nothing -\else% - \PassOptionsToPackage{pdfmark}{hyperref}% -\fi\fi - -%counter for absolute number of inclusions, -%used for labelling each annotation -\newcount\@MXV@includes - -%counter for absolute number of movie players -\newcount\@MXV@players - -%counter for absolute number of movierefs -\newcount\@MXV@links - -%measuring things -%textbox -\newdimen\@MXV@width -\newdimen\@MXV@height -\newdimen\@MXV@depth -\newdimen\@MXV@totalheight -\newdimen\@MXV@@boxdepth -%for centring the textbox within display box -\newdimen\@MXV@traiselen -\newdimen\@MXV@braiselen -%for compatibility options -\newdimen\@MXV@start -\newdimen\@MXV@end - -%stores textbox given as argument to text option -\newsavebox{\@MXV@textbox} - -%some booleans we need -\newboolean{@MXV@autoplay} -\newboolean{@MXV@autostop} -\newboolean{@MXV@autoresume} -\newboolean{@MXV@autoclose} -\newboolean{@MXV@autopause} -\newboolean{@MXV@mouse}%mouse interaction -\newboolean{@MXV@inline}%inline movie data -\newboolean{@MXV@attachment}%make embedded file extractable? -\newboolean{@MXV@externalviewer}%if true, screen annot will be removed -\newboolean{@MXV@url} -\newboolean{@MXV@boxopt}%true if text option is set -\newboolean{@MXV@textoverposter} -\newboolean{@MXV@runposter}% render poster from movie at runtime -\newboolean{@MXV@linkplay}% for \movieref command -\newboolean{@MXV@linkpause} -\newboolean{@MXV@linkresume} -\newboolean{@MXV@linkstop} -\newboolean{@MXV@linkclose} -\newboolean{@MXV@linkreset} -\newboolean{@MXV@issound} - -%macro to reset all macros and booleans -\def\@MXV@reset{% - \setboolean{@MXV@autoplay}{false}% - \setboolean{@MXV@autostop}{true}% - \setboolean{@MXV@autoresume}{false}% - \setboolean{@MXV@autopause}{false}% - \setboolean{@MXV@autoclose}{false}% - \setboolean{@MXV@mouse}{false}% - \setboolean{@MXV@inline}{true}% - \setboolean{@MXV@attachment}{true}% - \setboolean{@MXV@externalviewer}{false}% - \setboolean{@MXV@issound}{false}% - \setboolean{@MXV@url}{false}% - \setboolean{@MXV@boxopt}{false}% - \setboolean{@MXV@textoverposter}{true}% - \setboolean{@MXV@runposter}{false}% - \setboolean{@MXV@linkplay}{true}% - \setboolean{@MXV@linkpause}{false}% - \setboolean{@MXV@linkresume}{false}% - \setboolean{@MXV@linkstop}{false}% - \setboolean{@MXV@linkclose}{false}% - \setboolean{@MXV@linkreset}{false}% - \setboolean{@MXV@requirereopen}{false}% - \ifthenelse{\boolean{@MXV@draft}}{% - \setboolean{@MXV@@draft}{true}% - }{% - \setboolean{@MXV@@draft}{false}% - }% - % - \gdef\@MXV@label{}% for movieref - \gdef\@MXV@@label{}% for movieref - \gdef\@MXV@mime{@MXV@auto}% - \gdef\@MXV@player{}% - \gdef\@MXV@fsentry{}% - \gdef\@MXV@repeat{}% - \gdef\@MXV@@repeat{}% - \gdef\@MXV@volume{100}% - \gdef\@MXV@@volume{}% - \gdef\@MXV@ctrls{}% - \gdef\@MXV@@ctrls{}% - \gdef\@MXV@palindrome{}% - \gdef\@MXV@rate{}% - \gdef\@MXV@startat{}% - \gdef\@MXV@@startat{}% - \gdef\@MXV@endat{}% - \gdef\@MXV@poevent{}% - \gdef\@MXV@pcevent{}% - \gdef\@MXV@box##1##2##3{\raisebox{0pt}[##2][##3]{\makebox[##1]{}}}% - \setlength{\@MXV@depth}{0pt}% - \setlength{\@MXV@height}{0pt}% - \setlength{\@MXV@width}{0pt}% - \setlength{\@MXV@braiselen}{0pt}% - \setlength{\@MXV@traiselen}{0pt}% - \gdef\@MXV@boxdepth{}% - \gdef\@MXV@boxheight{}% - \gdef\@MXV@boxwidth{}% - % - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiid}{false}% - \gdef\@MXV@aac{30}% aperture angle of camera - \gdef\@MXV@roll{0}% camera roll angle - \gdef\@MXV@background{}% - \gdef\@MXV@jscriptiiidfile{}% - \gdef\@MXV@coo{0 0 0}% centre of orbit - \gdef\@MXV@ctoc{0 -1 0}% centre of orbit to camera vector - \gdef\@MXV@roo{0}% radius of orbit - \gdef\@MXV@viewsfile{}% file containing views of the 3D object - \setboolean{@MXV@viewsprovided}{false}% - \setboolean{@MXV@defaultviewprovided}{false}% - \gdef\@MXV@iiidview{}% - \gdef\@MXV@iiidtoolb{/TB false}% don't show toolbar by default - \gdef\@MXV@iiidia{}% 3D interactive by default - \gdef\@MXV@calc{}% camera aperture for coo and roo calculation - \setboolean{@MXV@iiidgetview}{false}% - \gdef\@MXV@iiidopt{}% option string to be passed to internal macro - \setboolean{@MXV@resource}{false}% - \gdef\@MXV@resourcetree{}% name tree of embedded 3D resources - \xdef\@MXV@animstyle{}% - \gdef\@MXV@iiidpalindrome{/Subtype/Linear}% forward - \gdef\@MXV@iiidrate{}% animation speed - \global\@MXV@iiidrepeat=-1% repeat count - \gdef\@MXV@lights{}% default lighting scheme - \gdef\@MXV@render{}% default render mode scheme - }{}% -}% - -%missing package error message -\def\@MXV@missing#1{% - \PackageError{movie15}{% - Package `#1' has not been loaded yet - }{% - Put the line `\protect\usepackage{#1}' somewhere after - `\protect\usepackage{movie15}' to the preamble of your - document! - }% -} - -%3D-need-be-enabled error message -\def\@MXV@neediiiD{% - \PackageError{movie15}{% - If you wish to embed 3D objects, enable the\MessageBreak - 3D feature first by passing option `3D' to movie15!\MessageBreak - Make sure the `fp' package for fixed point calculus\MessageBreak - is installed in your TeX system - }{Package `fp' is available from CTAN.}% -} - -%macro to guess the mime type of the media file -\def\@MXV@guessmime#1#2{% - \ifthenelse{\equal{#2}{aiff}\OR\equal{#2}{AIFF}\OR% - \equal{#2}{aif}\OR\equal{#2}{AIF}\OR% - \equal{#2}{aifc}\OR\equal{#2}{AIFC}}{% - \gdef\@MXV@mime{audio/aiff}% - }{% - \ifthenelse{\equal{#2}{wav}\OR\equal{#2}{WAV}}{% - \gdef\@MXV@mime{audio/wav}% - }{% - \ifthenelse{\equal{#2}{wma}\OR\equal{#2}{WMA}}{% - \gdef\@MXV@mime{audio/x-ms-wma}% - }{% - \ifthenelse{\equal{#2}{wmv}\OR\equal{#2}{WMV}}{% - \gdef\@MXV@mime{video/x-ms-wmv}% - }{% - \ifthenelse{\equal{#2}{au}\OR\equal{#2}{AU}\OR% - \equal{#2}{snd}\OR\equal{#2}{SND}}{% - \gdef\@MXV@mime{audio/basic}% - }{% - \ifthenelse{\equal{#2}{mid}\OR\equal{#2}{MID}\OR% - \equal{#2}{rmi}\OR\equal{#2}{RMI}}{% - \gdef\@MXV@mime{audio/midi}% - }{% - \ifthenelse{\equal{#2}{mov}\OR\equal{#2}{MOV}\OR% - \equal{#2}{qt}\OR\equal{#2}{QT}}{% - \gdef\@MXV@mime{video/quicktime}% - }{% - \ifthenelse{\equal{#2}{mp3}\OR\equal{#2}{MP3}\OR% - \equal{#2}{m3u}\OR\equal{#2}{M3U}}{% - \gdef\@MXV@mime{audio/x-mp3}% - }{% - \ifthenelse{\equal{#2}{mp4}\OR\equal{#2}{MP4}}{% - \gdef\@MXV@mime{video/mp4}% - }{% - \ifthenelse{\equal{#2}{avi}\OR\equal{#2}{AVI}}{% - \gdef\@MXV@mime{video/avi}% - }{% - \ifthenelse{\equal{#2}{gif}\OR\equal{#2}{GIF}}{% - \gdef\@MXV@mime{image/gif}% - }{% - \ifthenelse{\equal{#2}{mpeg}\OR\equal{#2}{MPEG}\OR% - \equal{#2}{mpg}\OR\equal{#2}{MPG}}{% - \gdef\@MXV@mime{video/mpeg}% - }{% - \ifthenelse{\equal{#2}{smil}\OR\equal{#2}{SMIL}}{% - \gdef\@MXV@mime{application/smil}% - }{% - \ifthenelse{\equal{#2}{swf}\OR\equal{#2}{SWF}}{% - \gdef\@MXV@mime{application/x-shockwave-flash}% - }{% - \ifthenelse{\equal{#2}{prc}\OR\equal{#2}{PRC}}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiid}{true}% - \gdef\@MXV@mime{model/prc}% (unofficial) - \gdef\@MXV@iiidsubtype{PRC}% - }{% - \@MXV@neediiiD% - }% - }{% - \ifthenelse{\equal{#2}{u3d}\OR\equal{#2}{U3D}}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiid}{true}% - \gdef\@MXV@mime{model/u3d}% (unofficial) - \gdef\@MXV@iiidsubtype{U3D}% - }{% - \@MXV@neediiiD% - }% - }{% - \ifthenelse{\equal{#2}{ra}\OR\equal{#2}{RA}}{ - \gdef\@MXV@mime{audio/vnd.rn-realaudio}% - }{% - \ifthenelse{% - \equal{#2}{rv}\OR\equal{#2}{RV}\OR - \equal{#2}{rm}\OR\equal{#2}{RM}% - }{% - \gdef\@MXV@mime{application/vnd.rn-realmedia}% - }{% - \PackageError{movie15}{% - I couldn't determine MIME type of file:\MessageBreak`#1':\MessageBreak - Unknown file name extension: `#2' - }{% - When using media files of unknown type or with a\MessageBreak - non-standard file name extension, the MIME type must\MessageBreak - explicitly be specified. Try option `mimetype=<mime type>'! - }% - }}}}}}}}}}}}}}}}}}% -} - -%sets @MXV@issound boolean -\def\@MXV@@issound#1/#2:{% argument: \@MXV@mime. - \def\@MXV@firstarg{#1}% - \def\@MXV@audio{audio}% - \ifx\@MXV@firstarg\@MXV@audio% - \setboolean{@MXV@issound}{true}% - \fi% -} - -%draft box -\def\@MXV@draftbox#1#2#3#4{%width height depth filename - \edef\@MXV@oldfboxsep{\the\fboxsep}% - \setlength{\fboxsep}{-\fboxrule}% - \framebox[#1][l]{% - \vrule width 0pt height #2 depth #3% - \edef\@tempa{#4}% - \raisebox{\depth}[0pt][0pt]{ \ttfamily\expandafter\strip@prefix\meaning\@tempa}% - }% - \setlength{\fboxsep}{\@MXV@oldfboxsep}% -} - -\ifthenelse{\boolean{@MXV@iiiDfeat}}{% 3D related definitions and macros - \RequirePackage{fp}% needed for fixed point calculus - \newread\@MXV@@viewsfile% file handle for views file - \newcount\@MXV@viewscount%counter for number of 3D views per inclusion - \newboolean{@MXV@viewsprovided}%3d views file provided? - \newboolean{@MXV@iiidgetview}% print current 3D settings? - \newboolean{@MXV@defaultviewprovided}%default 3D view provided? - \newboolean{@MXV@resource}%3d resource file provided? - \ifpdf\else\newcount\@MXV@rescount\fi% number of embedded resource files - \newcount\@MXV@iiidrepeat% play count - \newcount\@MXV@iiidoncurpage%index of 3D annot on current page - \global\@MXV@iiidoncurpage=0% - \gdef\@MXV@oldpage{0}% needed together with previous counter - - %macro for building the transformation matrix - \def\@MXV@ciiwmatrix#1 #2 #3 #4 #5 #6 #7 #8 {% - % #1,#2,#3 centre of orbit coordinates (coo) - % #4,#5,#6 centre of orbit to camera direction vector (c2c) - % #7 orbital radius (roo) - % #8 camera roll (roll) - %view vector (opposite to c2c) - \FPupn\@MXV@viewx{#4 neg}% - \FPupn\@MXV@viewy{#5 neg}% - \FPupn\@MXV@viewz{#6 neg}% - %normalize view vector - \FPupn\@MXV@modulo{\@MXV@viewx{} copy mul % - \@MXV@viewy{} copy mul + % - \@MXV@viewz{} copy mul + 2 swap root% - }% - \FPupn\@MXV@viewx{\@MXV@viewx{} \@MXV@modulo{} div}% - \FPupn\@MXV@viewy{\@MXV@viewy{} \@MXV@modulo{} div}% - \FPupn\@MXV@viewz{\@MXV@viewz{} \@MXV@modulo{} div}% - %camera roll - \FPupn\@MXV@sinroll{#8 180.0 div \FPpi{} mul sin}% - \FPupn\@MXV@cosroll{#8 180.0 div \FPpi{} mul cos}% - % - %top and bottom views - \FPupn\@MXV@leftx{-1.0}% - \FPupn\@MXV@lefty{0.0}% - \FPupn\@MXV@leftz{0.0}% - % - \FPifneg\@MXV@viewz% top view - %up-vector - \FPupn\@MXV@upx{0.0}% - \FPupn\@MXV@upy{1.0}% - \FPupn\@MXV@upz{0.0}% - \else% bottom view - %up-vector - \FPupn\@MXV@upx{0.0}% - \FPupn\@MXV@upy{-1.0}% - \FPupn\@MXV@upz{0.0}% - \fi% - \FPupn\@MXV@sumxy{\@MXV@viewx{} abs \@MXV@viewy{} abs add}% - \FPifeq\@MXV@sumxy{0}\else% other views than top and bottom - %up-vector = up_world - (up_world dot view) view - \FPupn\@MXV@upx{\@MXV@viewz{} \@MXV@viewx{} mul neg}% - \FPupn\@MXV@upy{\@MXV@viewz{} \@MXV@viewy{} mul neg}% - \FPupn\@MXV@upz{\@MXV@viewz{} \@MXV@viewz{} mul neg 1.0 add}% - %normalize up-vector - \FPupn\@MXV@modulo{\@MXV@upx{} copy mul \@MXV@upy{} copy % - mul + \@MXV@upz{} copy mul + 2 swap root}% - \FPupn\@MXV@upx{\@MXV@upx{} \@MXV@modulo{} div}% - \FPupn\@MXV@upy{\@MXV@upy{} \@MXV@modulo{} div}% - \FPupn\@MXV@upz{\@MXV@upz{} \@MXV@modulo{} div}% - %left vector = up x view - \FPupn\@MXV@leftx{\@MXV@viewz{} \@MXV@upy{} mul % - \@MXV@viewy{} \@MXV@upz{} mul sub}% - \FPupn\@MXV@lefty{\@MXV@viewx{} \@MXV@upz{} mul % - \@MXV@viewz{} \@MXV@upx{} mul sub}% - \FPupn\@MXV@leftz{\@MXV@viewy{} \@MXV@upx{} mul % - \@MXV@viewx{} \@MXV@upy{} mul sub}% - %normalize left vector - \FPupn\@MXV@modulo{\@MXV@leftx{} copy mul \@MXV@lefty{} % - copy mul + \@MXV@leftz{} copy mul + 2 swap root}% - \FPupn\@MXV@leftx{\@MXV@leftx{} \@MXV@modulo{} div}% - \FPupn\@MXV@lefty{\@MXV@lefty{} \@MXV@modulo{} div}% - \FPupn\@MXV@leftz{\@MXV@leftz{} \@MXV@modulo{} div}% - \fi% - %apply camera roll - \FPupn\@MXV@leftxprime{\@MXV@leftx{} \@MXV@cosroll{} mul \@MXV@upx{} \@MXV@sinroll{} mul +}% - \FPupn\@MXV@leftyprime{\@MXV@lefty{} \@MXV@cosroll{} mul \@MXV@upy{} \@MXV@sinroll{} mul +}% - \FPupn\@MXV@leftzprime{\@MXV@leftz{} \@MXV@cosroll{} mul \@MXV@upz{} \@MXV@sinroll{} mul +}% - \FPupn\@MXV@upxprime{\@MXV@upx{} \@MXV@cosroll{} mul \@MXV@leftx{} \@MXV@sinroll{} mul sub}% - \FPupn\@MXV@upyprime{\@MXV@upy{} \@MXV@cosroll{} mul \@MXV@lefty{} \@MXV@sinroll{} mul sub}% - \FPupn\@MXV@upzprime{\@MXV@upz{} \@MXV@cosroll{} mul \@MXV@leftz{} \@MXV@sinroll{} mul sub}% - \FPupn\@MXV@leftx{\@MXV@leftxprime}% - \FPupn\@MXV@lefty{\@MXV@leftyprime}% - \FPupn\@MXV@leftz{\@MXV@leftzprime}% - \FPupn\@MXV@upx{\@MXV@upxprime}% - \FPupn\@MXV@upy{\@MXV@upyprime}% - \FPupn\@MXV@upz{\@MXV@upzprime}% - %rotation matrix - \xdef\@MXV@matrix{\@MXV@leftx\space\@MXV@lefty\space\@MXV@leftz\space% - \@MXV@upx\space\@MXV@upy\space\@MXV@upz\space% - \@MXV@viewx\space\@MXV@viewy\space\@MXV@viewz}% - %translation vector - \FPupn\@MXV@roo{#7 abs}% - \FPifeq\@MXV@roo{0}\FPupn\@MXV@roo{0.000000000000000001}\fi% - \FPupn\@MXV@transx{#1 \@MXV@roo{} \@MXV@viewx{} mul sub}% - \FPupn\@MXV@transy{#2 \@MXV@roo{} \@MXV@viewy{} mul sub}% - \FPupn\@MXV@transz{#3 \@MXV@roo{} \@MXV@viewz{} mul sub}% - %transformation matrix - \xdef\@MXV@matrix{% - \@MXV@matrix\space\@MXV@transx\space\@MXV@transy\space\@MXV@transz% - }% - } - - %macro for parsing one line of 3D views file - \newcommand{\@MXV@parseline}[6][]{% - \xdef\@MXV@xname{#1}% name of the view (optional) - \ifthenelse{\equal{#2}{}}{% - \xdef\@MXV@coo{0 0 0}% - }{% - \xdef\@MXV@coo{#2}% - }% - \ifthenelse{\equal{#3}{}}{% - \xdef\@MXV@ctoc{0 -1 0}% - }{% - \xdef\@MXV@ctoc{#3}% - }% - \ifthenelse{\equal{#4}{}}{% - \xdef\@MXV@roo{0}% - }{% - \xdef\@MXV@roo{#4}% - }% - \ifthenelse{\equal{#5}{}}{% - \xdef\@MXV@roll{0}% - }{% - \xdef\@MXV@roll{#5}% - }% - \ifthenelse{\equal{#6}{}}{% - \xdef\@MXV@aac{30}% - }{% - \xdef\@MXV@aac{#6}% - }% - } - - %macro for generating an array of 3D views (varray) - \def\@MXV@buildva{% - \global\@MXV@viewscount=0% - \xdef\@MXV@varray{}% empty varray - % - %default view - \edef\@MXV@args{\@MXV@coo\space\@MXV@ctoc\space\@MXV@roo\space\@MXV@roll\space}% - \expandafter\@MXV@ciiwmatrix\@MXV@args% build C2W matrix - \xdef\@MXV@xname{Default}% - \@MXV@viewobj% create pdf object of 3D view - \edef\@MXV@defaultview{\@MXV@@viewobj}% - % - %read out 3D views file - \IfFileExists{\@MXV@viewsfile}{% - \edef\@MXV@endlinechar{\the\endlinechar}% - \endlinechar=-1% suppress trailing space at input line end - \openin\@MXV@@viewsfile=\@MXV@viewsfile% - \loop% - \read\@MXV@@viewsfile to \@MXV@inputline% - \if\@MXV@inputline\relax\else% - \expandafter\@MXV@parseline\@MXV@inputline% - \edef\@MXV@args{\@MXV@coo\space\@MXV@ctoc\space\@MXV@roo\space\@MXV@roll\space}% - \expandafter\@MXV@ciiwmatrix\@MXV@args% build C2W matrix - \global\advance\@MXV@viewscount by 1% - \ifthenelse{\equal{\@MXV@xname}{}}{% - \xdef\@MXV@xname{View \the\@MXV@viewscount}% - }{}% - \@MXV@viewobj% create pdf object of 3D view - %append current view obj ref to VA array - \xdef\@MXV@varray{\@MXV@varray\space\@MXV@@viewobj}% - \setboolean{@MXV@viewsprovided}{true}% - \repeat% - \closein\@MXV@@viewsfile% - \endlinechar=\@MXV@endlinechar% reset endlinechar - }{}% - % - %make the first view in the VA array the default view, if no default one has - %explicitly been provided, but if the VA array itself is empty too (no - %additional views provided) use our fallback view (c2c=0 -1 0) as default - \ifthenelse{\NOT\boolean{@MXV@defaultviewprovided}% - \AND\boolean{@MXV@viewsprovided}}{% - \xdef\@MXV@defaultview{/3DV /F}% - }{% - \xdef\@MXV@defaultview{/3DV \@MXV@defaultview}% - }% - } - - %following macros, including the 3D inclusion macro have driver specific - %implementations - \ifpdf% - %pdfLaTeX versions - %macro for creating 3D view object - \def\@MXV@viewobj{% - %projection dict - \pdfobj {<</Subtype/P/FOV \@MXV@aac/PS/Min>>}% - \pdfrefobj\pdflastobj% - % - \pdfobj {<<% - /MS/M% define the view as C2W matrix - /CO \@MXV@roo% orbital radius - /P \the\pdflastobj\space 0 R% - /C2W [\@MXV@matrix]% - /XN(\@MXV@xname)% name of the view appearing in the drop down list - \@MXV@background% - \@MXV@lights% - \@MXV@render% - >>}\pdfrefobj\pdflastobj% - \xdef\@MXV@@viewobj{\the\pdflastobj\space 0 R}% - }% - - %macro for creating resource objects from 3D and image files, to be used - %in 3D JavaScript - \def\@MXV@addresource#1{% - %determine file type - \filename@parse{#1}% - \ifthenelse{% - \equal{\filename@ext}{u3d}\OR% - \equal{\filename@ext}{U3D}% - }{% - \def\@MXV@restype{U3D}% - }{% - \def\@MXV@restype{image}% - }% - \ifthenelse{\equal{\@MXV@restype}{image}}{% - %embed the same image file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - \immediate\pdfximage {#1}% - \xdef\@MXV@resourcetree{% build name tree for embedded resources - \@MXV@resourcetree\space (#1) \the\pdflastximage\space 0 R% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{\the\pdflastximage}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) \@MXV@getlabelvalue{\pdfmdfivesum file {#1}}\space 0 R% - }% - }% - }{% - %embed the same 3D file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - \pdfobj stream % - attr {% - /Subtype/\@MXV@restype% - }% - file {#1}% - \pdfrefobj\pdflastobj% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) \the\pdflastobj\space 0 R% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{\the\pdflastobj}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) \@MXV@getlabelvalue{\pdfmdfivesum file {#1}}\space 0 R% - }% - }% - }% - } - - %3D inclusion macro - \newcommand{\@MXV@includeiiid}[5][]{% - %insert box or poster - \@MXV@box{#2}{#3}{#4}% - % - \if@MXV@externalviewer\else% - \setkeys{MXV@iiid}{#1}%process deferred options - \ifnum\@MXV@iiidrepeat=0\else% - \edef\@MXV@animstyle{% animation style dict - /AN <<% - \@MXV@iiidpalindrome\@MXV@iiidrate/PC \the\@MXV@iiidrepeat% - >>% - }% - \fi% - %java script file, stream object - \IfFileExists{\@MXV@jscriptiiidfile}{% - \pdfobj stream file {\@MXV@jscriptiiidfile}% - \pdfrefobj\pdflastobj% - \xdef\@MXV@jscriptiiid{/OnInstantiate \the\pdflastobj\space 0 R}% - }{\xdef\@MXV@jscriptiiid{}}% - % - %build the array of 3D views - \@MXV@buildva% - \fi% - % - %3D stream object - \if@MXV@inline% - \ifthenelse{% - \NOT\boolean{@MXV@presentation}\OR% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dstream}}{undefined}% - }{% - \pdfobj stream% - attr {% - /Subtype/\@MXV@iiidsubtype% - \if@MXV@externalviewer\else% - /VA [\@MXV@varray]% - /DV/F% use first entry in VA as default view - \@MXV@animstyle% - \@MXV@jscriptiiid% - \if@MXV@resource% - /Resources <<% - /Names [\@MXV@resourcetree]% - >>% - \fi% - \fi% - }% - file {#5}% - \pdfrefobj\pdflastobj% - \edef\@MXV@iiidstream{\the\pdflastobj}% - \if@MXV@presentation% - \@MXV@newlabel{\@MXV@label.3dstream}{\@MXV@iiidstream}% - \fi% - }{% - \edef\@MXV@iiidstream{\@MXV@getlabelvalue{\@MXV@label.3dstream}}% - }% - \fi% - % - \makebox[0pt][r]{\makebox[#2][l]{% - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}% -% since Reader 7.0.7, we cannot place a file attachment annot behind -% the 3D annot :-( -% \OR\boolean{@MXV@attachment} - }{% - \pdfannot width #2 height #3 depth #4 {% - /Subtype /FileAttachment% - /F 0% - /T (\@MXV@filename)% - /Contents (3D Object (\@MXV@mime))% - \if@MXV@externalviewer% - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS <<% - /F(#5)% - /Type/Filespec% - /EF << /F \@MXV@iiidstream\space 0 R >>% - >>% - }% - }{% - \if@MXV@url% - %insert Link annotation, if 3D file is a URL - \pdfannot width #2 height #3 depth #4 {% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@urlattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <</URI (#5) /S/URI>>% - /Contents (3D Object (\@MXV@mime))% - }% - \else% - %else insert Launch action for local external 3D file - \if@MXV@inline\else% - \pdfannot width #2 height #3 depth #4 {% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@runattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <<% - /F (#5)% - /S /Launch% - >>% - /Contents (3D Object (\@MXV@mime))% - }% - \fi% - \fi% - }% - % - \if@MXV@externalviewer\else% - %appearance dict dummy, to be shared by all 3D annots - \ifthenelse{\isundefined{\@MXV@apdict}}{% - \pdfobj stream attr {/BBox [0 0 0.001 0.001]} {}\pdfrefobj\pdflastobj% - \xdef\@MXV@apdict{/AP << /N \the\pdflastobj\space 0 R >>}% - }{}% - %3D reference dict - \if@MXV@presentation% - \ifthenelse{% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dref}}{undefined}% - }{% - \pdfobj {<<% - /Type/3DRef% - /3DD \@MXV@iiidstream\space 0 R% 3D stream object - >>}\pdfrefobj\pdflastobj% - \edef\@MXV@iiidstreamorref{\the\pdflastobj}% - \@MXV@newlabel{\@MXV@label.3dref}{\the\pdflastobj}% - }{% - \edef\@MXV@iiidstreamorref{\@MXV@getlabelvalue{\@MXV@label.3dref}}% - }% - \else% - \edef\@MXV@iiidstreamorref{\@MXV@iiidstream}% - \fi% - %annotation object of subtype `3D' - \pdfannot width #2 height #3 depth #4 {% - /Subtype/3D% - /F 4% we cannot put F 5 here; bug in Reader; 3D annot would be - /T (\@MXV@filename)% disabled even if plugin were available - /Contents (3D Object (\@MXV@mime))% - \ifx\@MXV@@label\@empty\else% - /NM (\@MXV@@label)% - \fi% - /P \@MXV@pdfpageref{@MXV@annot\the\@MXV@includes.page}% - \@MXV@apdict% /AP <</N<<>>/R<<>>/D<<>>>> doesn't work here - \@MXV@defaultview% - \@MXV@iiidia% - /3DD \@MXV@iiidstreamorref\space 0 R% 3D stream or reference object - /3DA << \@MXV@activation\@MXV@deactivation\@MXV@iiidtoolb >>% - }% - %label for later annot obj number determination, to be used in - %movieref's - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{\the\pdflastannot}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{\the\pdflastannot}% - \fi% - \fi}}% - }% - \else\if@MXV@dvipdfmx% - %dvipdfmx versions - %macro for creating 3D view object - \def\@MXV@viewobj{% - %projection dict - \special{pdf:obj @pdict\the\@MXV@includes_\the\@MXV@viewscount <<% - /Subtype/P/FOV \@MXV@aac/PS/Min% - >>}% - % - \special{pdf:obj @viewobj\the\@MXV@includes_\the\@MXV@viewscount <<% - /MS/M% define the view as C2W matrix - /CO \@MXV@roo% orbital radius - /P @pdict\the\@MXV@includes_\the\@MXV@viewscount% - /C2W [\@MXV@matrix]% - /XN(\@MXV@xname)% name of the view appearing in the drop down list - \@MXV@background% - \@MXV@lights% - \@MXV@render% - >>}% - \xdef\@MXV@@viewobj{@viewobj\the\@MXV@includes_\the\@MXV@viewscount}% - }% - - %macro for creating resource objects from 3D and image files, to be used - %in 3D JavaScript - \def\@MXV@addresource#1{% - %determine file type - \filename@parse{#1}% - \ifthenelse{% - \equal{\filename@ext}{u3d}\OR% - \equal{\filename@ext}{U3D}% - }{% - \def\@MXV@restype{U3D}% - }{% - \def\@MXV@restype{image}% - }% - \ifthenelse{\equal{\@MXV@restype}{image}}{% - %embed the same image file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - %increment counter of embedded resource files - \global\advance\@MXV@rescount by 1% - %create Image XObject from next raster image - \special{pdf:image @resource\the\@MXV@rescount\space(#1)}% - \xdef\@MXV@resourcetree{% build name tree for embedded resources - \@MXV@resourcetree\space(#1) @resource\the\@MXV@rescount% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{@resource\the\@MXV@rescount}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space(#1) \@MXV@getlabelvalue{\pdfmdfivesum file {#1}}% - }% - }% - }{% - %embed the same 3D file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - \global\advance\@MXV@rescount by 1% - \special{pdf:fstream @resource\the\@MXV@rescount\space(#1) <<% - /Subtype/\@MXV@restype>>}% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space(#1) @resource\the\@MXV@rescount% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{@resource\the\@MXV@rescount}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space(#1) \@MXV@getlabelvalue{\pdfmdfivesum file {#1}}% - }% - }% - }% - } - - %3D inclusion macro - \newcommand{\@MXV@includeiiid}[5][]{% - %insert box or poster - \@MXV@box{#2}{#3}{#4}% - % - \if@MXV@externalviewer\else% - \setkeys{MXV@iiid}{#1}%process deferred options - \ifnum\@MXV@iiidrepeat=0\else% - \edef\@MXV@animstyle{% animation style dict - /AN <<% - \@MXV@iiidpalindrome\@MXV@iiidrate/PC \the\@MXV@iiidrepeat% - >>% - }% - \fi% - %java script file, stream object - \IfFileExists{\@MXV@jscriptiiidfile}{% - \special{pdf:fstream @jscriptiiid\the\@MXV@includes\space(\@MXV@jscriptiiidfile)}% - \xdef\@MXV@jscriptiiid{/OnInstantiate @jscriptiiid\the\@MXV@includes}% - }{\xdef\@MXV@jscriptiiid{}}% - % - %build the array of 3D views - \@MXV@buildva% - \fi% - % - %3D stream object - \if@MXV@inline% - \ifthenelse{% - \NOT\boolean{@MXV@presentation}\OR% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dstream}}{undefined}% - }{% - \special{pdf:fstream @iiiDfile\the\@MXV@includes\space(#5) <<% - /Subtype/\@MXV@iiidsubtype% - \if@MXV@externalviewer\else% - /VA [\@MXV@varray]% - /DV/F% use first entry in VA as default view - \@MXV@animstyle% - \@MXV@jscriptiiid% - \if@MXV@resource% - /Resources <</Names [\@MXV@resourcetree]>>% - \fi% - \fi% - >>}% - \edef\@MXV@iiidstream{@iiiDfile\the\@MXV@includes}% - \if@MXV@presentation% - \@MXV@newlabel{\@MXV@label.3dstream}{\@MXV@iiidstream}% - \fi% - }{% - \edef\@MXV@iiidstream{\@MXV@getlabelvalue{\@MXV@label.3dstream}}% - }% - \fi% - % - \makebox[0pt][r]{\makebox[#2][l]{% - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}% -% since Reader 7.0.7, we cannot place a file attachment annot behind -% the 3D annot :-( -% \OR\boolean{@MXV@attachment} - }{% - \special{pdf:annot width \the#2 height \the#3 depth \the#4 <<% - /Subtype /FileAttachment% - /F 0% - /T (\@MXV@filename)% - /Contents (3D Object (\@MXV@mime))% - \if@MXV@externalviewer% - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS <<% - /F(#5)% - /Type/Filespec% - /EF << /F \@MXV@iiidstream >>% - >>% - >>}% - }{% - \if@MXV@url% - %insert Link annotation, if 3D file is a URL - \special{pdf:annot width \the#2 height \the#3 depth \the#4 <<% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@urlattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <</URI (#5) /S/URI>>% - /Contents (3D Object (\@MXV@mime))% - >>}% - \else% - %else insert Launch action for local external 3D file - \if@MXV@inline\else% - \special{pdf:annot width \the#2 height \the#3 depth \the#4 <<% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@runattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <<% - /F (#5)% - /S /Launch% - >>% - /Contents (3D Object (\@MXV@mime))% - >>}% - \fi% - \fi% - }% - % - \if@MXV@externalviewer\else% - %appearance dict dummy, to be shared by all 3D annots - \ifthenelse{\isundefined{\@MXV@apdict}}{% - \special{pdf:stream @apdict\space()<</BBox[0 0 0.001 0.001]>>}% - \xdef\@MXV@apdict{/AP << /N @apdict >>}% - }{}% - %3D reference dict - \if@MXV@presentation% - \ifthenelse{% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dref}}{undefined}% - }{% - \special{pdf:obj @iiiDref\the\@MXV@includes <<% - /Type/3DRef% - /3DD \@MXV@iiidstream% 3D stream object - >>}% - \edef\@MXV@iiidstreamorref{@iiiDref\the\@MXV@includes}% - \@MXV@newlabel{\@MXV@label.3dref}{\the\pdflastobj}% - }{% - \edef\@MXV@iiidstreamorref{\@MXV@getlabelvalue{\@MXV@label.3dref}}% - }% - \else% - \edef\@MXV@iiidstreamorref{\@MXV@iiidstream}% - \fi% - %annotation object of subtype `3D' - \special{pdf:annot @3Dannot\the\@MXV@includes\space width \the#2 height \the#3 depth \the#4 <<% - /Subtype/3D% - /F 4% we cannot put F 5 here; bug in Reader; 3D annot would be - /T (\@MXV@filename)% disabled even if plugin were available - /Contents (3D Object (\@MXV@mime))% - \ifx\@MXV@@label\@empty\else% - /NM (\@MXV@@label)% - \fi% - /P @thispage% - \@MXV@apdict% /AP <</N<<>>/R<<>>/D<<>>>> doesn't work here - \@MXV@defaultview% - \@MXV@iiidia% - /3DD \@MXV@iiidstreamorref% 3D stream or reference object - /3DA << \@MXV@activation\@MXV@deactivation\@MXV@iiidtoolb >>% - >>}% - %label for later annot obj number determination, to be used in - %movieref's - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{@3Dannot\the\@MXV@includes}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{@3Dannot\the\@MXV@includes}% - \fi% - \fi}}% - }% - \else% - %dvips versions - %macro for creating 3D view object and associated projection dict - \def\@MXV@viewobj{% - %projection dict - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {pdict\the\@MXV@includes_\the\@MXV@viewscount}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {pdict\the\@MXV@includes_\the\@MXV@viewscount} <<% - /Subtype/P/FOV \@MXV@aac/PS/Min% - >>% - }% - }% - % - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /type/dict% - /_objdef {viewobj\the\@MXV@includes_\the\@MXV@viewscount}% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {viewobj\the\@MXV@includes_\the\@MXV@viewscount} <<% - /MS/M% - /CO \@MXV@roo% - /P {pdict\the\@MXV@includes_\the\@MXV@viewscount}% - /C2W[\@MXV@matrix]% - /XN(\@MXV@xname)% - \@MXV@background% - \@MXV@lights% - \@MXV@render% - >>% - }% - }% - \xdef\@MXV@@viewobj{{viewobj\the\@MXV@includes_\the\@MXV@viewscount}}% - }% - % - %macro for creating resource objects from 3D and image files - \def\@MXV@addresource#1{% - %determine file type - \filename@parse{#1}% - \ifthenelse{% - \equal{\filename@ext}{u3d}\OR% - \equal{\filename@ext}{U3D}% - }{% - \def\@MXV@restype{U3D}% - }{% - \def\@MXV@restype{image}% - }% - \ifthenelse{\equal{\@MXV@restype}{image}}{% - %embed the same image file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - %increment counter of embedded resource files - \global\advance\@MXV@rescount by 1% - %create Image XObject from next raster image - \special{ps:% read image resource from file - [ /_objdef {resource\the\@MXV@rescount} /NI pdfmark - save gsave - { - /showpage {} def - /setpagedevice /pop load def - newpath clip - (#1) run - } ?pdfmark - 0 0 1 [1 0 0 1 0 0] {} image %empty dummy, in case #1 is not - grestore restore %a valid image file - }% - \xdef\@MXV@resourcetree{% build name tree for embedded resources - \@MXV@resourcetree\space (#1) {resource\the\@MXV@rescount}% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{resource\the\@MXV@rescount}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) {\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}% - }% - }% - }{% - %embed the same 3D file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}{undefined}}{% - \global\advance\@MXV@rescount by 1% - \special{ps: - [ /_objdef {resource\the\@MXV@rescount} /type/stream /OBJ pdfmark - [ {resource\the\@MXV@rescount} <<% - /Subtype/\@MXV@restype% - >> /PUT pdfmark% - [ {resource\the\@MXV@rescount} (#1) (r) file /PUT pdfmark - }% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) {resource\the\@MXV@rescount}% - }% - \@MXV@newlabel{\pdfmdfivesum file {#1}}{resource\the\@MXV@rescount}% - }{% - \xdef\@MXV@resourcetree{% - \@MXV@resourcetree\space (#1) {\@MXV@getlabelvalue{\pdfmdfivesum file {#1}}}% - }% - }% - }% - } - % - %3D inclusion macro - \newcommand{\@MXV@includeiiid}[5][]{% - % - \if@MXV@externalviewer\else% - \setkeys{MXV@iiid}{#1}%process deferred options - \ifnum\@MXV@iiidrepeat=0\else% - \edef\@MXV@animstyle{% animation style dict - /AN <<% - \@MXV@iiidpalindrome\@MXV@iiidrate/PC \the\@MXV@iiidrepeat% - >>% - }% - \fi% - %java script file, stream object - \IfFileExists{\@MXV@jscriptiiidfile}{% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {jscriptiiid\the\@MXV@includes}% - /type/stream% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {jscriptiiid\the\@MXV@includes}% - (\@MXV@jscriptiiidfile) (r) file% - }% - }% - \xdef\@MXV@jscriptiiid{% - /OnInstantiate {jscriptiiid\the\@MXV@includes}% - }% - }{\def\@MXV@jscriptiiid{}}% - % - %build the array of 3D views - \@MXV@buildva% - \fi% - % - %3D stream object - \if@MXV@inline% - \ifthenelse{% - \NOT\boolean{@MXV@presentation}\OR% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dstream}}{undefined}% - }{% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {iiiDfile\the\@MXV@includes}% - /type/stream% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {iiiDfile\the\@MXV@includes} <<% - /Subtype/\@MXV@iiidsubtype% - \if@MXV@externalviewer\else% - /VA [\@MXV@varray]% - /DV/F% use first entry in VA as default view - \@MXV@animstyle% - \if@MXV@resource% - /Resources <<% - /Names [\@MXV@resourcetree]% - >>% - \fi% - \@MXV@jscriptiiid% - \fi% - >>% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {iiiDfile\the\@MXV@includes}% - (#5) (r) file% - }% - }% - \edef\@MXV@iiidstream{iiiDfile\the\@MXV@includes}% - \if@MXV@presentation% - \@MXV@newlabel{\@MXV@label.3dstream}{\@MXV@iiidstream}% - \fi% - }{% - \edef\@MXV@iiidstream{\@MXV@getlabelvalue{\@MXV@label.3dstream}}% - }% - \fi% - % - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}% -% \OR\boolean{@MXV@attachment} - }{% - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#2}{#3}{#4}}]{% - pdfmark=/ANN,% - Subtype=/FileAttachment,% - Raw={% - /F 0% - /T (\@MXV@filename)% - /Contents (3D Object (\@MXV@mime))% - \if@MXV@externalviewer% - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS <<% - /F(#5)% - /Type/Filespec% - /EF <</F {\@MXV@iiidstream}>>% - >>% - }% - }% - }% - }{% - \if@MXV@url% - %insert Link annotation, if 3D file is a URL - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#2}{#3}{#4}}]{% - pdfmark=/ANN,% - Subtype=/Link,% - Raw={% - /F 0% - \if@MXV@externalviewer% - /C [\@urlbordercolor]% - /H \@pdfhighlight% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /Action <</URI (#5) /S/URI>>% - /Contents (3D Object (\@MXV@mime))% - }% - }% - }% - \else% - %else insert Launch action for local external 3D file - \if@MXV@inline\else% - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#2}{#3}{#4}}]{% - pdfmark=/ANN,% - Subtype=/Link,% - Raw={% - /F 0% - \if@MXV@externalviewer% - /C [\@urlbordercolor]% - /H \@pdfhighlight% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /Action <<% - /F (#5)% - /S /Launch% - >>% - /Contents (3D Object (\@MXV@mime))% - }% - }% - }% - \fi% - \fi% - }% - \if@MXV@externalviewer% - \phantom{\@MXV@box{#2}{#3}{#4}}% - \else% - %appearance dict dummy, to be shared by all 3D annots - \ifthenelse{\isundefined{\@MXV@apdict}}{% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {apdict}% - /type/stream% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {apdict}% - ()% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {apdict} - <</BBox [0 0 0.001 0.001]>> - }% - }% - \xdef\@MXV@apdict{/AP << /N {apdict}>>}% - }{}% - %3D reference dict - \if@MXV@presentation% - \ifthenelse{% - \equal{\@MXV@getlabelvalue{\@MXV@label.3dref}}{undefined}% - }{% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {iiiDref\the\@MXV@includes}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {iiiDref\the\@MXV@includes} <<% - /Type/3DRef% - /3DD {\@MXV@iiidstream}% 3D stream object - >>% - }% - }% - \edef\@MXV@iiidstreamorref{iiiDref\the\@MXV@includes}% - \@MXV@newlabel{\@MXV@label.3dref}{\@MXV@iiidstreamorref}% - }{% - \edef\@MXV@iiidstreamorref{\@MXV@getlabelvalue{\@MXV@label.3dref}}% - }% - \else% - \edef\@MXV@iiidstreamorref{\@MXV@iiidstream}% - \fi% - %annotation object of subtype `3D' - \pdfmark[\phantom{\@MXV@box{#2}{#3}{#4}}]{% - pdfmark=/ANN,% - Subtype=/3D,% - Raw={% - /_objdef {3Dannot\the\@MXV@includes}% - /F 4% - /T (\@MXV@filename)% - \ifx\@MXV@@label\@empty\else% - /NM (\@MXV@@label)% - \fi% - /Contents (3D Object (\@MXV@mime))% - /P {ThisPage}% - \@MXV@apdict% /AP <</N<<>>/R<<>>/D<<>>>> doesn't work here - \@MXV@defaultview% - \@MXV@iiidia% - /3DD {\@MXV@iiidstreamorref}% 3D stream or reference object - /3DA <<\@MXV@activation\@MXV@deactivation\@MXV@iiidtoolb>>% - }% - }% - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{\the\@MXV@includes}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{\the\@MXV@includes}% - \fi% - \fi% - }% - \fi\fi% -}{} - -%settings for newly opened media players -\def\@MXV@settings#1#2#3#4#5#6#7{% - var settings={% - privateData: {% - paused: false - }, - autoPlay: false, - visible: false, - volume: #7 - #1% showUI (controls) - #2% palindrome - #3% repeat - #4% rate - #5% startAt - #6% endAt - }; -} - -%JavaScript event handler routines for 2D media activation -\def\@MXV@events#1#2#3{% #1: playerid, #2: mouse?, #3: autoplay? - var events=new app.media.Events({% - %on focus change from one movie to another, events are fired in the - %following order: (1) onBlur, (2) onFocus, (3) afterBlur, (4) afterFocus - onBlur: function (e) {% - if(focusonplayer > 0){% - focusonplayer=0; - } - }, - afterBlur: function (e) {% - %only resume if we click outside of any media - if(focusonplayer==0){% - try{ - e.target.settings.privateData.paused=false; - e.target.play(); - }catch(e){} - } - }, - onFocus: function (e) {% - focusonplayer=#1; - }, - afterFocus: function (e) {% - if(!e.target.isPlaying){%play on click if paused - try{ - e.target.settings.privateData.paused=false; - e.target.play(); - if(!e.target.isPlaying){%still not playing?! - %sometimes play() fails, in particular if the movie has reached - %its end before getting the focus; but this works: - if( - e.target.settings.startAt.time - || e.target.settings.startAt.frame - || e.target.settings.startAt.marker - || e.target.id == 'vnd.adobe.swname:AAPL_QuickTime' - ){ - e.target.seek(e.target.settings.startAt); - }else{ - e.target.stop(); - } - e.target.play(); - } - } - catch (e){} - } - \@MXV@if{#2}% - else{% - %media can only be paused if mouse option is set - try{ - e.target.pause(); - e.target.settings.privateData.paused=true; - }catch (e){} - } - \fi% - \if@MXV@issound\else e.target.visible=true;\fi% - }, - onPlay: function (e) {% - e.target.settings.privateData.paused=false; - }, - onPause: function (e) {% - e.target.settings.privateData.paused=true; - }, - afterReady: function (e) {% - try{ - if( - e.target.settings.startAt.time - || e.target.settings.startAt.frame - || e.target.settings.startAt.marker - ){ - e.target.play(); - e.target.pause(); - e.target.stop(); - e.target.settings.privateData.paused=false; - e.target.seek(e.target.settings.startAt); - } - \if@MXV@issound\else e.target.visible=true;\fi% - \@MXV@if{#3} - e.target.settings.privateData.paused=false; - e.target.play(); - \fi - } - catch (e){} - } - }); -}% - -%output driver specific implementations of the 2D inclusion macro -\ifpdf% - %pdfLaTeX version - \def\@MXV@includemovie#1#2#3#4{% - %insert box or poster - \@MXV@box{#1}{#2}{#3}% - % - \if@MXV@externalviewer\else% - %new action dict - \pdfobj reserveobjnum% - \@MXV@adict=\pdflastobj% - % - %new additional actions dict - \pdfobj reserveobjnum% - \@MXV@aadict=\pdflastobj% - % - \fi% - %embedded file entry `/EF' - \if@MXV@inline% - %embed the same media file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#4}}}{undefined}}{% - \pdfobj stream % - attr {% - /Type/EmbeddedFile% - /Subtype (\@MXV@mime)% - }% - file {#4}% - \pdfrefobj\pdflastobj% - \edef\@MXV@efentry{% - /EF << /F \the\pdflastobj\space 0 R >>% - }% - \@MXV@newlabel{\pdfmdfivesum file {#4}}{\the\pdflastobj}% - }{% - \edef\@MXV@efentry{% - /EF << /F \@MXV@getlabelvalue{\pdfmdfivesum file {#4}}\space 0 R >>% - }% - }% - \else\def\@MXV@efentry{}\fi% - % - \ifthenelse{\boolean{@MXV@externalviewer}\AND\NOT\boolean{@MXV@inline}}{}{% - %new file specification object - \pdfobj {<<% - /F(#4)% - \@MXV@fsentry% - \@MXV@efentry% - /Type/Filespec% - >>}\pdfrefobj\pdflastobj% - \edef\@MXV@filespec{\the\pdflastobj}% - }% - % - \makebox[0pt][r]{\makebox[#1][l]{% - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}\OR% - \boolean{@MXV@attachment}% - }{% - \pdfannot width #1 height #2 depth #3 {% - /Subtype /FileAttachment% - /F 0% - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - \if@MXV@externalviewer% - %a coloured border, as with external links, would be much nicer - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS \@MXV@filespec\space 0 R% - }% - }{% - \if@MXV@url% - %insert Link annotation, if media file is a URL - \pdfannot width #1 height #2 depth #3 {% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@urlattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <</URI (#4) /S/URI>>% - /Contents (Media File (\@MXV@mime))% - }% - \else% - %else insert Launch action for local external media file - \if@MXV@inline\else% - \pdfannot width #1 height #2 depth #3 {% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@runattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <<% - /F (#4)% - /S /Launch% - >>% - /Contents (Media File (\@MXV@mime))% - }% - \fi% - \fi% - }% - % - \if@MXV@externalviewer\else% - %annotation object of subtype `Screen' - \pdfannot width #1 height #2 depth #3 {% - /Subtype /Screen% - /Border [0 0 0]% no border (PDF-1.1) - /BS <</S/S/W 0>>% no border (PDF-1.5) - /F 5% disable annot if multimedia is not available - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - /P \@MXV@pdfpageref{@MXV@annot\the\@MXV@includes.page} 0 R% - /A \the\@MXV@adict\space 0 R% - /AA \the\@MXV@aadict\space 0 R% - /AP <</N<<>>/R<<>>/D<<>>>>% - }\edef\@MXV@screenannot{\the\pdflastannot}% - %label for later annot obj number determination, to be used in - %movieref's only - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{\@MXV@screenannot}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{\@MXV@screenannot}% - \fi% - % - %new media clip object of subtype `Media Clip Data' (/S/MCD) - \pdfobj {<<% - /D \@MXV@filespec\space 0 R% - /P <</TF(TEMPACCESS)>>% - /S/MCD% - /CT (\@MXV@mime)% - >>}\pdfrefobj\pdflastobj% - % - %new rendition object of subtype `Media Rendition' (/S/MR) - \pdfobj {<<% - /C \the\pdflastobj\space 0 R% - /S/MR% - /SP <</BE<</O 0.0>>>>% - /P <<% - \@MXV@player% - /BE <<% - /F 2% - \@MXV@@repeat\@MXV@@volume\@MXV@@ctrls% - /D <</S /F>>% - >>% - >>% - >>}\edef\@MXV@mediarendition{\the\pdflastobj}\pdfrefobj\pdflastobj% - %label for later rendition obj number determination - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.rendition}{\@MXV@mediarendition}% - \@MXV@newlabel{@MXV@\@MXV@@label.rendition}{\@MXV@mediarendition}% - \fi% - % - %action dictionary - \pdfobj useobjnum \@MXV@adict {<<% - /R \@MXV@mediarendition\space 0 R% - /S/Rendition% - /OP 0% fallback if /JS doesn't work or is empty - \@MXV@activationjsentry% - /AN \@MXV@screenannot\space 0 R% - >>}\pdfrefobj\pdflastobj% - % - %create play/stop/resume/pause actions - \pdfobj {<<% - /R \@MXV@mediarendition\space 0 R% - /S/Rendition% - \@MXV@pageopenopentry% /OP fallback if /JS doesn't work - \@MXV@pageopenjsentry% - /AN \@MXV@screenannot\space 0 R% - >>}\edef\@MXV@pageopenaction{\the\pdflastobj}\pdfrefobj\pdflastobj% - % - \pdfobj {<<% - /R \@MXV@mediarendition\space 0 R% - /S/Rendition% - \@MXV@pagecloseopentry% - \@MXV@pageclosejsentry% - /AN \@MXV@screenannot\space 0 R% - >>}\edef\@MXV@pagecloseaction{\the\pdflastobj}\pdfrefobj\pdflastobj% - % - %populate additional actions dictionary - \pdfobj useobjnum \@MXV@aadict {<<% - /PO \@MXV@pageopenaction\space 0 R% - /PC \@MXV@pagecloseaction\space 0 R% - >>}\pdfrefobj\pdflastobj% - \fi}}% - }% -\else\if@MXV@dvipdfmx - %dvipdfmx version - \def\@MXV@includemovie#1#2#3#4{% - %insert box or poster - \@MXV@box{#1}{#2}{#3}% - % - \if@MXV@externalviewer\else% - %new action dict - \special{pdf:obj @MXV@adict\the\@MXV@includes << >>}% - % - %new additional actions dict - \special{pdf:obj @MXV@aadict\the\@MXV@includes << >>}% - % - \fi% - %embedded file entry `/EF' - \if@MXV@inline% - %embed the same media file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#4}}}{undefined}}{% - \special{pdf:fstream @fstream\the\@MXV@includes\space(#4) <<% - /Type/EmbeddedFile% - /Subtype (\@MXV@mime)% - >>}% - \edef\@MXV@efentry{% - /EF << /F @fstream\the\@MXV@includes >>% - }% - \@MXV@newlabel{\pdfmdfivesum file {#4}}{@fstream\the\@MXV@includes}% - }{% - \edef\@MXV@efentry{% - /EF << /F \@MXV@getlabelvalue{\pdfmdfivesum file {#4}} >>% - }% - }% - \else\def\@MXV@efentry{}\fi% - % - \ifthenelse{\boolean{@MXV@externalviewer}\AND\NOT\boolean{@MXV@inline}}{}{% - %new file specification object - \special{pdf:obj @filespec\the\@MXV@includes <<% - /F(#4)% - \@MXV@fsentry% - \@MXV@efentry% - /Type/Filespec% - >>}% - \edef\@MXV@filespec{@filespec\the\@MXV@includes}% - }% - % - \makebox[0pt][r]{\makebox[#1][l]{% - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}\OR% - \boolean{@MXV@attachment}% - }{% - \special{pdf:annot width \the#1 height \the#2 depth \the#3 <<% - /Subtype /FileAttachment% - /F 0% - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - \if@MXV@externalviewer% - %a coloured border, as with external links, would be much nicer - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS \@MXV@filespec% - >>}% - }{% - \if@MXV@url% - %insert Link annotation, if media file is a URL - \special{pdf:annot width \the#1 height \the#2 depth \the#3 <<% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@urlattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <</URI (#4) /S/URI>>% - /Contents (Media File (\@MXV@mime))% - >>}% - \else% - %else insert Launch action for local external media file - \if@MXV@inline\else% - \special{pdf:annot width \the#1 height \the#2 depth \the#3 <<% - /Subtype /Link% - /F 0% - \if@MXV@externalviewer% - \@MXV@runattr% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /A <<% - /F (#4)% - /S /Launch% - >>% - /Contents (Media File (\@MXV@mime))% - >>}% - \fi% - \fi% - }% - % - \if@MXV@externalviewer\else% - %annotation object of subtype `Screen' - \special{pdf:annot @screenannot\the\@MXV@includes\space width \the#1 height \the#2 depth \the#3 <<% - /Subtype /Screen% - /Border [0 0 0]% no border (PDF-1.1) - /BS <</S/S/W 0>>% no border (PDF-1.5) - /F 5% disable annot if multimedia is not available - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - /P @thispage% - /A @MXV@adict\the\@MXV@includes% - /AA @MXV@aadict\the\@MXV@includes% - /AP <</N<<>>/R<<>>/D<<>>>>% - >>}% - \edef\@MXV@screenannot{@screenannot\the\@MXV@includes}% - %label for later annot obj number determination, to be used in - %movieref's only - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{\@MXV@screenannot}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{\@MXV@screenannot}% - \fi% - % - %new media clip object of subtype `Media Clip Data' (/S/MCD) - \special{pdf:obj @mediaclipdata\the\@MXV@includes <<% - /D \@MXV@filespec% - /P <</TF(TEMPACCESS)>>% - /S/MCD% - /CT (\@MXV@mime)% - >>}% - % - %new rendition object of subtype `Media Rendition' (/S/MR) - \special{pdf:obj @mediarendition\the\@MXV@includes <<% - /C @mediaclipdata\the\@MXV@includes% - /S/MR% - /SP <</BE<</O 0.0>>>>% - /P <<% - \@MXV@player% - /BE <<% - /F 2% - \@MXV@@repeat\@MXV@@volume\@MXV@@ctrls% - /D <</S /F>>% - >>% - >>% - >>}% - \edef\@MXV@mediarendition{@mediarendition\the\@MXV@includes}% - %label for later rendition obj number determination - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.rendition}{\@MXV@mediarendition}% - \@MXV@newlabel{@MXV@\@MXV@@label.rendition}{\@MXV@mediarendition}% - \fi% - % - %action dictionary - \special{pdf:put @MXV@adict\the\@MXV@includes <<% - /R \@MXV@mediarendition% - /S/Rendition% - /OP 0% fallback if /JS doesn't work or is empty - \@MXV@activationjsentry% - /AN \@MXV@screenannot% - >>}% - % - %create play/stop/resume/pause actions - \special{pdf:obj @pageopenaction\the\@MXV@includes <<% - /R \@MXV@mediarendition% - /S/Rendition% - \@MXV@pageopenopentry% /OP fallback if /JS doesn't work - \@MXV@pageopenjsentry% - /AN \@MXV@screenannot% - >>}% - \edef\@MXV@pageopenaction{@pageopenaction\the\@MXV@includes}% - % - \special{pdf:obj @pagecloseaction\the\@MXV@includes <<% - /R \@MXV@mediarendition% - /S/Rendition% - \@MXV@pagecloseopentry% - \@MXV@pageclosejsentry% - /AN \@MXV@screenannot% - >>}% - \edef\@MXV@pagecloseaction{@pagecloseaction\the\@MXV@includes}% - % - %populate additional actions dictionary - \special{pdf:put @MXV@aadict\the\@MXV@includes <<% - /PO \@MXV@pageopenaction% - /PC \@MXV@pagecloseaction% - >>}% - \fi}}% - }% -\else% - %dvips version - \def\@MXV@includemovie#1#2#3#4{% - %insert FileAttachment annotation - \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}\OR% - \boolean{@MXV@attachment}% - }{% - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#1}{#2}{#3}}]{% - pdfmark=/ANN,% - Subtype=/FileAttachment,% - Raw={% - /F 0% - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - \if@MXV@externalviewer% - /Name/Paperclip% - /C [1 1 1]% - \else% - /AP <</N<<>>/R<<>>/D<<>>>>% - \fi% - /FS {filespec\the\@MXV@includes}% - }% - }% - }% - }{% - \if@MXV@url% - %insert Link annotation, if media file is a URL - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#1}{#2}{#3}}]{% - pdfmark=/ANN,% - Subtype=/Link,% - Raw={% - /F 0% - \if@MXV@externalviewer% - /C [\@urlbordercolor]% - /H \@pdfhighlight% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /Action <</URI (#4) /S/URI>>% - /Contents (Media File (\@MXV@mime))% - }% - }% - }% - \else% - %else insert Launch action for local external media file - \if@MXV@inline\else% - \makebox[0pt][l]{% - \pdfmark[\phantom{\@MXV@box{#1}{#2}{#3}}]{% - pdfmark=/ANN,% - Subtype=/Link,% - Raw={% - /F 0% - \if@MXV@externalviewer% - /C [\@urlbordercolor]% - /H \@pdfhighlight% - \else% - /H /N% - /Border [0 0 0]% - \fi% - /Action <<% - /F (#4)% - /S /Launch% - >>% - /Contents (Media File (\@MXV@mime))% - }% - }% - }% - \fi% - \fi% - }% - % - \if@MXV@externalviewer% - \@MXV@box{#1}{#2}{#3}% - \else% - %annotation object of subtype `Screen' - \pdfmark[\@MXV@box{#1}{#2}{#3}]{% - pdfmark=/ANN,% - Subtype=/Screen,% - Border={0 0 0},% - Raw={% - /_objdef {screenannot\the\@MXV@includes}% - /F 5% - /T (\@MXV@filename)% - /Contents (Media File (\@MXV@mime))% - /BS <</S/S/W 0>>% no border (PDF-1.5) - /P {ThisPage}% - /AA {aadict\the\@MXV@includes}% - /AP <</N<<>>/R<<>>/D<<>>>>% - }% - }% - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annot}{\the\@MXV@includes}% - \@MXV@newlabel{@MXV@\@MXV@@label.annot}{\the\@MXV@includes}% - \fi% - % - %entire action entry moved outside screen annotation - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {screenannot\the\@MXV@includes} <<% - /A <<% - /R {mediarendition\the\@MXV@includes}% - /S/Rendition% - /OP 0% fallback, if /JS doesn't work or is empty - \@MXV@activationjsentry% - /AN {screenannot\the\@MXV@includes}% - >>% - >>% - }% - }% - % - %new rendition object of subtype `Media Rendition' (/S/MR) - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /type/dict% - /_objdef {mediarendition\the\@MXV@includes}% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {mediarendition\the\@MXV@includes} <<% - /C {mediaclipdata\the\@MXV@includes}% - /S/MR% - %screen parameters: fully transparent, hidden if audio mime type - /SP <</BE<</O 0.0>>>>% - /P <<%Media Play Parameters - \@MXV@player% - /BE <<%Parameters need only be honored by the player in - %the best effort sense - /F 2%scale media's width and height to fit the - %annotation rectangle - \@MXV@@repeat\@MXV@@volume\@MXV@@ctrls% - /D <</S /F>>%movie remains opened - >>% - >>% - >>% - }% - }% - % - %new media clip object of subtype `Media Clip Data' (/S/MCD) - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {mediaclipdata\the\@MXV@includes}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {mediaclipdata\the\@MXV@includes} <<% - /D {filespec\the\@MXV@includes}% - /P <</TF(TEMPACCESS)>>% - /S/MCD% - /CT (\@MXV@mime)% mime type - >>% - }% - }% - \fi% - % - %new file specification object - \ifthenelse{\boolean{@MXV@externalviewer}\AND\NOT\boolean{@MXV@inline}}{}{% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {filespec\the\@MXV@includes}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {filespec\the\@MXV@includes} <<% - \@MXV@fsentry - /F(#4)% file name - /Type/Filespec% - >>% - }% - }% - }% - % - %embedded file entry `/EF' - \if@MXV@inline% - %embed the same media file only once - \ifthenelse{\equal{\@MXV@getlabelvalue{\pdfmdfivesum file {#4}}}{undefined}}{% - %new stream object - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {fstream\the\@MXV@includes}% - /type/stream% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {fstream\the\@MXV@includes}% - (#4) (r) file% read in file contents - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {fstream\the\@MXV@includes} <<% - /Type/EmbeddedFile% - /Subtype(\@MXV@mime)% - >>% - }% - }% - \edef\@MXV@moviestream{fstream\the\@MXV@includes}% - \@MXV@newlabel{\pdfmdfivesum file {#4}}{fstream\the\@MXV@includes}% - }{% - \edef\@MXV@moviestream{\@MXV@getlabelvalue{\pdfmdfivesum file {#4}}}% - }% - % put the embedded file entry into file spec object - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {filespec\the\@MXV@includes} <<% - /EF << /F {\@MXV@moviestream} >>% - >>% - }% - }% - \fi% - % - \if@MXV@externalviewer\else% - %create actions for page open/close events - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {pageopenaction\the\@MXV@includes}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {pageopenaction\the\@MXV@includes} <<% - /R {mediarendition\the\@MXV@includes}% - /S/Rendition% - \@MXV@pageopenopentry% /OP fallback, if /JS doesn't work - \@MXV@pageopenjsentry% - /AN {screenannot\the\@MXV@includes}% - >>% - }% - }% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {pagecloseaction\the\@MXV@includes}% - /type/dict% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {pagecloseaction\the\@MXV@includes} <<% - /R {mediarendition\the\@MXV@includes}% - /S/Rendition% - \@MXV@pagecloseopentry% - \@MXV@pageclosejsentry% - /AN {screenannot\the\@MXV@includes}% - >>% - }% - }% - % - %create and populate additional actions dictionary, always add entries - %for page open/close events - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /type/dict% - /_objdef {aadict\the\@MXV@includes}% - }% - }% - % - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {aadict\the\@MXV@includes} <<% - /PO {pageopenaction\the\@MXV@includes}% - /PC {pagecloseaction\the\@MXV@includes}% - >>% - }% - }% - \fi% - }% -\fi\fi - -%definition of user command `\includemovie' -\newcommand{\includemovie}[4][]{% - %test for hyperref package - \ifpdf\else% - \ifthenelse{\isundefined{\pdfmark}\AND\isundefined{\@pdfm@mark}}{\@MXV@missing{hyperref}}{}% - \fi% - % - \leavevmode% - \@MXV@reset% all macros and options - \setkeys{MXV@user}{#1}% parse options - % - %total height of text - \@MXV@totalheight=\@MXV@height% - \advance\@MXV@totalheight by \@MXV@depth% - %traiselen=distance at which text is to be raised to centre it vertically - %braiselen=vertical centre of media box (auxiliary measure) - \@MXV@traiselen=0.5\@MXV@height% - \advance\@MXV@traiselen by -0.5\@MXV@depth% - % - \ifthenelse{\equal{#3}{}}{% no height argument - \@MXV@braiselen=0.5\@MXV@height% - }{%override height of text, height argument given - \@MXV@braiselen=#3% - \@MXV@braiselen=0.5\@MXV@braiselen% - \setlength{\@MXV@height}{#3}% - }% - % - \ifthenelse{\equal{\@MXV@boxdepth}{}}{% no depth option given - \ifthenelse{\lengthtest{\@MXV@totalheight>\@MXV@height}}{% - %depth of text only taken into account, if the total height - %is smaller than the height of the display box - \advance\@MXV@braiselen by -0.5\@MXV@depth% - }{% - \@MXV@depth=0pt% - }% - }{%override depth of text, depth option given - \setlength{\@MXV@@boxdepth}{\@MXV@boxdepth}% - \advance\@MXV@braiselen by -0.5\@MXV@@boxdepth% - \setlength{\@MXV@depth}{\@MXV@boxdepth}% - }% - %finally centre text vertically - \ifthenelse{\NOT\equal{#3}{}\OR\NOT\equal{\@MXV@boxdepth}{}}{% - \advance\@MXV@traiselen by -\@MXV@braiselen% - \@MXV@traiselen=-\@MXV@traiselen% - \savebox{\@MXV@textbox}{\raisebox{\@MXV@traiselen}[0pt][0pt]{% - \usebox{\@MXV@textbox}}}% - }{}% - \ifthenelse{\equal{#2}{}}{}{%override horiz. dimension of text - \setlength{\@MXV@width}{#2}% - %centre text horizontally - \savebox{\@MXV@textbox}{\makebox[\@MXV@width][c]{\usebox{\@MXV@textbox}}}% - }% - % - %find out whether the contents should be hidden or not (for presentations) - \setboolean{@MXV@hide}{false}% -% \ifthenelse{\boolean{@MXV@powerdot}}{% -% \ifthenelse{\boolean{pd@overlay}}{}{% -% \ifthenelse{\pd@method=2}{}{% -% \setboolean{@MXV@hide}{true}% -% }% -% }% -% }{}% - \ifthenelse{\boolean{@MXV@beamer}}{% - \ifthenelse{\boolean{beamer@anotherslide}}{% - \setboolean{@MXV@hide}{true}% - }{}% - }{}% - % - \ifthenelse{\boolean{@MXV@hide}}{% - %insert whitespace instead of annot - \phantom{\vrule width \@MXV@width height \@MXV@height depth \@MXV@depth}% - }{% - \ifthenelse{\NOT\boolean{@MXV@url}\AND\boolean{@MXV@inline}}{% - \IfFileExists{#4}{}{% - \PackageError{movie15}{% - File `#4' cannot be opened for embedding.\MessageBreak - Did you forget to set option `url' or `inline=false'? - }{% - Try any of the options `url' or `inline=false'! - }% - }% - }{}% - % - %guess the mime type based on the filename extension - \filename@parse{#4}% - \ifthenelse{\equal{\@MXV@mime}{@MXV@auto}}{% - \@MXV@guessmime{#4}{\filename@ext}}{}% - \if\filename@ext\relax% - \xdef\@MXV@filename{\filename@base}% - \else% - \xdef\@MXV@filename{\filename@base.\filename@ext}% - \fi% - \expandafter\@MXV@@issound\@MXV@mime:% - % - %if 3D object is not embedded inline we must use some external player :( - \ifthenelse{% - \boolean{@MXV@iiid}% - \AND\NOT\boolean{@MXV@inline}% - }{% - \setboolean{@MXV@externalviewer}{true}% - }{}% - % - %some link attributes (if hyperref not loaded) - \ifthenelse{\isundefined{\@pdfborder}}{% - \def\@MXV@urlattr{}% - \def\@MXV@runattr{}% - }{% - \edef\@MXV@urlattr{% - \if@MXV@beamer% - /Border [1 1 1]% - \else% - /Border [\@pdfborder]% - \fi% - /C [\@urlbordercolor]% - /H \@pdfhighlight% - }% - \edef\@MXV@runattr{% - \if@MXV@beamer% - /Border [1 1 1]% - \else% - /Border [\@pdfborder]% - \fi% - /C [\@runbordercolor]% - /H \@pdfhighlight% - }% - }% - % - \global\advance\@MXV@includes by 1%increment counter - % - %label this annotation for later page number determination - \@MXV@labeltoaux{@MXV@annot\the\@MXV@includes.page}{% - \noexpand\the\@MXV@page}% - % - %label this annotation for later annot id number determination & - %check for multiply-defined labels - % \@MXV@label --> automatic (presentation mode) or user defined label - % \@MXV@@label = \@MXV@label (non presentation doc classes) - % \@MXV@@label = \@MXV@label + physical page No. (presentation mode) - \ifx\@MXV@label\@empty% - %when used with presentation packages, annots must be labelled, - %use the media file name, if no label provided - \ifthenelse{\boolean{@MXV@presentation}}{% - \xdef\@MXV@label{#4}% - }{}% - \fi% - \ifx\@MXV@label\@empty\else% - \ifthenelse{\boolean{@MXV@presentation}}{% - %in presentation mode, the label must be extended by the physical page No. - \xdef\@MXV@@label{\@MXV@label.\@MXV@getlabelvalue{@MXV@annot\the\@MXV@includes.page}}% - }{% - \xdef\@MXV@@label{\@MXV@label}% - }% - \fi% - \ifx\@MXV@@label\@empty\else% - \ifthenelse{% - \NOT\equal{\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}}{undefined}% - \AND% - \NOT\equal{\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}}{% - \the\@MXV@includes}% - }{% - \PackageWarning{movie15}{% - Label `\@MXV@label' multiply defined% - }% - \ifthenelse{\isundefined{\@MXV@multiwarning}}{% - \gdef\@MXV@multiwarning{}% - \AtEndDocument{% - \PackageWarningNoLine{movie15}{% - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak - @@ There were multiply-defined labels! @@\MessageBreak - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}% - }% - }{}% - }{}% - \if@MXV@@draft% - \@MXV@labeltoaux{@MXV@\@MXV@label.draft}{true}% - \else% - \@MXV@labeltoaux{@MXV@\@MXV@label.draft}{false}% - \fi% - \@MXV@labeltoaux{@MXV@\@MXV@@label.annotid}{\the\@MXV@includes}% - \if@MXV@presentation\else% - \@MXV@newlabel{@MXV@\@MXV@@label.annotid}{\the\@MXV@includes}% - \fi% - \fi% - % - \ifthenelse{\boolean{@MXV@@draft}}{}{% - \ifthenelse{\boolean{@MXV@externalviewer}}{% - \ifx\@MXV@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@label.externalviewer}{true}% - \@MXV@newlabel{@MXV@\@MXV@label.externalviewer}{true}% - \fi% - }{% - %what is to be put into movie link annot depends on the following - \ifx\@MXV@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@label.externalviewer}{false}% - \@MXV@newlabel{@MXV@\@MXV@label.externalviewer}{false}% - \fi% - % - %depending on options do content specific stuff - \ifthenelse{\boolean{@MXV@iiid}}{% - % #### 3D #### - \if@MXV@externalviewer\else% - \ifthenelse{\equal{\@MXV@iiidpalindrome}{/Subtype/Oscillating}}{% - \global\multiply\@MXV@iiidrepeat by 2% - }{}% - \ifthenelse{\boolean{@MXV@autoplay}\OR\boolean{@MXV@autoresume}}{% - \def\@MXV@activation{/A/PV/AIS/L}% open 3D object, run animation - }{% - \if@MXV@runposter% - \def\@MXV@activation{/A/PV/AIS/I}%open 3D obj but don't run animation - \else% - \def\@MXV@activation{/A/XA}% explicit activation by user - \fi% - }% - \if@MXV@autostop% - \def\@MXV@deactivation{/D/PI/DIS/I}% - \else% - \if@MXV@autopause% - \def\@MXV@deactivation{/D/PI/DIS/I}% - \else% - \if@MXV@autoclose% - \def\@MXV@deactivation{/D/PI/DIS/U}% - \else%@MXV@continue - \def\@MXV@deactivation{/D/PI/DIS/L}% - \fi% - \fi% - \fi% - %counter for 3D inclusion on current page - \ifthenelse{% - \equal{% - \@MXV@getlabelvalue{@MXV@annot\the\@MXV@includes.page}% - }{\@MXV@oldpage}% - }{% - \global\advance\@MXV@iiidoncurpage by 1% - }{% - \global\@MXV@iiidoncurpage=1% - }% - \xdef\@MXV@oldpage{\@MXV@getlabelvalue{% - @MXV@annot\the\@MXV@includes.page}}% - \fi% - \ifx\@MXV@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@label.3D}{true}% - \@MXV@newlabel{@MXV@\@MXV@label.3D}{true}% - \@MXV@labeltoaux{@MXV@\@MXV@label.3Dlights}{\@MXV@lights}% - \@MXV@newlabel{@MXV@\@MXV@label.3Dlights}{\@MXV@lights}% - \@MXV@labeltoaux{@MXV@\@MXV@label.3Drender}{\@MXV@render}% - \@MXV@newlabel{@MXV@\@MXV@label.3Drender}{\@MXV@render}% - \fi% - \ifx\@MXV@@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@@label.3Doncurpage}{\the\@MXV@iiidoncurpage}% - \@MXV@newlabel{@MXV@\@MXV@@label.3Doncurpage}{\the\@MXV@iiidoncurpage}% - \fi% - }{%#### 2D #### - %get the player ID - \if@MXV@presentation% - \ifthenelse{% - \equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.playerid}}{undefined}% - }{% - \global\advance\@MXV@players by 1%increment counter - }{% - \global\@MXV@players=\@MXV@getlabelvalue{@MXV@\@MXV@label.playerid}% - }% - \@MXV@labeltoaux{@MXV@\@MXV@label.playerid}{\the\@MXV@players}% - \@MXV@newlabel{@MXV@\@MXV@label.playerid}{\the\@MXV@players}% - \edef\@MXV@currplayer{\the\@MXV@players}% - \else% - \ifx\@MXV@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@label.playerid}{\the\@MXV@includes}% - \@MXV@newlabel{@MXV@\@MXV@label.playerid}{\the\@MXV@includes}% - \fi% - \edef\@MXV@currplayer{\the\@MXV@includes}% - \fi% - % - \ifx\@MXV@startat\@empty% default start position - \gdef\@MXV@startat{, startAt: 0}% - \fi% - %write player settings to aux file - \ifx\@MXV@label\@empty\else% - \@MXV@labeltoaux{@MXV@\@MXV@label.mouse}{% - \if@MXV@mouse true\else false\fi}% - \@MXV@labeltoaux{@MXV@\@MXV@label.showUI}{\@MXV@ctrls}% - \@MXV@labeltoaux{@MXV@\@MXV@label.palindrome}{\@MXV@palindrome}% - \@MXV@labeltoaux{@MXV@\@MXV@label.repeat}{\@MXV@repeat}% - \@MXV@labeltoaux{@MXV@\@MXV@label.rate}{\@MXV@rate}% - \@MXV@labeltoaux{@MXV@\@MXV@label.startAt}{\@MXV@startat}% - \@MXV@labeltoaux{@MXV@\@MXV@label.endAt}{\@MXV@endat}% - \@MXV@labeltoaux{@MXV@\@MXV@label.volume}{\@MXV@volume}% - \@MXV@labeltoaux{@MXV@\@MXV@label.autoplay}{% - \if@MXV@autoplay true\else false\fi}% - \@MXV@labeltoaux{@MXV@\@MXV@label.3D}{false}% - \@MXV@labeltoaux{@MXV@\@MXV@label.issound}{% - \if@MXV@issound true\else false\fi}% - % - \@MXV@newlabel{@MXV@\@MXV@label.mouse}{% - \if@MXV@mouse true\else false\fi}% - \@MXV@newlabel{@MXV@\@MXV@label.showUI}{\@MXV@ctrls}% - \@MXV@newlabel{@MXV@\@MXV@label.palindrome}{\@MXV@palindrome}% - \@MXV@newlabel{@MXV@\@MXV@label.repeat}{\@MXV@repeat}% - \@MXV@newlabel{@MXV@\@MXV@label.rate}{\@MXV@rate}% - \@MXV@newlabel{@MXV@\@MXV@label.startAt}{\@MXV@startat}% - \@MXV@newlabel{@MXV@\@MXV@label.endAt}{\@MXV@endat}% - \@MXV@newlabel{@MXV@\@MXV@label.volume}{\@MXV@volume}% - \@MXV@newlabel{@MXV@\@MXV@label.autoplay}{% - \if@MXV@autoplay true\else false\fi}% - \@MXV@newlabel{@MXV@\@MXV@label.3D}{false}% - \@MXV@newlabel{@MXV@\@MXV@label.issound}{% - \if@MXV@issound true\else false\fi}% - % - \fi% - % - \ifthenelse{\boolean{@MXV@autoplay}\OR\boolean{@MXV@runposter}}{% - \xdef\@MXV@pageopenopentry{/OP 4}% - }{% - \if@MXV@autoresume% - \xdef\@MXV@pageopenopentry{/OP 3}% - \else% - \xdef\@MXV@pageopenopentry{/OP 2}% - \fi% - }% - % - \if@MXV@autostop% - \xdef\@MXV@pagecloseopentry{/OP 1}% - \else% - \if@MXV@autopause% - \xdef\@MXV@pagecloseopentry{/OP 2}% - \else% - \if@MXV@autoclose% - \xdef\@MXV@pagecloseopentry{/OP 1}% - \else% @MXV@continue - \xdef\@MXV@pagecloseopentry{/OP 3}% - \fi% - \fi% - \fi% - % - %JavaScripts for playback control - %script for page invisible event - \if@MXV@autopause% - \xdef\@MXV@pageclosejsentry{% - /JS ( - try{% - if(player\@MXV@currplayer.isPlaying){% - player\@MXV@currplayer.pause(); - player\@MXV@currplayer.settings.privateData.paused=true; - } - focusonplayer=-1; %page change - player\@MXV@currplayer.visible=false; - } - catch(e){} - )% - }% - \else% - \if@MXV@autostop% - \xdef\@MXV@pageclosejsentry{% - /JS ( - try{% - player\@MXV@currplayer.settings.privateData.paused=false; - %players tend to be bugged, always stop from playing state - if(!player\@MXV@currplayer.isPlaying){ - player\@MXV@currplayer.play(); - } - player\@MXV@currplayer.stop(); - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id == - 'vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek(% - player\@MXV@currplayer.settings.startAt); - } - focusonplayer=-1; - player\@MXV@currplayer.visible=false; - } - catch(e){} - )% - }% - \else% - \if@MXV@autoclose% - \xdef\@MXV@pageclosejsentry{% - /JS ( - try{% - player\@MXV@currplayer.close(app.media.closeReason.general); - focusonplayer=-1; %page change - player\@MXV@currplayer.visible=false; - } - catch(e){} - )% - }% - \else% - \xdef\@MXV@pageclosejsentry{%@MXV@continue - /JS ( - try{% - focusonplayer=-1; %page change - player\@MXV@currplayer.visible=false; - } - catch(e){} - )% - }% - \fi% - \fi% - \fi% - % - %script for activation/resume on page open event - \xdef\@MXV@pageopenjsentry{% - /JS ( - try{% - if(player\@MXV@currplayer.isOpen){% - %drag the player on the current slide (presentation mode) - player\@MXV@currplayer.page=this.pageNum; - %... and make it visible - \if@MXV@issound\else player\@MXV@currplayer.visible=true;\fi% - % - %start or resume media which have autoplay option set; - %also resume paused media which have autoresume option set - \if@MXV@autoplay% - player\@MXV@currplayer.settings.privateData.paused=false; - player\@MXV@currplayer.play(); - if(!player\@MXV@currplayer.isPlaying){% still not playing?! - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id=='vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek( - player\@MXV@currplayer.settings.startAt); - }else{ - player\@MXV@currplayer.stop(); - } - player\@MXV@currplayer.play(); - } - \else% - \if@MXV@autoresume% - if(player\@MXV@currplayer.settings.privateData.paused){% - player\@MXV@currplayer.settings.privateData.paused=false; - player\@MXV@currplayer.play(); - if(!player\@MXV@currplayer.isPlaying){% - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id == - 'vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek(% - player\@MXV@currplayer.settings.startAt); - }else{ - player\@MXV@currplayer.stop();% - } - player\@MXV@currplayer.play(); - } - } - \fi% - \fi% - } - else{% - throw 'isClosed'; - } - } - catch(e){% - \@MXV@if{\if@MXV@autoplay true\else\if@MXV@runposter true\else % - false\fi\fi}% - if(focusonplayer==undefined){% - var focusonplayer=0; %shared by all annots - } - \@MXV@settings{\@MXV@ctrls}{\@MXV@palindrome}{\@MXV@repeat}% - {\@MXV@rate}{\@MXV@startat}{\@MXV@endat}{\@MXV@volume}% - \@MXV@events{\@MXV@currplayer}% - {\if@MXV@mouse true\else false\fi}% - {\if@MXV@autoplay true\else false\fi}% - var player\@MXV@currplayer=app.media.openPlayer({% - settings: settings, - events: events - }); - \fi% - }% - ) - }% - % - %script for normal activation by mouse click - \xdef\@MXV@activationjsentry{% - /JS ( - app.focusRect=true;% - if(focusonplayer==undefined){% - var focusonplayer=0; %shared by all annots - } - \@MXV@settings{\@MXV@ctrls}{\@MXV@palindrome}{\@MXV@repeat}% - {\@MXV@rate}{\@MXV@startat}{\@MXV@endat}{\@MXV@volume}% - \@MXV@events{\@MXV@currplayer}{\if@MXV@mouse true\else false\fi}% - {true}% - var player\@MXV@currplayer=app.media.openPlayer({% - settings: settings, - events: events - }); - ) - }% - }% - }% - }% draft? - % - %insert link target, if media has been labelled - \ifthenelse{\NOT\equal{\@MXV@@label}{}}{% - \raisebox{\@MXV@height}{% - \ifpdf% - \pdfdest name {@MXV@\@MXV@@label} xyz % - \else% - \hypertarget{@MXV@\@MXV@@label}{}% - \fi% - }% - }{}% - % - \ifthenelse{\boolean{@MXV@@draft}}{% - \makebox[0pt][l]{\usebox{\@MXV@textbox}}% - \@MXV@draftbox{\@MXV@width}{\@MXV@height}{\@MXV@depth}{#4}% - }{% - %insert textbox, obscured by poster - \ifthenelse{\boolean{@MXV@boxopt}\AND\NOT\boolean{@MXV@textoverposter}}{% - \makebox[0pt][l]{\usebox{\@MXV@textbox}}% - }{}% - % - %insert annotation - \ifthenelse{\boolean{@MXV@iiid}}{% - \edef\@MXV@iiidopt{[\@MXV@iiidopt]}% - \expandafter\@MXV@includeiiid\@MXV@iiidopt{\@MXV@width}{\@MXV@height}{\@MXV@depth}{#4}% - }{% - \@MXV@includemovie{\@MXV@width}{\@MXV@height}{\@MXV@depth}{#4}% - }% - % - %insert textbox, overprinting the poster - \ifthenelse{\boolean{@MXV@boxopt}\AND\boolean{@MXV@textoverposter}}{% - \makebox[0pt][r]{\usebox{\@MXV@textbox}}% - }{}% - }% - }% -} - -%for remote control of media -\newcommand\movieref[3][]{% - \ifpdf\else% - \ifthenelse{\isundefined{\pdfmark}\AND\isundefined{\@pdfm@mark}}{\@MXV@missing{hyperref}}{}% - \fi% - \leavevmode% - % save text argument - \savebox{\@MXV@textbox}{\ifHy@colorlinks\color{\@linkcolor}\fi#3}% - % - %find out whether the contents should be hidden or not (for presentations) - \setboolean{@MXV@hide}{false}% -% \ifthenelse{\boolean{@MXV@powerdot}}{% -% \ifthenelse{\boolean{pd@overlay}}{}{% -% \ifthenelse{\pd@method=2}{}{% -% \setboolean{@MXV@hide}{true}% -% }% -% }% -% }{}% - \ifthenelse{\boolean{@MXV@beamer}}{% - \ifthenelse{\boolean{beamer@anotherslide}}{% - \setboolean{@MXV@hide}{true}% - }{}% - }{}% - % - \ifthenelse{\boolean{@MXV@hide}}{% - %put whitespace instead of link annot - \phantom{\usebox{\@MXV@textbox}}% - }{% - \@MXV@reset% - % - \xdef\@MXV@label{#2}% - % - \global\advance\@MXV@links by 1%increment link counter - % - %label this link for later page number determination - \@MXV@labeltoaux{@MXV@link\the\@MXV@links.page}{\noexpand\the\@MXV@page}% - % - \ifthenelse{\boolean{@MXV@presentation}}{% - %in presentation mode the label must be extended by the physical page No. - \xdef\@MXV@@label{\@MXV@label.\@MXV@getlabelvalue{@MXV@link\the\@MXV@links.page}}% - }{% - \xdef\@MXV@@label{\@MXV@label}% - }% - % - %check if label is defined at all - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}}{undefined}}{% - \usebox{\@MXV@textbox}% write out text box - \PackageWarning{movie15}{% - Reference `\@MXV@label' on page \thepage \space undefined% - }% - \ifthenelse{\isundefined{\@MXV@undefwarning}}{% - \gdef\@MXV@undefwarning{}% - \AtEndDocument{% - \PackageWarningNoLine{movie15}{% - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak% - @@ There were undefined references! @@\MessageBreak% - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}% - }% - }{}% - }{% - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.draft}}{true}}{% - \setboolean{@MXV@@draft}{true}% if the screen annotation is in draft mode - }{}% - \if@MXV@@draft\else% - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.externalviewer}}{true}}{% - \setboolean{@MXV@externalviewer}{true}% - }{% - \setboolean{@MXV@externalviewer}{false}% - }% - \if@MXV@externalviewer\else% - %movieref used in 3D context? - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.3D}}{true}}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiid}{true}% - }{% - \@MXV@neediiiD% - }% - }{}% - % - %actions completely different in 3D & 2D context - \ifthenelse{\boolean{@MXV@iiid}}{% #### 3D #### - %retrieve default lighting scheme - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.3Dlights}}{undefined}}{% - \edef\@MXV@lights{}% - }{% - \edef\@MXV@lights{\@MXV@getlabelvalue{@MXV@\@MXV@label.3Dlights}}% - }% - %retrieve default render mode - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.3Drender}}{undefined}}{% - \edef\@MXV@render{}% - }{% - \edef\@MXV@render{\@MXV@getlabelvalue{@MXV@\@MXV@label.3Drender}}% - }% - \setkeys{MXV@user}{#1}% - \if@MXV@defaultviewprovided% define a new view, - %using any of the coo, c2c, roo, caa options - \xdef\@MXV@xname{}% - \edef\@MXV@args{\@MXV@coo\space\@MXV@ctoc\space\@MXV@roo\space\@MXV@roll\space}% - \expandafter\@MXV@ciiwmatrix\@MXV@args% build C2W matrix - \@MXV@viewobj% create pdf object of 3D view - \edef\@MXV@iiidview{\@MXV@@viewobj}% - %else use the indexed view specified by option `3Dviewindex' - \fi% - % - %create JavaScript (options 3Djscript, 3Dcalculate, 3Dgetview) - \ifthenelse{\NOT\equal{\@MXV@jscriptiiidfile}{}% - \OR\NOT\equal{\@MXV@calc}{}% - \OR\boolean{@MXV@iiidgetview}% - }{% - \edef\@MXV@linkjscriptiiid{% - try{% - %fill hash (annot3D) with refs to Annot3D objects - annot3D['\@MXV@label']=getAnnots3D(% - \@MXV@getlabelvalue{% - @MXV@annot\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}.page% - }-1% - )[\@MXV@getlabelvalue{@MXV@\@MXV@@label.3Doncurpage}-1];% - annot3D['\@MXV@label'].activated=true;% - }catch(e){% - try{% - annot3D=new Array;% - annot3D['\@MXV@label']=getAnnots3D(% - \@MXV@getlabelvalue{% - @MXV@annot\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}.page% - }-1% - )[\@MXV@getlabelvalue{@MXV@\@MXV@@label.3Doncurpage}-1];% - annot3D['\@MXV@label'].activated=true;% - }catch(e){% - var spc=String.fromCharCode(32);% - app.alert('3D' + spc + 'annotation' + spc + 'could' + spc +% - 'not' + spc + 'be' + spc + 'activated!');% - }% - }% - }% - \if@MXV@iiidgetview% - \edef\@MXV@linkjscriptiiid{% - \@MXV@linkjscriptiiid - try{ - %JavaScript to print the camera settings of the current view - var camera=annot3D['\@MXV@label'].context3D.scene.cameras.getByIndex(0);% - var coo=camera.targetPosition;% - var c2c=camera.position.subtract(coo);% - var roo=c2c.length;% - c2c.normalize();% - % - %assemble result string - %{<coo_x> <coo_y> <coo_z>}{<c2c_x> <c2c_y> <c2c_z>}{<roo>}{<aac>} - var spc=String.fromCharCode(32);% - var res='{';% - var x = (Math.abs(coo.x) < 1e-18 ? 0 : coo.x);% - var y = (Math.abs(coo.y) < 1e-18 ? 0 : coo.y);% - var z = (Math.abs(coo.z) < 1e-18 ? 0 : coo.z);% - if(Math.sqrt(x*x + y*y + z*z) > 0){% - res+=util.printf('\%s' + spc + '\%s' + spc + '\%s',% - (Math.abs(x) < 1.001e-6 && Math.abs(x) > 0 ?% - util.printf('\%.18f', x): x),% - (Math.abs(y) < 1.001e-6 && Math.abs(y) > 0 ?% - util.printf('\%.18f', y): y),% - (Math.abs(z) < 1.001e-6 && Math.abs(z) > 0 ?% - util.printf('\%.18f', z): z)% - );% - }% - res+='}{';% - x = (Math.abs(c2c.x) < 1e-18 ? 0 : c2c.x);% - y = (Math.abs(c2c.y) < 1e-18 ? 0 : c2c.y);% - z = (Math.abs(c2c.z) < 1e-18 ? 0 : c2c.z);% - if(!(x==0 && y==-1 && z==0)){% - res+=util.printf('\%s' + spc + '\%s' + spc + '\%s',% - (Math.abs(x) < 1.001e-6 && Math.abs(x) > 0 ?% - util.printf('\%.18f', x): x),% - (Math.abs(y) < 1.001e-6 && Math.abs(y) > 0 ?% - util.printf('\%.18f', y): y),% - (Math.abs(z) < 1.001e-6 && Math.abs(z) > 0 ?% - util.printf('\%.18f', z): z)% - );% - }% - res+='}{';% - if(roo > 0.11e-17){% - res+=util.printf('\%s',% - (roo < 1.001e-6 ? util.printf('\%.18f', roo): roo)% - );% - }% - res+='}{';% - %determine the camera roll (camera.roll is bugged) - %camera up-vector from camera.up, the latter being the positional vector - %of the actual camera up-vector tip - var up = camera.up.subtract(camera.position);% - up.normalize();% - %find the camera up-vector up0, that corresponds to zero roll - %(Gram-Schmitt orthogonalisation) - var worldup=new annot3D['\@MXV@label'].context3D.Vector3();% - worldup.set(0,0,1);% - var out=c2c.scale(-1);% - var up0=worldup.subtract(out.scale(out.dot(worldup)));% - up0.normalize();% - var up0xup=up0.cross(up);% - var roll=0;% - if(up0xup.length>0){% - up0xup.normalize();% - var up0dotup=up.dot(up0);% - up0dotup=(Math.abs(up0dotup) > 1 ? Math.round(up0dotup) : up0dotup);% - %compute the angle between camera up and up0 vectors - roll=Math.acos(up0dotup)*180/Math.PI*out.dot(up0xup);% - }% - if(util.printf('\%.5f', roll)!=0){% - res+=util.printf('\%s', roll);% - }% - res+='}{';% - aac=camera.fov * 180/Math.PI;% - if(util.printf('\%.5f', aac)!=30){% - res+=util.printf('\%s',% - (Math.abs(aac) < 1.001e-6 ? util.printf('\%.18f', aac): aac)% - );% - }% - res+='}';% - %open pop-up displaying the result string - var settings={% - initialize: function(dialog) {% - dialog.load({% - 'text': res% - });% - },% - description: {% - name: 'Current' + spc + '3D' + spc + 'Camera' + spc + 'Settings',% - elements: [% - {% - type: 'static_text',% - name: 'Add' + spc + 'the' + spc + 'following' + spc + 'line' + spc +% - 'to' + spc + 'a' + spc + 'file' + spc + 'of' + spc +% - 'predefined' + spc + 'views.' + spc +% - '(See' + spc + 'option' + spc + '3Dviews!)'% - },% - {% - type: 'edit_text',% - item_id: 'text',% - alignment: 'align_fill',% - readonly: false% - },% - {% - type: 'ok',% - ok_name: 'Close'% - }% - ]% - }% - };% - app.execDialog(settings);% - }catch(e){% - var spc=String.fromCharCode(32);% - app.alert('Error' + spc + 'while' + spc + 'executing' + spc +% - '3Dgetview:' + spc + e);% - }% - }% - \fi% - \ifx\@MXV@calc\@empty\else% - \edef\@MXV@linkjscriptiiid{% - \@MXV@linkjscriptiiid - try{ -% console.show(); -% console.clear(); - %constructor for doubly linked list - function List(){% - this.first_node=null;% - this.last_node=new Node(undefined);% - }% - List.prototype.push_back=function(x){% - var new_node=new Node(x);% - if(this.first_node==null){% - this.first_node=new_node;% - new_node.prev=null;% - }else{% - new_node.prev=this.last_node.prev;% - new_node.prev.next=new_node;% - }% - new_node.next=this.last_node;% - this.last_node.prev=new_node;% - };% - List.prototype.move_to_front=function(it){% - var node=it.get();% - if(node.next!=null && node.prev!=null){% - node.next.prev=node.prev;% - node.prev.next=node.next;% - node.prev=null;% - node.next=this.first_node;% - this.first_node.prev=node;% - this.first_node=node;% - }% - };% - List.prototype.begin=function(){% - var i=new Iterator();% - i.target=this.first_node;% - return(i);% - };% - List.prototype.end=function(){% - var i=new Iterator();% - i.target=this.last_node;% - return(i);% - };% - function Iterator(it){% - if( it!=undefined ){% - this.target=it.target;% - }else {% - this.target=null;% - }% - }% - Iterator.prototype.set=function(it){this.target=it.target;};% - Iterator.prototype.get=function(){return(this.target);};% - Iterator.prototype.deref=function(){return(this.target.data);};% - Iterator.prototype.incr=function(){% - if(this.target.next!=null){this.target=this.target.next;}% - };% - %constructor for node objects that populate the linked list - function Node(x){% - this.prev=null;% - this.next=null;% - this.data=x;% - }% - function sqr(r){return(r*r);}%helper function - %The following code borrows heavily from Bernd Gaertners `Miniball' software, - %originally written in C++, for computing the smallest enclosing ball of a - %set of points; see: http://www.inf.ethz.ch/personal/gaertner/miniball.html - function Basis(){% - this.m=0;% - this.q0=new Array(3);% - this.z=new Array(4);% - this.f=new Array(4);% - this.v=new Array(new Array(3), new Array(3), new Array(3), new Array(3));% - this.a=new Array(new Array(3), new Array(3), new Array(3), new Array(3));% - this.c=new Array(new Array(3), new Array(3), new Array(3), new Array(3));% - this.sqr_r=new Array(4);% - this.current_c=this.c[0];% - this.current_sqr_r=0;% - this.reset();% - }% - Basis.prototype.center=function(){return(this.current_c);};% - Basis.prototype.size=function(){return(this.m);};% - Basis.prototype.pop=function(){--this.m;};% - Basis.prototype.excess=function(p){% - var e=-this.current_sqr_r;% - for(var k=0;k<3;++k){% - e+=sqr(p[k]-this.current_c[k]);% - }% - return(e);% - };% - Basis.prototype.reset=function(){% - this.m=0;% - for(var j=0;j<3;++j){% - this.c[0][j]=0;% - }% - this.current_c=this.c[0];% - this.current_sqr_r=-1;% - };% - Basis.prototype.push=function(p){% - var i, j;% - var eps=1e-32;% - if(this.m==0){% - for(i=0;i<3;++i){% - this.q0[i]=p[i];% - }% - for(i=0;i<3;++i){% - this.c[0][i]=this.q0[i];% - }% - this.sqr_r[0]=0;% - }else {% - for(i=0;i<3;++i){% - this.v[this.m][i]=p[i]-this.q0[i];% - }% - for(i=1;i<this.m;++i){% - this.a[this.m][i]=0;% - for(j=0;j<3;++j){% - this.a[this.m][i]+=this.v[i][j]*this.v[this.m][j];% - }% - this.a[this.m][i]*=(2/this.z[i]);% - }% - for(i=1;i<this.m;++i){% - for(j=0;j<3;++j){% - this.v[this.m][j]-=this.a[this.m][i]*this.v[i][j];% - }% - }% - this.z[this.m]=0;% - for(j=0;j<3;++j){% - this.z[this.m]+=sqr(this.v[this.m][j]);% - }% - this.z[this.m]*=2;% - if(this.z[this.m]<eps*this.current_sqr_r){% - return(false);% - }% - var e=-this.sqr_r[this.m-1];% - for(i=0;i<3;++i){% - e+=sqr(p[i]-this.c[this.m-1][i]);% - }% - this.f[this.m]=e/this.z[this.m];% - for(i=0;i<3;++i){% - this.c[this.m][i]=this.c[this.m-1][i]+this.f[this.m]*this.v[this.m][i];% - }% - this.sqr_r[this.m]=this.sqr_r[this.m-1]+e*this.f[this.m]/2;% - }% - this.current_c=this.c[this.m];% - this.current_sqr_r=this.sqr_r[this.m];% - ++this.m;% - return(true);% - };% - function Miniball(){% - this.L=new List();% - this.B=new Basis();% - this.support_end=new Iterator();% - }% - Miniball.prototype.mtf_mb=function(it){% - var i=new Iterator(it);% - this.support_end.set(this.L.begin());% - if((this.B.size())==4){return;}% - for(var k=new Iterator(this.L.begin());k.get()!=i.get();){% - var j=new Iterator(k);% - k.incr();% - if(this.B.excess(j.deref()) > 0){% - if(this.B.push(j.deref())){% - this.mtf_mb(j);% - this.B.pop();% - if(this.support_end.get()==j.get()){% - this.support_end.incr();% - }% - this.L.move_to_front(j);% - }% - }% - }% - };% - Miniball.prototype.check_in=function(b){% - this.L.push_back(b);% - };% - Miniball.prototype.build=function(){% - this.B.reset();% - this.support_end.set(this.L.begin());% - this.mtf_mb(this.L.end());% - };% - Miniball.prototype.center=function(){% - return(this.B.center());% - };% - Miniball.prototype.radius=function(){% - return(Math.sqrt(this.B.current_sqr_r));% - };% - %create Miniball object - var mb=new Miniball();% - %aperture angle of the virtual camera - var aac=\@MXV@calc;% - %list of mesh nodes - var meshes=annot3D['\@MXV@label'].context3D.scene.meshes;% - %auxiliary vectors - var dir=new annot3D['\@MXV@label'].context3D.Vector3();% - var up=new annot3D['\@MXV@label'].context3D.Vector3();% - var corner=new annot3D['\@MXV@label'].context3D.Vector3();% - %auxiliary 4x4 matrix - var bbox4x4=new annot3D['\@MXV@label'].context3D.Matrix4x4();% - %iterate over all mesh nodes in the scene - for(i=0;i<meshes.count;i++){% - var mesh=meshes.getByIndex(i);% - %get the bbox of the mesh (local coordinates) - var bbox=mesh.computeBoundingBox();% - %local to parent transformation matrix - var trans=mesh.transform.transpose;% - %build local to world transformation matrix by recursively - %multiplying the parent's transf. matrix on the left - var parent=mesh.parent;% - while(parent.transform){% - trans=parent.transform.transpose.multiply(trans);% - parent=parent.parent;% - }% - %transform the local bounding box corner coordinates to - %world coordinates for bounding sphere determination; - %Matrix4x4 method transformDirection(<Vector3>) seems - %to be bugged, therefore we must resort to the - %multiply(<Matrix4x4>) method using an auxiliary matrix - %which contains the local bounding box corner coordinates - % - %auxiliary matrix from bbox.min coordinates - bbox4x4.setView(bbox.min, dir, up);% - %transform to world coordinates - bbox4x4=trans.multiply(bbox4x4.transpose);% - %extract the transformed coordinates - corner.set(bbox4x4.transpose.translation);% - %check-in corner position into Miniball - mb.check_in(new Array(corner.x, corner.y, corner.z));% - %the same procedure with bbox.max - bbox4x4.setView(bbox.max, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - %and with all remaining 6 bbox corners - corner.set(bbox.min.x, bbox.max.y, bbox.max.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - corner.set(bbox.min.x, bbox.min.y, bbox.max.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - corner.set(bbox.min.x, bbox.max.y, bbox.min.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - corner.set(bbox.max.x, bbox.min.y, bbox.min.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - corner.set(bbox.max.x, bbox.min.y, bbox.max.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - corner.set(bbox.max.x, bbox.max.y, bbox.min.z);% - bbox4x4.setView(corner, dir, up);% - bbox4x4=trans.multiply(bbox4x4.transpose);% - corner.set(bbox4x4.transpose.translation);% - mb.check_in(new Array(corner.x, corner.y, corner.z));% - }% - %compute the smallest enclosing bounding sphere - mb.build();% - %bounding sphere centre - var coo=new annot3D['\@MXV@label'].context3D.Vector3();% - coo.set((mb.center())[0], (mb.center())[1], (mb.center())[2]);% - %radius of orbit - var roo=mb.radius()/ Math.sin(aac * Math.PI/ 360.);% - %result string - var res='';% - var spc=String.fromCharCode(32);% - if(aac!=30){% - res+=util.printf('3Daac=\%s,' + spc,% - (Math.abs(aac) < 1.001e-6 && Math.abs(aac) > 0 ?% - util.printf('\%.18f', aac): aac)% - );% - }% - if(coo.length){% - res+=util.printf( '3Dcoo=\%s' + spc + '\%s' + spc + '\%s,'% - + spc,% - (Math.abs(coo.x) < 1.001e-6 && Math.abs(coo.x) > 0 ?% - util.printf('\%.18f', coo.x): coo.x),% - (Math.abs(coo.y) < 1.001e-6 && Math.abs(coo.y) > 0 ?% - util.printf('\%.18f', coo.y): coo.y),% - (Math.abs(coo.z) < 1.001e-6 && Math.abs(coo.z) > 0 ?% - util.printf('\%.18f', coo.z): coo.z)% - );% - }% - res+=util.printf(% - '3Droo=\%s,' + spc, (roo < 1.001e-6 ? util.printf('\%.18f', roo): roo) - );% - var settings={% - initialize: function(dialog){% - dialog.load({% - 'text': res% - });% - },% - description: {% - name: '3D' + spc + 'Camera' + spc + 'Settings',% - elements: [% - {% - type: 'static_text',% - name: 'Copy' + spc + 'and' + spc + 'paste' + spc +% - 'the' + spc + 'following' + spc + 'to' + spc +% - 'the' + spc + 'option' + spc + 'list' + spc +% - 'of' + spc + spc + '\string\\\string\\includemovie!'% - },% - {% - type: 'edit_text',% - item_id: 'text',% - alignment: 'align_fill',% - readonly: false% - },% - {% - type: 'ok',% - ok_name: 'Close'% - }% - ]% - }% - };% - app.execDialog(settings);% - }catch(e){% - var spc=String.fromCharCode(32);% - app.alert('Error' + spc + 'while' + spc + 'executing' + spc +% - '3Dcalculate:' + spc + e);% - }% - }% - \fi% - %create stream from user provided JavaScript file - \ifx\@MXV@jscriptiiidfile\@empty\else% - \ifthenelse{% create only once - \equal{\@MXV@getlabelvalue{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}}{undefined}% - }{% - \ifpdf% - \pdfobj stream file {\@MXV@jscriptiiidfile}% - \pdfrefobj\pdflastobj% - \edef\@MXV@userjscriptiiidstream{\the\pdflastobj\space 0 R}% - \@MXV@newlabel{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}{\the\pdflastobj}% - \else\if@MXV@dvipdfmx - \special{pdf:fstream @linkuserjscriptiiid\the\@MXV@links\space(\@MXV@jscriptiiidfile)}% - \edef\@MXV@userjscriptiiidstream{@linkuserjscriptiid\the\@MXV@links}% - \@MXV@newlabel{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}{@linkuserjscriptiid\the\@MXV@links}% - \else% - \pdfmark{% - pdfmark=/OBJ,% - Raw={% - /_objdef {linkuserjscriptiiid\the\@MXV@links}% - /type/stream% - }% - }% - \pdfmark{% - pdfmark=/PUT,% - Raw={% - {linkuserjscriptiiid\the\@MXV@links}% - (\@MXV@jscriptiiidfile) (r) file% - }% - }% - \edef\@MXV@userjscriptiiidstream{% - {linkuserjscriptiiid\the\@MXV@links}% - }% - \@MXV@newlabel{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}% - {linkuserjscriptiiid\the\@MXV@links}% - \fi\fi% - }{% - \ifpdf% - \edef\@MXV@userjscriptiiidstream{% - \@MXV@getlabelvalue{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}\space 0 R% - }% - \else% - \edef\@MXV@userjscriptiiidstream{% - {\@MXV@getlabelvalue{\pdfmdfivesum file {\@MXV@jscriptiiidfile}}}% - }% - \fi% - }% - \fi% - \edef\@MXV@jscriptiiidaction{% - /Next <<% - /S/JavaScript% - /JS (\@MXV@linkjscriptiiid)% - \ifx\@MXV@jscriptiiidfile\@empty\else% - /Next <<% - /S/JavaScript% - /JS \@MXV@userjscriptiiidstream% user provided script - >>% - \fi% - >>% - }% - }{\edef\@MXV@jscriptiiidaction{}}% - }{% #### 2D #### - \setkeys{MXV@user}{#1}% - %retrieve original settings - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.mouse}}{true}}{% - \setboolean{@MXV@mouse}{true}% - }{% - \setboolean{@MXV@mouse}{false}% - }% - \edef\@MXV@ctrls{\@MXV@getlabelvalue{@MXV@\@MXV@label.showUI}}% - \edef\@MXV@palindrome{\@MXV@getlabelvalue{@MXV@\@MXV@label.palindrome}}% - \edef\@MXV@repeat{\@MXV@getlabelvalue{@MXV@\@MXV@label.repeat}}% - \edef\@MXV@rate{\@MXV@getlabelvalue{@MXV@\@MXV@label.rate}}% - \edef\@MXV@startat{\@MXV@getlabelvalue{@MXV@\@MXV@label.startAt}}% - \edef\@MXV@endat{\@MXV@getlabelvalue{@MXV@\@MXV@label.endAt}}% - \edef\@MXV@volume{\@MXV@getlabelvalue{@MXV@\@MXV@label.volume}}% - \if@MXV@linkreset\else% - \setkeys{MXV@user}{#1}%override with new settings - \fi% - % - \edef\@MXV@operation{}% - % - %get the player ID - \edef\@MXV@currplayer{\@MXV@getlabelvalue{@MXV@\@MXV@label.playerid}}% - % - %see whether a sound inclusion is being referenced - \ifthenelse{\equal{\@MXV@getlabelvalue{@MXV@\@MXV@label.issound}}{true}}{% - \setboolean{@MXV@issound}{true}% - }{% - \setboolean{@MXV@issound}{false}% - }% - % - %create /OP and /JS entries - \if@MXV@linkplay% - \edef\@MXV@operation{% - /OP 0% - /JS (% - if(focusonplayer==undefined){% - var focusonplayer=0; %shared by all annots - }% - \@MXV@settings{\@MXV@ctrls}{\@MXV@palindrome}{\@MXV@repeat}% - {\@MXV@rate}{\@MXV@startat}{\@MXV@endat}{\@MXV@volume}% - \@MXV@events{\@MXV@currplayer}% - {\if@MXV@mouse true\else false\fi}% - {true}% - \if@MXV@requirereopen\else - try{% - \ifx\@MXV@@startat\@empty - player\@MXV@currplayer.seek(% - player\@MXV@currplayer.settings.startAt% - ); - \else - player\@MXV@currplayer.seek(\@MXV@@startat); - \fi - player\@MXV@currplayer.play(); - \ifx\@MXV@@startat\@empty - player\@MXV@currplayer.seek(% - player\@MXV@currplayer.settings.startAt% - ); - \else - player\@MXV@currplayer.seek(\@MXV@@startat); - \fi - }% - catch(e)\@charlb% - \fi% - try{% - if(player\@MXV@currplayer.isOpen){% - player\@MXV@currplayer.close(% - app.media.closeReason.general); - player\@MXV@currplayer=null; - }% - }% - catch(e){}% - % - try{% - var player\@MXV@currplayer=app.media.openPlayer({% - settings: settings,% - events: events% - });% - }% - catch (e){}% - \if@MXV@requirereopen\else - \@charrb% - \fi% - )% - }% - \fi% - \if@MXV@linkresume% resume/pause - \edef\@MXV@operation{% - /OP 3% - /JS (% - try{% - \if@MXV@issound\else player\@MXV@currplayer.visible=true;\fi% - if(!player\@MXV@currplayer.isPlaying){% - player\@MXV@currplayer.settings.privateData.paused=false; - player\@MXV@currplayer.play(); - if(!player\@MXV@currplayer.isPlaying){% - %media at end will restart from beginning - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id == - 'vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek( - player\@MXV@currplayer.settings.startAt); - }else{ - player\@MXV@currplayer.stop(); - } - player\@MXV@currplayer.play(); - }% - }% - else{% - player\@MXV@currplayer.pause(); - player\@MXV@currplayer.settings.privateData.paused=true; - }% - }% - catch(e){% open new player if not yet open - if(focusonplayer==undefined){% - var focusonplayer=0; %shared by all annots - }% - \@MXV@settings{\@MXV@ctrls}{\@MXV@palindrome}{\@MXV@repeat}% - {\@MXV@rate}{\@MXV@startat}{\@MXV@endat}{\@MXV@volume}% - \@MXV@events{\@MXV@currplayer}% - {\if@MXV@mouse true\else false\fi}% - {true}% - try{% - var player\@MXV@currplayer=app.media.openPlayer({% - settings: settings,% - events: events% - }); - }% - catch (e){}% - }% - )% - }% - \fi% - \if@MXV@linkstop% - \edef\@MXV@operation{% - /OP 1% - /JS (% - try{% - if(!player\@MXV@currplayer.isPlaying){% - player\@MXV@currplayer.settings.privateData.paused=false; - player\@MXV@currplayer.play(); - }% - player\@MXV@currplayer.stop(); - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id == - 'vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek(% - player\@MXV@currplayer.settings.startAt); - } - }% - catch(e){}% - )% - }% - \fi% - \if@MXV@linkpause% pause/resume - \edef\@MXV@operation{% - /OP 2% - /JS (% - try{% - \if@MXV@issound\else player\@MXV@currplayer.visible=true;\fi% - if(!player\@MXV@currplayer.isPlaying){% - player\@MXV@currplayer.settings.privateData.paused=false; - player\@MXV@currplayer.play(); - if(!player\@MXV@currplayer.isPlaying){% - %media at end will restart from beginning - if( - player\@MXV@currplayer.settings.startAt.time - || player\@MXV@currplayer.settings.startAt.frame - || player\@MXV@currplayer.settings.startAt.marker - || player\@MXV@currplayer.id == - 'vnd.adobe.swname:AAPL_QuickTime' - ){ - player\@MXV@currplayer.seek( - player\@MXV@currplayer.settings.startAt); - }else{ - player\@MXV@currplayer.stop(); - } - player\@MXV@currplayer.play(); - }% - }% - else{% - player\@MXV@currplayer.pause(); - player\@MXV@currplayer.settings.privateData.paused=true; - }% - }% - catch(e){% open new player if not yet open - if(focusonplayer==undefined){% - var focusonplayer=0; %shared by all annots - }% - \@MXV@settings{\@MXV@ctrls}{\@MXV@palindrome}{\@MXV@repeat}% - {\@MXV@rate}{\@MXV@startat}{\@MXV@endat}{\@MXV@volume}% - \@MXV@events{\@MXV@currplayer}% - {\if@MXV@mouse true\else false\fi}% - {true}% - try{% - var player\@MXV@currplayer=app.media.openPlayer({% - settings: settings,% - events: events% - }); - }% - catch (e){}% - }% - )% - }% - \fi% - \if@MXV@linkclose% - \edef\@MXV@operation{% - /OP 1% - /JS (% - try{% - player\@MXV@currplayer.close(% - app.media.closeReason.general); - player\@MXV@currplayer=null; - }% - catch(e){}% - )% - }% - \fi% - }% - \fi% - \fi% - % - \ifpdf% - \ifthenelse{\isundefined{\@pdfborder}}{% - \def\@MXV@linkattr{}% - }{% - \edef\@MXV@linkattr{% - \if@MXV@beamer% - \@MXV@pdfborder% - \else% - /Border [\@pdfborder]% - \fi% - /C [\@linkbordercolor]% - /H \@pdfhighlight% - }% - }% - % - \pdfstartlink% - attr{\@MXV@linkattr}% - user{% - /Subtype /Link% - /A <<% - /S/GoTo% - /D (@MXV@\@MXV@@label)% - \if@MXV@@draft\else% - \if@MXV@externalviewer\else% - \if@MXV@iiid% - \ifx\@MXV@iiidview\@empty\else% - /Next <<% - /S/GoTo3DView% - /TA \@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}\space 0 R% - /V \@MXV@iiidview% - \fi% - \@MXV@jscriptiiidaction% - \ifx\@MXV@iiidview\@empty\else% - >>% - \fi% - \else% - /Next <<% - /S/Rendition% - /R \@MXV@getlabelvalue{@MXV@\@MXV@@label.rendition}\space 0 R% - /AN \@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}\space 0 R% - \@MXV@operation% - >>% - \fi% - \fi% - \fi% - >>% - }% - \usebox{\@MXV@textbox}% write out text box - \pdfendlink% - \else\if@MXV@dvipdfmx - \ifthenelse{\isundefined{\@pdfborder}}{% - \def\@MXV@linkattr{}% - }{% - \edef\@MXV@linkattr{% - \if@MXV@beamer% - \@MXV@pdfborder% - \else% - /Border [\@pdfborder]% - \fi% - /C [\@linkbordercolor]% - /H \@pdfhighlight% - }% - }% - % - \special{pdf:bannot <<% - \@MXV@linkattr% - /Subtype /Link% - /A <<% - /S/GoTo% - /D (@MXV@\@MXV@@label)% - \if@MXV@@draft\else% - \if@MXV@externalviewer\else% - \if@MXV@iiid% - \ifx\@MXV@iiidview\@empty\else% - /Next <<% - /S/GoTo3DView% - /TA \@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}% - /V \@MXV@iiidview% - \fi% - \@MXV@jscriptiiidaction% - \ifx\@MXV@iiidview\@empty\else% - >>% - \fi% - \else% - /Next <<% - /S/Rendition% - /R \@MXV@getlabelvalue{@MXV@\@MXV@@label.rendition}% - /AN \@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}% - \@MXV@operation% - >>% - \fi% - \fi% - \fi% - >>% - >>}% - \usebox{\@MXV@textbox}% write out text box - \special{pdf:eannot}% - \else% - \pdfmark[{\usebox{\@MXV@textbox}}]{% - pdfmark=/ANN,% - Subtype=/Link,% - Color=\@linkbordercolor,% - AcroHighlight=\@pdfhighlight,% - Raw={% - \@MXV@pdfborder% - /_objdef {linkannot\the\@MXV@links}% - /Action <<% - /S/GoTo% - /D/@MXV@\@MXV@@label% - \if@MXV@@draft\else% - \if@MXV@externalviewer\else% - \if@MXV@iiid% - \ifx\@MXV@iiidview\@empty\else% - /Next <<% - /S/GoTo3DView% - /TA \@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}% - /V \@MXV@iiidview% - \fi% - \@MXV@jscriptiiidaction% - \ifx\@MXV@iiidview\@empty\else% - >>% - \fi% - \else% - /Next <<% - /S /Rendition% - /R {mediarendition\@MXV@getlabelvalue{@MXV@\@MXV@@label.annotid}}% - /AN {screenannot\@MXV@getlabelvalue{@MXV@\@MXV@@label.annot}}% - \@MXV@operation% - >>% - \fi% - \fi% - \fi% - >>% - }% - }% - \fi\fi% - }% - }% -} - -%set to true for certain \movieref options, which require the media player to -%be re-opened -\newboolean{@MXV@requirereopen} - -%standard keys to be processed first -%key definitions for options to \includemovie -\define@key{MXV@user}{draft}[true]{% - \setboolean{@MXV@@draft}{#1}% -} -\define@key{MXV@user}{final}[true]{% - \ifthenelse{\equal{#1}{true}}{% - \setboolean{@MXV@@draft}{false}% - }{% - \setboolean{@MXV@@draft}{true}% - }% -} -\define@key{MXV@user}{label}{%for use with movieref - \gdef\@MXV@label{#1}% -} -\define@key{MXV@user}{controls}[true]{% - \setboolean{@MXV@requirereopen}{true}% - \xdef\@MXV@ctrls{, showUI: #1}% - \xdef\@MXV@@ctrls{/C #1}% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@iiidtoolb{/TB #1}% - }{}% -} -\define@key{MXV@user}{toolbar}[true]{% - \xdef\@MXV@ctrls{, showUI: #1}% - \xdef\@MXV@@ctrls{/C #1}% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@iiidtoolb{/TB #1}% - }{}% -} -\define@key{MXV@user}{volume}{% - \def\@MXV@@volume{/V #1}% - \def\@MXV@volume{#1}% - \setboolean{@MXV@requirereopen}{true}% -} -\define@key{MXV@user}{mimetype}{% - \ifthenelse{\equal{#1}{model/u3d}}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiid}{true}% - \xdef\@MXV@iiidsubtype{U3D}% - }{\@MXV@neediiiD}% - }{}% - \def\@MXV@mime{#1}% -} -\define@key{MXV@user}{playerid}{% - \def\@MXV@player{% - /PL<</MU [<</PID<</U (vnd.adobe.swname:#1)>>>>]>>% - }% -} -\define@key{MXV@user}{autoplay}[true]{% - \setboolean{@MXV@autoplay}{#1}% - \if@MXV@autoplay% - \setboolean{@MXV@autoresume}{false}% - \fi% -} -\define@key{MXV@user}{autostop}[true]{% - \setboolean{@MXV@autostop}{#1}% - \if@MXV@autostop% - \setboolean{@MXV@autopause}{false}% - \fi% -} -\define@key{MXV@user}{autoresume}[true]{% - \setboolean{@MXV@autoresume}{#1}% - \if@MXV@autoresume% - \setboolean{@MXV@autoplay}{false}% - \setboolean{@MXV@autoclose}{false}% - \fi% -} -\define@key{MXV@user}{autopause}[true]{% - \setboolean{@MXV@autopause}{#1}% - \if@MXV@autopause% - \setboolean{@MXV@autostop}{false}% - \setboolean{@MXV@autoclose}{false}% - \fi% -} -\define@key{MXV@user}{autoclose}[true]{% - \setboolean{@MXV@autoclose}{#1}% - \if@MXV@autoclose% - \setboolean{@MXV@autostop}{false}% - \setboolean{@MXV@autopause}{false}% - \fi% -} -\define@key{MXV@user}{continue}[true]{% - \setboolean{@MXV@autostop}{false}% - \setboolean{@MXV@autopause}{false}% - \setboolean{@MXV@autoclose}{false}% -} -\define@key{MXV@user}{open}[true]{% - %no longer supported; once open, media remains loaded - %to avoid reloading when media is to be played again -} -\define@key{MXV@user}{mouse}[true]{% - \setboolean{@MXV@mouse}{#1}% - \setboolean{@MXV@requirereopen}{true}% - \ifthenelse{\equal{false}{#1}\AND\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@iiidia{/3DI #1}% - }{}% -} -\define@key{MXV@user}{palindrome}[true]{% - \xdef\@MXV@palindrome{, palindrome: #1}% - \setboolean{@MXV@requirereopen}{true}% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@iiidpalindrome{/Subtype/Oscillating}% - }{}% -} -\define@key{MXV@user}{rate}{% - \setboolean{@MXV@requirereopen}{true}% - \xdef\@MXV@rate{, rate: #1}% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@iiidrate{/TM #1}% - }{}% -} -\define@key{MXV@user}{repeat}[Infinity]{% - \setboolean{@MXV@requirereopen}{true}% - \ifthenelse{% - \equal{#1}{Infinity}\OR% - \equal{#1}{0}% - }{% - \xdef\@MXV@repeat{, repeat: Infinity}% - \xdef\@MXV@@repeat{/RC 0}% - }{% - \xdef\@MXV@repeat{, repeat: #1}% - \xdef\@MXV@@repeat{/RC #1}% - }% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \ifthenelse{\equal{#1}{Infinity}}{% - \global\@MXV@iiidrepeat=-1% - }{% - \global\@MXV@iiidrepeat=#1% - }% - }{}% -} -\define@key{MXV@user}{startat}{% - \xdef\@MXV@startat{, startAt: {#1}}% - \xdef\@MXV@@startat{{#1}}% -} -\define@key{MXV@user}{endat}{% - \setboolean{@MXV@requirereopen}{true}% - \xdef\@MXV@endat{, endAt: {#1}}% -} -\define@key{MXV@user}{poster}[true]{% - \ifthenelse{\equal{#1}{true}}{% option without arg - \setboolean{@MXV@runposter}{true}% - }{% - \def\@MXV@box##1##2##3{% - \ifpdf% - \mbox{\pdfximage width ##1 height ##2 depth ##3 {#1}}% - \pdfrefximage\pdflastximage% - \else% - \ifthenelse{\isundefined{\includegraphics}}{\@MXV@missing{graphics}}{}% - \@MXV@totalheight=##2% - \advance\@MXV@totalheight by ##3% - \raisebox{-##3}[##2][##3]{% - \includegraphics[% - width=##1,height=##2,totalheight=\@MXV@totalheight,clip]{#1}% - }% - \fi% - }% - }% -} -\define@key{MXV@user}{externalviewer}[true]{% - \setboolean{@MXV@externalviewer}{#1}% -} -\define@key{MXV@user}{inline}[true]{% - \if@MXV@url% - \setboolean{@MXV@inline}{false}% - \else% - \setboolean{@MXV@inline}{#1}% - \fi% - \if@MXV@inline\else% - \setboolean{@MXV@attachment}{false}% - \fi% -} -\define@key{MXV@user}{url}[true]{% - \setboolean{@MXV@url}{#1}% - \if@MXV@url% - \setboolean{@MXV@inline}{false}% - \setboolean{@MXV@attachment}{false}% - \def\@MXV@fsentry{/FS /URL}% - \fi% -} -\define@key{MXV@user}{attach}[true]{% - \setboolean{@MXV@attachment}{#1}% - \if@MXV@attachment% - \setboolean{@MXV@inline}{true}% - \fi% -} -\define@key{MXV@user}{text}{% - \setboolean{@MXV@boxopt}{true}% - \savebox{\@MXV@textbox}{#1}% - \@MXV@width=\wd\@MXV@textbox% - \@MXV@height=\ht\@MXV@textbox% - \@MXV@depth=\dp\@MXV@textbox% -} -\define@key{MXV@user}{textoverposter}[true]{% - \setboolean{@MXV@textoverposter}{#1}% -} -\define@key{MXV@user}{depth}{%set depth of display area - \gdef\@MXV@boxdepth{#1}% -} -%3D specific options -\define@key{MXV@user}{3Dbg}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@background{/BG<</CS/DeviceRGB/C[#1]>>}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Djscript}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \IfFileExists{#1}{% - \def\@MXV@jscriptiiidfile{#1}% - }{% - \PackageError{movie15}{Script file `#1' cannot be opened for embedding% - }{% - Make sure file `#1' exists and is readable!% - }% - }% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dcoo}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@coo{#1}% - \setboolean{@MXV@defaultviewprovided}{true}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dc2c}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@ctoc{#1}% - \setboolean{@MXV@defaultviewprovided}{true}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Droo}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@roo{#1}% - \setboolean{@MXV@defaultviewprovided}{true}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Daac}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@aac{#1}% - \setboolean{@MXV@defaultviewprovided}{true}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Droll}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \def\@MXV@roll{#1}% - \setboolean{@MXV@defaultviewprovided}{true}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dviews}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \IfFileExists{#1}{% - \def\@MXV@viewsfile{#1}% - }{% - \PackageError{movie15}{3D views file `#1' cannot be opened% - }{% - Make sure file `#1' exists and is readable!% - }% - }% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dlights}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@lights{/LS <</Subtype/#1>>}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Drender}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@render{/RM <</Subtype/#1>>}% - }{\@MXV@neediiiD}% -} -%options for \movieref command -\define@key{MXV@user}{play}[true]{% - \setboolean{@MXV@linkplay}{#1}% - \if@MXV@linkplay% - \setboolean{@MXV@linkpause}{false}% - \setboolean{@MXV@linkresume}{false}% - \setboolean{@MXV@linkstop}{false}% - \setboolean{@MXV@linkclose}{false}% - \fi% -} -\define@key{MXV@user}{pause}[true]{% - \setboolean{@MXV@linkpause}{#1}% - \if@MXV@linkpause% - \setboolean{@MXV@linkresume}{false}% - \setboolean{@MXV@linkstop}{false}% - \setboolean{@MXV@linkclose}{false}% - \setboolean{@MXV@linkplay}{false}% - \fi% -} -\define@key{MXV@user}{resume}[true]{% - \setboolean{@MXV@linkresume}{#1}% - \if@MXV@linkresume% - \setboolean{@MXV@linkpause}{false}% - \setboolean{@MXV@linkstop}{false}% - \setboolean{@MXV@linkclose}{false}% - \setboolean{@MXV@linkplay}{false}% - \fi% -} -\define@key{MXV@user}{stop}[true]{% - \setboolean{@MXV@linkstop}{#1}% - \if@MXV@linkstop% - \setboolean{@MXV@linkpause}{false}% - \setboolean{@MXV@linkresume}{false}% - \setboolean{@MXV@linkclose}{false}% - \setboolean{@MXV@linkplay}{false}% - \fi% -} -\define@key{MXV@user}{close}[true]{% - \setboolean{@MXV@linkclose}{#1}% - \if@MXV@linkclose% - \setboolean{@MXV@linkpause}{false}% - \setboolean{@MXV@linkresume}{false}% - \setboolean{@MXV@linkstop}{false}% - \setboolean{@MXV@linkplay}{false}% - \fi% -} -\define@key{MXV@user}{reset}[true]{% - \setboolean{@MXV@linkreset}{#1}% - \if@MXV@linkreset% - \setboolean{@MXV@requirereopen}{true}% - \fi% -} -\define@key{MXV@user}{default}[true]{% synonyme for `reset' - \setboolean{@MXV@linkreset}{#1}% - \if@MXV@linkreset% - \setboolean{@MXV@requirereopen}{true}% - \fi% -} -\define@key{MXV@user}{3Dviewindex}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \ifthenelse{% - \equal{#1}{F}% - \OR\equal{#1}{L}% - \OR\equal{#1}{N}% - \OR\equal{#1}{P}% - \OR\equal{#1}{D}% - }{% - \gdef\@MXV@iiidview{/#1}% any of F, L, N, P, D - }{% - \gdef\@MXV@iiidview{#1}% number (index) - }% - \setboolean{@MXV@defaultviewprovided}{false}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dcalculate}[30]{% - %calculate optimal 3D settings for roo and coo for a given aac - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \gdef\@MXV@calc{#1}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dgetview}[true]{% - %print current 3D camera settings - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \setboolean{@MXV@iiidgetview}{#1}% - }{\@MXV@neediiiD}% -} -\define@key{MXV@user}{3Dresource}{% - \ifthenelse{\boolean{@MXV@iiiDfeat}}{% - \IfFileExists{#1}{% - \setboolean{@MXV@resource}{true}% - \xdef\@MXV@iiidopt{3Dresource=#1, \@MXV@iiidopt}% - }{% - \PackageError{movie15}{3D resource file `#1' cannot be opened% - }{% - Make sure file `#1' exists and is readable!% - }% - }% - }{\@MXV@neediiiD}% -} - -%compatibility options for \movie and \hyperlinkmovie commands -\define@key{MXV@user}{borderwidth}{% - %ignored; acroread doesn't draw borders around screen annots anyway -} -\define@key{MXV@user}{height}{%set height of display area - \gdef\@MXV@boxheight{#1}% -} -\define@key{MXV@user}{width}{%set width of display area - \gdef\@MXV@boxwidth{#1}% -} -\define@key{MXV@user}{autostart}[true]{% - \xdef\@MXV@autostart{, autoplay=#1}% -} -\define@key{MXV@user}{loop}[Infinity]{% - \xdef\@MXV@loop{, repeat=#1}% -} -\define@key{MXV@user}{once}[]{% - \xdef\@MXV@loop{, repeat=1}% -} -\define@key{MXV@user}{showcontrols}[true]{% - \xdef\@MXV@showcontrols{, controls=#1}% -} -\define@key{MXV@user}{start}{% - \gdef\@MXV@starttime##1s{% - \global\@MXV@start=##1pt% - }% - \@MXV@starttime #1% -} -\define@key{MXV@user}{duration}{% - \gdef\@MXV@durationtime##1s{% - \global\@MXV@end=##1pt% - }% - \@MXV@durationtime #1% -} - -%options to be passed to internal macro \@MXV@includeiiid -\define@key{MXV@iiid}{3Dresource}{% - \@MXV@addresource{#1}% -} - -%compatibility macros -\providecommand\movie[3][]{% - \ifpdf\else% - \ifthenelse{\isundefined{\pdfmark}\AND\isundefined{\@pdfm@mark}}{\@MXV@missing{hyperref}}{}% - \fi% - \leavevmode% - \@MXV@reset% - \def\@MXV@autostart{}\def\@MXV@loop{}\def\@MXV@showcontrols{}% - \def\@MXV@starttime{}\def\@MXV@durationtime{}% - \setkeys{MXV@user}{#1}% - % - %sanity checks - \if@MXV@boxopt% - \PackageError{movie15}{% - Option `text' cannot be used with command `\string\movie'.\MessageBreak - Instead, put text into the 1st argument of `\string\movie' - }{}% - \fi% - % - \ifx\@MXV@durationtime\@empty\else\ifx\@MXV@startat\@empty\else% - \PackageError{movie15}{% - Options `startat' and `duration' cannot be used\MessageBreak - together.\MessageBreak - Possible combinations are `startat'/`endat',\MessageBreak - `start'/`endat' or `start'/`duration' - }{}% - \fi\fi% - % - %option list - \edef\@MXV@movieoptions{#1\@MXV@autostart\@MXV@loop\@MXV@showcontrols}% - % - %determine playback section - \ifx\@MXV@starttime\@empty\else% - \edef\@MXV@movieoptions{\@MXV@movieoptions, % - startat=time:\strip@pt\@MXV@start}% - \fi% - \ifx\@MXV@durationtime\@empty\else% - \advance\@MXV@end by \@MXV@start% - \edef\@MXV@movieoptions{\@MXV@movieoptions, % - endat=time:\strip@pt\@MXV@end}% - \fi% - % - %text option from 2nd argument - \savebox{\@MXV@textbox}{#2}% - \edef\@MXV@movieoptions{[\@MXV@movieoptions, text={\noexpand\usebox{% - \noexpand\@MXV@textbox}}]}% - \expandafter% - \includemovie\@MXV@movieoptions{\@MXV@boxwidth}{\@MXV@boxheight}{#3}% -} - -\newcommand\hyperlinkmovie[3][]{% - \ifpdf\else% - \ifthenelse{\isundefined{\pdfmark}\AND\isundefined{\@pdfm@mark}}{\@MXV@missing{hyperref}}{}% - \fi% - \leavevmode% - \@MXV@reset% - \def\@MXV@autostart{}\def\@MXV@loop{}\def\@MXV@showcontrols{}% - \def\@MXV@starttime{}\def\@MXV@durationtime{}% - \setkeys{MXV@user}{#1}% - % - %sanity check - \ifx\@MXV@durationtime\@empty\else\ifx\@MXV@startat\@empty\else% - \PackageError{movie15}{% - Options `startat' and `duration' cannot be used\MessageBreak - together.\MessageBreak - Possible combinations are `startat'/`endat',\MessageBreak - `start'/`endat' or `start'/`duration' - }{}% - \fi\fi% - % - %option list - \edef\@MXV@movieoptions{#1\@MXV@autostart\@MXV@loop\@MXV@showcontrols}% - % - %determine playback section - \ifx\@MXV@starttime\@empty\else% - \edef\@MXV@movieoptions{\@MXV@movieoptions, % - startat=time:\strip@pt\@MXV@start}% - \fi% - \ifx\@MXV@durationtime\@empty\else% - \advance\@MXV@end by \@MXV@start% - \edef\@MXV@movieoptions{\@MXV@movieoptions, % - endat=time:\strip@pt\@MXV@end}% - \fi% - % - \edef\@MXV@movieoptions{[\@MXV@movieoptions]}% - \expandafter\movieref\@MXV@movieoptions{#2}{#3}% -} diff --git a/Build/source/utils/asymptote/path.cc b/Build/source/utils/asymptote/path.cc index eb5c57ad2d0..642812e0b67 100644 --- a/Build/source/utils/asymptote/path.cc +++ b/Build/source/utils/asymptote/path.cc @@ -28,9 +28,11 @@ const double third=1.0/3.0; path nullpath; +const char *nopoints="nullpath has no points"; + void checkEmpty(Int n) { if(n == 0) - reportError("nullpath has no points"); + reportError(nopoints); } // Accurate computation of sqrt(1+x)-1. diff --git a/Build/source/utils/asymptote/path.h b/Build/source/utils/asymptote/path.h index 42f00c9c19c..c19438ae461 100644 --- a/Build/source/utils/asymptote/path.h +++ b/Build/source/utils/asymptote/path.h @@ -387,6 +387,7 @@ public: extern path nullpath; extern const unsigned maxdepth; extern const unsigned mindepth; +extern const char *nopoints; bool intersect(double& S, double& T, path& p, path& q, double fuzz, unsigned depth=maxdepth); diff --git a/Build/source/utils/asymptote/path3.cc b/Build/source/utils/asymptote/path3.cc index 5f995637b6a..69adf4947b4 100644 --- a/Build/source/utils/asymptote/path3.cc +++ b/Build/source/utils/asymptote/path3.cc @@ -759,14 +759,19 @@ path3 transformed(const array& t, const path3& p) return path3(nodes, n, p.cyclic()); } -double xratio(const triple& v) +path3 transformed(const double* t, const path3& p) { - return v.getx()/v.getz(); -} + Int n = p.size(); + mem::vector<solvedKnot3> nodes(n); + + for(Int i=0; i < n; ++i) { + nodes[i].pre=t*p.precontrol(i); + nodes[i].point=t*p.point(i); + nodes[i].post=t*p.postcontrol(i); + nodes[i].straight=p.straight(i); + } -double yratio(const triple& v) -{ - return v.gety()/v.getz(); + return path3(nodes, n, p.cyclic()); } template<class T> @@ -884,7 +889,7 @@ double controlbound(triple *P, double (*m)(double, double), } double bound(triple *P, double (*m)(double, double), - double (*f)(const triple&), double b, double fuzz, int depth) + double (*f)(const triple&), double b, double fuzz, int depth) { b=m(b,cornerbound(P,m,f)); if(m(-1.0,1.0)*(b-ratiobound(P,m,f)) >= -fuzz || depth == 0) @@ -1112,108 +1117,107 @@ void intersections(std::vector<double>& T, std::vector<double>& U, return; } - Int lp=p.length(); + Int lp=p.length(); - path3 p0,p1; - p.halve(p0,p1); + path3 p0,p1; + p.halve(p0,p1); - std::vector<double> T1,U1,V1; - double tscale,toffset; + std::vector<double> T1,U1,V1; + double tscale,toffset; - double fuzz2=max(fuzzFactor*fuzz,Fuzz); - fuzz2=fuzz2*fuzz2; + double fuzz2=max(fuzzFactor*fuzz,Fuzz); + fuzz2=fuzz2*fuzz2; - if(lp <= 1) { - if(lp == 1) p.halve(p0,p1); - if(lp == 0 || p0 == p || p1 == p) { - double u,v; - if(intersections(u,v,p.point((Int) 0),P,fuzz,depth)) { - T1.push_back(0.0); - U1.push_back(u); - V1.push_back(v); - add(T,U,V,T1,U1,V1,p,1.0,0.0,0.0,0.0,fuzz2); + if(lp <= 1) { + if(lp == 1) p.halve(p0,p1); + if(lp == 0 || p0 == p || p1 == p) { + double u,v; + if(intersections(u,v,p.point((Int) 0),P,fuzz,depth)) { + T1.push_back(0.0); + U1.push_back(u); + V1.push_back(v); + add(T,U,V,T1,U1,V1,p,1.0,0.0,0.0,0.0,fuzz2); + } + return; } - return; + tscale=toffset=0.5; + } else { + Int tp=lp/2; + p0=p.subpath(0,tp); + p1=p.subpath(tp,lp); + toffset=tp; + tscale=1.0; } - tscale=toffset=0.5; - } else { - Int tp=lp/2; - p0=p.subpath(0,tp); - p1=p.subpath(tp,lp); - toffset=tp; - tscale=1.0; - } - Split<triple> c0(P[0],P[1],P[2],P[3]); - Split<triple> c1(P[4],P[5],P[6],P[7]); - Split<triple> c2(P[8],P[9],P[10],P[11]); - Split<triple> c3(P[12],P[13],P[14],P[15]); + Split<triple> c0(P[0],P[1],P[2],P[3]); + Split<triple> c1(P[4],P[5],P[6],P[7]); + Split<triple> c2(P[8],P[9],P[10],P[11]); + Split<triple> c3(P[12],P[13],P[14],P[15]); - Split<triple> c4(P[12],P[8],P[4],P[0]); - Split<triple> c5(c3.m0,c2.m0,c1.m0,c0.m0); - Split<triple> c6(c3.m3,c2.m3,c1.m3,c0.m3); - Split<triple> c7(c3.m5,c2.m5,c1.m5,c0.m5); - Split<triple> c8(c3.m4,c2.m4,c1.m4,c0.m4); - Split<triple> c9(c3.m2,c2.m2,c1.m2,c0.m2); - Split<triple> c10(P[15],P[11],P[7],P[3]); + Split<triple> c4(P[12],P[8],P[4],P[0]); + Split<triple> c5(c3.m0,c2.m0,c1.m0,c0.m0); + Split<triple> c6(c3.m3,c2.m3,c1.m3,c0.m3); + Split<triple> c7(c3.m5,c2.m5,c1.m5,c0.m5); + Split<triple> c8(c3.m4,c2.m4,c1.m4,c0.m4); + Split<triple> c9(c3.m2,c2.m2,c1.m2,c0.m2); + Split<triple> c10(P[15],P[11],P[7],P[3]); - // Check all 4 Bezier subpatches against p0. - triple Q0[]={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}; - intersections(T1,U1,V1,p0,Q0,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.0,fuzz2); + // Check all 4 Bezier subpatches against p0. + triple Q0[]={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}; + intersections(T1,U1,V1,p0,Q0,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.0,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - triple Q1[]={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}; - intersections(T1,U1,V1,p0,Q1,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.5,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + triple Q1[]={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}; + intersections(T1,U1,V1,p0,Q1,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.0,0.5,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - triple Q2[]={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]}; - intersections(T1,U1,V1,p0,Q2,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.5,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + triple Q2[]={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]}; + intersections(T1,U1,V1,p0,Q2,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.5,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - triple Q3[]={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}; - intersections(T1,U1,V1,p0,Q3,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.0,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + triple Q3[]={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}; + intersections(T1,U1,V1,p0,Q3,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,0.0,0.5,0.0,fuzz2); - // Check all 4 Bezier subpatches against p1. - T1.clear(); - U1.clear(); - V1.clear(); - intersections(T1,U1,V1,p1,Q0,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.0,fuzz2); + // Check all 4 Bezier subpatches against p1. + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q0,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.0,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - intersections(T1,U1,V1,p1,Q1,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.5,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q1,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.0,0.5,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - intersections(T1,U1,V1,p1,Q2,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.5,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q2,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.5,fuzz2); - T1.clear(); - U1.clear(); - V1.clear(); - intersections(T1,U1,V1,p1,Q3,fuzz,depth); - add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.0,fuzz2); + T1.clear(); + U1.clear(); + V1.clear(); + intersections(T1,U1,V1,p1,Q3,fuzz,depth); + add(T,U,V,T1,U1,V1,p,tscale,toffset,0.5,0.0,fuzz2); } } } //namespace camp - diff --git a/Build/source/utils/asymptote/path3.h b/Build/source/utils/asymptote/path3.h index 893d1df0aba..60fb7e68c99 100644 --- a/Build/source/utils/asymptote/path3.h +++ b/Build/source/utils/asymptote/path3.h @@ -331,6 +331,7 @@ public: }; path3 transformed(const vm::array& t, const path3& p); +path3 transformed(const double* t, const path3& p); extern path3 nullpath3; extern const unsigned maxdepth; @@ -362,9 +363,6 @@ inline triple displacement(const triple& z, const triple& p, const triple& q) return Z-dot(Z,Q)*Q; } -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&), diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc index 9a77cd4d592..6ac8be8dcfc 100644 --- a/Build/source/utils/asymptote/picture.cc +++ b/Build/source/utils/asymptote/picture.cc @@ -1,4 +1,4 @@ - /***** +/***** * picture.cc * Andy Hammerlindl 2002/06/06 * @@ -32,6 +32,7 @@ texstream::~texstream() { unlink((name+"aux").c_str()); unlink((name+"log").c_str()); unlink((name+"out").c_str()); + unlink((name+"m9").c_str()); if(settings::pdf(texengine)) unlink((name+"pdf").c_str()); if(context) { @@ -44,6 +45,276 @@ texstream::~texstream() { namespace camp { +bool isIdTransform3(const double* t) +{ + return (t == NULL || (t[0]==1 && t[4]==0 && t[ 8]==0 && t[12]==0 && + t[1]==0 && t[5]==1 && t[ 9]==0 && t[13]==0 && + t[2]==0 && t[6]==0 && t[10]==1 && t[14]==0 && + t[3]==0 && t[7]==0 && t[11]==0 && t[15]==1)); +} + +// copy array to 4x4 transform matrix with range checks +void copyArray4x4C(double*& dest, const vm::array *a) +{ + double tt[16]; + const size_t n=checkArray(a); + const string fourbyfour="4x4 array of doubles expected"; + if(n != 4) reportError(fourbyfour); + + for(size_t i=0; i < 4; i++) { + const vm::array *ai=vm::read<vm::array*>(a,i); + const size_t aisize=checkArray(ai); + if(aisize == 4) { + for(size_t j=0; j < 4; j++) + tt[i+j*4]=vm::read<double>(ai,j); + } else reportError(fourbyfour); + } + + copyTransform3(dest,tt); +} + +void copyTransform3(double*& d, const double* s) +{ + if(isIdTransform3(s)) { + d=NULL; + } + else { + if (d == NULL) + d=new(UseGC) double[16]; + memcpy(d,s,sizeof(double)*16); + } +} + +// t = s*r +void multiplyTransform3(double*& t, const double* s, const double* r ) +{ + if(isIdTransform3(s)) { + copyTransform3(t, r); + } else if(isIdTransform3(r)) { + copyTransform3(t, s); + } else { + double tt[16]; + for(size_t i=0; i < 4; i++) { + const double& s0=s[i+0]; + const double& s1=s[i+4]; + const double& s2=s[i+8]; + const double& s3=s[i+12]; + tt[i]=s0*r[0]+s1*r[1]+s2*r[2]+s3*r[3]; + tt[i+4]=s0*r[4]+s1*r[5]+s2*r[6]+s3*r[7]; + tt[i+8]=s0*r[8]+s1*r[9]+s2*r[10]+s3*r[11]; + tt[i+12]=s0*r[12]+s1*r[13]+s2*r[14]+s3*r[15]; + } + copyTransform3(t,tt); + } +} + +void transformTriples(const double* t, size_t n, Triple* d, const Triple* s) +{ + if(n == 0 || s == NULL || d == NULL) + return; + + if(isIdTransform3(t)) { + copyTriples(n, d, s); + return; + } + for(size_t i=0; i < n; i++) { + const double& x = s[i][0]; + const double& y = s[i][1]; + const double& z = s[i][2]; + double f=t[3]*x+t[7]*y+t[11]*z+t[15]; + if(f == 0.0) + reportError("division by 0 in transformTriples"); + f=1.0/f; + d[i][0]=(t[0]*x+t[4]*y+t[8]*z+t[12])*f; + d[i][1]=(t[1]*x+t[5]*y+t[9]*z+t[13])*f; + d[i][2]=(t[2]*x+t[6]*y+t[10]*z+t[14])*f; + } +} + +void transformshiftlessTriples(const double* t, size_t n, Triple* d, + const Triple* s) +{ + if(n == 0 || s == NULL || d == NULL) + return; + + if(isIdTransform3(t)) { + copyTriples(n, d, s); + return; + } + for(size_t i=0; i < n; i++) { + const double& x=s[i][0]; + const double& y=s[i][1]; + const double& z=s[i][2]; + double f=t[3]*x+t[7]*y+t[11]*z+t[15]; + if(f == 0.0) + reportError("division by 0 in transformshiftlessTriples"); + f=1.0/f; + d[i][0]=(t[0]*x+t[4]*y+t[8]*z)*f; + d[i][1]=(t[1]*x+t[5]*y+t[9]*z)*f; + d[i][2]=(t[2]*x+t[6]*y+t[10]*z)*f; + } +} + +void transformNormalsTriples(const double* t, size_t n, Triple* d, + const Triple* s) +{ + if(n==0 || s==NULL || d==NULL) + return; + + if(isIdTransform3(t)) { + copyTriples(n, d, s); + return; + } + for(size_t i=0; i < n; i++) { + const double& x = s[i][0]; + const double& y = s[i][1]; + const double& z = s[i][2]; + double& X = d[i][0]; + double& Y = d[i][1]; + double& Z = d[i][2]; + double f=t[3]*x+t[7]*y+t[11]*z+t[15]; + if(f == 0.0) + reportError("division by 0 in transformNormalsTriples"); + f=1.0/f; + X=(t[0]*x+t[4]*y+t[8]*z)*f; + Y=(t[1]*x+t[5]*y+t[9]*z)*f; + Z=(t[2]*x+t[6]*y+t[10]*z)*f; + const double scale=sqrt(X*X+Y*Y+Z*Z); + if(scale != 0.0) { + X /= scale; + Y /= scale; + Z /= scale; + } + } +} + +void unitTriples(size_t n, Triple* d) +{ + for (size_t i=0; i < n; i++) { + double& x = d[i][0]; + double& y = d[i][1]; + double& z = d[i][2]; + const double scale=sqrt(x*x+y*y+z*z); + if(scale != 0.0) { + x /= scale; + y /= scale; + z /= scale; + } + } +} + +void copyTriples(size_t n, Triple* d, const Triple* s) +{ + if(n == 0 || s == NULL || d == NULL) + return; + + memcpy(d, s, sizeof(double)*3*n); +} + +void boundsTriples(double& x, double& y, double& z, double& X, double& Y, + double& Z, size_t n, const Triple* v) +{ + if(n == 0 || v == NULL) + return; + + X=x=v[0][0]; + Y=y=v[0][1]; + Z=z=v[0][2]; + + for(size_t i=1; i < n; ++i) { + const double* const vi=v[i]; + const double vx=vi[0]; + x=min(x,vx); + X=max(X,vx); + const double vy=vi[1]; + y=min(y,vy); + Y=max(Y,vy); + const double vz=vi[2]; + z=min(z,vz); + Z=max(Z,vz); + } + +} + +inline double xratioTriple(const Triple v) +{ + return v[0]/v[2]; +} + +inline double yratioTriple(const Triple v) +{ + return v[1]/v[2]; +} + +void ratioTriples(pair &b, double (*m)(double, double), bool &first, size_t n, + const Triple* v) +{ + if(n == 0 || v == NULL) + return; + + if(first) { + first=false; + const double* const v0=v[0]; + b=pair(xratioTriple(v0),yratioTriple(v0)); + } + + double x=b.getx(); + double y=b.gety(); + for(size_t i=0; i < n; ++i) { + const double* const vi=v[i]; + x=m(x,xratioTriple(vi)); + y=m(y,yratioTriple(vi)); + } + b=pair(x,y); +} + +void normalizeTriple(Triple v) +{ + const double length = sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); + if(length > 0) { + v[0] /= length; + v[1] /= length; + v[2] /= length; + } +} + +void crossTriple(Triple n, const Triple u, const Triple v) +{ + n[0]=u[1]*v[2]-u[2]*v[1]; + n[1]=u[2]*v[0]-u[0]*v[2]; + n[2]=u[0]*v[1]-u[1]*v[0]; +} + +double xratio(const triple& v) {return v.getx()/v.getz();} +double yratio(const triple& v) {return v.gety()/v.getz();} + +class matrixstack { + mem::stack<const double*> mstack; + +public: + // return current transform + const double* T() const + { + if(mstack.empty()) + return NULL; + else + return mstack.top(); + } + // we store the accumulated transform of all pushed transforms + void push(const double *r) + { + double* T3 = NULL; + multiplyTransform3(T3,T(),r); + mstack.push(T3); + } + void pop() + { + if(!mstack.empty()) + mstack.pop(); + } + +}; + const char *texpathmessage() { ostringstream buf; buf << "the directory containing your " << getSetting<string>("tex") @@ -180,11 +451,17 @@ bbox3 picture::bounds3() if(lastnumber3 == 0) b3=bbox3(); - nodelist::iterator p=nodes.begin(); - for(size_t i=0; i < lastnumber3; ++i) ++p; - for(; p != nodes.end(); ++p) { + matrixstack ms; + size_t i=0; + for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->bounds(b3); + if((*p)->begingroup3()) + ms.push((*p)->transf3()); + else if((*p)->endgroup3()) + ms.pop(); + else + (*p)->bounds(ms.T(),b3); + i++; } lastnumber3=n; @@ -197,9 +474,15 @@ pair picture::ratio(double (*m)(double, double)) pair b; bounds3(); double fuzz=sqrtFuzz*(b3.Max()-b3.Min()).length(); + matrixstack ms; for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->ratio(b,m,fuzz,first); + if((*p)->begingroup3()) + ms.push((*p)->transf3()); + else if((*p)->endgroup3()) + ms.pop(); + else + (*p)->ratio(ms.T(),b,m,fuzz,first); } return b; } @@ -241,7 +524,7 @@ void texinit() } else { if(!dir.empty()) cmd.push_back("-output-directory="+dir.substr(0,dir.length()-1)); - if(getSetting<bool>("inlinetex")) { + if(getSetting<bool>("inlineimage") || getSetting<bool>("inlinetex")) { string name=stripDir(stripExt((outname()))); size_t pos=name.rfind("-"); if(pos < string::npos) { @@ -456,6 +739,9 @@ int picture::epstopdf(const string& epsname, const string& pdfname) cmd.push_back("-q"); cmd.push_back("-dNOPAUSE"); cmd.push_back("-dBATCH"); + cmd.push_back("-P"); + if(safe) + cmd.push_back("-dSAFER"); cmd.push_back("-sDEVICE=pdfwrite"); cmd.push_back("-dEPSCrop"); cmd.push_back("-dSubsetFonts=true"); @@ -463,9 +749,6 @@ int picture::epstopdf(const string& epsname, const string& pdfname) cmd.push_back("-dMaxSubsetPct=100"); cmd.push_back("-dPDFSETTINGS=/prepress"); cmd.push_back("-dCompatibilityLevel=1.4"); - cmd.push_back("-P"); - if(safe) - cmd.push_back("-dSAFER"); if(!getSetting<bool>("autorotate")) cmd.push_back("-dAutoRotatePages=/None"); cmd.push_back("-g"+String(max(ceil(getSetting<double>("paperwidth")),1.0)) @@ -527,7 +810,7 @@ bool picture::postprocess(const string& prename, const string& outname, int status=0; bool epsformat=outputformat == "eps"; bool pdfformat=(settings::pdf(getSetting<string>("tex")) - && outputformat == "") || outputformat == "pdf"; + && outputformat == "") || outputformat == "pdf"; if(pdftex || !epsformat) { if(pdfformat) { @@ -573,7 +856,8 @@ bool picture::postprocess(const string& prename, const string& outname, status=System(cmd,0,true,"convert"); } } - if(!getSetting<bool>("keep")) unlink(prename.c_str()); + if(!getSetting<bool>("keep")) + unlink(prename.c_str()); } if(status != 0) return false; @@ -918,6 +1202,8 @@ bool picture::shipout(picture *preamble, const string& Prefix, if(context) prename=stripDir(prename); status=postprocess(prename,outname,outputformat,magnification,wait, view,pdf && Labels,svgformat); + if(pdfformat && !getSetting<bool>("keep")) + unlink(auxname(prefix,"m9").c_str()); } } } @@ -931,11 +1217,11 @@ bool picture::shipout(picture *preamble, const string& Prefix, // render viewport with width x height pixels. void picture::render(GLUnurbs *nurb, double size2, const triple& Min, const triple& Max, - double perspective, bool transparent) const + double perspective, bool lighton, bool transparent) const { for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->render(nurb,size2,Min,Max,perspective,transparent); + (*p)->render(nurb,size2,Min,Max,perspective,lighton,transparent); } } @@ -987,22 +1273,38 @@ bool picture::shipout3(const string& prefix, const string& format, if(getSetting<bool>("interrupt")) return true; - bool offscreen=getSetting<bool>("offscreen"); - #ifndef HAVE_LIBGLUT - if(!offscreen) + if(!getSetting<bool>("offscreen")) camp::reportError("to support onscreen rendering, please install glut library, run ./configure, and recompile"); #endif #ifndef HAVE_LIBOSMESA - if(offscreen) + if(getSetting<bool>("offscreen")) camp::reportError("to support offscreen rendering; please install OSMesa library, run ./configure --enable-offscreen, and recompile"); #endif - bounds3(); + picture *pic = new picture; + matrixstack ms; for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); + if((*p)->begingroup3()) + ms.push((*p)->transf3()); + else if((*p)->endgroup3()) + ms.pop(); + else + pic->append((*p)->transformed(ms.T())); + } + + pic->b3=bbox3(); + for(nodelist::iterator p=pic->nodes.begin(); p != pic->nodes.end(); ++p) { + assert(*p); + (*p)->bounds(pic->b3); + } + pic->lastnumber3=pic->nodes.size(); + + for(nodelist::iterator p=pic->nodes.begin(); p != pic->nodes.end(); ++p) { + assert(*p); (*p)->displacement(); } @@ -1012,6 +1314,7 @@ bool picture::shipout3(const string& prefix, const string& format, #ifdef HAVE_GL bool View=settings::view() && view; static int oldpid=0; + bool offscreen=getSetting<bool>("offscreen"); #ifdef HAVE_PTHREAD bool animating=getSetting<bool>("animating"); bool Wait=!interact::interactive || !View || animating; @@ -1024,7 +1327,7 @@ bool picture::shipout3(const string& prefix, const string& format, if(gl::initialize) { gl::initialize=false; com.prefix=prefix; - com.pic=this; + com.pic=pic; com.format=outputformat; com.width=width; com.height=height; @@ -1073,7 +1376,7 @@ bool picture::shipout3(const string& prefix, const string& format, } #endif #ifdef HAVE_GL - glrender(prefix,this,outputformat,width,height,angle,zoom,m,M,shift,t, + glrender(prefix,pic,outputformat,width,height,angle,zoom,m,M,shift,t, background,nlights,lights,diffuse,ambient,specular,viewportlighting, View,oldpid); #ifdef HAVE_PTHREAD @@ -1088,7 +1391,7 @@ bool picture::shipout3(const string& prefix, const string& format, return false; } -bool picture::shipout3(const string& prefix, array *index, array *center) +bool picture::shipout3(const string& prefix) { bounds3(); bool status = true; @@ -1102,7 +1405,7 @@ bool picture::shipout3(const string& prefix, array *index, array *center) groups.push_back(groupmap()); for(nodelist::iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->write(&prc,&billboard,index,center,compressionlimit,groups); + (*p)->write(&prc,&billboard,compressionlimit,groups); } groups.pop_back(); if(status) @@ -1132,11 +1435,23 @@ picture *picture::transformed(const transform& t) picture *picture::transformed(const array& t) { picture *pic = new picture; - - nodelist::iterator p; - for (p = nodes.begin(); p != nodes.end(); ++p) { + double* T=NULL; + copyArray4x4C(T, &t); + size_t level = 0; + for (nodelist::iterator p = nodes.begin(); p != nodes.end(); ++p) { assert(*p); - pic->append((*p)->transformed(t)); + if(level==0) + pic->append((*p)->transformed(T)); + else + pic->append(*p); + if((*p)->begingroup3()) + level++; + if((*p)->endgroup3()) { + if(level==0) + reportError("endgroup3 without matching begingroup3"); + else + level--; + } } return pic; diff --git a/Build/source/utils/asymptote/picture.h b/Build/source/utils/asymptote/picture.h index 7bd876f42e0..0e8897f701e 100644 --- a/Build/source/utils/asymptote/picture.h +++ b/Build/source/utils/asymptote/picture.h @@ -83,7 +83,7 @@ public: void render(GLUnurbs *nurb, double size2, const triple &Min, const triple& Max, double perspective, - bool transparent) const; + bool lighton, bool transparent) const; bool shipout3(const string& prefix, const string& format, double width, double height, double angle, double zoom, const triple& m, const triple& M, const pair& shift, double *t, @@ -92,7 +92,7 @@ public: bool viewportlighting, bool view); // PRC output - bool shipout3(const string& prefix, vm::array *index, vm::array *center); + bool shipout3(const string& prefix); bool reloadPDF(const string& Viewer, const string& outname) const; diff --git a/Build/source/utils/asymptote/policy.h b/Build/source/utils/asymptote/policy.h index 6898c7410d8..fe8fcf7a27f 100644 --- a/Build/source/utils/asymptote/policy.h +++ b/Build/source/utils/asymptote/policy.h @@ -21,7 +21,7 @@ typedef void (*function_typ)(state_typ, void *); typedef struct { const char *buf; - int_typ length; + size_t length; } string_typ; typedef void (*error_callback_typ)(string_typ); diff --git a/Build/source/utils/asymptote/prc/Makefile b/Build/source/utils/asymptote/prc/Makefile index af1a50084dd..a7f603b93f1 100644 --- a/Build/source/utils/asymptote/prc/Makefile +++ b/Build/source/utils/asymptote/prc/Makefile @@ -7,14 +7,14 @@ MAKEDEPEND = $(CFLAGS) -O0 -M -DDEPEND FILES = PRCbitStream oPRCFile PRCdouble writePRC -test: $(FILES:=.o) test.cc - $(CXX) $(CFLAGS) -o test $(FILES:=.o) test.cc -lz +test: $(FILES:=.o) test.o + $(CXX) $(CFLAGS) -o test $(FILES:=.o) test.o -lz -test_tess: $(FILES:=.o) test_tess.cc - $(CXX) $(CFLAGS) -o test_tess $(FILES:=.o) test_tess.cc -lz +test_tess: $(FILES:=.o) test_tess.o + $(CXX) $(CFLAGS) -o test_tess $(FILES:=.o) test_tess.o -lz -test_mesh: $(FILES:=.o) test_mesh.cc - $(CXX) $(CFLAGS) -o test_mesh $(FILES:=.o) test_mesh.cc -lz +test_mesh: $(FILES:=.o) test_mesh.o + $(CXX) $(CFLAGS) -o test_mesh $(FILES:=.o) test_mesh.o -lz .SUFFIXES: .c .cc .o .d .cc.o: diff --git a/Build/source/utils/asymptote/prc/oPRCFile.cc b/Build/source/utils/asymptote/prc/oPRCFile.cc index b8014544d4a..10f9431652c 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.cc +++ b/Build/source/utils/asymptote/prc/oPRCFile.cc @@ -24,6 +24,7 @@ #include <sstream> #include <iostream> #include <fstream> +#include <iomanip> #include <string> #include <zlib.h> #include <string.h> @@ -46,7 +47,7 @@ #define SerializeMaterial( value ) (value)->serializeMaterial(out); #define SerializeUserData UserData(0,0).write(out); -#define SerializeEmptyContentPRCBase EMPTY_CONTENTPRCBASE.serializeContentPRCBase(out); +#define SerializeEmptyContentPRCBase ContentPRCBase(PRC_TYPE_ROOT_PRCBase).serializeContentPRCBase(out); #define SerializeCategory1LineStyle( value ) (value)->serializeCategory1LineStyle(out); #define SerializeCoordinateSystem( value ) (value)->serializeCoordinateSystem(out); #define SerializeRepresentationItem( value ) (value)->serializeRepresentationItem(out); @@ -94,7 +95,7 @@ void PRCFileStructure::serializeFileStructureGlobals(PRCbitStream &out) PRCSingleAttribute sa((int32_t)PRCVersion); PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"); a.addKey(sa); - ContentPRCBase cb; + ContentPRCBase cb(PRC_TYPE_ROOT_PRCBase); cb.addAttribute(a); cb.serializeContentPRCBase(out); WriteUnsignedInteger (number_of_referenced_file_structures) @@ -132,12 +133,10 @@ void PRCFileStructure::serializeFileStructureGlobals(PRCbitStream &out) for (uint32_t i=0;i<number_of_materials;i++) SerializeMaterial (materials[i]) - out << (uint32_t)1 // number of line patterns hard coded for now - << (uint32_t)PRC_TYPE_GRAPH_LinePattern; - ContentPRCBase("",true,makeCADID(),0,makePRCID()).serializeContentPRCBase(out); - out << (uint32_t)0 // number of lengths - << 0.0 // phase - << false; // is real length + // number of line patterns hard coded for now + const uint32_t number_of_line_patterns = 1; + WriteUnsignedInteger (number_of_line_patterns) + PRCLinePattern().serializeLinePattern(out); const uint32_t number_of_styles = styles.size(); WriteUnsignedInteger (number_of_styles) @@ -161,12 +160,12 @@ void PRCFileStructure::serializeFileStructureTree(PRCbitStream &out) SerializeEmptyContentPRCBase - uint32_t number_of_part_definitions = part_definitions.size(); + const uint32_t number_of_part_definitions = part_definitions.size(); WriteUnsignedInteger (number_of_part_definitions) for (uint32_t i=0;i<number_of_part_definitions;i++) SerializePartDefinition (part_definitions[i]) - uint32_t number_of_product_occurrences = product_occurrences.size(); + const uint32_t number_of_product_occurrences = product_occurrences.size(); WriteUnsignedInteger (number_of_product_occurrences) for (uint32_t i=0;i<number_of_product_occurrences;i++) { @@ -239,7 +238,7 @@ void oPRCFile::serializeModelFileData(PRCbitStream &out) PRCSingleAttribute sa((int32_t)PRCVersion); PRCAttribute a("__PRC_RESERVED_ATTRIBUTE_PRCInternalVersion"); a.addKey(sa); - ContentPRCBase cb("PRC file"); + ContentPRCBase cb(PRC_TYPE_ROOT_PRCBase,"PRC file"); cb.addAttribute(a); cb.serializeContentPRCBase(out); @@ -400,11 +399,14 @@ uint32_t PRCHeader::getSize() return size; } -void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence) +void oPRCFile::doGroup(PRCgroup& group) { const string& name = group.name; - PRCPartDefinition *part_definition = new PRCPartDefinition; + PRCProductOccurrence*& product_occurrence = group.product_occurrence; + PRCProductOccurrence*& parent_product_occurrence = group.parent_product_occurrence; + PRCPartDefinition*& part_definition = group.part_definition; + PRCPartDefinition*& parent_part_definition = group.parent_part_definition; if(group.options.tess) { @@ -438,8 +440,8 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio tess->wire_indexes.push_back(pPoint->second); else { - uint32_t point_index = m1; - points.insert(make_pair(lit->point[i],(point_index = tess->coordinates.size()))); + const uint32_t point_index = tess->coordinates.size(); + points.insert(make_pair(lit->point[i],point_index)); tess->wire_indexes.push_back(point_index); tess->coordinates.push_back(lit->point[i].x); tess->coordinates.push_back(lit->point[i].y); @@ -476,6 +478,7 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio } map<PRCVector3d,uint32_t> points; PRC3DTess *tess = new PRC3DTess(); + tess->crease_angle = group.options.crease_angle; PRCTessFace *tessFace = new PRCTessFace(); tessFace->used_entities_flag=PRC_FACETESSDATA_Triangle; uint32_t triangles = 0; @@ -533,6 +536,145 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio } } + if(!group.quads.empty()) + { + map<PRCVector3d,uint32_t> points; + PRC3DTess *tess = new PRC3DTess(); + tess->crease_angle = group.options.crease_angle; + PRCTessFace *tessFace = new PRCTessFace(); + tessFace->used_entities_flag=PRC_FACETESSDATA_Triangle; + uint32_t triangles = 0; + + tessFace->is_rgba = false; + for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++) + { + const RGBAColour* C = qit->colours; + if(C[0].A != 1.0 || C[1].A != 1.0 || C[2].A != 1.0 || C[3].A != 1.0) + { + tessFace->is_rgba = true; + break; + } + } + bool same_colour = true; + const RGBAColour& colour = group.quads.front().colours[0]; + for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++) + { + const RGBAColour* C = qit->colours; + if(colour!=C[0] || colour!=C[1] || colour!=C[2] || colour!=C[3]) + { + same_colour = false; + break; + } + } + + for(PRCtessquadList::const_iterator qit=group.quads.begin(); qit!=group.quads.end(); qit++) + { + const RGBAColour* C = qit->colours; + const bool degenerate = (qit->vertices[0]==qit->vertices[1]); + uint32_t vertex_indices[4]; + for(size_t i = (degenerate?1:0); i < 4; ++i) + { + map<PRCVector3d,uint32_t>::const_iterator pPoint = points.find(qit->vertices[i]); + if(pPoint!=points.end()) + vertex_indices[i] = pPoint->second; + else + { + points.insert(make_pair(qit->vertices[i],(vertex_indices[i] = tess->coordinates.size()))); + tess->coordinates.push_back(qit->vertices[i].x); + tess->coordinates.push_back(qit->vertices[i].y); + tess->coordinates.push_back(qit->vertices[i].z); + } + } + if(degenerate) + { + tess->triangulated_index.push_back(vertex_indices[1]); + tess->triangulated_index.push_back(vertex_indices[2]); + tess->triangulated_index.push_back(vertex_indices[3]); + triangles++; + if(!same_colour) + { + tessFace->rgba_vertices.push_back(byte(C[1].R)); + tessFace->rgba_vertices.push_back(byte(C[1].G)); + tessFace->rgba_vertices.push_back(byte(C[1].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[1].A)); + + tessFace->rgba_vertices.push_back(byte(C[2].R)); + tessFace->rgba_vertices.push_back(byte(C[2].G)); + tessFace->rgba_vertices.push_back(byte(C[2].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[2].A)); + + tessFace->rgba_vertices.push_back(byte(C[3].R)); + tessFace->rgba_vertices.push_back(byte(C[3].G)); + tessFace->rgba_vertices.push_back(byte(C[3].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[3].A)); + } + } + else + { + tess->triangulated_index.push_back(vertex_indices[0]); + tess->triangulated_index.push_back(vertex_indices[2]); + tess->triangulated_index.push_back(vertex_indices[3]); + triangles++; + if(!same_colour) + { + tessFace->rgba_vertices.push_back(byte(C[0].R)); + tessFace->rgba_vertices.push_back(byte(C[0].G)); + tessFace->rgba_vertices.push_back(byte(C[0].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[0].A)); + + tessFace->rgba_vertices.push_back(byte(C[2].R)); + tessFace->rgba_vertices.push_back(byte(C[2].G)); + tessFace->rgba_vertices.push_back(byte(C[2].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[2].A)); + + tessFace->rgba_vertices.push_back(byte(C[3].R)); + tessFace->rgba_vertices.push_back(byte(C[3].G)); + tessFace->rgba_vertices.push_back(byte(C[3].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[3].A)); + } + tess->triangulated_index.push_back(vertex_indices[3]); + tess->triangulated_index.push_back(vertex_indices[1]); + tess->triangulated_index.push_back(vertex_indices[0]); + triangles++; + if(!same_colour) + { + tessFace->rgba_vertices.push_back(byte(C[3].R)); + tessFace->rgba_vertices.push_back(byte(C[3].G)); + tessFace->rgba_vertices.push_back(byte(C[3].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[3].A)); + + tessFace->rgba_vertices.push_back(byte(C[1].R)); + tessFace->rgba_vertices.push_back(byte(C[1].G)); + tessFace->rgba_vertices.push_back(byte(C[1].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[1].A)); + + tessFace->rgba_vertices.push_back(byte(C[0].R)); + tessFace->rgba_vertices.push_back(byte(C[0].G)); + tessFace->rgba_vertices.push_back(byte(C[0].B)); + if(tessFace->is_rgba) + tessFace->rgba_vertices.push_back(byte(C[0].A)); + } + } + } + tessFace->sizes_triangulated.push_back(triangles); + tess->addTessFace(tessFace); + const uint32_t tess_index = add3DTess(tess); + PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); + polyBrepModel->index_tessellation = tess_index; + polyBrepModel->is_closed = group.options.closed; + if(same_colour) + polyBrepModel->index_of_line_style = addColour(colour); + part_definition->addPolyBrepModel(polyBrepModel); + } + if(!group.points.empty()) { for(PRCpointsetMap::const_iterator pit=group.points.begin(); pit!=group.points.end(); pit++) @@ -556,6 +698,7 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio { for(std::vector<PRCPolyBrepModel*>::iterator pit=group.polymodels.begin(); pit!=group.polymodels.end(); pit++) { + (*pit)->is_closed = group.options.closed; part_definition->addPolyBrepModel(*pit); } } @@ -571,7 +714,7 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio if(!group.wires.empty()) { PRCTopoContext *wireContext = NULL; - uint32_t context_index = getTopoContext(wireContext); + const uint32_t context_index = getTopoContext(wireContext); for(PRCwireList::iterator wit=group.wires.begin(); wit!=group.wires.end(); wit++) { PRCWireEdge *wireEdge = new PRCWireEdge; @@ -593,7 +736,7 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio if(!faces.empty()) { bool same_color = true; - uint32_t style = faces.front().style; + const uint32_t style = faces.front().style; for(PRCfaceList::const_iterator fit=faces.begin(); fit!=faces.end(); fit++) if(style!=fit->style) { @@ -664,7 +807,7 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio if(!compfaces.empty()) { bool same_color = true; - uint32_t style = compfaces.front().style; + const uint32_t style = compfaces.front().style; for(PRCcompfaceList::const_iterator fit=compfaces.begin(); fit!=compfaces.end(); fit++) if(style!=fit->style) { @@ -723,14 +866,20 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio } } - PRCProductOccurrence *product_occurrence = new PRCProductOccurrence(name); - - for(PRCgroupList::iterator it=group.groupList.begin(); it!=group.groupList.end(); it++) + // Simplify and reduce to as simple entities as possible + // products with named representation items can not be reduced to sets, since + // outside references are already set + bool nonamedparts = true; + for(PRCRepresentationItemList::const_iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++) { - doGroup(*it, part_definition, product_occurrence); + if (!(*it)->name.empty()) + { + nonamedparts = false; + break; } - - // Simplify and reduce to as simple entities as possible + } + lastgroupname.clear(); + lastgroupnames.clear(); // First option - reduce to one element in parent if (parent_part_definition && product_occurrence->index_son_occurrence.empty() && part_definition->representation_item.size() == 1 && @@ -741,32 +890,52 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio part_definition->representation_item.front()->name = name; if(part_definition->representation_item.front()->index_local_coordinate_system==m1) part_definition->representation_item.front()->index_local_coordinate_system = addTransform(group.transform); + lastgroupname = calculate_unique_name(part_definition->representation_item.front(), parent_product_occurrence); parent_part_definition->addRepresentationItem(part_definition->representation_item.front()); part_definition->representation_item.clear(); - delete product_occurrence; - delete part_definition; + delete product_occurrence; product_occurrence = NULL; + delete part_definition; part_definition = NULL; } // Second option - reduce to a set else if (parent_part_definition && product_occurrence->index_son_occurrence.empty() && !part_definition->representation_item.empty() && - !group.options.do_break ) + !group.options.do_break && nonamedparts) { PRCSet *set = new PRCSet(name); set->index_local_coordinate_system = addTransform(group.transform); + lastgroupname = calculate_unique_name(set, parent_product_occurrence); for(PRCRepresentationItemList::iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++) + { + lastgroupnames.push_back(calculate_unique_name(*it, parent_product_occurrence)); set->addRepresentationItem(*it); + } part_definition->representation_item.clear(); parent_part_definition->addSet(set); - delete product_occurrence; - delete part_definition; + delete product_occurrence; product_occurrence = NULL; + delete part_definition; part_definition = NULL; } // Third option - create product else if ( !product_occurrence->index_son_occurrence.empty() || !part_definition->representation_item.empty()) { - if (part_definition->representation_item.empty()) - delete part_definition; + // if everything is enclosed in one group - drop the root group + if (parent_product_occurrence == NULL && group.transform == NULL && + part_definition->representation_item.empty() && product_occurrence->index_son_occurrence.size()==1) { + delete part_definition; part_definition = NULL; + delete product_occurrence; product_occurrence = NULL; + } else + { + lastgroupname = calculate_unique_name(product_occurrence, NULL); + if (part_definition->representation_item.empty()) { + delete part_definition; part_definition = NULL; + } + else + { + for(PRCRepresentationItemList::const_iterator it=part_definition->representation_item.begin(); it!=part_definition->representation_item.end(); it++) + if ((*it)->name.empty()) + lastgroupnames.push_back(calculate_unique_name(*it, product_occurrence)); product_occurrence->index_part = addPartDefinition(part_definition); + } if (group.transform) { product_occurrence->location = group.transform; group.transform = NULL; @@ -778,19 +947,61 @@ void oPRCFile::doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definitio addProductOccurrence(product_occurrence); } } + } // Last case - absolutely nothing to do else { - delete product_occurrence; - delete part_definition; + delete product_occurrence; product_occurrence = NULL; + delete part_definition; part_definition = NULL; } } +std::string oPRCFile::calculate_unique_name(const ContentPRCBase *prc_entity,const ContentPRCBase *prc_occurence) +{ + std::stringstream ss (std::stringstream::in | std::stringstream::out); + uint8_t *serialization_buffer = NULL; + PRCbitStream serialization(serialization_buffer,0u); + const PRCFileStructure *pfile_structure = fileStructures[0]; + const PRCUniqueId& uuid = pfile_structure->file_structure_uuid; +// ConvertUniqueIdentifierToString (prc_entity) +// SerializeCompressedUniqueId (file_structure) + serialization << uuid.id0 << uuid.id1 << uuid.id2 << uuid.id3; +// WriteUnsignedInteger (type) + serialization << prc_entity->getType(); +// WriteUnsignedInteger (unique_identifier) + serialization << prc_entity->getPRCID(); + if (prc_occurence) + { +// serialization_buffer = Flush serialization (serialization) + { + const uint32_t size_serialization = serialization.getSize(); + while(size_serialization == serialization.getSize()) + serialization << false; + } +// ConvertUniqueIdentifierToString (prc_occurrence_unique_id) +// SerializeCompressedUniqueId (file_structure) + serialization << uuid.id0 << uuid.id1 << uuid.id2 << uuid.id3; +// WriteUnsignedInteger (type) + serialization << (uint32_t)PRC_TYPE_ASM_ProductOccurence; +// WriteUnsignedInteger (unique_identifier) + serialization << prc_occurence->getPRCID(); + } + ss << (prc_entity->name.empty()?"node":prc_entity->name) << '.'; + const uint32_t size_serialization = serialization.getSize(); + for(size_t j=0; j<size_serialization; j++) + ss << hex << setfill('0') << setw(2) << (uint32_t)(serialization_buffer[j]); + + return ss.str(); +} + bool oPRCFile::finish() { - rootGroup.name = "root"; - doGroup(rootGroup, NULL, NULL); + if(groups.size()!=1) { + fputs("begingroup without matching endgroup",stderr); + exit(1); + } + doGroup(groups.top()); // write each section's bit data fileStructures[0]->prepare(); @@ -861,22 +1072,40 @@ uint32_t oPRCFile::getSize() uint32_t PRCFileStructure::addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *p, uint32_t width, uint32_t height, string name) { + uint8_t *data = NULL; + uint32_t components=0; + PRCPicture picture(name); if(size==0 || p==NULL) { cerr << "image not set" << endl; return m1; } - PRCPicture picture(name); PRCUncompressedFile* uncompressed_file = new PRCUncompressedFile; - uint32_t components=0; - uint8_t *data = NULL; + if(format==KEPRCPicture_PNG || format==KEPRCPicture_JPG) + { + data = new uint8_t[size]; + memcpy(data, p, size); + uncompressed_files.push_back(uncompressed_file); + uncompressed_files.back()->file_size = size; + uncompressed_files.back()->data = data; + picture.format = format; + picture.uncompressed_file_index = uncompressed_files.size()-1; + picture.pixel_width = 0; // width and height are ignored for JPG and PNG pictures - but let us keep things clean + picture.pixel_height = 0; + pictures.push_back(picture); + return pictures.size()-1; + } + switch(format) { case KEPRCPicture_BITMAP_RGB_BYTE: - components = 3; + components = 3; break; case KEPRCPicture_BITMAP_RGBA_BYTE: - components = 4; + components = 4; break; case KEPRCPicture_BITMAP_GREY_BYTE: - components = 1; + components = 1; break; case KEPRCPicture_BITMAP_GREYA_BYTE: - components = 2; + components = 2; break; + default: + { cerr << "unknown picture format" << endl; return m1; } + } if(width==0 || height==0) { cerr << "width or height parameter not set" << endl; return m1; } if (size < width*height*components) @@ -935,27 +1164,6 @@ uint32_t PRCFileStructure::addPicture(EPRCPictureDataFormat format, uint32_t siz picture.pixel_height = height; pictures.push_back(picture); return pictures.size()-1; - break; - - case KEPRCPicture_PNG: - case KEPRCPicture_JPG: - data = new uint8_t[size]; - memcpy(data, p, size); - uncompressed_files.push_back(uncompressed_file); - uncompressed_files.back()->file_size = size; - uncompressed_files.back()->data = data; - picture.format = format; - picture.uncompressed_file_index = uncompressed_files.size()-1; - picture.pixel_width = 0; // width and height are ignored for JPG and PNG pictures - but let us keep things clean - picture.pixel_height = 0; - pictures.push_back(picture); - return pictures.size()-1; - break; - - default: - { cerr << "unknown picture format" << endl; return m1; } - } - return m1; } uint32_t PRCFileStructure::addTextureDefinition(PRCTextureDefinition*& pTextureDefinition) @@ -985,11 +1193,10 @@ uint32_t PRCFileStructure::addRgbColorUnique(const PRCRgbColor &color) uint32_t oPRCFile::addColor(const PRCRgbColor &color) { PRCcolorMap::const_iterator pColor = colorMap.find(color); - uint32_t color_index = m1; if(pColor!=colorMap.end()) return pColor->second; // color_index = addRgbColorUnique(color); - color_index = fileStructures[0]->addRgbColor(color); + const uint32_t color_index = fileStructures[0]->addRgbColor(color); colorMap.insert(make_pair(color,color_index)); return color_index; } @@ -1043,106 +1250,213 @@ uint32_t oPRCFile::addTransform(PRCGeneralTransformation3d*& transform) if(pTransform!=transformMap.end()) return pTransform->second; PRCCoordinateSystem *coordinateSystem = new PRCCoordinateSystem(); + bool transform_replaced = false; + if( transform->M(0,1)==0 && transform->M(0,2)==0 && + transform->M(1,0)==0 && transform->M(1,2)==0 && + transform->M(2,0)==0 && transform->M(2,1)==0 && + transform->M(3,0)==0 && transform->M(3,1)==0 && transform->M(3,2)==0 && transform->M(3,3)==1 ) + { + transform_replaced = true; + PRCCartesianTransformation3d *carttransform = new PRCCartesianTransformation3d; +// if(transform->M(0,3)==0 && transform->M(1,3)==0 && transform->M(1,3)==0 && +// transform->M(0,0)==1 && transform->M(1,1)==1 && transform->M(2,2)==1 ) +// carttransform->behaviour = PRC_TRANSFORMATION_Identity; + if(transform->M(0,3)!=0 || transform->M(1,3)!=0 || transform->M(2,3)!=0) + { + carttransform->behaviour |= PRC_TRANSFORMATION_Translate; + carttransform->origin.Set(transform->M(0,3),transform->M(1,3),transform->M(2,3)); + } + if(transform->M(0,0)!=transform->M(1,1) || transform->M(0,0)!=transform->M(2,2)) + { + carttransform->behaviour |= PRC_TRANSFORMATION_NonUniformScale; + carttransform->scale.Set(transform->M(0,0),transform->M(1,1),transform->M(2,2)); + } + else + if(transform->M(0,0)!=1) + { + carttransform->behaviour |= PRC_TRANSFORMATION_Scale; + carttransform->uniform_scale=transform->M(0,0); + } + coordinateSystem->axis_set = carttransform; + } + else coordinateSystem->axis_set = transform; const uint32_t coordinate_system_index = fileStructures[0]->addCoordinateSystem(coordinateSystem); transformMap.insert(make_pair(*transform,coordinate_system_index)); + if(transform_replaced) + delete transform; transform = NULL; return coordinate_system_index; } -uint32_t oPRCFile::addMaterial(const PRCmaterial &material) +uint32_t oPRCFile::addTransform(const double* t) +{ + if(!t) + return m1; + PRCGeneralTransformation3d* transform = new PRCGeneralTransformation3d(t); + return addTransform(transform); +} + +uint32_t oPRCFile::addTransform(const double origin[3], const double x_axis[3], const double y_axis[3], double scale) +{ + PRCCartesianTransformation3d* transform = new PRCCartesianTransformation3d(origin, x_axis, y_axis, scale); + if(transform->behaviour==PRC_TRANSFORMATION_Identity) + return m1; + PRCCoordinateSystem *coordinateSystem = new PRCCoordinateSystem(); + coordinateSystem->axis_set = transform; + const uint32_t coordinate_system_index = fileStructures[0]->addCoordinateSystem(coordinateSystem); + return coordinate_system_index; +} + +uint32_t oPRCFile::addMaterial(const PRCmaterial& m) +{ + uint32_t material_index = m1; + const PRCmaterialgeneric materialgeneric(m); + PRCmaterialgenericMap::const_iterator pMaterialgeneric = materialgenericMap.find(materialgeneric); + if(pMaterialgeneric!=materialgenericMap.end()) + material_index = pMaterialgeneric->second; + else { - PRCmaterialMap::const_iterator pMaterial = materialMap.find(material); - if(pMaterial!=materialMap.end()) - return pMaterial->second; PRCMaterialGeneric *materialGeneric = new PRCMaterialGeneric(); - const PRCRgbColor ambient(material.ambient.R, material.ambient.G, material.ambient.B); + const PRCRgbColor ambient(m.ambient.R, m.ambient.G, m.ambient.B); materialGeneric->ambient = addColor(ambient); - const PRCRgbColor diffuse(material.diffuse.R, material.diffuse.G, material.diffuse.B); + const PRCRgbColor diffuse(m.diffuse.R, m.diffuse.G, m.diffuse.B); materialGeneric->diffuse = addColor(diffuse); - const PRCRgbColor emissive(material.emissive.R, material.emissive.G, material.emissive.B); + const PRCRgbColor emissive(m.emissive.R, m.emissive.G, m.emissive.B); + materialGeneric->emissive = addColor(emissive); - const PRCRgbColor specular(material.specular.R, material.specular.G, material.specular.B); + const PRCRgbColor specular(m.specular.R, m.specular.G, m.specular.B); materialGeneric->specular = addColor(specular); - materialGeneric->shininess = material.shininess; - materialGeneric->ambient_alpha = material.ambient.A; - materialGeneric->diffuse_alpha = material.diffuse.A; - materialGeneric->emissive_alpha = material.emissive.A; - materialGeneric->specular_alpha = material.specular.A; - const uint32_t material_index = addMaterialGeneric(materialGeneric); - PRCStyle *style = new PRCStyle(); - style->line_width = 0.0; - style->is_vpicture = false; - style->line_pattern_vpicture_index = 0; - style->is_material = true; - style->is_transparency_defined = (material.alpha < 1.0); - style->transparency = (uint8_t)(material.alpha * 256); - style->additional = 0; - if(material.picture!=NULL && material.picture_width!=0 && material.picture_height!=0) + + materialGeneric->shininess = m.shininess; + materialGeneric->ambient_alpha = m.ambient.A; + materialGeneric->diffuse_alpha = m.diffuse.A; + materialGeneric->emissive_alpha = m.emissive.A; + materialGeneric->specular_alpha = m.specular.A; + material_index = addMaterialGeneric(materialGeneric); + materialgenericMap.insert(make_pair(materialgeneric,material_index)); + } + uint32_t color_material_index = m1; + if(m.picture_data!=NULL) { - const uint32_t picture_index = - addPicture((material.picture_rgba?KEPRCPicture_BITMAP_RGBA_BYTE:KEPRCPicture_BITMAP_RGB_BYTE), - material.picture_width*material.picture_height*(material.picture_rgba?4:3),material.picture,material.picture_width,material.picture_height); - PRCTextureDefinition *textureDefinition = new PRCTextureDefinition; - textureDefinition->picture_index = picture_index; - textureDefinition->texture_function = material.picture_replace ? KEPRCTextureFunction_Replace : KEPRCTextureFunction_Modulate; - textureDefinition->texture_wrapping_mode_S = KEPRCTextureWrappingMode_ClampToEdge; - textureDefinition->texture_wrapping_mode_T = KEPRCTextureWrappingMode_ClampToEdge; - textureDefinition->texture_mapping_attribute_components = material.picture_rgba ? PRC_TEXTURE_MAPPING_COMPONENTS_RGBA : PRC_TEXTURE_MAPPING_COMPONENTS_RGB; - const uint32_t texture_definition_index = addTextureDefinition(textureDefinition); - PRCTextureApplication *textureApplication = new PRCTextureApplication; - textureApplication->material_generic_index = material_index; - textureApplication->texture_definition_index = texture_definition_index; - const uint32_t texture_application_index = addTextureApplication(textureApplication); - style->color_material_index = texture_application_index; + uint32_t picture_index = m1; + PRCpicture picture(m); + PRCpictureMap::const_iterator pPicture = pictureMap.find(picture); + if(pPicture!=pictureMap.end()) + picture_index = pPicture->second; + else + { + picture_index = addPicture(picture); + uint8_t* data = new uint8_t[picture.size]; + memcpy(data,picture.data,picture.size); + picture.data = data; + pictureMap.insert(make_pair(picture,picture_index)); + } + + uint32_t texture_definition_index = m1; + PRCtexturedefinition texturedefinition(picture_index, m); + PRCtexturedefinitionMap::const_iterator pTexturedefinition = texturedefinitionMap.find(texturedefinition); + if(pTexturedefinition!=texturedefinitionMap.end()) + texture_definition_index = pTexturedefinition->second; + else + { + PRCTextureDefinition *TextureDefinition = new PRCTextureDefinition; + if (m.picture_size==216688 && m.picture_format==KEPRCPicture_JPG) + TextureDefinition->texture_mapping_attribute=PRC_TEXTURE_MAPPING_OPACITY; + TextureDefinition->picture_index = picture_index; + TextureDefinition->texture_function = m.picture_replace ? KEPRCTextureFunction_Replace : KEPRCTextureFunction_Modulate; + TextureDefinition->texture_wrapping_mode_S = m.picture_repeat ? KEPRCTextureWrappingMode_Repeat : KEPRCTextureWrappingMode_ClampToEdge; + TextureDefinition->texture_wrapping_mode_T = m.picture_repeat ? KEPRCTextureWrappingMode_Repeat : KEPRCTextureWrappingMode_ClampToEdge; + TextureDefinition->texture_mapping_attribute_components = (m.picture_format==KEPRCPicture_BITMAP_RGB_BYTE || m.picture_format==KEPRCPicture_JPG) ? PRC_TEXTURE_MAPPING_COMPONENTS_RGB : PRC_TEXTURE_MAPPING_COMPONENTS_RGBA; + texture_definition_index = addTextureDefinition(TextureDefinition); + texturedefinitionMap.insert(make_pair(texturedefinition,texture_definition_index)); + } + + uint32_t texture_application_index = m1; + const PRCtextureapplication textureapplication(material_index, texture_definition_index); + PRCtextureapplicationMap::const_iterator pTextureapplication = textureapplicationMap.find(textureapplication); + if(pTextureapplication!=textureapplicationMap.end()) + texture_application_index = pTextureapplication->second; + else + { + PRCTextureApplication *TextureApplication = new PRCTextureApplication; + TextureApplication->material_generic_index = material_index; + TextureApplication->texture_definition_index = texture_definition_index; + texture_application_index = addTextureApplication(TextureApplication); + textureapplicationMap.insert(make_pair(textureapplication,texture_application_index)); + } + + color_material_index = texture_application_index; } else - style->color_material_index = material_index; - const uint32_t style_index = addStyle(style); - materialMap.insert(make_pair(material,style_index)); - return style_index; -} + color_material_index = material_index; -bool isid(const double t[][4]) -{ - return t == NULL || - (t[0][0]==1 && t[0][1]==0 && t[0][2]==0 && t[0][3]==0 && - t[1][0]==0 && t[1][1]==1 && t[1][2]==0 && t[1][3]==0 && - t[2][0]==0 && t[2][1]==0 && t[2][2]==1 && t[2][3]==0 && - t[3][0]==0 && t[3][1]==0 && t[3][2]==0 && t[3][3]==1); + uint32_t style_index = m1; + PRCstyle style(0,m.alpha,true,color_material_index); + PRCstyleMap::const_iterator pStyle = styleMap.find(style); + if(pStyle!=styleMap.end()) + style_index = pStyle->second; + else + { + PRCStyle *Style = new PRCStyle(); + Style->line_width = 0.0; + Style->is_vpicture = false; + Style->line_pattern_vpicture_index = 0; + Style->is_material = true; + Style->is_transparency_defined = (m.alpha < 1.0); + Style->transparency = (uint8_t)(m.alpha * 256); + Style->additional = 0; + Style->color_material_index = color_material_index; + style_index = addStyle(Style); + styleMap.insert(make_pair(style,style_index)); + } +// materialMap.insert(make_pair(material,style_index)); + return style_index; } -bool isid(const double t[]) + +bool isid(const double* t) { - return(isid((double (*)[4])t)); + return( + t[0]==1 && t[4]==0 && t[ 8]==0 && t[12]==0 && + t[1]==0 && t[5]==1 && t[ 9]==0 && t[13]==0 && + t[2]==0 && t[6]==0 && t[10]==1 && t[14]==0 && + t[3]==0 && t[7]==0 && t[11]==0 && t[15]==1 ); } - void oPRCFile::begingroup(const char *name, PRCoptions *options, - const double t[][4]) + const double* t) { - if(currentGroups.empty()) - currentGroups.push(rootGroup.groupList.insert(rootGroup.groupList.end(),PRCgroup())); - else - currentGroups.push(currentGroups.top()->groupList.insert(currentGroups.top()->groupList.end(),PRCgroup())); - PRCgroup &group = *(currentGroups.top()); + const PRCgroup &parent_group = groups.top(); + groups.push(PRCgroup()); + PRCgroup &group = groups.top(); group.name=name; if(options) group.options=*options; if(t&&!isid(t)) group.transform = new PRCGeneralTransformation3d(t); + group.product_occurrence = new PRCProductOccurrence(name); + group.parent_product_occurrence = parent_group.product_occurrence; + group.part_definition = new PRCPartDefinition; + group.parent_part_definition = parent_group.part_definition; } void oPRCFile::endgroup() { - if(!currentGroups.empty()) - currentGroups.pop(); + if(groups.size()<2) { + fputs("begingroup without matching endgroup",stderr); + exit(1); + } + doGroup(groups.top()); + groups.pop(); + +// std::cout << lastgroupname << std::endl; +// for(std::vector<std::string>::const_iterator it=lastgroupnames.begin(); it!=lastgroupnames.end(); it++) +// std::cout << " " << *it << std::endl; + } PRCgroup& oPRCFile::findGroup() { - if(!currentGroups.empty()) - return *(currentGroups.top()); - else - return rootGroup; + return groups.top(); } #define ADDWIRE(curvtype) \ @@ -1186,21 +1500,75 @@ void oPRCFile::addPoints(uint32_t n, const double P[][3], const RGBAColour &c, d PRCPointSet *pointset = new PRCPointSet(); group.pointsets.push_back(pointset); pointset->index_of_line_style = addColourWidth(c,w); + pointset->point.reserve(n); for(uint32_t i=0; i<n; i++) pointset->point.push_back(PRCVector3d(P[i][0],P[i][1],P[i][2])); } +void oPRCFile::useMesh(uint32_t tess_index, uint32_t style_index, const double origin[3], const double x_axis[3], const double y_axis[3], double scale) +{ + PRCgroup &group = findGroup(); + PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); + polyBrepModel->index_local_coordinate_system = addTransform(origin, x_axis, y_axis, scale); + polyBrepModel->index_tessellation = tess_index; + polyBrepModel->is_closed = group.options.closed; + polyBrepModel->index_of_line_style = style_index; + group.polymodels.push_back(polyBrepModel); +} + +void oPRCFile::useMesh(uint32_t tess_index, uint32_t style_index, const double* t) +{ + PRCgroup &group = findGroup(); + PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); + polyBrepModel->index_local_coordinate_system = addTransform(t); + polyBrepModel->index_tessellation = tess_index; + polyBrepModel->is_closed = group.options.closed; + polyBrepModel->index_of_line_style = style_index; + group.polymodels.push_back(polyBrepModel); +} + +void oPRCFile::useLines(uint32_t tess_index, uint32_t style_index, const double origin[3], const double x_axis[3], const double y_axis[3], double scale) +{ + PRCgroup &group = findGroup(); + PRCPolyWire *polyWire = new PRCPolyWire(); + polyWire->index_local_coordinate_system = addTransform(origin, x_axis, y_axis, scale); + polyWire->index_tessellation = tess_index; + polyWire->index_of_line_style = style_index; + group.polywires.push_back(polyWire); +} + +void oPRCFile::useLines(uint32_t tess_index, uint32_t style_index, const double* t) +{ + PRCgroup &group = findGroup(); + PRCPolyWire *polyWire = new PRCPolyWire(); + polyWire->index_local_coordinate_system = addTransform(t); + polyWire->index_tessellation = tess_index; + polyWire->index_of_line_style = style_index; + group.polywires.push_back(polyWire); +} + void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][3], const PRCmaterial &m, uint32_t nN, const double N[][3], const uint32_t NI[][3], uint32_t nT, const double T[][2], const uint32_t TI[][3], uint32_t nC, const RGBAColour C[], const uint32_t CI[][3], - uint32_t nM, const PRCmaterial M[], const uint32_t MI[]) + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca) { if(nP==0 || P==NULL || nI==0 || PI==NULL) return; - PRCgroup &group = findGroup(); + const uint32_t tess_index = createTriangleMesh(nP, P, nI, PI, m, nN, N, NI, nT, T, TI, nC, C, CI, nM, M, MI, ca); + useMesh(tess_index,m1); +} - const bool triangle_color = (nM != 0 && M != NULL && MI != NULL); +uint32_t oPRCFile::createTriangleMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][3], const uint32_t style_index, + uint32_t nN, const double N[][3], const uint32_t NI[][3], + uint32_t nT, const double T[][2], const uint32_t TI[][3], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][3], + uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca) +{ + if(nP==0 || P==NULL || nI==0 || PI==NULL) + return m1; + + const bool triangle_color = (nS != 0 && S != NULL && SI != NULL); const bool vertex_color = (nC != 0 && C != NULL && CI != NULL); const bool has_normals = (nN != 0 && N != NULL && NI != NULL); const bool textured = (nT != 0 && T != NULL && TI != NULL); @@ -1209,6 +1577,7 @@ void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const PRCTessFace *tessFace = new PRCTessFace(); tessFace->used_entities_flag = textured ? PRC_FACETESSDATA_TriangleTextured : PRC_FACETESSDATA_Triangle; tessFace->number_of_texture_coordinate_indexes = textured ? 1 : 0; + tess->coordinates.reserve(3*nP); for(uint32_t i=0; i<nP; i++) { tess->coordinates.push_back(P[i][0]); @@ -1216,18 +1585,27 @@ void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const tess->coordinates.push_back(P[i][2]); } if(has_normals) + { + tess->normal_coordinate.reserve(3*nN); for(uint32_t i=0; i<nN; i++) { tess->normal_coordinate.push_back(N[i][0]); tess->normal_coordinate.push_back(N[i][1]); tess->normal_coordinate.push_back(N[i][2]); } + } + else + tess->crease_angle = ca; if(textured) + { + tess->texture_coordinate.reserve(2*nT); for(uint32_t i=0; i<nT; i++) { tess->texture_coordinate.push_back(T[i][0]); tess->texture_coordinate.push_back(T[i][1]); } + } + tess->triangulated_index.reserve(3*nI+(has_normals?3:0)*nI+(textured?3:0)*nI); for(uint32_t i=0; i<nI; i++) { if(has_normals) @@ -1249,18 +1627,14 @@ void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const tessFace->sizes_triangulated.push_back(nI); if(triangle_color) { -#ifdef __GNUC__ - uint32_t styles[nM]; -#else - std::vector<uint32_t> styles(nM); -#endif - for(uint32_t i=0; i<nM; i++) - styles[i] = addMaterial(M[i]); + tessFace->line_attributes.reserve(nI); for(uint32_t i=0; i<nI; i++) - tessFace->line_attributes.push_back(styles[MI[i]]); + tessFace->line_attributes.push_back(SI[i]); + } + else if (style_index != m1 ) + { + tessFace->line_attributes.push_back(style_index); } - else - tessFace->line_attributes.push_back(addMaterial(m)); if(vertex_color) { tessFace->is_rgba=false; @@ -1271,6 +1645,7 @@ void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const break; } + tessFace->rgba_vertices.reserve((tessFace->is_rgba?4:3)*3*nI); for(uint32_t i=0; i<nI; i++) { tessFace->rgba_vertices.push_back(byte(C[CI[i][0]].R)); @@ -1292,25 +1667,31 @@ void oPRCFile::addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const } tess->addTessFace(tessFace); const uint32_t tess_index = add3DTess(tess); - PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); - polyBrepModel->index_tessellation = tess_index; - polyBrepModel->is_closed = group.options.closed; -// if(!triangle_color) -// polyBrepModel->index_of_line_style = addMaterial(m); - group.polymodels.push_back(polyBrepModel); + return tess_index; } void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial &m, uint32_t nN, const double N[][3], const uint32_t NI[][4], uint32_t nT, const double T[][2], const uint32_t TI[][4], uint32_t nC, const RGBAColour C[], const uint32_t CI[][4], - uint32_t nM, const PRCmaterial M[], const uint32_t MI[]) + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca) { if(nP==0 || P==NULL || nI==0 || PI==NULL) return; - PRCgroup &group = findGroup(); + const uint32_t tess_index = createQuadMesh(nP, P, nI, PI, m, nN, N, NI, nT, T, TI, nC, C, CI, nM, M, MI, ca); + useMesh(tess_index,m1); +} - const bool triangle_color = (nM != 0 && M != NULL && MI != NULL); +uint32_t oPRCFile::createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], uint32_t style_index, + uint32_t nN, const double N[][3], const uint32_t NI[][4], + uint32_t nT, const double T[][2], const uint32_t TI[][4], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][4], + uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca) +{ + if(nP==0 || P==NULL || nI==0 || PI==NULL) + return m1; + + const bool triangle_color = (nS != 0 && S != NULL && SI != NULL); const bool vertex_color = (nC != 0 && C != NULL && CI != NULL); const bool has_normals = (nN != 0 && N != NULL && NI != NULL); const bool textured = (nT != 0 && T != NULL && TI != NULL); @@ -1319,6 +1700,7 @@ void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uin PRCTessFace *tessFace = new PRCTessFace(); tessFace->used_entities_flag = textured ? PRC_FACETESSDATA_TriangleTextured : PRC_FACETESSDATA_Triangle; tessFace->number_of_texture_coordinate_indexes = textured ? 1 : 0; + tess->coordinates.reserve(3*nP); for(uint32_t i=0; i<nP; i++) { tess->coordinates.push_back(P[i][0]); @@ -1326,18 +1708,27 @@ void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uin tess->coordinates.push_back(P[i][2]); } if(has_normals) + { + tess->normal_coordinate.reserve(3*nN); for(uint32_t i=0; i<nN; i++) { tess->normal_coordinate.push_back(N[i][0]); tess->normal_coordinate.push_back(N[i][1]); tess->normal_coordinate.push_back(N[i][2]); } + } + else + tess->crease_angle = ca; if(textured) + { + tess->texture_coordinate.reserve(2*nT); for(uint32_t i=0; i<nT; i++) { tess->texture_coordinate.push_back(T[i][0]); tess->texture_coordinate.push_back(T[i][1]); } + } + tess->triangulated_index.reserve(2*(3*nI+(has_normals?3:0)*nI+(textured?3:0)*nI)); for(uint32_t i=0; i<nI; i++) { // first triangle @@ -1376,21 +1767,17 @@ void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uin tessFace->sizes_triangulated.push_back(2*nI); if(triangle_color) { -#ifdef __GNUC__ - uint32_t styles[nM]; -#else - std::vector<uint32_t> styles(nM); -#endif - for(uint32_t i=0; i<nM; i++) - styles[i] = addMaterial(M[i]); + tessFace->line_attributes.reserve(2*nI); for(uint32_t i=0; i<nI; i++) { - tessFace->line_attributes.push_back(styles[MI[i]]); - tessFace->line_attributes.push_back(styles[MI[i]]); + tessFace->line_attributes.push_back(SI[i]); + tessFace->line_attributes.push_back(SI[i]); } } else - tessFace->line_attributes.push_back(addMaterial(m)); + { + tessFace->line_attributes.push_back(style_index); + } if(vertex_color) { tessFace->is_rgba=false; @@ -1401,6 +1788,7 @@ void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uin break; } + tessFace->rgba_vertices.reserve(2*(tessFace->is_rgba?4:3)*3*nI); for(uint32_t i=0; i<nI; i++) { // first triangle @@ -1439,105 +1827,69 @@ void oPRCFile::addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uin } tess->addTessFace(tessFace); const uint32_t tess_index = add3DTess(tess); - PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); - polyBrepModel->index_tessellation = tess_index; - polyBrepModel->is_closed = group.options.closed; -// if(!triangle_color) -// polyBrepModel->index_of_line_style = addMaterial(m); - group.polymodels.push_back(polyBrepModel); + return tess_index; } void oPRCFile::addQuad(const double P[][3], const RGBAColour C[]) { PRCgroup &group = findGroup(); - PRC3DTess *tess = new PRC3DTess(); - PRCTessFace *tessFace = new PRCTessFace(); - tessFace->used_entities_flag = PRC_FACETESSDATA_Triangle; - tessFace->number_of_texture_coordinate_indexes = 0; - for(uint32_t i=0; i < 4; i++) + group.quads.push_back(PRCtessquad()); + PRCtessquad &quad = group.quads.back(); + for(size_t i = 0; i < 4; i++) { - tess->coordinates.push_back(P[i][0]); - tess->coordinates.push_back(P[i][1]); - tess->coordinates.push_back(P[i][2]); + quad.vertices[i].x = P[i][0]; + quad.vertices[i].y = P[i][1]; + quad.vertices[i].z = P[i][2]; + quad.colours[i] = C[i]; } +} +/* +void oPRCFile::addTriangle(const double P[][3], const double T[][2], uint32_t style_index) +{ + PRCgroup &group = findGroup(); - tess->triangulated_index.push_back(3*0); - tess->triangulated_index.push_back(3*1); - tess->triangulated_index.push_back(3*2); - - tess->triangulated_index.push_back(3*1); - tess->triangulated_index.push_back(3*3); - tess->triangulated_index.push_back(3*2); - - tessFace->sizes_triangulated.push_back(2); - - tessFace->is_rgba= - (C[0].A != 1.0 || C[1].A != 1.0 || C[2].A != 1.0 || C[3].A != 1.0); - - // first triangle - tessFace->rgba_vertices.push_back(byte(C[0].R)); - tessFace->rgba_vertices.push_back(byte(C[0].G)); - tessFace->rgba_vertices.push_back(byte(C[0].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[0].A)); - - tessFace->rgba_vertices.push_back(byte(C[1].R)); - tessFace->rgba_vertices.push_back(byte(C[1].G)); - tessFace->rgba_vertices.push_back(byte(C[1].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[1].A)); - - tessFace->rgba_vertices.push_back(byte(C[2].R)); - tessFace->rgba_vertices.push_back(byte(C[2].G)); - tessFace->rgba_vertices.push_back(byte(C[2].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[2].A)); - - // second triangle - tessFace->rgba_vertices.push_back(byte(C[1].R)); - tessFace->rgba_vertices.push_back(byte(C[1].G)); - tessFace->rgba_vertices.push_back(byte(C[1].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[1].A)); - - tessFace->rgba_vertices.push_back(byte(C[3].R)); - tessFace->rgba_vertices.push_back(byte(C[3].G)); - tessFace->rgba_vertices.push_back(byte(C[3].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[3].A)); - - tessFace->rgba_vertices.push_back(byte(C[2].R)); - tessFace->rgba_vertices.push_back(byte(C[2].G)); - tessFace->rgba_vertices.push_back(byte(C[2].B)); - if(tessFace->is_rgba) - tessFace->rgba_vertices.push_back(byte(C[2].A)); - - tess->addTessFace(tessFace); - const uint32_t tess_index = add3DTess(tess); - PRCPolyBrepModel *polyBrepModel = new PRCPolyBrepModel(); - polyBrepModel->index_tessellation = tess_index; - polyBrepModel->is_closed = group.options.closed; - group.polymodels.push_back(polyBrepModel); + group.triangles.push_back(PRCtesstriangle()); + PRCtesstriangle &triangle = group.triangles.back(); + for(size_t i = 0; i < 3; i++) + { + triangle.vertices[i].x = P[i][0]; + triangle.vertices[i].y = P[i][1]; + triangle.vertices[i].z = P[i][2]; + triangle.texcoords[i].x = T[i][0]; + triangle.texcoords[i].y = T[i][1]; + } + triangle.style = style_index; } +*/ void oPRCFile::addLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[], - const RGBAColour &c, double w, bool segment_color, - uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]) + const RGBAColour& c, double w, + bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]) { if(nP==0 || P==NULL || nI==0 || PI==NULL) return; + const uint32_t tess_index = createLines(nP, P, nI, PI, segment_color, nC, C, nCI, CI); + useLines(tess_index, c, w); +} + +uint32_t oPRCFile::createLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[], + bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]) +{ + if(nP==0 || P==NULL || nI==0 || PI==NULL) + return m1; const bool vertex_color = (nC != 0 && C != NULL && CI != NULL); - PRCgroup &group = findGroup(); PRC3DWireTess *tess = new PRC3DWireTess(); + tess->coordinates.reserve(3*nP); for(uint32_t i=0; i<nP; i++) { tess->coordinates.push_back(P[i][0]); tess->coordinates.push_back(P[i][1]); tess->coordinates.push_back(P[i][2]); } + tess->wire_indexes.reserve(nI); for(uint32_t i=0; i<nI;) { tess->wire_indexes.push_back(PI[i]); @@ -1555,7 +1907,7 @@ void oPRCFile::addLines(uint32_t nP, const double P[][3], uint32_t nI, const uin tess->is_rgba=true; break; } - + tess->rgba_vertices.reserve((tess->is_rgba?4:3)*nCI); for(uint32_t i=0; i<nCI; i++) { tess->rgba_vertices.push_back(byte(C[CI[i]].R)); @@ -1566,13 +1918,7 @@ void oPRCFile::addLines(uint32_t nP, const double P[][3], uint32_t nI, const uin } } const uint32_t tess_index = add3DWireTess(tess); - PRCPolyWire *polyWire = new PRCPolyWire(); - polyWire->index_tessellation = tess_index; - if(vertex_color) - polyWire->index_of_line_style = addColourWidth(RGBAColour(1,1,1),w); - else - polyWire->index_of_line_style = addColourWidth(c,w); - group.polywires.push_back(polyWire); + return tess_index; } void oPRCFile::addLine(uint32_t n, const double P[][3], const RGBAColour &c, double w) @@ -1637,7 +1983,6 @@ void oPRCFile::addRectangle(const double P[][3], const PRCmaterial &m) PRCgroup &group = findGroup(); if(group.options.tess) { - PRCgroup &group = findGroup(); group.rectangles.push_back(PRCtessrectangle()); PRCtessrectangle &rectangle = group.rectangles.back(); rectangle.style = addMaterial(m); @@ -1755,15 +2100,15 @@ void oPRCFile::addSurface(uint32_t dU, uint32_t dV, uint32_t nU, uint32_t nV, if(y_axis) surface->y_axis.Set(y_axis[0],y_axis[1],y_axis[2]); \ surface->scale = scale; \ surface->geometry_is_2D = false; \ - if(surface->origin!=PRCVector3d(0,0,0)) \ + if(surface->origin!=PRCVector3d(0.0,0.0,0.0)) \ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Translate; \ - if(surface->x_axis!=PRCVector3d(1,0,0)||surface->y_axis!=PRCVector3d(0,1,0)) \ + if(surface->x_axis!=PRCVector3d(1.0,0.0,0.0)||surface->y_axis!=PRCVector3d(0.0,1.0,0.0)) \ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Rotate; \ if(surface->scale!=1) \ surface->behaviour = surface->behaviour | PRC_TRANSFORMATION_Scale; \ surface->has_transformation = (surface->behaviour != PRC_TRANSFORMATION_Identity); -#define PRCFACETRANSFORM const double origin[3], const double x_axis[3], const double y_axis[3], double scale, const double t[][4] +#define PRCFACETRANSFORM const double origin[3], const double x_axis[3], const double y_axis[3], double scale, const double* t void oPRCFile::addTube(uint32_t n, const double cP[][3], const double oP[][3], bool straight, const PRCmaterial &m, PRCFACETRANSFORM) { diff --git a/Build/source/utils/asymptote/prc/oPRCFile.h b/Build/source/utils/asymptote/prc/oPRCFile.h index 643a0ff6e44..29b7f20b880 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.h +++ b/Build/source/utils/asymptote/prc/oPRCFile.h @@ -25,9 +25,11 @@ #include <fstream> #include <vector> #include <map> +#include <set> #include <list> #include <stack> #include <string> +#include <cstring> #ifdef HAVE_CONFIG_H #include "config.h" @@ -46,6 +48,10 @@ struct RGBAColour R(r), G(g), B(b), A(a) {} double R,G,B,A; + void Set(double r, double g, double b, double a=1.0) + { + R = r; G = g; B = b; A = a; + } bool operator==(const RGBAColour &c) const { return (R==c.R && G==c.G && B==c.B && A==c.A); @@ -64,6 +70,11 @@ struct RGBAColour return (B<c.B); return (A<c.A); } + friend RGBAColour operator * (const RGBAColour& a, const double d) + { return RGBAColour(a.R*d,a.G*d,a.B*d,a.A*d); } + friend RGBAColour operator * (const double d, const RGBAColour& a) + { return RGBAColour(a.R*d,a.G*d,a.B*d,a.A*d); } + }; typedef std::map<RGBAColour,uint32_t> PRCcolourMap; @@ -101,26 +112,45 @@ typedef std::map<PRCRgbColor,uint32_t> PRCcolorMap; struct PRCmaterial { PRCmaterial() : alpha(1.0),shininess(1.0), - picture(NULL), picture_width(0), picture_height(0), picture_rgba(false), picture_replace(false) {} + picture_data(NULL), picture_format(KEPRCPicture_BITMAP_RGB_BYTE), picture_width(0), picture_height(0), picture_size(0), + picture_replace(false), picture_repeat(false) {} PRCmaterial(const RGBAColour &a, const RGBAColour &d, const RGBAColour &e, const RGBAColour &s, double p, double h, - const uint8_t* pic=NULL, uint32_t picw=0, uint32_t pich=0, bool pica=false, bool picr=false) : + const uint8_t* pic=NULL, EPRCPictureDataFormat picf=KEPRCPicture_BITMAP_RGB_BYTE, + uint32_t picw=0, uint32_t pich=0, uint32_t pics=0, bool picreplace=false, bool picrepeat=false) : ambient(a), diffuse(d), emissive(e), specular(s), alpha(p), shininess(h), - picture(pic), picture_width(picw), picture_height(pich), picture_rgba(pica), picture_replace(picr) {} + picture_data(pic), picture_format(picf), picture_width(picw), picture_height(pich), picture_size(pics), + picture_replace(picreplace), picture_repeat(picrepeat) { + if(picture_size==0) + { + if (picture_format==KEPRCPicture_BITMAP_RGB_BYTE) + picture_size = picture_width*picture_height*3; + if (picture_format==KEPRCPicture_BITMAP_RGBA_BYTE) + picture_size = picture_width*picture_height*4; + if (picture_format==KEPRCPicture_BITMAP_GREY_BYTE) + picture_size = picture_width*picture_height*1; + if (picture_format==KEPRCPicture_BITMAP_GREYA_BYTE) + picture_size = picture_width*picture_height*2; + } + } RGBAColour ambient,diffuse,emissive,specular; double alpha,shininess; - const uint8_t* picture; + const uint8_t* picture_data; + EPRCPictureDataFormat picture_format; uint32_t picture_width; uint32_t picture_height; - bool picture_rgba; // is there alpha component? + uint32_t picture_size; bool picture_replace; // replace material color with texture color? if false - just modify + bool picture_repeat; // repeat texture? if false - clamp to edge bool operator==(const PRCmaterial &m) const { return (ambient==m.ambient && diffuse==m.diffuse && emissive==m.emissive && specular==m.specular && alpha==m.alpha && shininess==m.shininess - && picture==m.picture && picture_width==m.picture_width && picture_height==m.picture_height - && picture_rgba==m.picture_rgba && picture_replace==m.picture_replace); + && picture_replace==m.picture_replace && picture_repeat==m.picture_repeat + && picture_format==m.picture_format + && picture_width==m.picture_width && picture_height==m.picture_height && picture_size==m.picture_size + && (picture_data==m.picture_data || memcmp(picture_data,m.picture_data,picture_size)==0) ); } bool operator<(const PRCmaterial &m) const { @@ -136,19 +166,201 @@ struct PRCmaterial return (alpha<m.alpha); if(shininess!=m.shininess) return (shininess<m.shininess); - if(picture!=m.picture) - return (picture<m.picture); + if(picture_replace!=m.picture_replace) + return (picture_replace<m.picture_replace); + if(picture_repeat!=m.picture_repeat) + return (picture_repeat<m.picture_repeat); + if(picture_format!=m.picture_format) + return (picture_format<m.picture_format); if(picture_width!=m.picture_width) return (picture_width<m.picture_width); if(picture_height!=m.picture_height) return (picture_height<m.picture_height); - if(picture_rgba!=m.picture_rgba) - return (picture_rgba<m.picture_rgba); - return (picture_replace<m.picture_replace); + if(picture_size!=m.picture_size) + return (picture_size<m.picture_size); + if(picture_data!=m.picture_data) + return (memcmp(picture_data,m.picture_data,picture_size)<0); + return false; } }; typedef std::map<PRCmaterial,uint32_t> PRCmaterialMap; +struct PRCpicture +{ + PRCpicture() : + data(NULL), format(KEPRCPicture_BITMAP_RGB_BYTE), + width(0), height(0), size(0) {} + PRCpicture(const uint8_t* pic, EPRCPictureDataFormat picf, + uint32_t picw, uint32_t pich, uint32_t pics=0) : + data(pic), format(picf), + width(picw), height(pich), size(pics) + { + if(size==0) + { + if (format==KEPRCPicture_BITMAP_RGB_BYTE) + size = width*height*3; + if (format==KEPRCPicture_BITMAP_RGBA_BYTE) + size = width*height*4; + if (format==KEPRCPicture_BITMAP_GREY_BYTE) + size = width*height*1; + if (format==KEPRCPicture_BITMAP_GREYA_BYTE) + size = width*height*2; + } + } + PRCpicture(const PRCmaterial& m) : + data(m.picture_data), format(m.picture_format), + width(m.picture_width), height(m.picture_height), size(m.picture_size) {} + + const uint8_t* data; + EPRCPictureDataFormat format; + uint32_t width; + uint32_t height; + uint32_t size; + bool operator==(const PRCpicture& p) const + { + return ( format==p.format + && width==p.width && height==p.height && size==p.size + && (data==p.data || memcmp(data,p.data,size)==0) ); + } + bool operator<(const PRCpicture& p) const + { + if(format!=p.format) + return (format<p.format); + if(width!=p.width) + return (width<p.width); + if(height!=p.height) + return (height<p.height); + if(size!=p.size) + return (size<p.size); + if(data!=p.data) + return (memcmp(data,p.data,size)<0); + return false; + } +}; + +typedef std::map<PRCpicture,uint32_t> PRCpictureMap; + +struct PRCmaterialgeneric +{ + PRCmaterialgeneric() : alpha(1.0),shininess(1.0) {} + PRCmaterialgeneric(const RGBAColour& a, const RGBAColour& d, const RGBAColour& e, + const RGBAColour& s, double p, double h) : + ambient(a), diffuse(d), emissive(e), specular(s), alpha(p), shininess(h) {} + PRCmaterialgeneric(const PRCmaterial& m) : + ambient(m.ambient), diffuse(m.diffuse), emissive(m.emissive), specular(m.specular), alpha(m.alpha), shininess(m.shininess) {} + RGBAColour ambient,diffuse,emissive,specular; + double alpha,shininess; + + bool operator==(const PRCmaterialgeneric& m) const + { + return (ambient==m.ambient && diffuse==m.diffuse && emissive==m.emissive + && specular==m.specular && alpha==m.alpha && shininess==m.shininess); + } + bool operator<(const PRCmaterialgeneric& m) const + { + if(ambient!=m.ambient) + return (ambient<m.ambient); + if(diffuse!=m.diffuse) + return (diffuse<m.diffuse); + if(emissive!=m.emissive) + return (emissive<m.emissive); + if(specular!=m.specular) + return (specular<m.specular); + if(alpha!=m.alpha) + return (alpha<m.alpha); + if(shininess!=m.shininess) + return (shininess<m.shininess); + return false; + } +}; +typedef std::map<PRCmaterialgeneric,uint32_t> PRCmaterialgenericMap; + +struct PRCtexturedefinition +{ + PRCtexturedefinition() : + picture_index(m1), picture_replace(false), picture_repeat(false) {} + PRCtexturedefinition(uint32_t picindex, bool picreplace=false, bool picrepeat=false) : + picture_index(picindex), picture_replace(picreplace), picture_repeat(picrepeat) {} + PRCtexturedefinition(uint32_t picindex, const PRCmaterial& m) : + picture_index(picindex), picture_replace(m.picture_replace), picture_repeat(m.picture_repeat) {} + uint32_t picture_index; + bool picture_replace; // replace material color with texture color? if false - just modify + bool picture_repeat; // repeat texture? if false - clamp to edge + + bool operator==(const PRCtexturedefinition& t) const + { + return (picture_index==t.picture_index + && picture_replace==t.picture_replace && picture_repeat==t.picture_repeat); + } + bool operator<(const PRCtexturedefinition& t) const + { + if(picture_index!=t.picture_index) + return (picture_index<t.picture_index); + if(picture_replace!=t.picture_replace) + return (picture_replace<t.picture_replace); + if(picture_repeat!=t.picture_repeat) + return (picture_repeat<t.picture_repeat); + return false; + } +}; +typedef std::map<PRCtexturedefinition,uint32_t> PRCtexturedefinitionMap; + +struct PRCtextureapplication +{ + PRCtextureapplication() : + material_generic_index(m1), texture_definition_index(m1) {} + PRCtextureapplication(uint32_t matindex, uint32_t texindex) : + material_generic_index(matindex), texture_definition_index(texindex) {} + uint32_t material_generic_index; + uint32_t texture_definition_index; + + bool operator==(const PRCtextureapplication& t) const + { + return (material_generic_index==t.material_generic_index + && texture_definition_index==t.texture_definition_index); + } + bool operator<(const PRCtextureapplication& t) const + { + if(material_generic_index!=t.material_generic_index) + return (material_generic_index<t.material_generic_index); + if(texture_definition_index!=t.texture_definition_index) + return (texture_definition_index<t.texture_definition_index); + return false; + } +}; +typedef std::map<PRCtextureapplication,uint32_t> PRCtextureapplicationMap; + +struct PRCstyle +{ + PRCstyle() : + line_width(0), alpha(1), is_material(false), color_material_index(m1) {} + PRCstyle(double linewidth, double alph, bool ismat, uint32_t colindex=m1) : + line_width(linewidth), alpha(alph), is_material(ismat), color_material_index(colindex) {} + double line_width; + double alpha; + bool is_material; + uint32_t color_material_index; + + bool operator==(const PRCstyle& s) const + { + return (line_width==s.line_width && alpha==s.alpha && is_material==s.is_material + && color_material_index==s.color_material_index); + } + bool operator<(const PRCstyle& s) const + { + if(line_width!=s.line_width) + return (line_width<s.line_width); + if(alpha!=s.alpha) + return (alpha<s.alpha); + if(is_material!=s.is_material) + return (is_material<s.is_material); + if(color_material_index!=s.color_material_index) + return (color_material_index<s.color_material_index); + return false; + } +}; +typedef std::map<PRCstyle,uint32_t> PRCstyleMap; + struct PRCtessrectangle // rectangle { PRCVector3d vertices[4]; @@ -156,15 +368,25 @@ struct PRCtessrectangle // rectangle }; typedef std::vector<PRCtessrectangle> PRCtessrectangleList; -struct PRCtesstriangles // triangle +struct PRCtessquad // rectangle { - std::vector<PRCVector3d> vertices; - std::vector<PRCVector3d> normals; - std::vector<RGBAColour> colors; + PRCVector3d vertices[4]; + RGBAColour colours[4]; +}; +typedef std::vector<PRCtessquad> PRCtessquadList; +/* +struct PRCtesstriangle // textured triangle +{ + PRCtesstriangle() : + style(m1) {} + PRCVector3d vertices[3]; +// PRCVector3d normals[3]; +// RGBAColour colors[3]; + PRCVector2d texcoords[3]; uint32_t style; }; -typedef std::vector<PRCtesstriangles> PRCtesstrianglesList; - +typedef std::vector<PRCtesstriangle> PRCtesstriangleList; +*/ struct PRCtessline // polyline { std::vector<PRCVector3d> point; @@ -213,33 +435,38 @@ public: bool tess; // use tessellated mesh to store straight patches bool do_break; // bool no_break; // do not render transparent patches as one-faced nodes + double crease_angle; // crease angle for meshes PRCoptions(double compression=0.0, double granularity=0.0, bool closed=false, - bool tess=false, bool do_break=true, bool no_break=false) + bool tess=false, bool do_break=true, bool no_break=false, double crease_angle=25.8419) : compression(compression), granularity(granularity), closed(closed), - tess(tess), do_break(do_break), no_break(no_break) {} + tess(tess), do_break(do_break), no_break(no_break), crease_angle(crease_angle) {} }; class PRCgroup { public: - PRCgroup() : transform(NULL) {} - PRCgroup(const std::string &name) : name(name), transform(NULL) {} + PRCgroup() : + product_occurrence(NULL), parent_product_occurrence(NULL), part_definition(NULL), parent_part_definition(NULL), transform(NULL) {} + PRCgroup(const std::string& name) : + product_occurrence(NULL), parent_product_occurrence(NULL), part_definition(NULL), parent_part_definition(NULL), transform(NULL), name(name) {} + PRCProductOccurrence *product_occurrence, *parent_product_occurrence; + PRCPartDefinition *part_definition, *parent_part_definition; PRCfaceList faces; PRCcompfaceList compfaces; PRCtessrectangleList rectangles; +// PRCtesstriangleList triangles; + PRCtessquadList quads; PRCtesslineMap lines; PRCwireList wires; PRCpointsetMap points; std::vector<PRCPointSet*> pointsets; std::vector<PRCPolyBrepModel*> polymodels; std::vector<PRCPolyWire*> polywires; - std::string name; - std::list<PRCgroup> groupList; PRCGeneralTransformation3d* transform; + std::string name; PRCoptions options; }; -typedef std::list<PRCgroup> PRCgroupList; void makeFileUUID(PRCUniqueId&); void makeAppUUID(PRCUniqueId&); @@ -249,11 +476,9 @@ class PRCUncompressedFile public: PRCUncompressedFile() : file_size(0), data(NULL) {} PRCUncompressedFile(uint32_t fs, uint8_t *d) : file_size(fs), data(d) {} -// PRCUncompressedFile(uint32_t fs, const std::string &fn) : file_size(fs), data(NULL), file_name(fn) {} ~PRCUncompressedFile() { if(data != NULL) delete[] data; } uint32_t file_size; uint8_t *data; -// std::string file_name; void write(std::ostream&) const; @@ -417,6 +642,15 @@ class oPRCFile makeAppUUID(fileStructures[i]->application_uuid); fileStructures[i]->unit = u; } + + groups.push(PRCgroup()); + PRCgroup &group = groups.top(); + group.name="root"; + group.transform = NULL; + group.product_occurrence = new PRCProductOccurrence(group.name); + group.parent_product_occurrence = NULL; + group.part_definition = new PRCPartDefinition; + group.parent_part_definition = NULL; } oPRCFile(const std::string &name, double u=1, uint32_t n=1) : @@ -437,6 +671,15 @@ class oPRCFile makeAppUUID(fileStructures[i]->application_uuid); fileStructures[i]->unit = u; } + + groups.push(PRCgroup()); + PRCgroup &group = groups.top(); + group.name="root"; + group.transform = NULL; + group.product_occurrence = new PRCProductOccurrence(group.name); + group.parent_product_occurrence = NULL; + group.part_definition = new PRCPartDefinition; + group.parent_part_definition = NULL; } ~oPRCFile() @@ -447,12 +690,17 @@ class oPRCFile if(fout != NULL) delete fout; free(modelFile_data); + for(PRCpictureMap::iterator it=pictureMap.begin(); it!=pictureMap.end(); ++it) delete it->first.data; } void begingroup(const char *name, PRCoptions *options=NULL, - const double t[][4]=NULL); + const double* t=NULL); void endgroup(); + std::string lastgroupname; + std::vector<std::string> lastgroupnames; + std::string calculate_unique_name(const ContentPRCBase *prc_entity,const ContentPRCBase *prc_occurence); + bool finish(); uint32_t getSize(); @@ -465,32 +713,110 @@ class oPRCFile PRCcolorMap colorMap; PRCcolourMap colourMap; PRCcolourwidthMap colourwidthMap; - PRCmaterialMap materialMap; + PRCmaterialgenericMap materialgenericMap; + PRCtexturedefinitionMap texturedefinitionMap; + PRCtextureapplicationMap textureapplicationMap; + PRCstyleMap styleMap; + PRCpictureMap pictureMap; PRCgroup rootGroup; PRCtransformMap transformMap; - std::stack<PRCgroupList::iterator> currentGroups; + std::stack<PRCgroup> groups; PRCgroup& findGroup(); - void doGroup(PRCgroup& group, PRCPartDefinition *parent_part_definition, PRCProductOccurrence *parent_product_occurrence); + void doGroup(PRCgroup& group); uint32_t addColor(const PRCRgbColor &color); uint32_t addColour(const RGBAColour &colour); uint32_t addColourWidth(const RGBAColour &colour, double width); + uint32_t addLineMaterial(const RGBAColour& c, double width) + { return addColourWidth(c,width); } uint32_t addMaterial(const PRCmaterial &material); uint32_t addTransform(PRCGeneralTransformation3d*& transform); + uint32_t addTransform(const double* t); + uint32_t addTransform(const double origin[3], const double x_axis[3], const double y_axis[3], double scale); void addPoint(const double P[3], const RGBAColour &c, double w=1.0); void addPoints(uint32_t n, const double P[][3], const RGBAColour &c, double w=1.0); void addLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[], - const RGBAColour &c, double w, bool segment_color, - uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]); + const RGBAColour& c, double w, + bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]); + uint32_t createLines(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[], + bool segment_color, uint32_t nC, const RGBAColour C[], uint32_t nCI, const uint32_t CI[]); void addTriangles(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][3], const PRCmaterial &m, uint32_t nN, const double N[][3], const uint32_t NI[][3], uint32_t nT, const double T[][2], const uint32_t TI[][3], uint32_t nC, const RGBAColour C[], const uint32_t CI[][3], - uint32_t nM, const PRCmaterial M[], const uint32_t MI[]); + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca); + uint32_t createTriangleMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][3], uint32_t style_index, + uint32_t nN, const double N[][3], const uint32_t NI[][3], + uint32_t nT, const double T[][2], const uint32_t TI[][3], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][3], + uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca); + uint32_t createTriangleMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][3], const PRCmaterial& m, + uint32_t nN, const double N[][3], const uint32_t NI[][3], + uint32_t nT, const double T[][2], const uint32_t TI[][3], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][3], + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca) + { + const uint32_t style = addMaterial(m); + if(M!=NULL && nM>0) + { + uint32_t* const styles = new uint32_t[nM]; + for(uint32_t i=0; i<nM; i++) + styles[i]=addMaterial(M[i]); + const uint32_t meshid = createTriangleMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, nM, styles, MI, ca); + delete[] styles; + return meshid; + } + else + return createTriangleMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, 0, NULL, NULL, ca); + } void addQuads(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial &m, uint32_t nN, const double N[][3], const uint32_t NI[][4], uint32_t nT, const double T[][2], const uint32_t TI[][4], uint32_t nC, const RGBAColour C[], const uint32_t CI[][4], - uint32_t nM, const PRCmaterial M[], const uint32_t MI[]); + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca); + uint32_t createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], uint32_t style_index, + uint32_t nN, const double N[][3], const uint32_t NI[][4], + uint32_t nT, const double T[][2], const uint32_t TI[][4], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][4], + uint32_t nS, const uint32_t S[], const uint32_t SI[], double ca); + uint32_t createQuadMesh(uint32_t nP, const double P[][3], uint32_t nI, const uint32_t PI[][4], const PRCmaterial& m, + uint32_t nN, const double N[][3], const uint32_t NI[][4], + uint32_t nT, const double T[][2], const uint32_t TI[][4], + uint32_t nC, const RGBAColour C[], const uint32_t CI[][4], + uint32_t nM, const PRCmaterial M[], const uint32_t MI[], double ca) + { + const uint32_t style = addMaterial(m); + if(M!=NULL && nM>0) + { + uint32_t* const styles = new uint32_t[nM]; + for(uint32_t i=0; i<nM; i++) + styles[i]=addMaterial(M[i]); + const uint32_t meshid = createQuadMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, nM, styles, MI, ca); + delete[] styles; + return meshid; + } + else + return createQuadMesh(nP, P, nI, PI, style, nN, N, NI, nT, T, TI, nC, C, CI, 0, NULL, NULL, ca); + } +#define PRCTRANSFORM const double origin[3]=NULL, const double x_axis[3]=NULL, const double y_axis[3]=NULL, double scale=1, const double* t=NULL +#define PRCCARTRANSFORM const double origin[3], const double x_axis[3], const double y_axis[3], double scale +#define PRCGENTRANSFORM const double* t=NULL +#define PRCNOMATERIALINDEX m1 + void useMesh(uint32_t tess_index, uint32_t style_index, PRCGENTRANSFORM); + void useMesh(uint32_t tess_index, const PRCmaterial& m, PRCGENTRANSFORM) + { useMesh(tess_index,addMaterial(m),t); } + void useMesh(uint32_t tess_index, uint32_t style_index, PRCCARTRANSFORM); + void useMesh(uint32_t tess_index, const PRCmaterial& m, PRCCARTRANSFORM) + { useMesh(tess_index,addMaterial(m),origin, x_axis, y_axis, scale); } + + void useLines(uint32_t tess_index, uint32_t style_index, PRCGENTRANSFORM); + void useLines(uint32_t tess_index, const RGBAColour& c, double w, PRCGENTRANSFORM) + { useLines(tess_index, addLineMaterial(c,w), t); } + void useLines(uint32_t tess_index, uint32_t style_index, PRCCARTRANSFORM); + void useLines(uint32_t tess_index, const RGBAColour& c, double w, PRCCARTRANSFORM) + { useLines(tess_index,addLineMaterial(c,w),origin, x_axis, y_axis, scale); } + +// void addTriangle(const double P[][3], const double T[][2], uint32_t style_index); + void addLine(uint32_t n, const double P[][3], const RGBAColour &c, double w=1.0); void addBezierCurve(uint32_t n, const double cP[][3], const RGBAColour &c); void addCurve(uint32_t d, uint32_t n, const double cP[][3], const double *k, const RGBAColour &c, const double w[]); @@ -501,20 +827,24 @@ class oPRCFile void addSurface(uint32_t dU, uint32_t dV, uint32_t nU, uint32_t nV, const double cP[][3], const double *kU, const double *kV, const PRCmaterial &m, const double w[]); -#define PRCFACETRANSFORM const double origin[3]=NULL, const double x_axis[3]=NULL, const double y_axis[3]=NULL, double scale=1, const double t[][4]=NULL - void addTube(uint32_t n, const double cP[][3], const double oP[][3], bool straight, const PRCmaterial &m, PRCFACETRANSFORM); - void addHemisphere(double radius, const PRCmaterial &m, PRCFACETRANSFORM); - void addSphere(double radius, const PRCmaterial &m, PRCFACETRANSFORM); - void addDisk(double radius, const PRCmaterial &m, PRCFACETRANSFORM); - void addCylinder(double radius, double height, const PRCmaterial &m, PRCFACETRANSFORM); - void addCone(double radius, double height, const PRCmaterial &m, PRCFACETRANSFORM); - void addTorus(double major_radius, double minor_radius, double angle1, double angle2, const PRCmaterial &m, PRCFACETRANSFORM); -#undef PRCFACETRANSFORM + void addTube(uint32_t n, const double cP[][3], const double oP[][3], bool straight, const PRCmaterial& m, PRCTRANSFORM); + void addHemisphere(double radius, const PRCmaterial& m, PRCTRANSFORM); + void addSphere(double radius, const PRCmaterial& m, PRCTRANSFORM); + void addDisk(double radius, const PRCmaterial& m, PRCTRANSFORM); + void addCylinder(double radius, double height, const PRCmaterial& m, PRCTRANSFORM); + void addCone(double radius, double height, const PRCmaterial& m, PRCTRANSFORM); + void addTorus(double major_radius, double minor_radius, double angle1, double angle2, const PRCmaterial& m, PRCTRANSFORM); +#undef PRCTRANSFORM +#undef PRCCARTRANSFORM +#undef PRCGENTRANSFORM uint32_t addPicture(EPRCPictureDataFormat format, uint32_t size, const uint8_t *picture, uint32_t width=0, uint32_t height=0, std::string name="", uint32_t fileStructure=0) { return fileStructures[fileStructure]->addPicture(format, size, picture, width, height, name); } + uint32_t addPicture(const PRCpicture& pic, + std::string name="", uint32_t fileStructure=0) + { return fileStructures[fileStructure]->addPicture(pic.format, pic.size, pic.data, pic.width, pic.height, name); } uint32_t addTextureDefinition(PRCTextureDefinition*& pTextureDefinition, uint32_t fileStructure=0) { return fileStructures[fileStructure]->addTextureDefinition(pTextureDefinition); diff --git a/Build/source/utils/asymptote/prc/writePRC.cc b/Build/source/utils/asymptote/prc/writePRC.cc index 9fbbc41013b..5f62ea6731e 100644 --- a/Build/source/utils/asymptote/prc/writePRC.cc +++ b/Build/source/utils/asymptote/prc/writePRC.cc @@ -150,6 +150,84 @@ bool PRCVector3d::Normalize() return true; } +double PRCVector2d::Length() +{ + return sqrt(x*x+y*y); +} + +bool PRCVector2d::Normalize() +{ + double fLength=Length(); + if(fLength < FLT_EPSILON) return false; + double factor=1.0/fLength; + x *= factor; + y *= factor; + + return true; +} + +void PRCVector2d::serializeVector2d(PRCbitStream &pbs) +{ + WriteDouble (x) + WriteDouble (y) +} + +uint32_t makeCADID() +{ + static uint32_t ID = 1; + return ID++; +} + +uint32_t makePRCID() +{ + static uint32_t ID = 1; + return ID++; +} + +bool type_eligible_for_reference(uint32_t type) +{ + if( + type == PRC_TYPE_MISC_EntityReference || + type == PRC_TYPE_MISC_MarkupLinkedItem || + type == PRC_TYPE_RI_BrepModel || + type == PRC_TYPE_RI_Curve || + type == PRC_TYPE_RI_Direction || + type == PRC_TYPE_RI_Plane || + type == PRC_TYPE_RI_PointSet || + type == PRC_TYPE_RI_PolyBrepModel || + type == PRC_TYPE_RI_PolyWire || + type == PRC_TYPE_RI_Set || + type == PRC_TYPE_RI_CoordinateSystem || + type == PRC_TYPE_ASM_ProductOccurence || + type == PRC_TYPE_ASM_PartDefinition || + type == PRC_TYPE_ASM_Filter || + type == PRC_TYPE_MKP_View || + type == PRC_TYPE_MKP_Markup || + type == PRC_TYPE_MKP_Leader || + type == PRC_TYPE_MKP_AnnotationItem || + type == PRC_TYPE_MKP_AnnotationSet || + type == PRC_TYPE_MKP_AnnotationReference || + type == PRC_TYPE_GRAPH_Style || + type == PRC_TYPE_GRAPH_Material || + type == PRC_TYPE_GRAPH_TextureApplication || + type == PRC_TYPE_GRAPH_TextureDefinition || + type == PRC_TYPE_GRAPH_LinePattern || + type == PRC_TYPE_GRAPH_DottingPattern || + type == PRC_TYPE_GRAPH_HatchingPattern || + type == PRC_TYPE_GRAPH_SolidPattern || + type == PRC_TYPE_GRAPH_VPicturePattern || + type == PRC_TYPE_GRAPH_AmbientLight || + type == PRC_TYPE_GRAPH_PointLight || + type == PRC_TYPE_GRAPH_DirectionalLight || + type == PRC_TYPE_GRAPH_SpotLight || + type == PRC_TYPE_GRAPH_SceneDisplayParameters || + type == PRC_TYPE_GRAPH_Camera + ) + return true; + else + return false; +} + void UserData::write(PRCbitStream &pbs) { pbs << size; @@ -221,12 +299,12 @@ void PRCAttributes::serializeAttributes(PRCbitStream &pbs) const } } -void ContentPRCBase::serializeContentPRCBase(PRCbitStream &pbs) +void ContentPRCBase::serializeContentPRCBase(PRCbitStream &pbs) const { SerializeAttributeData SerializeName (name) - if (type_eligible_for_reference) + if (type_eligible_for_reference(type)) { WriteUnsignedInteger (CAD_identifier) WriteUnsignedInteger (CAD_persistent_identifier) @@ -381,6 +459,21 @@ void PRCTextureApplication::serializeTextureApplication(PRCbitStream &pbs) WriteUnsignedInteger (UV_coordinates_index+1) } +void PRCLinePattern::serializeLinePattern(PRCbitStream &pbs) +{ + uint32_t i = 0; + WriteUnsignedInteger (PRC_TYPE_GRAPH_LinePattern) + SerializeContentPRCBase + + const uint32_t size_lengths = lengths.size(); + WriteUnsignedInteger (size_lengths) + for (i=0;i<size_lengths;i++) + WriteDouble (lengths[i]) + WriteDouble (phase) + WriteBoolean (is_real_length) +} + + void PRCStyle::serializeCategory1LineStyle(PRCbitStream &pbs) { const bool is_additional_1_defined = (additional!=0); @@ -410,9 +503,8 @@ void PRCStyle::serializeCategory1LineStyle(PRCbitStream &pbs) WriteCharacter (additional_3) } -ContentPRCBase EMPTY_CONTENTPRCBASE; - std::string currentName; + void writeName(PRCbitStream &pbs,const std::string &name) { pbs << (name == currentName); @@ -672,9 +764,8 @@ void PRCPolyWire::serializePolyWire(PRCbitStream &pbs) void PRCGeneralTransformation3d::serializeGeneralTransformation3d(PRCbitStream &pbs) const { WriteUnsignedInteger (PRC_TYPE_MISC_GeneralTransformation) - for (int j=0;j<4;j++) - for (int i=0;i<4;i++) - WriteDouble(mat[i][j]); + for (uint32_t i=0; i<16; i++) + WriteDouble(m_coef[i]); } void PRCCartesianTransformation3d::serializeCartesianTransformation3d(PRCbitStream &pbs) const @@ -974,24 +1065,6 @@ void PRCMarkupTess::serializeMarkupTess(PRCbitStream &pbs) WriteCharacter (behaviour) } -void PRCVector2d::serializeVector2d(PRCbitStream &pbs) -{ - WriteDouble (x) - WriteDouble (y) -} - -uint32_t makeCADID() -{ - static uint32_t ID = 1; - return ID++; -} - -uint32_t makePRCID() -{ - static uint32_t ID = 1; - return ID++; -} - void writeUnit(PRCbitStream &out,bool fromCAD,double unit) { out << fromCAD << unit; @@ -1300,7 +1373,7 @@ void PRCCompressedFace::serializeCompressedNurbs(PRCbitStream &pbs, double brep for(uint32_t i=0;i<number_of_control_point_in_u;i++) for(uint32_t j=0;j<number_of_control_point_in_v;j++) P[i][j] = control_point[i*number_of_control_point_in_v+j]; -#if defined(__GNUC__) && !defined(__clang__) +#ifdef __GNUC__ itriple compressed_control_point[number_of_control_point_in_u][number_of_control_point_in_v]; uint32_t control_point_type[number_of_control_point_in_u][number_of_control_point_in_v]; #else @@ -1367,7 +1440,7 @@ void PRCCompressedFace::serializeCompressedNurbs(PRCbitStream &pbs, double brep if(x*x+y*y<nurbs_tolerance*nurbs_tolerance) { control_point_type[i][j] = 1; - compressed_control_point[i][j] = iroundto(PRCVector3d(0,0,z), nurbs_tolerance); + compressed_control_point[i][j] = iroundto(PRCVector3d(0.0,0.0,z), nurbs_tolerance); P[i][j] = P[i-1][j-1] + U + V + roundto(z, nurbs_tolerance)*Ne; // see above } else diff --git a/Build/source/utils/asymptote/prc/writePRC.h b/Build/source/utils/asymptote/prc/writePRC.h index 390e8042150..a1c794c919c 100644 --- a/Build/source/utils/asymptote/prc/writePRC.h +++ b/Build/source/utils/asymptote/prc/writePRC.h @@ -43,11 +43,12 @@ public : double x; double y; double z; - PRCVector3d() {} + PRCVector3d() : + x(0), y(0), z(0) {} PRCVector3d(double fx, double fy, double fz) : x(fx), y(fy), z(fz) {} - PRCVector3d(const double c[]) : - x(c?c[0]:0), y(c?c[1]:0), z(c?c[2]:0) {} + PRCVector3d(const double c[], double fx=0, double fy=0, double fz=0) : + x(c?c[0]:fx), y(c?c[1]:fy), z(c?c[2]:fz) {} PRCVector3d(const PRCVector3d& sVector3d) : x(sVector3d.x), y(sVector3d.y), z(sVector3d.z) {} @@ -118,8 +119,6 @@ class UUID void writeUncompressedUnsignedInteger(std::ostream &out, uint32_t data); -uint32_t makeCADID(); -uint32_t makePRCID(); void writeUnit(PRCbitStream &,bool,double); void writeEmptyMarkups(PRCbitStream&); @@ -239,17 +238,27 @@ class PRCAttributes PRCAttributeList attributes; }; +bool type_eligible_for_reference(uint32_t type); +uint32_t makeCADID(); +uint32_t makePRCID(); + class ContentPRCBase : public PRCAttributes { public: - ContentPRCBase(std::string n="",bool efr = false, - uint32_t ci = 0, uint32_t cpi = 0, uint32_t pi = 0) : - name(n),type_eligible_for_reference(efr),CAD_identifier(ci), - CAD_persistent_identifier(cpi),PRC_unique_identifier(pi) {} - void serializeContentPRCBase(PRCbitStream&); + ContentPRCBase(uint32_t t, std::string n="") : + type(t),name(n),CAD_identifier(0), CAD_persistent_identifier(0), PRC_unique_identifier(0) + { + if(type_eligible_for_reference(type)) + { + CAD_identifier = makeCADID(); + PRC_unique_identifier = makePRCID(); + } + } + void serializeContentPRCBase(PRCbitStream&) const; uint32_t getPRCID() const { return PRC_unique_identifier; } + uint32_t getType() const { return type; } + uint32_t type; std::string name; - bool type_eligible_for_reference; uint32_t CAD_identifier, CAD_persistent_identifier, PRC_unique_identifier; }; @@ -265,8 +274,6 @@ public: uint32_t unique_identifier; }; -extern ContentPRCBase EMPTY_CONTENTPRCBASE; - extern std::string currentName; void writeName(PRCbitStream&,const std::string&); void resetName(); @@ -309,7 +316,7 @@ class PRCPicture : public ContentPRCBase { public: PRCPicture(std::string n="") : - ContentPRCBase(n), format(KEPRCPicture_PNG), uncompressed_file_index(m1), pixel_width(0), pixel_height(0) {} + ContentPRCBase(PRC_TYPE_GRAPH_Picture,n), format(KEPRCPicture_PNG), uncompressed_file_index(m1), pixel_width(0), pixel_height(0) {} void serializePicture(PRCbitStream&); EPRCPictureDataFormat format; uint32_t uncompressed_file_index; @@ -319,20 +326,67 @@ public: struct PRCVector2d { - PRCVector2d() : - x(0.0), y(0.0) {} - PRCVector2d(double X, double Y) : - x(X), y(Y) {} - void serializeVector2d(PRCbitStream&); - double x; - double y; + PRCVector2d() : + x(0.0), y(0.0) {} + PRCVector2d(double X, double Y) : + x(X), y(Y) {} + void serializeVector2d(PRCbitStream&); + double x; + double y; + PRCVector2d(const double c[], double fx=0, double fy=0) : + x(c?c[0]:fx), y(c?c[1]:fy) {} + PRCVector2d(const PRCVector2d& sVector2d) : + x(sVector2d.x), y(sVector2d.y) {} + + void Set(double fx, double fy) + { x = fx; y = fy; } + double Dot(const PRCVector2d & sPt) const + { return(x*sPt.x)+(y*sPt.y); } + double LengthSquared() + { return(x*x+y*y); } + + friend PRCVector2d operator + (const PRCVector2d& a, const PRCVector2d& b) + { return PRCVector2d(a.x+b.x,a.y+b.y); } + friend PRCVector2d operator - (const PRCVector2d& a) + { return PRCVector2d(-a.x,-a.y); } + friend PRCVector2d operator - (const PRCVector2d& a, const PRCVector2d& b) + { return PRCVector2d(a.x-b.x,a.y-b.y); } + friend PRCVector2d operator * (const PRCVector2d& a, const double d) + { return PRCVector2d(a.x*d,a.y*d); } + friend PRCVector2d operator * (const double d, const PRCVector2d& a) + { return PRCVector2d(a.x*d,a.y*d); } + friend PRCVector2d operator / (const PRCVector2d& a, const double d) + { return PRCVector2d(a.x/d,a.y/d); } + + double Length(); + bool Normalize(); + + bool operator==(const PRCVector2d &v) const + { + return x==v.x && y==v.y; + } + bool operator!=(const PRCVector2d &v) const + { + return !(x==v.x && y==v.y); + } + bool operator<(const PRCVector2d &v) const + { + if(x!=v.x) + return (x<v.x); + return (y<v.y); + } + friend std::ostream& operator << (std::ostream& out, const PRCVector2d& v) + { + out << "(" << v.x << "," << v.y << ")"; + return out; + } }; class PRCTextureDefinition : public ContentPRCBase { public: PRCTextureDefinition(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), picture_index(m1), texture_mapping_attribute(PRC_TEXTURE_MAPPING_DIFFUSE), + ContentPRCBase(PRC_TYPE_GRAPH_TextureDefinition,n), picture_index(m1), texture_mapping_attribute(PRC_TEXTURE_MAPPING_DIFFUSE), texture_mapping_attribute_intensity(1.0), texture_mapping_attribute_components(PRC_TEXTURE_MAPPING_COMPONENTS_RGBA), texture_function(KEPRCTextureFunction_Modulate), texture_applying_mode(PRC_TEXTURE_APPLYING_MODE_NONE), texture_wrapping_mode_S(KEPRCTextureWrappingMode_Unknown), texture_wrapping_mode_T(KEPRCTextureWrappingMode_Unknown) // , @@ -375,7 +429,7 @@ class PRCMaterialGeneric : public ContentPRCBase, public PRCMaterial { public: PRCMaterialGeneric(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(PRC_TYPE_GRAPH_Material,n), ambient(m1), diffuse(m1), emissive(m1), specular(m1), shininess(0.0), ambient_alpha(1.0), diffuse_alpha(1.0), emissive_alpha(1.0), specular_alpha(1.0) @@ -404,7 +458,7 @@ class PRCTextureApplication : public ContentPRCBase, public PRCMaterial { public: PRCTextureApplication(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(PRC_TYPE_GRAPH_TextureApplication,n), material_generic_index(m1), texture_definition_index(m1), next_texture_index(m1), UV_coordinates_index(0) {} @@ -416,11 +470,24 @@ public: uint32_t UV_coordinates_index; }; +class PRCLinePattern : public ContentPRCBase +{ +public: + PRCLinePattern(std::string n="") : + ContentPRCBase(PRC_TYPE_GRAPH_LinePattern,n), + phase(0), is_real_length(false) {} + void serializeLinePattern(PRCbitStream&); + std::vector<double> lengths; + double phase; + bool is_real_length; +}; +typedef std::deque <PRCLinePattern*> PRCLinePatternList; + class PRCStyle : public ContentPRCBase { public: PRCStyle(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), line_width(0.0), is_vpicture(false), line_pattern_vpicture_index(m1), + ContentPRCBase(PRC_TYPE_GRAPH_Style,n), line_width(0.0), is_vpicture(false), line_pattern_vpicture_index(m1), is_material(false), color_material_index(m1), is_transparency_defined(false), transparency(255), additional(0) {} void serializeCategory1LineStyle(PRCbitStream&); @@ -480,7 +547,7 @@ class PRC3DTess : public PRCTess public: PRC3DTess() : has_faces(false), has_loops(false), - crease_angle(25.8419) + crease_angle(25.8419) // arccos(0.9), default found in Acrobat output {} ~PRC3DTess() { for(PRCTessFaceList::iterator it=face_tessellation.begin(); it!=face_tessellation.end(); ++it) delete *it; } void serialize3DTess(PRCbitStream&); @@ -545,7 +612,7 @@ class PRCMarkup: public PRCGraphics, public ContentPRCBase { public: PRCMarkup(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(PRC_TYPE_MKP_Markup,n), type(KEPRCMarkupType_Unknown), sub_type(KEPRCMarkupSubType_Unknown), index_tessellation(m1) {} void serializeMarkup(PRCbitStream&); EPRCMarkupType type; @@ -560,7 +627,7 @@ class PRCAnnotationItem: public PRCGraphics, public ContentPRCBase { public: PRCAnnotationItem(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()) {} + ContentPRCBase(PRC_TYPE_MKP_AnnotationItem,n) {} void serializeAnnotationItem(PRCbitStream&); void serializeAnnotationEntity(PRCbitStream &pbs) { serializeAnnotationItem(pbs); } PRCReferenceUniqueIdentifier markup; @@ -570,8 +637,8 @@ typedef std::deque <PRCAnnotationItem*> PRCAnnotationItemList; class PRCRepresentationItemContent: public PRCGraphics, public ContentPRCBase { public: - PRCRepresentationItemContent(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), + PRCRepresentationItemContent(uint32_t t, std::string n="") : + ContentPRCBase(t,n), index_local_coordinate_system(m1), index_tessellation(m1) {} void serializeRepresentationItemContent(PRCbitStream&); uint32_t index_local_coordinate_system; @@ -581,11 +648,10 @@ public: class PRCRepresentationItem : public PRCRepresentationItemContent { public: - PRCRepresentationItem(std::string n="") : - PRCRepresentationItemContent(n) {} + PRCRepresentationItem(uint32_t t, std::string n="") : + PRCRepresentationItemContent(t,n) {} virtual ~PRCRepresentationItem() {} virtual void serializeRepresentationItem(PRCbitStream &pbs) = 0; - virtual uint32_t getType() const = 0; }; typedef std::deque <PRCRepresentationItem*> PRCRepresentationItemList; @@ -593,10 +659,9 @@ class PRCBrepModel : public PRCRepresentationItem { public: PRCBrepModel(std::string n="") : - PRCRepresentationItem(n), has_brep_data(true), context_id(m1), body_id(m1), is_closed(false) {} + PRCRepresentationItem(PRC_TYPE_RI_BrepModel,n), has_brep_data(true), context_id(m1), body_id(m1), is_closed(false) {} void serializeBrepModel(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeBrepModel(pbs); } - uint32_t getType() const { return PRC_TYPE_RI_BrepModel; } bool has_brep_data; uint32_t context_id; uint32_t body_id; @@ -607,10 +672,9 @@ class PRCPolyBrepModel : public PRCRepresentationItem { public: PRCPolyBrepModel(std::string n="") : - PRCRepresentationItem(n), is_closed(false) {} + PRCRepresentationItem(PRC_TYPE_RI_PolyBrepModel,n), is_closed(false) {} void serializePolyBrepModel(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializePolyBrepModel(pbs); } - uint32_t getType() const { return PRC_TYPE_RI_PolyBrepModel; } bool is_closed; }; @@ -618,10 +682,9 @@ class PRCPointSet : public PRCRepresentationItem { public: PRCPointSet(std::string n="") : - PRCRepresentationItem(n) {} + PRCRepresentationItem(PRC_TYPE_RI_PointSet,n) {} void serializePointSet(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializePointSet(pbs); } - uint32_t getType() const { return PRC_TYPE_RI_PointSet; } std::vector<PRCVector3d> point; }; @@ -629,10 +692,9 @@ class PRCWire : public PRCRepresentationItem { public: PRCWire(std::string n="") : - PRCRepresentationItem(n), has_wire_body(true), context_id(m1), body_id(m1) {} + PRCRepresentationItem(PRC_TYPE_RI_Curve,n), has_wire_body(true), context_id(m1), body_id(m1) {} void serializeWire(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeWire(pbs); } - uint32_t getType() const { return PRC_TYPE_RI_Curve; } bool has_wire_body; uint32_t context_id; uint32_t body_id; @@ -642,17 +704,16 @@ class PRCPolyWire : public PRCRepresentationItem { public: PRCPolyWire(std::string n="") : - PRCRepresentationItem(n) {} + PRCRepresentationItem(PRC_TYPE_RI_PolyWire,n) {} void serializePolyWire(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializePolyWire(pbs); } - uint32_t getType() const { return PRC_TYPE_RI_PolyWire; } }; class PRCSet : public PRCRepresentationItem { public: PRCSet(std::string n="") : - PRCRepresentationItem(n) {} + PRCRepresentationItem(PRC_TYPE_RI_Set,n) {} ~PRCSet() { for(PRCRepresentationItemList::iterator it=elements.begin(); it!=elements.end(); ++it) delete *it; } void serializeSet(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeSet(pbs); } @@ -663,7 +724,6 @@ public: uint32_t addWire(PRCWire*& pWire); uint32_t addPolyWire(PRCPolyWire*& pPolyWire); uint32_t addRepresentationItem(PRCRepresentationItem*& pRepresentationItem); - uint32_t getType() const { return PRC_TYPE_RI_Set; } PRCRepresentationItemList elements; }; @@ -680,88 +740,63 @@ class PRCGeneralTransformation3d : public PRCTransformation3d public: PRCGeneralTransformation3d() { - mat[0][0] = mat[1][1] = mat[2][2] = mat[3][3] = 1.0; - mat[0][1] = mat[0][2] = mat[0][3] = 0.0; - mat[1][0] = mat[1][2] = mat[1][3] = 0.0; - mat[2][0] = mat[2][1] = mat[2][3] = 0.0; - mat[3][0] = mat[3][1] = mat[3][2] = 0.0; + setidentity(); } - PRCGeneralTransformation3d(const double t[][4]) + PRCGeneralTransformation3d(const double t[]) { - if(t!=NULL) - for (size_t i=0;i<4;i++) - for (size_t j=0;j<4;j++) - mat[i][j]=t[i][j]; - else - { - mat[0][0] = mat[1][1] = mat[2][2] = mat[3][3] = 1.0; - mat[0][1] = mat[0][2] = mat[0][3] = 0.0; - mat[1][0] = mat[1][2] = mat[1][3] = 0.0; - mat[2][0] = mat[2][1] = mat[2][3] = 0.0; - mat[3][0] = mat[3][1] = mat[3][2] = 0.0; - } - } - PRCGeneralTransformation3d(const double t[][4], double scale) - { - if(t!=NULL) - { - for (size_t i=0;i<3;i++) - for (size_t j=0;j<4;j++) - mat[i][j]=scale*t[i][j]; - for(size_t j= 0;j<4; j++) - mat[3][j] = scale*t[3][j]; - } - else - { - mat[0][0] = mat[1][1] = mat[2][2] = mat[3][3] = 1.0; - mat[0][1] = mat[0][2] = mat[0][3] = 0.0; - mat[1][0] = mat[1][2] = mat[1][3] = 0.0; - mat[2][0] = mat[2][1] = mat[2][3] = 0.0; - mat[3][0] = mat[3][1] = mat[3][2] = 0.0; - } + set(t); } void serializeGeneralTransformation3d(PRCbitStream&) const; void serializeTransformation3d(PRCbitStream& pbs) const { serializeGeneralTransformation3d(pbs); } - double mat[4][4]; + double m_coef[16]; bool operator==(const PRCGeneralTransformation3d &t) const { - for (size_t i=0;i<4;i++) - for (size_t j=0;j<4;j++) - if(mat[i][j]!=t.mat[i][j]) + for (size_t i=0;i<16;i++) + if(m_coef[i]!=t.m_coef[i]) return false; return true; } bool operator<(const PRCGeneralTransformation3d &t) const { - for (size_t i=0;i<4;i++) - for (size_t j=0;j<4;j++) - if(mat[i][j]!=t.mat[i][j]) + for (size_t i=0;i<16;i++) + if(m_coef[i]!=t.m_coef[i]) { - return (mat[i][j]<t.mat[i][j]); + return (m_coef[i]<t.m_coef[i]); } return false; } - void set(const double t[][4]) + void set(const double t[]) { if(t!=NULL) - for (size_t i=0;i<4;i++) - for (size_t j=0;j<4;j++) - mat[i][j]=t[i][j]; + for (size_t i=0;i<16;i++) + m_coef[i]=t[i]; + else + setidentity(); + } + void setidentity() + { + m_coef[0]=1; m_coef[4]=0; m_coef[ 8]=0; m_coef[12]=0; + m_coef[1]=0; m_coef[5]=1; m_coef[ 9]=0; m_coef[13]=0; + m_coef[2]=0; m_coef[6]=0; m_coef[10]=1; m_coef[14]=0; + m_coef[3]=0; m_coef[7]=0; m_coef[11]=0; m_coef[15]=1; } bool isnotidtransform() const { return( - mat[0][0]!=1 || mat[0][1]!=0 || mat[0][2]!=0 || mat[0][3]!=0 || - mat[1][0]!=0 || mat[1][1]!=1 || mat[1][2]!=0 || mat[1][3]!=0 || - mat[2][0]!=0 || mat[2][1]!=0 || mat[2][2]!=1 || mat[2][3]!=0 || - mat[3][0]!=0 || mat[3][1]!=0 || mat[3][2]!=0 || mat[3][3]!=1 ); + m_coef[0]!=1 || m_coef[4]!=0 || m_coef[ 8]!=0 || m_coef[12]!=0 || + m_coef[1]!=0 || m_coef[5]!=1 || m_coef[ 9]!=0 || m_coef[13]!=0 || + m_coef[2]!=0 || m_coef[6]!=0 || m_coef[10]!=1 || m_coef[14]!=0 || + m_coef[3]!=0 || m_coef[7]!=0 || m_coef[11]!=0 || m_coef[15]!=1 ); } bool isidtransform() const { return( - mat[0][0]==1 && mat[0][1]==0 && mat[0][2]==0 && mat[0][3]==0 && - mat[1][0]==0 && mat[1][1]==1 && mat[1][2]==0 && mat[1][3]==0 && - mat[2][0]==0 && mat[2][1]==0 && mat[2][2]==1 && mat[2][3]==0 && - mat[3][0]==0 && mat[3][1]==0 && mat[3][2]==0 && mat[3][3]==1 ); + m_coef[0]==1 && m_coef[4]==0 && m_coef[ 8]==0 && m_coef[12]==0 && + m_coef[1]==0 && m_coef[5]==1 && m_coef[ 9]==0 && m_coef[13]==0 && + m_coef[2]==0 && m_coef[6]==0 && m_coef[10]==1 && m_coef[14]==0 && + m_coef[3]==0 && m_coef[7]==0 && m_coef[11]==0 && m_coef[15]==1 ); + } + double M(size_t i, size_t j) const { + return m_coef[i+j*4]; } }; typedef std::deque <PRCGeneralTransformation3d> PRCGeneralTransformation3dList; @@ -773,6 +808,18 @@ public: behaviour(PRC_TRANSFORMATION_Identity), origin(0.0,0.0,0.0), X(1.0,0.0,0.0), Y(0.0,1.0,0.0), Z(0.0,0.0,1.0), scale(1.0,1.0,1.0), uniform_scale(1.0), X_homogeneous_coord(0.0), Y_homogeneous_coord(0.0), Z_homogeneous_coord(0.0), origin_homogeneous_coord(1.0) {} + PRCCartesianTransformation3d(const double o[3], const double x[3], const double y[3], double sc) : + behaviour(PRC_TRANSFORMATION_Identity), origin(o,0.0,0.0,0.0), X(x,1.0,0.0,0.0), Y(y,0.0,1.0,0.0), Z(0.0,0.0,1.0), + scale(1.0,1.0,1.0), uniform_scale(sc), + X_homogeneous_coord(0.0), Y_homogeneous_coord(0.0), Z_homogeneous_coord(0.0), origin_homogeneous_coord(1.0) + { + if(origin!=PRCVector3d(0.0,0.0,0.0)) + behaviour = behaviour | PRC_TRANSFORMATION_Translate; + if(X!=PRCVector3d(1.0,0.0,0.0) || Y!=PRCVector3d(0.0,1.0,0.0)) + behaviour = behaviour | PRC_TRANSFORMATION_Rotate; + if(uniform_scale!=1) + behaviour = behaviour | PRC_TRANSFORMATION_Scale; + } void serializeCartesianTransformation3d(PRCbitStream& pbs) const; void serializeTransformation3d(PRCbitStream& pbs) const { serializeCartesianTransformation3d(pbs); } uint8_t behaviour; @@ -799,7 +846,7 @@ class PRCTransformation public: PRCTransformation() : has_transformation(false), geometry_is_2D(false), behaviour(PRC_TRANSFORMATION_Identity), - origin(0,0,0), x_axis(1,0,0), y_axis(0,1,0), scale(1) {} + origin(0.0,0.0,0.0), x_axis(1.0,0.0,0.0), y_axis(0.0,1.0,0.0), scale(1) {} void serializeTransformation(PRCbitStream&); bool has_transformation; bool geometry_is_2D; @@ -814,13 +861,12 @@ class PRCCoordinateSystem : public PRCRepresentationItem { public: PRCCoordinateSystem(std::string n="") : - PRCRepresentationItem(n), axis_set(NULL) {} + PRCRepresentationItem(PRC_TYPE_RI_CoordinateSystem,n), axis_set(NULL) {} ~PRCCoordinateSystem() { delete axis_set; } void serializeCoordinateSystem(PRCbitStream&); void serializeRepresentationItem(PRCbitStream &pbs) { serializeCoordinateSystem(pbs); } void setAxisSet(PRCGeneralTransformation3d*& transform) { axis_set = transform; transform = NULL; } void setAxisSet(PRCCartesianTransformation3d*& transform) { axis_set = transform; transform = NULL; } - uint32_t getType() const { return PRC_TYPE_RI_CoordinateSystem; } PRCTransformation3d *axis_set; bool operator==(const PRCCoordinateSystem &t) const { @@ -872,7 +918,7 @@ public: class PRCBoundingBox { public: - PRCBoundingBox() : min(0,0,0), max(0,0,0) {} + PRCBoundingBox() : min(0.0,0.0,0.0), max(0.0,0.0,0.0) {} PRCBoundingBox(const PRCVector3d &m1, const PRCVector3d& m2) : min(m1),max(m2) {} void serializeBoundingBox(PRCbitStream &pbs); PRCVector3d min; @@ -1337,7 +1383,7 @@ class PRCTopoContext : public ContentPRCBase { public: PRCTopoContext(std::string n="") : - ContentPRCBase(n), behaviour(0), granularity(1), tolerance(0), + ContentPRCBase(PRC_TYPE_TOPO_Context,n), behaviour(0), granularity(1), tolerance(0), have_smallest_face_thickness(false), smallest_thickness(0), have_scale(false), scale(1) {} ~PRCTopoContext() { for(PRCBodyList::iterator it=body.begin(); it!=body.end(); ++it) delete *it; } void serializeTopoContext(PRCbitStream&); @@ -1384,7 +1430,7 @@ class PRCProductOccurrence: public PRCGraphics, public ContentPRCBase { public: PRCProductOccurrence(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()), + ContentPRCBase(PRC_TYPE_ASM_ProductOccurence,n), index_part(m1), index_prototype(m1), prototype_in_same_file_structure(true), index_external_data(m1), external_data_in_same_file_structure(true), @@ -1413,7 +1459,7 @@ class PRCPartDefinition: public PRCGraphics, public ContentPRCBase, public PRCBo { public: PRCPartDefinition(std::string n="") : - ContentPRCBase(n,true,makeCADID(),0,makePRCID()) {} + ContentPRCBase(PRC_TYPE_ASM_PartDefinition,n) {} ~PRCPartDefinition() { for(PRCRepresentationItemList::iterator it=representation_item.begin(); it!=representation_item.end(); ++it) delete *it; } void serializePartDefinition(PRCbitStream&); uint32_t addBrepModel(PRCBrepModel*& pBrepModel); diff --git a/Build/source/utils/asymptote/program.h b/Build/source/utils/asymptote/program.h index 7e15d2098b9..7d0192b3893 100644 --- a/Build/source/utils/asymptote/program.h +++ b/Build/source/utils/asymptote/program.h @@ -8,9 +8,13 @@ #ifndef PROGRAM_H #define PROGRAM_H +#include <cstddef> // for ptrdiff_t + #include "common.h" #include "inst.h" +using std::ptrdiff_t; + namespace vm { struct inst; diff --git a/Build/source/utils/asymptote/psfile.cc b/Build/source/utils/asymptote/psfile.cc index 97e6a803e61..3886db6d46f 100644 --- a/Build/source/utils/asymptote/psfile.cc +++ b/Build/source/utils/asymptote/psfile.cc @@ -649,10 +649,10 @@ void psfile::image(stack *Stack, callable *f, Int width, Int height, imageheader(width,height,colorspace); beginImage(ncomponents*width*height); - for(Int i=0; i < width; i++) { - for(Int j=0; j < height; j++) { - Stack->push(i); + for(Int j=0; j < height; j++) { + for(Int i=0; i < width; i++) { Stack->push(j); + Stack->push(i); f->call(Stack); pen p=pop<pen>(Stack); p.convert(); diff --git a/Build/source/utils/asymptote/runhistory.cc b/Build/source/utils/asymptote/runhistory.cc index 19d354f1a95..200b9274997 100644 --- a/Build/source/utils/asymptote/runhistory.cc +++ b/Build/source/utils/asymptote/runhistory.cc @@ -139,8 +139,11 @@ void cleanup() for(historyMap_t::iterator h=historyMap.begin(); h != historyMap.end(); ++h) { history_set_history_state(&h->second.state); - stifle_history(nlines); - if(h->second.store) write_history(historyfilename(h->first).c_str()); + if(h->second.store) { + stifle_history(nlines); + write_history(historyfilename(h->first).c_str()); + unstifle_history(); + } } history_set_history_state(&history_save); #endif @@ -160,13 +163,13 @@ void cleanup() #endif namespace run { // Return the last n lines of the history named name. -#line 106 "runhistory.in" +#line 109 "runhistory.in" // stringarray* history(string name, Int n=1); void gen_runhistory0(stack *Stack) { Int n=vm::pop<Int>(Stack,1); string name=vm::pop<string>(Stack); -#line 107 "runhistory.in" +#line 110 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) bool newhistory=historyMap.find(name) == historyMap.end(); @@ -198,12 +201,12 @@ void gen_runhistory0(stack *Stack) } // Return the last n lines of the interactive history. -#line 139 "runhistory.in" +#line 142 "runhistory.in" // stringarray* history(Int n=0); void gen_runhistory1(stack *Stack) { Int n=vm::pop<Int>(Stack,0); -#line 140 "runhistory.in" +#line 143 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) {Stack->push<stringarray*>(get_history(n)); return;} #else @@ -214,14 +217,14 @@ void gen_runhistory1(stack *Stack) // Prompt for a string using prompt, the GNU readline library, and a // local history named name. -#line 151 "runhistory.in" +#line 154 "runhistory.in" // string readline(string prompt=emptystring, string name=emptystring, bool tabcompletion=false); void gen_runhistory2(stack *Stack) { bool tabcompletion=vm::pop<bool>(Stack,false); string name=vm::pop<string>(Stack,emptystring); string prompt=vm::pop<string>(Stack,emptystring); -#line 153 "runhistory.in" +#line 156 "runhistory.in" if(!(isatty(STDIN_FILENO) || getSetting<Int>("inpipe") >= 0)) {Stack->push<string>(emptystring); return;} #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) @@ -263,14 +266,14 @@ void gen_runhistory2(stack *Stack) // Save a string in a local history named name. // If store=true, store the local history in the file historyfilename(name). -#line 195 "runhistory.in" +#line 198 "runhistory.in" // void saveline(string name, string value, bool store=true); void gen_runhistory3(stack *Stack) { bool store=vm::pop<bool>(Stack,true); string value=vm::pop<string>(Stack); string name=vm::pop<string>(Stack); -#line 196 "runhistory.in" +#line 199 "runhistory.in" #if defined(HAVE_LIBREADLINE) && defined(HAVE_LIBCURSES) store_history(&history_save); bool newhistory=historyMap.find(name) == historyMap.end(); @@ -303,13 +306,13 @@ namespace trans { void gen_runhistory_venv(venv &ve) { -#line 105 "runhistory.in" +#line 108 "runhistory.in" addFunc(ve, run::gen_runhistory0, stringArray(), SYM(history), formal(primString() , SYM(name), false, false), formal(primInt(), SYM(n), true, false)); -#line 138 "runhistory.in" +#line 141 "runhistory.in" addFunc(ve, run::gen_runhistory1, stringArray(), SYM(history), formal(primInt(), SYM(n), true, false)); -#line 149 "runhistory.in" +#line 152 "runhistory.in" addFunc(ve, run::gen_runhistory2, primString() , SYM(readline), formal(primString() , SYM(prompt), true, false), formal(primString() , SYM(name), true, false), formal(primBoolean(), SYM(tabcompletion), true, false)); -#line 193 "runhistory.in" +#line 196 "runhistory.in" addFunc(ve, run::gen_runhistory3, primVoid(), SYM(saveline), formal(primString() , SYM(name), false, false), formal(primString() , SYM(value), false, false), formal(primBoolean(), SYM(store), true, false)); } diff --git a/Build/source/utils/asymptote/runhistory.in b/Build/source/utils/asymptote/runhistory.in index e2f502f8f3e..851c808fe2c 100644 --- a/Build/source/utils/asymptote/runhistory.in +++ b/Build/source/utils/asymptote/runhistory.in @@ -88,8 +88,11 @@ void cleanup() for(historyMap_t::iterator h=historyMap.begin(); h != historyMap.end(); ++h) { history_set_history_state(&h->second.state); - stifle_history(nlines); - if(h->second.store) write_history(historyfilename(h->first).c_str()); + if(h->second.store) { + stifle_history(nlines); + write_history(historyfilename(h->first).c_str()); + unstifle_history(); + } } history_set_history_state(&history_save); #endif diff --git a/Build/source/utils/asymptote/runlabel.cc b/Build/source/utils/asymptote/runlabel.cc index 210c65c5885..c64b64258e3 100644 --- a/Build/source/utils/asymptote/runlabel.cc +++ b/Build/source/utils/asymptote/runlabel.cc @@ -136,10 +136,19 @@ array *readpath(const string& psname, bool keep, { double vscale=vsign*hscale; array *PP=new array(0); + + char *oldPath=NULL; + string dir=stripFile(outname()); + if(!dir.empty()) { + oldPath=getPath(); + setPath(dir.c_str()); + } + mem::vector<string> cmd; cmd.push_back(getSetting<string>("gs")); cmd.push_back("-q"); cmd.push_back("-dBATCH"); + cmd.push_back("-P"); if(safe) cmd.push_back("-dSAFER"); #ifdef __MSDOS__ const string null="NUL"; @@ -148,7 +157,7 @@ array *readpath(const string& psname, bool keep, #endif cmd.push_back("-sDEVICE=epswrite"); cmd.push_back("-sOutputFile="+null); - cmd.push_back(psname); + cmd.push_back(stripDir(psname)); iopipestream gs(cmd,"gs","Ghostscript"); while(true) { stringstream buf; @@ -241,6 +250,9 @@ array *readpath(const string& psname, bool keep, } } + if(oldPath != NULL) + setPath(oldPath); + if(!keep) unlink(psname.c_str()); return PP; @@ -255,7 +267,7 @@ array *readpath(const string& psname, bool keep, #endif namespace run { -#line 208 "runlabel.in" +#line 220 "runlabel.in" // void label(picture *f, string *s, string *size, transform t, pair position, pair align, pen p); void gen_runlabel0(stack *Stack) { @@ -266,26 +278,26 @@ void gen_runlabel0(stack *Stack) string * size=vm::pop<string *>(Stack); string * s=vm::pop<string *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 210 "runlabel.in" +#line 222 "runlabel.in" f->append(new drawLabel(*s,*size,t,position,align,p)); } -#line 214 "runlabel.in" +#line 226 "runlabel.in" // bool labels(picture *f); void gen_runlabel1(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 215 "runlabel.in" +#line 227 "runlabel.in" {Stack->push<bool>(f->havelabels()); return;} } -#line 219 "runlabel.in" +#line 231 "runlabel.in" // realarray* texsize(string *s, pen p=CURRENTPEN); void gen_runlabel2(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); string * s=vm::pop<string *>(Stack); -#line 220 "runlabel.in" +#line 232 "runlabel.in" texinit(); processDataStruct &pd=processData(); @@ -304,13 +316,13 @@ void gen_runlabel2(stack *Stack) {Stack->push<realarray*>(t); return;} } -#line 239 "runlabel.in" +#line 251 "runlabel.in" // patharray2* _texpath(stringarray *s, penarray *p); void gen_runlabel3(stack *Stack) { penarray * p=vm::pop<penarray *>(Stack); stringarray * s=vm::pop<stringarray *>(Stack); -#line 240 "runlabel.in" +#line 252 "runlabel.in" size_t n=checkArrays(s,p); if(n == 0) {Stack->push<patharray2*>(new array(0)); return;} @@ -413,13 +425,13 @@ void gen_runlabel3(stack *Stack) {Stack->push<patharray2*>(pdf ? readpath(psname,keep,0.1) : readpath(psname,keep,0.12,-1.0)); return;} } -#line 343 "runlabel.in" +#line 355 "runlabel.in" // patharray2* textpath(stringarray *s, penarray *p); void gen_runlabel4(stack *Stack) { penarray * p=vm::pop<penarray *>(Stack); stringarray * s=vm::pop<stringarray *>(Stack); -#line 344 "runlabel.in" +#line 356 "runlabel.in" size_t n=checkArrays(s,p); if(n == 0) {Stack->push<patharray2*>(new array(0)); return;} @@ -457,6 +469,7 @@ void gen_runlabel4(stack *Stack) cmd2.push_back("-dNOCACHE"); cmd2.push_back("-dNOPAUSE"); cmd2.push_back("-dBATCH"); + cmd2.push_back("-P"); if(safe) cmd2.push_back("-dSAFER"); cmd2.push_back("-sDEVICE=epswrite"); cmd2.push_back("-sOutputFile=-"); @@ -490,13 +503,13 @@ void gen_runlabel4(stack *Stack) {Stack->push<patharray2*>(readpath(psname,keep,0.1)); return;} } -#line 415 "runlabel.in" +#line 428 "runlabel.in" // patharray* _strokepath(path g, pen p=CURRENTPEN); void gen_runlabel5(stack *Stack) { pen p=vm::pop<pen>(Stack,CURRENTPEN); path g=vm::pop<path>(Stack); -#line 416 "runlabel.in" +#line 429 "runlabel.in" array *P=new array(0); if(g.size() == 0) {Stack->push<patharray*>(P); return;} @@ -526,17 +539,17 @@ namespace trans { void gen_runlabel_venv(venv &ve) { -#line 208 "runlabel.in" +#line 220 "runlabel.in" addFunc(ve, run::gen_runlabel0, primVoid(), SYM(label), formal(primPicture(), SYM(f), false, false), formal(primString(), SYM(s), false, false), formal(primString(), SYM(size), false, false), formal(primTransform(), SYM(t), false, false), formal(primPair(), SYM(position), false, false), formal(primPair(), SYM(align), false, false), formal(primPen(), SYM(p), false, false)); -#line 214 "runlabel.in" +#line 226 "runlabel.in" addFunc(ve, run::gen_runlabel1, primBoolean(), SYM(labels), formal(primPicture(), SYM(f), false, false)); -#line 219 "runlabel.in" +#line 231 "runlabel.in" addFunc(ve, run::gen_runlabel2, realArray(), SYM(texsize), formal(primString(), SYM(s), false, false), formal(primPen(), SYM(p), true, false)); -#line 239 "runlabel.in" +#line 251 "runlabel.in" addFunc(ve, run::gen_runlabel3, pathArray2() , SYM(_texpath), formal(stringArray() , SYM(s), false, false), formal(penArray() , SYM(p), false, false)); -#line 343 "runlabel.in" +#line 355 "runlabel.in" addFunc(ve, run::gen_runlabel4, pathArray2() , SYM(textpath), formal(stringArray() , SYM(s), false, false), formal(penArray() , SYM(p), false, false)); -#line 415 "runlabel.in" +#line 428 "runlabel.in" addFunc(ve, run::gen_runlabel5, pathArray() , SYM(_strokepath), formal(primPath(), SYM(g), false, false), formal(primPen(), SYM(p), true, false)); } diff --git a/Build/source/utils/asymptote/runlabel.in b/Build/source/utils/asymptote/runlabel.in index 0fa707bfdaa..20fdf38a3a7 100644 --- a/Build/source/utils/asymptote/runlabel.in +++ b/Build/source/utils/asymptote/runlabel.in @@ -92,10 +92,19 @@ array *readpath(const string& psname, bool keep, { double vscale=vsign*hscale; array *PP=new array(0); + + char *oldPath=NULL; + string dir=stripFile(outname()); + if(!dir.empty()) { + oldPath=getPath(); + setPath(dir.c_str()); + } + mem::vector<string> cmd; cmd.push_back(getSetting<string>("gs")); cmd.push_back("-q"); cmd.push_back("-dBATCH"); + cmd.push_back("-P"); if(safe) cmd.push_back("-dSAFER"); #ifdef __MSDOS__ const string null="NUL"; @@ -104,7 +113,7 @@ array *readpath(const string& psname, bool keep, #endif cmd.push_back("-sDEVICE=epswrite"); cmd.push_back("-sOutputFile="+null); - cmd.push_back(psname); + cmd.push_back(stripDir(psname)); iopipestream gs(cmd,"gs","Ghostscript"); while(true) { stringstream buf; @@ -197,6 +206,9 @@ array *readpath(const string& psname, bool keep, } } + if(oldPath != NULL) + setPath(oldPath); + if(!keep) unlink(psname.c_str()); return PP; @@ -379,6 +391,7 @@ patharray2 *textpath(stringarray *s, penarray *p) cmd2.push_back("-dNOCACHE"); cmd2.push_back("-dNOPAUSE"); cmd2.push_back("-dBATCH"); + cmd2.push_back("-P"); if(safe) cmd2.push_back("-dSAFER"); cmd2.push_back("-sDEVICE=epswrite"); cmd2.push_back("-sOutputFile=-"); diff --git a/Build/source/utils/asymptote/runpair.cc b/Build/source/utils/asymptote/runpair.cc index 0fdcc20790a..4e68bf1a1a5 100644 --- a/Build/source/utils/asymptote/runpair.cc +++ b/Build/source/utils/asymptote/runpair.cc @@ -234,167 +234,191 @@ void gen_runpair13(stack *Stack) { real deg=vm::pop<real>(Stack); #line 122 "runpair.in" + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 1) {Stack->push<real>(1); return;} + if(m == 3) {Stack->push<real>(-1); return;} + {Stack->push<real>(0.0); return;} + } {Stack->push<real>(sin(radians(deg))); return;} } -#line 126 "runpair.in" +#line 134 "runpair.in" // real Cos(real deg); void gen_runpair14(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 127 "runpair.in" +#line 135 "runpair.in" + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 0) {Stack->push<real>(1); return;} + if(m == 2) {Stack->push<real>(-1); return;} + {Stack->push<real>(0.0); return;} + } {Stack->push<real>(cos(radians(deg))); return;} } -#line 131 "runpair.in" +#line 147 "runpair.in" // real Tan(real deg); void gen_runpair15(stack *Stack) { real deg=vm::pop<real>(Stack); -#line 132 "runpair.in" +#line 148 "runpair.in" + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 1) {Stack->push<real>(HUGE_VAL); return;} + if(m == 3) {Stack->push<real>(-HUGE_VAL); return;} + {Stack->push<real>(0.0); return;} + } {Stack->push<real>(tan(radians(deg))); return;} } -#line 136 "runpair.in" +#line 160 "runpair.in" // real aSin(real x); void gen_runpair16(stack *Stack) { real x=vm::pop<real>(Stack); -#line 137 "runpair.in" +#line 161 "runpair.in" {Stack->push<real>(degrees(asin(x))); return;} } -#line 141 "runpair.in" +#line 165 "runpair.in" // real aCos(real x); void gen_runpair17(stack *Stack) { real x=vm::pop<real>(Stack); -#line 142 "runpair.in" +#line 166 "runpair.in" {Stack->push<real>(degrees(acos(x))); return;} } -#line 146 "runpair.in" +#line 170 "runpair.in" // real aTan(real x); void gen_runpair18(stack *Stack) { real x=vm::pop<real>(Stack); -#line 147 "runpair.in" +#line 171 "runpair.in" {Stack->push<real>(degrees(atan(x))); return;} } -#line 151 "runpair.in" +#line 175 "runpair.in" // pair unit(pair z); void gen_runpair19(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 152 "runpair.in" +#line 176 "runpair.in" {Stack->push<pair>(unit(z)); return;} } -#line 156 "runpair.in" +#line 180 "runpair.in" // pair dir(real degrees); void gen_runpair20(stack *Stack) { real degrees=vm::pop<real>(Stack); -#line 157 "runpair.in" +#line 181 "runpair.in" {Stack->push<pair>(expi(radians(degrees))); return;} } -#line 161 "runpair.in" +#line 185 "runpair.in" // pair dir(explicit pair z); void gen_runpair21(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 162 "runpair.in" +#line 186 "runpair.in" {Stack->push<pair>(unit(z)); return;} } -#line 166 "runpair.in" +#line 190 "runpair.in" // pair expi(real angle); void gen_runpair22(stack *Stack) { real angle=vm::pop<real>(Stack); -#line 167 "runpair.in" +#line 191 "runpair.in" {Stack->push<pair>(expi(angle)); return;} } -#line 171 "runpair.in" +#line 195 "runpair.in" // pair exp(explicit pair z); void gen_runpair23(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 172 "runpair.in" +#line 196 "runpair.in" {Stack->push<pair>(exp(z)); return;} } -#line 176 "runpair.in" +#line 200 "runpair.in" // pair log(explicit pair z); void gen_runpair24(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 177 "runpair.in" +#line 201 "runpair.in" {Stack->push<pair>(pair(log(z.length()),z.angle())); return;} } -#line 181 "runpair.in" +#line 205 "runpair.in" // pair sin(explicit pair z); void gen_runpair25(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 182 "runpair.in" +#line 206 "runpair.in" {Stack->push<pair>(sin(z)); return;} } -#line 186 "runpair.in" +#line 210 "runpair.in" // pair cos(explicit pair z); void gen_runpair26(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 187 "runpair.in" +#line 211 "runpair.in" {Stack->push<pair>(pair(cos(z.getx())*cosh(z.gety()),-sin(z.getx())*sinh(z.gety()))); return;} } // Complex Gamma function -#line 192 "runpair.in" +#line 216 "runpair.in" // pair gamma(explicit pair z); void gen_runpair27(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 193 "runpair.in" +#line 217 "runpair.in" {Stack->push<pair>(gamma(z)); return;} } -#line 197 "runpair.in" +#line 221 "runpair.in" // pair conj(pair z); void gen_runpair28(stack *Stack) { pair z=vm::pop<pair>(Stack); -#line 198 "runpair.in" +#line 222 "runpair.in" {Stack->push<pair>(conj(z)); return;} } -#line 202 "runpair.in" +#line 226 "runpair.in" // pair realmult(pair z, pair w); void gen_runpair29(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 203 "runpair.in" +#line 227 "runpair.in" {Stack->push<pair>(pair(z.getx()*w.getx(),z.gety()*w.gety())); return;} } // To avoid confusion, a dot product requires explicit pair arguments. -#line 208 "runpair.in" +#line 232 "runpair.in" // real dot(explicit pair z, explicit pair w); void gen_runpair30(stack *Stack) { pair w=vm::pop<pair>(Stack); pair z=vm::pop<pair>(Stack); -#line 209 "runpair.in" +#line 233 "runpair.in" {Stack->push<real>(dot(z,w)); return;} } -#line 213 "runpair.in" +#line 237 "runpair.in" // pair bezier(pair a, pair b, pair c, pair d, real t); void gen_runpair31(stack *Stack) { @@ -403,13 +427,13 @@ void gen_runpair31(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 214 "runpair.in" +#line 238 "runpair.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 220 "runpair.in" +#line 244 "runpair.in" // pair bezierP(pair a, pair b, pair c, pair d, real t); void gen_runpair32(stack *Stack) { @@ -418,11 +442,11 @@ void gen_runpair32(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 221 "runpair.in" +#line 245 "runpair.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 225 "runpair.in" +#line 249 "runpair.in" // pair bezierPP(pair a, pair b, pair c, pair d, real t); void gen_runpair33(stack *Stack) { @@ -431,11 +455,11 @@ void gen_runpair33(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 226 "runpair.in" +#line 250 "runpair.in" {Stack->push<pair>(6.0*(t*(d-a+3.0*(b-c))+a+c-2.0*b)); return;} } -#line 230 "runpair.in" +#line 254 "runpair.in" // pair bezierPPP(pair a, pair b, pair c, pair d); void gen_runpair34(stack *Stack) { @@ -443,7 +467,7 @@ void gen_runpair34(stack *Stack) pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 231 "runpair.in" +#line 255 "runpair.in" {Stack->push<pair>(6.0*(d-a+3.0*(b-c))); return;} } @@ -481,47 +505,47 @@ void gen_runpair_venv(venv &ve) addFunc(ve, run::gen_runpair12, primReal(), SYM(Degrees), formal(primReal(), SYM(radians), false, false)); #line 121 "runpair.in" addFunc(ve, run::gen_runpair13, primReal(), SYM(Sin), formal(primReal(), SYM(deg), false, false)); -#line 126 "runpair.in" +#line 134 "runpair.in" addFunc(ve, run::gen_runpair14, primReal(), SYM(Cos), formal(primReal(), SYM(deg), false, false)); -#line 131 "runpair.in" +#line 147 "runpair.in" addFunc(ve, run::gen_runpair15, primReal(), SYM(Tan), formal(primReal(), SYM(deg), false, false)); -#line 136 "runpair.in" +#line 160 "runpair.in" addFunc(ve, run::gen_runpair16, primReal(), SYM(aSin), formal(primReal(), SYM(x), false, false)); -#line 141 "runpair.in" +#line 165 "runpair.in" addFunc(ve, run::gen_runpair17, primReal(), SYM(aCos), formal(primReal(), SYM(x), false, false)); -#line 146 "runpair.in" +#line 170 "runpair.in" addFunc(ve, run::gen_runpair18, primReal(), SYM(aTan), formal(primReal(), SYM(x), false, false)); -#line 151 "runpair.in" +#line 175 "runpair.in" addFunc(ve, run::gen_runpair19, primPair(), SYM(unit), formal(primPair(), SYM(z), false, false)); -#line 156 "runpair.in" +#line 180 "runpair.in" addFunc(ve, run::gen_runpair20, primPair(), SYM(dir), formal(primReal(), SYM(degrees), false, false)); -#line 161 "runpair.in" +#line 185 "runpair.in" addFunc(ve, run::gen_runpair21, primPair(), SYM(dir), formal(primPair(), SYM(z), false, true)); -#line 166 "runpair.in" +#line 190 "runpair.in" addFunc(ve, run::gen_runpair22, primPair(), SYM(expi), formal(primReal(), SYM(angle), false, false)); -#line 171 "runpair.in" +#line 195 "runpair.in" addFunc(ve, run::gen_runpair23, primPair(), SYM(exp), formal(primPair(), SYM(z), false, true)); -#line 176 "runpair.in" +#line 200 "runpair.in" addFunc(ve, run::gen_runpair24, primPair(), SYM(log), formal(primPair(), SYM(z), false, true)); -#line 181 "runpair.in" +#line 205 "runpair.in" addFunc(ve, run::gen_runpair25, primPair(), SYM(sin), formal(primPair(), SYM(z), false, true)); -#line 186 "runpair.in" +#line 210 "runpair.in" addFunc(ve, run::gen_runpair26, primPair(), SYM(cos), formal(primPair(), SYM(z), false, true)); -#line 191 "runpair.in" +#line 215 "runpair.in" addFunc(ve, run::gen_runpair27, primPair(), SYM(gamma), formal(primPair(), SYM(z), false, true)); -#line 197 "runpair.in" +#line 221 "runpair.in" addFunc(ve, run::gen_runpair28, primPair(), SYM(conj), formal(primPair(), SYM(z), false, false)); -#line 202 "runpair.in" +#line 226 "runpair.in" addFunc(ve, run::gen_runpair29, primPair(), SYM(realmult), formal(primPair(), SYM(z), false, false), formal(primPair(), SYM(w), false, false)); -#line 207 "runpair.in" +#line 231 "runpair.in" addFunc(ve, run::gen_runpair30, primReal(), SYM(dot), formal(primPair(), SYM(z), false, true), formal(primPair(), SYM(w), false, true)); -#line 213 "runpair.in" +#line 237 "runpair.in" addFunc(ve, run::gen_runpair31, primPair(), SYM(bezier), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 220 "runpair.in" +#line 244 "runpair.in" addFunc(ve, run::gen_runpair32, primPair(), SYM(bezierP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 225 "runpair.in" +#line 249 "runpair.in" addFunc(ve, run::gen_runpair33, primPair(), SYM(bezierPP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false), formal(primReal(), SYM(t), false, false)); -#line 230 "runpair.in" +#line 254 "runpair.in" addFunc(ve, run::gen_runpair34, primPair(), SYM(bezierPPP), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false)); } diff --git a/Build/source/utils/asymptote/runpair.in b/Build/source/utils/asymptote/runpair.in index c7809a3558b..d6604454f5e 100644 --- a/Build/source/utils/asymptote/runpair.in +++ b/Build/source/utils/asymptote/runpair.in @@ -120,16 +120,40 @@ real Degrees(real radians) real Sin(real deg) { + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 1) return 1; + if(m == 3) return -1; + return 0.0; + } return sin(radians(deg)); } real Cos(real deg) { + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 0) return 1; + if(m == 2) return -1; + return 0.0; + } return cos(radians(deg)); } real Tan(real deg) { + int n=deg/90.0; + if(deg == n*90.0) { + int m=n % 4; + if(m < 0) m += 4; + if(m == 1) return HUGE_VAL; + if(m == 3) return -HUGE_VAL; + return 0.0; + } return tan(radians(deg)); } diff --git a/Build/source/utils/asymptote/runpath.cc b/Build/source/utils/asymptote/runpath.cc index d6873fffb32..64a0d08b8e3 100644 --- a/Build/source/utils/asymptote/runpath.cc +++ b/Build/source/utils/asymptote/runpath.cc @@ -502,26 +502,35 @@ void gen_runpath33(stack *Stack) } #line 276 "runpath.in" -// pair min(patharray *a); +// Int size(patharray *p); void gen_runpath34(stack *Stack) { - patharray * a=vm::pop<patharray *>(Stack); + patharray * p=vm::pop<patharray *>(Stack); #line 277 "runpath.in" - if (!a) { - error("min called on null path array"); - {Stack->push<pair>(pair(0,0)); return;} - } - if (a->empty()) { - error("min called on empty path array"); - {Stack->push<pair>(pair(0,0)); return;} - } + size_t size=checkArray(p); + Int count=0; + for (size_t i = 0; i < size; i++) + count += read<path *>(p,i)->size(); + {Stack->push<Int>(count); return;} +} - path *g = a->read<path *>(0); +#line 285 "runpath.in" +// pair min(patharray *p); +void gen_runpath35(stack *Stack) +{ + patharray * p=vm::pop<patharray *>(Stack); +#line 286 "runpath.in" + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); + + path *g = p->read<path *>(0); pair z = g->min(); double minx = z.getx(), miny = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path *g = a->read<path *>(i); + for (size_t i = 1; i < size; ++i) { + path *g = p->read<path *>(i); pair z = g->min(); double x = z.getx(), y = z.gety(); if (x < minx) @@ -533,27 +542,23 @@ void gen_runpath34(stack *Stack) {Stack->push<pair>(pair(minx, miny)); return;} } -#line 304 "runpath.in" -// pair max(patharray *a); -void gen_runpath35(stack *Stack) +#line 309 "runpath.in" +// pair max(patharray *p); +void gen_runpath36(stack *Stack) { - patharray * a=vm::pop<patharray *>(Stack); -#line 305 "runpath.in" - if (!a) { - error("max called on null path array"); - {Stack->push<pair>(pair(0,0)); return;} - } - if (a->empty()) { - error("max called on empty path array"); - {Stack->push<pair>(pair(0,0)); return;} - } + patharray * p=vm::pop<patharray *>(Stack); +#line 310 "runpath.in" + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); - path *g = a->read<path *>(0); + path *g = p->read<path *>(0); pair z = g->max(); double maxx = z.getx(), maxy = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path *g = a->read<path *>(i); + for (size_t i = 1; i < size; ++i) { + path *g = p->read<path *>(i); pair z = g->max(); double x = z.getx(), y = z.gety(); if (x > maxx) @@ -565,28 +570,24 @@ void gen_runpath35(stack *Stack) {Stack->push<pair>(pair(maxx, maxy)); return;} } -#line 332 "runpath.in" -// pair minAfterTransform(transform t, patharray *a); -void gen_runpath36(stack *Stack) +#line 333 "runpath.in" +// pair minAfterTransform(transform t, patharray *p); +void gen_runpath37(stack *Stack) { - patharray * a=vm::pop<patharray *>(Stack); + patharray * p=vm::pop<patharray *>(Stack); transform t=vm::pop<transform>(Stack); -#line 333 "runpath.in" - if (!a) { - error("minAfterTransform called on null path array"); - {Stack->push<pair>(pair(0,0)); return;} - } - if (a->empty()) { - error("minAfterTransform called on empty path array"); - {Stack->push<pair>(pair(0,0)); return;} - } +#line 334 "runpath.in" + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); - path g = a->read<path *>(0)->transformed(t); + path g = p->read<path *>(0)->transformed(t); pair z = g.min(); double minx = z.getx(), miny = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path g = a->read<path *>(i)->transformed(t); + for (size_t i = 1; i < size; ++i) { + path g = p->read<path *>(i)->transformed(t); pair z = g.min(); double x = z.getx(), y = z.gety(); if (x < minx) @@ -598,28 +599,24 @@ void gen_runpath36(stack *Stack) {Stack->push<pair>(pair(minx, miny)); return;} } -#line 360 "runpath.in" -// pair maxAfterTransform(transform t, patharray *a); -void gen_runpath37(stack *Stack) +#line 357 "runpath.in" +// pair maxAfterTransform(transform t, patharray *p); +void gen_runpath38(stack *Stack) { - patharray * a=vm::pop<patharray *>(Stack); + patharray * p=vm::pop<patharray *>(Stack); transform t=vm::pop<transform>(Stack); -#line 361 "runpath.in" - if (!a) { - error("maxAfterTransform called on null path array"); - {Stack->push<pair>(pair(0,0)); return;} - } - if (a->empty()) { - error("maxAfterTransform called on empty path array"); - {Stack->push<pair>(pair(0,0)); return;} - } +#line 358 "runpath.in" + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); - path g = a->read<path *>(0)->transformed(t); + path g = p->read<path *>(0)->transformed(t); pair z = g.max(); double maxx = z.getx(), maxy = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path g = a->read<path *>(i)->transformed(t); + for (size_t i = 1; i < size; ++i) { + path g = p->read<path *>(i)->transformed(t); pair z = g.max(); double x = z.getx(), y = z.gety(); if (x > maxx) @@ -631,12 +628,12 @@ void gen_runpath37(stack *Stack) {Stack->push<pair>(pair(maxx, maxy)); return;} } -#line 388 "runpath.in" +#line 381 "runpath.in" // realarray* mintimes(path p); -void gen_runpath38(stack *Stack) +void gen_runpath39(stack *Stack) { path p=vm::pop<path>(Stack); -#line 389 "runpath.in" +#line 382 "runpath.in" array *V=new array(2); pair z=p.mintimes(); (*V)[0]=z.getx(); @@ -644,12 +641,12 @@ void gen_runpath38(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 397 "runpath.in" +#line 390 "runpath.in" // realarray* maxtimes(path p); -void gen_runpath39(stack *Stack) +void gen_runpath40(stack *Stack) { path p=vm::pop<path>(Stack); -#line 398 "runpath.in" +#line 391 "runpath.in" array *V=new array(2); pair z=p.maxtimes(); (*V)[0]=z.getx(); @@ -657,74 +654,74 @@ void gen_runpath39(stack *Stack) {Stack->push<realarray*>(V); return;} } -#line 406 "runpath.in" +#line 399 "runpath.in" // real relativedistance(real theta, real phi, real t, bool atleast); -void gen_runpath40(stack *Stack) +void gen_runpath41(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 407 "runpath.in" +#line 400 "runpath.in" {Stack->push<real>(camp::velocity(theta,phi,tension(t,atleast))); return;} } -#line 411 "runpath.in" +#line 404 "runpath.in" // Int windingnumber(patharray *p, pair z); -void gen_runpath41(stack *Stack) +void gen_runpath42(stack *Stack) { pair z=vm::pop<pair>(Stack); patharray * p=vm::pop<patharray *>(Stack); -#line 412 "runpath.in" +#line 405 "runpath.in" {Stack->push<Int>(windingnumber(p,z)); return;} } -#line 416 "runpath.in" +#line 409 "runpath.in" // bool inside(explicit patharray *g, pair z, pen fillrule=CURRENTPEN); -void gen_runpath42(stack *Stack) +void gen_runpath43(stack *Stack) { pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); pair z=vm::pop<pair>(Stack); patharray * g=vm::pop<patharray *>(Stack); -#line 417 "runpath.in" +#line 410 "runpath.in" {Stack->push<bool>(fillrule.inside(windingnumber(g,z))); return;} } -#line 421 "runpath.in" +#line 414 "runpath.in" // bool inside(path g, pair z, pen fillrule=CURRENTPEN); -void gen_runpath43(stack *Stack) +void gen_runpath44(stack *Stack) { pen fillrule=vm::pop<pen>(Stack,CURRENTPEN); pair z=vm::pop<pair>(Stack); path g=vm::pop<path>(Stack); -#line 422 "runpath.in" +#line 415 "runpath.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 428 "runpath.in" +#line 421 "runpath.in" // real side(pair a, pair b, pair c); -void gen_runpath44(stack *Stack) +void gen_runpath45(stack *Stack) { pair c=vm::pop<pair>(Stack); pair b=vm::pop<pair>(Stack); pair a=vm::pop<pair>(Stack); -#line 429 "runpath.in" +#line 422 "runpath.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 435 "runpath.in" +#line 428 "runpath.in" // real incircle(pair a, pair b, pair c, pair d); -void gen_runpath45(stack *Stack) +void gen_runpath46(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 436 "runpath.in" +#line 429 "runpath.in" {Stack->push<real>(incircle(a.getx(),a.gety(),b.getx(),b.gety(),c.getx(),c.gety(), d.getx(),d.gety())); return;} } @@ -804,29 +801,31 @@ void gen_runpath_venv(venv &ve) #line 271 "runpath.in" addFunc(ve, run::gen_runpath33, primPair(), SYM(max), formal(primPath(), SYM(p), false, false)); #line 276 "runpath.in" - addFunc(ve, run::gen_runpath34, primPair(), SYM(min), formal(pathArray() , SYM(a), false, false)); -#line 304 "runpath.in" - addFunc(ve, run::gen_runpath35, primPair(), SYM(max), formal(pathArray() , SYM(a), false, false)); -#line 332 "runpath.in" - addFunc(ve, run::gen_runpath36, primPair(), SYM(minAfterTransform), formal(primTransform(), SYM(t), false, false), formal(pathArray() , SYM(a), false, false)); -#line 360 "runpath.in" - addFunc(ve, run::gen_runpath37, primPair(), SYM(maxAfterTransform), formal(primTransform(), SYM(t), false, false), formal(pathArray() , SYM(a), false, false)); -#line 388 "runpath.in" - addFunc(ve, run::gen_runpath38, realArray(), SYM(mintimes), formal(primPath(), SYM(p), false, false)); -#line 397 "runpath.in" - addFunc(ve, run::gen_runpath39, realArray(), SYM(maxtimes), formal(primPath(), SYM(p), false, false)); -#line 406 "runpath.in" - addFunc(ve, run::gen_runpath40, primReal(), SYM(relativedistance), formal(primReal(), SYM(theta), false, false), formal(primReal(), SYM(phi), false, false), formal(primReal(), SYM(t), false, false), formal(primBoolean(), SYM(atleast), false, false)); -#line 411 "runpath.in" - addFunc(ve, run::gen_runpath41, primInt(), SYM(windingnumber), formal(pathArray() , SYM(p), false, false), formal(primPair(), SYM(z), false, false)); -#line 416 "runpath.in" - addFunc(ve, run::gen_runpath42, primBoolean(), SYM(inside), formal(pathArray() , SYM(g), false, true), formal(primPair(), SYM(z), false, false), formal(primPen(), SYM(fillrule), true, false)); -#line 421 "runpath.in" - addFunc(ve, run::gen_runpath43, primBoolean(), SYM(inside), formal(primPath(), SYM(g), false, false), formal(primPair(), SYM(z), false, false), formal(primPen(), SYM(fillrule), true, false)); + addFunc(ve, run::gen_runpath34, primInt(), SYM(size), formal(pathArray() , SYM(p), false, false)); +#line 285 "runpath.in" + addFunc(ve, run::gen_runpath35, primPair(), SYM(min), formal(pathArray() , SYM(p), false, false)); +#line 309 "runpath.in" + addFunc(ve, run::gen_runpath36, primPair(), SYM(max), formal(pathArray() , SYM(p), false, false)); +#line 333 "runpath.in" + addFunc(ve, run::gen_runpath37, primPair(), SYM(minAfterTransform), formal(primTransform(), SYM(t), false, false), formal(pathArray() , SYM(p), false, false)); +#line 357 "runpath.in" + addFunc(ve, run::gen_runpath38, primPair(), SYM(maxAfterTransform), formal(primTransform(), SYM(t), false, false), formal(pathArray() , SYM(p), false, false)); +#line 381 "runpath.in" + addFunc(ve, run::gen_runpath39, realArray(), SYM(mintimes), formal(primPath(), SYM(p), false, false)); +#line 390 "runpath.in" + addFunc(ve, run::gen_runpath40, realArray(), SYM(maxtimes), formal(primPath(), SYM(p), false, false)); +#line 399 "runpath.in" + addFunc(ve, run::gen_runpath41, primReal(), SYM(relativedistance), formal(primReal(), SYM(theta), false, false), formal(primReal(), SYM(phi), false, false), formal(primReal(), SYM(t), false, false), formal(primBoolean(), SYM(atleast), false, false)); +#line 404 "runpath.in" + addFunc(ve, run::gen_runpath42, primInt(), SYM(windingnumber), formal(pathArray() , SYM(p), false, false), formal(primPair(), SYM(z), false, false)); +#line 409 "runpath.in" + addFunc(ve, run::gen_runpath43, primBoolean(), SYM(inside), formal(pathArray() , SYM(g), false, true), formal(primPair(), SYM(z), false, false), formal(primPen(), SYM(fillrule), true, false)); +#line 414 "runpath.in" + addFunc(ve, run::gen_runpath44, primBoolean(), SYM(inside), formal(primPath(), SYM(g), false, false), formal(primPair(), SYM(z), false, false), formal(primPen(), SYM(fillrule), true, false)); +#line 419 "runpath.in" + addFunc(ve, run::gen_runpath45, primReal(), SYM(side), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false)); #line 426 "runpath.in" - addFunc(ve, run::gen_runpath44, primReal(), SYM(side), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false)); -#line 433 "runpath.in" - addFunc(ve, run::gen_runpath45, primReal(), SYM(incircle), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false)); + addFunc(ve, run::gen_runpath46, primReal(), SYM(incircle), formal(primPair(), SYM(a), false, false), formal(primPair(), SYM(b), false, false), formal(primPair(), SYM(c), false, false), formal(primPair(), SYM(d), false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runpath.in b/Build/source/utils/asymptote/runpath.in index b8a8d8c204a..b39a082a4b3 100644 --- a/Build/source/utils/asymptote/runpath.in +++ b/Build/source/utils/asymptote/runpath.in @@ -273,23 +273,28 @@ pair max(path p) return p.max(); } -pair min(patharray *a) +Int size(patharray *p) { - if (!a) { - error("min called on null path array"); - return pair(0,0); - } - if (a->empty()) { - error("min called on empty path array"); - return pair(0,0); - } + size_t size=checkArray(p); + Int count=0; + for (size_t i = 0; i < size; i++) + count += read<path *>(p,i)->size(); + return count; +} + +pair min(patharray *p) +{ + size_t size=checkArray(p); - path *g = a->read<path *>(0); + if(size == 0) + error(nopoints); + + path *g = p->read<path *>(0); pair z = g->min(); double minx = z.getx(), miny = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path *g = a->read<path *>(i); + for (size_t i = 1; i < size; ++i) { + path *g = p->read<path *>(i); pair z = g->min(); double x = z.getx(), y = z.gety(); if (x < minx) @@ -301,23 +306,19 @@ pair min(patharray *a) return pair(minx, miny); } -pair max(patharray *a) +pair max(patharray *p) { - if (!a) { - error("max called on null path array"); - return pair(0,0); - } - if (a->empty()) { - error("max called on empty path array"); - return pair(0,0); - } + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); - path *g = a->read<path *>(0); + path *g = p->read<path *>(0); pair z = g->max(); double maxx = z.getx(), maxy = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path *g = a->read<path *>(i); + for (size_t i = 1; i < size; ++i) { + path *g = p->read<path *>(i); pair z = g->max(); double x = z.getx(), y = z.gety(); if (x > maxx) @@ -329,23 +330,19 @@ pair max(patharray *a) return pair(maxx, maxy); } -pair minAfterTransform(transform t, patharray *a) +pair minAfterTransform(transform t, patharray *p) { - if (!a) { - error("minAfterTransform called on null path array"); - return pair(0,0); - } - if (a->empty()) { - error("minAfterTransform called on empty path array"); - return pair(0,0); - } + size_t size=checkArray(p); - path g = a->read<path *>(0)->transformed(t); + if(size == 0) + error(nopoints); + + path g = p->read<path *>(0)->transformed(t); pair z = g.min(); double minx = z.getx(), miny = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path g = a->read<path *>(i)->transformed(t); + for (size_t i = 1; i < size; ++i) { + path g = p->read<path *>(i)->transformed(t); pair z = g.min(); double x = z.getx(), y = z.gety(); if (x < minx) @@ -357,23 +354,19 @@ pair minAfterTransform(transform t, patharray *a) return pair(minx, miny); } -pair maxAfterTransform(transform t, patharray *a) +pair maxAfterTransform(transform t, patharray *p) { - if (!a) { - error("maxAfterTransform called on null path array"); - return pair(0,0); - } - if (a->empty()) { - error("maxAfterTransform called on empty path array"); - return pair(0,0); - } + size_t size=checkArray(p); + + if(size == 0) + error(nopoints); - path g = a->read<path *>(0)->transformed(t); + path g = p->read<path *>(0)->transformed(t); pair z = g.max(); double maxx = z.getx(), maxy = z.gety(); - for (size_t i = 1; i < a->size(); ++i) { - path g = a->read<path *>(i)->transformed(t); + for (size_t i = 1; i < size; ++i) { + path g = p->read<path *>(i)->transformed(t); pair z = g.max(); double x = z.getx(), y = z.gety(); if (x > maxx) diff --git a/Build/source/utils/asymptote/runpicture.cc b/Build/source/utils/asymptote/runpicture.cc index 60896b54031..3f1e84a1703 100644 --- a/Build/source/utils/asymptote/runpicture.cc +++ b/Build/source/utils/asymptote/runpicture.cc @@ -59,7 +59,7 @@ function *realRealFunction(); #define CURRENTPEN processData().currentpen -#line 28 "runpicture.in" +#line 29 "runpicture.in" #include "picture.h" #include "drawelement.h" #include "path.h" @@ -84,6 +84,7 @@ using namespace settings; using namespace vm; typedef array Intarray; +typedef array Intarray2; typedef array realarray; typedef array realarray2; typedef array pairarray; @@ -98,6 +99,7 @@ typedef callable callableTransform; typedef callable callablePen; using types::IntArray; +using types::IntArray2; using types::realArray; using types::realArray2; using types::pairArray; @@ -139,71 +141,71 @@ triple Zero; #endif namespace run { -#line 101 "runpicture.in" +#line 104 "runpicture.in" void newPicture(stack *Stack) { -#line 102 "runpicture.in" +#line 105 "runpicture.in" {Stack->push<picture*>(new picture()); return;} } -#line 106 "runpicture.in" +#line 109 "runpicture.in" // bool empty(picture *f); void gen_runpicture1(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 107 "runpicture.in" +#line 110 "runpicture.in" {Stack->push<bool>(f->null()); return;} } -#line 111 "runpicture.in" +#line 114 "runpicture.in" // void erase(picture *f); void gen_runpicture2(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 112 "runpicture.in" +#line 115 "runpicture.in" f->nodes.clear(); } -#line 116 "runpicture.in" +#line 119 "runpicture.in" // pair min(picture *f); void gen_runpicture3(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 117 "runpicture.in" +#line 120 "runpicture.in" {Stack->push<pair>(f->bounds().Min()); return;} } -#line 121 "runpicture.in" +#line 124 "runpicture.in" // pair max(picture *f); void gen_runpicture4(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 122 "runpicture.in" +#line 125 "runpicture.in" {Stack->push<pair>(f->bounds().Max()); return;} } -#line 126 "runpicture.in" +#line 129 "runpicture.in" // pair size(picture *f); void gen_runpicture5(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 127 "runpicture.in" +#line 130 "runpicture.in" bbox b=f->bounds(); {Stack->push<pair>(b.Max()-b.Min()); return;} } -#line 132 "runpicture.in" +#line 135 "runpicture.in" // void _draw(picture *f, path g, pen p); void gen_runpicture6(stack *Stack) { pen p=vm::pop<pen>(Stack); path g=vm::pop<path>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 133 "runpicture.in" +#line 136 "runpicture.in" f->append(new drawPath(g,p)); } -#line 137 "runpicture.in" +#line 140 "runpicture.in" // void fill(picture *f, patharray *g, pen p=CURRENTPEN, bool copy=true); void gen_runpicture7(stack *Stack) { @@ -211,12 +213,12 @@ void gen_runpicture7(stack *Stack) pen p=vm::pop<pen>(Stack,CURRENTPEN); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 138 "runpicture.in" +#line 141 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawFill(*copyarray(g),false,p)); } -#line 143 "runpicture.in" +#line 146 "runpicture.in" // void latticeshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray2 *p, transform t=identity, bool copy=true); void gen_runpicture8(stack *Stack) { @@ -227,13 +229,13 @@ void gen_runpicture8(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 146 "runpicture.in" +#line 149 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawLatticeShade(*copyarray(g),stroke,fillrule,*copyarray(p), t)); } -#line 152 "runpicture.in" +#line 155 "runpicture.in" // void axialshade(picture *f, patharray *g, bool stroke=false, pen pena, pair a, pen penb, pair b, bool copy=true); void gen_runpicture9(stack *Stack) { @@ -245,12 +247,12 @@ void gen_runpicture9(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 154 "runpicture.in" +#line 157 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawAxialShade(*copyarray(g),stroke,pena,a,penb,b)); } -#line 159 "runpicture.in" +#line 162 "runpicture.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 gen_runpicture10(stack *Stack) { @@ -264,12 +266,12 @@ void gen_runpicture10(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 161 "runpicture.in" +#line 164 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawRadialShade(*copyarray(g),stroke,pena,a,ra,penb,b,rb)); } -#line 166 "runpicture.in" +#line 169 "runpicture.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, pairarray *z, Intarray *edges, bool copy=true); void gen_runpicture11(stack *Stack) { @@ -281,7 +283,7 @@ void gen_runpicture11(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 169 "runpicture.in" +#line 172 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; checkArrays(p,z); checkArrays(z,edges); @@ -289,7 +291,7 @@ void gen_runpicture11(stack *Stack) *copyarray(z),*copyarray(edges))); } -#line 177 "runpicture.in" +#line 180 "runpicture.in" // void gouraudshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, penarray *p, Intarray *edges, bool copy=true); void gen_runpicture12(stack *Stack) { @@ -300,7 +302,7 @@ void gen_runpicture12(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 180 "runpicture.in" +#line 183 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; size_t n=checkArrays(p,edges); size_t m=checkArray(g); @@ -321,7 +323,7 @@ void gen_runpicture12(stack *Stack) *z,*copyarray(edges))); } -#line 201 "runpicture.in" +#line 204 "runpicture.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 gen_runpicture13(stack *Stack) { @@ -333,7 +335,7 @@ void gen_runpicture13(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 204 "runpicture.in" +#line 207 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; array *(*copyarray2)(array *a)=copy ? copyArray2: nop; if(b == NULL) b=g; @@ -345,7 +347,7 @@ void gen_runpicture13(stack *Stack) *copyarray(b),*copyarray2(z))); } -#line 216 "runpicture.in" +#line 219 "runpicture.in" // void functionshade(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, string shader=emptystring, bool copy=true); void gen_runpicture14(stack *Stack) { @@ -355,14 +357,14 @@ void gen_runpicture14(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 219 "runpicture.in" +#line 222 "runpicture.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 226 "runpicture.in" +#line 229 "runpicture.in" // void clip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); void gen_runpicture15(stack *Stack) { @@ -371,13 +373,13 @@ void gen_runpicture15(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 228 "runpicture.in" +#line 231 "runpicture.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 234 "runpicture.in" +#line 237 "runpicture.in" // void beginclip(picture *f, patharray *g, bool stroke=false, pen fillrule=CURRENTPEN, bool copy=true); void gen_runpicture16(stack *Stack) { @@ -386,57 +388,57 @@ void gen_runpicture16(stack *Stack) bool stroke=vm::pop<bool>(Stack,false); patharray * g=vm::pop<patharray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 236 "runpicture.in" +#line 239 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; f->append(new drawClipBegin(*copyarray(g),stroke,fillrule,false)); } -#line 241 "runpicture.in" +#line 244 "runpicture.in" // void endclip(picture *f); void gen_runpicture17(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 242 "runpicture.in" +#line 245 "runpicture.in" f->append(new drawClipEnd(false)); } -#line 246 "runpicture.in" +#line 249 "runpicture.in" // void gsave(picture *f); void gen_runpicture18(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 247 "runpicture.in" +#line 250 "runpicture.in" f->append(new drawGsave()); } -#line 251 "runpicture.in" +#line 254 "runpicture.in" // void grestore(picture *f); void gen_runpicture19(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 252 "runpicture.in" +#line 255 "runpicture.in" f->append(new drawGrestore()); } -#line 256 "runpicture.in" +#line 259 "runpicture.in" // void begingroup(picture *f); void gen_runpicture20(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 257 "runpicture.in" +#line 260 "runpicture.in" f->append(new drawBegin()); } -#line 261 "runpicture.in" +#line 264 "runpicture.in" // void endgroup(picture *f); void gen_runpicture21(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 262 "runpicture.in" +#line 265 "runpicture.in" f->append(new drawEnd()); } -#line 266 "runpicture.in" +#line 269 "runpicture.in" // void _begingroup3(picture *f, string name, real compression, real granularity, bool closed, bool tessellate, bool dobreak, bool nobreak, triple center, Int interaction); void gen_runpicture22(stack *Stack) { @@ -450,62 +452,62 @@ void gen_runpicture22(stack *Stack) real compression=vm::pop<real>(Stack); string name=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 269 "runpicture.in" +#line 272 "runpicture.in" f->append(new drawBegin3(name,compression,granularity, closed,tessellate,dobreak,nobreak, center,(Interaction) intcast(interaction))); } -#line 275 "runpicture.in" +#line 278 "runpicture.in" // void endgroup3(picture *f); void gen_runpicture23(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 276 "runpicture.in" +#line 279 "runpicture.in" f->append(new drawEnd3()); } -#line 280 "runpicture.in" +#line 283 "runpicture.in" // void add(picture *dest, picture *src); void gen_runpicture24(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 281 "runpicture.in" +#line 284 "runpicture.in" dest->add(*src); } -#line 285 "runpicture.in" +#line 288 "runpicture.in" // void prepend(picture *dest, picture *src); void gen_runpicture25(stack *Stack) { picture * src=vm::pop<picture *>(Stack); picture * dest=vm::pop<picture *>(Stack); -#line 286 "runpicture.in" +#line 289 "runpicture.in" dest->prepend(*src); } -#line 290 "runpicture.in" +#line 293 "runpicture.in" // void postscript(picture *f, string s); void gen_runpicture26(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 291 "runpicture.in" +#line 294 "runpicture.in" f->append(new drawVerbatim(PostScript,s)); } -#line 295 "runpicture.in" +#line 298 "runpicture.in" // void tex(picture *f, string s); void gen_runpicture27(stack *Stack) { string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 296 "runpicture.in" +#line 299 "runpicture.in" f->append(new drawVerbatim(TeX,s)); } -#line 300 "runpicture.in" +#line 303 "runpicture.in" // void postscript(picture *f, string s, pair min, pair max); void gen_runpicture28(stack *Stack) { @@ -513,11 +515,11 @@ void gen_runpicture28(stack *Stack) pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 301 "runpicture.in" +#line 304 "runpicture.in" f->append(new drawVerbatim(PostScript,s,min,max)); } -#line 305 "runpicture.in" +#line 308 "runpicture.in" // void tex(picture *f, string s, pair min, pair max); void gen_runpicture29(stack *Stack) { @@ -525,33 +527,33 @@ void gen_runpicture29(stack *Stack) pair min=vm::pop<pair>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 306 "runpicture.in" +#line 309 "runpicture.in" f->append(new drawVerbatim(TeX,s,min,max)); } -#line 310 "runpicture.in" +#line 313 "runpicture.in" // void texpreamble(string s); void gen_runpicture30(stack *Stack) { string s=vm::pop<string>(Stack); -#line 311 "runpicture.in" +#line 314 "runpicture.in" string t=s+"\n"; processDataStruct &pd=processData(); pd.TeXpipepreamble.push_back(t); pd.TeXpreamble.push_back(t); } -#line 318 "runpicture.in" +#line 321 "runpicture.in" // void deletepreamble(); void gen_runpicture31(stack *) { -#line 319 "runpicture.in" +#line 322 "runpicture.in" if(getSetting<bool>("inlinetex")) { unlink(buildname(outname(),"pre").c_str()); } } -#line 325 "runpicture.in" +#line 328 "runpicture.in" // void _labelpath(picture *f, string s, string size, path g, string justify, pair offset, pen p); void gen_runpicture32(stack *Stack) { @@ -562,40 +564,40 @@ void gen_runpicture32(stack *Stack) string size=vm::pop<string>(Stack); string s=vm::pop<string>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 327 "runpicture.in" +#line 330 "runpicture.in" f->append(new drawLabelPath(s,size,g,justify,offset,p)); } -#line 331 "runpicture.in" +#line 334 "runpicture.in" // void texreset(); void gen_runpicture33(stack *) { -#line 332 "runpicture.in" +#line 335 "runpicture.in" processDataStruct &pd=processData(); pd.TeXpipepreamble.clear(); pd.TeXpreamble.clear(); pd.tex.pipeclose(); } -#line 339 "runpicture.in" +#line 342 "runpicture.in" // void layer(picture *f); void gen_runpicture34(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 340 "runpicture.in" +#line 343 "runpicture.in" f->append(new drawLayer()); } -#line 344 "runpicture.in" +#line 347 "runpicture.in" // void newpage(picture *f); void gen_runpicture35(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 345 "runpicture.in" +#line 348 "runpicture.in" f->append(new drawNewPage()); } -#line 349 "runpicture.in" +#line 352 "runpicture.in" // void _image(picture *f, realarray2 *data, pair initial, pair final, penarray *palette=NULL, transform t=identity, bool copy=true, bool antialias=false); void gen_runpicture36(stack *Stack) { @@ -607,14 +609,14 @@ void gen_runpicture36(stack *Stack) pair initial=vm::pop<pair>(Stack); realarray2 * data=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 352 "runpicture.in" +#line 355 "runpicture.in" array *(*copyarray)(array *a)=copy ? copyArray: nop; array *(*copyarray2)(array *a)=copy ? copyArray2: nop; f->append(new drawPaletteImage(*copyarray2(data),*copyarray(palette), t*matrix(initial,final),antialias)); } -#line 359 "runpicture.in" +#line 362 "runpicture.in" // void _image(picture *f, penarray2 *data, pair initial, pair final, transform t=identity, bool copy=true, bool antialias=false); void gen_runpicture37(stack *Stack) { @@ -625,13 +627,13 @@ void gen_runpicture37(stack *Stack) pair initial=vm::pop<pair>(Stack); penarray2 * data=vm::pop<penarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 361 "runpicture.in" +#line 364 "runpicture.in" array *(*copyarray2)(array *a)=copy ? copyArray2: nop; f->append(new drawNoPaletteImage(*copyarray2(data),t*matrix(initial,final), antialias)); } -#line 367 "runpicture.in" +#line 370 "runpicture.in" // void _image(picture *f, callablePen *F, Int width, Int height, pair initial, pair final, transform t=identity, bool antialias=false); void gen_runpicture38(stack *Stack) { @@ -643,36 +645,36 @@ void gen_runpicture38(stack *Stack) Int width=vm::pop<Int>(Stack); callablePen * F=vm::pop<callablePen *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 369 "runpicture.in" +#line 372 "runpicture.in" f->append(new drawFunctionImage(Stack,F,width,height, t*matrix(initial,final),antialias)); } -#line 374 "runpicture.in" +#line 377 "runpicture.in" // string nativeformat(); void gen_runpicture39(stack *Stack) { -#line 375 "runpicture.in" +#line 378 "runpicture.in" {Stack->push<string>(nativeformat()); return;} } -#line 379 "runpicture.in" +#line 382 "runpicture.in" // bool latex(); void gen_runpicture40(stack *Stack) { -#line 380 "runpicture.in" +#line 383 "runpicture.in" {Stack->push<bool>(latex(getSetting<string>("tex"))); return;} } -#line 384 "runpicture.in" +#line 387 "runpicture.in" // bool pdf(); void gen_runpicture41(stack *Stack) { -#line 385 "runpicture.in" +#line 388 "runpicture.in" {Stack->push<bool>(pdf(getSetting<string>("tex"))); return;} } -#line 389 "runpicture.in" +#line 392 "runpicture.in" // void shipout(string prefix=emptystring, picture *f, picture *preamble=NULL, string format=emptystring, bool wait=false, bool view=true, callableTransform *xform); void gen_runpicture42(stack *Stack) { @@ -683,7 +685,7 @@ void gen_runpicture42(stack *Stack) picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack,emptystring); -#line 392 "runpicture.in" +#line 395 "runpicture.in" if(prefix.empty()) prefix=outname(); picture *result=new picture; @@ -732,7 +734,7 @@ void gen_runpicture42(stack *Stack) result->shipout(preamble,prefix,format,0.0,wait,view); } -#line 441 "runpicture.in" +#line 444 "runpicture.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 gen_runpicture43(stack *Stack) { @@ -754,7 +756,7 @@ void gen_runpicture43(stack *Stack) string format=vm::pop<string>(Stack,emptystring); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 447 "runpicture.in" +#line 450 "runpicture.in" size_t n=checkArrays(lights,diffuse); checkEqual(n,checkArray(ambient)); checkEqual(n,checkArray(specular)); @@ -776,19 +778,17 @@ void gen_runpicture43(stack *Stack) delete[] T; } -#line 469 "runpicture.in" -// void shipout3(string prefix, picture *f, Intarray *index, triplearray *center); +#line 472 "runpicture.in" +// void shipout3(string prefix, picture *f); void gen_runpicture44(stack *Stack) { - triplearray * center=vm::pop<triplearray *>(Stack); - Intarray * index=vm::pop<Intarray *>(Stack); picture * f=vm::pop<picture *>(Stack); string prefix=vm::pop<string>(Stack); -#line 470 "runpicture.in" - f->shipout3(prefix,index,center); +#line 473 "runpicture.in" + f->shipout3(prefix); } -#line 474 "runpicture.in" +#line 477 "runpicture.in" // void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, callableTransform *xform); void gen_runpicture45(stack *Stack) { @@ -796,7 +796,7 @@ void gen_runpicture45(stack *Stack) real magnification=vm::pop<real>(Stack,1); picture * preamble=vm::pop<picture *>(Stack,NULL); picture * f=vm::pop<picture *>(Stack); -#line 476 "runpicture.in" +#line 479 "runpicture.in" unsigned level=0; unsigned n=0; @@ -928,7 +928,7 @@ void gen_runpicture45(stack *Stack) // Three-dimensional picture and surface operations // Bezier curve -#line 608 "runpicture.in" +#line 611 "runpicture.in" // void _draw(picture *f, path3 g, triple center=Zero, pen p, Int interaction=0); void gen_runpicture46(stack *Stack) { @@ -937,19 +937,18 @@ void gen_runpicture46(stack *Stack) triple center=vm::pop<triple>(Stack,Zero); path3 g=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 609 "runpicture.in" +#line 612 "runpicture.in" if(g.size() > 0) f->append(new drawPath3(g,center,p,(Interaction) intcast(interaction))); } // Bezier patch -#line 615 "runpicture.in" -// void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, triple normal, penarray *colors, bool lighton, Int interaction, bool prc=true); +#line 618 "runpicture.in" +// void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, triple normal, penarray *colors, Int interaction, bool prc=true); void gen_runpicture47(stack *Stack) { bool prc=vm::pop<bool>(Stack,true); Int interaction=vm::pop<Int>(Stack); - bool lighton=vm::pop<bool>(Stack); penarray * colors=vm::pop<penarray *>(Stack); triple normal=vm::pop<triple>(Stack); real PRCshininess=vm::pop<real>(Stack); @@ -960,14 +959,14 @@ void gen_runpicture47(stack *Stack) triple center=vm::pop<triple>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 619 "runpicture.in" +#line 621 "runpicture.in" f->append(new drawSurface(*P,center,straight,*p,opacity,shininess, - PRCshininess,normal,*colors,lighton, + PRCshininess,normal,*colors, (Interaction) intcast(interaction),prc)); } // General NURBS curve -#line 626 "runpicture.in" +#line 628 "runpicture.in" // void draw(picture *f, triplearray *P, realarray *knot, realarray *weights=emptyarray, pen p); void gen_runpicture48(stack *Stack) { @@ -976,16 +975,15 @@ void gen_runpicture48(stack *Stack) realarray * knot=vm::pop<realarray *>(Stack); triplearray * P=vm::pop<triplearray *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 628 "runpicture.in" +#line 630 "runpicture.in" f->append(new drawNurbsPath3(*P,knot,weights,p)); } // General NURBS surface -#line 633 "runpicture.in" -// void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, real opacity, real shininess, real PRCshininess, penarray *colors, bool lighton); +#line 635 "runpicture.in" +// void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, real opacity, real shininess, real PRCshininess, penarray *colors); void gen_runpicture49(stack *Stack) { - bool lighton=vm::pop<bool>(Stack); penarray * colors=vm::pop<penarray *>(Stack); real PRCshininess=vm::pop<real>(Stack); real shininess=vm::pop<real>(Stack); @@ -996,13 +994,13 @@ void gen_runpicture49(stack *Stack) realarray * uknot=vm::pop<realarray *>(Stack); triplearray2 * P=vm::pop<triplearray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 636 "runpicture.in" +#line 638 "runpicture.in" f->append(new drawNurbs(*P,uknot,vknot,weights,*p,opacity,shininess, - PRCshininess,*colors,lighton)); + PRCshininess,*colors)); } // PRC unit sphere -#line 642 "runpicture.in" +#line 644 "runpicture.in" // void drawPRCsphere(picture *f, realarray2 *t, bool half=false, penarray *p, real opacity, real shininess, Int type); void gen_runpicture50(stack *Stack) { @@ -1013,12 +1011,12 @@ void gen_runpicture50(stack *Stack) bool half=vm::pop<bool>(Stack,false); realarray2 * t=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 644 "runpicture.in" +#line 646 "runpicture.in" f->append(new drawSphere(*t,half,*p,opacity,shininess,intcast(type))); } // PRC unit cylinder -#line 649 "runpicture.in" +#line 651 "runpicture.in" // void drawPRCcylinder(picture *f, realarray2 *t, penarray *p, real opacity, real shininess); void gen_runpicture51(stack *Stack) { @@ -1027,12 +1025,12 @@ void gen_runpicture51(stack *Stack) penarray * p=vm::pop<penarray *>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 651 "runpicture.in" +#line 653 "runpicture.in" f->append(new drawCylinder(*t,*p,opacity,shininess)); } // PRC unit disk -#line 656 "runpicture.in" +#line 658 "runpicture.in" // void drawPRCdisk(picture *f, realarray2 *t, penarray *p, real opacity, real shininess); void gen_runpicture52(stack *Stack) { @@ -1041,12 +1039,12 @@ void gen_runpicture52(stack *Stack) penarray * p=vm::pop<penarray *>(Stack); realarray2 * t=vm::pop<realarray2 *>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 658 "runpicture.in" +#line 660 "runpicture.in" f->append(new drawDisk(*t,*p,opacity,shininess)); } // General PRC tube -#line 663 "runpicture.in" +#line 665 "runpicture.in" // void drawPRCtube(picture *f, path3 center, path3 g, penarray *p, real opacity, real shininess); void gen_runpicture53(stack *Stack) { @@ -1056,12 +1054,12 @@ void gen_runpicture53(stack *Stack) path3 g=vm::pop<path3>(Stack); path3 center=vm::pop<path3>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 665 "runpicture.in" +#line 667 "runpicture.in" f->append(new drawTube(center,g,*p,opacity,shininess)); } // Draw pixel -#line 670 "runpicture.in" +#line 672 "runpicture.in" // void drawpixel(picture *f, triple v, pen p, real width=1.0); void gen_runpicture54(stack *Stack) { @@ -1069,62 +1067,83 @@ void gen_runpicture54(stack *Stack) pen p=vm::pop<pen>(Stack); triple v=vm::pop<triple>(Stack); picture * f=vm::pop<picture *>(Stack); -#line 671 "runpicture.in" +#line 673 "runpicture.in" f->append(new drawPixel(v,p,width)); } -#line 675 "runpicture.in" -// triple min3(picture *f); +// Draw triangles +#line 678 "runpicture.in" +// void draw(picture *f, triplearray *v, Intarray2 *vi, triplearray *n, Intarray2 *ni, penarray *p, real opacity, real shininess, real PRCshininess, penarray *c=emptyarray, Intarray2 *ci=emptyarray); void gen_runpicture55(stack *Stack) { + Intarray2 * ci=vm::pop<Intarray2 *>(Stack,emptyarray); + penarray * c=vm::pop<penarray *>(Stack,emptyarray); + real PRCshininess=vm::pop<real>(Stack); + real shininess=vm::pop<real>(Stack); + real opacity=vm::pop<real>(Stack); + penarray * p=vm::pop<penarray *>(Stack); + Intarray2 * ni=vm::pop<Intarray2 *>(Stack); + triplearray * n=vm::pop<triplearray *>(Stack); + Intarray2 * vi=vm::pop<Intarray2 *>(Stack); + triplearray * v=vm::pop<triplearray *>(Stack); + picture * f=vm::pop<picture *>(Stack); +#line 682 "runpicture.in" + f->append(new drawTriangles(*v,*vi,*n,*ni,*p,opacity,shininess,PRCshininess, + *c,*ci)); +} + +#line 687 "runpicture.in" +// triple min3(picture *f); +void gen_runpicture56(stack *Stack) +{ picture * f=vm::pop<picture *>(Stack); -#line 676 "runpicture.in" +#line 688 "runpicture.in" {Stack->push<triple>(f->bounds3().Min()); return;} } -#line 680 "runpicture.in" +#line 692 "runpicture.in" // triple max3(picture *f); -void gen_runpicture56(stack *Stack) +void gen_runpicture57(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 681 "runpicture.in" +#line 693 "runpicture.in" {Stack->push<triple>(f->bounds3().Max()); return;} } -#line 685 "runpicture.in" +#line 697 "runpicture.in" // triple size3(picture *f); -void gen_runpicture57(stack *Stack) +void gen_runpicture58(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 686 "runpicture.in" +#line 698 "runpicture.in" bbox3 b=f->bounds3(); {Stack->push<triple>(b.Max()-b.Min()); return;} } -#line 691 "runpicture.in" +#line 703 "runpicture.in" // pair minratio(picture *f); -void gen_runpicture58(stack *Stack) +void gen_runpicture59(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 692 "runpicture.in" +#line 704 "runpicture.in" {Stack->push<pair>(f->ratio(::min)); return;} } -#line 696 "runpicture.in" +#line 708 "runpicture.in" // pair maxratio(picture *f); -void gen_runpicture59(stack *Stack) +void gen_runpicture60(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 697 "runpicture.in" +#line 709 "runpicture.in" {Stack->push<pair>(f->ratio(::max)); return;} } -#line 701 "runpicture.in" +#line 713 "runpicture.in" // bool is3D(picture *f); -void gen_runpicture60(stack *Stack) +void gen_runpicture61(stack *Stack) { picture * f=vm::pop<picture *>(Stack); -#line 702 "runpicture.in" +#line 714 "runpicture.in" {Stack->push<bool>(f->have3D()); return;} } @@ -1134,128 +1153,130 @@ namespace trans { void gen_runpicture_venv(venv &ve) { -#line 101 "runpicture.in" +#line 104 "runpicture.in" REGISTER_BLTIN(run::newPicture,"newPicture"); -#line 106 "runpicture.in" +#line 109 "runpicture.in" addFunc(ve, run::gen_runpicture1, primBoolean(), SYM(empty), formal(primPicture(), SYM(f), false, false)); -#line 111 "runpicture.in" +#line 114 "runpicture.in" addFunc(ve, run::gen_runpicture2, primVoid(), SYM(erase), formal(primPicture(), SYM(f), false, false)); -#line 116 "runpicture.in" +#line 119 "runpicture.in" addFunc(ve, run::gen_runpicture3, primPair(), SYM(min), formal(primPicture(), SYM(f), false, false)); -#line 121 "runpicture.in" +#line 124 "runpicture.in" addFunc(ve, run::gen_runpicture4, primPair(), SYM(max), formal(primPicture(), SYM(f), false, false)); -#line 126 "runpicture.in" +#line 129 "runpicture.in" addFunc(ve, run::gen_runpicture5, primPair(), SYM(size), formal(primPicture(), SYM(f), false, false)); -#line 132 "runpicture.in" +#line 135 "runpicture.in" addFunc(ve, run::gen_runpicture6, primVoid(), SYM(_draw), formal(primPicture(), SYM(f), false, false), formal(primPath(), SYM(g), false, false), formal(primPen(), SYM(p), false, false)); -#line 137 "runpicture.in" +#line 140 "runpicture.in" addFunc(ve, run::gen_runpicture7, primVoid(), SYM(fill), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primPen(), SYM(p), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 143 "runpicture.in" +#line 146 "runpicture.in" addFunc(ve, run::gen_runpicture8, primVoid(), SYM(latticeshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(penArray2() , SYM(p), false, false), formal(primTransform(), SYM(t), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 152 "runpicture.in" +#line 155 "runpicture.in" addFunc(ve, run::gen_runpicture9, primVoid(), SYM(axialshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(pena), false, false), formal(primPair(), SYM(a), false, false), formal(primPen(), SYM(penb), false, false), formal(primPair(), SYM(b), false, false), formal(primBoolean(), SYM(copy), true, false)); -#line 159 "runpicture.in" +#line 162 "runpicture.in" addFunc(ve, run::gen_runpicture10, primVoid(), SYM(radialshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(pena), false, false), formal(primPair(), SYM(a), false, false), formal(primReal(), SYM(ra), false, false), formal(primPen(), SYM(penb), false, false), formal(primPair(), SYM(b), false, false), formal(primReal(), SYM(rb), false, false), formal(primBoolean(), SYM(copy), true, false)); -#line 166 "runpicture.in" +#line 169 "runpicture.in" addFunc(ve, run::gen_runpicture11, primVoid(), SYM(gouraudshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(penArray() , SYM(p), false, false), formal(pairArray(), SYM(z), false, false), formal(IntArray(), SYM(edges), false, false), formal(primBoolean(), SYM(copy), true, false)); -#line 177 "runpicture.in" +#line 180 "runpicture.in" addFunc(ve, run::gen_runpicture12, primVoid(), SYM(gouraudshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(penArray() , SYM(p), false, false), formal(IntArray(), SYM(edges), false, false), formal(primBoolean(), SYM(copy), true, false)); -#line 201 "runpicture.in" +#line 204 "runpicture.in" addFunc(ve, run::gen_runpicture13, primVoid(), SYM(tensorshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(penArray2() , SYM(p), false, false), formal(pathArray() , SYM(b), true, false), formal(pairArray2(), SYM(z), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 216 "runpicture.in" +#line 219 "runpicture.in" addFunc(ve, run::gen_runpicture14, primVoid(), SYM(functionshade), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(primString() , SYM(shader), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 224 "runpicture.in" +#line 227 "runpicture.in" addFunc(ve, run::gen_runpicture15, primVoid(), SYM(clip), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 234 "runpicture.in" +#line 237 "runpicture.in" addFunc(ve, run::gen_runpicture16, primVoid(), SYM(beginclip), formal(primPicture(), SYM(f), false, false), formal(pathArray() , SYM(g), false, false), formal(primBoolean(), SYM(stroke), true, false), formal(primPen(), SYM(fillrule), true, false), formal(primBoolean(), SYM(copy), true, false)); -#line 241 "runpicture.in" +#line 244 "runpicture.in" addFunc(ve, run::gen_runpicture17, primVoid(), SYM(endclip), formal(primPicture(), SYM(f), false, false)); -#line 246 "runpicture.in" +#line 249 "runpicture.in" addFunc(ve, run::gen_runpicture18, primVoid(), SYM(gsave), formal(primPicture(), SYM(f), false, false)); -#line 251 "runpicture.in" +#line 254 "runpicture.in" addFunc(ve, run::gen_runpicture19, primVoid(), SYM(grestore), formal(primPicture(), SYM(f), false, false)); -#line 256 "runpicture.in" +#line 259 "runpicture.in" addFunc(ve, run::gen_runpicture20, primVoid(), SYM(begingroup), formal(primPicture(), SYM(f), false, false)); -#line 261 "runpicture.in" +#line 264 "runpicture.in" addFunc(ve, run::gen_runpicture21, primVoid(), SYM(endgroup), formal(primPicture(), SYM(f), false, false)); -#line 266 "runpicture.in" +#line 269 "runpicture.in" addFunc(ve, run::gen_runpicture22, primVoid(), SYM(_begingroup3), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(name), false, false), formal(primReal(), SYM(compression), false, false), formal(primReal(), SYM(granularity), false, false), formal(primBoolean(), SYM(closed), false, false), formal(primBoolean(), SYM(tessellate), false, false), formal(primBoolean(), SYM(dobreak), false, false), formal(primBoolean(), SYM(nobreak), false, false), formal(primTriple(), SYM(center), false, false), formal(primInt(), SYM(interaction), false, false)); -#line 275 "runpicture.in" +#line 278 "runpicture.in" addFunc(ve, run::gen_runpicture23, primVoid(), SYM(endgroup3), formal(primPicture(), SYM(f), false, false)); -#line 280 "runpicture.in" +#line 283 "runpicture.in" addFunc(ve, run::gen_runpicture24, primVoid(), SYM(add), formal(primPicture(), SYM(dest), false, false), formal(primPicture(), SYM(src), false, false)); -#line 285 "runpicture.in" +#line 288 "runpicture.in" addFunc(ve, run::gen_runpicture25, primVoid(), SYM(prepend), formal(primPicture(), SYM(dest), false, false), formal(primPicture(), SYM(src), false, false)); -#line 290 "runpicture.in" +#line 293 "runpicture.in" addFunc(ve, run::gen_runpicture26, primVoid(), SYM(postscript), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(s), false, false)); -#line 295 "runpicture.in" +#line 298 "runpicture.in" addFunc(ve, run::gen_runpicture27, primVoid(), SYM(tex), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(s), false, false)); -#line 300 "runpicture.in" +#line 303 "runpicture.in" addFunc(ve, run::gen_runpicture28, primVoid(), SYM(postscript), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(s), false, false), formal(primPair(), SYM(min), false, false), formal(primPair(), SYM(max), false, false)); -#line 305 "runpicture.in" +#line 308 "runpicture.in" addFunc(ve, run::gen_runpicture29, primVoid(), SYM(tex), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(s), false, false), formal(primPair(), SYM(min), false, false), formal(primPair(), SYM(max), false, false)); -#line 310 "runpicture.in" +#line 313 "runpicture.in" addFunc(ve, run::gen_runpicture30, primVoid(), SYM(texpreamble), formal(primString() , SYM(s), false, false)); -#line 318 "runpicture.in" +#line 321 "runpicture.in" addFunc(ve, run::gen_runpicture31, primVoid(), SYM(deletepreamble)); -#line 325 "runpicture.in" +#line 328 "runpicture.in" addFunc(ve, run::gen_runpicture32, primVoid(), SYM(_labelpath), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(s), false, false), formal(primString() , SYM(size), false, false), formal(primPath(), SYM(g), false, false), formal(primString() , SYM(justify), false, false), formal(primPair(), SYM(offset), false, false), formal(primPen(), SYM(p), false, false)); -#line 331 "runpicture.in" +#line 334 "runpicture.in" addFunc(ve, run::gen_runpicture33, primVoid(), SYM(texreset)); -#line 339 "runpicture.in" +#line 342 "runpicture.in" addFunc(ve, run::gen_runpicture34, primVoid(), SYM(layer), formal(primPicture(), SYM(f), false, false)); -#line 344 "runpicture.in" +#line 347 "runpicture.in" addFunc(ve, run::gen_runpicture35, primVoid(), SYM(newpage), formal(primPicture(), SYM(f), false, false)); -#line 349 "runpicture.in" +#line 352 "runpicture.in" addFunc(ve, run::gen_runpicture36, primVoid(), SYM(_image), formal(primPicture(), SYM(f), false, false), formal(realArray2(), SYM(data), false, false), formal(primPair(), SYM(initial), false, false), formal(primPair(), SYM(final), false, false), formal(penArray() , SYM(palette), true, false), formal(primTransform(), SYM(t), true, false), formal(primBoolean(), SYM(copy), true, false), formal(primBoolean(), SYM(antialias), true, false)); -#line 359 "runpicture.in" +#line 362 "runpicture.in" addFunc(ve, run::gen_runpicture37, primVoid(), SYM(_image), formal(primPicture(), SYM(f), false, false), formal(penArray2() , SYM(data), false, false), formal(primPair(), SYM(initial), false, false), formal(primPair(), SYM(final), false, false), formal(primTransform(), SYM(t), true, false), formal(primBoolean(), SYM(copy), true, false), formal(primBoolean(), SYM(antialias), true, false)); -#line 367 "runpicture.in" +#line 370 "runpicture.in" addFunc(ve, run::gen_runpicture38, primVoid(), SYM(_image), formal(primPicture(), SYM(f), false, false), formal(penFunction(), SYM(f), false, false), formal(primInt(), SYM(width), false, false), formal(primInt(), SYM(height), false, false), formal(primPair(), SYM(initial), false, false), formal(primPair(), SYM(final), false, false), formal(primTransform(), SYM(t), true, false), formal(primBoolean(), SYM(antialias), true, false)); -#line 374 "runpicture.in" +#line 377 "runpicture.in" addFunc(ve, run::gen_runpicture39, primString() , SYM(nativeformat)); -#line 379 "runpicture.in" +#line 382 "runpicture.in" addFunc(ve, run::gen_runpicture40, primBoolean(), SYM(latex)); -#line 384 "runpicture.in" +#line 387 "runpicture.in" addFunc(ve, run::gen_runpicture41, primBoolean(), SYM(pdf)); -#line 389 "runpicture.in" +#line 392 "runpicture.in" addFunc(ve, run::gen_runpicture42, primVoid(), SYM(shipout), formal(primString() , SYM(prefix), true, false), formal(primPicture(), SYM(f), false, false), formal(primPicture(), SYM(preamble), true, false), formal(primString() , SYM(format), true, false), formal(primBoolean(), SYM(wait), true, false), formal(primBoolean(), SYM(view), true, false), formal(transformFunction(), SYM(xform), false, false)); -#line 441 "runpicture.in" +#line 444 "runpicture.in" addFunc(ve, run::gen_runpicture43, primVoid(), SYM(shipout3), formal(primString() , SYM(prefix), false, false), formal(primPicture(), SYM(f), false, false), formal(primString() , SYM(format), true, false), formal(primReal(), SYM(width), false, false), formal(primReal(), SYM(height), false, false), formal(primReal(), SYM(angle), false, false), formal(primReal(), SYM(zoom), false, false), formal(primTriple(), SYM(m), false, false), formal(primTriple(), SYM(m), false, false), formal(primPair(), SYM(shift), false, false), formal(realArray2(), SYM(t), false, false), formal(realArray(), SYM(background), false, false), formal(tripleArray(), SYM(lights), false, false), formal(realArray2(), SYM(diffuse), false, false), formal(realArray2(), SYM(ambient), false, false), formal(realArray2(), SYM(specular), false, false), formal(primBoolean(), SYM(viewportlighting), false, false), formal(primBoolean(), SYM(view), true, false)); -#line 469 "runpicture.in" - addFunc(ve, run::gen_runpicture44, primVoid(), SYM(shipout3), formal(primString() , SYM(prefix), false, false), formal(primPicture(), SYM(f), false, false), formal(IntArray(), SYM(index), false, false), formal(tripleArray(), SYM(center), false, false)); -#line 474 "runpicture.in" +#line 472 "runpicture.in" + addFunc(ve, run::gen_runpicture44, primVoid(), SYM(shipout3), formal(primString() , SYM(prefix), false, false), formal(primPicture(), SYM(f), false, false)); +#line 477 "runpicture.in" addFunc(ve, run::gen_runpicture45, primVoid(), SYM(deconstruct), formal(primPicture(), SYM(f), false, false), formal(primPicture(), SYM(preamble), true, false), formal(primReal(), SYM(magnification), true, false), formal(transformFunction(), SYM(xform), false, false)); -#line 604 "runpicture.in" +#line 607 "runpicture.in" addFunc(ve, run::gen_runpicture46, primVoid(), SYM(_draw), formal(primPicture(), SYM(f), false, false), formal(primPath3(), SYM(g), false, false), formal(primTriple(), SYM(center), true, false), formal(primPen(), SYM(p), false, false), formal(primInt(), SYM(interaction), true, false)); -#line 614 "runpicture.in" - addFunc(ve, run::gen_runpicture47, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(center), false, false), formal(primBoolean(), SYM(straight), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(primTriple(), SYM(normal), false, false), formal(penArray() , SYM(colors), false, false), formal(primBoolean(), SYM(lighton), false, false), formal(primInt(), SYM(interaction), false, false), formal(primBoolean(), SYM(prc), true, false)); -#line 625 "runpicture.in" +#line 617 "runpicture.in" + addFunc(ve, run::gen_runpicture47, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray2(), SYM(p), false, false), formal(primTriple(), SYM(center), false, false), formal(primBoolean(), SYM(straight), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(primTriple(), SYM(normal), false, false), formal(penArray() , SYM(colors), false, false), formal(primInt(), SYM(interaction), false, false), formal(primBoolean(), SYM(prc), true, false)); +#line 627 "runpicture.in" addFunc(ve, run::gen_runpicture48, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray(), SYM(p), false, false), formal(realArray(), SYM(knot), false, false), formal(realArray(), SYM(weights), true, false), formal(primPen(), SYM(p), false, false)); -#line 632 "runpicture.in" - addFunc(ve, run::gen_runpicture49, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray2(), SYM(p), false, false), formal(realArray(), SYM(uknot), false, false), formal(realArray(), SYM(vknot), false, false), formal(realArray2(), SYM(weights), true, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(penArray() , SYM(colors), false, false), formal(primBoolean(), SYM(lighton), false, false)); -#line 641 "runpicture.in" +#line 634 "runpicture.in" + addFunc(ve, run::gen_runpicture49, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray2(), SYM(p), false, false), formal(realArray(), SYM(uknot), false, false), formal(realArray(), SYM(vknot), false, false), formal(realArray2(), SYM(weights), true, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(penArray() , SYM(colors), false, false)); +#line 643 "runpicture.in" addFunc(ve, run::gen_runpicture50, primVoid(), SYM(drawPRCsphere), formal(primPicture(), SYM(f), false, false), formal(realArray2(), SYM(t), false, false), formal(primBoolean(), SYM(half), true, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primInt(), SYM(type), false, false)); -#line 648 "runpicture.in" +#line 650 "runpicture.in" addFunc(ve, run::gen_runpicture51, primVoid(), SYM(drawPRCcylinder), formal(primPicture(), SYM(f), false, false), formal(realArray2(), SYM(t), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false)); -#line 655 "runpicture.in" +#line 657 "runpicture.in" addFunc(ve, run::gen_runpicture52, primVoid(), SYM(drawPRCdisk), formal(primPicture(), SYM(f), false, false), formal(realArray2(), SYM(t), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false)); -#line 662 "runpicture.in" +#line 664 "runpicture.in" addFunc(ve, run::gen_runpicture53, primVoid(), SYM(drawPRCtube), formal(primPicture(), SYM(f), false, false), formal(primPath3(), SYM(center), false, false), formal(primPath3(), SYM(g), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false)); -#line 669 "runpicture.in" +#line 671 "runpicture.in" addFunc(ve, run::gen_runpicture54, primVoid(), SYM(drawpixel), formal(primPicture(), SYM(f), false, false), formal(primTriple(), SYM(v), false, false), formal(primPen(), SYM(p), false, false), formal(primReal(), SYM(width), true, false)); -#line 675 "runpicture.in" - addFunc(ve, run::gen_runpicture55, primTriple(), SYM(min3), formal(primPicture(), SYM(f), false, false)); -#line 680 "runpicture.in" - addFunc(ve, run::gen_runpicture56, primTriple(), SYM(max3), formal(primPicture(), SYM(f), false, false)); -#line 685 "runpicture.in" - addFunc(ve, run::gen_runpicture57, primTriple(), SYM(size3), formal(primPicture(), SYM(f), false, false)); -#line 691 "runpicture.in" - addFunc(ve, run::gen_runpicture58, primPair(), SYM(minratio), formal(primPicture(), SYM(f), false, false)); -#line 696 "runpicture.in" - addFunc(ve, run::gen_runpicture59, primPair(), SYM(maxratio), formal(primPicture(), SYM(f), false, false)); -#line 701 "runpicture.in" - addFunc(ve, run::gen_runpicture60, primBoolean(), SYM(is3D), formal(primPicture(), SYM(f), false, false)); +#line 677 "runpicture.in" + addFunc(ve, run::gen_runpicture55, primVoid(), SYM(draw), formal(primPicture(), SYM(f), false, false), formal(tripleArray(), SYM(v), false, false), formal(IntArray2(), SYM(vi), false, false), formal(tripleArray(), SYM(n), false, false), formal(IntArray2(), SYM(ni), false, false), formal(penArray() , SYM(p), false, false), formal(primReal(), SYM(opacity), false, false), formal(primReal(), SYM(shininess), false, false), formal(primReal(), SYM(prcshininess), false, false), formal(penArray() , SYM(c), true, false), formal(IntArray2(), SYM(ci), true, false)); +#line 687 "runpicture.in" + addFunc(ve, run::gen_runpicture56, primTriple(), SYM(min3), formal(primPicture(), SYM(f), false, false)); +#line 692 "runpicture.in" + addFunc(ve, run::gen_runpicture57, primTriple(), SYM(max3), formal(primPicture(), SYM(f), false, false)); +#line 697 "runpicture.in" + addFunc(ve, run::gen_runpicture58, primTriple(), SYM(size3), formal(primPicture(), SYM(f), false, false)); +#line 703 "runpicture.in" + addFunc(ve, run::gen_runpicture59, primPair(), SYM(minratio), formal(primPicture(), SYM(f), false, false)); +#line 708 "runpicture.in" + addFunc(ve, run::gen_runpicture60, primPair(), SYM(maxratio), formal(primPicture(), SYM(f), false, false)); +#line 713 "runpicture.in" + addFunc(ve, run::gen_runpicture61, primBoolean(), SYM(is3D), formal(primPicture(), SYM(f), false, false)); } } // namespace trans diff --git a/Build/source/utils/asymptote/runpicture.in b/Build/source/utils/asymptote/runpicture.in index cfbe9cbf2b2..872d557071f 100644 --- a/Build/source/utils/asymptote/runpicture.in +++ b/Build/source/utils/asymptote/runpicture.in @@ -12,6 +12,7 @@ path => primPath() path3 => primPath3() picture* => primPicture() Intarray* => IntArray() +Intarray2* => IntArray2() realarray* => realArray() realarray2* => realArray2() patharray* => pathArray() @@ -49,6 +50,7 @@ using namespace settings; using namespace vm; typedef array Intarray; +typedef array Intarray2; typedef array realarray; typedef array realarray2; typedef array pairarray; @@ -63,6 +65,7 @@ typedef callable callableTransform; typedef callable callablePen; using types::IntArray; +using types::IntArray2; using types::realArray; using types::realArray2; using types::pairArray; @@ -466,9 +469,9 @@ void shipout3(string prefix, picture *f, string format=emptystring, delete[] T; } -void shipout3(string prefix, picture *f, Intarray *index, triplearray *center) +void shipout3(string prefix, picture *f) { - f->shipout3(prefix,index,center); + f->shipout3(prefix); } void deconstruct(picture *f, picture *preamble=NULL, real magnification=1, @@ -614,11 +617,10 @@ void _draw(picture *f, path3 g, triple center=Zero, pen p, Int interaction=0) // Bezier patch void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real PRCshininess, - triple normal, penarray *colors, bool lighton, - Int interaction, bool prc=true) + triple normal, penarray *colors, Int interaction, bool prc=true) { f->append(new drawSurface(*P,center,straight,*p,opacity,shininess, - PRCshininess,normal,*colors,lighton, + PRCshininess,normal,*colors, (Interaction) intcast(interaction),prc)); } @@ -632,10 +634,10 @@ void draw(picture *f, triplearray *P, realarray *knot, // General NURBS surface void draw(picture *f, triplearray2 *P, realarray *uknot, realarray *vknot, realarray2 *weights=emptyarray, penarray *p, real opacity, - real shininess, real PRCshininess, penarray *colors, bool lighton) + real shininess, real PRCshininess, penarray *colors) { f->append(new drawNurbs(*P,uknot,vknot,weights,*p,opacity,shininess, - PRCshininess,*colors,lighton)); + PRCshininess,*colors)); } // PRC unit sphere @@ -672,6 +674,16 @@ void drawpixel(picture *f, triple v, pen p, real width=1.0) f->append(new drawPixel(v,p,width)); } +// Draw triangles +void draw(picture *f, triplearray *v, Intarray2 *vi, + triplearray *n, Intarray2 *ni, + penarray *p, real opacity, real shininess, real PRCshininess, + penarray *c=emptyarray, Intarray2 *ci=emptyarray) +{ + f->append(new drawTriangles(*v,*vi,*n,*ni,*p,opacity,shininess,PRCshininess, + *c,*ci)); +} + triple min3(picture *f) { return f->bounds3().Min(); diff --git a/Build/source/utils/asymptote/runstring.cc b/Build/source/utils/asymptote/runstring.cc index 193b2419322..ed22450546b 100644 --- a/Build/source/utils/asymptote/runstring.cc +++ b/Build/source/utils/asymptote/runstring.cc @@ -61,7 +61,7 @@ function *realRealFunction(); #line 10 "runstring.in" #include <cfloat> -#include <string.h> +#include <cstring> #include <algorithm> #include "array.h" diff --git a/Build/source/utils/asymptote/runstring.in b/Build/source/utils/asymptote/runstring.in index 4c6c1db1d85..0c8ead107e5 100644 --- a/Build/source/utils/asymptote/runstring.in +++ b/Build/source/utils/asymptote/runstring.in @@ -8,7 +8,7 @@ stringarray2* => stringArray2() #include <cfloat> -#include <string.h> +#include <cstring> #include <algorithm> #include "array.h" diff --git a/Build/source/utils/asymptote/runsystem.cc b/Build/source/utils/asymptote/runsystem.cc index a731c603c14..b8221208f55 100644 --- a/Build/source/utils/asymptote/runsystem.cc +++ b/Build/source/utils/asymptote/runsystem.cc @@ -362,7 +362,7 @@ void gen_runsystem18(stack *Stack) setPath(oldPath); if(ret == 0 && verbose > 0) - cout << "Wrote " << ((file.empty()) ? name : file) << endl; + cout << "Wrote " << (file.empty() ? name : file) << endl; {Stack->push<Int>(ret); return;} } diff --git a/Build/source/utils/asymptote/runsystem.in b/Build/source/utils/asymptote/runsystem.in index faa862dd0bb..45f7a040c9e 100644 --- a/Build/source/utils/asymptote/runsystem.in +++ b/Build/source/utils/asymptote/runsystem.in @@ -228,7 +228,7 @@ Int convert(string args=emptystring, string file=emptystring, setPath(oldPath); if(ret == 0 && verbose > 0) - cout << "Wrote " << ((file.empty()) ? name : file) << endl; + cout << "Wrote " << (file.empty() ? name : file) << endl; return ret; } diff --git a/Build/source/utils/asymptote/seconds.h b/Build/source/utils/asymptote/seconds.h new file mode 100644 index 00000000000..c9fb4f0482c --- /dev/null +++ b/Build/source/utils/asymptote/seconds.h @@ -0,0 +1,91 @@ +#ifndef __seconds_h__ +#define __seconds_h__ 1 + +#ifdef _WIN32 +#include <Winsock2.h> + +#include <time.h> +#include <windows.h> +#include <iostream> + +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +// Definition of a gettimeofday function + +inline int gettimeofday(struct timeval *tv, struct timezone *tz) +{ +// Define a structure to receive the current Windows filetime + FILETIME ft; + +// Initialize the present time to 0 and the timezone to UTC + unsigned __int64 tmpres = 0; + static int tzflag = 0; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + +// The GetSystemTimeAsFileTime returns the number of 100 nanosecond +// intervals since Jan 1, 1601 in a structure. Copy the high bits to +// the 64 bit tmpres, shift it left by 32 then or in the low 32 bits. + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + +// Convert to microseconds by dividing by 10 + tmpres /= 10; + +// The Unix epoch starts on Jan 1 1970. Need to subtract the difference +// in seconds from Jan 1 1601. + tmpres -= DELTA_EPOCH_IN_MICROSECS; + +// Finally change microseconds to seconds and place in the seconds value. +// The modulus picks up the microseconds. + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + +// Adjust for the timezone west of Greenwich + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + +#else + +#include <sys/time.h> + +#endif + +inline double seconds() +{ + static timeval lasttime; + timeval tv; + gettimeofday(&tv,NULL); + double seconds=tv.tv_sec-lasttime.tv_sec+ + ((double) tv.tv_usec-lasttime.tv_usec)/1000000.0; + lasttime=tv; + return seconds; +} + +#endif diff --git a/Build/source/utils/asymptote/settings.cc b/Build/source/utils/asymptote/settings.cc index a97804a1831..af0278caa75 100644 --- a/Build/source/utils/asymptote/settings.cc +++ b/Build/source/utils/asymptote/settings.cc @@ -74,12 +74,6 @@ namespace settings { using camp::pair; -#ifdef HAVE_LIBOSMESA -const bool defaultoffscreen=true; -#else -const bool defaultoffscreen=false; -#endif - #ifdef HAVE_GL const bool havegl=true; #else @@ -1088,6 +1082,8 @@ void initSettings() { "Embed 3D PRC graphics in PDF output", true)); addOption(new boolSetting("toolbar", 0, "Show 3D toolbar in PDF output", true)); + addOption(new boolSetting("axes3", 0, + "Show 3D axes in PDF output", true)); addOption(new realSetting("render", 0, "n", "Render 3D graphics using n pixels per bp (-1=auto)", havegl ? -1.0 : 0.0)); @@ -1096,7 +1092,7 @@ void initSettings() { addOption(new IntSetting("multisample", 0, "n", "Multisampling width for screen images", 4)); addOption(new boolSetting("offscreen", 0, - "Use offscreen rendering",defaultoffscreen)); + "Use offscreen rendering",false)); addOption(new boolSetting("twosided", 0, "Use two-sided 3D lighting model for rendering", true)); diff --git a/Build/source/utils/asymptote/texfile.h b/Build/source/utils/asymptote/texfile.h index 13b733bb145..3d2fb7024da 100644 --- a/Build/source/utils/asymptote/texfile.h +++ b/Build/source/utils/asymptote/texfile.h @@ -60,7 +60,7 @@ void texpreamble(T& out, mem::list<string>& preamble=processData().TeXpreamble, { texuserpreamble(out,preamble); string texengine=settings::getSetting<string>("tex"); - out << "\\def\\ASYprefix{}" << newl + out << "\\def\\ASYprefix{" << stripFile(settings::outname()) << "}" << newl << "\\newbox\\ASYbox" << newl << "\\newdimen\\ASYdimen" << newl << "\\long\\def\\ASYbase#1#2{\\leavevmode\\setbox\\ASYbox=\\hbox{#1}" diff --git a/Build/source/utils/asymptote/triple.h b/Build/source/utils/asymptote/triple.h index fde711bb5e3..62bda62d914 100644 --- a/Build/source/utils/asymptote/triple.h +++ b/Build/source/utils/asymptote/triple.h @@ -12,14 +12,35 @@ #include <cassert> #include <iostream> #include <cmath> +#include <cstring> #include "common.h" #include "angle.h" +#include "pair.h" namespace camp { typedef double Triple[3]; +class triple; + +bool isIdTransform3(const double* t); +void copyTransform3(double*& d, const double* s); +void multiplyTransform3(double*& t, const double* s, const double* r); + +void copyTriples(size_t n, Triple* d, const Triple* s); +void transformTriples(const double* t, size_t n, Triple* d, const Triple* s); +void transformshiftlessTriples(const double* t, size_t n, Triple* d, const Triple* s); +void transformNormalsTriples(const double* t, size_t n, Triple* d, const Triple* s); +void unitTriples(size_t n, Triple* d); + +void boundsTriples(double& x, double& y, double& z, double& X, double& Y, double& Z, size_t n, const Triple* v); + +void ratioTriples(pair &b, double (*m)(double, double), bool &first, size_t n, const Triple* v); + +void normalizeTriple(Triple v); +void crossTriple(Triple n, const Triple u, const Triple v); + class triple : virtual public gc { double x; double y; @@ -32,10 +53,122 @@ public: virtual ~triple() {} + void set(double X, double Y=0.0, double Z=0.0) { x=X; y=Y; z=Z; } + double getx() const { return x; } double gety() const { return y; } double getz() const { return z; } + // transform by column-major matrix + friend triple operator* (const double* t, const triple& v) + { + if(t == NULL) + return v; + + double f=t[3]*v.x+t[7]*v.y+t[11]*v.z+t[15]; + if(f == 0.0) + reportError("division by 0 in transform of a triple"); + f=1.0/f; + + return triple((t[0]*v.x+t[4]*v.y+t[8]*v.z+t[12])*f, + (t[1]*v.x+t[5]*v.y+t[9]*v.z+t[13])*f, + (t[2]*v.x+t[6]*v.y+t[10]*v.z+t[14])*f); + } + + friend triple multshiftless(const double* t, const triple& v) + { + if(t == NULL) + return v; + + double f=t[3]*v.x+t[7]*v.y+t[11]*v.z+t[15]; + if(f == 0.0) + reportError("division by 0 in shiftless transform of a triple"); + f=1.0/f; + + return triple((t[0]*v.x+t[4]*v.y+t[8]*v.z)*f, + (t[1]*v.x+t[5]*v.y+t[9]*v.z)*f, + (t[2]*v.x+t[6]*v.y+t[10]*v.z)*f); + } + + friend void transformtriples(const double* t, size_t n, triple* d, + const triple* s) + { + if(n == 0 || d == NULL || s == NULL) + return; + + if(isIdTransform3(t)) { + copytriples(n, d, s); + return; + } + + for(size_t i=0; i < n; i++) { + const double& x = s[i].x; + const double& y = s[i].y; + const double& z = s[i].z; + double f=t[3]*x+t[7]*y+t[11]*z+t[15]; + if(f == 0.0) + reportError("division by 0 in transformtriples"); + f=1.0/f; + d[i].x=(t[0]*x+t[4]*y+t[8]*z+t[12])*f; + d[i].y=(t[1]*x+t[5]*y+t[9]*z+t[13])*f; + d[i].z=(t[2]*x+t[6]*y+t[10]*z+t[14])*f; + } + } + + friend void copytriples(size_t n, triple* d, const triple* s) + { + if(d == NULL || s == NULL) + return; + + for(size_t i=0; i < n; i++) d[i]=s[i]; + } + + friend void boundstriples(triple& Min, triple& Max, size_t n, const triple* v) + { + if(n==0 || v==NULL) + return; + + double x,y,z; + double X,Y,Z; + + X=x=v[0].getx(); + Y=y=v[0].gety(); + Z=z=v[0].getz(); + for(size_t i=1; i < n; ++i) { + const double vx=v[i].getx(); + x=fmin(x,vx); X=fmax(X,vx); + const double vy=v[i].gety(); + y=fmin(y,vy); Y=fmax(Y,vy); + const double vz=v[i].getz(); + z=fmin(z,vz); Z=fmax(Z,vz); + } + + Min.set(x,y,z); + Max.set(X,Y,Z); + } + + friend void ratiotriples(pair &b, double (*m)(double, double), bool &first, + size_t n, const triple* v) + { + if(n==0 || v==NULL) + return; + + if(first) { + first=false; + const triple& v0=v[0]; + b=pair(v0.x/v0.z,v0.y/v0.z); + } + + double x=b.getx(); + double y=b.gety(); + for(size_t i=0; i < n; ++i) { + const triple& vi = v[i]; + x=m(x,vi.x/vi.z); + y=m(y,vi.y/vi.z); + } + b=pair(x,y); + } + friend triple operator+ (const triple& z, const triple& w) { return triple(z.x + w.x, z.y + w.y, z.z + w.z); @@ -184,6 +317,9 @@ inline triple perp(triple v, triple u) return v-dot(v,u)*u; } +double xratio(const triple& v); +double yratio(const triple& v); + } //namespace camp GC_DECLARE_PTRFREE(camp::triple); diff --git a/Build/source/utils/asymptote/util.cc b/Build/source/utils/asymptote/util.cc index 4ab92050784..af8fb1a811e 100644 --- a/Build/source/utils/asymptote/util.cc +++ b/Build/source/utils/asymptote/util.cc @@ -51,7 +51,7 @@ string demangle(const char *s) free(demangled); return string("Unknown(") + s + ")"; } -}; +} #else string demangle(const char* s) { |