The magnitude of the cross product of two vectors is the area of the parallelogram spanned by the two vectors. The area of the triangle is half that area, or equivalently, the area of the parallelogram is twice the area of the triangle. See this as an example: clicky.
The formula in your code is simply the Z-component of the cross product of two vectors in a 2D-plane. Two vectors in the XY-plane has its cross product along the Z-axis, and thus the magnitude of the cross product is simply the magnitude of the Z-component.