Is this function for cross product right?


class Point:
    def cross_product(self, other):
        return self.x * other.y - self.y * other.x

It returns a scalar, which isn't quite right, but since this is working on 2D Points, you can probably just treat it as a scalar, because the cross product of two 2D points is (0, 0, someZ).


TL;DR You can't compute the cross product of 2 2d vectors.

You can, technically, if you treat the 2D vectors as 3D vectors with z of zero.

If you read the answer, then

However, often it is interesting to evaluate the cross product of two vectors assuming that the 2D vectors are extended to 3D by setting their z-coordinate to zero. This is the same as working with 3D vectors on the xy-plane.

If you extend the vectors that way and calculate the cross product of such an extended vector pair you'll notice that only the z-component has a meaningful value: x and y will always be zero.

the scalar version is the hack

I found this post I made, and it confirms that the answer to the topic of this post is "yes".