Rounds down a positive value such that the first digit is 1, 2, or 5
(double x)
| 853 | } |
| 854 | /** Rounds down a positive value such that the first digit is 1, 2, or 5 */ |
| 855 | static double round(double x) { |
| 856 | double base = Math.pow(10, Math.floor(Math.log10(x)+1e-8)); |
| 857 | if (x > 4.999999*base) return 5*base; |
| 858 | else if (x > 1.999999*base) return 2*base; |
| 859 | else return base; |
| 860 | } |
| 861 | } // Utils inner class |
| 862 | } //ScaleBar class |
no outgoing calls
no test coverage detected