## 453 - Intersecting Circles

All about problems in Volume 4. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

### 453 argghhh

I hate this problem...... I have tried many times to get accepted but I always get WA. I tried the sample input data on Pochmans home page and my program got the same answers. Here is my code.....

[c]
#include <stdio.h>
#include <math.h>

double epsilon=1e-6;
double peps=5e-4;

void main(void)
{ double ax,ay,ar,bx,by,br,dc,er,px,py,a,h,px2,py2;
while(!feof(stdin))
{ ax=0;ay=0;ar=0;bx=0;by=0;br=0;
if(scanf("%lf",&ax)==EOF)
break;
if(scanf("%lf",&ay)==EOF)
break;
if(scanf("%lf",&ar)==EOF)
break;
if(scanf("%lf",&bx)==EOF)
break;
if(scanf("%lf",&by)==EOF)
break;
if(scanf("%lf",&br)==EOF)
break;
dc=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
if(ar>dc)
er=fabs(-ar+br+dc);
else if(br>dc)
er=fabs(ar-br+dc);
else
er=fabs(ar+br-dc);
if(dc<epsilon)
{ /* same circles */
if(ar<epsilon)
printf("(%.3lf,%.3lf)\n",ax,ay);
else
printf("THE CIRCLES ARE THE SAME\n");
}
else if(er<epsilon)
{ /* 1 point of intersection */
if(ar>br)
{ px=ar/dc*(bx-ax)+ax;
py=ar/dc*(by-ay)+ay;
}
else
{ px=br/dc*(ax-bx)+bx;
py=br/dc*(ay-by)+by;
}
if(fabs(px)<peps)
px=0.0;
if(fabs(py)<peps)
py=0.0;
printf("(%.3lf,%.3lf)\n",px,py);
}
else if((dc>fabs(ar+br))||(dc<fabs(ar-br)))
{ /* no points of intersection */
printf("NO INTERSECTION\n");
}
else
{ /* 2 points of intersection */
a=(ar*ar-br*br+dc*dc)/(2*dc);
h=sqrt(ar*ar-a*a);
px =ax+(bx-ax)*a/dc+(by-ay)*h/dc;
px2=ax+(bx-ax)*a/dc-(by-ay)*h/dc;
py =ay+(by-ay)*a/dc-(bx-ax)*h/dc;
py2=ay+(by-ay)*a/dc+(bx-ax)*h/dc;
if(fabs(px)<peps)
px=0.0;
if(fabs(py)<peps)
py=0.0;
if(fabs(px2)<peps)
px2=0.0;
if(fabs(py2)<peps)
py2=0.0;
if((px<px2)||((px==px2)&&(py<py2)))
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px,py,px2,py2);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px2,py2,px,py);
}
}
}
[/c]

Can anyone save me from this madness ?

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany
I think, your problem is:
If you round the values of intersection points to 3 digits after the decimal point and they are equal, your output should be only one point.

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

### new code

new code (still WA!).

[c]
#include <stdio.h>
#include <math.h>

double epsilon=1e-6;

double roundit(double a)
{ double b;
if(a<0)
{ b=-a;
b=floor(b*1000+0.5)/1000;
b=-b;
}
else
{ b=a;
b=floor(b*1000+0.5)/1000;
}
return b;
}

