Which of two vertices has the wider angle?

45 Views Asked by At

enter image description here
Given that:

  1. two vertices from different paths share the same point;
  2. the winding orientation of these paths is unspecified;
  3. the angle at both vertices will be less than 180 degrees
  4. these paths don't intersect

what's the most efficient way to determine which path is outside (has a wider angle than) the other?

I could use cross product formula to get the orientations of each path, to determine which of the respective adjacent vertices is on the left (relative to the other), and then perform a third cross product calculation using the left-most vertex from each path and the common (lower) vertex to determine which of the left vertices is outside the other. But is there a more efficient approach?

In other words, in the image above, how can I most efficiently verify that the blue path is outside the red path?

Edit:

It's also possible that either the left edges or the right edges are colinear (but both won't be colinear).

1

There are 1 best solutions below

1
On

I would compare the angles, if you have x,y information of end points. First calculate the angles of each path, if you don't have the x,y of common vertice just give it a random x,y the inner line will remain inner no matter what.

Now that you have angular info of both paths, you can compare them to each other. Find the angle between any two close end points from different paths, and find the angle between them from the shared vertice. Now you are questioning if A(b1-r1) + R(r1-r3) ?> B(b1-b3).

There is only one exception I guess you didn't mention, what if what if the order was like this: r1-b1-r3-b3? Now neither of them is inner or outer. Maybe you should also clarify that one. Sorry if I'm missing any point.