﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
18274	[RFC PATCH] BBox should have a method to determine functional equivalency	taylor.smock	team	"When comparing bboxes from different sources (e.g., one from OSM and one from another service, e.g. MapWithAI), sometimes there is a very small difference (in this case, I've had differences of around 0.00001 degrees, which translates to roughly 1.5m). For the purposes of `equals`, this is OK, but if the bboxes are close enough to be functionally equal (for the purposes of the calling function), then `equals` doesn't work. `contains` doesn't always work for this, because sometimes the bboxes are slightly shifted.

So, I would like to add a function to the `BBox` class that looks something like this:
{{{
#!java
    public boolean bboxesAreFunctionallyEqual(BBox other, Double maxDifference) {
        return bboxesAreFunctionallyEqual(this, other, maxDifference);
    }

    public static boolean bboxesAreFunctionallyEqual(BBox bbox1, BBox bbox2, Double maxDifference) {
        if (maxDifference == null) {
            maxDifference = LatLon.MAX_SERVER_PRECISION;
        }
        return (bbox1 != null && bbox2 != null)
                && (Math.abs(bbox1.getBottomRightLat() - bbox2.getBottomRightLat()) < maxDifference
                        && Math.abs(bbox1.getBottomRightLon() - bbox2.getBottomRightLon()) < maxDifference
                        && Math.abs(bbox1.getTopLeftLat() - bbox2.getTopLeftLat()) < maxDifference
                        && Math.abs(bbox1.getTopLeftLon() - bbox2.getTopLeftLon()) < maxDifference);
    }
}}}"	enhancement	closed	normal	19.10	Core		fixed	bbox	