void main(void)
{ double ax,ay,ar,bx,by,br,dc,er,px,py,a,h,px2,py2;
while(!feof(stdin))
{ ax=0;ay=0;ar=0;bx=0;by=0;br=0;
if(scanf("%lf",&ax)==EOF)
break;
if(scanf("%lf",&ay)==EOF)
break;
if(scanf("%lf",&ar)==EOF)
break;
if(scanf("%lf",&bx)==EOF)
break;
if(scanf("%lf",&by)==EOF)
break;
if(scanf("%lf",&br)==EOF)
break;
dc=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
if(ar>dc)
er=fabs(-ar+br+dc);
else if(br>dc)
er=fabs(ar-br+dc);
else
er=fabs(ar+br-dc);
if(dc<epsilon)
{ /* same circles */
if(ar<epsilon)
printf("(%.3lf,%.3lf)\n",ax,ay);
else
printf("THE CIRCLES ARE THE SAME\n");
}
else if(er<epsilon)
{ /* 1 point of intersection */
if(ar>br)
{ px=ar/dc*(bx-ax)+ax;
py=ar/dc*(by-ay)+ay;
}
else
{ px=br/dc*(ax-bx)+bx;
py=br/dc*(ay-by)+by;
}
px=roundit(px);
py=roundit(py);
printf("(%.3lf,%.3lf)\n",px,py);
}
else if((dc>fabs(ar+br))||(dc<fabs(ar-br)))
{ /* no points of intersection */
printf("NO INTERSECTION\n");
}
else
{ /* 2 points of intersection */
a=(ar*ar-br*br+dc*dc)/(2*dc);
h=sqrt(ar*ar-a*a);
px =ax+(bx-ax)*a/dc+(by-ay)*h/dc;
px2=ax+(bx-ax)*a/dc-(by-ay)*h/dc;
py =ay+(by-ay)*a/dc-(bx-ax)*h/dc;
py2=ay+(by-ay)*a/dc+(bx-ax)*h/dc;
px=roundit(px);
py=roundit(py);
px2=roundit(px2);
py2=roundit(py2);
/* so close they are 1 ? */
if((px==px2)&&(py==py2))
printf("(%.3lf,%.3lf)\n",px,py);
else if((px<px2)||((px==px2)&&(py<py2)))
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px,py,px2,py2);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px2,py2,px,py);
}
}
}
[/c]

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:
One testcase I certainly need to include (ok, just did it):

0.0 0.0 2.0
0.0 0.0 1.0

You say they are the same. And btw, you sometimes print "-0.000" instead of "0.000".

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

### ah thanks

still WA....... rechecked it against your set of data and tried some examples of my own as well.

[c]
#include <stdio.h>
#include <math.h>

double epsilon=1e-6;

double roundit(double a)
{ double b;
if(a<0)
{ b=-a;
b=floor(b*1000+0.5)/1000;
b=-b;
}
else
{ b=a;
b=floor(b*1000+0.5)/1000;
}
return b;
}

void main(void)
{ double ax,ay,ar,bx,by,br,dc,px,py,a,h,px2,py2,er;
while(!feof(stdin))
{ ax=0;ay=0;ar=0;bx=0;by=0;br=0;
if(scanf("%lf",&ax)==EOF)
break;
if(scanf("%lf",&ay)==EOF)
break;
if(scanf("%lf",&ar)==EOF)
break;
if(scanf("%lf",&bx)==EOF)
break;
if(scanf("%lf",&by)==EOF)
break;
if(scanf("%lf",&br)==EOF)
break;
dc=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
if(ar>dc)
er=fabs(-ar+br+dc);
else if(br>dc)
er=fabs(ar-br+dc);
else
er=fabs(ar+br-dc);
if((dc<epsilon)&&(fabs(ar-br)<epsilon))
{ /* same circles */
/* centres coincide and radii are the same */
ax=roundit(ax);
ay=roundit(ay);
/* zero radii = one point of intersection since the circles are points */
if(ar<epsilon)
printf("(%.3lf,%.3lf)\n",ax,ay);
else
printf("THE CIRCLES ARE THE SAME\n");
}
else if(er<epsilon)
{ /* 1 point of intersection */
/* which is on the line joining the centres */
if(ar>br)
{ px=ar/dc*(bx-ax)+ax;
py=ar/dc*(by-ay)+ay;
}
else
{ px=br/dc*(ax-bx)+bx;
py=br/dc*(ay-by)+by;
}
px=roundit(px);
py=roundit(py);
printf("(%.3lf,%.3lf)\n",px,py);
}
else if((dc>fabs(ar+br))||(dc<fabs(ar-br)))
{ /* no points of intersection */
/* distance between centres is either */
/* - greater than sum of radii */
/* - or less than difference of radii */
printf("NO INTERSECTION\n");
}
else
{ /* assume 2 points of intersection */
/* and work out if points are the same at the end */
a=(ar*ar-br*br+dc*dc)/(2*dc);
h=sqrt(ar*ar-a*a);
px =ax+(bx-ax)*a/dc+(by-ay)*h/dc;
px2=ax+(bx-ax)*a/dc-(by-ay)*h/dc;
py =ay+(by-ay)*a/dc-(bx-ax)*h/dc;
py2=ay+(by-ay)*a/dc+(bx-ax)*h/dc;
px=roundit(px);
py=roundit(py);
px2=roundit(px2);
py2=roundit(py2);
/* so close they are 1 ? */
if((px==px2)&&(py==py2))
printf("(%.3lf,%.3lf)\n",px,py);
else if((px<px2)||((px==px2)&&(py<py2)))
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px,py,px2,py2);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",px2,py2,px,py);
}
}
}
[/c]

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:
You still print "-0.000":

