Jump to content


Convex polygon ...


  • You cannot reply to this topic
1 reply to this topic

#1 Groove

    New Member

  • Members
  • PipPip
  • 26 posts

Posted 06 November 2006 - 05:57 PM

In my program I need to select 4 vertices from two triangles.

Unfortunally, sometime the selection look like:
4 ----- 3
| |
| |
1 ----- 2
The good case but sometime:
3 ----- 2
\ /
/ \
1 ----- 4
the bad case ...

Is there any good and robust solution to make sure that I process my vertices in the right order?

Cheers !

#2 .oisyn

    DevMaster Staff

  • Moderators
  • 1822 posts

Posted 06 November 2006 - 06:38 PM

You can do a crossproduct between any two adjacent edges and check whether the results always point in the same direction.

Or you can project the points on a plane and calculate the convex hull around the points, that would give you the right answer immediately.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users