skspatial.objects.Plane.project_line

Plane.project_line(line: Line, **kwargs: float) Line[source]

Project a line onto the plane.

This method can also handle the case where the line is parallel to the plane.

Parameters:
lineLine

Input line.

kwargsdict, optional

Additional keywords passed to Vector.is_perpendicular(), which is used to check if the line is parallel to the plane (i.e., the line direction is perpendicular to the plane normal).

Returns:
Line

Projection of the line onto the plane.

Examples

>>> from skspatial.objects import Line, Plane
>>> plane = Plane([0, 0, 0], [0, 0, 1])
>>> line = Line([0, 0, 0], [1, 1, 1])
>>> plane.project_line(line)
Line(point=Point([0., 0., 0.]), direction=Vector([1., 1., 0.]))

The line is parallel to the plane.

>>> line = Line([0, 0, 5], [1, 0, 0])
>>> plane.project_line(line)
Line(point=Point([0., 0., 0.]), direction=Vector([1, 0, 0]))