--!native --!optimize 2 -- Compiled with roblox-ts v3.0.0 local CFrameTools = {} do local _container = CFrameTools local function AddCFrames(cframe_0, cframe_1) local components_0 = { cframe_0:GetComponents() } local components_1 = { cframe_1:GetComponents() } for i = 0, #components_0 - 1 do components_0[i + 1] += components_1[i + 1] end return CFrame.new(unpack(components_0)) end _container.AddCFrames = AddCFrames local function SubCFrames(cframe_0, cframe_1) local components_0 = { cframe_0:GetComponents() } local components_1 = { cframe_1:GetComponents() } for i = 0, #components_0 - 1 do components_0[i + 1] -= components_1[i + 1] end return CFrame.new(unpack(components_0)) end _container.SubCFrames = SubCFrames local function MulCFrameByNumber(cframe, value) local components_0 = { cframe:GetComponents() } for i = 0, #components_0 - 1 do components_0[i + 1] *= value end return CFrame.new(unpack(components_0)) end _container.MulCFrameByNumber = MulCFrameByNumber local function MulCFramesComponents(cframe_0, cframe_1) local components_0 = { cframe_0:GetComponents() } local components_1 = { cframe_1:GetComponents() } for i = 0, #components_0 - 1 do components_0[i + 1] += components_1[i + 1] end return CFrame.new(unpack(components_0)) end _container.MulCFramesComponents = MulCFramesComponents --[[ * * * @param a CFrame * @param b CFrame * @returns a mirrored around b ]] local function MirrorAround(a, b) return AddCFrames(b, SubCFrames(b, a)) end _container.MirrorAround = MirrorAround --[[ * * * @param a CFrame * @param b CFrame * @param use_rotation_b if true the end cframe will have the rotation of b, defaults to false * @returns a position mirrored around b position with rotation of selected component * used for the splines ]] local function MirrorPositionAround(a, b, use_rotation_b) local _position = b.Position local _position_1 = b.Position local _position_2 = a.Position local position = _position + (_position_1 - _position_2) return if use_rotation_b then b.Rotation + position else a.Rotation + position end _container.MirrorPositionAround = MirrorPositionAround --[[ * * * @param cframe * @returns determinant of rotation matrix ]] local function RotationDet(cframe) local x, y, z, a, b, c, d, e, f, g, h, i = cframe:GetComponents() return a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g) end _container.RotationDet = RotationDet --[[ * * * @param cframe * @returns turns every nan component into 0 ]] local function FixCFrame(cframe) if cframe == cframe then return cframe end local components = { cframe:GetComponents() } local new_components = table.create(12) for i = 0, #components - 1 do new_components[i + 1] = if components[i + 1] == components[i + 1] then components[i + 1] else 0 end return CFrame.new(unpack(new_components)) end _container.FixCFrame = FixCFrame end return { CFrameTools = CFrameTools, }