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

Home » Public Forums » archive » Re: Polygon filling oddities
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: Polygon filling oddities [message #27070 is a reply to message #26936] Thu, 04 October 2001 14:40 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
From: "David Fanning" <david@dfanning.com>
> Mark Hadfield (m.hadfield@niwa.cri.nz) writes:
>
>> I guess POLYFILLV and IDLanROI are intended for dealing with regions of
>> interest on images and it is anticipated that the vertices of the ROI
will
>> be in the positive quarter-plane. But I don't see any reason why they
>> shouldn't be able to work with negative vertex coordinates.
>>
>> So is what I've found a bug or a feature? Can others reproduce my
results?
>> (I've been using IDL 5.4.)
>
> I can reproduce your results. But I can also
> get the PolyFillV code to work by making this
> change:
>
> p = polyfillv(0 > x < (!D.X_Size-1), 0 > y < (!D.Y_Size-1), 500, 500)

Two comments/questions:

1. Do you think you need !D.X_Size and !D.Y_Size in there? What has the
current graphics device got to do with it? (Not arguing just curious.)

2. Clipping x and y before calculating the filled polygon generally won't
give the same answer as clipping the polygon, at least not when the vertex
spacing is large. Eg think of replacing the circle in my example with a
triangle.

BTW I thought of another method using IDLanROI:ContainsPoints instead of
IDLanROI:ComputeMask...

4: begin
roi = obj_new('IDLanROI', x, y)
xx = rebin(findgen(500),500,500)
yy = rebin(findgen(1,500),500,500)
inside = roi->ContainsPoints(xx[*],yy[*])
obj_destroy, roi
image = bytarr(500,500)
image[where(inside)] = 255B
tv, image
end

It gives the correct results (i.e. the circle doesn't vanish abruptly) but
the CPU time increases by a factor of ~ 500 (from 0.12 to 6 seconds on my
machine).

I will raise this with RSI. I'm sure they'll call back all the IDL 5.5
CD-ROMs :-)

---
Mark Hadfield
m.hadfield@niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research




--
Posted from clam.niwa.cri.nz [202.36.29.1]
via Mailgate.ORG Server - http://www.Mailgate.ORG
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: findfile on unix bug - help
Next Topic: Can you drag and drop a Windows file into a Draw Widget?

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

Current Time: Sat Oct 11 04:45:27 PDT 2025

Total time taken to generate the page: 1.19654 seconds