Pixel Rotation and INT truncation

I'm having a problem with a functions I wrote to rotate a coordinate (x,y) around the origin.

I use this to draw an Equilateral triangle that I want to use to represent the player's ship, much like Asteroids. Initially, this works just as I planned, and it draws the ship in its initial shape without incident.

However, when I repeatedly rotate the ship, it gets smaller and smaller until it collapses to a point on the center. I believe this is because I am using integer values to represent the X and Y coordinate positions, which are truncating the floating point values used by the Sine/Cosine functions that perform the rotation, thus the ship shrinks. I tried changing all integer values to floats, but some of my code requires non-float data types (The << operator used in some drawing procs).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Convert degrees into radians
float Ship::convert(float degrees){
	return degrees*(PI/180);
}

//Rotation X-Coord
int Ship::rotateX(int x, int y, float degrees){
	return (x*cos(convert(degrees)))-(y*sin(convert(degrees)));
}

//Rotate Y-Coord
int Ship::rotateY(int x, int y, float degrees){
	return x*sin(convert(degrees))+y*cos(convert(degrees));
}

//Rotate the Ship
void Ship::rotateShip(float degrees){
	vertA [0]=rotateX(vertA [0], vertA [1], degrees);
	vertA [1]=rotateY(vertA [0], vertA [1], degrees);
	vertB [0]=rotateX(vertB [0], vertB [1], degrees);
	vertB [1]=rotateY(vertB [0], vertB [1], degrees);
	vertC [0]=rotateX(vertC [0], vertC [1], degrees);
	vertC [1]=rotateY(vertC [0], vertC [1], degrees);
}


The rotation seems to work, it's just the the ship gets smaller. Does anybody know what I can try?
Topic archived. No new replies allowed.