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

Home » Public Forums » archive » Point within country boundary
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: Point within country boundary [message #87361 is a reply to message #87359] Tue, 28 January 2014 07:05 Go to previous messageGo to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
On 28.01.2014 14:01, Fabien wrote:
> Matt,
>
> I think you are aware that they are not doing the same thing.
> ComputeMask things "pixels", containPoints thinks "(grid) points".
>
> Cheers
>
>

Just for the record ;-), a small programm that illustrates the difference:

pro illustrate_contain_points

grid = cgScaleVector(FINDGEN(5,4),0,254)

points_X = (FINDGEN(5)+0.5) # (LONARR(4) + 1)
points_Y = (FINDGEN(4)+0.5) # (LONARR(5) + 1)

shape_x = [1.2, 3.9, 2.3, 1.2]
shape_y = [1.2, 2.3, 3.7, 1.2]
roi = IDLanROI(shape_x, shape_y)

cgLoadCT, 33 & TVLCT, 130, 130, 130, 255 & cgWindow
cgImage, grid, /KEEP_ASPECT_RATIO, /AXES, /ADDCMD, TITLE=''
cgPolygon, shape_x, shape_y, /ADDCMD, COLOR='black', THICK=2
cgPlotS, points_X, points_Y, PSYM=16, /ADDCMD

mask = roi->ComputeMask(DIMENSIONS=[5,4], $
PIXEL_CENTER=[0.5,0.5], MASK_RULE=2)
grid_ = grid
grid_[where(mask ne 0)] = 255

cgLoadCT, 33 & TVLCT, 130, 130, 130, 255 & cgWindow
cgImage, grid_, /KEEP_ASPECT_RATIO, /AXES, /ADDCMD, $
TITLE='Compute Mask, RULE=2'
cgPolygon, shape_x, shape_y, /ADDCMD, COLOR='black', THICK=2
cgPlotS, points_X, points_Y, PSYM=16, /ADDCMD

mask = roi->ComputeMask(DIMENSIONS=[5,4], $
PIXEL_CENTER=[0.5,0.5], MASK_RULE=1)
grid_ = grid
grid_[where(mask ne 0)] = 255

cgLoadCT, 33 & TVLCT, 130, 130, 130, 255 & cgWindow
cgImage, grid_, /KEEP_ASPECT_RATIO, /AXES, /ADDCMD, $
TITLE='Compute Mask, RULE=1'
cgPolygon, shape_x, shape_y, /ADDCMD, COLOR='black', THICK=2
cgPlotS, points_X, points_Y, PSYM=16, /ADDCMD

mask = mask * 0
cp = roi->ContainsPoints(points_X, points_Y)

cgLoadCT, 33 & TVLCT, 130, 130, 130, 255 & cgWindow
cgImage, grid, /KEEP_ASPECT_RATIO, /AXES, /ADDCMD, $
TITLE='Contain Points'
cgPolygon, shape_x, shape_y, /ADDCMD, COLOR='black', THICK=2
cgPlotS, points_X, points_Y, PSYM=16, /ADDCMD
cgPlotS, points_X[where(cp)], points_Y[where(cp)], $
PSYM=16, COLOR='dark grey', /ADDCMD

end
[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: harrisgeospatial unreachable...
Next Topic: Re: Segregating data in bimodal distribution

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

Current Time: Wed Oct 08 14:11:01 PDT 2025

Total time taken to generate the page: 0.00786 seconds