Use a for loop instead of table.insert

To increase performance (by @pfirsich)
This commit is contained in:
Pablo Ariel Mayobre (Positive07) 2017-11-05 19:14:37 -03:00
parent 0645bae6a9
commit 14aa6450b9

View File

@ -83,9 +83,11 @@ local function EPA(shape_a, shape_b)
last_diff_dist = diff_dist last_diff_dist = diff_dist
-- simplex = {..., simplex[e.i-1], px, py, simplex[e.i] -- simplex = {..., simplex[e.i-1], px, py, simplex[e.i]
table.insert(simplex, e.i, py) for i = n, e.i, -1 do
table.insert(simplex, e.i, px) simplex[i+2] = simplex[i]
end
simplex[e.i+0] = px
simplex[e.i+1] = py
n = n + 2 n = n + 2
end end
end end