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

Home » Public Forums » archive » Re: chunk indexing like
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: chunk indexing like [message #69301 is a reply to message #69300] Sun, 10 January 2010 08:05 Go to previous messageGo to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Sun, 10 Jan 2010 08:07:00 -0700, David Fanning <news@dfanning.com>
wrote:

> But the
> question, as far as I know, has never been presented
> with its context.

Ok, you asked for it :-).

Suppose you have two lines crossing a NxN grid.
t=lindgen(N+1)-0.5 ; the grid
y1=m1*t+b1 ; line 1
y2=m2*t+b2 ; line 2

Now you want to calculate the area of each pixel of the NxN grid that
is covered by the area between the two lines. This is illustrated in
(lines don't have to be parallel) http://xrdua.ua.ac.be/public/tmp.jpg

To do this I first take all intersections between the two lines and
the hor. and vert. gridlines:

x=[t,(t-b1)/m1,t,(t-b2)/m2]
y=[y1,t,y2,t]

Then I add grid nodes that are in between the two lines

y1=round(y1)
y2=round(y2)
nadd=y2-y1
if total(nadd) ne 0 then begin
xadd=chunkindex(nadd)
yadd=chunklindgen(nadd) ; THIS WAS MY QUESTION
x=[x,xadd-0.5]
y=[y,y1[xadd]+yadd+0.5]
endif

Then I use TRIANGULATE to make triangles. Each triangle lies within 1
pixel so calculating the area and the center of the triangles will
solve my original problem (an additional drizzling is used because 1
pixel will be the sum of several triangles). Some triangles have to be
rejected too.

So the "chunked lindgen" (my question) is used to calculate y
coordinates of grid nodes between the two lines. For each x there are
zero or more grid nodes, hence the need for some "chunked lindgen".
[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
Previous Topic: Greek Symbols in Plot Annotations
Next Topic: isurface with custom palette

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

Current Time: Fri Oct 10 15:19:35 PDT 2025

Total time taken to generate the page: 1.04195 seconds