mirror of
https://github.com/GayPizzaSpecifications/padlab.git
synced 2025-08-03 21:21:33 +00:00
ch ch ch ch changes! big ol overhaul:
- Hidpi support - Display & edit both sticks individually - Clearer distinction between raw & filtered position - Param editing & preview for digital - Digital has an angle parameter - Touched up CMakeLists.txt - gitignore
This commit is contained in:
26
maths.h
26
maths.h
@ -1,5 +1,15 @@
|
||||
#ifndef VECTOR_H
|
||||
#define VECTOR_H
|
||||
#ifndef MATHS_H
|
||||
#define MATHS_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define PI 3.141592653589793238462643383279502884L
|
||||
#define TAU 6.283185307179586476925286766559005768L
|
||||
|
||||
#define MAX(LHS, RHS) ((LHS > RHS) ? (LHS) : (RHS))
|
||||
#define MIN(LHS, RHS) ((LHS < RHS) ? (LHS) : (RHS))
|
||||
#define CLAMP(X, A, B) (MIN(B, MAX(A, X)))
|
||||
#define SATURATE(X) (CLAMP(X, 0, 1))
|
||||
|
||||
typedef double vec_t;
|
||||
typedef struct {vec_t x, y;} vector;
|
||||
@ -14,4 +24,14 @@ static inline vector VecScale(vector v, vec_t x)
|
||||
return (vector){v.x * x, v.y * x};
|
||||
}
|
||||
|
||||
#endif//VECTOR_H
|
||||
static inline double pfmod(double x, double d)
|
||||
{
|
||||
return fmod(fmod(x, d) + d, (d));
|
||||
}
|
||||
|
||||
static inline double AccelCurve(double x, double y)
|
||||
{
|
||||
return (x * (x + y)) / (1.0 + y);
|
||||
}
|
||||
|
||||
#endif//MATHS_H
|
||||
|
Reference in New Issue
Block a user