pitrix/include/functions.h

46 lines
918 B
C

#ifndef functions_H
#define functions_H
#include "prototypes.h"
#include "my_fastled.h"
#include "config.h"
uint16_t XYsafe(int x, int y);
void blur(fract8 blur_amount);
void blur_row(uint8_t row_index, fract8 blur_amount);
void blur_column(uint8_t column_index, fract8 blur_amount);
inline double sines(double x, double y) {
return ((cos(x) * sin(y)) * 0.5) + 0.5;
}
inline double basefield(double x, double y) {
return (cos(x) * sin(y) * cos(sqrt((x*x) + (y*y))));
}
inline double addmod(double x, double mod, double delta) {
x = x + delta;
while( x >= mod ) x -= mod;
while( x < 0.0 ) x += mod;
return x;
}
inline double addmodpi(double x, double delta) {
return addmod(x, 2*PI, delta);
}
struct Matrix multiply(struct Matrix m1, struct Matrix m2);
struct Vector multiply(struct Matrix m, struct Vector v);
struct Vector add(struct Vector v1, struct Vector v2);
#endif