📄 geometry.h
字号:
#ifndef _GEOMERTY_H_
#define _GEOMETRY_H_
template<class T>
struct point
{
point():x(0),y(0){}
point(T _x,T _y):x(_x),y(_y){}
T x;
T y;
};
template<class T>
point<T> inline operator - (const point<T> &a,const point<T> &b)
{
return point<T>(a.x - b.x, a.y - b.y);
}
template<class T,class P>
point<T> inline operator / (const point<T> &a,const point<P> &b)
{
return point<T>(a.x / b.x, a.y / b.y)
}
template<class T>
struct rect
{
point<T> a;
point<T> b;
bool inline inside(const point<T> &p){
return p.x >= a.x && p.x < b.x && p.y >= a.y && p.y < b.y;
}
bool inline inclusive_inside(const point<T> &p){
return p.x >= a.x && p.x <= b.x && p.y >= a.y && p.y <= b.y;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -