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.
The canonical approach is using a rotation matrix to rotate the two endpoints of the line segment. The Wolfram article I linked to describes rotation about the origin. If you wish to rotate about another point, you need to:
This is handled typically using a 4x4 (or 4x3) matrix in computer graphics.