summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/group.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/group.cc')
-rw-r--r--2004/i/nono/src/ovision/group.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/2004/i/nono/src/ovision/group.cc b/2004/i/nono/src/ovision/group.cc
index 9228d7b..3b07e3b 100644
--- a/2004/i/nono/src/ovision/group.cc
+++ b/2004/i/nono/src/ovision/group.cc
@@ -70,15 +70,15 @@ void Group::Plague(int type, unsigned char numColor, int x, int y) {
// TODO ajouter une inertie ?
// Parcours de l'objet trouve de haut en bas
- while ((xmax < width-1)&& (tabSegm[(++xmax)+y*width] == numColor)) {}
- while ((xmin > 0) && (tabSegm[(--xmin)+y*width] == numColor)) {}
- while ((ymax < height-1) && (tabSegm[x+(++ymax)*width] == numColor)) {}
- while ((ymin > 0) && (tabSegm[x+(--ymin)*width] == numColor)) {}
+ while ((xmax < img->width-1)&& (tabSegm[(++xmax)+y* img->width] == numColor)) {}
+ while ((xmin > 0) && (tabSegm[(--xmin)+y* img->width] == numColor)) {}
+ while ((ymax < img->height-1) && (tabSegm[x+(++ymax)* img->width] == numColor)) {}
+ while ((ymin > 0) && (tabSegm[x+(--ymin)* img->width] == numColor)) {}
// Verification la validite des entrees
-/* if ((xmin < 0) || (xmin > width))
+/* if ((xmin < 0) || (xmin > img->width))
xmin = 0;
- if ((xmax > img->width) || (xmax < 0))
+ if ((xmax > img->img->width) || (xmax < 0))
xmax = img->width;
if ((ymin < 0) || (ymin > height))
ymin = 0;
@@ -104,7 +104,7 @@ void Group::Plague(int type, unsigned char numColor, int x, int y) {
ZONE *pLast=NULL;
while (pCur) {
// si on a deja ce groupe on actualise les donnees du groupe
- if ((numColor == pCur->idColor) && (abs(pCur->centerx - centerx) <= DELTA) && (abs(pCur->centery - centery) <= DELTA)) {
+ if ((numColor == pCur->idColor) && (abs(pCur->centerx - centerx) <= PRECISION) && (abs(pCur->centery - centery) <= PRECISION)) {
if (xmin < pCur->xmin) pCur->xmin = xmin;
if (xmax > pCur->xmax) pCur->xmax = xmax;
if (ymin < pCur->ymin) pCur->ymin = ymin;
@@ -175,7 +175,7 @@ void Group::ShowZones() {
}
pCur = zoneListGoal;
- cout << "Groupes balles:" << endl;
+ cout << "Groupes poteaux:" << endl;
while(pCur) {
printf("%u %i %i %i %i\n", pCur->idColor, pCur->xmin, pCur->xmax, pCur->ymin, pCur->ymax);
pCur = pCur->next;
@@ -187,15 +187,16 @@ void Group::ShowZones() {
/// @param numColor numero de la couleur a trouver
void Group::JumpPoints(unsigned char numColor) {
+ zoneListBall = NULL;
tabSegm = segm->tabSegm;
// Initialisation de la couleur a chercher
numColor = segm->index[numColor];
// Parcours d'une partie des pixels de l'image
- for (int x=0; x<width; x+=10) {
- for (int y=0; y<height; y+=10) {
- if (tabSegm[y*width+x] == numColor)
+ for (int x=0; x<img->width; x+=10) {
+ for (int y=0; y<img->height; y+=10) {
+ if (tabSegm[y*img->width+x] == numColor)
{
Plague(BALL, numColor, x, y);
}
@@ -229,7 +230,7 @@ void Group::TabOut() {
// Remplissage de la zone avec une couleur
for(int i=pCur->xmin; i<pCur->xmax; i++)
for (int j=pCur->ymin; j<pCur->ymax; j++)
- tabOut[j*img->width+i] = pCur->idColor+1;
+ tabOut[j* img->width+i] = pCur->idColor+1;
pCur = pCur->next;
}