2021-07-13 18:09:40 +02:00
|
|
|
-- ███ ███ ████████ ██████ ██ ██████
|
|
|
|
-- ████ ████ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ████ ██ ██ ██████ ██ ██ ███
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██ ██ ██
|
|
|
|
-- ██ ██ ██ ██ ██ ██ ██████
|
2021-07-09 05:54:05 +02:00
|
|
|
local wea = worldeditadditions
|
2021-07-13 18:09:40 +02:00
|
|
|
local v3 = worldeditadditions.Vector3
|
2022-05-19 23:10:09 +02:00
|
|
|
worldeditadditions_core.register_command("mtrig", {
|
2021-07-09 05:54:05 +02:00
|
|
|
params = "",
|
2021-07-14 04:43:56 +02:00
|
|
|
description = "Return the length of and angles of an imginary line between pos1 and pos2 in the selection.",
|
2021-07-09 05:54:05 +02:00
|
|
|
privs = { worldedit = true },
|
|
|
|
require_pos = 2,
|
|
|
|
parse = function(params_text)
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
func = function(name, params_text)
|
2021-07-15 22:44:56 +02:00
|
|
|
local str = "The measurements of the line from pos1 to pos2 are Length (D): "
|
2021-07-13 18:09:40 +02:00
|
|
|
local vec = v3.subtract(worldedit.pos2[name],worldedit.pos1[name]):abs()
|
|
|
|
local len = vec:length()
|
2021-07-13 18:59:53 +02:00
|
|
|
str = str..wea.round(len, 4)..", ∠XZ: "..
|
|
|
|
wea.round(math.deg(math.atan(vec.z/vec.x)), 4).."°, ∠DY: "..
|
|
|
|
wea.round(math.deg(math.asin(vec.y/len)), 4).."°"
|
2021-07-09 05:54:05 +02:00
|
|
|
return true, str
|
|
|
|
end,
|
|
|
|
})
|