/**//*
Crect: ptinrect
Determines whether the specified point lies within crect.
*/
Bool ptinrect (
Point point
) Const throw ();
/**//*
Parameters
Point
Contains a point structure or cpoint object.
Return Value
Nonzero if the point lies within crect; otherwise 0.
Remarks
A point is within crect if it lies on the left or top side or is within all four sides. A point on the right or bottom side is outside crect.
Note
The rectangle must be normalized or this function may fail. You can call normalizerect to normalize the rectangle before calling this function.
Example
*/
Crect rect (5, 5,100,100 );
Cpoint pt1 (35, 50 );
Cpoint pt2 (125,298 );
// This is true, because pt1 is inside the rectangle
Assert (rect. ptinrect (pt1 ));
// This is not true, because pt2 is outside the rectangle
Assert (! Rect. ptinrect (pt2 ));
// Note that the right and the bottom aren't inside
Assert (! Rect. ptinrect (cpoint (35,100 )));
Assert (! Rect. ptinrect (cpoint (100, 98 )));
// But the top and
Assert (rect. ptinrect (cpoint (5, 65 )));
Assert (rect. ptinrect (cpoint (88, 5 )));
// And that ptinrect () works against a point, too
Point pt;
PT. x = 35;
PT. Y = 50;
Assert (rect. ptinrect (PT ));
/*
See also
Reference
Crect class
Hierarchy chart
Crect: normalizerect
Ptinrect
Other resources
Crect members
*/