Vector math improvements zefram/use
authorZefram <zefram@fysh.org>
Thu, 24 Jul 2014 12:49:15 +0000 (13:49 +0100)
committerZefram <zefram@fysh.org>
Fri, 8 Aug 2014 23:38:25 +0000 (00:38 +0100)
commitcff732f347cdbec77f4200f72eef40ed66d6686b
treec358cf776ad1aba54fb8f7691728adec46792946
parentc359b9d086d98fff3f4998cf9f02f3ce58937702
Vector math improvements

Rewrite math.hypot() to compute more directly, with far fewer operations.
Rewrite vector.length() and vector.distance() to each use a single
sqrt operation, rather than two (which they were doing via math.hypot).
Add vector.length_square() and vector.distance_square(), which return
squared distance more cheaply by omitting the sqrt operation.
builtin/common/misc_helpers.lua
builtin/common/vector.lua
doc/lua_api.txt