@MartyMacGyver Yes, indeed cross product is not defined for 2D space since the product vector must be orthogonal to the plane formed by the two vectors for calculation.

Another way to "embed" 2D vectors into 3D space is to force z-component as zero, i.e., let "2D" vectors

v1 = (x1, y1, 0), v2 = (x2, y2, 0),

then by the determinant formula of 3D cross product, we have

v1 x v2 = det([v1, v2, e]),

where e = (ix, iy, iz) is the triplet of 3 axis unit vectors. Only iz-direction has non-zero coefficient which is exactly 2x2 determinant det([[x1, y1], [x2, y2]]), and we only care about its sign for convexity.