import { dot, scale, sub, type Vec } from "./given.ts"; /** * Remove the component of `v` that points into a wall with the given (unit) * normal, leaving only the motion that runs along the wall. * * vSlide = v - normal * dot(v, normal) */ export function slide(v: Vec, normal: Vec): Vec { return sub(v, scale(normal, dot(v, normal))); }