projects
/
my-code
/
triang.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c05b048
)
completed prog - 1st stable rel. ;)
author
hackbard
<hackbard>
Fri, 9 Aug 2002 02:40:01 +0000
(
02:40
+0000)
committer
hackbard
<hackbard>
Fri, 9 Aug 2002 02:40:01 +0000
(
02:40
+0000)
triang.c
patch
|
blob
|
history
diff --git
a/triang.c
b/triang.c
index
04ec140
..
1caf49a
100644
(file)
--- a/
triang.c
+++ b/
triang.c
@@
-4,7
+4,7
@@
#define MAXSIGNAL 100
#define MAXSIGNAL 100
-double deltaX1, deltaY1;
+double deltaX1, deltaY1
, deltaX2, deltaY2
;
/*
zweite Loesung ist achsensymmetrisch zur Verbindungslinie
/*
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;
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);
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));
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 {
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));
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;
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! */
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("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
);
}
}