[C] pbm d'installation eclipse pour c/c++

Résolu/Fermé
Utilisateur anonyme - 4 juin 2007 à 13:52
 Silent Eagle - 27 oct. 2011 à 14:55
Bonjour,
j'ai un petit souci d'installation avec Eclipse 3.2.2
Il me l'installe correctement mais je ne peux pas programmer en C. J'ai bien installé CDT mais ca ne marche tjs pas. Si kk1 a une idée ca pourrait me depanner.
Merci
A voir également:

8 réponses

essaye ce lien :

http://wiki.eistiens.net/w/Le_C_sous_Windows_avec_Eclipse

@yopaparis : ça peut peut-être fonctionner aussi pour codeBlock (tu as insMinGW mais il faut aussi installer Msys et initialiser les variables d'environnement ).
1
Effectivement , merci pour ce lien qui est très intéressant.
Et en fait j'avais réussi à installer CDT et à le faire fonctionner mais je e me souviens plus comment. Et depuis j'ai réinstallé mon PC et pas refais de C mais je vais probablement m'y remettre bientôt.

Bonne journée et bon code à tous.
0
Lien mort...
0
l'adresse de la page à changer maintenant c'est :
http://wiki.eistiens.net/wiki/Le_C_sous_Windows_avec_Eclipse
0
il faut aussi installer ton compilateur. par exemple MinGW. regarde dans le tuto d'eclipse c'est tout expliquer avec les liens.

Pour ma part, j'ai aussi un soucis. J'ai fais l'install comme ils le disaient sur le tuto et quand je compile j'ai comme erreur:

**** Build of configuration MinGW GCC for project test1 ****


(Exec error:Launching failed)


.. J'ai tout reoris mais ça marche toujors pas. Je suppose que j'au du oublier de co,figurer un truc.. Quelqu'un pourrait m'aider?
0
Utilisateur anonyme
5 janv. 2008 à 13:21
J'ai le meme soucis mais seulement quand je lance le debug. Sinon la compilation a l'air de marcher mais quand j'exécute un programme dans la console c'est du n'importe quoi. Par contre si je l'execute avec l'invite de commande windows ca marche tres bien. Il me semble qu'il y a un parametrage de variables a faire mais ou et comment??

Merci pour votre aide
0
bonjour,
j'ai moi aussi le même souci, je ne trouve pas l'endroit où je pourrai indiquer le chemin d'accès au répertoire MinGW/bin qui contient gcc, g++ et tous les autres fichiers binaires qui permettent de compiler les fichiers C ou C++.

Sachant que j'ai codeblocks sur le PC et que MInGW se trouve du coup dans C:\Program Files\CodeBlocks\MinGW\bin.

Eclipse à l'air puissant mais pas aisé à paramétrer.

Si quelqu'un a une idée merci de nous filer un petit coup demain.

Merci par avance.

Cédric
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Utilisateur anonyme
20 janv. 2009 à 12:51
Super ton site merci. J'ai jamais installé eclipse aussi vite
0
Je confirme, le meilleur tuto que j'ai trouvé.
Je remet le lien car celui du post précédent pointe sur un 404
http://wiki.eistiens.net/wiki/Le_C_sous_Windows_avec_Eclipse
0
otakuu Messages postés 302 Date d'inscription dimanche 14 octobre 2007 Statut Membre Dernière intervention 13 mai 2014 38
22 juil. 2009 à 22:32
bonjour,
merci pour le lien, j'ai suivi les meme etapes mais a la fin ca ne marche pas toujours pas meme pour la compilation ca ne reconnais pas les bibliotheque stdio.h et stdlib.h ce me met des erreur : stdlib.h: no such file or directory.
ca fait 2 jours que j'essai de faire marcher c/c++ sous eclipse et a chaque fois rien :-[
0
hanoun29 Messages postés 1 Date d'inscription lundi 8 mars 2010 Statut Membre Dernière intervention 9 mars 2010
9 mars 2010 à 14:34
Bonjour tt le monde:
notre thème est le contour actif (snake) et en utilisant les agents (chaque agent est responsable à une point de snake) sous la plate forme jade ,le langage utilisé java ,voici notre code source:
package info;
//import info.Cadre1.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.table.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
import java.applet.*;
import info.Cadre1.*;
import info.FiltreSobel.*;
import info.AvancementEvent.*;
 
import java.util.Vector;
public class Snake extends FiltreAvancement{
Point tab_point[]=new Point[100];
Point tab_vois[]=new Point[100];
public void greedy(int Xs,int Ys,int taille_filtre,int Nb_Point,double Rayon,int criter_arret,float p_s,float coef_eng_cont,float coef_eng_cour,float coef_eng_bal,float coef_eng_gra,int seuil)  { 
int Nb_vois=taille_filtre*taille_filtre;
float energ_cont[]=new float[1000];
float ener_cour[]=new float[1000];
int ener_grad[][]=new int[1000][1000];
float ener_ballon[]=new float[1000];
float ener_total[]=new float[1000];
 
 
//BufferedImage imagee[];
File b1[]=null;
int im=0;
int w = Cadre1.imageF[0].getWidth(null);
int h = Cadre1.imageF[0].getHeight(null);
//imagee=new BufferedImage [100];
Object [][]col=new Object[100][100];
//String[] titreColonnes = { "Image","nb iteration", "Temps execution La Methode1"};
//table.jTable1 = new JTable(col,titreColonnes);
File fr=new File("Resultat Snake");
if(fr.exists())
        {
        	b1=fr.listFiles();
        	for(int i=0;i < b1.length ;i++)
            {
        	     b1[i].delete();
        	}//fr.delete();
        }
        //	
        else fr.mkdir();
im=0;{
//Calendar now = Calendar.getInstance();
//int mm = now.get(Calendar.MINUTE);
//int hh = now.get(Calendar.SECOND);
//int ss = now.get(Calendar.MILLISECOND);
///////////////////////////////////////////////////////////////////////////////////////////
FiltreSobel s = new FiltreSobel();
s.filtrerImage(Cadre1.image[0],true,seuil);
for (int i = 0; i <Cadre1.image[im].getWidth(null); i++) {
for (int j = 0; j < Cadre1.image[im].getHeight(null); j++) {
ener_grad[i][j] =s.pf[i][j];
}
}
//////////////Normalisation de gradient/////////////////////////////////////////////////////
       /* int w = Cadre1.imagee[im].getWidth(null);
        int h = Cadre1.imageFiltre_sobel[im].getHeight(null);*/
        int min_ene_grd = minimum1(ener_grad, w, h);
        int max_ene_grd = calcMaximum1(ener_grad, w, h);
        for (int i = 0; i < w; i++) {
          for (int  j = 0; j < h; j++) {
            ener_grad[i][j] = (ener_grad[i][j] - min_ene_grd)/(max_ene_grd - min_ene_grd);
          }
        }
///////////////////////////////////////////////////////////////////////////////////////////////
        int i, v;
        Graphics g = ContourActif.paneauImage[im].getGraphics();
        double alpha = 2 * (Math.PI) / Nb_Point;
        for (int nb = 0; nb < Nb_Point; nb++) {
          tab_point[nb] = new Point( (int) (Xs - Math.sin(alpha * (nb)) * Rayon),(int) (Ys - Math.cos(alpha * (nb)) * Rayon));
        }
 boolean check=ContourActif.jCheckBox2.isSelected();
if(check)
{       
for (int nb = 0; nb < Nb_Point; nb++) {
//if (nb % 2 == 0)
//{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.RED.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.RED.getRGB());	
}//}
//else
/*{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.RED.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.RED.getRGB());	
}}*/
}
g.drawImage(Cadre1.imageF[im], 0, 0, null);}
////////////////////////////debut algo greedy1111111111111/////////////////////////////////////////////////////////////////////////////////////
 
        int iteration = 0;
        int nb1;int ps=0;
while (iteration < criter_arret && ps<p_s/100) {
	ps=0;
          for (nb1 = 0; nb1 < Nb_Point; nb1++) {
          	tab_vois=new Point[Nb_vois+1];
            tab_vois = voisinage(nb1, taille_filtre);
            /* for (int nb=0; nb<taille_filtre*taille_filtre; nb++) {
             System.out.println("vois"+tab_vois[nb1]);
             }*/
// System.out.println("////////////////////////////////////////////////");
///////////////////////////////distance moyenne///////////////////////////////////////////////////////////////////////////////////
            double D_M = 0;
            int indexD, point, point_1;
            double d_m = 0;
            for (indexD = 0; indexD < Nb_Point; indexD++) {
              if (indexD == Nb_Point - 1) {
                point = Nb_Point - 1;
                point_1 = 0;
              }
              else {
                point = indexD;
                point_1 = indexD + 1;
              }
              d_m = d_m +Math.sqrt(Math.pow( (tab_point[point].x -tab_point[point_1].x), 2) +Math.pow( (tab_point[point].y -tab_point[point_1].y), 2));
            }
            d_m = d_m / Nb_Point;
/////////////////////////////////////Calcul des  energies/////////////////////////////////////////////////////////////////////////
//////////////////////////////////energie de continuite///////////////////////////////////////////////////////////////////////////
            for (v = 0; v < taille_filtre * taille_filtre; v++) {
              int point_AR; //int d=taille*taille;
              if (nb1 == 0) {
                point_AR = Nb_Point - 1;
              }
              else {
                if (nb1 == Nb_Point - 1) {
                  point_AR = nb1 - 1;
                }
                else {
                  point_AR = nb1 - 1;
                }
              }
//**** 0.5 (distance moyenne -la racine de [(Xi-Xi-1)2 + (Yi-Yi-1)]) *********
               energ_cont[v] = (float) (0.5 *Math.abs(d_m -(Math.sqrt(Math.pow( (tab_point[point_AR].x - tab_vois[v].x), 2) +Math.pow( (tab_point[point_AR].y - tab_vois[v].y), 2)))));
//System.out.println("energie continuite"+"  "+energ_cont[v]);
///////////////////// ///////////////////////energie courbure///////////////////////////////////////////////////////////////////////
              int point_AV;
              if (nb1 == 0) {
                point_AR = Nb_Point - 1;
                point_AV = nb1 + 1;
              }
              else {
                if (nb1 == Nb_Point - 1) {
                  point_AR = nb1 - 1;
                  point_AV = 0;
                }
                else {
                  if (nb1 == Nb_Point - 2) {
                    point_AR = nb1 - 1;
                    point_AV = nb1 + 1;
                  }
                  else {
                    if (nb1 == 1) {
                      point_AR = nb1 - 1;
                      point_AV = nb1 + 1;
                    }
                    else {
                      point_AR = nb1 - 1;
                      point_AV = nb1 + 1;
                    }
                  }
                }
              }
//****0.5[(Xi-1 -2Xi +Xi+1)  +   (Yi-1  -2Yi +Yi+1)]****
ener_cour[v] = (float) (0.5 *(Math.pow( (tab_point[point_AR].x -2 * (tab_vois[v].x) + tab_point[point_AV].x), 2) +Math.pow(tab_point[point_AR].y -2 * tab_vois[v].y +tab_point[point_AV].y, 2)));
//System.out.println("energie courbure"+"  "+ener_cour[v]);
//////////////////////////////////////////energie de ballon////////////////////////////////////////////////////////////////////////
ener_ballon[v] = (tab_vois[v].x - Xs) *(tab_vois[v].x - tab_point[nb1].x) +(tab_vois[v].y - Ys) * (tab_vois[v].y - tab_point[nb1].y);
//System.out.println("energie ballon"+"  "+ener_ballon[v]);?????????????????????
            } //vois
//System.out.println("//////////////////////////");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////Normalisation des energies/////////////////////////
            float min_eng_cont = minimum(energ_cont,taille_filtre * taille_filtre);
            float max_eng_cont = calcMaximum(energ_cont);
            float min_eng_cour = minimum(ener_cour,taille_filtre * taille_filtre);
            float max_eng_cour = calcMaximum(ener_cour);
            float min_eng_bal = minimum(ener_ballon,taille_filtre * taille_filtre);
            float max_eng_bal = calcMaximum(ener_ballon);
            for (v = 0; v < taille_filtre * taille_filtre; v++) {
              energ_cont[v] = ( (energ_cont[v] - min_eng_cont) /(max_eng_cont - min_eng_cont));
              ener_cour[v] = (ener_cour[v] - min_eng_cour) /(max_eng_cour - min_eng_cour);
              ener_ballon[v] = (ener_ballon[v] - min_eng_bal) /(max_eng_bal - min_eng_bal);
              //ener_total[v] = (coef_eng_cont * energ_cont[v]) +(coef_eng_cour * ener_cour[v]) +( (coef_eng_bal) * ener_ballon[v]) +(coef_eng_gra * ener_grad[tab_vois[v].x][tab_vois[v].y]);
            }
///////////////////////////////////////////////////////////////////////
for (int v1 = 0; v1 < taille_filtre * taille_filtre; v1++) {
          
              ener_total[v1] = (coef_eng_cont * energ_cont[v1]) +(coef_eng_cour * ener_cour[v1]) +( (coef_eng_bal) * ener_ballon[v1]) +(coef_eng_gra * ener_grad[tab_vois[v1].x][tab_vois[v1].y]);
            }
            int min = minimum2(ener_total, taille_filtre * taille_filtre);           
                int r = (tab_vois[min].x);
                int f = (tab_vois[min].y);
                if (r ==tab_point[nb1].x && f ==tab_point[nb1].y ) {
ps=ps+1;
}else tab_point[nb1] = new Point(r, f);
} //nb1
ps=ps/Nb_Point;
check=ContourActif.jCheckBox1.isSelected();
if(check)
{
for (int nb = 0; nb < Nb_Point; nb++)
{
if (nb % 2 == 0)
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.red.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.red.getRGB());	
}}
else
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.GREEN.getRGB());
 
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.GREEN.getRGB());	
}}
}
g.drawImage(Cadre1.imageF[im], 0, 0, null);}
else 
{
if(ps >=p_s/100 || iteration==criter_arret-1)
{
for (int nb = 0; nb < Nb_Point; nb++)
{
if (nb % 2 == 0)
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.red.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.red.getRGB());	
}}
else
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.GREEN.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.GREEN.getRGB());	
}}}}
g.drawImage(Cadre1.imageF[im], 0, 0, null);}
iteration++;
} //iteration
table.jTable1.setValueAt(im,im,0);
table.jTable1.setValueAt(iteration,im,1);
Calendar dateDepart = Calendar.getInstance();
int m =  dateDepart.get (Calendar.MINUTE);
int h1 = dateDepart.get(Calendar.SECOND);
int s1 = dateDepart.get(Calendar.MILLISECOND);
//String tims=Integer.toString(s1-ss);
//String timh=Integer.toString(h1-hh);
//String timm=Integer.toString(m-mm);
//table.jTable1.setValueAt(timm+"M"+" - "+timh+"S"+" - "+tims+"MS",im,2);
 
