15 #include <vsg/core/ConstVisitor.h>
16 #include <vsg/core/visit.h>
17 #include <vsg/maths/mat3.h>
18 #include <vsg/maths/mat4.h>
19 #include <vsg/maths/quat.h>
20 #include <vsg/maths/vec3.h>
26 constexpr
float PIf = 3.14159265358979323846f;
27 constexpr
double PI = 3.14159265358979323846;
30 constexpr
float radians(
float degrees) noexcept {
return degrees * (PIf / 180.0f); }
31 constexpr
double radians(
double degrees) noexcept {
return degrees * (PI / 180.0); }
34 constexpr
float degrees(
float radians) noexcept {
return radians * (180.0f / PIf); }
35 constexpr
double degrees(
double radians) noexcept {
return radians * (180.0 / PI); }
38 constexpr
float square(
float v) noexcept {
return v * v; };
39 constexpr
double square(
double v) noexcept {
return v * v; };
43 T smoothstep(T edge0, T edge1, T x)
49 double r = (x - edge0) / (edge1 - edge0);
50 return edge0 + (r * r * (3.0 - 2.0 * r)) * (edge1 - edge0);
61 return r * r * (3.0 - 2.0 * r);
66 T mix(T start, T end, T r)
68 T one_minus_r = 1.0 - r;
69 return start * one_minus_r + end * r;