Given $(x_1,y_1)$ and slope(angle), find $(x_2,y_2)$ coordinate

47 Views Asked by At

On a price/time chart where coordinates are defined in pixels, I am looking for formula to find $(x_2,y_2)$ coordinate. I already know the slope in degrees and $(x_1,y_1)$ coordinate. Help would be appreciated.

1

There are 1 best solutions below

0
On

From the given information you only will be able to deduce a link between $x_2$ and $y_2$

The correlation between these two points are

$$ \tan \Theta = \frac{y_2-y_1}{x_2-x_1} $$

where $\Theta$ is the angle. So

$$ y_2 = \tan\Theta\cdot x_2-\tan\Theta\cdot x_1+y_1 $$

You will need to specify $x_2$ to get a corresponding $y_2$.

Hope this helps :)