Input:
1.4 -2.5 2.5
-5.4 4.6 8.2

Your output:
(-1.097,-2.380)(1.388,-0.000)

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

### hmm

This is quite strange. When I compile and run against this input it gives:
(-1.097,-2.380)(1.388,0.000)
I can't replicate the -0.000 thing at all
I'll look at doing this more carefully somehow.....

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:

### new attempt

Still WA. This cannot possibly be printing -0.000. I rechecked it and it conforms to your big set of input tests.

[c]
#include <stdio.h>
#include <math.h>

double epsilon=1e-6;

int roundit(double a)
{ double b;
int i;
if(a<0)
{ b=-a;
b=floor(b*1000+0.5);
b=-b;
}
else
{ b=a;
b=floor(b*1000+0.5);
}
return b;
}

void printcoords(double a,double b)
{ int i,j;
printf("(");
i=roundit(a);
if(i<0)
{ printf("-");
i=-i;
}
j=i%1000;
i=i/1000;
printf("%d.%03d,",i,j);
i=roundit(b);
if(i<0)
{ printf("-");
i=-i;
}
j=i%1000;
i=i/1000;
printf("%d.%03d)",i,j);
}

void main(void)
{ double ax,ay,ar,bx,by,br,dc,px,py,a,h,px2,py2,er;
while(!feof(stdin))
{ ax=0;ay=0;ar=0;bx=0;by=0;br=0;
if(scanf("%lf",&ax)==EOF)
break;
if(scanf("%lf",&ay)==EOF)
break;
if(scanf("%lf",&ar)==EOF)
break;
if(scanf("%lf",&bx)==EOF)
break;
if(scanf("%lf",&by)==EOF)
break;
if(scanf("%lf",&br)==EOF)
break;
dc=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
if(ar>dc)
er=fabs(-ar+br+dc);
else if(br>dc)
er=fabs(ar-br+dc);
else
er=fabs(ar+br-dc);
if((dc<epsilon)&&(fabs(ar-br)<epsilon))
{ /* same circles */
/* centres coincide and radii are the same */
/* zero radii = one point of intersection since the circles are points */
if(ar<epsilon)
{ printcoords(ax,ay);
printf("\n");
}
else
printf("THE CIRCLES ARE THE SAME\n");
}
else if(er<epsilon)
{ /* 1 point of intersection */
/* which is on the line joining the centres */
if(ar>br)
{ px=ar/dc*(bx-ax)+ax;
py=ar/dc*(by-ay)+ay;
}
else
{ px=br/dc*(ax-bx)+bx;
py=br/dc*(ay-by)+by;
}
printcoords(px,py);
printf("\n");
}
else if((dc>fabs(ar+br))||(dc<fabs(ar-br)))
{ /* no points of intersection */
/* distance between centres is either */
/* - greater than sum of radii */
/* - or less than difference of radii */
printf("NO INTERSECTION\n");
}
else
{ /* assume 2 points of intersection */
/* and work out if points are the same at the end */
a=(ar*ar-br*br+dc*dc)/(2*dc);
h=sqrt(ar*ar-a*a);
px =ax+(bx-ax)*a/dc+(by-ay)*h/dc;
px2=ax+(bx-ax)*a/dc-(by-ay)*h/dc;
py =ay+(by-ay)*a/dc-(bx-ax)*h/dc;
py2=ay+(by-ay)*a/dc+(bx-ax)*h/dc;
/* so close they are 1 ? */
if((px==px2)&&(py==py2))
{ printcoords(px,py);
printf("\n");
}
else if((px<px2)||((px==px2)&&(py<py2)))
{ printcoords(px,py);
printcoords(px2,py2);
printf("\n");
}
else
{ printcoords(px2,py2);
printcoords(px,py);
printf("\n");
}
}
}
}
[/c]

