givexa
givexa

Reputation: 119

How to determine if Quadrilateral is convex or not by given points

Is there any way to determine whether quadrilateral is convex or not? (meaning each of its angles are less than 180 degree) by using points. For example A(0,0) B(2,0) C(2,2) D(-1,3). How can we determine that all of the angles in ABCD quadrilateral are less than 180 degrees.

Upvotes: 0

Views: 2542

Answers (1)

sebtheiler
sebtheiler

Reputation: 2557

I believe this link answers your question, for any polygon.

In summary, given a list of points [[0, 0], [2, 0], [2, 2], [-1, 3]], check if the direction of the cross product of any two adjacent sides are the same (if so, the polygon is convex).

Upvotes: 1

Related Questions