Utils

Cubiomes.UtilsModule

Some utility functions and types that are used in various places in the codebase. Ideally it should be divided into multiple very small modules.

source

Index

API

Cubiomes.Utils.length_of_trimmedMethod
length_of_trimmed(predicate, x) where N

Returns the length of the collection x after removing the elements from the beginning and the end that satisfy the predicate.

⚠ The collection must have the property so that x[i] for i in firstindex(x):lastindex(x) is valid.

source
Cubiomes.Utils.lerpMethod
lerp(part, from, to)

Performs linear interpolation between from and to using part as the fraction. Equivalent to from + part * (to - from).

source
Cubiomes.Utils.lerp2Method
lerp2(dx, dy, v00, v10, v01, v11)

Performs bilinear interpolation between four values v00, v10, v01, v11 using fractions dx and dy.

source
Cubiomes.Utils.lerp3Method
lerp3(dx, dy, dz, v000, v100, v010, v110, v001, v101, v011, v111)

Performs trilinear interpolation between eight values v... using fractions dx, dy, and dz.

source
Cubiomes.Utils.lerp4Method
lerp4(a::Couple, b::Couple, c::Couple, d::Couple, dy, dx, dz)

Performs trilinear interpolation where the initial eight corner values are derived from four Couples (pairs of values) by first interpolating along the y-axis using dy. Subsequent interpolations use dz and dx.

Specifically, it computes: lerp(dx, lerp(dz, lerp(dy, a[1], a[2]), lerp(dy, c[1], c[2])), lerp(dz, lerp(dy, b[1], b[2]), lerp(dy, d[1], d[2])))

source
Cubiomes.Utils.threadingFunction
threading(kind = :off; kwargs...)

Return a Scheduler from the OhMyThreads package type that contains all the static parameters needed for threading. See the documentation of OhMyThreads related to the schedulers to know what to pass to the kwargs.

source
Cubiomes.Utils.@only_float32Macro
@only_float32 expr

Transforms all real literals in the expr to Float32.

Example

@only_float32 function f()
    x = 1 + 2im # expand to `1.0f0 + 2.0f0im`
    x += 1 # expand to `x += 1.0f0`
    return x
end
source

Private API

Click to see
Cubiomes.Utils.findfirst_defaultMethod
findfirst_default(predicate::Function, A, default)

Return the first index i of A where predicate(A[i]) is true. If no i satisfy this, default is returned instead.

source