Commit 3d6ae910 authored by Maxime Goret's avatar Maxime Goret
Browse files

Fin Voisinage

parent 928af81b
#include <voisinage.hpp>
#include"voisinage.hpp"
#include<math.h>
void Voisinage::setr(unsigned int rayon){
int rayon = -1;
rayon = -1;
while (rayon < 0){
while (rayon< 0){
printf("Entrez le ratonde voisinage (0 pour le voisinage arbitraire):\n ");
scanf("%d", &rayon);
......@@ -185,15 +185,15 @@ void RegleVoisinageMoore::calculVoisinage(Voisinage& v, const Reseau& r){
}
Voisinage::~Voisinage() {
VoisinageIterator *cellules = voisins.creerIterator();
cellules.first();
VoisinageIterator *cellules = creerIterator();
cellules->first();
int nb = 0;
while (!cellules.isDone()){
while (!cellules->isDone()){
delete voisinage[nb];
nb++;
}
delete[] voisinage;
}
\ No newline at end of file
}
......@@ -13,6 +13,8 @@
using namespace std;
class Voisinage {
private :
......@@ -38,10 +40,11 @@ public:
class RegleVoisinage{
private :
unsigned int nbVoisin;
public :
unsigned int nbVoisin;
void setNbVoisins(unsigned int r);
unsigned int getNbVoisin() {return nbVoisin;}
void calculVoisinage(Voisinage& v, const Reseau& r);
......@@ -85,10 +88,9 @@ class VoisinageIterator {
void next(){
i++;
}
// bool isDone(){
// return i == vsn->voisinage
// }
bool isDone(){
return (vsn->voisinage.size() <= i);
}
int currentItem(){
return vsn->voisinage[i];
......@@ -96,4 +98,5 @@ class VoisinageIterator {
}
};
#endif /* voisinnage_hpp */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment