CPoint:Floor


The Floor method rounds both the x,y properties to the next lower integer value. For example P.x=100.54 becomes P.x=100. Compare with the Round and Ceil methods.

Syntax

CPoint:Floor()

  

One common use of this method is when converting fractional fractional image pixel coordinates to the integral coordinates of the pixel. The value of the image pixel is effective at its center, which occurs at an exact integer coordinate.

Example

The following script lists the values of a point before and after using the Floor method.

P = NewPoint( 50.322, 100.55 )

-- Create a CPoint

Printf("%lg, %lg\n", P:Get() )

-- result: 50.322, 100.55

P:Floor()

-- round to the next lower integer values

Printf("%lg, %lg\n", P:Get() )

-- result: 50, 100

Related Topics

Round

Ceil

Get

CPoint class