Module dlib.math.utils

Utility math functions

Functions

NameDescription
bytesToUint(src) Constructs uint from an array of bytes
degtorad(angle) Convert degrees to radians
fovXfromY(yfov, aspectRatio) Field of view angle X from Y
fovYfromX(xfov, aspectRatio) Field of view angle Y from X
frac(v) Fractional part
integer(v) Integer part
isConsiderZero(f) Is less than EPSILON
isPerfectSquare(n) Is perfect square
isPowerOfTwo(x) Is power of 2
max2(x, y) Find maximum of two values
max3(x, y, z) Find maximum of three values
min2(x, y) Find minimum of two values
min3(x, y, z) Find minimum of three values
nextPowerOfTen(k) Round to next power of 10
nextPowerOfTwo(k) Round to next power of 2
oneOfIsZero() If at least one element is zero
radtodeg(angle) Convert radians to degrees
radtorev(angle) Convert radians to revolutions
revtorad() Convert revolutions to radians
sign(x) Sign of a number
swap(a, b) Swap values
swapEndian16(n) Returns 16-bit integer n with swapped endianness

Enums

NameDescription
Axis Axes of Cartesian space

Manifest constants

NameTypeDescription
EPSILON Very small value