From: hackbard Date: Fri, 9 Aug 2002 02:40:01 +0000 (+0000) Subject: completed prog - 1st stable rel. ;) X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=1f66fd1f42b17d524529fbe20f1b004a4a8e7db5;p=my-code%2Ftriang.git completed prog - 1st stable rel. ;) --- diff --git a/triang.c b/triang.c index 04ec140..1caf49a 100644 --- a/triang.c +++ b/triang.c @@ -4,7 +4,7 @@ #define MAXSIGNAL 100 -double deltaX1, deltaY1; +double deltaX1, deltaY1, deltaX2, deltaY2; /* zweite Loesung ist achsensymmetrisch zur Verbindungslinie @@ -31,19 +31,19 @@ c_q=(X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2); deltaX=X1-X2; deltaY=Y1-Y2; zaehler=a_q-b_q-c_q; -printf("Debug: Zaehler %f\n", zaehler); nenner=-2*sqrt(c_q*b_q); -printf("Debug: Nenner %f\n", nenner); printf("Debug: a=%f , b=%f ... und c=%f\n", sqrt(a_q), sqrt(b_q), sqrt(c_q)); -if ( (sqrt(a_q)+sqrt(b_q))>=sqrt(c_q) ) { +if ( (sqrt(a_q)+sqrt(b_q)) <= sqrt(c_q) ) { printf("impossible situation!\n"); deltaX1=0; deltaY1=0; } else { - deltaX1=sqrt(b_q)*cos(acos(deltaX/deltaY)-acos(zaehler/nenner)); + deltaX1=-sqrt(b_q)*cos(acos(deltaX/deltaY)-acos(zaehler/nenner)); deltaY1=sqrt(b_q)*sin(acos(deltaX/deltaY)-acos(zaehler/nenner)); + deltaX2=deltaY1; + deltaY2=-1*deltaX1; } } @@ -58,8 +58,8 @@ a=0; b=0; c=0; d=10; -e=90; -f=90; +e=5; +f=2; seek_target (a, b, c, d, e, f); /* wir sind im ursprung, kumpel 10 einheiten ueber uns! */ @@ -67,7 +67,7 @@ seek_target (a, b, c, d, e, f); printf("Debug: seek_target ausgefuehrt!\n"); printf("1. Moeglichkeit: (%f;%f)\n", deltaX1, deltaY1); -// printf("2. Moeglichkeit: (%f;%f)\n", delta2, delta1); +printf("2. Moeglichkeit: (%f;%f)\n", deltaX2, deltaY2); }