skspatial.measurement.area_triangle

skspatial.measurement.area_triangle(point_a: Union[numpy.ndarray, Sequence], point_b: Union[numpy.ndarray, Sequence], point_c: Union[numpy.ndarray, Sequence]) numpy.float64[source]

Return the area of a triangle defined by three points.

The points are the vertices of the triangle. They must be 3D or less.

Parameters
point_a, point_b, point_carray_like

The three vertices of the triangle.

Returns
np.float64

The area of the triangle.

References

http://mathworld.wolfram.com/TriangleArea.html

Examples

>>> from skspatial.measurement import area_triangle
>>> area_triangle([0, 0], [0, 1], [1, 0])
0.5
>>> area_triangle([0, 0], [0, 2], [1, 1])
1.0
>>> area_triangle([3, -5, 1], [5, 2, 1], [9, 4, 2]).round(2)
12.54