mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 17:12:59 +00:00
Starbeamrainbowlabs
9b9a471aa8
Next we need to implement a worldedit function to handle fetching the manip data, calculating the heightmap, pushing it through this convolutional system, and saving the changes back again.
11 lines
370 B
Lua
11 lines
370 B
Lua
-- From http://lua-users.org/wiki/SimpleRound
|
|
function worldeditadditions.round(num, numDecimalPlaces)
|
|
local mult = 10^(numDecimalPlaces or 0)
|
|
return math.floor(num * mult + 0.5) / mult
|
|
end
|
|
|
|
function worldeditadditions.hypotenuse(x1, y1, x2, y2)
|
|
local xSquare = math.pow(x1 - x2, 2);
|
|
local ySquare = math.pow(y1 - y2, 2);
|
|
return math.sqrt(xSquare + ySquare);
|
|
end
|