Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --begin vector functions
- function addv(v1, v2)
- return {x=v1.x+v2.x, y=v1.y+v2.y}
- end
- function subv(v1,v2)
- return {x=v1.x-v2.x, y=v1.y-v2.y}
- end
- function multv(v,n)
- return {x=v.x*n, y=v.y*n}
- end
- function divv(v, n)
- return {x=v.x/n, y=v.y/n}
- end
- function magsqrv(v)
- return (v.x*v.x)+(v.y*v.y)
- end
- function distsqrv(v1, v2)
- return (v1.x-v2.x) * (v1.x-v2.x) + (v1.y-v2.y) * (v1.y-v2.y)
- end
- --end vector functions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement