Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for AxisAlignedBoundingBox clone method #6183

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Change Log
==========

### 1.43 - 2018-03-01

##### Fixes :wrench:
* Fixed bug where AxisAlignedBoundingBox did not copy over center value when cloning an undefined result. [#6183](https:/AnalyticalGraphicsInc/cesium/pull/6183)

### 1.42.1 - 2018-02-01
_This is an npm-only release to fix an issue with using Cesium in Node.js.__
* Fixed a bug where Cesium would fail to load under Node.js. [#6177](https:/AnalyticalGraphicsInc/cesium/pull/6177)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AxisAlignedBoundingBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ define([
}

if (!defined(result)) {
return new AxisAlignedBoundingBox(box.minimum, box.maximum);
return new AxisAlignedBoundingBox(box.minimum, box.maximum, box.center);
}

result.minimum = Cartesian3.clone(box.minimum, result.minimum);
Expand Down
7 changes: 7 additions & 0 deletions Specs/Core/AxisAlignedBoundingBoxSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ defineSuite([
expect(box).toEqual(result);
});

it('clone without a result parameter with box of offset center', function() {
var box = new AxisAlignedBoundingBox(Cartesian3.UNIT_Y, Cartesian3.UNIT_X, Cartesian3.UNIT_Z);
var result = box.clone();
expect(box).not.toBe(result);
expect(box).toEqual(result);
});

it('clone with a result parameter', function() {
var box = new AxisAlignedBoundingBox(Cartesian3.UNIT_Y, Cartesian3.UNIT_X);
var result = new AxisAlignedBoundingBox(Cartesian3.ZERO, Cartesian3.UNIT_Z);
Expand Down