Matlab 3D figure to 3D (X)HTML

Converts 3D objects of a Matlab figure to XHTML embedded X3D file. Interactive 3D website graphics.
4K Descargas
Actualizado 17 ago 2011

Ver licencia

Nota del editor: This file was selected as MATLAB Central Pick of the Week

This function FIGURE2XHTML converts the 3D objects of a Matlab figure to an in XHTML embedded X3D file. In a modern browser, you can then view your figure interactively because of the great X3DOM Library (Instant 3D the HTML way! http://www.x3dom.org/).

Currently the function supports: Axes, Patch, Line, Surface, Text, Images and Light Objects.

Note: Even volume rendering in your browser is possible, by using: http://www.mathworks.com/matlabcentral/fileexchange/19155-volume-render

Browsers supported:
- Google Chrome 9.x and above
- Firefox 4.x and above
- Webkit nightly builds
- Flash11 needed for Internet explorer (or InstantReality-plugin)


figure2xhtml(filename,handle,options)

Note : All input arguments are optional, and sorting doesn't matter
thus figure2xhtml(); is valid but also figure2xhtml(options,handle);

inputs,
filename : Name of the XHTML file (also an X3D file is created).
When empty or not known a File-Dialog is shown
handle : Figure handle or axis handle
When empty or not known the current axis (GCA) is used
options : A struct with options
options.output : Produce output files 'x3d', 'xhtml' or 'both' (default)
options.width : Width of X3D render object in pixels default 500
options.height : Height of X3D render object in pixels default 500
options.headlight : Enable Camera head light, boolean true/false
(default true)
options.title : Title of xhtml page, default 'Matlab X3D'
options.interactive : Make mesh/surface objects clickable in xhtml,
boolean true/false (default false)



Example,
load('functions\exampledata');
figure, hold on; axis equal;
patch(FV,'facecolor',[1 0 0],'facealpha',0.5);
FV.vertices(:,1)=FV.vertices(:,1)+80;
patch(FV,'FaceColor','interp','FaceVertexCData',rand(size(FV.vertices)),'edgecolor','none');
FV.vertices(:,1)=FV.vertices(:,1)+80;
patch(FV,'FaceColor','flat','FaceVertexCData',rand(size(FV.faces)),'edgecolor','none');
figure2xhtml('test/example1')

Citar como

Dirk-Jan Kroon (2024). Matlab 3D figure to 3D (X)HTML (https://www.mathworks.com/matlabcentral/fileexchange/32207-matlab-3d-figure-to-3d-x-html), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2011a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Agradecimientos

Inspiración para: Export figure to 3D interactive PDF

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.9.0.0

Improved Internet Explorer support

1.8.0.0

Added options

1.7.0.0

added alphamap support

1.6.0.0

Added images support.
Added reverse axis support.

1.5.0.0

Added Line-Marker support

1.4.0.0

Font-size adjustment

1.2.0.0

added text support, and example with axis in xhtml.

1.1.0.0

- Added Surface Texture Support
- Fixed NaN bug in vertex-normals

1.0.0.0