# Algorithm to rotate a line

I have a program I'm writing that requires a line drawn in SVG to be rotatable, and I'm having trouble with the math behind that. If I were to have a line at the beginning that has a start point of (40, 40) and an endpoint of (40, 240), and I want to be able to rotate that line in increments of one degree without changing the length of the line, what math would I need to look into? I'm familiar with basic slope and y-intercept math, but I'm not sure how to predict the replots of the start and end points along a rotation.

-
Perhaps a little off topic, but doesn't SVG have operators for letting you rotate an object around a point? Also, you haven't specified which point you wish to rotate your line segment about. Finally, I think many beginning texts on computer graphics will include the necessary mathematics, which includes some very elementary linear algebra including rotation matrices. Sorry I can't be more specific. – Harald Hanche-Olsen May 10 '13 at 8:36
Unfortunately, the "transform" attribute doesn't work on lines. – Fibericon May 10 '13 at 9:01