-
- Sys_Printf( "Total visible clusters: %i\n", totalvis );
- Sys_Printf( "Average clusters visible: %i\n", totalvis / portalclusters );
+
+ totalvis = 0;
+ totalvis2 = 0;
+ for(i = 0; i < MAX_MAP_LEAFS; ++i)
+ if(clustersizehistogram[i])
+ {
+ Sys_FPrintf(SYS_VRB, "%4i clusters have exactly %4i visible clusters\n", clustersizehistogram[i], i);
+ totalvis += ((double) i) * ((double) clustersizehistogram[i]);
+ totalvis2 += ((double) i) * ((double) i) * ((double) clustersizehistogram[i]);
+ /* cast is to prevent integer overflow */
+ }
+
+ mu = totalvis / portalclusters;
+ sigma = sqrt(totalvis2 / portalclusters - mu * mu);
+
+ Sys_Printf( "Total clusters: %i\n", portalclusters );
+ Sys_Printf( "Total visible clusters: %.0f\n", totalvis );
+ Sys_Printf( "Average clusters visible: %.2f sdev=%.2f\n", mu, sigma);