Bounding-radius of a layout result: max distance from origin across all * nodes. Used to size galaxy spacing so satellites don't overlap the primary * cluster. Layouts with a 1000-node cluster have radius ~1500; the previous * fixed 600 spacing buried satellites inside the primary mass. */
| 1350 | * cluster. Layouts with a 1000-node cluster have radius ~1500; the previous |
| 1351 | * fixed 600 spacing buried satellites inside the primary mass. */ |
| 1352 | static double layout_radius(const cbm_layout_result_t *r) { |
| 1353 | if (!r || r->node_count == 0) |
| 1354 | return 0.0; |
| 1355 | double max_r2 = 0.0; |
| 1356 | for (int i = 0; i < r->node_count; i++) { |
| 1357 | double x = (double)r->nodes[i].x; |
| 1358 | double y = (double)r->nodes[i].y; |
| 1359 | double z = (double)r->nodes[i].z; |
| 1360 | if (!isfinite(x) || !isfinite(y) || !isfinite(z)) |
| 1361 | continue; |
| 1362 | double r2 = x * x + y * y + z * z; |
| 1363 | if (r2 > max_r2) |
| 1364 | max_r2 = r2; |
| 1365 | } |
| 1366 | return sqrt(max_r2); |
| 1367 | } |
| 1368 | |
| 1369 | static void handle_layout(cbm_http_conn_t *c, const cbm_http_req_t *req) { |
| 1370 | char project[256] = {0}; |