How can I plot a line just by knowing its angle of inclination and starting point?
6 views (last 30 days)
Show older comments
Hello!
I'm trying to figure out how can I plot a line from the one I only know its angle of inclination with respect of the horizontal and also where it starts. What I'm basically trying to do is to plot the representation of a sphere that emittes light and it goes into a different substance so it gets refracted and with the Snell's Law I know both angles, here's a picture of what I want to mean:

The first image is what I try to mean about the lightbeam, and the second one is what I'm trying to do with the angles, this is so I can put that into a for loop and make the first image. Also I don't know what to do in order that the scale or ruler doesn't move from the first plot which is the black line there stated at zero.
Thanks so much for your help!
0 Comments
Answers (1)
Walter Roberson
on 19 Jan 2017
Use the usual: y = m * x + b and m = tan(theta) . With your given start point, solve for b:
y0 = tan(theta) * x0 + b
implies
b = y0 - tan(theta) * x0
1 Comment
Rawan Alghamdi
on 7 Feb 2019
Suppose my reference line is between (8,2) and (5,8), and we are trying to draw another line of angle 45 degrees.
How to implement the information you provided.
So, b will be my new point? Then what is my y0?
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!