Skip to content

Commit d673fef

Browse files
committed
partition: Use a slightly larger scale factor on group size
Instead of just offsetting the score by 1 per each group size, offset it by a configurable value (currently 3). This results in slightly more even cluster distribution due to the fact that shared vertices are double-counted in cluster corners as we don't perfectly estimate this.
1 parent 8460072 commit d673fef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/partition.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
namespace meshopt
88
{
99

10+
static const unsigned int kGroupSizeBias = 3;
11+
1012
struct ClusterAdjacency
1113
{
1214
unsigned int* offsets;
@@ -284,7 +286,7 @@ static int pickGroupToMerge(const ClusterGroup* groups, int id, const ClusterAdj
284286
unsigned int score = countShared(groups, id, other, adjacency);
285287

286288
// favor smaller target groups
287-
score += unsigned(max_group_size) - groups[other].size;
289+
score += (unsigned(max_group_size) - groups[other].size) * kGroupSizeBias;
288290

289291
if (score > best_score)
290292
{

0 commit comments

Comments
 (0)