Skip to content

adding & subtracting multiple points after calling build() #68

@jGaboardi

Description

@jGaboardi

Currently with FastPair.__add__() only a single point can be added at time after calling build():

def __add__(self, p):
    self.points.append(p)
    if self.initialized:
        self._find_neighbor(p)
    elif len(self) >= self.min_points:
        self.build()
    return self

With some modification, a collection of points could be added to the data structure:

def __add__(self, p):
    if isinstance(p, list):
        for _p in p:
            self._add_1_point(_p)
    else:
        self._add_1_point(p)
    return self

def _add_1_point(self, p):
    self.points.append(p)
    if self.initialized:
        self._find_neighbor(p)
    elif len(self) >= self.min_points:
        self.build()
    return self

Seems like the same could go for FastPair.__sub__()

Thoughts?

cc @gegen07

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions