CRect:PtInside CRect:RectInside

CRect:PtInsideInt


The PtInsideInt method tests whether a point is interior to the CRect when the coordinates are all considered to be integers rather than real numbers.

Syntax

bSuccess = CRect:IsInsideInt( x, y )

    wherex and y are numbers representing the coordinates of the target point.

Remarks

This method handles the boundary case in which the point lies within the same integer value. For example, if xmin = 200.4, then any point x in the range 200 through 201 is considered to lie on the boundary xmin and is therefore considered inside the rectangle.

Example

The following script fragment tests whether the point (225.2,300.6) is inside the CRect when tested using both PtInside() and PtInsideInt():

 

R = CRect:new()

-- create a CRect object

R:Set(200.5,250,250,500)

 

x = 200.2 ; y = 300

 

test = R:PtInside(x,y)

-- returns true or false

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

-- result: Inside = 0

test = R:PtInsideInt(x,y)

-- returns test = true or false

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

-- result: Inside = 1

Related Topics

CRect, PtInside, RectInside