CPoint:Floor


The Floor method replaces the x and y members of the CPoint with the next lower integer value. For example, x=1.3 becomes x=1, and x=-16.2 becomes x=-17.

Syntax

P = CPoint:Floor()

bullet.gif    P returned is the original CPoint object. This allows the Floor method to be used as part of an operator expression, if desired.

bullet.gif    On failure, nil is returned.

Example

The following script creates a CPoint object and applies the Floor method to its values.

P = new_point(4.4,-12.7)

-- create a CPoint object

Printf("x=%lg, y=%lg\n", P.x, P.y)

-- result: x=4.4, y=-12.7

P:Floor()

-- compute the floor values

Printf("x=%lg, y=%lg\n", P.x, P.y)

-- result: x=4, y=-13

Related Topics

CPoint class, Ceil, Round, CPoint Math Operators


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.