******************* Method of orienting curves for solving optimal control problems with state constraints