Skip to content

Commit

Permalink
Add reject to vector-light
Browse files Browse the repository at this point in the history
Just porting this over: vrld#125
  • Loading branch information
Aweptimum authored Jul 4, 2022
1 parent 94a2559 commit 5f56d87
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vector-light.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ local function project(x,y, u,v)
return s*u, s*v
end

local function reject(x,y, u,v)
return sub(x,y, project(x,y, u,v))
end

local function mirror(x,y, u,v)
local s = 2 * (x*u + y*v) / (u*u + v*v)
return s*u - x, s*v - y
Expand Down Expand Up @@ -180,6 +184,7 @@ return {
rotate = rotate,
perpendicular = perpendicular,
project = project,
reject = reject,
mirror = mirror,
trim = trim,
angleTo = angleTo,
Expand Down

0 comments on commit 5f56d87

Please sign in to comment.