comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » making a checkerboard array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
making a checkerboard array? [message #55935] Tue, 25 September 2007 09:27 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
I'm trying to make a checkerboard mask for an array, but I'm missing
something that is likely to be obvious to the IDL array masters. The
following code makes a pattern like this (use a fixed width font):

+++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++

Can anyone help me fill in the missing rectangles like this?

+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
+++++00000+++++00000+++++00000
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++
00000+++++00000+++++00000+++++


Nx=300
Ny=200
Nrects = 10
Xside = Nx/Nrects
Yside = Ny/Nrects
xs = [replicate(1,Xside), replicate(0,Xside)]
while n_elements(xs) lt Nx do xs = [xs, [replicate(1,Xside),
replicate(0,Xside)]]
xs = xs[0:Nx-1]
ys = [replicate(1,Yside), replicate(0,Yside)]
while n_elements(ys) lt Ny do ys = [ys, [replicate(1,Yside),
replicate(0,Yside)]]
ys = ys[0:Ny-1]
window, xsize=Nx, ysize=Ny
tvscl, xs # ys
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Parsing C -> Generating DLL/DLM
Next Topic: selection box in widget program

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:35:57 PDT 2025

Total time taken to generate the page: 0.00494 seconds