time for a snapshot
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
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)));
|
||||
}
|
||||
Reference in New Issue
Block a user