[Math] Finding end point of straight line given starting point and angle

algorithmsgeometrylinear algebra

I have a program which computes the angle of skew of a scanned photograph.

It returns the angle of skew in degrees.

I now need to draw lines across the image which follow the angle of skew. These lines start at different points on the y axis and always at 0 on the x axis. Therefore I know the starting point $(x,y)$ for each line and the angle of skew.

How do I compute the $(x,y)$ point for the end of the line? I know the end x axis value (which will be the width of the image in pixels) so I am really looking to compute an end value for y given the skew angle.

Any help much appreciated.

Best Answer

The equation of a line trough the point $(0,y_0)$ that forms a certain angle $\alpha$ with the $OX$ axis is $y=y_0+(\tan \alpha) x.$ If you know $x$ then the end point is $(x,y_0+(\tan \alpha) x).$ (Remember to introduce the angle in degrees.)