Skip to content

raisim::noiseUtils ​

class · #include <raisim/Terrain.hpp>

Internal: numeric helpers of the terrain noise generator.

Static member functions ​

fastFloor static ​

cpp
static std::int64_t fastFloor(double f) noexcept

Floor as a SIGNED integer. Returning an unsigned type would wrap every negative result to ~1.8e19, which breaks x -= fastFloor(x) in PerlinNoise::sample below. Truncation toward zero already equals floor for f >= 0 and for exact negative integers; only a negative value with a fractional part needs the extra -1.

Parameters

ParameterDescription
f (in)value inside the int64 range

Returns floor(f)

fastRound static ​

cpp
static std::int64_t fastRound(double f) noexcept

Parameters

ParameterDescription
f (in)value

Returns f rounded to the nearest integer, halves away from zero

map static ​

cpp
static double map(
    double value,
    double lower0,
    double upper0,
    double lower1,
    double upper1)

Linearly maps value from [lower0, upper0] to [lower1, upper1] (no clamping).

Parameters

ParameterDescription
value (in)input value
lower0 (in)input range start
upper0 (in)input range end
lower1 (in)output range start
upper1 (in)output range end

Returns the mapped value

RaiSim — physics for robotics and AI.