Angle between two line segments Here's a question? I have two line segments which have an angle between them. For the line segments, I know coordinates of their points. I need to be able to rotate one segment for one angle (for example, $\alpha$ needs to be $60^\circ$) - it doesn't matter in which direction is angle calculated, as long as it stays persistent. Because that I only know point of line segment, idea is to rotate other point around point of intersection for desired angle, and to get coordinates for that point after rotation. But I can not come to solution which works for every angle and where rotation direction (clockwise or counter-clockwise) is persistent. $(0, 0)$ is in top left corner, as shown on picture. You don't have to bother with theory (if you don't want), I need to apply this as algorithm. Thanks

 A: The usual rotation matrix approach works.  To rotate by an angle $\theta$, you have $x'=x \cos \theta - y \sin \theta, y'=y \cos \theta + x \sin \theta$  If you apply it to all the points, the angles between lines will stay the same.
A: Ok, I have found solution for my problem (here's solution in objective c):
first of all, I'm getting length of line segment which needs to be rotated. Then i'm calculating angle between static line segment and intersection point - or axis (second angle in code). Afterwards, I'm adding second angle to desired angle, and rotating point of line segment around intersection point for sum of two angles (that's because i need angle to be set between two line segments, not between one segment and axis). Angle will alway be calculated in clockwise direction from static point. 
-(CGPoint)rotateWallaroundPoint:(CGPoint)rotateAroundP pointToRotate:(CGPoint)pToRotate staticPoint:(CGPoint)staticP forAngle:(CGFloat)angle opposite:(bool)opp {
CGFloat l;
    l = sqrtf( (pToRotate.x - rotateAroundP.x) *(pToRotate.x - rotateAroundP.x) + (pToRotate.y - rotateAroundP.y) * (pToRotate.y - rotateAroundP.y));
    CGPoint rotatedPoint;
    CGFloat secondAngle;
    secondAngle = atan2f(staticPoint.y - rotateAroundP.y,staticPoint.x - rotateAroundP.x);
    angle = angle + secondAngle;
    rotatedPoint.x = l * cosf(angle) + rotateAroundP.x;
    rotatedPoint.y = l * sinf(angle) + rotateAroundP.y;
    return rotatedPoint;

