Skip to content

Commit

Permalink
camera.flyToBoundingSphere should always use range when it's supplied
Browse files Browse the repository at this point in the history
Fixes #2519

I also tweaked `distanceToBoundingSphere2D` because it was giving
incorrect results on my machine.
  • Loading branch information
mramato committed Mar 2, 2015
1 parent 8677e31 commit db29e1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Change Log
* Fixed a bug that would cause incorrect geometry for long Corridors and Polyline Volumes. [#2513](https://github.com/AnalyticalGraphicsInc/cesium/issues/2513)
* Fixed a bug in imagery loading that could cause some or all of the globe to be missing when using an imagery layer that does not cover the entire globe.
* Fixed a bug that caused `ElipseOutlineGeometry` and `CircleOutlineGeometry` to be extruded to the ground when they should have instead been drawn at height. [#2499](https://github.com/AnalyticalGraphicsInc/cesium/issues/2499).
* Fixed a bug where `camera.flyToBoundingSphere` would ignore range if the bounding sphere radius was 0. [#2519](https://github.com/AnalyticalGraphicsInc/cesium/issues/2519)
* Fixed some styling issues with `InfoBox` and `BaseLayerPicker` caused by using Bootstrap with Cesium. [#2487](https://github.com/AnalyticalGraphicsInc/cesium/issues/2479)
* Added support for rendering a water effect on Quantized-Mesh terrain tiles.
* Added `pack` and `unpack` functions to `Matrix2` and `Matrix3`.
Expand Down
16 changes: 9 additions & 7 deletions Source/Scene/Camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -2410,23 +2410,25 @@ define([
right = heightRatio;
}

return Math.max(right, top) * 1.25;
return Math.max(right, top) * 1.50;
}

var scratchDefaultOffset = new HeadingPitchRange(0.0, -CesiumMath.PI_OVER_FOUR, 0.0);
var MINIMUM_ZOOM = 100.0;

function adjustBoundingSphereOffset(camera, boundingSphere, offset) {
if (!defined(offset)) {
offset = scratchDefaultOffset;
offset.range = 0.0;
offset = HeadingPitchRange.clone(scratchDefaultOffset);
}

if (boundingSphere.radius === 0.0) {
offset.range = MINIMUM_ZOOM;
} else if (defined(offset.range) && offset.range === 0.0) {
var range = offset.range;
if (!defined(range) || range === 0.0) {
var radius = boundingSphere.radius;
offset.range = camera._mode === SceneMode.SCENE2D ? distanceToBoundingSphere2D(camera, radius) : distanceToBoundingSphere3D(camera, radius);
if (radius === 0.0) {
offset.range = MINIMUM_ZOOM;
} else {
offset.range = camera._mode === SceneMode.SCENE2D ? distanceToBoundingSphere2D(camera, radius) : distanceToBoundingSphere3D(camera, radius);
}
}

return offset;
Expand Down

0 comments on commit db29e1d

Please sign in to comment.