Stefan Pochmann
A great helper
Posts: 284
Joined: Thu Feb 28, 2002 2:00 am
Location: Germany
Contact:
Sorry, now I don't know any more tips. My guess would be rounding errors in the method you use, but that's hard to say...

Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany
I had WA till I tested my program on linux. The values I got were a bit different from the values I got with Windows. After I changed my program that the values were ok for Linux, I got Accepted.

Caesum
Experienced poster
Posts: 225
Joined: Fri May 03, 2002 12:14 am
Location: UK
Contact:
in what way did you have to change your program to do that ?

Revenger
Experienced poster
Posts: 132
Joined: Sun Apr 14, 2002 12:27 pm
Location: Russia

### 453 WA

I don't know why it gets WA. Please, help me!

[pascal]Program p453;

Const Eps = 1e-10;

Var x1,y1,r1 : Extended;
x2,y2,r2 : Extended;
a,b,c,d,x,y : Extended;
a0,b0,c0,di : Extended;
ya,yb,xa,xb : Extended;

begin
While Not Eof(InPut) Do begin
Readln(x1,y1,r1);
Readln(x2,y2,r2);
if (abs(x1-x2)<Eps)and(abs(y1-y2)<Eps)and(abs(r1-r2)<Eps) then
Writeln('THE CIRCLES ARE THE SAME')
else if (abs(x1-x2)<Eps)and(abs(y1-y2)<Eps)and(abs(r1-r2)>Eps) then
Writeln('NO INTERSECTION')
else begin
a:=r1*r1+y2*y2+x2*x2-r2*r2-x1*x1-y1*y1;
if abs(x1-x2)<Eps then begin
y:=a/2/(y2-y1);
b:=r1*r1-(y-y1)*(y-y1);
if b<-Eps then Writeln('NO INTERSECTION') else begin
x:=x1-sqrt(b);
Write('(');
if (-0.0004999999<x)and(x<0.0004999999) then Write('0.000') else Write(x:0:3);
Write(',');
if (-0.0004999999<y)and(y<0.0004999999) then Write('0.000') else Write(y:0:3);
Write(')');
if b>Eps then begin
x:=x1+sqrt(b);
Write('(');
if (-0.0004999999<x)and(x<0.0004999999) then Write('0.000') else Write(x:0:3);
Write(',');
if (-0.0004999999<y)and(y<0.0004999999) then Write('0.000') else Write(y:0:3);
Write(')');
end;
Writeln;
end;
end else begin
c:=a/2/(x2-x1);
d:=-(y2-y1)/(x2-x1);
a0:=d*d+1;
b0:=2*((c-x1)*d-y1);
c0:=(c-x1)*(c-x1)+y1*y1-r1*r1;
di:=b0*b0-4*a0*c0;
if di<-Eps then Writeln('NO INTERSECTION') else
if di<Eps then begin
y:=-b0/2/a0;
x:=c+d*y;
Write('(');
if (-0.0004999999<x)and(x<0.0004999999) then Write('0.000') else Write(x:0:3);
Write(',');
if (-0.0004999999<y)and(y<0.0004999999) then Write('0.000') else Write(y:0:3);
Write(')');
Writeln;
end else begin
ya:=(-b0+sqrt(Di))/2/a0;
xa:=c+d*ya;
yb:=(-b0-sqrt(Di))/2/a0;
xb:=c+d*yb;
if (xa<xb)or((xa-eps<xb)and(ya<yb)) then begin
Write('(');
if (-0.0004999999<xa)and(xa<0.0004999999) then Write('0.000') else Write(xa:0:3);
Write(',');
if (-0.0004999999<ya)and(ya<0.0004999999) then Write('0.000') else Write(ya:0:3);
Write(')');
Write('(');
if (-0.0004999999<xb)and(xb<0.0004999999) then Write('0.000') else Write(xb:0:3);
Write(',');
if (-0.0004999999<yb)and(yb<0.0004999999) then Write('0.000') else Write(yb:0:3);
Write(')');
Writeln;
end else begin
Write('(');
if (-0.0004999999<xb)and(xb<0.0004999999) then Write('0.000') else Write(xb:0:3);
Write(',');
if (-0.0004999999<yb)and(yb<0.0004999999) then Write('0.000') else Write(yb:0:3);
Write(')');
Write('(');
if (-0.0004999999<xa)and(xa<0.0004999999) then Write('0.000') else Write(xa:0:3);
Write(',');
if (-0.0004999999<ya)and(ya<0.0004999999) then Write('0.000') else Write(ya:0:3);
Write(')');
Writeln;
end;
end;
end;
end;
end;
end.[/pascal]

