spatial4j
spatial4j copied to clipboard
WithinDistanceCalculator
For most distance calculation methods, there is redundant math being performed when the formula is being used to check if a point is within a circle, many times over. Addressing this is an API issue. The DistanceCalculator abstraction as it is currently formed isn't so great. Perhaps instead it should be named WithinDistanceCalculator and you initialize it with a point and distance. Not only would LawOfCosines benefit, but the others would too.
See #80.
It's good to add WithinDistanceCalculator. When user set DistanceCalculator in SpatialContext, you need make sure within check will uses WithinDistanceCalculator automatically.