forked from james-yoo/DBSCAN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbscan.h
47 lines (39 loc) · 1.06 KB
/
dbscan.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
#ifndef DBSCAN_H
#define DBSCAN_H
#include <vector>
#include <cmath>
#define UNCLASSIFIED -1
#define CORE_POINT 1
#define BORDER_POINT 2
#define NOISE -2
#define SUCCESS 0
#define FAILURE -3
using namespace std;
typedef struct Point_
{
float x, y, z; // X, Y, Z position
int clusterID; // clustered ID
}Point;
class DBSCAN {
public:
DBSCAN(unsigned int minPts, float eps, vector<Point> points){
m_minPoints = minPts;
m_epsilon = eps;
m_points = points;
m_pointSize = points.size();
}
~DBSCAN(){}
int run();
vector<int> calculateCluster(Point point);
int expandCluster(Point point, int clusterID);
inline double calculateDistance(Point pointCore, Point pointTarget);
int getTotalPointSize() {return m_pointSize;}
int getMinimumClusterSize() {return m_minPoints;}
int getEpsilonSize() {return m_epsilon;}
private:
vector<Point> m_points;
unsigned int m_pointSize;
unsigned int m_minPoints;
float m_epsilon;
};
#endif // DBSCAN_H