
‘POINTS’ = [ [0, 0], [5, 0], [5, 5], [0, 5] ], ‘N’ = 4.

As the given polygon is a convex polygon, you should return ‘True’ as the answer.
1. The polygon formed by the given points is always a Simple polygon, i.e., exactly two edges intersect at each vertex, and the edges otherwise don’t intersect each other.
2. All the given points are unique.
The first line of input contains an integer ‘T’ which denotes the number of test cases. Then, the ‘T’ test cases follow.
The first line of each test case contains an integer ‘N’ denoting the size of the array ‘POINTS’. Then, ‘N’ lines follow.
Each line contains two integers, ‘X’ and ‘Y’, representing an element in the array ‘POINTS’.
For every test case, if the given polygon is convex, return ‘True’. Otherwise, return ‘False’.
You do not need to print anything; it has already been taken care of. Just implement the function.
1 <= T <= 100
1 <= N <= 1000
-10^4 <= Value in each element of ‘POINTS’ <= 10^4
Time limit: 1 second
For any edge ‘E’ in a convex polygon, every vertex ‘V’ should be either at one side of it (above/below) or on it. Consider the following two examples:

Let ‘AB’ be the edge between the vertices ‘(A, B)’ and ‘C’ be any vertex.
‘POS = (B.x - A.x) * (C.y - A.y) - (B.y - A.y) * (C.x - A.x)’ (Position of point ‘C’ w.r.t. ‘AB’).
Here, ‘POS’ is the Z-component of the cross-product between the vectors ‘AB’ and ‘AC’. To decide if ‘C’ is below or above ‘AB’:

In other words, ‘POS’ can be:
So, for any edge, if we find two vertices having opposite signs of ‘POS’, then we declare that the polygon is not convex.
Algorithm:
For a convex polygon, all the internal angles must be less than 180 degrees.
For the three vertices, ‘A’, ‘B’ and ‘C’, we have one edge from ‘A’ to ‘B’ and one edge from ‘B’ to ‘C’. So, for each such triplet, the angle between ‘AB’ and ‘BC’ must be less than 180 degrees.
From the sign of the ‘POS’ value computed in the previous approach, we can find out whether the angle between ‘AB’ and ‘BC’ exceeds 180 degrees or not. For the same ‘A’, ‘B’, ‘C’, depending on the order in which we chose them, ‘POS’ can produce either the exterior or the interior angle values. But, we know that the given polygon cannot have all its interior angles greater than 180 degrees. So, if all the ‘POS’ values are either positive or negative (all values have the same sign), we can say that the polygon is a convex polygon.
We have, ‘pos = (A.x - B.x) * (C.y - B.y) - (A.y - B.y) * (C.x - B.x)’.
Here, 'POS' is the Z-component of the cross-product between the vectors ‘AB’ and ‘AC’.
Algorithm: