local function K(K,D)return K==K and K or D end local function D(K,D)local O=(D-K)%TAU if O>PI then O=O-TAU end return O end local function O(K,O)local r=D(K.X,O.X)local l=D(K.Y,O.Y)local V=D(K.Z,O.Z)return V3(r,l,V)end
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
local function CheckNAN(value, returnIfNan)
	return (value == value and value or returnIfNan)
end -- CheckNAN

local function DeltaAngle(current, target)
	local num = (target - current) % TAU
	if num > PI then
		num = (num - TAU)
	end
	return num
end -- DeltaAngle()

local function DeltaAngleV3(pos1, pos2)
	local x = DeltaAngle(pos1.X, pos2.X)
	local y = DeltaAngle(pos1.Y, pos2.Y)
	local z = DeltaAngle(pos1.Z, pos2.Z)
	return V3(x, y, z)
end -- DeltaAngleV3()
