Helper function to prevent us from accidentally writing scientific notation to an HOCR or PDF file. Besides, three decimal points are all you really need.
| 211 | // scientific notation to an HOCR or PDF file. Besides, three |
| 212 | // decimal points are all you really need. |
| 213 | double prec(double x) { |
| 214 | double kPrecision = 1000.0; |
| 215 | double a = round(x * kPrecision) / kPrecision; |
| 216 | if (a == -0) |
| 217 | return 0; |
| 218 | return a; |
| 219 | } |
| 220 | |
| 221 | long dist2(int x1, int y1, int x2, int y2) { |
| 222 | return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); |
no test coverage detected