def point_to_plane_distance(p: Vector3r, n: Vector3r, d: float): """ Returns the distance from a point `p` to a plane with normal `n` and distance `d` from the coordinate system's origin (along `n`). """ return p.dot(n) - d
def vector_projected_onto_vector(v: Vector3r, u: Vector3r) -> Vector3r: """ Returns the projection of `v` onto `u`. """ return u * v.dot(u) / u.dot(u)