Bonjour,

J'ai un programme java dans lequel est défini un cercle (ce cercle est dessiner point par point en liant deux points distant de trois pixels)
voici le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 void drawCircle(Graphics g) {
        int i,j,i1,j1;
        g.setColor(Color.green);
 
        for(double th=0.;th<359.;th+=3.) {
            i=(int)Math.round((circlex+circler*Math.cos(th*Math.PI/180.)+x0)*50.)+xImin;
            j=(int)Math.round((y0-circley-circler*Math.sin(th*Math.PI/180.))*50.)+yImin;
            i1=(int)Math.round((circlex+circler*Math.cos((th+3.)*Math.PI/180.)+x0)*50.)+xImin;
            j1=(int)Math.round((y0-circley-circler*Math.sin((th+3.)*Math.PI/180.))*50.)+yImin;
            if((i+i1)/2>=xImin && (i+i1)/2<=xImax && (j+j1)/2>=yImin && (j+j1)/2<=yImax) g.drawLine(i,j,i1,j1);
        }
        if(kuttaOn) {
            i=(int)Math.round((circlex+circler*Math.cos(kuttat)*.95+x0)*50.)+xImin;
            j=(int)Math.round((y0-circley-circler*Math.sin(kuttat)*.95)*50.)+yImin;
            i1=(int)Math.round((circlex+circler*Math.cos(kuttat)*1.05+x0)*50.)+xImin;
            j1=(int)Math.round((y0-circley-circler*Math.sin(kuttat)*1.05)*50.)+yImin;
            if((i+i1)/2>=xImin && (i+i1)/2<=xImax && (j+j1)/2>=yImin && (j+j1)/2<=yImax) g.drawLine(i,j,i1,j1);
        }
    }
je voudrai remplacer ce cercle par un simple losange

Si quelqu'un peut m'aider...
Merci d'avance