| Description |
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') |