Enregistrement e=new Enregistrement(); 
                   File t=new File("Resultat methode1\\"+"image"+im+".png");                                    
                   e.enregistrer(1,Cadre1.imageF[im],t);
}//tr2ai_image0
int sumX=0,sumY=0;
for (int i = 0; i < Nb_Point; i++)         
{
sumX=sumX+tab_point[i].x;
sumY=sumY+tab_point[i].y;	
}
//Xs=sumX/Nb_Point;
//Ys=sumY/Nb_Point;
/*for ( im = 1; im < (Cadre1.b.length)-1; im++)
{
Calendar now = Calendar.getInstance();
int mm = now.get(Calendar.MINUTE);
int hh = now.get(Calendar.SECOND);
int ss = now.get(Calendar.MILLISECOND);
//imagee[im] = Cadre1.imageF[im];
FiltreSobel s=new FiltreSobel();
s.filtrerImage(Cadre1.imageF[im],true,seuil);
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
ener_grad[i][j] = s.pf[i][j];
//System.out.print(ener_grad1[i][j]);
}}
//////////////Normalisation de gradient/////////////////////////////////////////////////////
        int min_ene_grd = minimum1(ener_grad, w, h);
        int max_ene_grd = calcMaximum1(ener_grad, w, h);
        for (int i = 0; i < w; i++) {
          for (int j = 0; j < h; j++) {
            ener_grad[i][j] = (ener_grad[i][j] - min_ene_grd) /
                (max_ene_grd - min_ene_grd);
          }
        }
///////////////////////////////////////////////////////////////////////////////////////////////
int i, v;
Graphics g1 = Cadre1.panneauImage[im].getGraphics();
double alpha = 2 * (Math.PI) / Nb_Point;
for (int nb = 0; nb < Nb_Point; nb++) {
tab_point[nb] = new Point( (int) (Xs - Math.sin(alpha * (nb)) * Rayon),(int) (Ys - Math.cos(alpha * (nb)) * Rayon));
}
boolean check=ContourActif.jCheckBox2.isSelected();
if(check && im!=0)
{
for (int nb = 0; nb < Nb_Point; nb++) {
if (nb % 2 == 0)
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.BLUE.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.BLUE.getRGB());	
}}
else
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.BLUE.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.BLUE.getRGB());	
}}
}
g1.drawImage(Cadre1.imageF[im], 0, 0, null);}
////////////////////////////debut algo greedy22222/////////////////////////////////////////////////////////////////////////////////////
/*int iteration = 0;int nb1, ps=0;
while (iteration < criter_arret && ps < p_s/100) {
ps=0;
for (nb1 = 0; nb1 < Nb_Point; nb1++) {
	tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb1, taille_filtre);
/* for (int nb=0; nb<taille_filtre*taille_filtre; nb++) {
 System.out.println("vois"+tab_vois[nb1]);
  }*/
