paysages3d/src/basics/Maths.h
Michaël Lemaire 094dfbf783 Added render test for clouds lighting
This will allow to validate future changes
2016-01-26 02:26:43 +01:00

38 lines
899 B
C++

#ifndef MATHS_H
#define MATHS_H
#include "basics_global.h"
namespace paysages {
namespace basics {
/**
* Basic math utilities.
*/
class BASICSSHARED_EXPORT Maths {
public:
/**
* Constraint a value in the [min,max[ range, by applying a modulo.
*/
static double modInRange(double value, double min, double max);
/**
* Constraint a value in the [min,max[ range, by clamping it.
*/
static double clamp(double x, double minval, double maxval);
/**
* Returns 0.0 when x < edge0, 1.0 when y > edge1, and a smoothly interpolated value in-between.
*/
static double smoothstep(double edge0, double edge1, double x);
static constexpr double PI = 3.141592653589793238462643383279;
static constexpr double PI_2 = PI / 2.0;
static constexpr double PI_4 = PI / 4.0;
static constexpr double TWOPI = 2.0 * PI;
};
}
}
#endif // MATHS_H