0% found this document useful (0 votes)
187 views10 pages

PDF and 3D Interactive Graphics

This document discusses how to embed interactive 3D graphics from Matlab in PDF documents using the U3D file format. It provides the following steps: 1. Generate 3D surface plots in Matlab 2. Use the u3d_pre toolbox to create U3D files from the surface data 3. Use the mesh2pdf toolbox to convert the U3D files into LaTeX code for inclusion in documents 4. Add the movie15 LaTeX package and copy/paste the generated LaTeX code to embed the interactive 3D graphic in a PDF.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views10 pages

PDF and 3D Interactive Graphics

This document discusses how to embed interactive 3D graphics from Matlab in PDF documents using the U3D file format. It provides the following steps: 1. Generate 3D surface plots in Matlab 2. Use the u3d_pre toolbox to create U3D files from the surface data 3. Use the mesh2pdf toolbox to convert the U3D files into LaTeX code for inclusion in documents 4. Add the movie15 LaTeX package and copy/paste the generated LaTeX code to embed the interactive 3D graphic in a PDF.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Embed 3D graphics in pdf from Matlab

Embedding 3D graphics in pdf from


Matlab
able to view and navigate 3D plots/graphics
enhance your documents/presentations
Embed 3D graphics in pdf from Matlab

Figure: Some surface plots.


Embed 3D graphics in pdf from Matlab

(sdtest9wend2R50.u3d) (eudiswend2R50.u3d)
Embed 3D graphics in pdf from Matlab

Universal 3D(U3D)

compressed file format standard for 3D computer graphics


data
file name extension filename.u3d
supported by the pdf format
interactively visualized by Acrobat Reader (since version 7)
Embed 3D graphics in pdf from Matlab

Matlab Figures U3D file format LATEX code

What we need:
u3d pre and mesh2pdf packages for Matlab from
Mathworks;1 2

movie15 package for LATEX from any ctan site;3

1
http://www.mathworks.com/matlabcentral/fileexchange/
25383-matlab-mesh-to-pdf-with-3d-interactive-object
2
http://www.mathworks.com/matlabcentral/fileexchange/
27245-generate-vertices-faces-and-color-for-u3d-format
3
http:
//www.ctan.org/tex-archive/help/Catalogue/entries/movie15.html
which provide interface to embed movies, sounds and 3D objects into PDF.
Embed 3D graphics in pdf from Matlab

Generate 3D graphics in Matlab in a normal figure window


>>[X,Y,Z]=peaks(30);
>>surf(X,Y,0.3*Z);
Create a structure of faces and vertices of the 3D surface
>>fvc=u3d pre;
Generate the graphics information
>>mesh to latex(filename,fvc.vertices, ...
uint32(fvc.faces),fvc.facevertexcdata);
filename.u3d - a u3d file
filename.tex - an example of LATEX code
Embed 3D graphics in pdf from Matlab

Example of filename.tex:
\ begin { center }
\ i n c l u d e m o v i e [ p o s t e r , t o o l b a r , l a b e l=f i l e n a m e . u3d ,
t e x t =( f i l e n a m e . u3d ) , 3 Daac =7 , 3 D r o l l =0,
3 Dc2c =0.000000 1 . 0 0 0 0 0 0 0 . 0 0 0 0 0 0 , 3 Droo =8 6.60254 0 ,
3Dcoo=0 0 0 , 3 D l i g h t s=CAD, ] { \ l i n e w i d t h }
{\ l i n e w i d t h }{ f i l e n a m e . u3d }
\ end { c e n t e r }

Copy the code from filename.tex and paste into your LATEX
document where you want the 3D graphic.
Remember to add into the preamble \usepackage[3d]{movie15}
Embed 3D graphics in pdf from Matlab

(peaksurf.u3d)

0
Z

2
0 2
0
X 2 2
Y

Figure: Drag your mouse over the graphic.


Embed 3D graphics in pdf from Matlab

(try4.u3d)

0
Z

2
0 2
0
X 2 2
Y

Figure: Drag your mouse over the graphic.


Embed 3D graphics in pdf from Matlab

Nothing is perfect... always!

Weakness of the current mesh2pdf and u3d pre packages:


Only works for surf,mesh,isosurface figures in Matlab,
not for scatter3 figure
can we label it? adding text? (axis?)

You might also like