lowai
New poster
Posts: 48
Joined: Mon Apr 29, 2002 1:26 pm

### 453 WA

What's the trick of this problem?
here is my code:
[pascal]
const minbound = 1e-8;
var
a1, b1, r1, a, b, sqra, sqrb, sqr1, sqr2, r2, x1, y1, x2, y2 : real;
d, dr1, dr2, cons1, cons2, cons3 : real;

begin
while not eof do
begin
readln(a1, b1, r1); readln(a, b, r2);
a := a - a1;
b := b - b1;
sqra := sqr(a);
sqrb := sqr(b);
cons1 := -sqr(a) * (sqr(a) + sqr(b) - sqr(r1 + r2)) * (sqr(a) + sqr(b) - sqr(r1 - r2));
d := sqrt(sqra + sqrb);
dr1 := abs(r1 - r2);
dr2 := r1 + r2;
if (d < dr1) or (d > dr2) then writeln('NO INTERSECTION')
else
if (abs(a) < minbound) and (abs(b) < minbound) and (abs(r1 - r2) < minbound)
and not((r1 < minbound) and (r2 < minbound))
then writeln('THE CIRCLES ARE THE SAME')
else
if (dr1 < d) and (d < dr2) then
begin
cons1 := sqrt(cons1);
cons2 := 2 * (sqra + sqrb);
sqr1 := sqr(r1);
sqr2 := sqr(r2);
x1 := sqr(sqra) + sqr(a) * sqr(b) + sqr(a) * (sqr1 - sqr2) - b * cons1;
x1 := x1 / (a * cons2);
y1 := b * (sqr(a) + sqr(b)) + b * (sqr1 - sqr2) + cons1;
y1 := y1 / cons2;
x2 := sqr(sqra) + sqr(a) * sqr(b) + sqr(a) * (sqr1 - sqr2) + b * cons1;
x2 := x2 / (a * cons2);
y2 := b * (sqr(a) + sqr(b)) + b * (sqr1 - sqr2) - cons1;
y2 := y2 / cons2;
if x1 < x2 then
writeln('(', x1 + a1 : 0 : 3, ',', y1 + b1 : 0 : 3, ')(', x2 + a1: 0 : 3, ',', y2 + b1 : 0 : 3, ')')
else
if x2 > x1 then
writeln('(', x2 + a1 : 0 : 3, ',', y2 + b1 : 0 : 3, ')(', x1 + a1: 0 : 3, ',', y1 + b1 : 0 : 3, ')')
else
if y1 < y2 then
writeln('(', x1 + a1: 0 : 3, ',', y1 + b1: 0 : 3, ')(', x2 + a1: 0 : 3, ',', y2 + b1: 0 : 3, ')')
else
writeln('(', x2 + a1: 0 : 3, ',', y2 + b1: 0 : 3, ')(', x1 + a1: 0 : 3, ',', y1 + b1: 0 : 3, ')');
end
else
begin
cons1 := sqrt(cons1);
cons2 := 2 * (sqra + sqrb);
if abs(cons2) < minbound then
writeln('(', x1 + a1: 0 : 3, ',', y1 + b1: 0 : 3, ')')
else
begin
sqr1 := sqr(r1);
sqr2 := sqr(r2);
x1 := sqr(sqra) + sqr(a) * sqr(b) + sqr(a) * (sqr1 - sqr2) - b * cons1;
x1 := x1 / (a * cons2);
y1 := b * (sqr(a) + sqr(b)) + b * (sqr1 - sqr2) + cons1;
y1 := y1 / cons2;
writeln('(', x1 + a1: 0 : 3, ',', y1 + b1: 0 : 3, ')')
end;
end;
end;
end.
[/pascal]

