Rasterize an image [message #52318] |
Fri, 26 January 2007 13:39 |
Dave[3]
Messages: 12 Registered: November 2006
|
Junior Member |
|
|
Hi all,
I suspect this is trivial (an IDL 2-liner) and I'm struggling on a
Friday... I am trying to model what an image from a known object will
look like using a low-res CCD detector. I can define the shape of the
object being imaged in a simple equation and I know its radiant
flux/color as a function of the radius. The trivial example below
draws a circle and an ellipse using vectors. What I would like to know
is what these would look like if I used a 256x256 array to image them.
All tips, hints and examples greatly appreciated!
Have a great weekend,
Dave
Example:
np = 101
grd = 2*findgen(np)/(np-1) - 1.0
; circle
o = [-1.0, -4.0] ; offset
r = 10.0 ; radius
xc = r * grd
yc = sqrt(r^2 - xc^2)
xc_im = [xc[0:np-1],reverse( xc[0:np-1])] + o[0] ; make the half
circle whole
yc_im = [yc[0:np-1],reverse(-1*yc[0:np-1])] + o[1]
; elipse
o = [2.0, 3.0] ; offset
a = 11.0 ; x semi-axis
b = 8.0 ; y semi-axis
xe = a * grd
ye = b/a * sqrt(a^2 - xe^2)
xe_im = [xe[0:np-1],reverse( xe[0:np-1])] + o[0] ; make the half
elipse whole
ye_im = [ye[0:np-1],reverse(-1*ye[0:np-1])] + o[1]
window, 0, xsize=600, ysize=600
plot, xc_im, yc_im, xrange=[-15,15], yrange=[-15,15], /xstyle, /ystyle
oplot, xe_im, ye_im
end
|
|
|