25 constexpr
double eps = std::numeric_limits<double>::epsilon();
26 return std::abs(a - b)
27 <= eps * std::max(tolerance * eps, std::max(1., tolerance) * std::abs(b));
32 std::random_device rd;
33 std::mt19937 gen(rd());
34 std::uniform_int_distribution<int> uniform_int(low, high);
35 return uniform_int(gen);
40 std::random_device rd;
41 std::mt19937 gen(rd());
42 std::uniform_real_distribution<> uniform_real(low, high);
43 return uniform_real(gen);
MVVM_MODEL_EXPORT bool AreAlmostEqual(double a, double b, double tolerance_factor=1.0)
Returns true if two doubles agree within epsilon*tolerance.
MVVM_MODEL_EXPORT double RandDouble(double low, double high)
Produces random FLOAT values uniformly distributed on the interval [low, high).
MVVM_MODEL_EXPORT int RandInt(int low, int high)
Produces random integer values uniformly distributed on the closed interval [low, high].
materialitems.h Collection of materials to populate MaterialModel.