dlib.math.utils

Utility math functions

Public Imports

std.algorithm
public import std.algorithm : clamp;

Limit to given range

Members

Enums

Axis
enum Axis

Axes of Cartesian space

Functions

allIsZero
deprecated bool allIsZero(T[] array)

If all elements are zeros

bigEndian
ushort bigEndian(ushort value)

Byte operations

bigEndian
uint bigEndian(uint value)

Byte operations

bigEndian
ushort bigEndian(ushort value)
Undocumented in source. Be warned that the author may not have intended to support it.
bigEndian
uint bigEndian(uint value)
Undocumented in source. Be warned that the author may not have intended to support it.
bytesToUint
uint bytesToUint(ubyte[4] src)
Undocumented in source. Be warned that the author may not have intended to support it.
clamp
T clamp(T v, T minimal, T maximal)
Undocumented in source. Be warned that the author may not have intended to support it.
degtorad
T degtorad(T angle)

Convert degrees to radians

fovXfromY
T fovXfromY(T yfov, T aspectRatio)

Field of view angle X from Y

fovYfromX
T fovYfromX(T xfov, T aspectRatio)

Field of view angle Y from X

invertArray
deprecated T[] invertArray(T[] array)

Negate all elements of an array

isConsiderZero
bool isConsiderZero(T f)

Is less than EPSILON

isPerfectSquare
bool isPerfectSquare(float n)

Is perfect square

isPowerOfTwo
bool isPowerOfTwo(T x)

Is power of 2

max2
T max2(T x, T y)

Find maximum of two values

max3
T max3(T x, T y, T z)

Find maximum of three values

min2
T min2(T x, T y)

Find minimum of two values

min3
T min3(T x, T y, T z)

Find minimum of three values

networkByteOrder
ushort networkByteOrder(ushort value)

Byte operations

networkByteOrder
uint networkByteOrder(uint value)

Byte operations

networkByteOrder
ushort networkByteOrder(ushort value)
Undocumented in source. Be warned that the author may not have intended to support it.
networkByteOrder
uint networkByteOrder(uint value)
Undocumented in source. Be warned that the author may not have intended to support it.
nextPowerOfTen
T nextPowerOfTen(T k)

Round to next power of 10

nextPowerOfTwo
T nextPowerOfTwo(T k)

Round to next power of 2

oneOfIsZero
bool oneOfIsZero(T[] array)

If at least one element is zero

radtodeg
T radtodeg(T angle)

Convert radians to degrees

sign
int sign(T x)

Sign of a number

sum
deprecated T sum(T[] array)

Sum of all elements of an array

swap
void swap(T* a, T* b)

Swap values

Manifest constants

EPSILON
enum EPSILON;

Very small value

Meta

Authors

Timur Gafarov