Change S so it only gets updated at the end of the neighbor search
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
46b2075515
commit
404d15c6ba
@ -54,6 +54,7 @@ def DBSCAN(points, eps = MAX_DISTANCE, minPts = MIN_PTS, verbose = True):
|
|||||||
|
|
||||||
sub_perc = -1
|
sub_perc = -1
|
||||||
sub_total = len(S)
|
sub_total = len(S)
|
||||||
|
T = S
|
||||||
for j, Q in enumerate(S): # Process every seed point
|
for j, Q in enumerate(S): # Process every seed point
|
||||||
if verbose == True:
|
if verbose == True:
|
||||||
sub_new_perc = int(100 * (j+1) / total)
|
sub_new_perc = int(100 * (j+1) / total)
|
||||||
@ -71,7 +72,7 @@ def DBSCAN(points, eps = MAX_DISTANCE, minPts = MIN_PTS, verbose = True):
|
|||||||
C['faces'].append(Q)
|
C['faces'].append(Q)
|
||||||
N = RangeQuery(points, Q, eps) # Find neighbors
|
N = RangeQuery(points, Q, eps) # Find neighbors
|
||||||
if len(N) >= minPts: # Density check (if Q is a core point)
|
if len(N) >= minPts: # Density check (if Q is a core point)
|
||||||
S = Union(S, N) # Add new neighbors to seed set
|
T = Union(T, N) # Add new neighbors to seed set
|
||||||
|
|
||||||
return clusters
|
return clusters
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user