Strange behavior of POLYFILL [message #77736] |
Wed, 21 September 2011 01:41 |
Xavi Llort
Messages: 15 Registered: September 2006
|
Junior Member |
|
|
Dear all,
After hours fighting against POLYFILL, I found a strange behavior that
I cannot understand...
Here there is a small code searching the points inside a triangle. Why
there is a point that clearly is inside the triangle and not retrieved
by Polyfill (see plot)? Does anyone have a solution?
Thanks in advance,
Xavi
PRO POLY_HELL
dim_x = 1024 & dim_y = 1024
lon_res = 0.02 & lat_res = 0.02
lon_arr = DINDGEN(dim_x)*lon_res - 12.99
lat_arr = DINDGEN(dim_y)*lat_res + 29.53
triangle_xx = [-4.27, -4.3221145, -4.3234300, -4.27]
triangle_yy = [35.449997, 35.535344, 35.365467,35.449997]
xx_n = (triangle_xx - lon_arr[0]) / lon_res +1.
yy_n = (triangle_yy - lat_arr[0]) / lat_res +1.
points_in = POLYFILLV(xx_n, yy_n, dim_x, dim_y )
DEVICE, DEC=0
LOADCT, 5
WINDOW, 0, XSIZE=800, YSIZE=800
PLOT, triangle_xx, triangle_yy, PSYM=-4, XR=[-4.39, -4.15], XSTYLE=1,
$
YR=[35.33, 35.57], YSTYLE=1
lon_mat = REBIN(lon_arr, dim_x, dim_y)
lat_mat = REBIN(TRANSPOSE(lat_arr), dim_x, dim_y)
OPLOT, lon_mat, lat_mat, psym=1, SYMSIZE=0.7
OPLOT, lon_mat[points_in], lat_mat[points_in], psym=4, SYMSIZE=1.4,
COLOR=115, THICK=2.
END
|
|
|