Sign in to follow this  
marcus12

Angle Calculation

Recommended Posts

Hi,
I want to find the angle between the ray of Light (Red) and the Normal (Blue) at different point of contact as shown
in figure.

From the figure the two points of the Black LINE are (700.0f, 500.0f) and (700.0f, 300.0f). The logic I am THINKING is to get the slope of the

Black line with two points ie m = y1-y2/(x1-x2) in this case its infinity

using this get the equation of line perpendicular to BLACK, which can be taken as the NORMAL to the black line.

The RED line which is ray of light is represented using vector with 1) Origin 2) Direction

I am confused in how to get the angle between the Normal (Blue) and the ray (RED) ie the angle 'A' as shown in figure


All suggestions are welcome

Share this post


Link to post
Share on other sites
If you have two normalized direction vectors a and b, you can computer the angle between them using the dot product. See http://en.wikipedia.org/wiki/Dot_product#Geometric_interpretation .

Share this post


Link to post
Share on other sites
[quote name='alvaro' timestamp='1318088057' post='4870513']
You seem to just need a this formula for the angle between two vectors:

angle(v,w) = acos(dot_product(v,w))
[/quote]


Ok..If one of the vector is the RAY of light (Red) .

Then how to represent the NORMAL ( blue) line as a vector? given only two points representing the BLACK line as shown in figure

Share this post


Link to post
Share on other sites
[quote name='marcus12' timestamp='1318089712' post='4870519']
[quote name='alvaro' timestamp='1318088057' post='4870513']
You seem to just need a this formula for the angle between two vectors:

angle(v,w) = acos(dot_product(v,w))
[/quote]


Ok..If one of the vector is the RAY of light (Red) .

Then how to represent the NORMAL ( blue) line as a vector? given only two points representing the BLACK line as shown in figure
[/quote]

Subtract the two points to get a vector along the black line. Then swap the coordinates and change the sign of one of them to get a perpendicular vector.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this