5.0

5.0 | 2 ratings Rate this file 13 Downloads (last 30 days) File Size: 587 KB File ID: #29591
image thumbnail

Create 3D-interactive HTML File from MATLAB surface, Part2

by

 

01 Dec 2010 (Updated )

This function allows to show 3d-surface plots in html - documents.

| Watch this File

File Information
Description

Syntax:
   javaview_nosym(surface_handle, filename, destination, source, open_html)

Description:
   This function generates output files for Javaview (www.javaview.de).
   It allows to display and interact with 3d-Graph not only in the
   javaview engine, but also in html-Documents. See javaview
   documentation for more information about how to interact.

   This function depends of the installed toolboxes. If the Symbolic Math Tooolbox (SMT) is installed, the html is
   exported half automatically/ half manually. If the SMT is not installed the function will open the
   generated stl file in JavaView and you must modify the result manually (see without_mupad.pdf for further
   information) and export it to html. Don't forget to have your jars-directory in the html-file.

   With SMT there are 4 output files:
       a) first file (.stl)is generated by the surf2stl function (Many
          thanks to Bill McDonald, this function is availabe at the MCFE
          and was pick of the week on June 5th, 2009)
       b) the second and third file (jvx) and (jvd) are input files for
          javaview and are generated by mupad (or javaview). The jvx-file describes the
          3d-graph, the jvd file descrribes scene options
       c) the last file is an html file, were the 3d-Graph is displayed

  Because the applet in html file need the javaruntime for javaview the
  jars directory from the "source" (input parameter) directory is copied
  to the destination folder.
  open_html is true or false. When it is true your standard webbrowser is
  opened and you will see the surface in the html file.

  Parameter:
      1. surface_handle - handle to surface graph
      2. filename - filename for *.stl, .jvx, *.jvd, *.html
      3. destination - folder where all files are saved
      4. source - source folder of jars (see jvaview installation path)
      5. open_html - shows the result html in your standard webbrowser

 Sorry for the work around with the handmade copy and paste when to
 generate the javaview files with SMT. But evalin(symengine, ...) does not produce
 the required files.

Online Example:
      http://wwwpub.zih.tu-dresden.de/~s9034647/peaksurface.html
      http://wwwpub.zih.tu-dresden.de/~s9034647/test.html
http://wwwpub.zih.tu-dresden.de/~s9034647/Beethoven.html
http://wwwpub.zih.tu-dresden.de/~s9034647/Garko50k.html

Example:
        su=2*pi/150;
        sv=2*pi/20;
        [u,v]=meshgrid(0:su:(2*pi),0:sv:(2*pi));
        r1=2;
        r2=0.4;
        r3=0.3;
        p1=2;
        p2=3;
        x=r1*cos(u*p1) + r2*cos(u*p1).*cos(u*p2) +r3*cos(u*p1).*sin(v);
        y=r1*sin(u*p1) + r2*sin(u*p1).*cos(u*p2) +r3*sin(u*p1).*sin(v);
        z=r2*sin(u*p2)+r3*cos(v);
        h=surf(x,y,z);
        javaview_nosym(h, 'test', 'C:\Users\sk\Desktop\3d-PDF\jvtest', 'C:\Program Files (x86)\JavaView\jars', 1);
      

The Code was created under Matlab 2010a, but it also works without Symbolic Math Toolbox from version Matlab 7.0.4 (R14, SP2)
 

Bugs and suggestions:
   Please send to Sven Koerner: koerner(underline)sven(add)gmx.de

You need to download and install first:
   www.javaview.de
   http://blogs.mathworks.com/pick/2009/06/5/writing-to-stl-files/
   (Symbolic Math Toolbox with MuPad)

License to use and modify this code is granted freely to all interested, as long as the original author is
referenced and attributed as such. The original author maintains the right to be solely associated with this work.

Programmed by Sven Koerner: koerner(underline)sven(add)gmx.de

MATLAB release MATLAB 7.10 (R2010a)
Other requirements Symbolic Math Toolbox (not necessary) www.javaview.de http://blogs.mathworks.com/pick/2009/06/5/writing-to-stl-files/
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (8)
11 May 2011 Sven Koerner

Hi Jillian,
I had a look in the javaview help but couldn't find any property for a logarithmic scaling. I also tried to export an graph with logarithmic scale from mupad, but there is the same result - only linear axes.

10 May 2011 Jillian

Sven,
This is great - exactly what I need! Thanks for your contribution.

The one problem I have is that it changes my logarithmic axis into a linear scaling. Do you know if there's any way around this? The x-axis is set in my matlab script using set(gca, 'XScale', 'log') (and the resulting matlab plots are correct), but the html gives me all linear axes.

Thanks!

05 Jan 2011 Sven Koerner

Erik, have a look:
http://wwwpub.zih.tu-dresden.de/~s9034647/without_mupad.pdf

05 Jan 2011 Sven Koerner

Dear Erik,
cool that it work with older Matlab-Versions. And you're right: I forgot to upload the "without_mupad.pdf". I'll upload it in a minute, so it is online hopefully tomorrow.

05 Jan 2011 Erik Benkler

Dear Sven,
I confirmed this to work with Matlab R14 SP2 (without SMT of course). You wrote something about more details on manual editing of the HTML file exported by javaview in the file "without_mupad.pdf", but I cannot find this file (forgot to upload?).

Thanks for sharing this!

21 Dec 2010 Luigi Giaccari

This is Awesome!

03 Dec 2010 Sven Koerner

Hi Jan, a colleague tested the examples also in Firefox and it works. Maybe you must check your add-on configuration. Maybe you can try it with an alternative browser?

02 Dec 2010 Jan Simon

Looks like a marvelous idea. Unfortunately I can see just a text line in my Firefox browser, if I click on the two online examples: "Applet shows test.jvx (right click on graph to select option, or press "h" to select a point)." Nothing else. Does my browser require to display the examples?

Updates
21 Dec 2010

Added online examples based on surface reconstruction code of Luigi Giaccari: http://www.mathworks.fr/matlabcentral/fileexchange/22185surface-reconstruction-from-scattered-points-cloud-part1
 

05 Jan 2011

upload without_mupad.pdf

16 Feb 2011

Hint in description that Matlab Version R14, SP2 also works with the code.

Contact us