-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVec.h
More file actions
48 lines (35 loc) · 738 Bytes
/
Copy pathVec.h
File metadata and controls
48 lines (35 loc) · 738 Bytes
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
//
// Created by 20281 on 2022/9/12.
//
#ifndef C__LEARN_VEC_H
#define C__LEARN_VEC_H
#include <vector>
#include <iostream>
using namespace std;
/**
* 二维矢量类
*/
class Vec {
public:
int x;
int y;
Vec(int x, int y);
Vec();
/**
* 在 0~width-1 之内,0~height-1之内随机取一个点
* @param width
* @param height
* @return
*/
static Vec randomVec(int width, int height);
bool operator<(const Vec &v) const;
Vec operator+(const Vec &v) const;
bool operator==(const Vec &v) const;
friend ostream &operator<<(ostream &os, const Vec &p);
/**
* 获取一个坐标点的上下左右四个位置
* @return
*/
vector<Vec> getRoundLoc();
};
#endif //C__LEARN_VEC_H