Update utils.lua

removed `math.sqrt` in favor of `^ 0.5`
This commit is contained in:
howmanysmall 2018-12-25 12:36:50 -07:00 committed by GitHub
parent 130fe2aca0
commit 677cb31de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@
local modules = (...): gsub('%.[^%.]+$', '') .. "."
local vec2 = require(modules .. "vec2")
local vec3 = require(modules .. "vec3")
local sqrt = math.sqrt
local abs = math.abs
local ceil = math.ceil
local floor = math.floor
@ -202,7 +201,7 @@ function utils.refract(i, n, ior)
local k = 1 - ior * ior * (1 - d * d)
if k >= 0 then
return (i * ior) - (n * (ior * d + sqrt(k)))
return (i * ior) - (n * (ior * d + k ^ 0.5))
end
return vec3()