Search code examples
vectorspaceradial

How to check if a vector is inside of an angular space?


check the image: https://i.sstatic.net/ozWzF.png

Basically I have A,B and C on the same plane and I want to check if True or False that the V is inside the angular space (is this a concept?) defined by A and B or B and C

Thanks


Solution

  • If I understand your question correctly, then what you need is the sign of the cross-product. If you have two vectors, A and B, then the cross product of A and B is positive if and only if B is in the counterclockwise direction from A. In other words, if you point your hand in the direction of A, and then move it to point in the direction of B, then you'll have to have move your hand counterclockwise.

    In your question, let's assume and CrossProduct(a, b) is positive. Then c is between a and b if and only if both CrossProduct(a, c) and CrossProduct(c, b) are both positive.

    If CrossProduct(a, b) is negative to begin with, then you want both CrossProduct(a, c) and CrossProduct(c, b) to be negative, too.