diff options
author | Reinhard Kotucha <reinhard.kotucha@web.de> | 2006-11-25 04:03:28 +0000 |
---|---|---|
committer | Reinhard Kotucha <reinhard.kotucha@web.de> | 2006-11-25 04:03:28 +0000 |
commit | 451833e2188d33c208f5d81394af9ca3799b3789 (patch) | |
tree | 6ed7cdb7270a7de5277ae2a9bfb1325d69e51127 /Master/texmf-dist | |
parent | 9e01f4032d4e859e6eff68fb86f9ef6518c53034 (diff) |
update movie15.
git-svn-id: svn://tug.org/texlive/trunk@2519 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/README | 11 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/animation.js | 98 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/dice.js | 193 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/dice.vws | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/lights.js | 51 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/movie15.pdf | bin | 451730 -> 464142 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/movie15.tex | 120 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/overlay-example.pdf | bin | 28129 -> 31983 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/overlay-example.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/movie15/turntable.js | 60 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/movie15/movie15.sty | 1064 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/movie15.tpm | 9 |
12 files changed, 1042 insertions, 586 deletions
diff --git a/Master/texmf-dist/doc/latex/movie15/README b/Master/texmf-dist/doc/latex/movie15/README index bfe5f779188..a71172392df 100644 --- a/Master/texmf-dist/doc/latex/movie15/README +++ b/Master/texmf-dist/doc/latex/movie15/README @@ -207,6 +207,10 @@ Usage: +999999999999999999.999999999999999999 are allowed. + 3Droll=<roll> prescribes an initial camera roll around the + optical axis (in clockwise direction, if <roll> + is greater than zero); measured in degrees. + 3Droo=<r> Radius of orbit ROO of the virtual camera; cf. option `3Dcoo' for the number format. @@ -215,7 +219,7 @@ Usage: The file <views file> contains lines which obey the syntax: - [<name>]{<coo_x> <coo_y> <coo_z>}{<c2c_x> <c2c_y> <c2c_z>}{<roo>}{<aac>} +[<name>]{<coo_x> <coo_y> <coo_z>}{<c2c_x> <c2c_y> <c2c_z>}{<roo>}{<roll>}{<aac>} The <name> entry is optional. For <coo_x>, <coo_y>, <coo_z>, <c2c_x>, <c2c_y>, <c2c_z>, <roo> @@ -268,6 +272,11 @@ Usage: calculation unless an optional <aac angle> has been provided. + 3Dgetview Camera settings corresponding to the current view + in the Reader are printed to a dialogue box. The + output is readily formatted to be inserted into a + file of predefined views, see option `3Dviews'. + Known file name extensions: diff --git a/Master/texmf-dist/doc/latex/movie15/animation.js b/Master/texmf-dist/doc/latex/movie15/animation.js new file mode 100644 index 00000000000..7c870a1b498 --- /dev/null +++ b/Master/texmf-dist/doc/latex/movie15/animation.js @@ -0,0 +1,98 @@ +/////////////////////////////////////////////////////////////////////// +// +// animation.js +// +// JavaScript for use with `3Djscript' option of \includemovie +// +// * Activates animation embedded in the u3d file. +// * Arrow keys `Down', `Up' can be used for speeding up and slowing +// down a running animation, key `Home' for reverting to the default +// speed. +// +/////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////// +// adjustable parameters +/////////////////////////////////////////////////////// +var rate = 1; // 1 --> use original speed as default +var palindrome = true; // true --> play forth and back +/////////////////////////////////////////////////////// + +//get the first animation in the scene +var myAnim = scene.animations.getByIndex(0); +rate = Math.abs(rate); +myAnim.speed = rate; +myAnim.forward = true; +scene.activateAnimation(myAnim); + +//menu items +runtime.addCustomMenuItem( + "faster", "Faster (Key Up)", "default", 0 +); +runtime.addCustomMenuItem( + "slower", "Slower (Key Down)", "default", 0 +); +runtime.addCustomMenuItem( + "default", "Default Speed (Key Home)", "default", 0 +); + +//menu handler to control speed +menuEventHandler = new MenuEventHandler(); +menuEventHandler.onEvent = function(e) { + if (e.menuItemName == "faster") { + myAnim.speed *= 1.25; + } + else if (e.menuItemName == "slower") { + myAnim.speed /= 1.25; + } + else if (e.menuItemName == "default") { + myAnim.speed = rate; + } +}; +runtime.addEventHandler(menuEventHandler); + +//key handler to control speed +keyEventHandler = new KeyEventHandler(); +keyEventHandler.onKeyDown = true; +keyEventHandler.onEvent = function(e) { + switch(e.characterCode) { + case 30: //key up + myAnim.speed *= 1.05; + break; + + case 31: //key down + myAnim.speed /= 1.05; + break; + + case 4: //key home + myAnim.speed = rate; + break; + } +}; +runtime.addEventHandler(keyEventHandler); + +//run the animation using a TimeEventHandler +myTimer = new TimeEventHandler(); +myTimer.onTimeChange = true; +myTimer.onEvent = function(e) { + if (myAnim.forward) { + myAnim.currentTime += e.deltaTime * myAnim.speed; + if (myAnim.currentTime > myAnim.endTime) { + if (palindrome == true) { + myAnim.currentTime = myAnim.endTime; + myAnim.forward = false; + } + else { + myAnim.currentTime = myAnim.startTime; + } + } + } + else { + myAnim.currentTime -= e.deltaTime * myAnim.speed; + if (myAnim.currentTime < myAnim.startTime) { + myAnim.currentTime = myAnim.startTime; + myAnim.forward = true; + } + } +}; +runtime.addEventHandler(myTimer); diff --git a/Master/texmf-dist/doc/latex/movie15/dice.js b/Master/texmf-dist/doc/latex/movie15/dice.js index e5561194c32..2050fbcf536 100644 --- a/Master/texmf-dist/doc/latex/movie15/dice.js +++ b/Master/texmf-dist/doc/latex/movie15/dice.js @@ -1,98 +1,119 @@ -////////////////////////// -// add our own lights -////////////////////////// +//////////////////////////////////////////////////////////////////////// +// +// This JavaScript file is a simple concatenation of the files +// `lights.js' and `turntable.js' from the `doc/javascript' directory. +// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +// +// lights.js +// +// example JavaScript for use with `3Djscript' option of \includemovie +// +// * Adds light sources around the object for better illumination. +// +//////////////////////////////////////////////////////////////////////// + //first remove any scene lights for (var i = scene.lights.count - 1; i >= 0; i--) { scene.lights.removeByIndex(i); } -lights = new Object(); -lights.init = function() { - //from left - l1 = scene.createLight(); - l1.color.set3(1,1,1); - l1.brightness = .4; - l1.direction.set3(1,0,0); //NB: direction, not source! - - //from right - l2 = scene.createLight(); - l2.color.set3(1,1,1); - l2.brightness = .4; - l2.direction.set3(-1,0,0); - - //from bottom - l3 = scene.createLight(); - l3.color.set3(1,1,1); - l3.brightness = .4; - l3.direction.set3(0,0,1); - - //from top - l4 = scene.createLight(); - l4.color.set3(1,1,1); - l4.brightness = .4; - l4.direction.set3(0,0,-1); - - //from front - l5 = scene.createLight(); - l5.color.set3(1,1,1); - l5.brightness = .4; - l5.direction.set3(0,1,0); - - //from back - l6 = scene.createLight(); - l6.color.set3(1,1,1); - l6.brightness = .4; - l6.direction.set3(0,-1,0); -} +//new lights +//from left +l1 = scene.createLight(); +l1.color.set(1,1,1); +l1.brightness = .4; +l1.direction.set(1,0,0); -lights.init(); +//from right +l2 = scene.createLight(); +l2.color.set(1,1,1); +l2.brightness = .4; +l2.direction.set(-1,0,0); -//////////////////////////////////////////////////////////////////////// -// get rid of Gimbal rotation; as a result the z-axis will always be up; -// this part of the script should work off the shelf with _any_ 3D model -//////////////////////////////////////////////////////////////////////// -var max_theta = 88; // maximum pitch (degrees from horizontal) of the camera -var sin_max_theta = Math.sin(max_theta * Math.PI/180); -var tan_max_theta = Math.tan(max_theta * Math.PI/180); +//from bottom +l3 = scene.createLight(); +l3.color.set(1,1,1); +l3.brightness = .4; +l3.direction.set(0,0,1); + +//from top +l4 = scene.createLight(); +l4.color.set(1,1,1); +l4.brightness = .4; +l4.direction.set(0,0,-1); + +//from front +l5 = scene.createLight(); +l5.color.set(1,1,1); +l5.brightness = .4; +l5.direction.set(0,1,0); -mouseEventHandler = new MouseEventHandler(); +//from back +l6 = scene.createLight(); +l6.color.set(1,1,1); +l6.brightness = .4; +l6.direction.set(0,-1,0); + +///////////////////////////////////////////////////////////////////// +// +// turntable.js +// +// JavaScript for use with `3Djscript' option of \includemovie +// +// * Greatly improves the rotational behaviour of the 3D object, +// prevents it from tilting to the side while dragging the mouse. +// This is achieved by suppressing the rolling of the camera about +// its optical axis. +// +///////////////////////////////////////////////////////////////////// + +// maximum pitch (degrees from horizontal) of the camera +var max_alpha = 88; +var min_beta = 90 - max_alpha; // the complement +var cos_min_beta = Math.cos(min_beta * Math.PI/180); +var tan_min_beta = Math.tan(min_beta * Math.PI/180); + +var camera = scene.cameras.getByIndex(0); + +//updates the vertical axis of rotation whenever a predefined view +//is selected from the drop down list in the 3D toolbar +var cameraEventHandler = new CameraEventHandler(); +cameraEventHandler.onEvent = function (e) { + camera.axis_up = camera.up.subtract(camera.position); + camera.axis_up.normalize(); +} +runtime.addEventHandler(cameraEventHandler); + +//suppresses camera rolling and limits camera pitch +var mouseEventHandler = new MouseEventHandler(); mouseEventHandler.onMouseMove = true; -mouseEventHandler.onEvent = function(event) { - if(event.currentTool == runtime.TOOL_NAME_ROTATE) { - var camera = scene.cameras.getByIndex(0); - var c2c = camera.position.subtract(camera.targetPosition); - var roo = c2c.length; - - try { - var sin_theta = c2c.z / roo; - if(sin_theta == 1) {//top view - c2c.z = roo * sin_max_theta; - c2c.y = -c2c.z / tan_max_theta; - c2c.x = 0 - } - else if(sin_theta == -1) {//bottom view - c2c.z = -roo * sin_max_theta; - c2c.y = c2c.z / tan_max_theta; - c2c.x = 0 - } - else if(sin_max_theta < sin_theta){//camera too high - c2c.z = Math.sqrt(c2c.x * c2c.x + c2c.y * c2c.y) * tan_max_theta; - c2c.normalize(); - c2c.scaleInPlace(roo); - } - else if(sin_theta < -sin_max_theta){//camera too low - c2c.z = -Math.sqrt(c2c.x * c2c.x + c2c.y * c2c.y) * tan_max_theta; - c2c.normalize(); - c2c.scaleInPlace(roo); - } - - //corrected camera position - camera.position.set(camera.targetPosition.add(c2c)); - } - catch(e) {} - - camera.roll=0; //z-axis always up +mouseEventHandler.onEvent = function (e) { + var c2c = camera.position.subtract(camera.targetPosition); + var roo = c2c.length; + c2c.normalize(); + cos_beta = c2c.dot(camera.axis_up); //cos of enclosed angle + + //correct the camera position if it is too high or too low + if(Math.abs(cos_beta) > cos_min_beta) { + //auxiliary vectors a & b + var a = camera.axis_up.scale(cos_beta); + var b = c2c.subtract(a); + b.normalize(); + b.scaleInPlace(tan_min_beta * a.length); + + c2c.set(a.add(b)); + c2c.normalize(); + + camera.position.set(camera.targetPosition.add(c2c.scale(roo))); + cos_beta = c2c.dot(camera.axis_up); } -} + //suppress rolling + camera.up.set( + camera.position.add(camera.axis_up).add(c2c.scale(-cos_beta)) + ); +}; runtime.addEventHandler(mouseEventHandler); diff --git a/Master/texmf-dist/doc/latex/movie15/dice.vws b/Master/texmf-dist/doc/latex/movie15/dice.vws index 06a7e496061..bfd7f35ec83 100644 --- a/Master/texmf-dist/doc/latex/movie15/dice.vws +++ b/Master/texmf-dist/doc/latex/movie15/dice.vws @@ -1,7 +1,7 @@ -[Front]{}{0 -1 0}{27}{}% using defaults coo=0 0 0 (arg #2) and aac=30 (arg #5) -[Back]{}{0 1 0}{27}{} -[Left]{}{-1 0 0}{27}{} -[Right]{}{1 0 0}{27}{} -[Top]{}{0 0 1}{27}{} -[Bottom]{}{0 0 -1}{27}{} -[Fish Eye at Centre]{}{0 -1 0}{}{130}% using defaults coo=0 0 0 (arg #2) and roo=0 (arg #4) +[Front]{}{}{27}{}{}% using defaults: coo=0 0 0 (arg #2), c2c=0 -1 0 (arg #3), roll=0 (arg #5) and aac=30 (arg #6) +[Back]{}{0 1 0}{27}{}{} +[Left]{}{-1 0 0}{27}{}{} +[Right]{}{1 0 0}{27}{}{} +[Top]{}{0 0 1}{27}{}{} +[Bottom]{}{0 0 -1}{27}{}{} +[Fish Eye at Centre]{}{}{}{}{130}% using defaults: coo=0 0 0 (arg #2), c2c=0 -1 0 (arg #3), roo=0 (arg #4), roll=0 (arg #5) diff --git a/Master/texmf-dist/doc/latex/movie15/lights.js b/Master/texmf-dist/doc/latex/movie15/lights.js new file mode 100644 index 00000000000..97c6175336f --- /dev/null +++ b/Master/texmf-dist/doc/latex/movie15/lights.js @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////////////////// +// +// lights.js +// +// example JavaScript for use with `3Djscript' option of \includemovie +// +// * Adds light sources around the object for better illumination. +// +//////////////////////////////////////////////////////////////////////// + +//first remove any scene lights +for (var i = scene.lights.count - 1; i >= 0; i--) { + scene.lights.removeByIndex(i); +} + +//new lights +//from left +l1 = scene.createLight(); +l1.color.set(1,1,1); +l1.brightness = .4; +l1.direction.set(1,0,0); + +//from right +l2 = scene.createLight(); +l2.color.set(1,1,1); +l2.brightness = .4; +l2.direction.set(-1,0,0); + +//from bottom +l3 = scene.createLight(); +l3.color.set(1,1,1); +l3.brightness = .4; +l3.direction.set(0,0,1); + +//from top +l4 = scene.createLight(); +l4.color.set(1,1,1); +l4.brightness = .4; +l4.direction.set(0,0,-1); + +//from front +l5 = scene.createLight(); +l5.color.set(1,1,1); +l5.brightness = .4; +l5.direction.set(0,1,0); + +//from back +l6 = scene.createLight(); +l6.color.set(1,1,1); +l6.brightness = .4; +l6.direction.set(0,-1,0); diff --git a/Master/texmf-dist/doc/latex/movie15/movie15.pdf b/Master/texmf-dist/doc/latex/movie15/movie15.pdf Binary files differindex 27cd89c2953..e55f511fe30 100644 --- a/Master/texmf-dist/doc/latex/movie15/movie15.pdf +++ b/Master/texmf-dist/doc/latex/movie15/movie15.pdf diff --git a/Master/texmf-dist/doc/latex/movie15/movie15.tex b/Master/texmf-dist/doc/latex/movie15/movie15.tex index 18f7d208363..5a0fb60e052 100644 --- a/Master/texmf-dist/doc/latex/movie15/movie15.tex +++ b/Master/texmf-dist/doc/latex/movie15/movie15.tex @@ -5,7 +5,7 @@ % for the details of that license. % \documentclass[a4paper]{article} - +\frenchspacing \usepackage[3D]{movie15} \usepackage{ragged2e} \usepackage{amssymb} @@ -35,7 +35,7 @@ pdftitle={The movie15 Package}, pdfsubject={Documentation}, pdfauthor={Alexander Grahn}, - pdfkeywords={embed, embedded, multimedia, movie, sound, 3D, LaTeX, pdfLaTeX, PDF, Adobe}, + pdfkeywords={embed, include, multimedia, movie, sound, video, animation, JavaScript, 3D, LaTeX, pdfLaTeX, PDF}, citebordercolor={0 0 1}, filebordercolor={0 0 1}, linkbordercolor={0 0 1}, @@ -49,8 +49,9 @@ \author{Alexander Grahn\\[1ex]\includegraphics[height=2.7ex]{mailto}} \maketitle -\begin{abstract} -A \LaTeX{} package for inclusion of movies, sounds and 3D objects into PDF documents with PDF-1.5/1.6 compatibility. +\begin{abstract}\noindent +A \LaTeX{} package for inclusion of movies, sounds and 3D objects into PDF documents with PDF-1.5/1.6 compatibility.\\[0.2\baselineskip] +\emph{Keywords}: embed, include, multimedia, movie, sound, video, animation, JavaScript, 3D, LaTeX, pdfLaTeX, PDF \end{abstract} \tableofcontents @@ -93,16 +94,14 @@ Enables the 3D feature from the PDF-1.6 specification. Inclusion of 3D files int \begin{verbatim} draft \end{verbatim} -Media files are not included. Just the file name is printed in a box of size \verb+<width>+$\times$(\verb+<height>++\verb+<depth>+), see \hyperlink{lnk:widthheight}{below}. +Media files are not included. Just the file name is printed in a box of size \verb+<width>+$\times$(\verb+<height>++\verb+<depth>+). \begin{verbatim} final \end{verbatim} The opposite of draft. Useful to override a global draft option specified in the \verb+\documentclass+ command. -If PDF is generated via DVI and Postscript by the usual \verb+latex+ $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+ sequence of commands, the `graphicx' and `hyperref' packages are required and must be loaded \emph{after} `movie15'. - -In the case of pdf\LaTeX{}, the `graphicx' and `hyperref' packages are not required. +If PDF is generated via DVI and Postscript by the usual \verb+latex+ $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+ sequence of commands, the `graphicx' and `hyperref' packages are required. In the case of pdf\LaTeX{}, the `graphicx' and `hyperref' packages are not required. Note that several runs may be necessary to resolve internally created cross-references. Appropriate warnings will be issued in such cases. @@ -112,7 +111,7 @@ Movies, sounds and 3D objects are embedded into the document using the command \begin{verbatim} \includemovie[<options>]{<width>}{<height>}{<media file>} \end{verbatim} -\hypertarget{lnk:widthheight}{}Unless left empty, the \verb+<width>+ and \verb+<height>+ arguments must be given in valid \TeX{} dimensions. Horizontal and vertical dimensions of the media clip are scaled independently to fit \verb+<width>+ and \verb+<height>+ or, if the two latter are empty, to fit the size of the text box, given as argument to the `\verb+text+' option, see \hyperlink{lnk:textoption}{below}. \verb+<media file>+ specifies the file name of the media clip. If the media file is embedded as part of the final PDF output, which is the default, it may reside wherever \TeX{} or Ghostscript search for input files, depending on the PDF producing method. +Unless left empty, the \verb+<width>+ and \verb+<height>+ arguments must be given in valid \TeX{} dimensions. Horizontal and vertical dimensions of the media clip are scaled independently to fit \verb+<width>+ and \verb+<height>+ or, if the two latter are empty, to fit the size of the text box, given as argument to the `\verb+text+' option; see \hyperlink{lnk:textoption}{below}. \verb+<media file>+ specifies the file name of the media clip. If the media file is embedded as part of the final PDF output, which is the default, it may reside wherever \TeX{} or Ghostscript search for input files, depending on the PDF producing method. Below, common options to \verb+\includemovie+ are listed. Options specific to embedding of 3D content are discussed separately in section~\ref{sec:3D}. The impatient reader may advance directly to the \hyperlink{sec:3Dtut}{3D quick-start guide}, which summarizes the basic steps for embedding 3D objects. \begin{verbatim} @@ -197,7 +196,7 @@ Forces a particular media player plug-in to be used instead of the default one. \begin{verbatim} poster \end{verbatim} -The first frame of the movie or the frame at the beginning of the movie section specified by the `\verb+startat+' and `\verb+endat+' options is shown. +The first frame of the movie or the frame at the beginning of the movie section specified by the `\verb+startat+' option is shown. \begin{verbatim} poster=<image> \end{verbatim} @@ -235,7 +234,7 @@ text=<text> \includemovie[text={\includegraphics[scale=2]{path/to/poster}}] {}{}{path/to/movie} \end{verbatim} -In combination with the `\verb+poster+' option, where the poster image will be rendered from the movie during runtime, the PDF file size can be reduced somewhat by putting \verb+\includegraphics+ into a \verb+\phantom+ box: +In combination with the `\verb+poster+' option, which causes the poster image to be rendered from the movie during runtime, the PDF file size can be reduced somewhat by putting \verb+\includegraphics+ into a \verb+\phantom+ box: \begin{verbatim} \includemovie[ poster, @@ -256,7 +255,7 @@ volume=<percentage of original volume> The meaning of this option should be self explaining. \subsection{Inclusion of 3D objects}\label{sec:3D} -The PDF-1.6 specification, which was introduced with the advent of Adobe Acrobat/Reader 7, allows embedding of 3-dimensional graphic objects, such as CAD models or 3D scientific data, and lets the user interactively manipulate them. At time of writing this documentation, the only supported file format is U3D~\cite{3diforg}, and only one commercial software~\cite{dexp} for exporting into U3D format, yet from a number of CAD and 3D vector formats, including DXF and VRML, was known. Nevertheless, a try-out version of~\cite{dexp} can be downloaded without charge. +The PDF-1.6 specification, which was introduced with the advent of Adobe Acrobat/Reader 7, allows embedding of 3-dimensional graphic objects, such as CAD models or 3D scientific data, and lets the user interactively manipulate them. At time of writing this documentation, the only supported file format was U3D~\cite{3diforg}, and only one commercial software~\cite{dexp} for exporting into the U3D format, yet from a number of CAD and 3D vector formats, including DXF and VRML, was known. Nevertheless, a try-out version of~\cite{dexp} can be downloaded without charge. Selection of the `\verb+3D+' package option enables the 3D feature. Most of the command options listed in section~\ref{usrif} do what they are supposed to do in the case of embedded 3D as well. Other options are ignored, in particular `\verb+repeat+', `\verb+palindrome+', `\verb+startat+', `\verb+endat+', `\verb+rate+' and `\verb+volume+', because they do not make sense and `\verb+mouse+', because 3D objects are interactive by definition. Options `\verb+inline=false+' and `\verb+url+' are supported, but imply option `{\tt{}externalview\-er}', because the 3D Reader plug-in handles embedded files only. @@ -270,7 +269,7 @@ The \emph{default view}, i.\,e. the view that is shown initially after activatin \begin{verbatim} 3Daac=<angle> \end{verbatim} -This option sets the aperture angle of the camera, measured in degrees. Fixed point real numbers between 0 and 180 are admissible. A sensible value of 30 is pre-set by default. Larger values can be used to achieve wide-angle or fish-eye effects, see example~\ref{ex3d} in section~\ref{examples}. +This option sets the aperture angle of the camera, measured in degrees. Fixed point real numbers between 0 and 180 are admissible. A sensible value of 30 is pre-set by default. Larger values can be used to achieve wide-angle or fish-eye effects. See example~\ref{ex3d} in section~\ref{examples}. \begin{verbatim} 3Dc2c=<x> <y> <z> \end{verbatim} @@ -284,6 +283,10 @@ are allowed. \end{verbatim} \verb+<x> <y> <z>+ specify the positional vector $\overrightarrow{COO}$ of the centre of orbit. See option `\verb+3Dc2c+' for the number format of \verb+<x> <y> <z>+. \begin{verbatim} +3Droll=<roll> +\end{verbatim} +Prescribes an initial camera roll around the optical axis (in clockwise direction, if \verb+<roll>+ is greater that zero); measured in degrees. +\begin{verbatim} 3Droo=<r> \end{verbatim} \verb+<r>+ (always positive!) specifies the radius of orbit $ROO$ of the virtual camera. See option `\verb+3Dc2c+' for the number format of \verb+<r>+. @@ -295,9 +298,9 @@ Without the above options the virtual camera sits at the origin $(0,0,0)$ of the \end{verbatim} Instead of or in addition to the default view, further \emph{named views} can be set in an auxiliary file specified by the `\verb+3Dviews+' option. The additional views can later be selected from a drop down list in the tool bar that is associated with every activated 3D object in the Reader. The file \verb+<views file>+ contains lines which obey the syntax: \begin{verbatim} -[<name>]{<coo_x> <coo_y> <coo_z>}{<c2c_x> <c2c_y> <c2c_z>}{<roo>}{<aac>} +[<name>]{<coo_x> <coo_y> <coo_z>}{<c2c_x> <c2c_y> <c2c_z>}{<roo>}{<roll>}{<aac>} \end{verbatim} -The \verb+<name>+ entry is optional. If \verb+<name>+ is not given, a default name consisting of `View' followed by the number of the current entry in the list is formed. For \verb+<coo_x>+, \verb+<coo_y>+, \verb+<coo_z>+, \verb+<c2c_x>+, \verb+<c2c_y>+, \verb+<c2c_z>+, \verb+<roo>+ and \verb+<aac>+ the same rules as for the corresponding options `\verb+3Dcoo+', `\verb+3Dc2c+', `\verb+3Droo+' and `\verb+3Daac+' apply. Empty braces, \verb+{}+, are possible and cause default values to be used. Trailing spaces or comment signs (\%) are allowed. Reading of the file stops either at its end, at the first empty line encountered or at the first line containing nothing but spaces and/or a comment sign followed by arbitrary stuff. +The \verb+<name>+ entry is optional. If \verb+<name>+ is not given, a default name consisting of `View' followed by the number of the current entry in the list is formed. For \verb+<coo_x>+, \verb+<coo_y>+, \verb+<coo_z>+, \verb+<c2c_x>+, \verb+<c2c_y>+, \verb+<c2c_z>+, \verb+<roo>+, \verb+<roll>+ and \verb+<aac>+ the same rules as for the corresponding options `\verb+3Dcoo+', `\verb+3Dc2c+', `\verb+3Droo+', `\verb+3Droll+' and `\verb+3Daac+' apply. Empty braces, \verb+{}+, are possible and cause default values to be used. Trailing spaces or comment signs (\%) are allowed. Reading of the file stops either at its end, at the first empty line encountered or at the first line containing nothing but spaces and/or a comment sign followed by arbitrary stuff. See option `\verb+3Dgetview+' of \verb+\movieref+ on how to get the camera settings of the current view in the Reader, which can be used to populate a file of additional views. \begin{verbatim} 3Dbg=<r> <g> <b> @@ -307,7 +310,7 @@ This option sets the background colour of the canvas. Only fixed point real numb \begin{verbatim} 3Djscript=<JavaScript file> \end{verbatim} -Things like animation, lighting, background colour etc. may also be script driven. Option `\verb+3Djscript+' associates a \verb+<JavaScript file>+ with the 3D object. The script will be executed upon activation of the object. Refer to the Acrobat 3D JavaScript Reference~\cite{jscript3D} for details. +Things like animation, lighting, background colour etc. may also be script driven. Option `\verb+3Djscript+' associates \verb+<JavaScript file>+ with the 3D object. The script will be executed upon activation of the object. Refer to the Acrobat 3D JavaScript Reference~\cite{jscript3D} for details. Directory `\verb+doc/javascript+' contains JavaScript example files for animation and rotation control. The files work off-the-shelf with any 3D file and may be concatenated to combine their effects. \subsection{Media hyperlinks}\label{hyperlinks} A movie, sound or 3D object may serve as the destination of hyperlinks, which are inserted into the document using the command @@ -350,20 +353,26 @@ Immediately closes the media player. \begin{verbatim} 3Dviewindex=<index> \end{verbatim} -Go to a predefined view of the 3D object. \verb+<index>+ can take `\verb+F+', `\verb+L+', `\verb+N+' or `\verb+P+' to access the first, last, next or previous element of the list of additional views, cf. option `\verb+3Dviews+' of {\tt \string\include\-movie}, or an integer specifying an index into the list. In the case of `\verb+N+' and `\verb+P+', repeated clicking onto the hyperlink allows to cycle through the list in forward or backward direction. `\verb+D+' gives access to the default view. +Go to a predefined view of the 3D object. \verb+<index>+ can take `\verb+F+', `\verb+L+', `\verb+N+' or `\verb+P+' to access the first, last, next or previous element of the list of additional views, see option `\verb+3Dviews+' of {\tt \string\include\-movie}, or an integer specifying an index into the list. In the case of `\verb+N+' and `\verb+P+', repeated clicking onto the hyperlink allows to cycle through the list in forward or backward direction. `\verb+D+' gives access to the default view. \begin{verbatim} 3Daac=<angle> 3Dc2c=<x> <y> <z> 3Dcoo=<x> <y> <z> +3Droll=<roll> 3Droo=<r> \end{verbatim} -Instead of referencing an existing view of the 3D object, a new one can be defined using any of these options, cf. section~\ref{sec:3D}. +Instead of referencing an existing view of the 3D object, a new one can be defined using any of these options. See section~\ref{sec:3D}. \begin{verbatim} 3Dcalculate[=<aac angle>] \end{verbatim} -Creates a link for calculating `\verb+3Droo+' and `\verb+3Dcoo+' settings of the virtual camera. Clicking the link opens a dialogue box from which the settings can be copied to the clipboard for later insertion into the option list of \verb+\includemovie+. The default aperture angle of $30$\textdegree{} is used for the calculation unless an optional \verb+<aac angle>+ has been provided. +Mainly used during document authoring. Creates a link for calculating `\verb+3Droo+' and `\verb+3Dcoo+' settings of the virtual camera, which may be used to define a default view. Clicking the link opens a dialogue box from which the settings can be copied to the clipboard for later insertion into the option list of \verb+\includemovie+. The default aperture angle of $30$\textdegree{} is used for the calculation unless an optional \verb+<aac angle>+ has been provided. + +\begin{verbatim} +3Dgetview +\end{verbatim} +Mainly used during document authoring. Camera settings corresponding to the current view in the Reader are printed to a dialogue box. The output is readily formatted to be inserted into a file of predefined views. See option `\verb+3Dviews+'. \begin{verbatim} 3Djscript=<JavaScript file> @@ -374,7 +383,7 @@ Runs the script \verb+<JavaScript file>+ after clicking the link. Unlike the scr \end{verbatim} For details about Acrobat JavaScript and its Annot3D object, see \cite{jscript}. -\newpage +%\newpage \subsection{Compatibility commands} Two user commands have been provided that make `movie15' a replacement for the `multimedia' package which is part of Till Tantau's `Beamer' Class: \begin{verbatim} @@ -414,7 +423,7 @@ duration=<duration in seconds>s \end{verbatim} The duration of the media segment to be played. The trailing `\verb+s+' is mandatory. Note that `\verb+duration+' cannot be used together with option `\verb+startat+' from \verb+\includemovie+. In order to define a media segment options can be combined as follows: `\verb+startat+'/`\verb+endat+', `\verb+start+'/`\verb+endat+', `\verb+start+'/`\verb+duration+'. -\newpage +%\newpage \section{Examples}\label{examples} \begin{enumerate} \item A short circular MPEG movie, taken from \href{http://www.linux-video.net/Samples/}{\tt http://www.linux-video.net/} \href{http://www.linux-video.net/Samples/}{\tt Samples/} @@ -472,8 +481,8 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \end{center} \end{minipage} -\newpage -\item\label{ex3d} Embedded U3D file. It is based on a VRML model by Peter Whitehouse \href{mailto:pwhitehouse@optusnet.com.au}{\tt <pwhitehouse@optusnet.com.au>}. Conversion to U3D has been made with DeepExploration\textsuperscript{\scriptsize\textregistered}\cite{dexp}. The file `{\tt dice.vws}' provides additional views to be selected from the 3D toolbar or by right click. The JavaScript `{\tt dice.js}' defines light sources and disables the annoying Gimbal rotation mode. +%\newpage +\item\label{ex3d} Embedded U3D file. It is based on a VRML model by Peter Whitehouse, \href{http://www.wonko.info/vrml/index.htm}{\tt http://www.wonko.info/vrml/index.htm}. Conversion to U3D has been made with DeepExploration\textsuperscript{\scriptsize\textregistered}\cite{dexp}. The file `{\tt dice.vws}' provides predefined views to be selected from the 3D toolbar or by right click. The JavaScript `{\tt dice.js}' defines light sources and disables the annoying Gimbal rotation mode. \begin{minipage}{0.5\linewidth} {\tt% @@ -482,8 +491,7 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \phantom{xx}label=dice,\\ \phantom{xx}text=(dice.u3d),\\ \phantom{xx}3Droo=27,\\ - \phantom{xx}3Dc2c=1 -1 1,\\ - \phantom{xx}3Dbg=1 1 1,\\ +% \phantom{xx}3Dc2c=1 -1 1,\\ \phantom{xx}3Dviews=dice.vws,\\ \phantom{xx}3Djscript=dice.js\\ ]\string{\\ @@ -506,13 +514,11 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda label=dice, text=(dice.u3d), 3Droo=27, - 3Dc2c=1 -1 1, - 3Dbg=1 1 1, 3Dviews=dice.vws, 3Djscript=dice.js ]{\linewidth}{\linewidth}{dice.u3d} \end{center} -\movieref[3Dviewindex=N]{dice}{Click here} to cycle through the list of additional views. \movieref[3Dcalculate=60]{dice}{This link} calculates 3D option settings for a 60\textdegree{} aperture angle of the virtual camera. +\movieref[3Dviewindex=N]{dice}{Click here} to cycle through the list of predefined views. \movieref[3Dcalculate=60]{dice}{This link} calculates 3D option settings for a 60\textdegree{} aperture angle of the virtual camera. \end{minipage} \end{enumerate} @@ -533,14 +539,14 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \string\movieref[3Dcalculate]\string{my\_label\string}\string{Click here!\string} } - \item Compile and recompile the document source until no more `movie15' related warnings appear. + \item Compile and recompile the document until no more `movie15' related warnings appear. \item Open the PDF document with Adobe Reader and go to the page containing the 3D object. Click the link and wait for a dialogue box to pop up. \item Copy the settings ({\tt 3Droo=...}, {\tt 3Dcoo=...}) from the dialogue box into the option list of {\tt \string\include\-movie}. Remove the link from the document source: {\tt% \string\includemovie[\\ - \phantom{xx}poster, 3Droo=33.3333, 3Dcoo=1.2345 9.8765 0 - \\]\string{\\ + \phantom{xx}poster, 3Droo=33.3333, 3Dcoo=1.2345 9.8765 0\\ + ]\string{\\ \phantom{xx}.5\string\linewidth\\ \string}\string{\\ \phantom{xx}.5\string\linewidth\\ @@ -549,9 +555,59 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \string} } - \item Again, compile and recompile the document source until no more `movie15' related warnings appear. + \item Again, compile and recompile the document until no more `movie15' related warnings appear. + \xdef\lastcount{\theenumi} \end{enumerate} +\emph{Optional steps:} + +\begin{enumerate} + \setcounter{enumi}{\lastcount} + \item Associate a JavaScript with the 3D object: + + {\tt% + \string\includemovie[\\ + \phantom{xx}..., 3Djscript=my\_script.js\\ + ]\string{\\ + \phantom{xx}.5\string\linewidth\\ + \string}\string{\\ + \phantom{xx}.5\string\linewidth\\ + \string}\string{\\ + \phantom{xx}my\_file.u3d\\ + \string} + } + + JavaScript is required if you want to make use of embedded animation. The example file `{\tt{}animation.js}' in the `{\tt{}doc/javascript}' directory may serve as a starting point. + + Another useful example file you should definitely experiment with is `{\tt{}turn\-table.js}'. It improves the rotational behaviour of the 3D object, because it prevents the object from tilting to the side while dragging the mouse. + + All files in `{\tt{}doc/javascript}' work off-the-shelf and can be copied into a single file in order to combine their effects. + + \item Create a file with predefined views of the 3D object and attach it to the latter using the `{\tt{}3Dviews}' option: + + {\tt% + \string\includemovie[\\ + \phantom{xx}..., label=my\_label, 3Dviews=my\_views.vws\\ + ]\string{\\ + \phantom{xx}.5\string\linewidth\\ + \string}\string{\\ + \phantom{xx}.5\string\linewidth\\ + \string}\string{\\ + \phantom{xx}my\_file.u3d\\ + \string} + } + + The views file can easily be populated using a temporarily inserted {\tt \string\movie\-ref} link: + + {\tt% + \string\movieref[3Dgetview]\string{my\_label\string}\string{Click here!\string} + } + + Manipulate the 3D object in the Reader by means of the `Rotate', `Pan', `Zoom' and `Walk' tools as well as the `Zoom to Part' action (to be selected from the context menu items `Tools' and `Part Options'). A line, readily formatted for insertion into the views file, that contains the settings according to the current view can be copied from a dialogue box which pops up after clicking the link. +\end{enumerate} + + + \section{Media formats} \begin{table}[H] \caption{Media formats for use with Adobe Reader (partially from \cite{pdfspec})}\label{table:mime} diff --git a/Master/texmf-dist/doc/latex/movie15/overlay-example.pdf b/Master/texmf-dist/doc/latex/movie15/overlay-example.pdf Binary files differindex 845bbbaab89..8c7635481bd 100644 --- a/Master/texmf-dist/doc/latex/movie15/overlay-example.pdf +++ b/Master/texmf-dist/doc/latex/movie15/overlay-example.pdf diff --git a/Master/texmf-dist/doc/latex/movie15/overlay-example.tex b/Master/texmf-dist/doc/latex/movie15/overlay-example.tex index 5aa70abc012..92348d42247 100644 --- a/Master/texmf-dist/doc/latex/movie15/overlay-example.tex +++ b/Master/texmf-dist/doc/latex/movie15/overlay-example.tex @@ -6,7 +6,7 @@ % \documentclass{beamer} \setbeamertemplate{navigation symbols}{} -\usepackage{movie15} +\usepackage[3D]{movie15} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Some hints on using movie15 with /presentation/ packages @@ -31,10 +31,12 @@ \includemovie[ poster, autopause, autoresume, - text=(AlienSong.mpg), + text={\parbox{0.4\linewidth}{\tiny + http://www.linux-video.net/\\Samples/Mpeg1/AlienSong.mpg% + }}, playerid=AAPL_QuickTime, url - ]{0.5\linewidth}{0.375\linewidth}{% + ]{0.4\linewidth}{0.3\linewidth}{% http://www.linux-video.net/Samples/Mpeg1/AlienSong.mpg% } \end{center} diff --git a/Master/texmf-dist/doc/latex/movie15/turntable.js b/Master/texmf-dist/doc/latex/movie15/turntable.js new file mode 100644 index 00000000000..d8f5bd93fd1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/movie15/turntable.js @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////// +// +// turntable.js +// +// JavaScript for use with `3Djscript' option of \includemovie +// +// * Greatly improves the rotational behaviour of the 3D object, +// prevents it from tilting to the side while dragging the mouse. +// This is achieved by suppressing the rolling of the camera about +// its optical axis. +// +///////////////////////////////////////////////////////////////////// + +// maximum pitch (degrees from horizontal) of the camera +var max_alpha = 88; +var min_beta = 90 - max_alpha; // the complement +var cos_min_beta = Math.cos(min_beta * Math.PI/180); +var tan_min_beta = Math.tan(min_beta * Math.PI/180); + +var camera = scene.cameras.getByIndex(0); + +//updates the vertical axis of rotation whenever a predefined view +//is selected from the drop down list in the 3D toolbar +var cameraEventHandler = new CameraEventHandler(); +cameraEventHandler.onEvent = function (e) { + camera.axis_up = camera.up.subtract(camera.position); + camera.axis_up.normalize(); +} +runtime.addEventHandler(cameraEventHandler); + +//suppresses camera rolling and limits camera pitch +var mouseEventHandler = new MouseEventHandler(); +mouseEventHandler.onMouseMove = true; +mouseEventHandler.onEvent = function (e) { + var c2c = camera.position.subtract(camera.targetPosition); + var roo = c2c.length; + c2c.normalize(); + cos_beta = c2c.dot(camera.axis_up); //cos of enclosed angle + + //correct the camera position if it is too high or too low + if(Math.abs(cos_beta) > cos_min_beta) { + //auxiliary vectors a & b + var a = camera.axis_up.scale(cos_beta); + var b = c2c.subtract(a); + b.normalize(); + b.scaleInPlace(tan_min_beta * a.length); + + c2c.set(a.add(b)); + c2c.normalize(); + + camera.position.set(camera.targetPosition.add(c2c.scale(roo))); + cos_beta = c2c.dot(camera.axis_up); + } + + //suppress rolling + camera.up.set( + camera.position.add(camera.axis_up).add(c2c.scale(-cos_beta)) + ); +}; +runtime.addEventHandler(mouseEventHandler); diff --git a/Master/texmf-dist/tex/latex/movie15/movie15.sty b/Master/texmf-dist/tex/latex/movie15/movie15.sty index e71a6b6414f..bd4134da353 100644 --- a/Master/texmf-dist/tex/latex/movie15/movie15.sty +++ b/Master/texmf-dist/tex/latex/movie15/movie15.sty @@ -9,7 +9,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{movie15}[2006/10/12] +\ProvidesPackage{movie15}[2006/11/21] \RequirePackage{keyval} \RequirePackage{ifthen} \RequirePackage{ifpdf} @@ -58,8 +58,24 @@ %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}% +} \ifthenelse{\boolean{@MXV@iiiDfeat}}{% \newcount\@MXV@iiidoncurpage%index of 3D annot on current page @@ -100,9 +116,9 @@ \gdef\@MXV@warning{}% of document \AtEndDocument{% \PackageWarningNoLine{movie15}{% - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak - @@ Rerun to get cross-references right! @@\MessageBreak - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}% + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak + @@ Rerun to get object references right! @@\MessageBreak + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}% }% }{}% }{}% @@ -230,6 +246,7 @@ \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 @@ -243,6 +260,7 @@ %would be noninteractive, i. e. would not respond to mouse events \setboolean{@MXV@iiidctrls}{true}% \gdef\@MXV@calc{}% camera aperture for coo and roo calculation + \setboolean{@MXV@iiidgetview}{false}% }{}% }% @@ -360,13 +378,15 @@ \newcount\@MXV@viewscount%counter for number of 3D views per inclusion \newboolean{@MXV@viewsprovided}%3d views file provided? \newboolean{@MXV@iiidctrls}% show controls? + \newboolean{@MXV@iiidgetview}% print current 3D settings? \newboolean{@MXV@defaultviewprovided}%default 3D view provided? %macro for building the transformation matrix - \def\@MXV@ciiwmatrix#1 #2 #3 #4 #5 #6 #7 {% + \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}% @@ -379,44 +399,72 @@ \FPupn\@MXV@viewx{\@MXV@viewx{} \@MXV@modulo{} div}% \FPupn\@MXV@viewy{\@MXV@viewy{} \@MXV@modulo{} div}% \FPupn\@MXV@viewz{\@MXV@viewz{} \@MXV@modulo{} div}% - %rotation matrix + %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 - \xdef\@MXV@matrix{-1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 -1.0}% + %up-vector + \FPupn\@MXV@upx{0.0}% + \FPupn\@MXV@upy{1.0}% + \FPupn\@MXV@upz{0.0}% \else% bottom view - \xdef\@MXV@matrix{-1.0 0.0 0.0 0.0 -1.0 0.0 0.0 0.0 1.0}% + %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 + %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 + %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@viewy{} \@MXV@upz{} mul % - \@MXV@viewz{} \@MXV@upy{} mul sub}% - \FPupn\@MXV@lefty{\@MXV@viewz{} \@MXV@upx{} mul % - \@MXV@viewx{} \@MXV@upz{} mul sub}% - \FPupn\@MXV@leftz{\@MXV@viewx{} \@MXV@upy{} mul % - \@MXV@viewy{} \@MXV@upx{} mul sub}% + \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}% - \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}% \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}% - \FPiflt\@MXV@roo{0.001}\FPupn\@MXV@roo{0.001}\fi% + \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}% @@ -427,7 +475,7 @@ } %macro for parsing one line of 3D views file - \newcommand{\@MXV@parseline}[5][]{% + \newcommand{\@MXV@parseline}[6][]{% \xdef\@MXV@xname{#1}% name of the view (optional) \ifthenelse{\equal{#2}{}}{% \xdef\@MXV@coo{0 0 0}% @@ -445,9 +493,14 @@ \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{#5}% + \xdef\@MXV@aac{#6}% }% } @@ -457,7 +510,7 @@ \xdef\@MXV@varray{}% empty varray % %default view - \edef\@MXV@args{\@MXV@coo\space\@MXV@ctoc\space\@MXV@roo\space}% + \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 @@ -473,7 +526,7 @@ \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}% + \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}{}}{% @@ -568,7 +621,7 @@ \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}% +% \OR\boolean{@MXV@attachment} }{% \pdfannot width #1 height #2 depth #3 {% /Subtype /FileAttachment% @@ -647,7 +700,7 @@ \else% \edef\@MXV@iiidstreamorref{\@MXV@iiidstream}% \fi% - %annotation object of subtype `3D'% + %annotation object of subtype `3D' \pdfannot width #1 height #2 depth #3 {% /Subtype/3D% /F 4% we cannot put F 5 here; bug in Reader; 3D annot would be @@ -788,7 +841,7 @@ % %insert FileAttachment annotation \ifthenelse{\boolean{@MXV@inline}\AND\boolean{@MXV@externalviewer}% -% \OR\boolean{@MXV@attachment}% +% \OR\boolean{@MXV@attachment} }{% \makebox[0pt][l]{% \pdfmark[\phantom{\@MXV@box{#1}{#2}{#3}}]{% @@ -1150,7 +1203,7 @@ }% % \if@MXV@externalviewer\else% - %new annotation object of subtype `Screen'% + %new annotation object of subtype `Screen' \pdfannot width #1 height #2 depth #3 {% /Subtype /Screen% /Border [0 0 0]% no border (PDF-1.1) @@ -1308,7 +1361,7 @@ \if@MXV@externalviewer% \@MXV@box{#1}{#2}{#3}% \else% - %new annotation object of subtype `Screen'% + %new annotation object of subtype `Screen' \pdfmark[\@MXV@box{#1}{#2}{#3}]{% pdfmark=/ANN,% Subtype=/Screen,% @@ -1572,25 +1625,20 @@ \savebox{\@MXV@textbox}{\makebox[\@MXV@width][c]{\usebox{\@MXV@textbox}}}% }% % - %find out if some presentation making package is being used - %and whether the contents should be hidden or not on the current slide - \setboolean{@MXV@presentation}{false}% + %find out whether the contents should be hidden or not (for presentations) \setboolean{@MXV@hide}{false}% - \ifx\ifpd@overlay\@undefined\relax% - \else% powerdot - \setboolean{@MXV@presentation}{true}% + \ifthenelse{\boolean{@MXV@powerdot}}{% \ifthenelse{\boolean{pd@overlay}}{}{% \ifthenelse{\pd@method=2}{}{% \setboolean{@MXV@hide}{true}% }% }% - \fi% - \ifx\ifbeamer@anotherslide\@undefined\relax\else% - \setboolean{@MXV@presentation}{true}% + }{}% + \ifthenelse{\boolean{@MXV@beamer}}{% \ifthenelse{\boolean{beamer@anotherslide}}{% \setboolean{@MXV@hide}{true}% }{}% - \fi% + }{}% % \ifthenelse{\boolean{@MXV@hide}}{% %insert whitespace instead of annot @@ -1631,19 +1679,19 @@ \def\@MXV@runattr{}% }{% \edef\@MXV@urlattr{% - \ifx\beamer@version\@undefined% - /Border [\@pdfborder]% - \else% + \if@MXV@beamer% /Border [1 1 1]% + \else% + /Border [\@pdfborder]% \fi% /C [\@urlbordercolor]% /H \@pdfhighlight% }% \edef\@MXV@runattr{% - \ifx\beamer@version\@undefined% - /Border [\@pdfborder]% - \else% + \if@MXV@beamer% /Border [1 1 1]% + \else% + /Border [\@pdfborder]% \fi% /C [\@runbordercolor]% /H \@pdfhighlight% @@ -2046,25 +2094,20 @@ \leavevmode% \savebox{\@MXV@textbox}{#3}% save text argument % - %find out if some presentation making package is being used - %and whether the contents should be hidden or not on the current slide - \setboolean{@MXV@presentation}{false}% + %find out whether the contents should be hidden or not (for presentations) \setboolean{@MXV@hide}{false}% - \ifx\ifpd@overlay\@undefined\relax% - \else% powerdot - \setboolean{@MXV@presentation}{true}% + \ifthenelse{\boolean{@MXV@powerdot}}{% \ifthenelse{\boolean{pd@overlay}}{}{% \ifthenelse{\pd@method=2}{}{% \setboolean{@MXV@hide}{true}% }% }% - \fi% - \ifx\ifbeamer@anotherslide\@undefined\relax\else% - \setboolean{@MXV@presentation}{true}% + }{}% + \ifthenelse{\boolean{@MXV@beamer}}{% \ifthenelse{\boolean{beamer@anotherslide}}{% \setboolean{@MXV@hide}{true}% }{}% - \fi% + }{}% % \ifthenelse{\boolean{@MXV@hide}}{% %put whitespace instead of link annot @@ -2130,436 +2173,535 @@ %else use the indexed view specified by option `3Dviewindex' \fi% % - %java script action + %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{ + %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.constructor.name!='Scene'){% + 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{% + \ifthenelse{% create only once \equal{\@MXV@getlabelvalue{\@MXV@jscriptiiidfile}}{undefined}% }{% \ifpdf% \pdfobj stream file {\@MXV@jscriptiiidfile}% \pdfrefobj\pdflastobj% - \edef\@MXV@jscriptiiid{/JS \the\pdflastobj\space 0 R}% + \edef\@MXV@userjscriptiiidstream{\the\pdflastobj\space 0 R}% \@MXV@newlabel{\@MXV@jscriptiiidfile}{\the\pdflastobj}% \else% \pdfmark{% pdfmark=/OBJ,% Raw={% - /_objdef {linkjscriptiiid\the\@MXV@links}% + /_objdef {linkuserjscriptiiid\the\@MXV@links}% /type/stream% }% }% \pdfmark{% pdfmark=/PUT,% Raw={% - {linkjscriptiiid\the\@MXV@links}% + {linkuserjscriptiiid\the\@MXV@links}% (\@MXV@jscriptiiidfile) (r) file% }% }% - \edef\@MXV@jscriptiiid{% - /JS {linkjscriptiiid\the\@MXV@links}% + \edef\@MXV@userjscriptiiidstream{% + {linkuserjscriptiiid\the\@MXV@links}% }% \@MXV@newlabel{\@MXV@jscriptiiidfile}% - {linkjscriptiiid\the\@MXV@links}% + {linkuserjscriptiiid\the\@MXV@links}% \fi% }{% \ifpdf% - \edef\@MXV@jscriptiiid{% - /JS \@MXV@getlabelvalue{\@MXV@jscriptiiidfile}\space 0 R% + \edef\@MXV@userjscriptiiidstream{% + \@MXV@getlabelvalue{\@MXV@jscriptiiidfile}\space 0 R% }% \else% - \edef\@MXV@jscriptiiid{% - /JS {\@MXV@getlabelvalue{\@MXV@jscriptiiidfile}}% + \edef\@MXV@userjscriptiiidstream{% + {\@MXV@getlabelvalue{\@MXV@jscriptiiidfile}}% }% \fi% }% \fi% \edef\@MXV@jscriptiiidaction{% /Next <<% - /S/JavaScript% fill hash (annot3D) with refs to Annot3D objects - /JS (% for use within the user provided script - try{% - 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!"); - }% - }% - )% - %JavaScript for calculating 3Droo and 3Dcoo settings for a given - %aperture angle - \ifx\@MXV@calc\@empty\else% + /S/JavaScript% + /JS (\@MXV@linkjscriptiiid)% + \ifx\@MXV@jscriptiiidfile\@empty\else% /Next <<% /S/JavaScript% - /JS (try{% - %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.constructor.name != 'Scene'){% - 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.); - % - %assemble 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), 32% - ); - }% - 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 += '3Droo=' + roo + ','; - % - %open pop-up displaying the result string - 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 + '\string\\\string\\includemovie!'% - }, - {% - type: "edit_text", % - item_id: "text", % - alignment: "align_fill", % - readonly: false% - }, % - {% - type: "ok", % - ok_name: "Close"% - }% - ]% - }% - }; - app.execDialog(settings); - }catch(e){})% - \fi% - \ifx\@MXV@jscriptiiidfile\@empty\else% - /Next <<% - /S/JavaScript% - \@MXV@jscriptiiid% user provided script - >>% - \fi% - \ifx\@MXV@calc\@empty\else% + /JS \@MXV@userjscriptiiidstream% user provided script >>% \fi% >>% @@ -2781,10 +2923,10 @@ \def\@MXV@linkattr{}% }{% \edef\@MXV@linkattr{% - \ifx\beamer@version\@undefined% - /Border [\@pdfborder]% - \else% + \if@MXV@beamer% /Border [1 1 1]% + \else% + /Border [\@pdfborder]% \fi% /C [\@linkbordercolor]% /H \@pdfhighlight% @@ -3085,6 +3227,12 @@ \setboolean{@MXV@defaultviewprovided}{true}% }{\@MXV@neediiiD}% } +\define@key{movie15}{3Droll}{% + \ifthenelse{\boolean{@MXV@iiiDfeat}}{% + \def\@MXV@roll{#1}% + \setboolean{@MXV@defaultviewprovided}{true}% + }{\@MXV@neediiiD}% +} \define@key{movie15}{3Dviews}{% \ifthenelse{\boolean{@MXV@iiiDfeat}}{% \IfFileExists{#1}{% @@ -3097,10 +3245,6 @@ }% }{\@MXV@neediiiD}% } -\define@key{movie15}{3Dcalculate}[30]{% - %calculates optimal 3D settings for roo and coo for a given aac - \gdef\@MXV@calc{#1}% -} %options for \movieref command \define@key{movie15}{play}[true]{% \setboolean{@MXV@linkplay}{#1}% @@ -3178,6 +3322,18 @@ \setboolean{@MXV@defaultviewprovided}{false}% }{\@MXV@neediiiD}% } +\define@key{movie15}{3Dcalculate}[30]{% + %calculates optimal 3D settings for roo and coo for a given aac + \ifthenelse{\boolean{@MXV@iiiDfeat}}{% + \gdef\@MXV@calc{#1}% + }{\@MXV@neediiiD}% +} +\define@key{movie15}{3Dgetview}[true]{% + %print current 3D camera settings + \ifthenelse{\boolean{@MXV@iiiDfeat}}{% + \setboolean{@MXV@iiidgetview}{#1}% + }{\@MXV@neediiiD}% +} %compatibility macros \providecommand\movie[3][]{% diff --git a/Master/texmf-dist/tpm/movie15.tpm b/Master/texmf-dist/tpm/movie15.tpm index 986d168753d..450c92efa68 100644 --- a/Master/texmf-dist/tpm/movie15.tpm +++ b/Master/texmf-dist/tpm/movie15.tpm @@ -3,7 +3,7 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/movie15.zip"> <TPM:Name>movie15</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2006/11/03 06:16:00</TPM:Date> + <TPM:Date>2006/11/21 10:05:42</TPM:Date> <TPM:Version>2005/07/01</TPM:Version> <TPM:Creator>rahtz</TPM:Creator> <TPM:Title>Multimedia inclusion package.</TPM:Title> @@ -17,25 +17,28 @@ played back synchronously. <TPM:Author>Alexander Grahn</TPM:Author> <TPM:Size>871171</TPM:Size> <TPM:Build/> - <TPM:RunFiles size="116566"> + <TPM:RunFiles size="122474"> texmf-dist/tex/latex/movie15/movie15.sty texmf-dist/tpm/movie15.tpm </TPM:RunFiles> - <TPM:DocFiles size="754605"> + <TPM:DocFiles size="780934"> texmf-dist/doc/latex/movie15/3dsystem.fig texmf-dist/doc/latex/movie15/3dsystem.pdf texmf-dist/doc/latex/movie15/3dsystem.tex texmf-dist/doc/latex/movie15/README +texmf-dist/doc/latex/movie15/animation.js texmf-dist/doc/latex/movie15/dice.js texmf-dist/doc/latex/movie15/dice.u3d texmf-dist/doc/latex/movie15/dice.vws texmf-dist/doc/latex/movie15/dice.wrl +texmf-dist/doc/latex/movie15/lights.js texmf-dist/doc/latex/movie15/mailto.png texmf-dist/doc/latex/movie15/movie15.pdf texmf-dist/doc/latex/movie15/movie15.tex texmf-dist/doc/latex/movie15/overlay-example.pdf texmf-dist/doc/latex/movie15/overlay-example.tex texmf-dist/doc/latex/movie15/random.mpg +texmf-dist/doc/latex/movie15/turntable.js </TPM:DocFiles> <TPM:Provides>Package/movie15</TPM:Provides> </rdf:Description> |