diff --git a/src/ol/geom/circle.js b/src/ol/geom/circle.js index aeb9f69827..1ff63e2f72 100644 --- a/src/ol/geom/circle.js +++ b/src/ol/geom/circle.js @@ -106,9 +106,18 @@ ol.geom.Circle.prototype.getExtent = function(opt_extent) { * @return {number} Radius. */ ol.geom.Circle.prototype.getRadius = function() { + return Math.sqrt(this.getRadiusSquared_()); +}; + + +/** + * @private + * @return {number} Radius squared. + */ +ol.geom.Circle.prototype.getRadiusSquared_ = function() { var dx = this.flatCoordinates[this.stride] - this.flatCoordinates[0]; var dy = this.flatCoordinates[this.stride + 1] - this.flatCoordinates[1]; - return Math.sqrt(dx * dx + dy * dy); + return dx * dx + dy * dy; };