skspatial.objects.Plane

class skspatial.objects.Plane(point: Union[numpy.ndarray, Sequence], normal: Union[numpy.ndarray, Sequence])[source]

A plane in space.

The plane is defined by a point and a normal vector.

Parameters
pointarray_like

Point on the plane.

directionarray_like

Normal vector of the plane.

kwargsdict, optional

Additional keywords passed to Vector.is_zero(). This method is used to ensure that the normal vector is not the zero vector.

Raises
ValueError

If the point and vector have different dimensions. If the vector is all zeros.

Examples

>>> from skspatial.objects import Plane
>>> plane = Plane(point=[0, 0, 0], normal=[0, 0, 5])
>>> plane
Plane(point=Point([0, 0, 0]), normal=Vector([0, 0, 5]))
>>> plane.normal
Vector([0, 0, 5])

The normal can also be accessed with the vector attribute.

>>> plane.vector
Vector([0, 0, 5])

The plane dimension is the dimension of the point and vector.

>>> plane.dimension
3
>>> Plane([0, 0], [1, 0, 0])
Traceback (most recent call last):
...
ValueError: The point and vector must have the same dimension.
>>> Plane([1, 1], [0, 0])
Traceback (most recent call last):
...
ValueError: The vector must not be the zero vector.
Attributes
pointPoint

Point on the plane.

normalVector

Unit normal vector.

vectorVector

Same as the normal.

dimensionint

Dimension of the plane.

Methods

best_fit(points[, tol])

Return the plane of best fit for a set of 3D points.

cartesian()

Return the coefficients of the Cartesian equation of the plane.

distance_point_signed(point)

Return the signed distance from a point to the plane.

from_points(point_a, point_b, point_c, **kwargs)

Instantiate a plane from three points.

from_vectors(point, vector_a, vector_b, **kwargs)

Instantiate a plane from a point and two vectors.

intersect_line(line, **kwargs)

Intersect the plane with a line.

intersect_plane(other, **kwargs)

Intersect the plane with another.

plot_3d(ax_3d[, lims_x, lims_y])

Plot a 3D plane.

project_line(line, **kwargs)

Project a line onto the plane.

project_point(point)

Project a point onto the plane.

project_vector(vector)

Project a vector onto the plane.

side_point(point)

Find the side of the plane where a point lies.

to_mesh([lims_x, lims_y])

Return coordinate matrices for the 3D surface of the plane.

to_points(**kwargs)

Return points on the surface of the object.