1

I have a list of vertices 3D, creating a polygon. I need to triangulate it and i use the cutting ears algorithm. My polygons are non-convex, so i need to find the concave angles in the polygon. I also dont know wich orientation are my polygons ( clockwise or counter clocwise)

Could anyone help me how to determine if is clockwise or counter clockwise

Thank you

  • clockwise or counter clockwise depends on the side you're looking the polygon from, it's not absolute in 3d, I think – fortran Jul 29 '09 at 11:03
  • Are you using a library (like OpenGL)? If so, you may be able to use something like GLUtesselator. This will scale easily even to non-convex polygons if you ever need it. – Tarydon Jan 07 '10 at 02:03

2 Answers2

1

It's probably simplest to project the polygon into a convenient plane (say z=0) and then use a method like reinier's.

1) Set all z=0. This won't change the answer.

2) Use a method like reinier's or this one to determine whether the polygon is clockwise or counterclockwise, and therefore whether the cross products "should be" +z or -z.

3) Any vertex with a cross product that points in the "wrong" direction is concave.

Beta
  • 96,650
  • 16
  • 149
  • 150
  • Almost correct, except we need to check that the polygon is not in a plane perpendicular to the XY plane (in which case setting all z to 0 will degenerate it to a line). – Tarydon Jan 07 '10 at 02:05
0

use the cross product

ordering of polygon

Toad
  • 15,593
  • 16
  • 82
  • 128