Module hedron::math

source ·

Structs

A two dimentional range. Can also be interpreted as an axis-aligned rectangle
A two dimentional range. Can also be interpreted as an axis-aligned rectangle

Constants

Functions

calculate weight using Bernstein Polynomials: (n over i) t^i * (1-t)^(n - i). precalculated Pascal’s triangle for a bit more efficiency
binary search to figure out between which two values this sample is assumes data is sorted!!
roughly equals, for when dealing with floating point equality
Factorial, calculated naively ex: 3! = 1 * 2 * 3 = 6
get t as a fraction between min and max.
same as lerp, but using a Range
logaritmic lerping
when interpolating t between multiple data points, ‘select’ the two data points it falls between, if t in 0..data.len().
Fade function as defined by Ken Perlin. This eases coordinate values so that they will ease towards integral values. This ends up smoothing the final output. equals to 6t^5 - 15t^4 + 10t^3
TODO add this to a vector / points area when we get it convert a spherical coordinate to a cartesian one
Factorial but addition, don’t know what it is called ex: 3 = 1 + 2 + 3 = 6