local H=require("\112\097\116\104 \116\111 \098\105\110\097\114\121 \111\099\116\114\101\101")local A=require("\112\097\116\104 \116\111 \115\108\101\105\116\110\105\099\107\115 \109\111\100\117\108\101")local K=Vector3.zero.Dot local e=516 local f={}for H=1,1000,1 do table.insert(f,{Position=Vector3.new(math.random(-e,e),math.random(-e,e),math.random(-e,e))})end local B=Vector3.new(50,1,50)local s=30 local function V()local H={}for A,K in f do local e=K.Position-B if e.Magnitude<=s then table.insert(H,K)end end return H end local r=H.new(e,5,Vector3.zero)H.InsertObjects(r,f)local v=A.new(e)local z={}for H,A in f do table.insert(z,v:CreateNode(A.Position,A))end return{ParameterGenerator=function()return end,Functions={["\076\105\110\101\097\114 \083\101\097\114\099\104 \083\112\104\101\114\101"]=function(H)V()end,["\083\108\101\105\116\110\105\099\107 \113\117\101\114\121 \115\112\104\101\114\101"]=function(H)v:SearchRadius(B,s)end;["\066\105\110\097\114\121\079\099\116\114\101\101 \081\117\101\114\121 \083\112\104\101\114\101"]=function(A)H.QuerySphere(r,B,s)end}}
--!optimize 2

--[[
This file is for use by Benchmarker (https://boatbomber.itch.io/benchmarker)

|WARNING| THIS RUNS IN YOUR REAL ENVIRONMENT. |WARNING|
--]]

local BinaryOctreeModule = require("path to binary octree")
local SleitnickModule = require("path to sleitnicks module")

local Dot = Vector3.zero.Dot
local OctreeSize = 516

local Objects = {}

for i = 1,1000 do
	table.insert(Objects,{Position = Vector3.new(math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize),math.random(-OctreeSize,OctreeSize))})
end

local StartPosition = Vector3.new(50,1,50)

local Radius = 30

local function LinearSearch()
	local GottenObjects = {}

	for _,Object in Objects do
		local SubtractedPosition = Object.Position - StartPosition
		if SubtractedPosition.Magnitude <= Radius then
			table.insert(GottenObjects,Object)
		end
	end

	return GottenObjects
end

local QueryBinaryOctree = BinaryOctreeModule.new(OctreeSize,5,Vector3.zero)
BinaryOctreeModule.InsertObjects(QueryBinaryOctree,Objects)
local SleitnickOctree = SleitnickModule.new(OctreeSize)

local SleitNodes = {}

for _,Object in Objects do
	table.insert(SleitNodes,SleitnickOctree:CreateNode(Object.Position,Object))
end

return {
	ParameterGenerator = function()
		return
	end,

	Functions = {
		["Linear Search Sphere"] = function(Profiler)
			LinearSearch()
		end,
		["Sleitnick query sphere"] = function(Profiler)
			SleitnickOctree:SearchRadius(StartPosition,Radius)
		end,
		["BinaryOctree Query Sphere"] = function(Profiler)
			BinaryOctreeModule.QuerySphere(QueryBinaryOctree,StartPosition,Radius)
		end,
	},
}
