def test_get_leaves(self): LA = Engine.shape_factory.LeastAddition([ StdFactroy.AABB(numpy.array([0, 0]), 10, 10, identifier=i) for i in range(10) ]) for leaf in LA.get_leaves(): print(leaf)
def test_leaf_complex(self): LA = Engine.shape_factory.LeastAddition([ StdFactroy.AABB(numpy.array([0, 0]), 10, 10, identifier=i) for i in range(Engine.shape_factory.LeastAddition.FILL + 1) ]) LA.delete(Engine.shape_factory.LeastAddition.FILL) self.assertEqual(Engine.shape_factory.LeastAddition.FILL, len(LA.get_leaves()))
def test_massive_equal(self): tree = Shapes.factory.get_LA([]) objects = [ StdFactroy.get_AABB(numpy.array([0, 0]), 10, 10, identifier=i) for i in range(1000) ] before = time.time() for obj in objects: tree.add(obj) elapsed_time = time.time() - before print(f"Elapsed time {elapsed_time}")
from Engine.Shapes.FinitelyBounded.Factories.StdFactory import StdFactroy import Engine Engine.shape_factory = StdFactroy() import unittest import numpy from Engine.Ray import Ray class LA(unittest.TestCase): epsilon = 10 def test_case_1(self): shapes = [ Engine.shape_factory.AAB(numpy.array([16, 17]), 10, 2, 3), Engine.shape_factory.AAB(numpy.array([13, 21]), 10, 2, 4), Engine.shape_factory.AAB(numpy.array([25, 17]), 10, 2, 5), Engine.shape_factory.AAB(numpy.array([79, 59]), 10, 2, 6), Engine.shape_factory.AAB(numpy.array([60, 71]), 10, 2, 7), Engine.shape_factory.AAB(numpy.array([44, 73]), 10, 2, 8), Engine.shape_factory.AAB(numpy.array([11, 83]), 10, 2, 9), Engine.shape_factory.AAB(numpy.array([2, 62]), 10, 2, 10), Engine.shape_factory.AAB(numpy.array([9, 38]), 10, 2, 11), Engine.shape_factory.AAB(numpy.array([41, 7]), 10, 2, 12), Engine.shape_factory.AAB(numpy.array([99, 44]), 10, 2, 13), Engine.shape_factory.AAB(numpy.array([89, 66]), 10, 2, 14), Engine.shape_factory.AAB(numpy.array([74, 76]), 10, 2, 15), Engine.shape_factory.AAB(numpy.array([26, 76]), 10, 2, 16), Engine.shape_factory.AAB(numpy.array([34, 73]), 10, 2, 17), Engine.shape_factory.AAB(numpy.array([13, 77]), 10, 2, 18), Engine.shape_factory.AAB(numpy.array([33, 71]), 10, 2, 19),
def test_leaf_delete(self): LA = Engine.shape_factory.LeastAddition( [StdFactroy.AABB(numpy.array([0, 0]), 10, 10, identifier=1)]) LA.delete(1) self.assertEqual(0, len(LA.nodes), "Nodes not empty")
def test_split_insert_p1(self): Engine.shape_factory.LeastAddition([ StdFactroy.AABB(numpy.array([0, 0]), 10, 10, identifier=i) for i in range(Engine.shape_factory.LeastAddition.FILL + 2) ])