How to check if polygon is convex? [duplicate]

2019-05-29 10:12发布

问题:

Possible Duplicate:
How do determine if a polygon is complex/convex/nonconvex?

I'd like to know how you would check if a polygon is convex or not.

One apparent way of doing it is to run a convex hull algorithm. If the number of points in the convex hull is the same as the number of points in the polygon, does that mean the polygon is convex?

回答1:

Walk around the polygon, check that at each node that you are turning the same way (either left or right, consistently, the whole way round).

I think finding the convex hull of a set of points is more complicated than checking if a polygon is convex, so going about it in that way might be less desirable.