htl
Experienced poster
Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan
My code always gets WA. Is it just the precision problem? Or anything else?
[c]
#include<stdio.h>
#include<math.h>
#define ABS(x,y) ((x)>=(y) ? (x)-(y) : (y)-(x))
void main(void)
{
double c1[3],c2[3],d1,d2,e1,e2,f1,f2,dis,x1,y1,x2,y2,a,b,x,y,z;
while(scanf("%lf %lf %lf",&c1[0],&c1[1],&c1[2])!=EOF)
{
scanf("%lf %lf %lf",&c2[0],&c2[1],&c2[2]);
if(c1[0]==c2[0] && c1[1]==c2[1] && c1[2]==c2[2])
{
printf("THE CIRCLES ARE THE SAME\n");
continue;
}
dis=sqrt((c1[0]-c2[0])*(c1[0]-c2[0])+(c1[1]-c2[1])*(c1[1]-c2[1]));
if(!((dis==c1[2]+c2[2]) || (c1[2]+c2[2]>dis && ABS(c1[2],c2[2])<dis)))
{
printf("NO INTERSECTION\n");
continue;
}
d1=-2*c1[0],e1=-2*c1[1],f1=c1[0]*c1[0]+c1[1]*c1[1]-c1[2]*c1[2];
d2=-2*c2[0],e2=-2*c2[1],f2=c2[0]*c2[0]+c2[1]*c2[1]-c2[2]*c2[2];
if(e1==e2)
{
x1=x2=-(f1-f2)/(d1-d2);
y1=(-e1-sqrt(e1*e1-4*(x1*x1+d1*x1+f1)))/2;
y2=(-e1+sqrt(e1*e1-4*(x1*x1+d1*x1+f1)))/2;
if(y1==y2)
printf("(%.3lf,%.3lf)\n",x1,y1);
else
{
if(y1<y2)
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x1,y1,x2,y2);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x1,y2,x2,y1);
}
}
else
{
a=-(d1-d2)/(e1-e2),b=-(f1-f2)/(e1-e2);
x=a*a+1,y=2*a*b+d1+a*e1,z=b*b+b*e1+f1;
x1=(-y-sqrt(y*y-4*x*z))/(2*x),y1=x1*a+b;
x2=(-y+sqrt(y*y-4*x*z))/(2*x),y2=x2*a+b;
if(x1==x2)
{
if(y1<y2)
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x1,y1,x2,y2);
else if(y1==y2)
printf("(%.3lf,%.3lf)\n",x1,y1);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x1,y2,x2,y1);
}
else if(x1<x2)
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x1,y1,x2,y2);
else
printf("(%.3lf,%.3lf)(%.3lf,%.3lf)\n",x2,y2,x1,y1);
}
}
}
[/c]

mathijs
New poster
Posts: 7
Joined: Tue Mar 04, 2003 5:15 pm
Location: Groningen, The Netherlands
Contact:
Where can I find the testdata mentioned in the earlier messages?
I keep getting WA's too...