!***************************************************** !* REDUCTION OF CONICALS * !* of equation: ax^2+2bxy+cy^2+2dx+2ey+f=0 * !* ------------------------------------------------- * !* The program, knowing the coefficients a, b, c, d, * !* e and f of the cartesian equation, finds the * !* caracteristics of the reduction elements: * !* type of conical (hyperbola,parabola,ellipse or * !* circle) and center position, focus position(s), * !* axes and excentricity. * !* ------------------------------------------------- * !* Ref.: "Mathématiques en Turbo-Pascal By M. Ducamp * !* and A. Reverchon (vol 2), Eyrolles, Paris, 1988" * !* [BIBLI 05]. * !* ------------------------------------------------- * !* SAMPLE RUN: * !* * !* REDUCTION OF CONICALS * !* * !* a = 1 * !* 2b = 2 * !* c = 1 * !* 2d = -13 * !* 2e = -11 * !* f = 32 * !* * !* Type: Parabola * !* * !* Center: x=0.999999 y=5.000000 * !* Symmetry direction: x=1 y=-1 * !* Focus: x=1.124999 y=4.875000 * !* Parameter: 0.35355339 * !* * !* F90 version by J-P Moreau. * !* (www.jpmoreau.fr) * !***************************************************** PROGRAM Conicals !input variables: real*8 a,b,c,d,e,f ! coefficients of cartesian equation ! output variables: ! typ: type of conical (integer) ! 1: ellipse ! 2: hyperbola ! 3: parabola ! 4: circle ! 5: line ! 6: two lines ! 7: one point ! 8: no conical at all. ! ex: excentricity (or parameter for a parabola), ! xc,yc: coordinates of center, ! la,lb: axis half-length for an ellipse (la, radius for a circle), ! xf1,yf1,xf2,yf2: focus coordinates (only one focus for a parabola), ! xs1,ys1,xs2,ys2: summit coordinates for an hyperbola, ! xv1,yv1,xv2,yv2: vector directions of symmetry axes ! (only one direction for a parabola). real*8 ex,xc,yc,la,lb,xf1,yf1,xf2,yf2,xs1,ys1,xs2,ys2,xv1,yv1,xv2,yv2 ! other internal variables real*8 delta,u,l,m,x2,y2 integer typ print *,'' print *,' REDUCTION OF CONICALS' print *,'' write(*,200,advance='no'); read *, a write(*,201,advance='no'); read *, b write(*,202,advance='no'); read *, c write(*,203,advance='no'); read *, d write(*,204,advance='no'); read *, e write(*,205,advance='no'); read *, f print *,'' b=b/2; d=d/2; e=e/2 delta=a*c-b*b if (delta.eq.0) then call Parabola(a,b,c,d,e,f,typ,l,m,xc,yc,xv1,yv1,xf1,yf1,ex) else xc=(b*e-d*c)/delta yc=(b*d-a*e)/delta f = f + a*xc*xc+2*b*xc*yc+c*yc*yc+2*d*xc+2*e*yc if (f.eq.0) then if (delta>0) then typ=7 else typ=6 !7=one point, 6=two lines goto 100 end if end if u=dsqrt((a-c)*(a-c)+4*b*b) l=(a+c-u)/2; m=(a+c+u)/2 if (a.eq.c.and.b.eq.0) then if (f*a>=0) then typ=8; ! no conical goto 100 else typ=4 ! circle la=dsqrt(-f/a) ex=1.d0 goto 100 end if end if if (a0) then typ=8 return !8=no conical end if la=dsqrt(-f/l); lb=dsqrt(-f/m) if (l<0) then u=la; la=lb; lb=u u=x2; x2=-y2; y2=u u=xv1; xv1=-yv1; yv1=u end if xv2=-yv1; yv2=xv1 u=dsqrt(la*la-lb*lb) xf1=xc+x2*u; yf1=yc+y2*u xf2=xc-x2*u; yf2=yc-y2*u ex=u/la return end ! end of file conical.f90