fixed a freeze when drawing offscreen grid lines

This commit is contained in:
Zeno Rogue 2020-01-19 11:49:35 +01:00
parent e925f6e93c
commit 4b7739e80d
1 changed files with 5 additions and 1 deletions

View File

@ -3590,13 +3590,17 @@ bool celldrawer::cell_clipped() {
EX ld precise_width = .5;
int grid_depth = 0;
EX void gridline(const transmatrix& V1, const hyperpoint h1, const transmatrix& V2, const hyperpoint h2, color_t col, int prec) {
ld d = hdist(V1*h1, V2*h2);
while(d > precise_width && d < 100) {
while(d > precise_width && d < 100 && grid_depth < 10) {
if(!eqmatrix(V1, V2, 1e-6)) { gridline(V1, h1, V1, inverse(V1) * V2 * h2, col, prec); return; }
hyperpoint h = midz(h1, h2);
grid_depth++;
gridline(V1, h1, V1, h, col, prec);
gridline(V1, h, V1, h2, col, prec);
grid_depth--;
return;
}
#if MAXMDIM >= 4