CPoint:Round


The Round method rounds both x and y properties to the nearest integer value. For example P.x=100.54 becomes P.x=101 , and P.x=100.49 becomes P.x=100. This method uses the Round function.

Syntax

CRect:Round()

Example

The following script returns the values of a point before and after being rounded:

P = NewPoint( 50.322, 100.55 )

-- Create a CPoint

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

-- result: 50.322, 100.55

P:Round()

-- round to integer values

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

-- result: 50, 101

Related Topics

Floor

Get

CPoint class