// System.out.println("////////////////////////////////////////////////");
///////////////////////////////distance moyenne///////////////////////////////////////////////////////////////////////////////////
/*double D_M = 0;
int indexD, point, point_1;
double d_m = 0;
for (indexD = 0; indexD < Nb_Point; indexD++) {
if (indexD == Nb_Point - 1) {
point = Nb_Point - 1;
point_1 = 0;
}
else {
point = indexD;
point_1 = indexD + 1;
}
d_m = d_m +
Math.sqrt(Math.pow( (tab_point[point].x-tab_point[point_1].x), 2) +Math.pow( (tab_point[point].y -tab_point[point_1].y), 2));
}
d_m = d_m / Nb_Point;
/////////////////////////////////////Calcul des  energies/////////////////////////////////////////////////////////////////////////
//////////////////////////////////energie de continuite///////////////////////////////////////////////////////////////////////////
for (v = 0; v < taille_filtre * taille_filtre; v++) {
int point_AR; 
if (nb1 == 0) {
point_AR = Nb_Point - 1;
}
else {
if (nb1 == Nb_Point - 1) {
point_AR = nb1 - 1;
}
else {
point_AR = nb1 - 1;
}
}
//**** 0.5 (distance moyenne -la racine de [(Xi-Xi-1)2 + (Yi-Yi-1)]) *********
energ_cont[v] = (float) (0.5 *Math.abs(d_m -(Math.sqrt(Math.pow( (tab_point[point_AR].x - tab_vois[v].x), 2) +Math.pow( (tab_point[point_AR].y - tab_vois[v].y), 2)))));
//System.out.println("energie continuite"+"  "+energ_cont[v]);
///////////////////// ///////////////////////energie courbure///////////////////////////////////////////////////////////////////////
int point_AV;
if (nb1 == 0) {
point_AR = Nb_Point - 1;
point_AV = nb1 + 1;
}
else {
if (nb1 == Nb_Point - 1) {
point_AR = nb1 - 1;
point_AV = 0;
}
else {
if (nb1 == Nb_Point - 2) {
point_AR = nb1 - 1;
point_AV = nb1 + 1;
}
else {
if (nb1 == 1) {
point_AR = nb1 - 1;
point_AV = nb1 + 1;
}
else {
point_AR = nb1 - 1;
 point_AV = nb1 + 1;
 }}}}
//****0.5[(Xi-1 -2Xi +Xi+1)  +   (Yi-1  -2Yi +Yi+1)]****
ener_cour[v] = (float) (0.5*(Math.pow((tab_point[point_AR].x -2*(tab_vois[v].x) + tab_point[point_AV].x), 2) +Math.pow(tab_point[point_AR].y -2 * tab_vois[v].y +tab_point[point_AV].y, 2)));
//System.out.println("energie courbure"+"  "+ener_cour[v]);
//////////////////////////////////////////energie de ballon////////////////////////////////////////////////////////////////////////
ener_ballon[v] = (tab_vois[v].x - Xs) *(tab_vois[v].x - tab_point[nb1].x) +(tab_vois[v].y - Ys) * (tab_vois[v].y - tab_point[nb1].y);
//System.out.println("energie ballon"+"  "+ener_ballon[v]);
} //vois
//System.out.println("//////////////////////////");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////Normalisation des energies/////////////////////////
float min_eng_cont = minimum(energ_cont,taille_filtre * taille_filtre);
float max_eng_cont = calcMaximum(energ_cont);
float min_eng_cour = minimum(ener_cour,taille_filtre * taille_filtre);
float max_eng_cour = calcMaximum(ener_cour);
float min_eng_bal = minimum(ener_ballon,taille_filtre * taille_filtre);
float max_eng_bal = calcMaximum(ener_ballon);
for (v = 0; v < taille_filtre * taille_filtre; v++) {
energ_cont[v] = ( (energ_cont[v] - min_eng_cont) /(max_eng_cont - min_eng_cont));
ener_cour[v] = (ener_cour[v] - min_eng_cour) /(max_eng_cour - min_eng_cour);
ener_ballon[v] = (ener_ballon[v] - min_eng_bal) /(max_eng_bal - min_eng_bal);
ener_total[v] = (coef_eng_cont * energ_cont[v]) +(coef_eng_cour * ener_cour[v]) +( (coef_eng_bal) * ener_ballon[v]) +(coef_eng_gra * ener_grad[tab_vois[v].x][tab_vois[v].y]);
}
///////////////////////////////////////////////////////////////////////
int min = minimum2(ener_total, taille_filtre * taille_filtre);
int r = (tab_vois[min].x);
int f = (tab_vois[min].y);
if (r ==tab_point[nb1].x && f ==tab_point[nb1].y ) {
ps=ps+1;
}else 
{
if(r!=0 && f!=0 && r!=w && f!=h)
tab_point[nb1] = new Point(r, f);}
} //nb1
ps=ps/Nb_Point;
 check=ContourActif.jCheckBox1.isSelected();
if(check)
{
for (int nb = 0; nb < Nb_Point; nb++)
{
if (nb % 2 == 0)
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.red.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.red.getRGB());	
}}
else
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.GREEN.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.GREEN.getRGB());	
}}
}
g1.drawImage(Cadre1.imageF[im], 0, 0, null);}
else 
{
if(ps >=p_s/100 || iteration==criter_arret-1)
{
	for (int nb = 0; nb < Nb_Point; nb++)
{
if (nb % 2 == 0)
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.red.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.red.getRGB());	
}}
else
{
Cadre1.imageF[im].setRGB(tab_point[nb].x, tab_point[nb].y,Color.GREEN.getRGB());
tab_vois=new Point[Nb_vois+1];
tab_vois = voisinage(nb, 3);
for (v = 0; v < 9; v++) {
Cadre1.imageF[im].setRGB(tab_vois[v].x, tab_vois[v].y,Color.GREEN.getRGB());	
}}}}
g1.drawImage(Cadre1.imageF[im], 0, 0, null);}		
iteration++;
} //iteration*/
//table.jTable1.setValueAt(im,im,0);
//table.jTable1.setValueAt(iteration,im,1);
//Calendar dateDepart = Calendar.getInstance();
//int m =  dateDepart.get (Calendar.MINUTE);
//int h1 = dateDepart.get(Calendar.SECOND);
//int s1 = dateDepart.get(Calendar.MILLISECOND);
//String tims=Integer.toString(s1-ss);
//String timh=Integer.toString(h1-hh);
//String timm=Integer.toString(m-mm);
//table.jTable1.setValueAt(timm+"M"+" - "+timh+"S"+" - "+tims+"MS",im,2);
// sumX=0;sumY=0;
//for ( i = 0; i < Nb_Point; i++)         
//{
//sumX=sumX+tab_point[i].x;
//sumY=sumY+tab_point[i].y;	
//}
//Xs=sumX/Nb_Point;
//Ys=sumY/Nb_Point;
//Cadre1.imagee[im]=imagee[im];
 
 
/*Enregistrement e=new Enregistrement(); 
                   File t=new File("Resultat methode1\\"+"image"+im+".png");                                    
                   e.enregistrer(1,Cadre1.imageF[im],t);
} trai_image*/  	
}//fin void snake
/////////////////////////////// METHODE POUR INITIALISATION///////
public void initialise(int Nb_point,int xc,int yc,int R)
{Point tab_vois[]=new Point[9];
Graphics g1 = Cadre1.panneauImage[0].getGraphics();
double alpha = 2 * (Math.PI) / Nb_point;
for (int nb = 0; nb < Nb_point; nb++) {
tab_point[nb] = new Point( (int) (xc - Math.sin(alpha * (nb)) * R),(int) (yc - Math.cos(alpha * (nb)) * R));
}
for (int nb = 0; nb < Nb_point; nb++) {
if (nb % 2 == 0)
{
Cadre1.imageF[0].setRGB(tab_point[nb].x, tab_point[nb].y,Color.BLUE.getRGB());
tab_vois = voisinage(nb, 3);
for (int v = 0; v < 9; v++) {
Cadre1.imageF[0].setRGB(tab_vois[v].x, tab_vois[v].y,Color.BLUE.getRGB());	
}}
else
{
Cadre1.imageF[0].setRGB(tab_point[nb].x, tab_point[nb].y,Color.BLUE.getRGB());
tab_vois = voisinage(nb, 3);
for (int v = 0; v < 9; v++) {
Cadre1.imageF[0].setRGB(tab_vois[v].x, tab_vois[v].y,Color.BLUE.getRGB());	
}}
}
g1.drawImage(Cadre1.imageF[0], 0, 0, null);	
}//////////////////////
/*public void TempsExecution()
{
 table  cadre2;
 
       boolean packFrame = false;
                       cadre2=new table ();
                      if (packFrame) {
                      cadre2.pack();
                                  }
                      else {cadre2.validate(); }
                            //Centrer la fentre
                      Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                      Dimension frameSize = cadre2.getSize();
                      if (frameSize.height > screenSize.height) {
                      frameSize.height = screenSize.height;
                                                         }
                     if (frameSize.width > screenSize.width) {
                      frameSize.width = screenSize.width;
                                                       }
                      cadre2.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
                      cadre2.setVisible(true);
}*/
public Point []voisinage(int point,int ta){//////METHODE DE VOISINAGE
int bix,biy,bsx,bsy,j,v = 0;
bix = tab_point[point].x -(int)(ta/2);
bsx =  tab_point[point].x +(int) (ta/2) ;
Point tab_v[]=new Point[100];
biy = tab_point[point].y - (int)(ta/2);
bsy = tab_point[point].y +(int)(ta/2);
for(int i = bix ; i <= bsx ; i++)
{
for(j = biy ; j <= bsy ; j++)
{
tab_v[v]=new Point(i,j);v++;
}}return tab_v;}
/////////////////////////////////////////////METHODE PR CALCUL MAX
float calcMaximum(float mesnombres[])
{float maxvaleur = 0;
for (int ii = 0; ii < mesnombres.length; ii++)
{if (mesnombres[ii] > maxvaleur){maxvaleur = mesnombres[ii];}
}return maxvaleur;}
//////////////////////////////////////////////////////////////METHODE PR CALCUL MIN------------------------------------------------------
float minimum(float[] t,int taille) {
float minvaleur =t[0];
for (int i = 0; i < taille; i++)
{
if (t[i]<minvaleur){minvaleur = t[i];}
}return minvaleur;}
//////////////////////////////////////////////////////////////
int minimum2(float[] t,int taille) {
int indice=taille/2;;
float minvaleur =t[indice];
for (int i = 0; i < taille; i++)
{
if (t[i]<minvaleur){minvaleur = t[i];indice=i;}
}return indice;}
//////////////////////////////////////////////MAX DE MATRICE////////////////
int calcMaximum1(int mesnombres[][],int w,int h)
{int maxvaleur = 0;
for (int ii = 0; ii < w; ii++)
{ for (int jj = 0; jj < h; jj++)
{if (mesnombres[ii][jj] > maxvaleur){maxvaleur = mesnombres[ii][jj];}
}}return maxvaleur;}
///////////////////////////////MIN DE MAT///////////////////////////////
int minimum1(int[][] t,int taille,int taille1) {
int minvaleur =t[0][0];
for (int i = 0; i < taille; i++)
{for (int j = 0; j < taille1; j++){
if (t[i][j]<minvaleur){minvaleur = t[i][j];}
}}return minvaleur;}
//////////////////////////////////////////////////////////////
 
 }//fin classe snake

merci d' avance
0