From 61c3e41e8ab08c81d83291d5a5e7270e77355192 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 26 Apr 2022 16:12:43 +0200 Subject: [PATCH] gridlines now draw correctly for (ultra)ideal vertices --- graph.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/graph.cpp b/graph.cpp index 67abc27b..a1aa8003 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3978,7 +3978,10 @@ EX bool fat_edges = false; EX void gridline(const shiftmatrix& V1, const hyperpoint h1, const shiftmatrix& V2, const hyperpoint h2, color_t col, int prec) { transmatrix U2 = unshift(V2, V1.shift); - ld d = hdist(V1.T*h1, U2*h2); + + int c1 = safe_classify_ideals(h1); + int c2 = safe_classify_ideals(h2); + ld d = (c1 <= 0 || c2 <= 0) ? 99 : hdist(V1.T*h1, U2*h2); #if MAXMDIM >= 4 if(WDIM == 3 && fat_edges) { @@ -3992,7 +3995,25 @@ EX void gridline(const shiftmatrix& V1, const hyperpoint h1, const shiftmatrix& while(d > precise_width && d < 100 && grid_depth < 10) { if(V1.shift != V2.shift || !eqmatrix(V1.T, V2.T, 1e-6)) { gridline(V1, h1, V1, inverse_shift(V1, V2) * h2, col, prec); return; } - hyperpoint h = midz(h1, h2); + hyperpoint h; + if(c1 <= 0 && c2 <= 0) { + h = closest_to_zero(h1, h2); + if(safe_classify_ideals(h) <= 0) return; + h = normalize(h); + } + else if(c2 <= 0) { + dynamicval dw(grid_depth, 99); + for(ld a=0; a dw(grid_depth, 99); + for(ld a=0; a