Mail Archives: djgpp/1998/10/02/09:40:46
Dear cbroo AT iafrica DOT com (Chris Brooker),
Would you mind giving a valid email address if you expect answers ?
Tony
>This message was created automatically by mail delivery software.
>
>A message that you sent could not be delivered to all of its recipients. The
>following address(es) failed:
>
> cbroo AT iafrica DOT com:
> unknown local-part "cbroo" in domain "iafrica.com"
At 07:14 02.10.98 GMT, you wrote:
>Here are the functions:
>
>double dir_degrees(int x1, int y1, int y2, int x2)
>{
> int v1, v2;
> double dir;
> v1 = y1 - y2;
> v2 = x1 - x2;
> if (v2 == 0)
> v2++; //Stops division by zero errors
> dir = 57 * atan(v1 / v2);
> return dir;
>}
Consider using atan2:
#include <math.h>
double dir_degrees(int x1, int y1, int y2, int x2)
{
return atan2(y1-y2, x1-x2) * 180.0 / PI;
}
Tony
**************************************************************
Dipl.-Ing. Anton HELM *T* mailto:tony AT nt DOT tuwien DOT ac DOT at
Institut fuer *U* http://www.nt.tuwien.ac.at/~tony/
Nachrichtentechnik und *W* http://www.nt.tuwien.ac.at/
Hochfrequenztechnik *I* talkto:tony AT eagle DOT nt DOT tuwien DOT ac DOT at
Guszhausstr. 25/389 *E* phoneto:+43-1-58801-38920
A-1040 Wien, AUSTRIA *N* faxto:+43-1-5870583
**************************************************************
finger -l tony AT penguin DOT nt DOT tuwien DOT ac DOT at for PGP public key
**************************************************************
- Raw text -