project_point_plane

compas.geometry.project_point_plane(point, plane)[source]

Project a point onto a plane.

Parameters:
point[float, float, float] | compas.geometry.Point

XYZ coordinates of the point.

plane[point, vector]

Base point and normal vector defining the projection plane.

Returns:
[float, float, float]

XYZ coordinates of the projected point.

Notes

The projection is in the direction perpendicular to the plane. The projected point is thus the closest point on the plane to the original point [1].

References

[1]

Math Stack Exchange. Project a point in 3D on a given plane. Available at: https://math.stackexchange.com/questions/444968/project-a-point-in-3d-on-a-given-plane.

Examples

>>> from compas.geometry import project_point_plane
>>> point = [3.0, 3.0, 3.0]
>>> plane = ([0.0, 0.0, 0.0], [0.0, 0.0, 1.0])  # the XY plane
>>> project_point_plane(point, plane)
[3.0, 3.0, 0.0]