aboutsummaryrefslogtreecommitdiff
path: root/src/stm32/TODO/maths.h
blob: 2dc3560c0e5e68c0b623ae9e981ef27027f80643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once

// #include <math.h>

typedef struct {
    u_int32_t x,y;//fixed point at decimal 7lsb (world positions in pixels (with fixed decimal point))
} vec2;

typedef vec2 vec_cen;//centered
typedef vec2 vec_cor;//left upper corner

#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define CLAMP(N,LOWER,UPPER) (MIN(MAX(LOWER, N), UPPER))