diff --git a/backed-map.cpp b/backed-map.cpp index 8d1a6b60..ec60302e 100644 --- a/backed-map.cpp +++ b/backed-map.cpp @@ -114,6 +114,23 @@ void backed_map::rebase(heptagon*& backer, transmatrix& T) { } } +EX ld worst_precision_error; + +#if HDR +struct hr_precision_error : hr_exception { hr_precision_error() : hr_exception("precision error") {} }; +#endif + +/** check if a and b are the same, testing for equality. Throw an exception or warning if not sure */ +EX bool same_point_may_warn(hyperpoint a, hyperpoint b) { + ld d = hdist(a, b); + if(d > 1e-2) return false; + if(d > 1e-3) throw hr_precision_error(); + if(d > 1e-6 && worst_precision_error <= 1e-6) + addMessage("warning: precision errors are building up!"); + if(d > worst_precision_error) worst_precision_error = d; + return true; + } + bool in_hpe = false; void backed_map::handle_precision_errors(heptagon *h) { diff --git a/hyperpoint.cpp b/hyperpoint.cpp index ce2a6cbf..000ec4df 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -2037,23 +2037,6 @@ EX bool clockwise(hyperpoint h1, hyperpoint h2) { return h1[0] * h2[1] > h1[1] * h2[0]; } -EX ld worst_precision_error; - -#if HDR -struct hr_precision_error : hr_exception { hr_precision_error() : hr_exception("precision error") {} }; -#endif - -/** check if a and b are the same, testing for equality. Throw an exception or warning if not sure */ -EX bool same_point_may_warn(hyperpoint a, hyperpoint b) { - ld d = hdist(a, b); - if(d > 1e-2) return false; - if(d > 1e-3) throw hr_precision_error(); - if(d > 1e-6 && worst_precision_error <= 1e-6) - addMessage("warning: precision errors are building up!"); - if(d > worst_precision_error) worst_precision_error = d; - return true; - } - /** compute the area of a shape -- v.back() must equal v[0] */ EX ld compute_area(const vector& v) { ld area = 0;