--!native --!optimize 2 -- Compiled with roblox-ts v3.0.0 --*vector with unlimited amount of components local Vector do Vector = setmetatable({}, { __tostring = function() return "Vector" end, }) Vector.__index = Vector function Vector.new(...) local self = setmetatable({}, Vector) return self:constructor(...) or self end function Vector:constructor(args) self.Elements = table.clone(args) self.size_ = #args end function Vector:CreateWithValue(value, size) return Vector.new(table.create(size, value)) end function Vector:FromCFrame(cframe) return Vector.new({ cframe:GetComponents() }) end function Vector:FromCFramesList(cframes_list) local vectors_list = table.create(#cframes_list) for i = 0, #cframes_list - 1 do vectors_list[i + 1] = Vector:FromCFrame(cframes_list[i + 1]) end return vectors_list end function Vector:Add(vector) local max_size = math.max(vector:GetSize(), self.size_) local elements = table.create(max_size) for i = 0, max_size - 1 do local _condition = self.Elements[i + 1] if _condition == nil then _condition = 0 end local element_1 = _condition local _condition_1 = vector.Elements[i + 1] if _condition_1 == nil then _condition_1 = 0 end local element_2 = _condition_1 elements[i + 1] = element_1 + element_2 end return Vector.new(elements) end function Vector:Sub(vector) local max_size = math.max(vector:GetSize(), self.size_) local elements = table.create(max_size) for i = 0, max_size - 1 do local _condition = self.Elements[i + 1] if _condition == nil then _condition = 0 end local element_1 = _condition local _condition_1 = vector.Elements[i + 1] if _condition_1 == nil then _condition_1 = 0 end local element_2 = _condition_1 elements[i + 1] = element_1 - element_2 end return Vector.new(elements) end function Vector:MulNum(value) local elements = table.create(self.size_) for i = 0, self.size_ - 1 do elements[i + 1] = self.Elements[i + 1] * value end return Vector.new(elements) end function Vector:Mul(vector) local max_size = math.max(vector:GetSize(), self.size_) local elements = table.create(max_size) for i = 0, max_size - 1 do local _condition = self.Elements[i + 1] if _condition == nil then _condition = 0 end local element_1 = _condition local _condition_1 = vector.Elements[i + 1] if _condition_1 == nil then _condition_1 = 0 end local element_2 = _condition_1 elements[i + 1] = element_1 * element_2 end return Vector.new(elements) end function Vector:Div(vector) local max_size = math.max(vector:GetSize(), self.size_) local elements = table.create(max_size) for i = 0, max_size - 1 do local _condition = self.Elements[i + 1] if _condition == nil then _condition = 0 end local element_1 = _condition local _condition_1 = vector.Elements[i + 1] if _condition_1 == nil then _condition_1 = 0 end local element_2 = _condition_1 elements[i + 1] = element_1 / element_2 end return Vector.new(elements) end function Vector:ToCFrame(orthonormalize) if orthonormalize == nil then orthonormalize = true end local cframe = CFrame.new(unpack((self.Elements))) return if orthonormalize then cframe:Orthonormalize() else cframe end function Vector:MirrorAround(mirror_point) return mirror_point:Add(mirror_point:Sub(self)) end function Vector:GetSize() return self.size_ end end return { Vector = Vector, }