You are not logged in.
Hello, I have a geometric problem and I would like some help!
I have a chain of lines, one after the other with different angles and lengths.
When I want to create a new line, after the last line, I give an angle and I want to rotate the line in accordance with the previous line.
So, at the beginning I create the new line with the same slope as the the previous line and then I want to rotate it.
The problem is the calculation of the new ending point of the new line, knowing the starting point of the new line, the ending point of the new line before the rotation, and the angle of the rotation.
PS. The angle that is given for the rotation, does not refer to the Cartesian Coordinate System but to the slope of the previous line.
Thank you for your patience and your time.
The matrix for rotation through angle θ anticlockwise about the origin is
If you are rotating about the point (a,b) other than the origin, first translate to the origin using
, then rotate with the matrix, then translate back with .Offline
Hello again,
thank you for your answer, it really helped me.
But, I would like something more.
I want to create a line that is an extension of an other.
So, I want to find the ending point of the second line, knowing the slope of the first line.
How could we do this ?!
Thank you in advance for your help.
I found it in another forum
Let us call the x and y components in each of the ordered pairs as follows:
A = (Ax, Ay)
B = (Bx, By)
C = (Cx, Cy)
Now let us call the slope of the line m and it can be obtained from points A and B:
m = (By - Ay) / (Bx - Ax) = (Cy - By) / (Cx - Bx)
And suppose we want to extend the line by length L from point B to C, we know that:
L² = (Cx - Bx)² + (Cy - By)²
Using these two equations we can derive expressions for Cx and Cy in terms of known quantities. I won't go through the algebra here but the results are:
Cx = L / √(m² + 1) + Bx
Cy = L*m / √(m² + 1) + By