local R={}function R.Subtract(R,U)return Vector3.new(R[1]-U[1],R[2]-U[2],R[3]-U[3])end function R.Add(R,U)return Vector3.new(R[1]+U[1],R[2]+U[2],R[3]+U[3])end function R.RotateVector(R,U)local m,A,H=R[1],R[2],R[3]local P,J,S=U[1],U[2],U[3]local i=m local s=A*math.cos(P)-H*math.sin(P)local O=A*math.sin(P)+H*math.cos(P)local C=i*math.cos(J)+O*math.sin(J)local x=s local L=-i*math.sin(J)+O*math.cos(J)local n=C*math.cos(S)-x*math.sin(S)local r=C*math.sin(S)+x*math.cos(S)local D=L return{n;r,D}end return R

local module = {}

function module.Subtract(v1, v2)
	return Vector3.new(v1[1] - v2[1], v1[2] - v2[2], v1[3] - v2[3])
end

function module.Add(v1, v2)
	return Vector3.new(v1[1] + v2[1], v1[2] + v2[2], v1[3] + v2[3])
end

function module.RotateVector(vector, rotation)
	local x, y, z = vector[1], vector[2], vector[3]
	local rx, ry, rz = rotation[1], rotation[2], rotation[3]

	-- Apply rotation around X-axis
	local rotatedX = x
	local rotatedY = y * math.cos(rx) - z * math.sin(rx)
	local rotatedZ = y * math.sin(rx) + z * math.cos(rx)

	-- Apply rotation around Y-axis
	local tempX = rotatedX * math.cos(ry) + rotatedZ * math.sin(ry)
	local tempY = rotatedY
	local tempZ = -rotatedX * math.sin(ry) + rotatedZ * math.cos(ry)

	-- Apply rotation around Z-axis
	local finalX = tempX * math.cos(rz) - tempY * math.sin(rz)
	local finalY = tempX * math.sin(rz) + tempY * math.cos(rz)
	local finalZ = tempZ

	return {finalX, finalY, finalZ}
end


return module
