I gave it some more thought, and I think you can avoid the winding/overflow issues by minimizing the dot product over the pairs which have positive cross product. New pseudocode:
Code:Number smallest_dot = 1.0; Array[2] best_vertex_pair; for (a = first vertex to last) for (b = first vertex to last) if (a != b && cross2D(a,b) > 0) { Number current_dot = dot2D( normalize(a), normalize(b) ); if (current_dot < smallest_dot) { smallest_dot = current_dot; best_vertex_pair = [a,b]; } }




Reply With Quote
