Menu

#328 Using "samples" for isoline sampling in hidden3d

closed-rejected
nobody
None
5
2012-06-02
2012-05-02
Douglas
No

Currently, gnuplot does not permit the "set samples" parameter to determine the sampling of splot isolines when hidden3d is implemented. This strikes me as a limitation that could be overcome with some attention. It's quite alarming to apply "set hidden3d" and have a gorgeously rendered splot turn jagged. And it's disappointing to not be able to use the gorgeous higher sampling with the hidden3d option; I hate having to choose when I really want both! I'll be happy to tackle this will a little bit of help.

For example, the jaggedness in these plots (http://www.gnuplot.info/demo/hidden.html) could be alleviated if "set samples 100" affected them like they do when hidden3d is not set.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2012-05-02

    Do you mean "set isosamples"?

     
  • Douglas

    Douglas - 2012-05-02

    The problem is that if you set isosamples to a large value, you have too many plotted lines and the graph is indiscernible. What we want is something like

    set hidden3d
    set samples 100
    set isosamples 10
    splot exp(x**2/2.0) w l

    to behave the same as if we hadn't set hidden3d. Right now, setting hidden3d samples with the same resolution as isosamples and results in a jagged plot. If isosamples is increased, the plot is smoother, but becomes unreadable.

     
  • Douglas

    Douglas - 2012-05-02

    Whoops, the splot function was meant to be splot exp(-(x**2+y**2)/2.0) w l

     
  • Ethan Merritt

    Ethan Merritt - 2012-05-02

    Okay, then "set isosamples 100,10".

     
  • Ethan Merritt

    Ethan Merritt - 2012-05-02

    Sorry, I don't understand what you're looking for. What's wrong with setting isosamples to the resolution you want? Yes, it draws a lot of lines. That's what you asked for. If you ask for a coarser sampling then you get a coarser sampling. Try setting the linewidth to 0.1 or less.

     
  • Douglas

    Douglas - 2012-05-02

    But that's the point. Without hidden3d, for instance, you plot

    unset hidden3d
    set samples 100, 100
    set isosamples 10, 10
    splot exp(-(x**2+y**2)/2.0) w l

    This looks fine. We have 10 lines in each direction but the sampling resolution is high so they curve appropriately.

    On the other hand

    set hidden3d
    set samples 100, 100
    set isosamples 10, 10
    splot exp(-(x**2+y**2)/2.0) w l

    produces jagged lines and

    set hidden3d
    set samples 100, 100
    set isosamples 100, 100
    splot exp(-(x**2+y**2)/2.0) w l

    draws too many lines. What I'm looking for are the curvy lines of the first script but with hidden3d working correctly. There must be a way to make that happen.

     
  • Ethan Merritt

    Ethan Merritt - 2012-05-03

    My Mileage Varies

    I think this looks great:
    set hidden3d
    set isosamples 100,100
    splot exp(-(x**2+y**2)/2.0) w l lw 0.1

    The combination of "smooth lines but far apart" is not compatible with hidden3d, which is based on rectangles rather than lines. The only way to get a smooth surface tiled with rectangles is to have really small rectangles.

     
  • Douglas

    Douglas - 2012-05-03

    That looks good, but it would be unpublishable unless you could rely on an extremely high fidelity printer at the publisher.

    I understand that the current implementation of hidden3d uses the isoline rectangles to do the job, but this seems like a limitation I could help gnuplot overcome. One solution that comes to mind: if nothing else, I would expect that isolines could be computed at the higher "set samples" resolution, but then only draw every tenth line, for instance, when "set samples" is a multiple of "set isosamples".

     
  • Douglas

    Douglas - 2012-05-04

    It's worth pointing out that the behavior I'm asking for is fairly common in other plotting packages. For instance, in Mathematica, the placement of a mesh (with proper line occlusion) is entirely separated from the interpolation of the function. See the second example: http://reference.wolfram.com/mathematica/ref/Mesh.html

     
  • Douglas

    Douglas - 2012-05-04

    Similarly, in matplotlib, the commands rstride and cstride do exactly what I'm suggesting: simply skip over isolines by a certain interval. Feel free to the try the ball example from here: http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html

    Simply set rstride=10 and cstride=10, and you'll see that you get proper sampling of the function (curved mesh lines) even though not all the lines are shown (precisely one/tenth of the isolines are shown in each direction).

     
  • Ethan Merritt

    Ethan Merritt - 2012-06-02

    The requested feature is simply not compatible with the way hidden line removal is done in gnuplot.

     
  • Ethan Merritt

    Ethan Merritt - 2012-06-02
    • status: open --> closed-rejected
     

Log in to post a comment.