📄 misc.h
字号:
/* random stuff */#ifndef MISC_H#define MISC_H#include <cmath>#ifndef M_PI#define M_PI 3.141592653589793#endiftypedef unsigned char uchar;typedef struct { uchar r, g, b; } rgb;inline bool operator==(const rgb &a, const rgb &b) { return ((a.r == b.r) && (a.g == b.g) && (a.b == b.b));}template <class T>inline T abs(const T &x) { return (x > 0 ? x : -x); };template <class T>inline int sign(const T &x) { return (x >= 0 ? 1 : -1); };template <class T>inline T square(const T &x) { return x*x; };template <class T>inline T bound(const T &x, const T &min, const T &max) { return (x < min ? min : (x > max ? max : x));}template <class T>inline bool check_bound(const T &x, const T&min, const T &max) { return ((x < min) || (x > max));}inline int vlib_round(float x) { return (int)(x + 0.5F); }inline int vlib_round(double x) { return (int)(x + 0.5); }inline double gaussian(double val, double sigma) { return exp(-square(val/sigma)/2)/(sqrt(2*M_PI)*sigma);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -