CRect:PtInside
The PtInside method tests whether a point is interior to the CRect. The tests are made using <= or >= so that a point exactly on a CRect boundary is considered to be inside. The related PtInsideInt method tests the CRect using fuzzy integral boundaries.
bSuccess = CRect:PtInside( CPoint ) bSuccess = CRect:PtInside( x, y ) where x, y are the point coordinates. CPoint is a CPoint object. bSuccess is returned true if the point is inside the rectangle, otherwise false. |
The following script tests whether the point (225,300) is inside the CRect:
|
-- create a CRect object |
|
|
|
-- returns test = true or false |
|
-- result: Inside = 1 |
The script below tests whether an object intended for photometry is entirely inside the image when the size of the outer background aperture is considered. Assume a CApphot object A and a CImage object I already exist. This script uses the radius of the outer aperture to define a zone to be avoided around the margin of the image. The value is increased by 1 pixel to handle fractional pixels that might otherwise push the edge of the aperture outside the image.
|
-- get the radius of the outer aperture, add 1 pixel |
|
-- create a CRect object |
|
-- give the rectangle the dimension of the image |
|
-- shrink the CRect by (aperture radius + 1) |
|
-- get some coordinates for the object |
|
-- returns test = true or false |
|
|