diff --git a/line.lua b/line.lua index a1d6006..9a68263 100644 --- a/line.lua +++ b/line.lua @@ -4,9 +4,9 @@ -- using Bresenham's Algorithm -- Converted from the original to Lua function edit.calculate_line_points(p1, p2) - p1 = vector.copy(p1) - p2 = vector.copy(p2) - local output = {vector.copy(p1)} + p1 = table.copy(p1) + p2 = table.copy(p2) + local output = {table.copy(p1)} local d = vector.apply(vector.subtract(p1, p2), math.abs) local s = vector.new( p2.x > p1.x and 1 or -1, @@ -30,7 +30,7 @@ function edit.calculate_line_points(p1, p2) end n1 = n1 + 2 * d.y n2 = n2 + 2 * d.z - table.insert(output, vector.copy(p1)) + table.insert(output, table.copy(p1)) end -- Driving axis is Y-axis @@ -49,7 +49,7 @@ function edit.calculate_line_points(p1, p2) end n1 = n1 + 2 * d.x n2 = n2 + 2 * d.z - table.insert(output, vector.copy(p1)) + table.insert(output, table.copy(p1)) end -- Driving axis is Z-axis @@ -68,7 +68,7 @@ function edit.calculate_line_points(p1, p2) end n1 = n1 + 2 * d.y n2 = n2 + 2 * d.x - table.insert(output, vector.copy(p1)) + table.insert(output, table.copy(p1)) end end return output diff --git a/polygon.lua b/polygon.lua index b078d1c..c229783 100644 --- a/polygon.lua +++ b/polygon.lua @@ -34,8 +34,8 @@ local function ray_intersects_triangle(ray_origin, ray_vector, vertex_a, vertex_ end function edit.calculate_triangle_points(a, b, c) - local bounding_box_min = vector.copy(a) - local bounding_box_max = vector.copy(a) + local bounding_box_min = table.copy(a) + local bounding_box_max = table.copy(a) for index, axis in pairs({"x", "y", "z"}) do bounding_box_min[axis] = math.min(a[axis], b[axis], c[axis]) bounding_box_max[axis] = math.max(a[axis], b[axis], c[axis]) @@ -63,7 +63,7 @@ function edit.calculate_triangle_points(a, b, c) -- Switch from local to global coordinate system. -- Also works the same to convert local to global coordinate system. local function swap_coord_sys(v) - v = vector.copy(v) + v = table.copy(v) local old_selected = v[selected_axis] v[selected_axis] = v.y v.y = old_selected diff --git a/preview.lua b/preview.lua index c73082f..c9e13bb 100644 --- a/preview.lua +++ b/preview.lua @@ -165,8 +165,8 @@ local function update_polygon_preview(player, marker_pos_list, show_polygon_hud) local player_data = edit.player_data[player] local show_full_preview = true - local bounding_box_min = vector.copy(marker_pos_list[1]) - local bounding_box_max = vector.copy(marker_pos_list[1]) + local bounding_box_min = table.copy(marker_pos_list[1]) + local bounding_box_max = table.copy(marker_pos_list[1]) for index, axis in pairs({"x", "y", "z"}) do for i, pos in ipairs(marker_pos_list) do bounding_box_min[axis] = math.min(bounding_box_min[axis], pos[axis])