pitrix/include/functions.h

60 lines
1.1 KiB
C
Raw Normal View History

#ifndef functions_H
#define functions_H
#include "prototypes.h"
#include "my_fastled.h"
#include "config.h"
uint16_t XYsafe(int x, int y);
void setPixel(int x, int y, CRGB color);
void setPixel(int i, CRGB color);
void setPixel(Window win, int x, int y, CRGB color);
2019-05-30 09:12:40 +00:00
void addPixelColor(int i, CRGB color);
void clear(Window window, CRGB color);
void clear(Window window);
void clear();
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