-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoints_in_rect.h
More file actions
41 lines (36 loc) · 946 Bytes
/
Copy pathpoints_in_rect.h
File metadata and controls
41 lines (36 loc) · 946 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
#ifndef POINTS_IN_RECT_H
#define POINTS_IN_RECT_H
#include <QtAlgorithms>
#include <QMap>
#include <QSet>
#include <QHash>
#include <QDateTime>
#include <QPoint>
#include <QRect>
#include <QSize>
#include <QVector>
#include <QVector2D>
#include <random>
#include <QDebug>
#include <QLine>
QVector<QPoint> generatePoints(QSize &size, int n);
QVector<QLine> generateLines(QSize &size, int n);
class PointsCounter {
private:
QVector<QVector<int>> table;
QVector<int> xvector, yvector;
int unique;
public:
PointsCounter();
PointsCounter(QVector<QPoint> &points);
~PointsCounter();
int xIndex(int &x);
int yIndex(int &y);
int getQ(QPoint &p);
int getUnique();
int count(QRect &rect);
int count(QPoint &leftTop, QPoint &rightBottom);
int count(QPoint leftTop, QPoint rightTop, QPoint leftBottom, QPoint rightBottom);
void updatePoints(QVector<QPoint> &points);
};
#endif // POINTS_IN_RECT_H