spatial4j icon indicating copy to clipboard operation
spatial4j copied to clipboard

Remove AbstractDistanceCalculator and simplify distance method

Open chrismale opened this issue 13 years ago • 1 comments
trafficstars

AbstractDistanceCalculator doesn't add anything except redirecting distance(Point, Point) to distance(Point, double, double).

Now that we have reusable Points, we should remove distance(Point, double, double) and just keep distance(Point, Point) (it reads alot better) and remove AbstractDistanceCalculator

chrismale avatar Sep 25 '12 07:09 chrismale

AbstractDistanceCalculator indeed isn't doing much so I support removing it.

Despite shapes being re-usable, it doesn't mean that all API call sites are in a position to possess a re-usable Shape. For example, take RectangleImpl.getCenter():Point It has no point to re-use, and adding one to the method parameter seems very wrong to me. Another example regarding the specific method you pointed out is to look at who calls it. CircleImpl.contains() calls it, and it has no re-usable shape parameter. Lets say it had one... now who calls this method? CircleImpl.relate(Point) does. And where is this method to get a re-usable Point from?

dsmiley avatar Sep 25 '12 14:09 dsmiley