Added Euclidean distance calculations
This commit is contained in:
39
Euclidean.hpp
Normal file
39
Euclidean.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef __EUCLIDIAN_HPP__
|
||||
#define __EUCLIDIAN_HPP__
|
||||
|
||||
#include <math.h>
|
||||
|
||||
class Euclidean
|
||||
{
|
||||
public:
|
||||
Euclidean(const int x, const int y) : _x(x), _y(y) {}
|
||||
|
||||
void setX(const int x) { _x = x; }
|
||||
|
||||
int getX() const { return _x; }
|
||||
|
||||
void setY(const int y) { _y = y; }
|
||||
|
||||
int getY() const { return _y; }
|
||||
|
||||
void setDistance(const double distance) { _distance = distance; }
|
||||
|
||||
double getDistance() const { return _distance; }
|
||||
|
||||
void setNearest(Euclidean & nearest) { _nearest = &nearest; }
|
||||
|
||||
Euclidean* getNearest() const { return _nearest; }
|
||||
|
||||
double computeDistanceFrom(const Euclidean & euclidian);
|
||||
|
||||
private:
|
||||
int _x;
|
||||
|
||||
int _y;
|
||||
|
||||
double _distance;
|
||||
|
||||
Euclidean *_nearest;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user