I have one incident edges and multiple outgoing Edges, for which I want to pick an outgoing edge such that the angles between the outgoing edge and the incoming edge is the smallest of all. We know the coordinates for the vertex $V$ .
The angle must start from the incoming edge ($e_1$) and ends at another edge ($e_2$, $e_3$, $e_4$).
Also, the angle must be form in such a way that the face constructed from $e_1$ to $e_2$ must be in counter-close-wise direction. In other words, the face that you construct when you link all the vertexes $V$ in $e_1$ and $e_i$ together, must be a counter clockwise cycle.
So in the case below, edge $e_2$ must be picked because the $\theta$ is the smallest.
Is there an algorithm that does this elegantly? The few algorithms I devise are just plain ugly and requires a lot of hacks.
Update: One method that I think of ( and proposed below) is to use the cross product for each edge against the incoming edge $e_1$, and get the minimum $\theta_{i}$. i.e.,
$$e_{1} \times e_{i} = |e_{1}||e_{i}| \sin\, \theta_{i}$$
But the problem of this is it doesn't really work. Consider the following test cases: $$e_1=(1,0)$$ $$e_2=(-1/\sqrt(2),1/\sqrt(2) )$$ $$e_3=(1/\sqrt(2),-1/\sqrt(2))$$
One would find that
$$\theta_2 = -45^o$$ $$\theta_3=-45^o$$
Both are equal-- even though we know that $e_2$ should be selected.