home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD1.img
/
d1xx
/
d118
/
wiredemo
/
sub.c
< prev
next >
Wrap
C/C++ Source or Header
|
1987-12-02
|
882b
|
63 lines
#include "bubbles.h"
ISIN(theta)
uword theta;
{
double d = sin((double)theta / 10430.219);
return((short)(d * 32767));
}
ICOS(theta)
uword theta;
{
double d = cos((double)theta / 10430.219);
return((short)(d * 32767));
}
ibearing(x,y)
{
return((long)(bearing((double)x,(double)y) * (32768.0 / XPI)));
}
irange(x,y)
{
return((long)range((double)x,(double)y));
}
double
bearing(x,y)
double x,y;
{
if (x < 0.0001 && x > -0.0001) {
if (y < 0.0)
return(3*XPI2);
return(XPI2);
}
if (x > 0.0)
return(atan(y/x));
return(XPI-atan(-y/x));
}
double
range(x,y)
double x,y;
{
return(sqrt(x*x+y*y));
}
double
edgeinterceptrange(x,y)
double x,y;
{
x = fabs(x);
y = fabs(y);
if (x > y) /* intercept is (1,?) ? = y/x */
return(range(1.0,y/x));
else /* intercept is (?,1) ? = x/y */
return(range(1.0,x/y));
}