Added few comments
This commit is contained in:
parent
1194c68af5
commit
cf3ec4c8ec
@ -1,9 +1,9 @@
|
|||||||
#include "Euclidean.hpp"
|
#include "Euclidean.hpp"
|
||||||
|
|
||||||
double Euclidean::computeDistanceFrom(const Euclidean & euclidian)
|
double Euclidean::computeDistanceFrom(const Euclidean & euclidean) const
|
||||||
{
|
{
|
||||||
double diffx = _x - euclidian.getX();
|
double diffx = _x - euclidean.getX();
|
||||||
double diffy = _y - euclidian.getY();
|
double diffy = _y - euclidean.getY();
|
||||||
double diffx_sqr = pow(diffx, 2);
|
double diffx_sqr = pow(diffx, 2);
|
||||||
double diffy_sqr = pow(diffy, 2);
|
double diffy_sqr = pow(diffy, 2);
|
||||||
|
|
||||||
|
@ -4,31 +4,79 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Euclidean class.
|
||||||
|
*
|
||||||
|
* @author William Durand <william.durand1@gmail.com>
|
||||||
|
* @author Guillaume Bernard <guill.bernard1@gmail.com>
|
||||||
|
*/
|
||||||
class Euclidean
|
class Euclidean
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param const int x Coordinate X
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
void setX(const int x) { _x = x; }
|
void setX(const int x) { _x = x; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return const int
|
||||||
|
*/
|
||||||
int getX() const { return _x; }
|
int getX() const { return _x; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param const int y Coordinate Y
|
||||||
|
*/
|
||||||
void setY(const int y) { _y = y; }
|
void setY(const int y) { _y = y; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return const int
|
||||||
|
*/
|
||||||
int getY() const { return _y; }
|
int getY() const { return _y; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param const double distance A distance.
|
||||||
|
*/
|
||||||
void setDistance(const double distance) { _distance = distance; }
|
void setDistance(const double distance) { _distance = distance; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return const double
|
||||||
|
*/
|
||||||
double getDistance() const { return _distance; }
|
double getDistance() const { return _distance; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Euclidean & nearest
|
||||||
|
*/
|
||||||
void setNearest(Euclidean & nearest) { _nearest = &nearest; }
|
void setNearest(Euclidean & nearest) { _nearest = &nearest; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return const Euclidean*
|
||||||
|
*/
|
||||||
Euclidean* getNearest() const { return _nearest; }
|
Euclidean* getNearest() const { return _nearest; }
|
||||||
|
|
||||||
double computeDistanceFrom(const Euclidean & euclidian);
|
/**
|
||||||
|
* @param const Euclidean & euclidean
|
||||||
|
* @return const double
|
||||||
|
*/
|
||||||
|
double computeDistanceFrom(const Euclidean & euclidean) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param const std::vector<Euclidean>
|
||||||
|
* @return double
|
||||||
|
*/
|
||||||
static double max(const std::vector<Euclidean> vect);
|
static double max(const std::vector<Euclidean> vect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param const std::vector<Euclidean>
|
||||||
|
* @return double
|
||||||
|
*/
|
||||||
static double min(const std::vector<Euclidean> vect);
|
static double min(const std::vector<Euclidean> vect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user