diff --git a/CHANGES.md b/CHANGES.md
index ffd8e9fd0d9b..8bb681ca3965 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -3,8 +3,12 @@ Change Log
### 1.5 - 2015-01-05
+* Deprecated
+ * `Rectangle.intersectWith` was deprecated in Cesium 1.5. It will be removed in Cesium 1.6. Use `Rectangle.intersection`, which is the same but returns `undefined` when two rectangles do not intersect.
+ * `Rectangle.isEmpty` was deprecated in Cesium 1.5. It will be removed in Cesium 1.6.
* Improved polygon loading performance.
* Added `Math.mod` which computes `m % n` but also works when `m` is negative.
+* Fixed imagery providers whose rectangle crosses the IDL. Added `Rectangle.computeWidth`, `Rectangle.computeHeight`, `Rectangle.width`, and `Rectangle.height`. [#2195](https://github.com/AnalyticalGraphicsInc/cesium/issues/2195)
### 1.4 - 2014-12-01
diff --git a/Source/Core/GeographicTilingScheme.js b/Source/Core/GeographicTilingScheme.js
index cb41f1f97504..6e0537d2260d 100644
--- a/Source/Core/GeographicTilingScheme.js
+++ b/Source/Core/GeographicTilingScheme.js
@@ -175,11 +175,11 @@ define([
var xTiles = this.getNumberOfXTilesAtLevel(level);
var yTiles = this.getNumberOfYTilesAtLevel(level);
- var xTileWidth = (rectangle.east - rectangle.west) / xTiles;
+ var xTileWidth = rectangle.width / xTiles;
var west = x * xTileWidth + rectangle.west;
var east = (x + 1) * xTileWidth + rectangle.west;
- var yTileHeight = (rectangle.north - rectangle.south) / yTiles;
+ var yTileHeight = rectangle.height / yTiles;
var north = rectangle.north - y * yTileHeight;
var south = rectangle.north - (y + 1) * yTileHeight;
@@ -207,10 +207,7 @@ define([
*/
GeographicTilingScheme.prototype.positionToTileXY = function(position, level, result) {
var rectangle = this._rectangle;
- if (position.latitude > rectangle.north ||
- position.latitude < rectangle.south ||
- position.longitude < rectangle.west ||
- position.longitude > rectangle.east) {
+ if (!Rectangle.contains(rectangle, position)) {
// outside the bounds of the tiling scheme
return undefined;
}
@@ -218,10 +215,15 @@ define([
var xTiles = this.getNumberOfXTilesAtLevel(level);
var yTiles = this.getNumberOfYTilesAtLevel(level);
- var xTileWidth = (rectangle.east - rectangle.west) / xTiles;
- var yTileHeight = (rectangle.north - rectangle.south) / yTiles;
+ var xTileWidth = rectangle.width / xTiles;
+ var yTileHeight = rectangle.height / yTiles;
- var xTileCoordinate = (position.longitude - rectangle.west) / xTileWidth | 0;
+ var longitude = position.longitude;
+ if (rectangle.east < rectangle.west) {
+ longitude += CesiumMath.TWO_PI;
+ }
+
+ var xTileCoordinate = (longitude - rectangle.west) / xTileWidth | 0;
if (xTileCoordinate >= xTiles) {
xTileCoordinate = xTiles - 1;
}
diff --git a/Source/Core/HeightmapTessellator.js b/Source/Core/HeightmapTessellator.js
index a29283892132..db1c326719e7 100644
--- a/Source/Core/HeightmapTessellator.js
+++ b/Source/Core/HeightmapTessellator.js
@@ -6,7 +6,8 @@ define([
'./DeveloperError',
'./Ellipsoid',
'./freezeObject',
- './Math'
+ './Math',
+ './Rectangle'
], function(
Cartesian3,
defaultValue,
@@ -14,7 +15,8 @@ define([
DeveloperError,
Ellipsoid,
freezeObject,
- CesiumMath) {
+ CesiumMath,
+ Rectangle) {
"use strict";
/**
@@ -186,8 +188,8 @@ define([
var elementMultiplier = defaultValue(structure.elementMultiplier, HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier);
var isBigEndian = defaultValue(structure.isBigEndian, HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian);
- var granularityX = (nativeRectangle.east - nativeRectangle.west) / (width - 1);
- var granularityY = (nativeRectangle.north - nativeRectangle.south) / (height - 1);
+ var granularityX = Rectangle.computeWidth(nativeRectangle) / (width - 1);
+ var granularityY = Rectangle.computeHeight(nativeRectangle) / (height - 1);
var radiiSquared = ellipsoid.radiiSquared;
var radiiSquaredX = radiiSquared.x;
diff --git a/Source/Core/Math.js b/Source/Core/Math.js
index 6dd2230457f9..97993e2fdff2 100644
--- a/Source/Core/Math.js
+++ b/Source/Core/Math.js
@@ -493,7 +493,11 @@ define([
throw new DeveloperError('x is required.');
}
//>>includeEnd('debug');
- return CesiumMath.mod(x, CesiumMath.TWO_PI);
+ var mod = CesiumMath.mod(x, CesiumMath.TWO_PI);
+ if (mod === 0.0 && x !== 0.0) {
+ return CesiumMath.sign(x) * CesiumMath.TWO_PI;
+ }
+ return mod;
};
/**
diff --git a/Source/Core/QuantizedMeshTerrainData.js b/Source/Core/QuantizedMeshTerrainData.js
index 7cd473d99d77..a3ee8c967aaa 100644
--- a/Source/Core/QuantizedMeshTerrainData.js
+++ b/Source/Core/QuantizedMeshTerrainData.js
@@ -414,9 +414,9 @@ define([
* the rectangle, so expect incorrect results for positions far outside the rectangle.
*/
QuantizedMeshTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) {
- var u = CesiumMath.clamp((longitude - rectangle.west) / (rectangle.east - rectangle.west), 0.0, 1.0);
+ var u = CesiumMath.clamp((longitude - rectangle.west) / rectangle.width, 0.0, 1.0);
u *= maxShort;
- var v = CesiumMath.clamp((latitude - rectangle.south) / (rectangle.north - rectangle.south), 0.0, 1.0);
+ var v = CesiumMath.clamp((latitude - rectangle.south) / rectangle.height, 0.0, 1.0);
v *= maxShort;
var uBuffer = this._uValues;
diff --git a/Source/Core/Rectangle.js b/Source/Core/Rectangle.js
index 7d7384532c1c..215c9f1efa66 100644
--- a/Source/Core/Rectangle.js
+++ b/Source/Core/Rectangle.js
@@ -3,6 +3,8 @@ define([
'./Cartographic',
'./defaultValue',
'./defined',
+ './defineProperties',
+ './deprecationWarning',
'./DeveloperError',
'./Ellipsoid',
'./freezeObject',
@@ -11,6 +13,8 @@ define([
Cartographic,
defaultValue,
defined,
+ defineProperties,
+ deprecationWarning,
DeveloperError,
Ellipsoid,
freezeObject,
@@ -64,6 +68,63 @@ define([
this.north = defaultValue(north, 0.0);
};
+ defineProperties(Rectangle.prototype, {
+ /**
+ * Gets the width of the rectangle in radians.
+ * @memberof Rectangle.prototype
+ * @type {Number}
+ */
+ width : {
+ get : function() {
+ return Rectangle.computeWidth(this);
+ }
+ },
+
+ /**
+ * Gets the height of the rectangle in radians.
+ * @memberof Rectangle.prototype
+ * @type {Number}
+ */
+ height : {
+ get : function() {
+ return Rectangle.computeHeight(this);
+ }
+ }
+ });
+
+ /**
+ * Computes the width of a rectangle in radians.
+ * @param {Rectangle} rectangle The rectangle to compute the width of.
+ * @returns {Number} The width.
+ */
+ Rectangle.computeWidth = function(rectangle) {
+ //>>includeStart('debug', pragmas.debug);
+ if (!defined(rectangle)) {
+ throw new DeveloperError('rectangle is required.');
+ }
+ //>>includeEnd('debug');
+ var east = rectangle.east;
+ var west = rectangle.west;
+ if (east < west) {
+ east += CesiumMath.TWO_PI;
+ }
+ return east - west;
+ };
+
+ /**
+ * Computes the height of a rectangle in radians.
+ * @param {Rectangle} rectangle The rectangle to compute the height of.
+ * @returns {Number} The height.
+ */
+ Rectangle.computeHeight = function(rectangle) {
+ //>>includeStart('debug', pragmas.debug);
+ if (!defined(rectangle)) {
+ throw new DeveloperError('rectangle is required.');
+ }
+ //>>includeEnd('debug');
+ return rectangle.north - rectangle.south;
+ };
+
/**
* Creates an rectangle given the boundary longitude and latitude in degrees.
*
@@ -439,17 +500,19 @@ define([
var east = rectangle.east;
var west = rectangle.west;
- var longitude = (west + east) * 0.5;
if (east < west) {
- longitude = CesiumMath.negativePiToPi(longitude + CesiumMath.PI);
+ east += CesiumMath.TWO_PI;
}
+ var longitude = CesiumMath.negativePiToPi((west + east) * 0.5);
+ var latitude = (rectangle.south + rectangle.north) * 0.5;
+
if (!defined(result)) {
- return new Cartographic(longitude, (rectangle.south + rectangle.north) * 0.5);
+ return new Cartographic(longitude, latitude);
}
result.longitude = longitude;
- result.latitude = (rectangle.south + rectangle.north) * 0.5;
+ result.latitude = latitude;
result.height = 0.0;
return result;
};
@@ -460,9 +523,9 @@ define([
* @param {Rectangle} rectangle On rectangle to find an intersection
* @param {Rectangle} otherRectangle Another rectangle to find an intersection
* @param {Rectangle} [result] The object onto which to store the result.
- * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
+ * @returns {Rectangle|undefined} The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
*/
- Rectangle.intersectWith = function(rectangle, otherRectangle, result) {
+ Rectangle.intersection = function(rectangle, otherRectangle, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(rectangle)) {
throw new DeveloperError('rectangle is required');
@@ -472,10 +535,38 @@ define([
}
//>>includeEnd('debug');
- var west = Math.max(rectangle.west, otherRectangle.west);
+ var rectangleEast = rectangle.east;
+ var rectangleWest = rectangle.west;
+
+ var otherRectangleEast = otherRectangle.east;
+ var otherRectangleWest = otherRectangle.west;
+
+ if (rectangleEast < rectangleWest && otherRectangleEast > 0.0) {
+ rectangleEast += CesiumMath.TWO_PI;
+ } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0.0) {
+ otherRectangleEast += CesiumMath.TWO_PI;
+ }
+
+ if (rectangleEast < rectangleWest && otherRectangleWest < 0.0) {
+ otherRectangleWest += CesiumMath.TWO_PI;
+ } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0.0) {
+ rectangleWest += CesiumMath.TWO_PI;
+ }
+
+ var west = CesiumMath.negativePiToPi(Math.max(rectangleWest, otherRectangleWest));
+ var east = CesiumMath.negativePiToPi(Math.min(rectangleEast, otherRectangleEast));
+
+ if ((rectangle.west < rectangle.east || otherRectangle.west < otherRectangle.east) && east <= west) {
+ return undefined;
+ }
+
var south = Math.max(rectangle.south, otherRectangle.south);
- var east = Math.min(rectangle.east, otherRectangle.east);
var north = Math.min(rectangle.north, otherRectangle.north);
+
+ if (south >= north) {
+ return undefined;
+ }
+
if (!defined(result)) {
return new Rectangle(west, south, east, north);
}
@@ -487,36 +578,53 @@ define([
};
/**
- * Returns true if the cartographic is on or inside the rectangle, false otherwise.
+ * Computes the intersection of two rectangles
*
- * @param {Rectangle} rectangle The rectangle
- * @param {Cartographic} cartographic The cartographic to test.
- * @returns {Boolean} true if the provided cartographic is inside the rectangle, false otherwise.
+ * @deprecated
+ *
+ * @param {Rectangle} rectangle On rectangle to find an intersection
+ * @param {Rectangle} otherRectangle Another rectangle to find an intersection
+ * @param {Rectangle} [result] The object onto which to store the result.
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
*/
- Rectangle.contains = function(rectangle, cartographic) {
+ Rectangle.intersectWith = function(rectangle, otherRectangle, result) {
+ deprecationWarning('Rectangle.intersectWith', 'Rectangle.intersectWith was deprecated in Cesium 1.5. It will be removed in Cesium 1.6. Use Rectangle.intersection.');
+
//>>includeStart('debug', pragmas.debug);
if (!defined(rectangle)) {
throw new DeveloperError('rectangle is required');
}
- if (!defined(cartographic)) {
- throw new DeveloperError('cartographic is required.');
+ if (!defined(otherRectangle)) {
+ throw new DeveloperError('otherRectangle is required.');
}
//>>includeEnd('debug');
- return cartographic.longitude >= rectangle.west &&
- cartographic.longitude <= rectangle.east &&
- cartographic.latitude >= rectangle.south &&
- cartographic.latitude <= rectangle.north;
+ var west = Math.max(rectangle.west, otherRectangle.west);
+ var south = Math.max(rectangle.south, otherRectangle.south);
+ var east = Math.min(rectangle.east, otherRectangle.east);
+ var north = Math.min(rectangle.north, otherRectangle.north);
+ if (!defined(result)) {
+ return new Rectangle(west, south, east, north);
+ }
+ result.west = west;
+ result.south = south;
+ result.east = east;
+ result.north = north;
+ return result;
};
/**
* Determines if the rectangle is empty, i.e., if west >= east
* or south >= north
.
*
+ * @deprecated
+ *
* @param {Rectangle} rectangle The rectangle
* @returns {Boolean} True if the rectangle is empty; otherwise, false.
*/
Rectangle.isEmpty = function(rectangle) {
+ deprecationWarning('Rectangle.isEmpty', 'Rectangle.isEmpty was deprecated in Cesium 1.5. It will be removed in Cesium 1.6.');
+
//>>includeStart('debug', pragmas.debug);
if (!defined(rectangle)) {
throw new DeveloperError('rectangle is required');
@@ -526,6 +634,41 @@ define([
return rectangle.west >= rectangle.east || rectangle.south >= rectangle.north;
};
+ /**
+ * Returns true if the cartographic is on or inside the rectangle, false otherwise.
+ *
+ * @param {Rectangle} rectangle The rectangle
+ * @param {Cartographic} cartographic The cartographic to test.
+ * @returns {Boolean} true if the provided cartographic is inside the rectangle, false otherwise.
+ */
+ Rectangle.contains = function(rectangle, cartographic) {
+ //>>includeStart('debug', pragmas.debug);
+ if (!defined(rectangle)) {
+ throw new DeveloperError('rectangle is required');
+ }
+ if (!defined(cartographic)) {
+ throw new DeveloperError('cartographic is required.');
+ }
+ //>>includeEnd('debug');
+
+ var longitude = cartographic.longitude;
+ var latitude = cartographic.latitude;
+
+ var west = rectangle.west;
+ var east = rectangle.east;
+
+ if (east < west) {
+ east += CesiumMath.TWO_PI;
+ if (longitude < 0.0) {
+ longitude += CesiumMath.TWO_PI;
+ }
+ }
+ return (longitude > west || CesiumMath.equalsEpsilon(longitude, west, CesiumMath.EPSILON14)) &&
+ (longitude < east || CesiumMath.equalsEpsilon(longitude, east, CesiumMath.EPSILON14)) &&
+ latitude >= rectangle.south &&
+ latitude <= rectangle.north;
+ };
+
var subsampleLlaScratch = new Cartographic();
/**
* Samples an rectangle so that it includes a list of Cartesian points suitable for passing to
@@ -587,9 +730,8 @@ define([
}
for ( var i = 1; i < 8; ++i) {
- var temp = -Math.PI + i * CesiumMath.PI_OVER_TWO;
- if (west < temp && temp < east) {
- lla.longitude = temp;
+ lla.longitude = -Math.PI + i * CesiumMath.PI_OVER_TWO;
+ if (Rectangle.contains(rectangle, lla)) {
result[length] = ellipsoid.cartographicToCartesian(lla, result[length]);
length++;
}
diff --git a/Source/Core/RectangleGeometry.js b/Source/Core/RectangleGeometry.js
index e593de391f46..3170206c47bb 100644
--- a/Source/Core/RectangleGeometry.js
+++ b/Source/Core/RectangleGeometry.js
@@ -519,7 +519,6 @@ define([
* @exception {DeveloperError} options.rectangle.east
must be in the interval [-Pi
, Pi
].
* @exception {DeveloperError} options.rectangle.west
must be in the interval [-Pi
, Pi
].
* @exception {DeveloperError} options.rectangle.north
must be greater than options.rectangle.south
.
- * @exception {DeveloperError} options.rectangle.east
must be greater than options.rectangle.west
.
*
* @see RectangleGeometry#createGeometry
*
@@ -616,8 +615,8 @@ define([
Matrix3.clone(Matrix3.IDENTITY, tangentRotationMatrix);
}
- options.lonScalar = 1.0 / (rectangle.east - rectangle.west);
- options.latScalar = 1.0 / (rectangle.north - rectangle.south);
+ options.lonScalar = 1.0 / rectangle.width;
+ options.latScalar = 1.0 / rectangle.height;
options.vertexFormat = vertexFormat;
options.textureMatrix = textureMatrix;
options.tangentRotationMatrix = tangentRotationMatrix;
diff --git a/Source/Core/RectangleOutlineGeometry.js b/Source/Core/RectangleOutlineGeometry.js
index b7236922b2e4..bf2b4eb8e279 100644
--- a/Source/Core/RectangleOutlineGeometry.js
+++ b/Source/Core/RectangleOutlineGeometry.js
@@ -180,7 +180,6 @@ define([
* @exception {DeveloperError} options.rectangle.east
must be in the interval [-Pi
, Pi
].
* @exception {DeveloperError} options.rectangle.west
must be in the interval [-Pi
, Pi
].
* @exception {DeveloperError} options.rectangle.north
must be greater than rectangle.south
.
- * @exception {DeveloperError} options.rectangle.east
must be greater than rectangle.west
.
*
* @see RectangleOutlineGeometry#createGeometry
*
diff --git a/Source/Core/VRTheWorldTerrainProvider.js b/Source/Core/VRTheWorldTerrainProvider.js
index e27b416bd03d..ee6a9338d9cf 100644
--- a/Source/Core/VRTheWorldTerrainProvider.js
+++ b/Source/Core/VRTheWorldTerrainProvider.js
@@ -309,8 +309,8 @@ define([
var testRectangle = rectangle.rectangle;
- var intersection = Rectangle.intersectWith(testRectangle, parentRectangle, rectangleScratch);
- if (!Rectangle.isEmpty(intersection)) {
+ var intersection = Rectangle.intersection(testRectangle, parentRectangle, rectangleScratch);
+ if (defined(intersection)) {
// Parent tile is inside this rectangle, so at least one child is, too.
if (isTileInRectangle(tilingScheme, testRectangle, x * 2, y * 2, level + 1)) {
childMask |= 4; // northwest
@@ -332,7 +332,7 @@ define([
function isTileInRectangle(tilingScheme, rectangle, x, y, level) {
var tileRectangle = tilingScheme.tileXYToRectangle(x, y, level);
- return !Rectangle.isEmpty(Rectangle.intersectWith(tileRectangle, rectangle, rectangleScratch));
+ return defined(Rectangle.intersection(tileRectangle, rectangle, rectangleScratch));
}
/**
diff --git a/Source/Core/WebMercatorTilingScheme.js b/Source/Core/WebMercatorTilingScheme.js
index e77377f4b540..51402c103bc1 100644
--- a/Source/Core/WebMercatorTilingScheme.js
+++ b/Source/Core/WebMercatorTilingScheme.js
@@ -219,10 +219,7 @@ define([
*/
WebMercatorTilingScheme.prototype.positionToTileXY = function(position, level, result) {
var rectangle = this._rectangle;
- if (position.latitude > rectangle.north ||
- position.latitude < rectangle.south ||
- position.longitude < rectangle.west ||
- position.longitude > rectangle.east) {
+ if (!Rectangle.contains(rectangle, position)) {
// outside the bounds of the tiling scheme
return undefined;
}
diff --git a/Source/Scene/BingMapsImageryProvider.js b/Source/Scene/BingMapsImageryProvider.js
index 11e5a66021d9..a300a400f644 100644
--- a/Source/Scene/BingMapsImageryProvider.js
+++ b/Source/Scene/BingMapsImageryProvider.js
@@ -630,8 +630,8 @@ define([
for (var areaIndex = 0, areaLength = attribution.coverageAreas.length; !included && areaIndex < areaLength; ++areaIndex) {
var area = coverageAreas[areaIndex];
if (level >= area.zoomMin && level <= area.zoomMax) {
- var intersection = Rectangle.intersectWith(rectangle, area.bbox, intersectionScratch);
- if (!Rectangle.isEmpty(intersection)) {
+ var intersection = Rectangle.intersection(rectangle, area.bbox, intersectionScratch);
+ if (defined(intersection)) {
included = true;
}
}
diff --git a/Source/Scene/GlobeSurfaceTile.js b/Source/Scene/GlobeSurfaceTile.js
index 7220a940e668..8c423ee9ad2f 100644
--- a/Source/Scene/GlobeSurfaceTile.js
+++ b/Source/Scene/GlobeSurfaceTile.js
@@ -733,11 +733,11 @@ define([
// Compute the water mask translation and scale
var sourceTileRectangle = sourceTile.rectangle;
var tileRectangle = tile.rectangle;
- var tileWidth = tileRectangle.east - tileRectangle.west;
- var tileHeight = tileRectangle.north - tileRectangle.south;
+ var tileWidth = tileRectangle.width;
+ var tileHeight = tileRectangle.height;
- var scaleX = tileWidth / (sourceTileRectangle.east - sourceTileRectangle.west);
- var scaleY = tileHeight / (sourceTileRectangle.north - sourceTileRectangle.south);
+ var scaleX = tileWidth / sourceTileRectangle.width;
+ var scaleY = tileHeight / sourceTileRectangle.height;
surfaceTile.waterMaskTranslationAndScale.x = scaleX * (tileRectangle.west - sourceTileRectangle.west) / tileWidth;
surfaceTile.waterMaskTranslationAndScale.y = scaleY * (tileRectangle.south - sourceTileRectangle.south) / tileHeight;
surfaceTile.waterMaskTranslationAndScale.z = scaleX;
diff --git a/Source/Scene/ImageryLayer.js b/Source/Scene/ImageryLayer.js
index 222ec6ec504f..11836ab4f04c 100644
--- a/Source/Scene/ImageryLayer.js
+++ b/Source/Scene/ImageryLayer.js
@@ -376,10 +376,10 @@ define([
// the geometry tile. The ImageryProvider and ImageryLayer both have the
// opportunity to constrain the rectangle. The imagery TilingScheme's rectangle
// always fully contains the ImageryProvider's rectangle.
- var imageryBounds = Rectangle.intersectWith(imageryProvider.rectangle, this._rectangle, imageryBoundsScratch);
- var rectangle = Rectangle.intersectWith(tile.rectangle, imageryBounds, tileImageryBoundsScratch);
+ var imageryBounds = Rectangle.intersection(imageryProvider.rectangle, this._rectangle, imageryBoundsScratch);
+ var rectangle = Rectangle.intersection(tile.rectangle, imageryBounds, tileImageryBoundsScratch);
- if (rectangle.east <= rectangle.west || rectangle.north <= rectangle.south) {
+ if (!defined(rectangle)) {
// There is no overlap between this terrain tile and this imagery
// provider. Unless this is the base layer, no skeletons need to be created.
// We stretch texels at the edge of the base layer over the entire globe.
@@ -389,6 +389,7 @@ define([
var baseImageryRectangle = imageryBounds;
var baseTerrainRectangle = tile.rectangle;
+ rectangle = tileImageryBoundsScratch;
if (baseTerrainRectangle.south >= baseImageryRectangle.north) {
rectangle.north = rectangle.south = baseImageryRectangle.north;
@@ -441,8 +442,8 @@ define([
// of the northwest tile, we don't actually need the northernmost or westernmost tiles.
// We define "very close" as being within 1/512 of the width of the tile.
- var veryCloseX = (tile.rectangle.north - tile.rectangle.south) / 512.0;
- var veryCloseY = (tile.rectangle.east - tile.rectangle.west) / 512.0;
+ var veryCloseX = tile.rectangle.height / 512.0;
+ var veryCloseY = tile.rectangle.width / 512.0;
var northwestTileRectangle = imageryTilingScheme.tileXYToRectangle(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel);
if (Math.abs(northwestTileRectangle.south - tile.rectangle.north) < veryCloseY && northwestTileCoordinates.y < southeastTileCoordinates.y) {
@@ -465,7 +466,7 @@ define([
var terrainRectangle = tile.rectangle;
var imageryRectangle = imageryTilingScheme.tileXYToRectangle(northwestTileCoordinates.x, northwestTileCoordinates.y, imageryLevel);
- var clippedImageryRectangle = Rectangle.intersectWith(imageryRectangle, imageryBounds, clippedRectangleScratch);
+ var clippedImageryRectangle = Rectangle.intersection(imageryRectangle, imageryBounds, clippedRectangleScratch);
var minU;
var maxU = 0.0;
@@ -477,11 +478,11 @@ define([
// it may not start at the northern or western edge of the terrain tile.
// Calculate where it does start.
if (!this.isBaseLayer() && Math.abs(clippedImageryRectangle.west - tile.rectangle.west) >= veryCloseX) {
- maxU = Math.min(1.0, (clippedImageryRectangle.west - terrainRectangle.west) / (terrainRectangle.east - terrainRectangle.west));
+ maxU = Math.min(1.0, (clippedImageryRectangle.west - terrainRectangle.west) / terrainRectangle.width);
}
if (!this.isBaseLayer() && Math.abs(clippedImageryRectangle.north - tile.rectangle.north) >= veryCloseY) {
- minV = Math.max(0.0, (clippedImageryRectangle.north - terrainRectangle.south) / (terrainRectangle.north - terrainRectangle.south));
+ minV = Math.max(0.0, (clippedImageryRectangle.north - terrainRectangle.south) / terrainRectangle.height);
}
var initialMinV = minV;
@@ -490,9 +491,9 @@ define([
minU = maxU;
imageryRectangle = imageryTilingScheme.tileXYToRectangle(i, northwestTileCoordinates.y, imageryLevel);
- clippedImageryRectangle = Rectangle.intersectWith(imageryRectangle, imageryBounds, clippedRectangleScratch);
+ clippedImageryRectangle = Rectangle.intersection(imageryRectangle, imageryBounds, clippedRectangleScratch);
- maxU = Math.min(1.0, (clippedImageryRectangle.east - terrainRectangle.west) / (terrainRectangle.east - terrainRectangle.west));
+ maxU = Math.min(1.0, (clippedImageryRectangle.east - terrainRectangle.west) / terrainRectangle.width);
// If this is the eastern-most imagery tile mapped to this terrain tile,
// and there are more imagery tiles to the east of this one, the maxU
@@ -508,8 +509,8 @@ define([
maxV = minV;
imageryRectangle = imageryTilingScheme.tileXYToRectangle(i, j, imageryLevel);
- clippedImageryRectangle = Rectangle.intersectWith(imageryRectangle, imageryBounds, clippedRectangleScratch);
- minV = Math.max(0.0, (clippedImageryRectangle.south - terrainRectangle.south) / (terrainRectangle.north - terrainRectangle.south));
+ clippedImageryRectangle = Rectangle.intersection(imageryRectangle, imageryBounds, clippedRectangleScratch);
+ minV = Math.max(0.0, (clippedImageryRectangle.south - terrainRectangle.south) / terrainRectangle.height);
// If this is the southern-most imagery tile mapped to this terrain tile,
// and there are more imagery tiles to the south of this one, the minV
@@ -543,11 +544,11 @@ define([
ImageryLayer.prototype._calculateTextureTranslationAndScale = function(tile, tileImagery) {
var imageryRectangle = tileImagery.readyImagery.rectangle;
var terrainRectangle = tile.rectangle;
- var terrainWidth = terrainRectangle.east - terrainRectangle.west;
- var terrainHeight = terrainRectangle.north - terrainRectangle.south;
+ var terrainWidth = terrainRectangle.width;
+ var terrainHeight = terrainRectangle.height;
- var scaleX = terrainWidth / (imageryRectangle.east - imageryRectangle.west);
- var scaleY = terrainHeight / (imageryRectangle.north - imageryRectangle.south);
+ var scaleX = terrainWidth / imageryRectangle.width;
+ var scaleY = terrainHeight / imageryRectangle.height;
return new Cartesian4(
scaleX * (terrainRectangle.west - imageryRectangle.west) / terrainWidth,
scaleY * (terrainRectangle.south - imageryRectangle.south) / terrainHeight,
@@ -674,7 +675,7 @@ define([
// avoids precision problems in the reprojection transformation while making
// no noticeable difference in the georeferencing of the image.
if (!(this._imageryProvider.tilingScheme instanceof GeographicTilingScheme) &&
- (rectangle.east - rectangle.west) / texture.width > 1e-5) {
+ rectangle.width / texture.width > 1e-5) {
var reprojectedTexture = reprojectToGeographic(this, context, texture, imagery.rectangle);
texture.destroy();
imagery.texture = texture = reprojectedTexture;
@@ -949,7 +950,7 @@ define([
var ellipsoid = tilingScheme.ellipsoid;
var latitudeFactor = !(layer._imageryProvider.tilingScheme instanceof GeographicTilingScheme) ? Math.cos(latitudeClosestToEquator) : 1.0;
var tilingSchemeRectangle = tilingScheme.rectangle;
- var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * (tilingSchemeRectangle.east - tilingSchemeRectangle.west) * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0));
+ var levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * tilingSchemeRectangle.width * latitudeFactor / (imageryProvider.tileWidth * tilingScheme.getNumberOfXTilesAtLevel(0));
var twoToTheLevelPower = levelZeroMaximumTexelSpacing / texelSpacing;
var level = Math.log(twoToTheLevelPower) / Math.log(2);
diff --git a/Source/Scene/WebMapServiceImageryProvider.js b/Source/Scene/WebMapServiceImageryProvider.js
index 10234cab5e53..0915f19a5d5f 100644
--- a/Source/Scene/WebMapServiceImageryProvider.js
+++ b/Source/Scene/WebMapServiceImageryProvider.js
@@ -151,7 +151,7 @@ define([
this._rectangle = defaultValue(options.rectangle, Rectangle.MAX_VALUE);
this._tilingScheme = defined(options.tilingScheme) ? options.tilingScheme : new GeographicTilingScheme();
- this._rectangle = Rectangle.intersectWith(this._rectangle, this._tilingScheme.rectangle);
+ this._rectangle = Rectangle.intersection(this._rectangle, this._tilingScheme.rectangle);
var credit = options.credit;
if (typeof credit === 'string') {
@@ -475,8 +475,8 @@ define([
projected = this._tilingScheme.projection.project(cartographic, cartesian3Scratch);
}
- var i = (this._tileWidth * (projected.x - rectangle.west) / (rectangle.east - rectangle.west)) | 0;
- var j = (this._tileHeight * (rectangle.north - projected.y) / (rectangle.north - rectangle.south)) | 0;
+ var i = (this._tileWidth * (projected.x - rectangle.west) / rectangle.width) | 0;
+ var j = (this._tileHeight * (rectangle.north - projected.y) / rectangle.height) | 0;
var url;
diff --git a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
index 3df7d1a245bb..2a5f354e1daf 100644
--- a/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
+++ b/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
@@ -134,6 +134,15 @@ define([
var vertexIndex = vertexBufferIndex / vertexStride;
+ var north = rectangle.north;
+ var south = rectangle.south;
+ var east = rectangle.east;
+ var west = rectangle.west;
+
+ if (east < west) {
+ east += CesiumMath.TWO_PI;
+ }
+
for (var i = start; i !== end; i += increment) {
var index = edgeVertices[i];
var offset = index * vertexStride;
@@ -141,8 +150,8 @@ define([
var v = vertexBuffer[offset + vIndex];
var h = vertexBuffer[offset + hIndex];
- cartographicScratch.longitude = CesiumMath.lerp(rectangle.west, rectangle.east, u);
- cartographicScratch.latitude = CesiumMath.lerp(rectangle.south, rectangle.north, v);
+ cartographicScratch.longitude = CesiumMath.lerp(west, east, u);
+ cartographicScratch.latitude = CesiumMath.lerp(south, north, v);
cartographicScratch.height = h - skirtLength;
var position = ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch);
diff --git a/Source/Workers/upsampleQuantizedTerrainMesh.js b/Source/Workers/upsampleQuantizedTerrainMesh.js
index dbae013f9ea9..a7fccc685cf9 100644
--- a/Source/Workers/upsampleQuantizedTerrainMesh.js
+++ b/Source/Workers/upsampleQuantizedTerrainMesh.js
@@ -180,6 +180,15 @@ define([
var ellipsoid = Ellipsoid.clone(parameters.ellipsoid);
var rectangle = parameters.childRectangle;
+ var north = rectangle.north;
+ var south = rectangle.south;
+ var east = rectangle.east;
+ var west = rectangle.west;
+
+ if (east < west) {
+ east += CesiumMath.TWO_PI;
+ }
+
for (i = 0; i < uBuffer.length; ++i) {
u = uBuffer[i];
if (u <= minU) {
@@ -217,8 +226,8 @@ define([
heightBuffer[i] = height;
- cartographicScratch.longitude = CesiumMath.lerp(rectangle.west, rectangle.east, u);
- cartographicScratch.latitude = CesiumMath.lerp(rectangle.south, rectangle.north, v);
+ cartographicScratch.longitude = CesiumMath.lerp(west, east, u);
+ cartographicScratch.latitude = CesiumMath.lerp(south, north, v);
cartographicScratch.height = height;
ellipsoid.cartographicToCartesian(cartographicScratch, cartesian3Scratch);
diff --git a/Specs/Core/RectangleSpec.js b/Specs/Core/RectangleSpec.js
index 7ee99de2a40b..6a5fbf0010af 100644
--- a/Specs/Core/RectangleSpec.js
+++ b/Specs/Core/RectangleSpec.js
@@ -36,6 +36,24 @@ defineSuite([
expect(rectangle.north).toEqual(north);
});
+ it('computeWidth', function() {
+ var rectangle = new Rectangle(west, south, east, north);
+ var expected = east - west;
+ expect(Rectangle.computeWidth(rectangle)).toEqual(expected);
+ expect(rectangle.width).toEqual(expected);
+
+ rectangle = new Rectangle(2.0, -1.0, -2.0, 1.0);
+ expected = rectangle.east - rectangle.west + CesiumMath.TWO_PI;
+ expect(rectangle.width).toEqual(expected);
+ });
+
+ it('computeHeight', function() {
+ var rectangle = new Rectangle(west, south, east, north);
+ var expected = north - south;
+ expect(Rectangle.computeHeight(rectangle)).toEqual(expected);
+ expect(rectangle.height).toEqual(expected);
+ });
+
it('fromDegrees produces expected values.', function() {
var west = -10.0;
var south = -20.0;
@@ -320,7 +338,7 @@ defineSuite([
it('center works without a result parameter', function() {
var rectangle = new Rectangle(west, south, east, north);
var returnedResult = Rectangle.center(rectangle);
- expect(returnedResult).toEqual(center);
+ expect(returnedResult).toEqualEpsilon(center, CesiumMath.EPSILON11);
});
it('center works with a result parameter', function() {
@@ -328,13 +346,13 @@ defineSuite([
var result = new Cartographic();
var returnedResult = Rectangle.center(rectangle, result);
expect(result).toBe(returnedResult);
- expect(returnedResult).toEqual(center);
+ expect(returnedResult).toEqualEpsilon(center, CesiumMath.EPSILON11);
});
it('center works across IDL', function() {
var rectangle = Rectangle.fromDegrees(170, 0, -170, 0);
var returnedResult = Rectangle.center(rectangle);
- expect(returnedResult).toEqualEpsilon(Cartographic.fromDegrees(-180, 0), CesiumMath.EPSILON11);
+ expect(returnedResult).toEqualEpsilon(Cartographic.fromDegrees(180, 0), CesiumMath.EPSILON11);
rectangle = Rectangle.fromDegrees(160, 0, -170, 0);
returnedResult = Rectangle.center(rectangle);
@@ -355,71 +373,150 @@ defineSuite([
}).toThrowDeveloperError();
});
- it('intersectWith works without a result parameter', function() {
+ it('intersection works without a result parameter', function() {
var rectangle = new Rectangle(0.5, 0.1, 0.75, 0.9);
var rectangle2 = new Rectangle(0.0, 0.25, 1.0, 0.8);
var expected = new Rectangle(0.5, 0.25, 0.75, 0.8);
- var returnedResult = Rectangle.intersectWith(rectangle, rectangle2);
+ var returnedResult = Rectangle.intersection(rectangle, rectangle2);
expect(returnedResult).toEqual(expected);
});
- it('intersectWith works with a result parameter', function() {
+ it('intersection works with a result parameter', function() {
var rectangle = new Rectangle(0.5, 0.1, 0.75, 0.9);
var rectangle2 = new Rectangle(0.0, 0.25, 1.0, 0.8);
var expected = new Rectangle(0.5, 0.25, 0.75, 0.8);
var result = new Rectangle();
- var returnedResult = Rectangle.intersectWith(rectangle, rectangle2, result);
+ var returnedResult = Rectangle.intersection(rectangle, rectangle2, result);
expect(returnedResult).toEqual(expected);
expect(result).toBe(returnedResult);
});
- it('contains works', function() {
- var rectangle = new Rectangle(west, south, east, north);
- expect(Rectangle.contains(rectangle, new Cartographic(west, south))).toEqual(true);
- expect(Rectangle.contains(rectangle, new Cartographic(west, north))).toEqual(true);
- expect(Rectangle.contains(rectangle, new Cartographic(east, south))).toEqual(true);
- expect(Rectangle.contains(rectangle, new Cartographic(east, north))).toEqual(true);
- expect(Rectangle.contains(rectangle, Rectangle.center(rectangle))).toEqual(true);
- expect(Rectangle.contains(rectangle, new Cartographic(west - 0.1, south))).toEqual(false);
- expect(Rectangle.contains(rectangle, new Cartographic(west, north + 0.1))).toEqual(false);
- expect(Rectangle.contains(rectangle, new Cartographic(east, south - 0.1))).toEqual(false);
- expect(Rectangle.contains(rectangle, new Cartographic(east + 0.1, north))).toEqual(false);
+ it('intersection works across the IDL (1)', function() {
+ var rectangle1 = Rectangle.fromDegrees(170.0, -10.0, -170.0, 10.0);
+ var rectangle2 = Rectangle.fromDegrees(-175.0, 5.0, -160.0, 15.0);
+ var expected = Rectangle.fromDegrees(-175.0, 5.0, -170.0, 10.0);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).toEqual(expected);
+ expect(Rectangle.intersection(rectangle2, rectangle1)).toEqual(expected);
});
- it('isEmpty reports a non-empty rectangle', function() {
- var rectangle = new Rectangle(1.0, 1.0, 2.0, 2.0);
- expect(Rectangle.isEmpty(rectangle)).toEqual(false);
+ it('intersection works across the IDL (2)', function() {
+ var rectangle1 = Rectangle.fromDegrees(170.0, -10.0, -170.0, 10.0);
+ var rectangle2 = Rectangle.fromDegrees(160.0, 5.0, 175.0, 15.0);
+ var expected = Rectangle.fromDegrees(170.0, 5.0, 175.0, 10.0);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).toEqual(expected);
+ expect(Rectangle.intersection(rectangle2, rectangle1)).toEqual(expected);
});
- it('isEmpty reports true for a point', function() {
- var rectangle = new Rectangle(2.0, 2.0, 2.0, 2.0);
- expect(Rectangle.isEmpty(rectangle)).toEqual(true);
+ it('intersection works across the IDL (3)', function() {
+ var rectangle1 = Rectangle.fromDegrees(170.0, -10.0, -170.0, 10.0);
+ var rectangle2 = Rectangle.fromDegrees(175.0, 5.0, -175.0, 15.0);
+ var expected = Rectangle.fromDegrees(175.0, 5.0, -175.0, 10.0);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).toEqual(expected);
+ expect(Rectangle.intersection(rectangle2, rectangle1)).toEqual(expected);
});
- it('isEmpty reports true for a north-south line', function() {
- var rectangle = new Rectangle(2.0, 2.0, 2.0, 2.1);
- expect(Rectangle.isEmpty(rectangle)).toEqual(true);
+ it('intersection returns undefined for a point', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(east, north, east + 0.1, north + 0.1);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
});
- it('isEmpty reports true for an east-west line', function() {
- var rectangle = new Rectangle(2.0, 2.0, 2.1, 2.0);
- expect(Rectangle.isEmpty(rectangle)).toEqual(true);
+ it('intersection returns undefined for a east-west line (1)', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(west, north, east, north + 0.1);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
});
- it('isEmpty reports true if north-south direction is degenerate', function() {
- var rectangle = new Rectangle(1.0, 1.1, 2.0, 1.0);
- expect(Rectangle.isEmpty(rectangle)).toEqual(true);
+ it('intersection returns undefined for a east-west line (2)', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(west, south + 0.1, east, south);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
});
- it('isEmpty reports true if east-west direction is degenerate', function() {
- var rectangle = new Rectangle(1.1, 1.0, 1.0, 2.0);
- expect(Rectangle.isEmpty(rectangle)).toEqual(true);
+ it('intersection returns undefined for a north-south line (1)', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(east, south, east + 0.1, north);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
});
- it('isEmpty throws with no rectangle', function() {
- expect(function() {
- Rectangle.isEmpty();
- }).toThrowDeveloperError();
+ it('intersection returns undefined for a north-south line (2)', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(west - 0.1, south, west, north);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
+ });
+
+ it('intersection returns undefined for a north-south line (3)', function() {
+ var west = CesiumMath.toRadians(170.0);
+ var south = CesiumMath.toRadians(-10.0);
+ var east = CesiumMath.toRadians(-170.0);
+ var north = CesiumMath.toRadians(10.0);
+
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(east, south, east + 0.1, north);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
+ });
+
+ it('intersection returns undefined for a north-south line (4)', function() {
+ var west = CesiumMath.toRadians(170.0);
+ var south = CesiumMath.toRadians(-10.0);
+ var east = CesiumMath.toRadians(-170.0);
+ var north = CesiumMath.toRadians(10.0);
+
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(west - 0.1, south, west, north);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
+ });
+
+ it('intersection returns undefined if north-south direction is degenerate', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(west, north + 0.1, east, north + 0.2);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
+ });
+
+ it('intersection returns undefined if east-west direction is degenerate', function() {
+ var rectangle1 = new Rectangle(west, south, east, north);
+ var rectangle2 = new Rectangle(east + 0.1, south, east + 0.2, north);
+ expect(Rectangle.intersection(rectangle1, rectangle2)).not.toBeDefined();
+ expect(Rectangle.intersection(rectangle2, rectangle1)).not.toBeDefined();
+ });
+
+ it('contains works', function() {
+ var rectangle = new Rectangle(west, south, east, north);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, south))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, north))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, south))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, north))).toEqual(true);
+ expect(Rectangle.contains(rectangle, Rectangle.center(rectangle))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(west - 0.1, south))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, north + 0.1))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, south - 0.1))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(east + 0.1, north))).toEqual(false);
+ });
+
+ it('contains works with rectangle across the IDL', function() {
+ var west = CesiumMath.toRadians(170.0);
+ var south = CesiumMath.toRadians(-10.0);
+ var east = CesiumMath.toRadians(-170.0);
+ var north = CesiumMath.toRadians(10.0);
+
+ var rectangle = new Rectangle(west, south, east, north);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, south))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, north))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, south))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, north))).toEqual(true);
+ expect(Rectangle.contains(rectangle, Rectangle.center(rectangle))).toEqual(true);
+ expect(Rectangle.contains(rectangle, new Cartographic(west - 0.1, south))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(west, north + 0.1))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(east, south - 0.1))).toEqual(false);
+ expect(Rectangle.contains(rectangle, new Cartographic(east + 0.1, north))).toEqual(false);
});
it('subsample works south of the equator', function() {
@@ -525,10 +622,16 @@ defineSuite([
}).toThrowDeveloperError();
});
- it('intersectWith throws with no rectangle', function() {
+ it('intersection throws with no rectangle', function() {
+ expect(function() {
+ Rectangle.intersection(undefined);
+ }).toThrowDeveloperError();
+ });
+
+ it('intersection throws with no otherRectangle', function() {
var rectangle = new Rectangle(west, south, east, north);
expect(function() {
- Rectangle.intersectWith(undefined);
+ Rectangle.intersection(rectangle, undefined);
}).toThrowDeveloperError();
});
diff --git a/Specs/Scene/WebMapServiceImageryProviderSpec.js b/Specs/Scene/WebMapServiceImageryProviderSpec.js
index 9f385b91c44c..fbdc62e31515 100644
--- a/Specs/Scene/WebMapServiceImageryProviderSpec.js
+++ b/Specs/Scene/WebMapServiceImageryProviderSpec.js
@@ -7,6 +7,7 @@ defineSuite([
'Core/GeographicTilingScheme',
'Core/loadImage',
'Core/loadWithXhr',
+ 'Core/Math',
'Core/queryToObject',
'Core/Rectangle',
'Core/WebMercatorTilingScheme',
@@ -26,6 +27,7 @@ defineSuite([
GeographicTilingScheme,
loadImage,
loadWithXhr,
+ CesiumMath,
queryToObject,
Rectangle,
WebMercatorTilingScheme,
@@ -344,7 +346,7 @@ defineSuite([
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toBeUndefined();
expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme);
- expect(provider.rectangle).toEqual(rectangle);
+ expect(provider.rectangle).toEqualEpsilon(rectangle, CesiumMath.EPSILON14);
expect(provider.tileDiscardPolicy).toBeUndefined();
});
});