mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
diagnostic functions raise_error and invalid_matrix
This commit is contained in:
parent
182df69535
commit
c9655a29a5
3
hyper.h
3
hyper.h
@ -5489,4 +5489,7 @@ namespace dual {
|
|||||||
inline reaction_t mayboth(reaction_t what) { return [=] { may_split_or_do(what); }; }
|
inline reaction_t mayboth(reaction_t what) { return [=] { may_split_or_do(what); }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void raise_error();
|
||||||
|
bool invalid_matrix(const transmatrix T);
|
||||||
|
|
||||||
}
|
}
|
12
hypgraph.cpp
12
hypgraph.cpp
@ -782,6 +782,18 @@ bool invis_point(const hyperpoint h) {
|
|||||||
return h[2] < 0;
|
return h[2] < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void raise_error() {
|
||||||
|
println(hlog, "something wrong");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool invalid_matrix(const transmatrix T) {
|
||||||
|
for(int i=0; i<DIM; i++) for(int j=0; j<DIM; j++)
|
||||||
|
if(std::isnan(T[i][j]) || T[i][j] > 1e8 || T[i][j] < -1e8 || std::isinf(T[i][j]))
|
||||||
|
return true;
|
||||||
|
for(int i=0; i<DIM; i++) for(int j=0; j<DIM; j++) if(T[i][j] > .5 || T[i][j] < -.5) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool invalid_point(const hyperpoint h) {
|
bool invalid_point(const hyperpoint h) {
|
||||||
return std::isnan(h[DIM]) || h[DIM] > 1e8 || std::isinf(h[DIM]);
|
return std::isnan(h[DIM]) || h[DIM] > 1e8 || std::isinf(h[DIM]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user