[edit] You seem to have gotten it working before I typed this up -- good work. You should take some graphics courses sometime. [/edit]
What's the value of deg90InRad? If you replace it with the hard-coded value (3.14159 / 2), what happens?
There was a problem with my pseudo-code -- I was replacing the value of x before it was used in calculating y in the second line involving sin and cos. Oops. But it actually works if you adapt it a little:
Code:
$ cat rotate.c
#include <stdio.h>
#include <math.h>
static const double deg90InRad = -3.14159265358979324 / 2;
int main(int argc, char *argv[]) {
double startX = 10.0, startY = 10.0;
double endX = 15.0, endY = 15.0;
double x, y;
// This code rotates the line by 90 degrees clockwise about the point start
// We want (x,y) to be the location of the end endpoint, and start to be moved to the origin
// First, set (x,y) to the end
x = endX;
y = endY;
// Now translate by (-startX, -startY)
x -= startX;
y -= startY;
// Next perform the rotation (you seem to have not copied the formulae correctly, I got this from the Wikipedia page, more or less)
endX = (x * cos(deg90InRad)) - (y * sin(deg90InRad));
endY = (x * sin(deg90InRad)) + (y * cos(deg90InRad));
// Now translate back, by (startX, startY)
endX += startX;
endY += startY;
printf("New line is from (%f,%f) to (%f,%f)\n", startX, startY, endX, endY);
return 0;
}
$ gcc -W -Wall -g rotate.c -o rotate -lm
rotate.c: In function ‘main’:
rotate.c:6: warning: unused parameter ‘argc’
rotate.c:6: warning: unused parameter ‘argv’
$ ./rotate
New line is from (10.000000,10.000000) to (15.000000,5.000000)
$
Turns out I also had to make the angle negative to get a clockwise rotation.
If you're still having trouble with your code, you might try posting a more substantial portion of it.