asp.net - How to know if a vector on the right hand side -
let me first define problem,
i working on indoor navigation problem. constructed graph simulate possible paths. can calculate shortest path dijkstra , draw on map. far, good.
but not enough,
i need give instruction user navigate him.
for example:
"turn right" "turn left" "go on left"
to give these kind of instructions need know path on left , path on right.
and here have solve this:
1. undirected weighted graph 2. shortest path contains vertices , edges 3. x , y coordinates of each vertices
by way in .net using beacon technology.
do know how separate left , right edges can give direction messages user?
thanks.
the easiest way can think of take cross product of vector representing direction player facing/traveling , vector representing direction want player go in. whether player must turn left or right depends on whether result's y-coordinate positive or negative, which depends on handedness of coordinate system. pick 1 , try it. have 50% of being right, , it's easy reverse if you're wrong.
edit:
here see a×b points when a right of b. however, see -a×b points down. so, if a pointing in opposite direction—to left—then cross product point down.
Comments
Post a Comment