| 
 
      Is a point (or set of points) inside a region?
     
Short_Type regInsideRegion( Region_Type Region, Double_Type X,
Double_Type Y )
Array_Type regInsideRegion( Region_Type Region, Array_Type Xarr,
Array_Type Yarr ) 
      
        The regInsideRegion routine queries a region to find out if a
        point (or an array of points) is inside the region or not.  1
        is returned for yes, and 0 if no.  The input values are a CIAO
        region variable (as returned from regParse), and the positions
        to query which can be either a single X, Y position or two
        arrays of positions, Xarray and Yarray.
       
chips> region("region")
chips> reg = regParse("circle(10,10,4)")
chips> flag = regInsideRegion( reg, 12, 11 )
chips> print(flag)
1
	  
	    Here we use the regInsideRegion() routine to find out whether
	    the point at (12,11) is inside the circle centered at (10,10)
	    with a radius of 4 pixels.
	    The answer is 1, since it is.
	   
chips> xc = [ 10, 16, 12 ]
chips> yc = [ 11, -4, 8 ]
chips> flag = regInsideRegion( reg, xc, yc )
chips> writeascii( stdout, xc, yc, flag )
10 11 1
16 -4 0
12 8 1
chips> i = where( flag )
chips> xx = xc[i]
chips> yy = yc[i]
chips> writeascii( stdout, xx, yy )
10 11
12 8
	  
	    Here we have found that the points (10,11) and (12,8) are
	    inside the region, but that (16,-4) is not. The where()
	    routine is then used to show how you can extract from the
	    arrays only those points that lie inside the region.
	    If the where() finction had been written
	     
	    then it would have selected those points that lie
	    outside the region.
	   |