On Sun, Mar 08, 2009 at 01:14:49PM -0600, Daniel J Sebald wrote: > Martin, > > Using depthorder is creative. I'd like to point out that depthorder is > only an approximation to what should be "hidden surfaces". I worked on > many aspects of gnuplot. Although gnuplot does have a hidden line > algorithm (i.e., it can break a mesh into line segments--based on > intersections of lines--and discard those segments which are hidden by a > surface), it doesn't have an algorithm that breaks surfaces into > triangles--based on intersections of surfaces--and discard hidden surfaces. > So depthorder is an approximation that quite often has patch that seems out > of place, sticking through a surface it shouldn't, etc.
Martin's solution works as his isosurface function returns triangles for the polygons. If we wanted to use the "patch" function of octave for 3D patches we'd have to handle patches with an arbitrary number of points. We could quite easily relax the constraint on 3D filled patches in Octave to instead of not permitting them, to allow only 3D filled patches with three points. That would allow Martin's code into the core of Octave. > I've always felt motivated to write a hidden surface algorithm but hadn't > found the time given how much work that would require. Even the syntax > "depthorder" would be nice to deprecate, and instead simply refer to it as > "hidden". That would be nice.. > It sounds like David Bateman has a lot of knowledge about 3D visualization. > Perhaps a long term project could be started for gnuplot, but it would be a > while before I could work on such a project. Not really, just what I picked up here and there. A 3D "filledcurve" option that was equivalent to the 2D filledcurve option with the curve to fill being the projection of the points into the plane defined by gnuplots view would make the implementation in Octave of the 3D patch function trivial. D. > > Dan > > > >## 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"); ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev