How does one know if a normal vector is between two angles?

I have a Max Angle and a Min Angle, and also a unit vector pointing in some direction (2D).

How do I find out if this normal vector is between the two angles?

Answers


Calculate the angle from the dot product (this is easy in 2d) and then compare to your angle range.


I don't know c#, but I know math:

Suppose the vector's coordinates are (x,y), and it is a unit vector, so |(x,y)| = 1. The angle a between the positive x-axis and the vector is

a = atan2(y,x)

where atan2 is the four-quadrant arctangent. You can then check if this angle is between your max and min angles (provided they are also defined with respect to the positive x-axis).

Note that a is in radians; if your angles are given in degrees, you should first compute

a = a*180/pi;

where pi = 3.1415..... of course.

Does this help at all?


Need Your Help

Saving micro sign character in a mongo collection

python unicode python-unicode

I'm working on a python script to created a mongo collection based on a MySql db. The problem is with the micro sign character:

In MPI How to broadcast c++ vector?

c++ vector mpi

I want to broadcast C++ vector using MPI.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.