-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct.h
75 lines (62 loc) · 1.42 KB
/
struct.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//一些游戏中可能用到的结构体
//AI开发者可以选择性使用
#pragma once
using namespace std;
#include <cmath>
#include <cstdlib>
#include <ctime>
#define PI 3.1415926535898
//形状种类(枚举类型)
enum shapes{S_Circle,S_Box,S_Beam};
//点
struct Point
{
double x;
double y;
};
//圆形
struct Circle
{
double x; //圆心坐标x
double y; //圆心坐标y
double r; //圆形半径
};
//矩形
struct Box
{
double x; //矩形中心坐标x
double y; //矩形中心坐标y
double width; //矩形宽(水平)
double height; //矩形高(垂直)
};
//线段
struct Segment
{
double x1,y1;
double x2,y2;
};
//射线
struct Beam
{
//起点(x,y)
double x;
double y;
double rotation; //角度
//终点(x,y)
double ex,ey;
};
//这里是一些可能会用到的函数
//你完全可以忽略它们,而使用自己编写的函数
//这部分的函数体实现在GlobalFunction.cpp中
extern Point myRotate(double,double,double,double,bool);
extern double AngleAdjust(double &);
extern double AnglePlus(double,double);
extern double AngleToRadian(double);
extern double RadianToAngle(double);
extern bool HitTestCirclePoint(const Circle &,const double &,const double y);
extern bool HitTestCircles(const Circle &, const Circle &);
extern bool HitTestBeamCircle(const Beam &,const Circle &);
extern Point GetHitPoint(Beam,Circle);
extern void SetSeed();
extern double Random0_1();
extern int Random(int,int);