From d4684503cdf118aa8ccb3f5b1b854f71e7b870ac Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 3 Dec 2018 18:41:19 +0100 Subject: [PATCH] fixed the Camelot volume computation for bitruncated half-dimension --- crystal.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/crystal.cpp b/crystal.cpp index ec4df171..d8e6819a 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -553,7 +553,7 @@ int dist_relative(cell *c) { int r = roundTableRadius(NULL); cell *start = m->gamestart(); if(!cc) { - printf("Finding Camelot center..."); + println(hlog, "Finding Camelot center..."); cc = start; while(precise_distance(cc, start) < r + 5) cc = cc->cmove(hrand(cc->type)); @@ -944,7 +944,6 @@ shift_data shift_data_zero; string get_table_volume() { if(!pure()) { auto m = crystal_map(); - m->prepare_east(); bignum res; manual_celllister cl; cl.add(m->gamestart()); @@ -959,17 +958,23 @@ string get_table_volume() { } static const ld eps = 1e-4; if(mincoord >= 0-eps && maxcoord < 4-eps) { + ld my_rad2 = rad2; auto cshift = (co - m->camelot_coord) / 4; auto sd = &shift_data_zero; for(int i=0; ics.dim; i++) { - ld val = cshift[i] - floor(cshift[i]); - if(!sd->children.count(val)) { - sd->children[val].parent = sd; - sd->children[val].shift = val; + if(i == m->cs.dim-1 && (m->cs.dir&1)) { + my_rad2 -= pow(cshift[i] / m->camelot_mul, 2); + } + else { + ld val = cshift[i] - floor(cshift[i]); + if(!sd->children.count(val)) { + sd->children[val].parent = sd; + sd->children[val].shift = val; + } + sd = &sd->children[val]; } - sd = &sd->children[val]; } - res.addmul(sd->compute(rad2), 1); + res.addmul(sd->compute(my_rad2), 1); } if(mincoord < -2 || maxcoord > 6) continue; forCellCM(c2, c) cl.add(c2);