skspatial.objects.Plane.from_points

classmethod Plane.from_points(point_a: Union[ndarray, Sequence], point_b: Union[ndarray, Sequence], point_c: Union[ndarray, Sequence], **kwargs) Plane[source]

Instantiate a plane from three points.

The three points lie on the plane.

Parameters:
point_a, point_b, point_c: array_like

Three points defining the plane.

kwargs: dict, optional

Additional keywords passed to Points.are_collinear().

Returns:
Plane

Plane containing the three input points.

Raises:
ValueError

If the points are collinear.

Examples

>>> from skspatial.objects import Plane
>>> Plane.from_points([0, 0], [1, 0], [3, 3])
Plane(point=Point([0, 0, 0]), normal=Vector([0, 0, 3]))

The order of the points affects the direction of the normal vector.

>>> Plane.from_points([0, 0], [3, 3], [1, 0])
Plane(point=Point([0, 0, 0]), normal=Vector([ 0,  0, -3]))
>>> Plane.from_points([0, 0], [0, 1], [0, 3])
Traceback (most recent call last):
...
ValueError: The points must not be collinear.