[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line thickness & Z-buffer



Simon Hall (shall@atm.ch.cam.ac.uk) writes:

> I draw some lines of thickness 2 (using plot) directly to a window and
> all is well, I get lines of thickness 2. However, I need to produce some
> 3000+ images for an animated sequence and rather than plot to a window
> I'm plotting to the z-buffer, reading that image with tvrd(), and
> writing a gif image. When I do so I get a bunch of lines of varying
> thicknesses. Horizontal and vertial lines seem fine, diagonal ones are
> noticably thinner. 
> 
> Can someone tell me how to get lines of uniform thickness (without
> plotting each segment separately) in a z-buffer-generated image???
> 
> Using IDL 5.2 on NT4. I can provide an example.

There has always been something weird about the Z-buffer.
For example, it uses a different character size than normal,
so plot margins are slightly different, etc. I don't know
if there is something inherent in the resolution of the
device, or what, but I think this is a manifestation of
the same underlying problem.

In fooling around with this, though, I noticed that a
thickness of 2 is just about the *worst* thickness you
can use! Here is the code I used to play around. I found
a thickness of 2.75 gave reasonable results. You may
have to find something you can live with.

An alternative, possibly, would be to draw this 
into a pixmap rather than into the Z-buffer.

Cheers,

David

PRO test
thickness = 2.75
window, xs=400, ys=400
data = loaddata(1)
plot, data, /nodata
Oplot, data, thick=thickness
Oplot, [0,101],[0,20], thick=thickness
plots, [0,100], [10,10], thick=thickness
thisDevice = !D.Name
set_plot, 'z'
device, set_resolution=[400,400]
plot, data, /nodata
Oplot, data, thick=thickness
Oplot, [0,101],[0,20], thick=thickness
plots, [0,100], [10,10], thick=thickness
snap = tvrd()
set_plot, thisDevice
window, 1, xs=400, ys=400
tv, snap
END

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155