On Wed, Mar 28, 2012 at 5:18 PM, Martin Helm <mar...@mhelm.de> wrote: > Dear all, > > I'ld like to propose two new functions (maybe for the plot package) and > would be happy to get some feedback: > > Rationale: A few years ago I code the iso* functions for octave > including isosurface which is fine for plotting discrete data. A few > days ago a user contacted me on plotting implicit functions and while > the standard isosurface function can do that it has some drawbacks if > you don't want to use high resolutions and only a coarse grid. Due to > the inherent linear approximation done by the algorithm the intersection > points with the grid which are calculated are sometimes a poor > approximation. > So I made a very first draft for a somewhat improved function "implicit" > (the name is modeled after the equivalent Maxima function) which > calculates the intersection points with higher precision and also the > gradient vectors based on the function instead from the grid values. > This version is of course very slow and I am not sure if I can find ways > to speed it significantly up, but nonetheless I think it fills a gap. > > The second function is just a helper to get a somewhat simulated > lighting feature as long as no possibility exists in octave to set > lights for shading. > > Attached are the functions and a the output from the following test script > > f = @(x,y,z) x.^2 + y.^2 + z.^2; > [T P] = implicit(f, 3, -2:2, -2:2, -2:2); > trimesh (T, P(:,1), P(:,2), P(:,3)); > hold on > plot3(zeros(200,1),sqrt(3)*exp(-1i*linspace(0,2*pi,200)), "r-") > view(90,0) > axis equal > title "Implicit" > print sphere_exact.png > clf > [xx yy zz] = meshgrid(-2:2, -2:2, -2:2); > v = f(xx,yy,zz); > [T P] = isosurface(xx, yy, zz, v, 3); > trimesh (T, P(:,1), P(:,2), P(:,3)); > hold on > plot3(zeros(200,1),sqrt(3)*exp(-1i*linspace(0,2*pi,200)), "r-") > view(90,0) > axis equal > title "Isosurface" > print sphere_isosurface.png > > to show the difference in precision of the approximation. > > Both functions have also a demo (which use the fltk backend by default, > you can remove that - it also works with gnuplot but incredibly slow of > course). > > ------------------------------------------------------------------------------ > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Octave-dev mailing list > Octave-dev@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/octave-dev >
Martin, Such that your functions do not get forgotten. Would you like to upload them here http://sourceforge.net/tracker/?group_id=2888&atid=352888 Thanks -- M. Sc. Juan Pablo Carbajal ----- PhD Student University of Zürich http://ailab.ifi.uzh.ch/carbajal/ ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev