Get from Ico-github-logo

Highlights from
Export figure to 3D interactive PDF

  • [strmodelshading, strface...
  • check_file_extension(fnam...
    See also CLEAR_FILE_EXTENSION, ISFILEXTENSION.
  • clear_file_extension(fnam...
    See also CHECK_FILE_EXTENSION, ISFILEXTENSION.
  • create_marker_lines(h, ty...
  • cut_line_to_pieces(x, npe...
  • doc_examples
  • draw_crystal_lattice
  • examples
  • fig2idtf(filename,...
    FIG2IDTF Save figure in IDTF format.
  • fig2latex(ax, fname, medi...
    FIG2LATEX Convert axes to U3D file, generating LaTeX code including it.
  • fig2pdf3d(ax, filename, m...
    FIG2PDF3D Convert axes to PDF with embedded interactive 3D image.
  • fig2u3d(ax, fname, imgtyp...
    FIG2U3D Convert figure to U3D file.
  • get_line_xyz(h)
  • get_quiver_data
  • heart3d
  • idtf2u3d(idtffile, u3dfile)
    IDTF2U3D Convert IDTF to U3D file.
  • idtf_model_nodes(n_meshes...
  • isfilextension(fname, ext...
    See also CHECK_FILE_EXTENSION, CLEAR_FILE_EXTENSION.
  • latex2pdf3d(fname, latex_...
    LATEX2PDF3D Compile LaTeX code to PDF.
  • line_pieces(vertices_all,...
    % See also u3d_pre_line, u3d_pre_contourgroup.
  • mesh_normals(points,faces)
    MESH_NORMALS compute mesh normals
  • populate_line_resource_st...
    % See also FACE_VERTEX_DATA_EQUALS_NPOINTS, VERBATIM.
  • populate_mesh_resource_st...
    % See also FACE_VERTEX_DATA_EQUALS_NPOINTS, MESH_NORMALS, VERBATIM.
  • populate_point_resource_s...
  • shaders_materials_modifie...
    File: shaders_materials_modifiers.m
  • single_mesh_resource_str(...
    % See also u3d_pre_patch.
  • test_hexagram_shape
  • u3d_in_latex(fname, media...
    U3D_IN_LATEX LaTeX code which includes a U3D file.
  • u3d_pre_contourgroup(ax)
    U3D_PRE_CONTOURGROUP Preprocess contour output to u3d.
  • u3d_pre_line(ax)
    U3D_PRE_LINE Preprocess line output to u3d.
  • u3d_pre_patch(ax)
    U3D_PRE_PATCH Preprocess surface output to u3d.
  • u3d_pre_quivergroup(ax)
    U3D_PRE_QUIVERGROUP Preprocess quiver output to u3d.
  • u3d_pre_surface(ax)
    U3D_PRE_SURFACE Preprocess surface output to u3d.
  • verbatim
    VERBATIM Get the text that appears in the next comment block.
  • view2vws(ax, filename, pa...
    VIE2VWS Saves current view in a views file for LaTeX media9 package.
  • test_fig2u3d_contour_surf.m
    function [] = test_fig2u3d_contour_surf
  • test_spiral.m
    function [] = test_fig2u3d_spiral
  • View all files
image thumbnail

Export figure to 3D interactive PDF

by

 

27 Jul 2012 (Updated )

Export figure as U3D file or directly to 3D interactive graphics within PDF.

u3d_in_latex(fname, media9_or_movie15)
function [] = u3d_in_latex(fname, media9_or_movie15)
%U3D_IN_LATEX   LaTeX code which includes a U3D file.
%
% usage
%   U3D_IN_LATEX(fname, media9_or_movie15)
%
% input
%   fname = LaTeX file name (a '_small.tex' will be appended)
%   media9_or_movie15 = LaTeX package to use for including the 3D file
%
% output
%   Saves a LaTeX file including the U3D file
%
% File:      u3d_in_latex.m
% Author:    Ioannis Filippidis, jfilippidis@gmail.com
% Date:      2012.06.21
% Language:  MATLAB R2012a
% Purpose:   produce LaTeX code including a U3D file
%
% acknowledgment
%   Based on write_latex by Alexandre Gramfort.
%   This can be found on the MATLAb Central File Exchange:
%       http://www.mathworks.com/matlabcentral/fileexchange/25383-matlab-mesh-to-pdf-with-3d-interactive-object
%   and is covered by the BSD License.

fname = clear_file_extension(fname, '.tex');
texfile = [fname, '_small.tex'];
disp(['Writing: ', texfile] );

%[~, u3dfname] = fileparts(fname);
if strcmp(media9_or_movie15, 'media9')
    content = latex_include_using_media9;
elseif strcmp(media9_or_movie15, 'movie15')
    content = latex_include_using_movie15;
else
    error('media9 or movie15 are the only available choices.')
end

fid = fopen(texfile, 'w');
    fprintf(fid, content, fname, fname, fname);
fclose(fid);

%fprintf(fid, content, fname, fname, ceil(va),...
%        up(1), up(2), up(3), ro, fname);

function [str] = latex_include_using_media9
% VWS file name (w/o extension) = string,
% 2D substitute image file name (w/o extension) = string,
% U3D file name (w/o extension) = string
str = verbatim;
%{
\\includemedia[%%
width=\\linewidth,%%
height=\\linewidth,%%
activate=pagevisible,%%
deactivate=pageinvisible,%%
3Dviews=%s.vws,%%
3Dtoolbar]{%%
    \\includegraphics[width=\\linewidth]{%s.png}%%
}{%s.u3d}%%
%}

function [str] = latex_include_using_movie15
% u3dfile = string,
% u3dfile = string,
% u3dfile = string
str = verbatim;
%{
\\includemovie[%%
poster=%s.png,%%
3Dviews2=%s.vws,%%
autoplay,%%
toolbar]{\\linewidth}{\\linewidth}{%s.u3d}
%}

Contact us