title: How to determine if a vector is between two other vectors?
body: <p>I am looking for a fast and effective way to determine if vector B is Between the small angle of vector A and vector C. Normally I would use the perpendicular dot product to determine which sides of each line B lies on but in this case is not so simple because of the following:  </p>
  
  <ul>
  <li>None of the vectors can be assumed to be normalized and normalizing them is an extra step I would prefer to avoid.</li>
  <li>I have no clear notion as to which side is the smallest angle so it is hard to say which side of the line is good or not.</li>
  <li>It is possible for A and B to be co-linear or exactly 180 degrees apart in which case I want to return false.</li>
  <li>While I am working in a 3D enviroment it is easy for me to simplify this to 2D if that makes things easier and more importantly faster. This test will be used in an algorithm that needs to run as fast as possible.</li>
  </ul>
  
  <p>If there is some easy and efficient method to determine which direction my perpendicular vectors should both point I could use the two dot products for my test.</p>
  
  <p>Another approach I have been considering without much success so far is using a matrix. In theory from what I understand of matrix transforms I should be able to use A and C as basis vectors. Then multiplying B by the matrix I should be able to test what quadrant B then lies in by whether X and Y are both positive. If I could get this approach to work it would likely be the best since one matrix multiplication should be faster than two dot products and I should not have to worry about which side has the smallest angle on it.</p>
  
  <p>The problem is from my tests I cannot simply use A and C as bases and multiply it normally and get correct behavior.  I am really not sure what i am doing wrong here. I have run across the term "Vector spaces" a few times which as near as I can figure seems to be a very similar concept to matrix transforms without any requirements for orthogonal bases or orthonormal bases. Is it the same thing as matrix? If not, might there be a better approach and how would I use that?</p>
  
  <p>Just to give a more visual explanation of what I am talking about:</p>
  
  <p><img src="https://i.stack.imgur.com/1Dnwo.png" alt="Rough example"></p>
  
  <p>@Aki Suihkonen
  I can't seem to get it working. Coded up a mock case I could run through and see if I can't figure somthing out</p>
  
  <p>For this case using</p>
  
  <p>Ax 2.9579773 Ay 3.315979</p>
  
  <p>Cx 2.5879822 Cy 5.1630249</p>
  
  <p>For B I rotated around the four quadrants the vectors divide the space up into.</p>
  
  <p>The signs I got:
  - For Q1 <code>--</code>
  - For Q2 <code>+-</code>
  - For Q3 <code>+-</code>
  - For Q4 <code>--</code></p>
  
  <p>Assuming I rotated around in the enviroment the same direction as the image I am fairly sure I did.</p>
  
  <p><img src="https://i.stack.imgur.com/MPXXI.png" alt="Quadrants"></p>