CRect:Floor
The Floor method truncates all 4 rectangle limits to the next lower integer value. For example xmax=100.54 becomes xmax=100.
CRect:Floor() This method has no arguments and no return value. |
This method truncates all 4 rectangle limits to integer values. One common use of this method is when using the rectangle to refer to image pixels. The value of the image pixel is effective at its center, which occurs at an exact integer coordinate. In some analyses, it is critical that the value used for the pixel be applied exactly at its center pixel coordinates, and this method helps with that requirement.
The following script returns the values of the image cursor rectangle and changes them to integer values using the Floor method. Assume that a CImageView V is attached to an image window. Note that the CImage I and CRect R do not need to be created separately, as they are created by the methods that return them as a value.
|
-- create a CImage for the displayed image |
|
-- Create a CRect for the cursor rectangle |
|
-- result: 383.43 502.14 603.43 554.83 |
|
-- round down to integer values |
|
-- result: 383 502 603 554 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.