CImage:PtInside


The PtInside method tests whether a point is interior to the image.

Syntax

bSuccess = CImage:PtInside( nAxis[] )

bSuccess = CImage:PtInside( x, y )

bSuccess = CImage:PtInside( n )

where

    nAxis[] is a n-Dimensional coordinate array.

    x and y are image coordinates in pixel units.

    n is an integer index between 1 and the number of pixels in the image.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

This method is useful for the non-trivial cases when a coordinate is calculated or expressed in world coordinates. In the latter case, call WcsToXy to convert to pixel coordinates before calling this method. See the example below.

Example

Assume an image is displayed image is a CImageView window. The following script converts a coordinate (a,d) into pixel coordinates and then tests whether the point (x,y) is inside the image:

I = V:GetImage()

-- create a CRect object

x, y = I:XytoWcs(a,d)

-- convert to pixel coordinates

test = I:PtInside(x,y)

 -- returns true if x,y is inside the image

Printf( "Inside=%d\n",test)

-- result: Inside = 1

Related Topics

Pos

CRect:PtInside

CImage class