[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basic implementation for isosurface, isocolors, isonormals
From: |
Martin Helm |
Subject: |
Re: basic implementation for isosurface, isocolors, isonormals |
Date: |
Mon, 9 Mar 2009 17:34:29 +0100 |
User-agent: |
KMail/1.10.3 (Linux/2.6.27.19-3.2-default; KDE/4.1.3; x86_64; ; ) |
> On Mar 9, 2009, at 11:24 PM, Martin Helm wrote:
> > Dear Octave maintainers,
> >
> > recently I made some preliminary implementation for isocolors,
> > isonormals,
> > isosurface for my own use which I would like to share (isocaps will
> > follow in
> > the near future). My first intention was to make a package at octave-
> > forge. As
> > it turned out in the discussion at the OF mailing list that this
> > functions
> > should go into octave itself because these are base matlab
> > functions, I start
> > this thread to continue the discussion which can be found at
> >
> > http://sourceforge.net/mailarchive/forum.php?thread_name=200903051754.354
> >46.martin%40mhelm.de&forum_name=octave- dev
> >
> > My functions can be found at
> > http://www.mhelm.de/octave/pkg/visualize3d-0.1.5.tar.gz
> > and some examples
> > http://www.mhelm.de/octave/index.html
> >
> > I try to summarize the previous discussion:
> >
> > The iso* functions need a graphics backend which is able to
> > visualize filled
> > 3d patches (at least triangle patches) if you want to visualize the
> > results in
> > a matlab compatible way.
> >
> > This is at the moment possible with the fltk backend and also with the
> > jhandles package but not with the gnuplot backend.
> >
> > As discussed in the mailig list mentioned above there might be a
> > chance to
> > make filled 3d patches possible also with gnuplot for at least
> > triangle 3d
> > patches (using pm3d), but it is not completely sure at the moment if
> > this will
> > work or how fast it can be done.
> >
> > So I would be glad to receive some thoughts from you if you see this
> > functions
> > as octave core functions (with the limitation in mind that they
> > cannot be used
> > with gnuplot in the worst case) or as an addon which belongs to
> > octave-forge.
> >
> > I would also like to restart the discussion about the possibility to
> > introduce
> > (a subset of) filled 3d patches with gnuplot backend here.
> >
> > Regards
> > Martin Helm
>
> Martin,
>
> I'm interested in understanding what needs to be improved in the
> gnuplot backend to support this functionality.
>
> Are 3D patches all that is needed? ... my ignorance might be showing,
> but is there any reason gnuplot's splot can't do the job?
>
> Ben
Hi Ben,
in principle gnuplot can do it. But I cannot oversee how it fits into the
octave drawing functions at the moment (I need to look into the code later, I
have no access to octave now).
The difference between 2d and 3d patches with gnuplot is that it is not
possible to use the same syntax (2d uses a filled curve style which does not
exist for 3d).
The very trivial example below shows that gnuplot renders a triangle mesh from
the isosurface function with a special syntax for the data file without
problems, but for sure more details have to be taken into account like
EdgeColor (I did not try this at the moment) and FaceVertexCData.
N=30;
x = linspace(0, 4, N);
y = linspace(0, 4, N);
z = linspace(0, 4, N);
[ xx, yy, zz ] = meshgrid(x, y, z);
data = 1./((xx-2).^2 + (yy-2).^2 + (zz-2).^2) + ...
2./((xx-1).^2 + (yy-1).^2 + (zz-1).^2);
[T, p, c] = isosurface(xx,yy,zz,data,3, zz);
## workaround for visualization with gnuplot
tmp = tmpnam();
[fid, msg] = fopen(tmp, "w");
if ( fid == -1 )
error("Could not create temporary data file\n%s", msg);
endif
for ii = 1:size(T, 1)
fprintf(fid, "%f %f %f %f\n", p(T(ii,1), 1), p(T(ii,1), 2), p(T(ii,1), 3),
c(T(ii,1)));
fprintf(fid, "%f %f %f %f\n\n", p(T(ii,2), 1), p(T(ii,2), 2), p(T(ii,2), 3),
c(T(ii,2)));
fprintf(fid, "%f %f %f %f\n", p(T(ii,3), 1), p(T(ii,3), 2), p(T(ii,3), 3),
c(T(ii,3)));
fprintf(fid, "%f %f %f %f\n\n\n", p(T(ii,3), 1), p(T(ii,3), 2), p(T(ii,3),
3), c(T(ii,3)));
endfor
fclose(fid);
cmd = sprintf("gnuplot -p -e \"set pm3d;set style data pm3d;set pm3d
depthorder;splot '%s' using 1:2:3:4\"", tmp);
system(cmd, 0, "async");
- basic implementation for isosurface, isocolors, isonormals, Martin Helm, 2009/03/09
- Re: basic implementation for isosurface, isocolors, isonormals, Ben Abbott, 2009/03/09
- Re: basic implementation for isosurface, isocolors, isonormals,
Martin Helm <=
- Re: basic implementation for isosurface, isocolors, isonormals, dbateman, 2009/03/09
- Re: basic implementation for isosurface, isocolors, isonormals, dbateman, 2009/03/09
- Re: basic implementation for isosurface, isocolors, isonormals, Martin Helm, 2009/03/14
- Re: basic implementation for isosurface, isocolors, isonormals, Martin Helm, 2009/03/14
- Re: basic implementation for isosurface, isocolors, isonormals, David Bateman, 2009/03/20