Accueil import java.applet.*; import java.awt.*; import java.awt.event.*; import java.lang.*; public class Clotho1 extends java.applet.Applet implements ActionListener { Button DetClo,DetOve,ExOve; String src,noticeA,noticeB; Button Ex[] = new Button[4]; TextField T[] = new TextField[14]; TextArea TA, TB; float R,dR,Xc,Yc,X1,Y1,X2,Y2,Xp,Yp,Gt,ad,bd,Xh,Yh,Xb,Yb; float R1,Xc1,Yc1,R2,Xc2,Yc2,Ri,Xci,Yci; float xj1,yj1,xj2,yj2,xk1,yk1,xk2,yk2,xS,yS; double dC,dc,dK,xc1,yc1,xc2,yc2,Fi,Fj,G1,G2,g1,g2,dfi,dfj,xi,yi; double xi1,yi1,xi2,yi2,dx,Gt1,Gt2,DC; double A,B,C,Ad,Bd,Cd,Dd,Ac,dA,L,t,T1,T2,r,x,y,x0,y0,Z1,Z2,Ae; double x1,y1,x2,y2,xo1,yo1,xl1,yl1,xo2,yo2,xl2,yl2,Xl,Yl,ZOOM; double Xo1,Yo1,Xl1,Xo2,Xl2,Yl1,Xu1,Xu2,xu1,yu1,xu2,yu2,angl,N,Xq,Yq; Label Lab1,Lab2; int R1i,R2i,Xc1i,Yc1i,Xc2i,Yc2i,Xo1i,Yo1i,Xe1i,Ye1i,Xo2i,Yo2i,Xe2i,Ye2i; int Xt1i,Yt1i,Xt2i,Yt2i,xJ1,yJ1,xJ2,yJ2,xK1,yK1,xK2,yK2,xSi,ySi; int a,b,c,n,m,fac,xc,yc,Rj,xt,yt,Xcj,Ycj,X1j,Y1j,X2j,Y2j,Xpj,Ypj; int Ya1,Ya2,Ya3,Ya4,Yb1,Yb2,Yb3,Yb4,Xa1,Xa2,Xa3,Xa4,Li,Lj; int Xt1,Yt1,Xt2,Yt2,xv1,yv1,xv2,yv2,Axx,Axy,Xbi,Ybi; int[] tru1 = {1,2}; int[] tru2 = {1,3,4,5,6,7,8}; int[] tru3 = {1,3,4,9,10,11}; int[] tru4 = {1,3,4,12,13}; int[] fal1 = {3,4,5,6,7,8,9,10,11,12,13}; int[] fal2 = {2,9,10,11,12,13}; int[] fal3 = {2,5,6,7,8,12,13}; int[] fal4 = {2,5,6,7,8,9,10,11}; float[] Exp1 = {80,20}; float[] Exp2 = {60,65,110,-45,95,35,45}; float[] Exp3 = {485,95,-490,95,135,110}; float[] Exp4 = {140,170,105,(float)3.9,235}; float[] Exove = {400,130,-140,145,80,(float)71.5}; double[] Lw = new double[3]; double[] tw = new double[3]; double[] Xw1 = new double[3]; double[] Yw1 = new double[3]; double[] Xw2 = new double[3]; double[] Yw2 = new double[3]; int[] t1 = {0,85,245,480,480,295,295,480,480,295,295,480,295,415}; int[] t2 = {0,70,70,60,80,120,140,120,140,170,190,180,220,220}; int[] t3 = {0,160,380,380,160,380,380}; int[] t4 = {0,70,60,80,120,110,130}; int[] Xf = new int[100000]; int[] Yf = new int[100000]; int[] Xe = new int[100000]; int[] Ye = new int[100000]; float[] Xg = new float[100000]; float[] Yg = new float[100000]; float[] Xk = new float[100000]; float[] Yk = new float[100000]; boolean secan,KA1,KA2,KA3,KA4; boolean Detclo,Detove,Coup,CalOve,PaDeSo,KOve; Color background = new Color(150, 150, 255); public void init() { noticeA = " - NOTICE - \n"+ " Ce programme permet la détermi- \n"+ "nation d'une clothoïde entre un ali- \n"+ "gnement droit et un cercle de rayon \n"+ "connu. Bien entendu la droite et le \n"+ "cercle ne doivent être ni sécants ni \n"+ "tangents. \n"+ "Ce programme est extrêment simple \n"+ "à utiliser, il suffit de choisir l'exemple \n"+ "qui correspond au mode d'introduc- \n"+ "tion de vos données, et de rempla- \n"+ "cer les nombres de l'exemple par les \n"+ "votres. Pour lancer le calcul avec \n"+ "vos données vous devez après les \n"+ "avoir introduites presser la touche \n"+ "''Entrée'' de votre clavier. \n"; noticeB = " - NOTICE - \n"+ " Ce programme permet la détermination d'une \n"+ "clothoïde tangente à deux cercles de rayons et \n"+ "centres connus. Le cercle de plus petit rayon doit \n"+ "être contenu dans celui de plus grand rayon, et leurs \n"+ "centres ne doivent pas être communs. De plus la \n"+ "distance entre les deux cercles ne doit pas être \n"+ "trop importante pour que la longueur de la branche \n"+ "de clothoïde reste raisonnable. \n"; Font f,g; Color background = new Color(150, 150, 255); setBackground(background); this.setLayout(null); add(Lab1=new Label("L A C L O T H O I D E")); Lab1.setBackground(Color.lightGray); Lab1.setBounds(200,5,205,20); add(Lab2=new Label("(Auteur Michel BERTEAU)")); Lab2.setForeground(Color.blue); Lab2.setBackground(Color.lightGray); Lab2.setBounds(430,10,145,15); add(DetClo = new Button("Détermination Clothoïde")); DetClo.addActionListener(this); DetClo.setBounds(100,30,285,20); add(DetOve = new Button("Détermination Ove")); DetOve.addActionListener(this); DetOve.setBounds(385,30,285,20); f = new java.awt.Font("Helvetica", Font.BOLD,18); g = new java.awt.Font("Helvetica", Font.PLAIN,12); Lab1.setFont(f); Lab2.setFont(g); }//init public void actionPerformed(ActionEvent evt) { Object source = evt.getSource(); if (source == DetClo) DetClo(); if (source == DetOve) DetOve(); if (Detclo) { if (KA1) { if (source == T[1]) Cas1(); if (source == T[2]) Cas1(); } if (KA2) { if (source == T[1]) Cas2(); if (source == T[3]) Cas2(); if (source == T[4]) Cas2(); if (source == T[5]) Cas2(); if (source == T[6]) Cas2(); if (source == T[7]) Cas2(); if (source == T[8]) Cas2(); } if (KA3) { if (source == T[1]) Cas3(); if (source == T[3]) Cas3(); if (source == T[4]) Cas3(); if (source == T[9]) Cas3(); if (source == T[10]) Cas3(); if (source == T[11]) Cas3(); } if (KA4) { if (source == T[1]) Cas4(); if (source == T[3]) Cas4(); if (source == T[4]) Cas4(); if (source == T[12]) Cas4(); if (source == T[13]) Cas4(); } if (source == T[1]) T[2].requestFocus(); if (source == T[2]) Cas1(); if (source == T[3]) T[4].requestFocus(); if (source == T[5]) T[6].requestFocus(); if (source == T[6]) T[7].requestFocus(); if (source == T[7]) T[8].requestFocus(); if (source == T[8]) Cas2(); if (source == T[9]) T[10].requestFocus(); if (source == T[10]) T[11].requestFocus(); if (source == T[11]) Cas3(); if (source == T[12]) T[13].requestFocus(); if (source == T[13]) Cas4(); if (source == Ex[0]) Exem1(); if (source == Ex[1]) Exem2(); if (source == Ex[2]) Exem3(); if (source == Ex[3]) Exem4(); }//Detclo if (Detove) { if (KOve) { if (source == T[1]) Casove(); if (source == T[2]) Casove(); if (source == T[3]) Casove(); if (source == T[4]) Casove(); if (source == T[5]) Casove(); if (source == T[6]) Casove(); if (source == ExOve) Exove(); } else { if (source == T[1]) T[2].requestFocus(); if (source == T[2]) T[3].requestFocus(); if (source == T[3]) T[4].requestFocus(); if (source == T[4]) T[5].requestFocus(); if (source == T[5]) T[6].requestFocus(); if (source == T[6]) Casove(); if (source == ExOve) Exove(); } }//Detove } public void DetClo() { DetClo.setBackground(background); DetOve.setBackground(Color.lightGray); if (Detclo) { for (int i=1;i<14;i++) { remove(T[i]); if (i<5) remove(Ex[i-1]); } remove(TA); }//Detclo if (Detove) { for (int i=1;i<7;i++) { remove(T[i]); } remove(ExOve); remove(TB); }//Detove KA1=KA2=KA3=KA4=false; CalOve = PaDeSo = secan = false; for (int i=0;i<14;i++) { if (i>0) add(T[i]=new TextField()); if (i>0) T[i].addActionListener(this); if (i>0) T[i].setBounds(t1[i], t2[i], 70, 20); if (i<4) add(Ex[i] = new Button("Exemple"+(i+1))); if (i<4) Ex[i].addActionListener(this); if (i<4) Ex[i].setBounds(500+i*65,220,62,20); if (i<4) Ex[i].setBackground(Color.yellow); } add(TA=new TextArea(noticeA)); TA.setBounds(560,55,205,155); TA.setBackground(background); Detclo = true; Detove = false; T[1].requestFocus(); repaint(); } public void DetOve() { DetOve.setBackground(background); DetClo.setBackground(Color.lightGray); if (Detclo) { for (int i=1;i<14;i++) { remove(T[i]); if (i<5) remove(Ex[i-1]); } remove(TA); }//Detclo if (Detove) { for (int i=1;i<7;i++) { remove(T[i]); } remove(ExOve); remove(TB); }//Detove CalOve = PaDeSo = Coup = false; KA1=KA2=KA3=KA4=false; for (int i=1;i<7;i++) { add(T[i]=new TextField()); T[i].addActionListener(this); T[i].setBounds(t3[i], t4[i], 70, 20); T[i].setText(""); } add(TB=new TextArea(noticeB)); TB.setBounds(455,55,310,125); TB.setBackground(background); add(ExOve = new Button("Exemple")); ExOve.addActionListener(this); ExOve.setBounds(562,182,70,18); Detove = true; Detclo = false; T[1].requestFocus(); repaint(); } public void Exove() { for (int i=0;i<6;i++) { T[i+1].setText(""+Exove[i]); } Casove(); } public void Casove() { double xe1,ye1,xe2,ye2,L1,L2; KOve = false; try { R1 = Float.valueOf (T[1].getText ()).floatValue (); Xc1 = Float.valueOf (T[2].getText ()).floatValue (); Yc1 = Float.valueOf (T[3].getText ()).floatValue (); R2 = Float.valueOf (T[4].getText ()).floatValue (); Xc2 = Float.valueOf (T[5].getText ()).floatValue (); Yc2 = Float.valueOf (T[6].getText ()).floatValue (); if (R1<R2) { Ri = R1; R1 = R2; R2 = Ri; Xci = Xc1; Xc1 = Xc2; Xc2 = Xci; Yci = Yc1; Yc1 = Yc2; Yc2 = Yci; } CalOve = true; }//try catch (NumberFormatException e) { CalOve = false; T[2].requestFocus(); } PaDeSo = false; dC = Math.sqrt((Xc1-Xc2)*(Xc1-Xc2)+(Yc1-Yc2)*(Yc1-Yc2)); dK = R1-R2-dC; if (dK<=0) Coup=true; else Coup=false; if (!Coup) { dA = Ac = 1; do { ye1 = xe1 = xe2 = ye2 = 0; L1 = Ac*Ac/R1; L2 = Ac*Ac/R2; T1 = L1*L1/(2*Ac*Ac); T2 = L2*L2/(2*Ac*Ac); fac = 1; int s = -1; A = Ac; for (n=1,m=1;n<10;n++,m+=2) { if (m-1>0) fac=fac*(m-1)*m; s *= -1; ye1 += L1*s*Math.pow(T1,2*n-1)/(4*n-1)/fac; xe1 += L1*s*Math.pow(T1,2*n-2)/(4*n-3)/(fac/m); ye2 += L2*s*Math.pow(T2,2*n-1)/(4*n-1)/fac; xe2 += L2*s*Math.pow(T2,2*n-2)/(4*n-3)/(fac/m); } xc1 = xe1-R1*Math.sin(T1); yc1 = ye1+R1*Math.cos(T1); xc2 = xe2-R2*Math.sin(T2); yc2 = ye2+R2*Math.cos(T2); dc = Math.sqrt((xc1-xc2)*(xc1-xc2)+(yc1-yc2)*(yc1-yc2)); if (T2>2.5) PaDeSo = true; if (dc>dC) Ac+=dA; else { dA = dA/2; Ac -= dA; } DC = Math.abs(dc-dC); if (PaDeSo) DC=0; }while (DC>0.000001); KOve = true; dx = Math.abs(Xc1-Xc2); if (dx>0.0001) Fi = Math.abs(Math.atan((Yc1-Yc2)/(Xc1-Xc2)))*200/Math.PI; if ((Xc1<Xc2)&(Yc1<Yc2)) G1 = 100-Fi; if ((Xc1>Xc2)&(Yc1<Yc2)) G1 = 300+Fi; if ((Xc1>Xc2)&(Yc1>=Yc2)) G1 = 300-Fi; if ((Xc1<Xc2)&(Yc1>=Yc2)) G1 = 100+Fi; if ((Yc1<Yc2)&(dx<0.0001)) G1 = 0; if ((Yc1>Yc2)&(dx<0.0001)) G1 = 200; Fj = Math.abs(Math.atan((yc1-yc2)/(xc1-xc2)))*200/Math.PI; if ((xc1<xc2)&(yc1<yc2)) g1 = 100-Fj; if ((xc1>xc2)&(yc1<yc2)) g1 = 300+Fj; if ((xc1>xc2)&(yc1>yc2)) g1 = 300-Fj; if ((xc1<xc2)&(yc1>yc2)) g1 = 100+Fj; dfi = (200-g1)*Math.PI/200; dfj = (200-G1)*Math.PI/200; Gt1 = G1-g1+100; if (Gt1<0) Gt1 = 400+Gt1; if (Gt1>400) Gt1 = Gt1-400; Gt2 = G1+g1-100; if (Gt2<0) Gt2 = 400+Gt1; if (Gt2>400) Gt2 = Gt2-400; Li = (int)Math.round(A*A/R2); Lj = (int)Math.round(A*A/R1); for (int i=0;i<Li;i++) { x = 0; y = 0; fac = 1; r = i*i/(2*A*A); for (n=1,m=1;n<10;n++,m+=2) { if (m-1>0) fac=fac*(m-1)*m; y += i*Math.pow(-1,n+1)*Math.pow(r,2*n-1)/(4*n-1)/fac; x += i*Math.pow(-1,n+1)*Math.pow(r,2*n-2)/(4*n-3)/(fac/m); } xi = (x-xc1)*Math.cos(dfi)+(y-yc1)*Math.sin(dfi); yi = (y-yc1)*Math.cos(dfi)-(x-xc1)*Math.sin(dfi); Xg[i] = (float)(xi*Math.cos(dfj)-yi*Math.sin(dfj)+Xc1); Yg[i] = (float)(xi*Math.sin(dfj)+yi*Math.cos(dfj)+Yc1); Xk[i] = (float)(-xi*Math.cos(dfj)-yi*Math.sin(dfj)+Xc1); Yk[i] = (float)(-xi*Math.sin(dfj)+yi*Math.cos(dfj)+Yc1); } Lw[0] = 0; Lw[1] = A*A/R1; Lw[2] = A*A/R2; tw[0] = 0; tw[1] = A*A/2/R1/R1; tw[2] = A*A/2/R2/R2; for (int i=0;i<3;i++) { x = 0; y = 0; fac = 1; r = tw[i]; for (n=1,m=1;n<10;n++,m+=2) { if (m-1>0) fac=fac*(m-1)*m; y += Lw[i]*Math.pow(-1,n+1)*Math.pow(r,2*n-1)/(4*n-1)/fac; x += Lw[i]*Math.pow(-1,n+1)*Math.pow(r,2*n-2)/(4*n-3)/(fac/m); } xi = (x-xc1)*Math.cos(dfi)+(y-yc1)*Math.sin(dfi); yi = (y-yc1)*Math.cos(dfi)-(x-xc1)*Math.sin(dfi); Xw1[i] = xi*Math.cos(dfj)-yi*Math.sin(dfj)+Xc1; Yw1[i] = xi*Math.sin(dfj)+yi*Math.cos(dfj)+Yc1; Xw2[i] = -xi*Math.cos(dfj)-yi*Math.sin(dfj)+Xc1; Yw2[i] = -xi*Math.sin(dfj)+yi*Math.cos(dfj)+Yc1; } xi1 = (-5000-xc1)*Math.cos(dfi)+(-yc1)*Math.sin(dfi); yi1 = (-yc1)*Math.cos(dfi)-(-5000-xc1)*Math.sin(dfi); xi2 = (5000-xc1)*Math.cos(dfi)+(-yc1)*Math.sin(dfi); yi2 = (-yc1)*Math.cos(dfi)-(5000-xc1)*Math.sin(dfi); xj1 = (float)(xi1*Math.cos(dfj)-yi1*Math.sin(dfj)+Xc1); yj1 = (float)(xi1*Math.sin(dfj)+yi1*Math.cos(dfj)+Yc1); xj2 = (float)(xi2*Math.cos(dfj)-yi2*Math.sin(dfj)+Xc1); yj2 = (float)(xi2*Math.sin(dfj)+yi2*Math.cos(dfj)+Yc1); xk1 = (float)(-xi1*Math.cos(dfj)-yi1*Math.sin(dfj)+Xc1); yk1 = (float)(-xi1*Math.sin(dfj)+yi1*Math.cos(dfj)+Yc1); xk2 = (float)(-xi2*Math.cos(dfj)-yi2*Math.sin(dfj)+Xc1); yk2 = (float)(-xi2*Math.sin(dfj)+yi2*Math.cos(dfj)+Yc1); xS = (float)((R1+30)*Math.sin(dfj)+Xc1); yS = (float)((-R1-30)*Math.cos(dfj)+Yc1); Xh = Yh = Xb = Yb = 0; Xh = (float)(Math.max(0,Xg[0])); Xh = (float)(Math.max(Xh,Xg[Li-1])); Xh = (float)(Math.max(Xh,Xk[0])); Xh = (float)(Math.max(Xh,Xk[Li-1])); Xh = (float)(Math.max(Xh,Xg[Lj])); Xh = (float)(Math.max(Xh,Xk[Lj])); Yh = (float)(Math.max(0,Yg[0])); Yh = (float)(Math.max(Yh,Yg[Li-1])); Yh = (float)(Math.max(Yh,Yk[0])); Yh = (float)(Math.max(Yh,Yk[Li-1])); Yh = (float)(Math.max(Yh,Yg[Lj])); Yh = (float)(Math.max(Yh,Yk[Lj])); Xb = (float)(Math.min(0,Xg[0])); Xb = (float)(Math.min(Xb,Xg[Li-1])); Xb = (float)(Math.min(Xb,Xk[0])); Xb = (float)(Math.min(Xb,Xk[Li-1])); Xb = (float)(Math.min(Xb,Xg[Lj])); Xb = (float)(Math.min(Xb,Xk[Lj])); Yb = (float)(Math.min(0,Yg[0])); Yb = (float)(Math.min(Yb,Yg[Li-1])); Yb = (float)(Math.min(Yb,Yk[0])); Yb = (float)(Math.min(Yb,Yk[Li-1])); Yb = (float)(Math.min(Yb,Yg[Lj])); Yb = (float)(Math.min(Yb,Yk[Lj])); Z1 = 700/(Xh-Xb); Z2 = 380/(Yh-Yb); if (Z1<Z2) ZOOM = Z1; else ZOOM = Z2; if (Xb<0) Axx = (int)Math.round(385-(Xb+(Xh-Xb)/2)*ZOOM); else Axx = (int)Math.round(385-((Xh-Xb)/2)*ZOOM); if (Yb<0) Axy = (int)Math.round(585+(Yb+(Yh-Yb)/2)*ZOOM); else Axy = (int)Math.round(585+((Yh-Yb)/2)*ZOOM); if (Xb<0) Xbi = (int)Math.round(385-((Xh-Xb)/2)*ZOOM); else Xbi = Axx; if (Yb<0) Ybi = (int)Math.round(585+((Yh-Yb)/2)*ZOOM); else Ybi = Axy; R1i = (int)Math.round(R1*ZOOM); R2i = (int)Math.round(R2*ZOOM); Xc1i = (int)Math.round(Xc1*ZOOM); Yc1i = (int)Math.round(Yc1*ZOOM); Xc2i = (int)Math.round(Xc2*ZOOM); Yc2i = (int)Math.round(Yc2*ZOOM); Xo1i = (int)Math.round(Xg[0]*ZOOM); Yo1i = (int)Math.round(Yg[0]*ZOOM); Xt1i = (int)Math.round(Xg[Lj]*ZOOM); Yt1i = (int)Math.round(Yg[Lj]*ZOOM); Xe1i = (int)Math.round(Xg[Li-1]*ZOOM); Ye1i = (int)Math.round(Yg[Li-1]*ZOOM); Xo2i = (int)Math.round(Xk[0]*ZOOM); Yo2i = (int)Math.round(Yk[0]*ZOOM); Xt2i = (int)Math.round(Xk[Lj]*ZOOM); Yt2i = (int)Math.round(Yk[Lj]*ZOOM); Xe2i = (int)Math.round(Xk[Li-1]*ZOOM); Ye2i = (int)Math.round(Yk[Li-1]*ZOOM); xJ1 = (int)Math.round(xj1*ZOOM); yJ1 = (int)Math.round(yj1*ZOOM); xJ2 = (int)Math.round(xj2*ZOOM); yJ2 = (int)Math.round(yj2*ZOOM); xK1 = (int)Math.round(xk1*ZOOM); yK1 = (int)Math.round(yk1*ZOOM); xK2 = (int)Math.round(xk2*ZOOM); yK2 = (int)Math.round(yk2*ZOOM); xSi = (int)Math.round(xS*ZOOM); ySi = (int)Math.round(yS*ZOOM); for (int i=0;i<Li;i++) { Xf[i] = (int)Math.round(Xg[i]*ZOOM); Yf[i] = (int)Math.round(Yg[i]*ZOOM); Xe[i] = (int)Math.round(Xk[i]*ZOOM); Ye[i] = (int)Math.round(Yk[i]*ZOOM); } }//!Coup repaint(); }//Casove public void Exem1() { for (int i=0;i<4;i++) { Ex[i].setBackground(Color.yellow); } Ex[0].setBackground(Color.red); for (int i=0;i<2;i++) { T[tru1[i]].setEnabled(true); T[tru1[i]].setText(""+Exp1[i]); } for (int i=0;i<11;i++) { T[fal1[i]].setText(""); T[fal1[i]].setEnabled(false); } Cas1(); } public void Cas1() { try { R = Float.valueOf (T[1].getText ()).floatValue (); dR = Float.valueOf (T[2].getText ()).floatValue (); KA1 = true; KA2 = KA3 = KA4 = false; Calcul1(); }//try catch (NumberFormatException e) { KA1=KA2=KA3=KA4=false; T[2].requestFocus(); } } public void Calcul1() { if (!secan) { Ac = dA = 1; PaDeSo = false; do { y = x = 0; L = Ac*Ac/R; t = L*L/(2*Ac*Ac); fac = 1; int s = -1; A = Ac; for (n=1,m=1;n<10;n++,m+=2) { if (m-1>0) fac=fac*(m-1)*m; s *= -1; y += L*s*Math.pow(t,2*n-1)/(4*n-1)/fac; x += L*s*Math.pow(t,2*n-2)/(4*n-3)/(fac/m); } DC = R*Math.cos(t)+y-R-dR; if (DC<0) Ac+=dA; else { dA = dA/2; Ac -= dA; } Xl = x; Yl = y; if (t>2.5) PaDeSo = true; if (R*50<Math.abs(DC)) PaDeSo = true; if (PaDeSo) DC=0; }while (Math.abs(DC)>0.000001); x0 = x-R*Math.sin(t); y0 = y+R*Math.cos(t); Xo1 = R*Math.sin(t)-Xl; Xo2 = Xl-R*Math.sin(t); Yo1 = -R-dR; Xl1 = R*Math.sin(t); Xl2 = -R*Math.sin(t); Yl1 = -R*Math.cos(t); Xu1 = Xo1*4; Xu2 = Xo2*4; if (!KA1){ N = Bd*Xc-Ad*Yc; Xq = (N*Bd-Ad*Cd)/(Ad*Ad+Bd*Bd); Yq = (-Ad*N-Bd*Cd)/(Ad*Ad+Bd*Bd); Ae = Math.abs(Ad); if ((Xc<=Xq)&(Yc<=Yq)) angl=Math.PI/2+Math.acos(Ae); if ((Xc>=Xq)&(Yc<=Yq)) angl=Math.PI*3/2-Math.acos(Ae); if ((Xc>=Xq)&(Yc>=Yq)) angl=Math.PI*3/2+Math.acos(Ae); if ((Xc<=Xq)&(Yc>=Yq)) angl=Math.PI/2-Math.acos(Ae); xo1 = Xo1*Math.cos(angl)-Yo1*Math.sin(angl)+Xc; yo1 = Xo1*Math.sin(angl)+Yo1*Math.cos(angl)+Yc; xl1 = Xl1*Math.cos(angl)-Yl1*Math.sin(angl)+Xc; yl1 = Xl1*Math.sin(angl)+Yl1*Math.cos(angl)+Yc; xo2 = Xo2*Math.cos(angl)-Yo1*Math.sin(angl)+Xc; yo2 = Xo2*Math.sin(angl)+Yo1*Math.cos(angl)+Yc; xl2 = Xl2*Math.cos(angl)-Yl1*Math.sin(angl)+Xc; yl2 = Xl2*Math.sin(angl)+Yl1*Math.cos(angl)+Yc; xu1 = Xu1*Math.cos(angl)-Yo1*Math.sin(angl)+Xc; yu1 = Xu1*Math.sin(angl)+Yo1*Math.cos(angl)+Yc; xu2 = Xu2*Math.cos(angl)-Yo1*Math.sin(angl)+Xc; yu2 = Xu2*Math.sin(angl)+Yo1*Math.cos(angl)+Yc; } else { angl = xo1 = yo1 = yo2 = 0; xl1 = Xl; yl1 = yl2 = Yl; xo2 = Xo2*2; xl2 = Xo2-Xl1; Xc = (float)Xo2; Yc = R+dR; xu1 = Xu1; yu1 = Yo1; xu2 = Xu2; yu2 = Yo1; } Li = (int)Math.round(A*A/R); for (int i=0;i<Li;i++) { x = 0; y = 0; fac = 1; r = i*i/(2*A*A); for (n=1,m=1;n<10;n++,m+=2) { if (m-1>0) fac=fac*(m-1)*m; y += i*Math.pow(-1,n+1)*Math.pow(r,2*n-1)/(4*n-1)/fac; x += i*Math.pow(-1,n+1)*Math.pow(r,2*n-2)/(4*n-3)/(fac/m); } Xg[i] = (float)((x-x0)*Math.cos(angl)-(y-y0)*Math.sin(angl)+Xc); Yg[i] = (float)((x-x0)*Math.sin(angl)+(y-y0)*Math.cos(angl)+Yc); Xk[i] = (float)((x0-x)*Math.cos(angl)-(y-y0)*Math.sin(angl)+Xc); Yk[i] = (float)((x0-x)*Math.sin(angl)+(y-y0)*Math.cos(angl)+Yc); } Xh = Yh = Xb = Yb = 0; Xh = (float)(Math.max(0,xo1)); Xh = (float)(Math.max(Xh,xo2)); Xh = (float)(Math.max(Xh,xl1)); Xh = (float)(Math.max(Xh,xl2)); Yh = (float)(Math.max(0,yo1)); Yh = (float)(Math.max(Yh,yo2)); Yh = (float)(Math.max(Yh,yl1)); Yh = (float)(Math.max(Yh,yl2)); Xb = (float)(Math.min(0,xo1)); Xb = (float)(Math.min(Xb,xo2)); Xb = (float)(Math.min(Xb,xl1)); Xb = (float)(Math.min(Xb,xl2)); Yb = (float)(Math.min(0,yo1)); Yb = (float)(Math.min(Yb,yo2)); Yb = (float)(Math.min(Yb,yl1)); Yb = (float)(Math.min(Yb,yl2)); Z1 = 700/(Xh-Xb); Z2 = 350/(Yh-Yb); if (Z1<Z2) ZOOM = Z1; else ZOOM = Z2; if (KA1) ZOOM = ZOOM/1.3; if (Xb<0) Axx = (int)Math.round(385-(Xb+(Xh-Xb)/2)*ZOOM); else Axx = (int)Math.round(385-((Xh-Xb)/2)*ZOOM); if (Yb<0) Axy = (int)Math.round(600+(Yb+(Yh-Yb)/2)*ZOOM); else Axy = (int)Math.round(600+((Yh-Yb)/2)*ZOOM); if (Xb<0) Xbi = (int)Math.round(385-((Xh-Xb)/2)*ZOOM); else Xbi = Axx; if (Yb<0) Ybi = (int)Math.round(600+((Yh-Yb)/2)*ZOOM); else Ybi = Axy; ChangeCoor(); }//!secan else repaint(); } public void Exem2() { for (int i=0;i<4;i++) { Ex[i].setBackground(Color.yellow); } Ex[1].setBackground(Color.red); for (int i=0;i<7;i++) { T[tru2[i]].setEnabled(true); T[tru2[i]].setText(""+Exp2[i]); } for (int i=0;i<6;i++) { T[fal2[i]].setText(""); T[fal2[i]].setEnabled(false); } Cas2(); } public void Cas2() { try { R = Float.valueOf (T[1].getText ()).floatValue (); Xc = Float.valueOf (T[3].getText ()).floatValue (); Yc = Float.valueOf (T[4].getText ()).floatValue (); X1 = Float.valueOf (T[5].getText ()).floatValue (); Y1 = Float.valueOf (T[6].getText ()).floatValue (); X2 = Float.valueOf (T[7].getText ()).floatValue (); Y2 = Float.valueOf (T[8].getText ()).floatValue (); Ad = Y1-Y2; Bd = X2-X1; Dd = Math.sqrt(Ad*Ad+Bd*Bd); Ad = Ad/Dd; Bd = Bd/Dd; Cd = -Ad*X1-Bd*Y1; dR = (float)(Math.abs(Ad*Xc+Bd*Yc+Cd)-R); if (dR<0.00001) secan=true; else secan=false; KA2 = true; KA1 = KA3 = KA4 = false; Calcul1(); }//try catch (NumberFormatException e) { KA1=KA2=KA3=KA4=false; T[3].requestFocus(); } } public void Exem3() { for (int i=0;i<4;i++) { Ex[i].setBackground(Color.yellow); } Ex[2].setBackground(Color.red); for (int i=0;i<6;i++) { T[tru3[i]].setEnabled(true); T[tru3[i]].setText(""+Exp3[i]); } for (int i=0;i<7;i++) { T[fal3[i]].setText(""); T[fal3[i]].setEnabled(false); } Cas3(); } public void Cas3() { try { R = Float.valueOf (T[1].getText ()).floatValue (); Xc = Float.valueOf (T[3].getText ()).floatValue (); Yc = Float.valueOf (T[4].getText ()).floatValue (); Xp = Float.valueOf (T[9].getText ()).floatValue (); Yp = Float.valueOf (T[10].getText ()).floatValue (); Gt = Float.valueOf (T[11].getText ()).floatValue (); Ad = -Math.sin((100-Gt)*Math.PI/200); Bd = Math.cos((100-Gt)*Math.PI/200); Cd = -Ad*Xp-Bd*Yp; dR = (float)(Math.abs(Ad*Xc+Bd*Yc+Cd)-R); if (dR<0.00001) secan=true; else secan=false; KA3 = true; KA1 = KA2 = KA4 = false; Calcul1(); }//try catch (NumberFormatException e) { KA1=KA2=KA3=KA4=false; T[3].requestFocus(); } } public void Exem4() { for (int i=0;i<4;i++) { Ex[i].setBackground(Color.yellow); } Ex[3].setBackground(Color.red); for (int i=0;i<5;i++) { T[tru4[i]].setEnabled(true); T[tru4[i]].setText(""+Exp4[i]); } for (int i=0;i<8;i++) { T[fal4[i]].setText(""); T[fal4[i]].setEnabled(false); } Cas4(); } public void Cas4() { try { R = Float.valueOf (T[1].getText ()).floatValue (); Xc = Float.valueOf (T[3].getText ()).floatValue (); Yc = Float.valueOf (T[4].getText ()).floatValue (); ad = Float.valueOf (T[12].getText ()).floatValue (); bd = Float.valueOf (T[13].getText ()).floatValue (); Dd = Math.sqrt(ad*ad+1);; Ad = ad/Dd; Bd = -1/Dd; Cd = bd/Dd; dR = (float)(Math.abs(Ad*Xc+Bd*Yc+Cd)-R); if (dR<0.00001) secan=true; else secan=false; KA4 = true; KA1 = KA2 = KA3 = false; Calcul1(); }//try catch (NumberFormatException e) { KA1=KA2=KA3=KA4=false; T[13].requestFocus(); } } public void ChangeCoor() { Xcj = (int)Math.round(Xc*ZOOM); Ycj = (int)Math.round(Yc*ZOOM); Xt1 = (int)Math.round(xl1*ZOOM); Yt1 = (int)Math.round(yl1*ZOOM); Xt2 = (int)Math.round(xl2*ZOOM); Yt2 = (int)Math.round(yl2*ZOOM); Rj = (int)Math.round(R*ZOOM); xv1 = (int)Math.round(xu1*ZOOM); yv1 = (int)Math.round(yu1*ZOOM); xv2 = (int)Math.round(xu2*ZOOM); yv2 = (int)Math.round(yu2*ZOOM); X1j = (int)Math.round(X1*ZOOM); Y1j = (int)Math.round(Y1*ZOOM); X2j = (int)Math.round(X2*ZOOM); Y2j = (int)Math.round(Y2*ZOOM); Xpj = (int)Math.round(Xp*ZOOM); Ypj = (int)Math.round(Yp*ZOOM); for (int i=0;i<Li;i++) { Xf[i] = (int)Math.round(Xg[i]*ZOOM); Yf[i] = (int)Math.round(Yg[i]*ZOOM); Xe[i] = (int)Math.round(Xk[i]*ZOOM); Ye[i] = (int)Math.round(Yk[i]*ZOOM); } repaint(); } public void paint (Graphics g) { g.setFont(new Font("ARIAL",Font.PLAIN,12)); g.setColor(Color.lightGray); g.fillRect(0, 0, 770, 50); g.setColor(Color.black); if (Detclo) { g.drawString("Rayon R =",25,85); g.drawString("Ripage dR =",173,85); g.drawString("Centre du cercle",348,85); g.drawString("Xc = ",450,75); g.drawString("Yc = ",450,95); g.drawLine(443,63,443,97); g.setFont(new Font("ARIAL",Font.BOLD,14)); g.drawString("Définition de la droite",25,112); g.setFont(new Font("ARIAL",Font.PLAIN,12)); g.setColor(Color.blue); g.drawString("(On peut définir la droite de trois façons différentes)",185,112); g.setColor(Color.black); g.drawString("- CAS 1 (2 points P1 et P2) Point P1",40,145); g.drawLine(258,123,258,157); g.drawString("X1 = ",265,135); g.drawString("Y1 = ",265,155); g.drawString("Point P2",390,145); g.drawLine(443,123,443,157); g.drawString("X2 = ",450,135); g.drawString("Y2 = ",450,155); g.drawString("- CAS 2 (1 point P et le gisement Gt)",40,195); g.drawString("P",247,195); g.drawLine(258,172,258,207); g.drawString("Xp = ",265,185); g.drawString("Yp = ",265,205); g.drawString("Gisement Gt = ",392,195); g.drawString("- CAS 3 (a et b de y = ax + b)",40,235); g.drawString("a = ",272,235); g.drawString("b = ",393,235); if (secan) { g.setFont(new Font("ARIAL",Font.BOLD,14)); g.setColor(Color.red); g.drawString("ATTENTION la droite coupe le cercle il n'y a pas de solution",200,270); } else { if (PaDeSo) { g.setFont(new Font("ARIAL",Font.BOLD,14)); g.setColor(Color.red); g.drawString("Il n'y a pas de solution, la distance entre",249,300); g.drawString("le cercle et la droite est trop importante",250,320); g.drawString("vous devez modifier certaines hypothèses.",240,340); } else { Color coul = new Color(195,195,255); g.setColor(coul); g.fillRect(5,250,760,550); if((KA1)|(KA2)|(KA3)|(KA4)) { g.setColor(Color.black); for (int i=0;i<5;i++) { if (i<4) g.drawLine(20,295+20*i,200,295+20*i); if (!KA1) g.drawLine(464,275+20*i,698,275+20*i); if (i<4) g.drawLine(272,295+20*i,392,295+20*i); } g.drawString("CARACTERISTIQUES DE",40,272); g.drawString("LA CLOTHOIDE",65,288); g.drawRect(20,255,180,120); g.drawString("Paramètre A = ±"+(float)A,25,310); g.drawString("Angle t = "+(float)t+" rad",25,330); g.drawString("Longueur L = "+(float)L,25,350); g.drawString("Ripage dR = "+dR,25,370); if (!KA1) { g.drawRect(397,255,301,120); g.drawLine(397,275,464,275); g.drawLine(397,295,464,295); g.drawLine(397,335,464,335); g.drawLine(581,275,581,375); g.drawLine(464,255,464,375); g.drawString("COORDONNEES GENERALES",491,270); g.drawString("Paramètre",402,290); g.drawString("Origine",409,312); g.drawString("clothoïde",404,328); g.drawString("Extrémité",404,352); g.drawString("clothoïde",404,368); g.drawString("A = +"+(float)A,469,290); g.drawString("Xo1 = "+(float)xo1,469,310); g.drawString("Yo1 = "+(float)yo1,469,330); g.drawString("Xe1 = "+(float)xl1,469,350); g.drawString("Ye1 = "+(float)yl1,469,370); g.drawString("A = -"+(float)A,586,290); g.drawString("Xo2 = "+(float)xo2,586,310); g.drawString("Yo2 = "+(float)yo2,586,330); g.drawString("Xe2 = "+(float)xl2,586,350); g.drawString("Ye2 = "+(float)yl2,586,370); } g.drawString("COORDONNEES",286,272); g.drawString("LOCALES",306,288); g.drawRect(205,255,187,120); g.drawLine(272,255,272,375); g.drawLine(205,295,272,295); g.drawLine(205,335,272,335); g.drawString("Extrémité",212,312); g.drawString("clothoïde",212,328); g.drawString("Centre du",210,352); g.drawString("cercle",220,368); g.drawString("xe = ±"+(float)Xl,276,310); g.drawString("ye = "+(float)Yl,276,330); g.drawString("xc = ±"+(float)x0,276,350); g.drawString("yc = "+(float)y0,276,370); if (KA1) g.drawString("- REMARQUE -",510,280); if (KA1) g.drawString("Ce cas ne peut être représenté qu'en système",430,300); if (KA1) g.drawString("de coordonnées locales, nous avons deux systèmes",405,320); if (KA1) g.drawString("d'axe l'un est situé à l'origine de la clothoïde positive",405,340); if (KA1) g.drawString("et l'autre est situé à l'origine de la clothoïde négative.",405,360); g.clipRect(5,380,760,420); g.setColor(Color.gray); if (KA1) { g.drawLine(Axx+Xcj,Ybi+15,Axx+Xcj,Axy-Ycj); g.drawLine(Axx+Xcj-4,Axy-Ycj+Rj-10,Axx+Xcj,Axy-Ycj+Rj); g.drawLine(Axx+Xcj+4,Axy-Ycj+Rj-10,Axx+Xcj,Axy-Ycj+Rj); g.drawLine(Axx+Xcj-4,Axy+10,Axx+Xcj,Axy); g.drawLine(Axx+Xcj+4,Axy+10,Axx+Xcj,Axy); } g.drawLine(Axx+Xt1,Axy-Yt1,Axx+Xt1,Axy); if (!KA1) g.drawLine(Axx+Xt1,Axy-Yt1,Axx,Axy-Yt1); else g.drawLine(Axx+Xcj*2,Axy-Yt1,Axx,Axy-Yt1); g.drawLine(Axx+Xt2,Axy-Yt2,Axx+Xt2,Axy); g.drawLine(Axx+Xt2,Axy-Yt2,Axx,Axy-Yt2); g.drawLine(Axx+Xe[0],Axy-Ye[0],Axx+Xe[0],Axy); g.drawLine(Axx+Xe[0],Axy-Ye[0],Axx,Axy-Ye[0]); g.drawLine(Axx+Xf[0],Axy-Yf[0],Axx+Xf[0],Axy); g.drawLine(Axx+Xf[0],Axy-Yf[0],Axx,Axy-Yf[0]); g.setColor(Color.blue); g.drawOval(Axx+Xcj-Rj,Axy-Ycj-Rj,2*Rj,2*Rj); g.setColor(Color.black); g.drawLine(Axx,Ybi+20,Axx,1180-Ybi-(800-Ybi)/2); g.drawLine(Axx,1180-Ybi-(800-Ybi)/2,Axx+4,1190-Ybi-(800-Ybi)/2); g.drawLine(Axx,1180-Ybi-(800-Ybi)/2,Axx-4,1190-Ybi-(800-Ybi)/2); g.drawString("Y",Axx+8,1190-Ybi-(800-Ybi)/2); if (KA1) { g.drawLine(Axx+Xcj*2,Ybi+20,Axx+Xcj*2,1180-Ybi-(800-Ybi)/2); g.drawLine(Axx+Xcj*2,1180-Ybi-(800-Ybi)/2,Axx+4+Xcj*2,1190-Ybi-(800-Ybi)/2); g.drawLine(Axx+Xcj*2,1180-Ybi-(800-Ybi)/2,Axx-4+Xcj*2,1190-Ybi-(800-Ybi)/2); g.drawString("Y",Axx+8+Xcj*2,1190-Ybi-(800-Ybi)/2); g.drawString("0",Axx+2+Xcj*2,Axy-2); g.drawString("Xc",Axx+Xcj-5,Axy+27); } g.drawLine(Xbi-20,Axy,790-Xbi+(Xbi-35)/2,Axy); g.drawLine(790-Xbi+(Xbi-35)/2,Axy,780-Xbi+(Xbi-35)/2,Axy-4); g.drawLine(790-Xbi+(Xbi-35)/2,Axy,780-Xbi+(Xbi-35)/2,Axy+4); g.drawString("X",780-Xbi+(Xbi-35)/2,Axy-8); g.drawString("0",Axx+2,Axy-2); g.drawString("Xe1",Axx+Xt1-8,Axy+12); g.drawString("Ye1",Axx-21,Axy-Yt1+5); g.drawString("Xe2",Axx+Xt2-8,Axy+12); if (!KA1) g.drawString("Ye2",Axx-23,Axy-Yt2+5); else g.drawString("Ye2",Axx+4+Xcj*2,Axy-Yt2+5); if (!KA1) g.drawString("Xo2",Axx+Xe[0]-8,Axy+12); if (!KA1) g.drawString("Yo2",Axx-23,Axy-Ye[0]+5); if (!KA1) g.drawString("Xo1",Axx+Xf[0]-8,Axy+12); if (!KA1) g.drawString("Yo1",Axx-21,Axy-Yf[0]+5); g.drawLine(Axx+xv1,Axy-yv1,Axx+xv2,Axy-yv2); g.setColor(Color.red); for (n=1;n<Li;n++) { g.drawLine(Axx+Xf[n-1],Axy-Yf[n-1],Axx+Xf[n],Axy-Yf[n]); g.drawLine(Axx+Xe[n-1],Axy-Ye[n-1],Axx+Xe[n],Axy-Ye[n]); } g.setColor(Color.white); if (KA1) g.drawString("dR",Axx+Xcj+3,Axy+5-(Ycj-Rj)/2); if (KA1) g.drawString("R",Axx+Xcj+3,Axy-(Axy-(780-Ybi/2))/2); g.drawOval(Axx+Xcj-1,Axy-Ycj-1,2,2); g.drawString("Centre",Axx+Xcj+3,Axy-Ycj-3); if (KA2) g.drawOval(Axx+X1j-2,Axy-Y1j-2,4,4); if (KA2) g.drawString("P1",Axx+X1j+4,Axy-Y1j-4); if (KA2) g.drawOval(Axx+X2j-2,Axy-Y2j-2,4,4); if (KA2) g.drawString("P2",Axx+X2j+4,Axy-Y2j-4); if (KA3) g.drawOval(Axx+Xpj-2,Axy-Ypj-2,4,4); if (KA3) g.drawString("P",Axx+Xpj+4,Axy-Ypj-4); g.setColor(Color.black); g.drawOval(Axx+Xt1-2,Axy-Yt1-2,4,4); g.drawOval(Axx+Xt2-2,Axy-Yt2-2,4,4); g.drawOval(Axx+Xe[0]-2,Axy-Ye[0]-2,4,4); g.drawOval(Axx+Xf[0]-2,Axy-Yf[0]-2,4,4); }//KA }//else PaDeSo }//else Secan }//DetClo if (Detove) { Color coul = new Color(195,195,255); g.setColor(coul); g.fillRect(5,160,760,640); g.setFont(new Font("ARIAL",Font.BOLD,14)); g.setColor(Color.black); g.drawString("Premier",10,77); g.drawString("Cercle C1",10,93); g.drawString("Second",10,127); g.drawString("Cercle C2",10,143); g.setFont(new Font("ARIAL",Font.PLAIN,12)); g.drawString("Rayon R1 =",92,85); g.drawString("Rayon R2 =",92,135); g.drawString("Centre du cercle",243,85); g.drawString("Xc1 = ",345,75); g.drawString("Yc1 = ",345,95); g.drawLine(338,63,338,97); g.drawString("Centre du cercle",243,135); g.drawString("Xc2 = ",345,125); g.drawString("Yc2 = ",345,145); g.drawLine(338,113,338,147); if (Coup) { g.setFont(new Font("ARIAL",Font.BOLD,14)); g.setColor(Color.red); g.drawString("ATTENTION les deux cercles se coupent il n'y a pas de solution",200,270); } else { if (PaDeSo) { g.setFont(new Font("ARIAL",Font.BOLD,14)); g.setColor(Color.red); g.drawString("Il n'y a pas de solution, la distance mini entre",218,270); g.drawString("les deux cercles est trop importante, vous devez",203,290); g.drawString("modifier les coordonnées d'un centre ou un rayon.",200,310); } else { if (CalOve) { g.drawString("CARACTERISTIQUES DES CLOTHOIDES",483,215); g.drawRect(455,200,285,145); g.drawLine(455,220,740,220); g.drawLine(455,240,740,240); g.drawLine(455,275,740,275); g.drawLine(455,310,740,310); g.drawString("- Paramètres A = ±"+(float)A,460,235); g.drawString("- Longueur de l'ove (branche de la clothoïde située",460,255); g.drawString("entre les rayons R1 et R2), Lo = "+(float)(A*A/R2-A*A/R1),467,270); g.drawString("- Longueur L1 de la branche de clothoïde située",460,290); g.drawString("entre l'origine et le rayon R1, L1 = "+(float)(A*A/R1),467,305); g.drawString("- Longueur L2 de la branche de clothoïde située",460,325); g.drawString("entre l'origine et le rayon R2, L2 = "+(float)(A*A/R2),467,340); g.drawString("POINTS CARACTERISTIQUES",148,180); g.drawString("Paramètres",75,200); g.drawString("A = +"+(float)A,210,200); g.drawString("A = -"+(float)A,330,200); g.drawString("Points tangents a R1",51,228); g.drawString("Xa1 = "+(float)Xw1[1],210,220); g.drawString("Ya1 = "+(float)Yw1[1],210,235); g.drawString("Xa2 = "+(float)Xw2[1],330,220); g.drawString("Ya2 = "+(float)Yw2[1],330,235); g.drawString("Points tangents a R2",51,263); g.drawString("Xb1 = "+(float)Xw1[2],210,255); g.drawString("Yb1 = "+(float)Yw1[2],210,270); g.drawString("Xb2 = "+(float)Xw2[2],330,255); g.drawString("Yb2 = "+(float)Yw2[2],330,270); g.drawString("Point origine de la",59,290); g.drawString("clothoïde",85,305); g.drawString("Xo1 = "+(float)Xw1[0],210,290); g.drawString("Yo1 = "+(float)Yw1[0],210,305); g.drawString("Xo2 = "+(float)Xw2[0],330,290); g.drawString("Yo2 = "+(float)Yw2[0],330,305); g.drawString("Gisement des droites tangentes",18,325); g.drawString("à l'origine des clothoïdes",38,340); g.drawString("Gt1 = "+(float)Gt1,210,333); g.drawString("Gt2 = "+(float)Gt2,330,333); g.drawRect(10,165,440,180); g.drawLine(10,187,450,187); g.drawLine(10,205,450,205); g.drawLine(10,240,450,240); g.drawLine(10,275,450,275); g.drawLine(10,310,450,310); g.drawLine(205,187,205,345); g.drawLine(325,187,325,345); g.clipRect(5,350,760,450); g.drawLine(Axx,Ybi+20,Axx,1150-Ybi-(800-Ybi)/2); g.drawLine(Axx,1150-Ybi-(800-Ybi)/2,Axx+4,1160-Ybi-(800-Ybi)/2); g.drawLine(Axx,1150-Ybi-(800-Ybi)/2,Axx-4,1160-Ybi-(800-Ybi)/2); g.drawString("Y",Axx+8,1160-Ybi-(800-Ybi)/2); g.drawLine(Xbi-20,Axy,790-Xbi+(Xbi-35)/2,Axy); g.drawLine(790-Xbi+(Xbi-35)/2,Axy,780-Xbi+(Xbi-35)/2,Axy-4); g.drawLine(790-Xbi+(Xbi-35)/2,Axy,780-Xbi+(Xbi-35)/2,Axy+4); g.drawString("X",780-Xbi+(Xbi-35)/2,Axy-8); g.drawString("0",Axx+2,Axy-2); g.setColor(Color.gray); g.drawLine(Axx+Xo1i,Axy-Yo1i,Axx+Xo1i,Axy); g.drawLine(Axx+Xo1i,Axy-Yo1i,Axx,Axy-Yo1i); g.drawLine(Axx+Xo2i,Axy-Yo2i,Axx+Xo2i,Axy); g.drawLine(Axx+Xo2i,Axy-Yo2i,Axx,Axy-Yo2i); g.drawLine(Axx+Xt1i,Axy-Yt1i,Axx+Xt1i,Axy); g.drawLine(Axx+Xt1i,Axy-Yt1i,Axx,Axy-Yt1i); g.drawLine(Axx+Xt2i,Axy-Yt2i,Axx+Xt2i,Axy); g.drawLine(Axx+Xt2i,Axy-Yt2i,Axx,Axy-Yt2i); g.drawLine(Axx+Xe1i,Axy-Ye1i,Axx+Xe1i,Axy); g.drawLine(Axx+Xe1i,Axy-Ye1i,Axx,Axy-Ye1i); g.drawLine(Axx+Xe2i,Axy-Ye2i,Axx+Xe2i,Axy); g.drawLine(Axx+Xe2i,Axy-Ye2i,Axx,Axy-Ye2i); g.drawLine(Axx+Xc1i,Axy-Yc1i,Axx+xSi,Axy-ySi); g.setColor(Color.black); g.drawLine(Axx+xJ1,Axy-yJ1,Axx+xJ2,Axy-yJ2); g.drawLine(Axx+xK1,Axy-yK1,Axx+xK2,Axy-yK2); g.setColor(Color.blue); g.drawOval(Axx+Xc1i-R1i,Axy-Yc1i-R1i,2*R1i,2*R1i); g.drawOval(Axx+Xc2i-R2i,Axy-Yc2i-R2i,2*R2i,2*R2i); g.setColor(Color.black); g.drawString("Xo1",Axx+Xo1i-8,Axy+12); g.drawString("Yo1",Axx-23,Axy-Yo1i+5); g.drawString("Xo2",Axx+Xo2i-8,Axy+12); g.drawString("Yo2",Axx-23,Axy-Yo2i+5); g.drawString("Xa1",Axx+Xt1i-8,Axy+12); g.drawString("Ya1",Axx-23,Axy-Yt1i+5); g.drawString("Xa2",Axx+Xt2i-8,Axy+12); g.drawString("Ya2",Axx-23,Axy-Yt2i+5); g.drawString("Xb1",Axx+Xe1i-8,Axy+12); g.drawString("Yb1",Axx-23,Axy-Ye1i+5); g.drawString("Xb2",Axx+Xe2i-8,Axy+12); g.drawString("Yb2",Axx-23,Axy-Ye2i+5); g.drawOval(Axx+Xo1i-2,Axy-Yo1i-2,4,4); g.drawOval(Axx+Xo2i-2,Axy-Yo2i-2,4,4); g.drawOval(Axx+Xt1i-2,Axy-Yt1i-2,4,4); g.drawOval(Axx+Xt2i-2,Axy-Yt2i-2,4,4); g.drawOval(Axx+Xe1i-2,Axy-Ye1i-2,4,4); g.drawOval(Axx+Xe2i-2,Axy-Ye2i-2,4,4); g.setColor(Color.white); g.drawOval(Axx+Xc1i-1,Axy-Yc1i-1,2,2); g.drawOval(Axx+Xc2i-1,Axy-Yc2i-1,2,2); g.drawString("Centre",Axx+Xc1i+3,Axy-Yc1i-3); g.drawString("Centre",Axx+Xc2i+3,Axy-Yc2i-3); for (n=1;n<Li;n++) { g.setColor(Color.red); if (n>(A*A/R1)) { g.drawLine(Axx+Xf[n-1],Axy-Yf[n-1]+1,Axx+Xf[n],Axy-Yf[n]+1); g.drawLine(Axx+Xf[n-1]+1,Axy-Yf[n-1],Axx+Xf[n]+1,Axy-Yf[n]); g.drawLine(Axx+Xf[n-1]-1,Axy-Yf[n-1],Axx+Xf[n]-1,Axy-Yf[n]); g.drawLine(Axx+Xe[n-1],Axy-Ye[n-1]+1,Axx+Xe[n],Axy-Ye[n]+1); g.drawLine(Axx+Xe[n-1]+1,Axy-Ye[n-1],Axx+Xe[n]+1,Axy-Ye[n]); g.drawLine(Axx+Xe[n-1]-1,Axy-Ye[n-1],Axx+Xe[n]-1,Axy-Ye[n]); } g.drawLine(Axx+Xf[n-1],Axy-Yf[n-1],Axx+Xf[n],Axy-Yf[n]); g.drawLine(Axx+Xe[n-1],Axy-Ye[n-1],Axx+Xe[n],Axy-Ye[n]); } } } }//CalOve }//Detove } } Java2html