AHELP for CIAO 4.12

# regInsideRegion

Context: region

## Synopsis

*DEPRECATED* Is a point (or set of points) inside a region?

## Syntax

```regInsideRegion(region, x, y)

The return value is a scalar if x and y are scalars or a numpy array if
x and y are numpy arrays.```

## Description

The interfaces described in this help file have been deprecated. CIAO 4.10 includes a new object based interface which should be used instead of these routines. This document is provided for legacy support.

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 be a single X, Y position or two arrays of positions.

The region module is not available by default; see "ahelp region" for information on loading the module.

## Examples

### Example 1

```>>> from region import *
>>> reg = regParse("circle(10,10,4)")
>>> flag = regInsideRegion(reg, 12, 11)
>>> 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; if the routinr returns 1 then it is, otherwise it returns 0.

### Example 2

```>>> import numpy as np
>>> xc = np.array([10, 16, 12])
>>> yc = np.array([11, -4, 8])
>>> flags = regInsideRegion(reg, xc, yc)
>>> print(flags)
[1 0 1]
>>> i = np.where(flags == 1)
>>> xx = xc[i]
>>> yy = yc[i]
>>> print(zip(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() function had been written

`where( flag == 0 )`

then it would have selected those points that lie outside the region.

### Changes in CIAO 4.8

The region library (C version) was re-written in CIAO 4.8, so that some routines may give different answers, in particular when handling self-intersecting (non-simple) polygons.

## Bugs

See the bugs page for the region library on the CIAO website for an up-to-date listing of known bugs.

Refer to the CIAO bug pages for an up-to-date listing of known issues.