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

Home » Public Forums » archive » A distracting puzzle
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: A distracting puzzle [message #26727 is a reply to message #26698] Tue, 25 September 2001 09:54 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Stein Vidar Hagfors Haugan wrote:
>
> If what's being sought here is only to distinguish which pixels have *some*
> area inside the polygon and which do not, wouldn't it be sufficient to check
> the corners? I.e., in a continuum of pixel coordinates, given corners with
> coordinates [0,0], [1,0], [1,1], [0,1], it can be checked whether each of
> those are inside versus outside any defined polygon. If one or more of the
> corners is inside, then some area is also inside..
>
> I have included some simple-minded routines I wrote some years ago to check
> whether a point is inside or outside a polygon...

Thanks Stein Vidar. Your method would seem to provide the answer for
the boolean question; however, my intent was to provide a list of pixels
which are at least partly inside the polygon, *along with* a list of
their fractional areas included. I came up with a solution I call
polyfillaa, which is a direct replacement for polyfillv.

inds=polyfillaa(x,y,sx,sy,AREAS=a)

returns the pixel indices, along with the clipping areas if desired. It
performs a straightforward form of polygon clipping. The "aa" is for
anti-aliasing, which is basically what it does. It works quite well,
but is very slow, thanks to a surplus of looping. In general it returns
more pixels than polyfillv, which neglects pixels with small areas
inside, and (erroneously, I feel) truncates polygon points to integer
pixels.

I may document it and put it up somewhere soon, but I'm embarrassed by
all the for loops. We'll see.

JD
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Filled Contour Colors on Maps Incorrect
Next Topic: Re: OBJECT GRAHPIC BOOKS

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

Current Time: Wed Oct 08 19:12:45 PDT 2025

Total time taken to generate the page: 0.00465 seconds