Closed kkdd closed 7 years ago
Can you describe the purpose of this refactoring?
In this request, cos(lat), which is required in CheapRuler(), would be precedently calculated in cheapRuler() or fromTile(). The path from "fromTile()" to "CheapRuler()" would consequently require less non-elementary functions than present.
I see now. Thanks for the PR! However I think that introducing this optimization reduces the clarity of the code for a very small benefit (since fromTile
isn't expected to be called often anyway). So I'd prefer to leave it as is.
Hello, I would propose refactoring CheapRuler(coslat, units) where coslat = Math.cos(lat * Math.PI / 180)