This commit is contained in:
William DURAND 2012-01-11 00:36:31 +01:00
parent 38ca00ee57
commit f6fe37d72e
2 changed files with 63 additions and 62 deletions

View File

@ -1,5 +1,5 @@
#ifndef __EUCLIDIAN_HPP__ #ifndef EUCLIDIAN_HPP
#define __EUCLIDIAN_HPP__ #define EUCLIDIAN_HPP
#include <math.h> #include <math.h>
#include <vector> #include <vector>
@ -12,82 +12,82 @@
*/ */
class Euclidean class Euclidean
{ {
public: public:
/** /**
* Constructor * Constructor
* *
* @param const int x Coordinate X * @param const int x Coordinate X
* @param const int y Coordinate Y * @param const int y Coordinate Y
*/ */
Euclidean(const int x, const int y) : _x(x), _y(y) {} Euclidean(const int x, const int y) : _x(x), _y(y) {}
/** /**
* @param const int x Coordinate X * @param const int x Coordinate X
*/ */
void setX(const int x) { _x = x; } void setX(const int x) { _x = x; }
/** /**
* @return const int * @return const int
*/ */
int getX() const { return _x; } int getX() const { return _x; }
/** /**
* @param const int y Coordinate Y * @param const int y Coordinate Y
*/ */
void setY(const int y) { _y = y; } void setY(const int y) { _y = y; }
/** /**
* @return const int * @return const int
*/ */
int getY() const { return _y; } int getY() const { return _y; }
/** /**
* @param const double distance A distance. * @param const double distance A distance.
*/ */
void setDistance(const double distance) { _distance = distance; } void setDistance(const double distance) { _distance = distance; }
/** /**
* @return const double * @return const double
*/ */
double getDistance() const { return _distance; } double getDistance() const { return _distance; }
/** /**
* @param Euclidean & nearest * @param Euclidean & nearest
*/ */
void setNearest(Euclidean & nearest) { _nearest = &nearest; } void setNearest(Euclidean & nearest) { _nearest = &nearest; }
/** /**
* @return const Euclidean* * @return const Euclidean*
*/ */
Euclidean* getNearest() const { return _nearest; } Euclidean* getNearest() const { return _nearest; }
/** /**
* @param const Euclidean & euclidean * @param const Euclidean & euclidean
* @return const double * @return const double
*/ */
double computeDistanceFrom(const Euclidean & euclidean) const; double computeDistanceFrom(const Euclidean & euclidean) const;
/** /**
* @param const std::vector<Euclidean> * @param const std::vector<Euclidean>
* @return double * @return double
*/ */
static double max(const std::vector<Euclidean> vect); static double max(const std::vector<Euclidean> vect);
/** /**
* @param const std::vector<Euclidean> * @param const std::vector<Euclidean>
* @return double * @return double
*/ */
static double min(const std::vector<Euclidean> vect); static double min(const std::vector<Euclidean> vect);
private: private:
int _x; int _x;
int _y; int _y;
double _distance; double _distance;
Euclidean *_nearest; Euclidean *_nearest;
}; };
#endif #endif

View File

@ -34,6 +34,7 @@ double sum(CImg<float> img, int startedX, int startedY, int w) {
} }
} }
} }
return res; return res;
} }