mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: mid_cleanse() on one row of results (#522)
This commit is contained in:
parent
c94176fbd2
commit
b7df51c0e8
@ -94,6 +94,12 @@ class InventoryManager:
|
|||||||
if count == 1:
|
if count == 1:
|
||||||
return mids
|
return mids
|
||||||
elif count == 2:
|
elif count == 2:
|
||||||
|
# Only one row, [173.5 175. ]
|
||||||
|
mid_diff_mean = np.mean(mid_diff_range)
|
||||||
|
diff = max(mids) - min(mids)
|
||||||
|
if diff < mid_diff_mean * 0.3:
|
||||||
|
return np.mean(mids).reshape((1,))
|
||||||
|
# Double rows
|
||||||
return mids
|
return mids
|
||||||
# print(mids)
|
# print(mids)
|
||||||
encourage = self.COINCIDENT_POINT_ENCOURAGE_DISTANCE ** 2
|
encourage = self.COINCIDENT_POINT_ENCOURAGE_DISTANCE ** 2
|
||||||
@ -179,6 +185,8 @@ class InventoryManager:
|
|||||||
area = self.inventory.area
|
area = self.inventory.area
|
||||||
x_list = np.unique(np.sort(points[:, 0]))
|
x_list = np.unique(np.sort(points[:, 0]))
|
||||||
y_list = np.unique(np.sort(points[:, 1]))
|
y_list = np.unique(np.sort(points[:, 1]))
|
||||||
|
# print(x_list)
|
||||||
|
# print(y_list)
|
||||||
x_list = self.mid_cleanse(
|
x_list = self.mid_cleanse(
|
||||||
x_list,
|
x_list,
|
||||||
mid_diff_range=(self.GRID_DELTA[0] - 3, self.GRID_DELTA[0] + 3),
|
mid_diff_range=(self.GRID_DELTA[0] - 3, self.GRID_DELTA[0] + 3),
|
||||||
@ -189,6 +197,8 @@ class InventoryManager:
|
|||||||
mid_diff_range=(self.GRID_DELTA[1] - 3, self.GRID_DELTA[1] + 3),
|
mid_diff_range=(self.GRID_DELTA[1] - 3, self.GRID_DELTA[1] + 3),
|
||||||
edge_range=(area[1], area[3])
|
edge_range=(area[1], area[3])
|
||||||
)
|
)
|
||||||
|
# print(x_list)
|
||||||
|
# print(y_list)
|
||||||
|
|
||||||
def is_near_existing(p):
|
def is_near_existing(p):
|
||||||
diff = np.linalg.norm(points - p, axis=1)
|
diff = np.linalg.norm(points - p, axis=1)
|
||||||
|
Loading…
Reference in New Issue
Block a user