<<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, DELTA=DELTA, NOPRINT=NOPRINT, NEWCOORD=NEWCOORD)

Return value

a n elements 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 quadrilateral are on a sphere and that their coordinates are longitude-latitude coordinates. In this case, east-west periodicity, poles singularity and other pbs related to longitude-latitude coordinates are managed automatically.

DOUBLE       

use double precision to perform the computation

DELTA        default: 4

to speed up the program, we reduce the aera where we look for potential quadrilaterals containing (x,y). Delta defines the limit of the box centred on (x,y) with a zonal and meridional extent of delta 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 ...

Version history

Version

$Id: inquad.pro 371 2008-08-07 09:32:02Z 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.

Statistics

McCabe cyclic 22
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.