Fix minor bugs in algorithms
This commit is contained in:
@@ -119,12 +119,12 @@ def assign_groups(prev_groups, new_groups):
|
|||||||
Assigns group numbers to a new scan based on the groups of an old scan.
|
Assigns group numbers to a new scan based on the groups of an old scan.
|
||||||
"""
|
"""
|
||||||
for group in prev_groups:
|
for group in prev_groups:
|
||||||
old_centre = find_centre(prev_groups)
|
old_centre = find_centre(group)
|
||||||
for new_group in new_groups:
|
for new_group in new_groups:
|
||||||
new_centre = find_centre(new_group)
|
new_centre = find_centre(new_group)
|
||||||
# They are considered the same if the new group and old group centres are within 5cm.
|
# They are considered the same if the new group and old group centres are within 5cm.
|
||||||
if ((new_centre[0] - old_centre[0]) ** 2 + (new_centre[1] - old_centre[1]) ** 2) < 50 ** 2:
|
if ((new_centre[0] - old_centre[0]) ** 2 + (new_centre[1] - old_centre[1]) ** 2) < 50 ** 2:
|
||||||
new_group.set_number(group.get_number())
|
new_group.number = group.number
|
||||||
|
|
||||||
return new_groups
|
return new_groups
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user