EMD/Euclidean.hpp

46 lines
924 B
C++
Raw Normal View History

2011-12-06 00:17:32 +08:00
#ifndef __EUCLIDIAN_HPP__
#define __EUCLIDIAN_HPP__
#include <math.h>
2012-01-10 05:09:51 +08:00
#include <vector>
2011-12-06 00:17:32 +08:00
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);
static double max(const std::vector<Euclidean> vect);
static double min(const std::vector<Euclidean> vect);
2011-12-06 00:17:32 +08:00
private:
2011-12-06 00:17:32 +08:00
int _x;
int _y;
double _distance;
Euclidean *_nearest;
};
#endif