Use set instead of list for Plane's internal collection of objects.
parent
c7709045e9
commit
da3f023b2d
|
@ -246,7 +246,7 @@ class ObjIdRange(object):
|
||||||
class Plane(object):
|
class Plane(object):
|
||||||
|
|
||||||
def __init__(self, objs=None, gridsize=50):
|
def __init__(self, objs=None, gridsize=50):
|
||||||
self._objs = []
|
self._objs = set()
|
||||||
self._grid = {}
|
self._grid = {}
|
||||||
self.gridsize = gridsize
|
self.gridsize = gridsize
|
||||||
if objs is not None:
|
if objs is not None:
|
||||||
|
@ -281,7 +281,7 @@ class Plane(object):
|
||||||
else:
|
else:
|
||||||
r = self._grid[k]
|
r = self._grid[k]
|
||||||
r.append(obj)
|
r.append(obj)
|
||||||
self._objs.append(obj)
|
self._objs.add(obj)
|
||||||
return
|
return
|
||||||
|
|
||||||
# remove(obj): displace an object.
|
# remove(obj): displace an object.
|
||||||
|
|
Loading…
Reference in New Issue