private void init() { if (radiusDEG > 90) { // --spans more than half the globe assert enclosingBox.getWidth() == 360; double backDistDEG = 180 - radiusDEG; if (backDistDEG > 0) { double backRadius = 180 - radiusDEG; double backX = DistanceUtils.normLonDEG(getCenter().getX() + 180); double backY = DistanceUtils.normLatDEG(getCenter().getY() + 180); // Shrink inverseCircle as small as possible to avoid accidental overlap. // Note that this is tricky business to come up with a value small enough // but not too small or else numerical conditioning issues become a problem. backRadius -= Math.max( Math.ulp(Math.abs(backY) + backRadius), Math.ulp(Math.abs(backX) + backRadius)); if (inverseCircle != null) { inverseCircle.reset(backX, backY, backRadius); } else { inverseCircle = new GeoCircle(ctx.makePoint(backX, backY), backRadius, ctx); } } else { inverseCircle = null; // whole globe } horizAxisY = getCenter().getY(); // although probably not used } else { inverseCircle = null; double _horizAxisY = ctx.getDistCalc().calcBoxByDistFromPt_yHorizAxisDEG(getCenter(), radiusDEG, ctx); // some rare numeric conditioning cases can cause this to be barely beyond the box if (_horizAxisY > enclosingBox.getMaxY()) { horizAxisY = enclosingBox.getMaxY(); } else if (_horizAxisY < enclosingBox.getMinY()) { horizAxisY = enclosingBox.getMinY(); } else { horizAxisY = _horizAxisY; } // assert enclosingBox.relate_yRange(horizAxis,horizAxis,ctx).intersects(); } }
protected double normY(double y) { return ctx.isGeo() ? DistanceUtils.normLatDEG(y) : y; }