mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 09:03:01 +00:00
Fix and stabilize //mtrig
This commit is contained in:
parent
f94906c854
commit
3f6b8f4d21
1 changed files with 10 additions and 16 deletions
|
@ -1,10 +1,10 @@
|
||||||
-- ███ ███ ██████ ████████ ██ ██████
|
-- ███ ███ ████████ ██████ ██ ██████
|
||||||
-- ████ ████ ██ ██ ██ ██ ██
|
-- ████ ████ ██ ██ ██ ██ ██
|
||||||
-- ██ ████ ██ ██████ ██ ██ ██ ███
|
-- ██ ████ ██ ██ ██████ ██ ██ ███
|
||||||
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
||||||
-- ██ ██ ██ ██ ██ ██ ██████
|
-- ██ ██ ██ ██ ██ ██ ██████
|
||||||
local wea = worldeditadditions
|
local wea = worldeditadditions
|
||||||
-- worldeditdebug.register("abschk")
|
local v3 = worldeditadditions.Vector3
|
||||||
worldedit.register_command("mtrig", {
|
worldedit.register_command("mtrig", {
|
||||||
params = "",
|
params = "",
|
||||||
description = "Return the length of each axis of current selection.",
|
description = "Return the length of each axis of current selection.",
|
||||||
|
@ -14,16 +14,10 @@ worldedit.register_command("mtrig", {
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
func = function(name, params_text)
|
func = function(name, params_text)
|
||||||
local str = "The measurements of the line pos1,pos2 are Length: "
|
local str = "The measurements of the line pos1,pos2 are Length (D): "
|
||||||
local vec = vector.subtract(worldedit.pos2[name],worldedit.pos1[name])
|
local vec = v3.subtract(worldedit.pos2[name],worldedit.pos1[name]):abs()
|
||||||
wea.vector.abs(vec)
|
local len = vec:length()
|
||||||
-- Test:
|
str = str..len..", ∠XZ: "..math.deg(math.atan(vec.z/vec.x)).."° ∠DY: "..math.deg(math.asin(vec.y/len)).."°"
|
||||||
-- if worldeditdebug.debug["abschk"][name] then
|
|
||||||
-- -- //debug abschk
|
|
||||||
-- return false, "Values = " .. worldeditdebug.table_tostring(vec)
|
|
||||||
-- end
|
|
||||||
local len = wea.Vector3.length(vec)
|
|
||||||
str = str..len..", X/Z angle: "..math.atan(vec.z/vec.x).."° h/Y angle: "..math.atan(vec.y/len).."°"
|
|
||||||
return true, str
|
return true, str
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue