Here is my code

const float DEG2RAD = 3.14159/180; void findcoord_circle(int x, int y, double radius, double degree, int &getx, int &gety) { float degInRad = degree*DEG2RAD; getx=(int)((cos(degInRad)*radius)+0.5); gety=(int)((sin(degInRad)*radius)+0.5); getx+=x; gety+=y; } double distance(int x1, int y1,int x2, int y2) { double xd = (double)x2-(double)x1; double yd = (double)y2-(double)y1; return(sqrt(xd*xd + yd*yd)); } double finddegrees(int x1, int y1, int x2, int y2) { double vx, vy; vx=(double)x2-(double)x1; vy=(double)y2-(double)y1; return atan(vy/vx)*(180/3.14159265); } void drawturnedimage(SDL_Surface *input, SDL_Surface *screen,int x,int y ,double degrees) { int center_w=(int)(input->w/2); int center_h=(int)(input->h/2); for(int a=0;a<input->h;a++) { for(int b=0;b<(input->w);b++) { double degrees2; degrees2 = finddegrees(x+center_w,y+center_h,x+b,y+a)+degrees; int pixel_x, pixel_y; double radius=/*(int)*/distance(x+center_w,y+center_h,x+b,y+a); findcoord_circle(x+center_w,y+center_h,radius,degrees2,pixel_x,pixel_y); Uint8 r,g,b; SDL_GetRGB(getpixel(input,b,a),input->format,&r,&g,&b); DrawPixel(screen,pixel_x,pixel_y,r,g,b); } } } }

I wanna draw a rectangular (136 on 136) blue bitmap and i get this if i rotate it on 30 degrees

Where did i go wrong?

EDIT:

You gotta love the patterns on the ouput though

This post has been edited by **manhaeve5**: 24 September 2007 - 12:17 PM