Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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)