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

Home » Public Forums » archive » FG question: retrieve points within polygon
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
FG question: retrieve points within polygon [message #89797] Thu, 04 December 2014 01:50 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
I'm looking for an easier way to get the indices inside a polygon or ellipse created in function graphics.
So here is a basic example that states what I want to do:

;first generate the graphics
img = dist(600)
w = window(dimensions=[500,500])
im = image(img, current=w)
pl = polygon([0.25,0.75,0.75,0.25],[0.25,0.25,0.75,0.75],/norm,ta rget=im)
;make some changes to the polygon
pl.rotate, 12

;now extract the mean value of the points of the image that are inside the polygon

pl->getData, xx, yy
o = obj_new('idlanroi', xx*600d, yy*600d, /double, type=2)
mask = o->ComputeMask(dimensions=[600,600])
obj_destroy, o
pts = where(mask, cnt)
meanVal = mean(img[pts])
print, 'the mean value inside the polygon is ', meanVal



So this method works fine. It's maybe not the most obvious, but works. Now the question is... How do I get the same result for an ellipse?
Of course I could calculate the perimeter points of the ellipse and use the same method as above, but that would not really be... well ... cool.

Any better way to do this? I couldn't find any FG method to get such info.

Thanks,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dot miscentered in \sun symbol of cgsymbol?
Next Topic: Re: FG question: retrieve points within polygon

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

Current Time: Wed Oct 08 15:57:16 PDT 2025

Total time taken to generate the page: 0.00380 seconds