ModelTranslator: 新增 pick_best_candidate——过门且岛数最少者择优

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ud18010
2026-07-21 11:13:23 +08:00
co-authored by Claude Opus 4.8
parent f0046ea64d
commit 788122b271
2 changed files with 39 additions and 0 deletions
+10
View File
@@ -38,6 +38,16 @@ def uvpm_mode_label(base, applied):
return base + "+uvpm" if applied else base
def pick_best_candidate(candidates):
"""从候选 UV 指标 dict 列表选过质量门且岛数最少者;无过门候选返回 None。
每个 candidate 至少含 flipped/overlap/islands。"""
passing = [c for c in candidates
if uv_gate_ok(c["flipped"], c["overlap"])]
if not passing:
return None
return min(passing, key=lambda c: c["islands"])
def count_islands(n_faces, adjacent_pairs):
"""union-find 数 UV 岛:n_faces 个面,adjacent_pairs 为 UV 连续的面索引对。"""
parent = list(range(n_faces))