diff options
author | Norbert Preining <preining@logic.at> | 2006-11-03 06:16:00 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2006-11-03 06:16:00 +0000 |
commit | a6d4e22f961008636a3bfc36f89570e6fa0c85f6 (patch) | |
tree | 9d13f81b2a37ab6bdf3336066017d4cb5e701011 /Master/texmf-dist/tex/latex/movie15/movie15.sty | |
parent | e9b9a3f32d1a5b371fa2256f098ee4b158f6df1d (diff) |
several updates (sorry Karl, it was a long train ride):
updates of packages: screenplay, bussproofs computational-complexity
dvdcoll gnuplottex mathmode movie15 pgf pstricks-add pst-labo
trfsigns (dvi->pdf move, COPYING file to doc) toptesi tocvsec2 thumb
textfit (doc move)
added to tpm-ctan-check: typogrid trsym trfsigns tracking toptesi toolbox
todo tocvsec2 tocloft tocbibind titling titlefoot thumb textopo textfit
teubner tensor
git-svn-id: svn://tug.org/texlive/trunk@2382 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/movie15/movie15.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/movie15/movie15.sty | 468 |
1 files changed, 345 insertions, 123 deletions
diff --git a/Master/texmf-dist/tex/latex/movie15/movie15.sty b/Master/texmf-dist/tex/latex/movie15/movie15.sty index 44702431632..e71a6b6414f 100644 --- a/Master/texmf-dist/tex/latex/movie15/movie15.sty +++ b/Master/texmf-dist/tex/latex/movie15/movie15.sty @@ -1,4 +1,4 @@ -% Copyright 2004 Alexander Grahn +% Copyright 2004--2006 Alexander Grahn % % This material is subject to the LaTeX Project Public License. See % http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html @@ -9,21 +9,40 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{movie15}[2006/08/15] +\ProvidesPackage{movie15}[2006/10/12] \RequirePackage{keyval} \RequirePackage{ifthen} \RequirePackage{ifpdf} +\RequirePackage{ifdraft} -\newboolean{@MXV@iiiDfeat}% enable 3D features from PDF-1.6 spec? +\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@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}% } -\DeclareOption*{\PackageWarning{movie15}{Unknown Option \CurrentOption}} -\ProcessOptions\relax +\DeclareOption*{% + \PackageWarning{movie15}{Unknown Option \CurrentOption} +} +\ProcessOptions*\relax %correct pdfTeX version? \ifpdf% @@ -175,6 +194,12 @@ \setboolean{@MXV@linkstop}{false}% \setboolean{@MXV@linkclose}{false}% \setboolean{@MXV@linkreset}{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}% @@ -318,6 +343,18 @@ }}}}}}}}}}}}}}}}% } +%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 \newcount\@MXV@viewscount%counter for number of 3D views per inclusion @@ -1660,7 +1697,9 @@ }{}% }{}% \@MXV@labeltoaux{@MXV@\@MXV@@label.annotid}{\the\@MXV@includes}% - \@MXV@newlabel{@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@externalviewer}}{% @@ -1979,22 +2018,26 @@ }% }{}% % - %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}}{% - \@MXV@includeiiid{\@MXV@width}{\@MXV@height}{\@MXV@depth}{#4}% + \ifthenelse{\boolean{@MXV@@draft}}{% + \@MXV@draftbox{\@MXV@width}{\@MXV@height}{\@MXV@depth}{#4}% }{% - \@MXV@includemovie{\@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}}{% + \@MXV@includeiiid{\@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}}% + }{}% }% - % - %insert textbox, overprinting the poster - \ifthenelse{\boolean{@MXV@boxopt}\AND\boolean{@MXV@textoverposter}}{% - \makebox[0pt][r]{\usebox{\@MXV@textbox}}% - }{}% }% } @@ -2166,12 +2209,195 @@ /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 nodes - var nodes = annot3D["\@MXV@label"].context3D.scene.nodes; - var cnt = nodes.count; + %list of mesh nodes + var meshes = annot3D["\@MXV@label"].context3D.scene.meshes; % %auxiliary vectors var dir = new annot3D["\@MXV@label"].context3D.Vector3(); @@ -2181,110 +2407,96 @@ %auxiliary 4x4 matrix var bbox4x4 = new annot3D["\@MXV@label"].context3D.Matrix4x4(); % - %centre of global bounding box --> centre of orbit - var coo = % - annot3D["\@MXV@label"].context3D.scene.computeBoundingBox().center; - % - %radius of bounding sphere - var rBSphere = 0; - % - %iterate over all nodes in the scene - for(i=0; i<cnt; i++){% - var node = nodes.getByIndex(i); + %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; % - %but inspect mesh nodes only - if(node.constructor.name == 'Mesh'){% - %get the bbox of the node (local coordinates) - var bbox = node.computeBoundingBox(); - % - %local to parent transformation matrix - var trans = node.transform.transpose; - % - %build local to world transformation matrix by recursively - %multiplying the parent's transf. matrix on the left - var parent = node.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 radius - %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); - % - %vector from centre of orbit to bbox corner position - corner.subtractInPlace(coo); - % - %update bounding sphere radius - rBSphere = Math.max(rBSphere, corner.length); - % - %the same procedure with bbox.max - bbox4x4.setView(bbox.max, dir, up); - bbox4x4 = trans.multiply(bbox4x4.transpose); - corner.set(bbox4x4.transpose.translation); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - %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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - 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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - 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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - 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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - 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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); - % - 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); - corner.subtractInPlace(coo); - rBSphere = Math.max(rBSphere, corner.length); + %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 = rBSphere / Math.sin(aac * Math.PI / 360.); + var roo = mb.radius()/ Math.sin(aac * Math.PI / 360.); % %assemble result string var res = ''; @@ -2661,6 +2873,16 @@ } %key definitions for options to \includemovie +\define@key{movie15}{draft}[true]{% + \setboolean{@MXV@@draft}{#1}% +} +\define@key{movie15}{final}[true]{% + \ifthenelse{\equal{#1}{true}}{% + \setboolean{@MXV@@draft}{false}% + }{% + \setboolean{@MXV@@draft}{true}% + }% +} \define@key{movie15}{label}{%for use with movieref \gdef\@MXV@label{#1}% } |