I have two line segments which are currently intersecting, how do I rotate either intersecting line about the intersection point?
How do I calculate rotation of these lines?
Rotation about a point formula:
x' = x * cos(theta) - y * sin(theta)
y' = x * sin(theta) + y * cos(theta)
But I believe this is rotation about the origin. So I need to first calculate the point of intersection. I know how to calculate the point of intersection, so let's assume I have my point of intersection.
How do I use my pointOfIntersection variable to rotate a line about this? I can plug in values for x and y, but what is theta? Is theta the angle of intersection?
atan2
function to help you determine the direction from the center of your rotation to the mouse at any instant: the angle is $atan2(y-y_0,x-x_0)$ where $(x,y)$ is the coordinates of the mouse relative to your coordinate system. If the user clicks at one angle and then drags to a different angle, $\theta$ is the difference between those angles. $\endgroup$