Graphics Reference
In-Depth Information
Table B-3
Common Functions
(continued)
Syntax
Description
genType
round
(genType
x
)
Returns a value equal to the nearest
integer to
x
. The fraction 0.5 will
round in a direction chosen by the
implementation, presumably the direction
that is fastest. This includes the possibility
that
round
(
x
) returns the same value as
roundEven
(
x
) for all values of
x
.
genType
roundEven
(genType
x
)
Returns a value equal to the nearest
integer to
x
. A fractional part of 0.5 will
round toward the nearest even integer.
(Both 3.5 and 4.5 for
x
will return 4.0.)
genType
ceil
(genType
x
)
Returns a value equal to the nearest
integer that is greater than or equal to
x.
genType
fract
(genType
x
)
Returns
x
-
loor
(
x
).
genType
mod
(genType
x,
float
y
)
genType
mod
(genType
x,
genType
y
)
Modulus (modulo). Returns
x
-
y
*
loor
(
x
/
y
).
genType
min
(genType
x,
genType
y
)
genType
min
(genType
x
, float
y
)
genIType
min
(genIType
x,
genIType
y
)
genIType
min
(genIType
x
, int
y
)
genUType
min
(genUType
x,
genUType
y
)
genUType
min
(genUType
x
, uint
y
)
Returns
y
if
y
<
x
; otherwise, it returns
x.
genType
max
(genType
x,
genType
y
)
genType
max
(genType
x
, float
y
)
genIType
max
(genIType
x,
genIType
y
)
genIType
max
(genIType
x
, int
y
)
genUType
max
(genUType
x,
genUType
y
)
genUType
max
(genUType
x
, uint
y
)
Returns
y
if
x
<
y
; otherwise, it
returns
x.