cccc996Use Nawaf Bou-Rabee's reference WALNUTS implementationJeremy Magland 1function result = u_turn(O)
2 theta_left = O{1,1};
3 rho_left = O{1,2};
4 theta_right = O{end,1};
5 rho_right = O{end,2};
7 dot1 = dot(rho_right, (theta_right - theta_left));
8 dot2 = dot(rho_left, (theta_right - theta_left));
10 result = (dot1 < 0) || (dot2 < 0);
11end