This is my function for triangular collision checking.

ship*.x1
ship .x2
ship.x3
ship.y1
ship.y2
ship.y3
Are all integers*

missile[j].x

missile[j].y

Are doubles

PI is a constant equal to 3.14159265

Everything compiles correctly, but for some reason a1, a2, and a3 all end up being equal to 0

Is there something wrong with my math? Do I have some kind of syntax error?

```
void CollisionCheck()
{
double a1, a2, a3;
for (int j=0; j<254; j++)
{
if (missile[j].visible)
{
for (int i=0; i<2; i++)
{
a1=atan2(ship[i].y1-missile[j].y, ship[i].x1-missile[j].x);
a1+=-atan2(ship[i].y2-missile[j].y, ship[i].x2-missile[j].x);
a1=a1*(PI/180);
a1=abs((int)a1);
a2=atan2(ship[i].y2-missile[j].y, ship[i].x2-missile[j].x);
a2+=-atan2(ship[i].y3-missile[j].y, ship[i].x3-missile[j].x);
a2=a1*(PI/180);
a2=abs((int)a1);
a3=atan2(ship[i].y3-missile[j].y, ship[i].x3-missile[j].x);
a3+=-atan2(ship[i].y1-missile[j].y, ship[i].x1-missile[j].x);
a3=a1*(PI/180);
a3=abs((int)a1);
if (a1>180) {a1+=-180;}
if (a2>180) {a2+=-180;}
if (a3>180) {a3+=-180;}
if (a1+a2+a3>=360)
{
//ship[i] is colliding with missile[j]
ship[i].health+=-25;
ship[i].visible=false;
missile[j].active=false;
missile[j].visible=false;
}
}
}
}
}
```