bool GeoCircleBrowse::exactDocCheck(const Point& p, double& d){ switch (_type) { case GEO_PLANE: { if(distanceWithin(_startPt, p, _maxDistance)) return true; break; } case GEO_SPHERE: checkEarthBounds(p); if(spheredist_deg(_startPt, p) <= _maxDistance) return true; break; default: verify(false); } return false; }
bool GeoHopper::exactDocCheck(const Point& p, double& d){ bool within = false; // Get the appropriate distance for the type switch (_type) { case GEO_PLANE: d = distance(_near, p); within = distanceWithin(_near, p, _maxDistance); break; case GEO_SPHERE: checkEarthBounds(p); d = spheredist_deg(_near, p); within = (d <= _maxDistance); break; default: verify(false); } return within; }
GeoAccumulator:: KeyResult GeoHopper::approxKeyCheck(const Point& p, double& d) { // Always check approximate distance, since it lets us avoid doing // checks of the rest of the object if it succeeds switch (_type) { case GEO_PLANE: d = distance(_near, p); break; case GEO_SPHERE: checkEarthBounds(p); d = spheredist_deg(_near, p); break; default: verify(false); } verify(d >= 0); // If we need more points double borderDist = (_points.size() < _max ? _maxDistance : farthest()); if (d >= borderDist - 2 * _distError && d <= borderDist + 2 * _distError) return BORDER; else return d < borderDist ? GOOD : BAD; }
GeoAccumulator::KeyResult GeoCircleBrowse::approxKeyCheck(const Point& p, double& d) { // Inexact hash distance checks. double error = 0; switch (_type) { case GEO_PLANE: d = distance(_startPt, p); error = _converter->getError(); break; case GEO_SPHERE: { checkEarthBounds(p); d = spheredist_deg(_startPt, p); error = _converter->getErrorSphere(); break; } default: verify(false); } // If our distance is in the error bounds... if(d >= _maxDistance - error && d <= _maxDistance + error) return BORDER; return d > _maxDistance ? BAD : GOOD; }