<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

Interpolation/

inquad.pro

to find if an (x,y) point is in a quadrilateral (x1,x2,x3,x4)

topinquad Grid

result = inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4, ONSPHERE=ONSPHERE, DOUBLE=DOUBLE, ZOOMRADIUS=ZOOMRADIUS, NOPRINT=NOPRINT, NEWCOORD=NEWCOORD)

Return value

a n element vector. Where n is the number of elements of x. res[i]=j means that the point number i is located in the quadrilateral number j with (0 <= j <= n_elements(x0)-1)

Parameters

x        in required

y        in required

the coordinates of the point we want to know where it is. Must be a scalar if /ONSPHERE activated else can be scalar or array.

x1        in required

y1        in required

x2        in required

y2        in required

x3        in required

y3        in required

x4        in required

y4        in required

the coordinates of the quadrilateral given in the CLOCKWISE order. Scalar or array.

Keywords

ONSPHERE       

to specify that the quadilateral are on a sphere and that teir coordinates are longitude-latitude coordinates. In this case, est-west periodicity, poles singularity and other pbs related to longitude-latitude coordinates are managed automatically.

DOUBLE       

use double precision to perform the computation

ZOOMRADIUS        default: 4

the zoom (circle centred on the (x,y) with a radius of zoomradius degree where we look for the the quadrilateral which contains the (x,y) point) used for the satellite projection when /ONSPHERE is activated. 4 seems to be the minimum which can be used. Can be increase if the cell size is larger than 5 degrees.

NOPRINT       

to suppress the print messages.

NEWCOORD       

Examples

IDL> x = 1.*[1, 2, 6, 7, 3] IDL> y = 1.*[1, 3, 3, 4, 7] IDL> x1 = 1.*[0,4,2] IDL> y1 = 1.*[1,4,8] IDL> x2 = 1.*[1,6,4] IDL> y2 = 1.*[5,6,8] IDL> x3 = 1.*[3,8,4] IDL> y3 = 1.*[4,4,6] IDL> x4 = 1.*[2,6,2] IDL> y4 = 1.*[0,2,6] IDL> splot, [0,10], [0,10], xstyle = 1, ystyle = 1,/nodata IDL> for i=0,2 do oplot, [x4[i],x1[i],x2[i],x3[i],x4[i]],[y4[i],y1[i],y2[i],y3[i],y4[i]] IDL> oplot, x, y, color = 20, psym = 1, thick = 2 IDL> print, inquad(x, y, x1, y1, x2, y2, x3, y3, x4, y4) On a sphere see clickincell.pro...

Version history

Version

$Id: inquad.pro 136 2006-07-10 15:20:19Z pinsard $

History

Sebastien Masson (smasson@lodyc.jussieu.fr) August 2003 Based on Convert_clic_ij.pro written by Gurvan Madec

Known issues

Restrictions

I think degenerated quadrilateral (e.g. flat of twisted) is not work. This has to be tested.
Produced by IDLdoc 2.0.