From 8b72bf8ed7caa2b0b988743008ac7eabc09c8df0 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 13:36:57 -0400 Subject: [PATCH 01/18] Allow headingPitchRollToFixedFrame to take a HeadingPitchRoll object. --- Source/Core/Transforms.js | 24 ++++++++++++--- Specs/Core/TransformsSpec.js | 58 ++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 4c5b1a12900b..0d30ee5920c6 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -7,6 +7,7 @@ define([ './Cartographic', './defaultValue', './defined', + './deprecationWarning', './DeveloperError', './EarthOrientationParameters', './EarthOrientationParametersSample', @@ -28,6 +29,7 @@ define([ Cartographic, defaultValue, defined, + deprecationWarning, DeveloperError, EarthOrientationParameters, EarthOrientationParametersSample, @@ -456,10 +458,12 @@ define([ * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. * + * You should pass a HeadingPitchRoll object. Passing separate heading, pitch, and roll values is deprecated. + * * @param {Cartesian3} origin The center point of the local reference frame. - * @param {Number} heading The heading angle in radians. - * @param {Number} pitch The pitch angle in radians. - * @param {Number} roll The roll angle in radians. + * @param {HeadingPitchRoll|Number} hprOrHeading A HeadingPitchRoll or the heading angle in radians. + * @param {Number?} pitch The pitch angle in radians if a HeadingPitchRoll object was not passed. + * @param {Number?} roll The roll angle in radians if a HeadingPitchRoll object was not passed. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. * @param {Matrix4} [result] The object onto which to store the result. * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if none was provided. @@ -472,7 +476,19 @@ define([ * var roll = 0.0; * var transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, heading, pitch, roll); */ - Transforms.headingPitchRollToFixedFrame = function(origin, heading, pitch, roll, ellipsoid, result) { + Transforms.headingPitchRollToFixedFrame = function(origin, hprOrHeading, pitch, roll, ellipsoid, result) { + var heading; + if (typeof hprOrHeading === 'object') { + // Shift arguments using assignments to encourage JIT optimization. + ellipsoid = pitch; + result = roll; + heading = hprOrHeading.heading; + pitch = hprOrHeading.pitch; + roll = hprOrHeading.roll; + } else { + deprecationWarning('headingPitchRollToFixedFrame', 'headingPitchRollToFixedFrame with separate heading, pitch, and roll arguments was deprecated in 1.27. It will be removed in 1.30. Use a HeadingPitchRoll object.'); + heading = hprOrHeading; + } // checks for required parameters happen in the called functions var hprQuaternion = Quaternion.fromHeadingPitchRoll(heading, pitch, roll, scratchHPRQuaternion); var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4); diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 2fc0a2d48394..1e4259dc1a91 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -267,6 +267,34 @@ defineSuite([ expect(actualTranslation).toEqual(origin); }); + it('headingPitchRollToFixedFrame works with a HeadingPitchRoll object and without a result parameter', function() { + var origin = new Cartesian3(1.0, 0.0, 0.0); + var heading = CesiumMath.toRadians(20.0); + var pitch = CesiumMath.toRadians(30.0); + var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); + + var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); + var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); + var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); + var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); + + Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); + Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); + Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); + + var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); + var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); + var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); + var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); + var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); + + expect(actualX).toEqual(expectedX); + expect(actualY).toEqual(expectedY); + expect(actualZ).toEqual(expectedZ); + expect(actualTranslation).toEqual(origin); + }); + it('headingPitchRollToFixedFrame works with a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0); var heading = CesiumMath.toRadians(20.0); @@ -296,6 +324,36 @@ defineSuite([ expect(actualTranslation).toEqual(origin); }); + it('headingPitchRollToFixedFrame works with a HeadingPitchRoll object and a result parameter', function() { + var origin = new Cartesian3(1.0, 0.0, 0.0); + var heading = CesiumMath.toRadians(20.0); + var pitch = CesiumMath.toRadians(30.0); + var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); + + var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); + var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); + var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); + var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); + + Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); + Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); + Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); + + var result = new Matrix4(); + var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE, result); + var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); + var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); + var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); + var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); + + expect(returnedResult).toBe(result); + expect(actualX).toEqual(expectedX); + expect(actualY).toEqual(expectedY); + expect(actualZ).toEqual(expectedZ); + expect(actualTranslation).toEqual(origin); + }); + it('aircraftHeadingPitchRollToFixedFrame works without a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0); var heading = CesiumMath.toRadians(20.0); From 35bb5ccab9c104783d06333c69a8d1850e9ba978 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:00:36 -0400 Subject: [PATCH 02/18] Fix aircraftHeadingPitchRollToFixedFrame to use an east-north up frame, as documented. --- Source/Core/Transforms.js | 2 +- Specs/Core/TransformsSpec.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 0d30ee5920c6..2dbb894e9ca9 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -529,7 +529,7 @@ define([ //>>includeEnd('debug'); var hprQuaternion = Quaternion.fromHeadingPitchRoll(headingPitchRoll.heading, headingPitchRoll.pitch, headingPitchRoll.roll, scratchHPRQuaternion); var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4); - result = Transforms.northWestUpToFixedFrame(origin, ellipsoid, result); + result = Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, result); return Matrix4.multiply(result, hprMatrix, result); }; diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 1e4259dc1a91..84220cb5e21a 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -365,9 +365,9 @@ defineSuite([ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); - Cartesian3.fromElements(expectedX.z, -expectedX.y, expectedX.x, expectedX); - Cartesian3.fromElements(expectedY.z, -expectedY.y, expectedY.x, expectedY); - Cartesian3.fromElements(expectedZ.z, -expectedZ.y, expectedZ.x, expectedZ); + Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); + Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); + Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); scratchHeadingPitchRoll.heading = heading; scratchHeadingPitchRoll.pitch = pitch; @@ -396,9 +396,9 @@ defineSuite([ var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); - Cartesian3.fromElements(expectedX.z, -expectedX.y, expectedX.x, expectedX); - Cartesian3.fromElements(expectedY.z, -expectedY.y, expectedY.x, expectedY); - Cartesian3.fromElements(expectedZ.z, -expectedZ.y, expectedZ.x, expectedZ); + Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); + Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); + Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); scratchHeadingPitchRoll.heading = heading; scratchHeadingPitchRoll.pitch = pitch; From c58317cbc99e84d3013cecea1a70cbc50ca921a6 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:01:54 -0400 Subject: [PATCH 03/18] Make aircraftHeadingPitchRollToFixedFrame alias headingPitchRollToFixedFrame. --- Source/Core/Transforms.js | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 2dbb894e9ca9..9ab23703e62d 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -496,43 +496,6 @@ define([ return Matrix4.multiply(result, hprMatrix, result); }; - /** - * Computes a 4x4 transformation matrix from a reference frame with axes computed from the heading-pitch-roll angles - * centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local north - * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles - * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. - * - * @param {Cartesian3} origin The center point of the local reference frame. - * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, roll angles to apply. - * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. - * @param {Matrix4} [result] The object onto which to store the result. - * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if none was provided. - * - * @example - * // Get the transform from local heading-pitch-roll at cartographic (0.0, 0.0) to Earth's fixed frame. - * var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - * var hpr.heading = -Cesium.Math.PI_OVER_TWO; - * var hpr.pitch = Cesium.Math.PI_OVER_FOUR; - * var hpr.roll = 0.0; - * var transform = Cesium.Transforms.aircraftHeadingPitchRollToFixedFrame(center, hpr); - */ - Transforms.aircraftHeadingPitchRollToFixedFrame = function(origin, headingPitchRoll, ellipsoid, result) { - // checks for required parameters happen in the called functions - //>>includeStart('debug', pragmas.debug); - if (!defined(origin)) { - throw new DeveloperError('origin is required.'); - } - if (!defined(headingPitchRoll)) { - throw new DeveloperError('headingPitchRoll is required.'); - } - //>>includeEnd('debug'); - var hprQuaternion = Quaternion.fromHeadingPitchRoll(headingPitchRoll.heading, headingPitchRoll.pitch, headingPitchRoll.roll, scratchHPRQuaternion); - var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4); - result = Transforms.eastNorthUpToFixedFrame(origin, ellipsoid, result); - return Matrix4.multiply(result, hprMatrix, result); - }; - var scratchENUMatrix4 = new Matrix4(); var scratchHPRMatrix3 = new Matrix3(); @@ -1078,5 +1041,7 @@ define([ return result; }; + Transforms.aircraftHeadingPitchRollToFixedFrame = Transforms.headingPitchRollToFixedFrame; + return Transforms; }); From b9b066940e020beb01c81c78c8855df823581b80 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:09:05 -0400 Subject: [PATCH 04/18] Remove aircraftHeadingPitchRollToFixedFrame. --- .../gallery/development/HeadingPitchRoll.html | 4 +- CHANGES.md | 1 - Source/Core/Transforms.js | 4 +- Specs/Core/TransformsSpec.js | 80 +------------------ 4 files changed, 5 insertions(+), 84 deletions(-) diff --git a/Apps/Sandcastle/gallery/development/HeadingPitchRoll.html b/Apps/Sandcastle/gallery/development/HeadingPitchRoll.html index 148bc91fb8ad..a58c6fae485e 100644 --- a/Apps/Sandcastle/gallery/development/HeadingPitchRoll.html +++ b/Apps/Sandcastle/gallery/development/HeadingPitchRoll.html @@ -107,7 +107,7 @@

Loading...

var planePrimitive = scene.primitives.add(Cesium.Model.fromGltf({ url : '../../SampleData/models/CesiumAir/Cesium_Air.glb', - modelMatrix : Cesium.Transforms.aircraftHeadingPitchRollToFixedFrame(position, hpRoll), + modelMatrix : Cesium.Transforms.headingPitchRollToFixedFrame(position, hpRoll), minimumPixelSize : 128 })); @@ -208,7 +208,7 @@

Loading...

speedVector = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.UNIT_X, speed / 10, speedVector); position = Cesium.Matrix4.multiplyByPoint(planePrimitive.modelMatrix, speedVector, position); pathPosition.addSample(Cesium.JulianDate.now(), position); - Cesium.Transforms.aircraftHeadingPitchRollToFixedFrame(position, hpRoll, undefined, planePrimitive.modelMatrix); + Cesium.Transforms.headingPitchRollToFixedFrame(position, hpRoll, undefined, planePrimitive.modelMatrix); if (fromBehind.checked) { // Zoom to model diff --git a/CHANGES.md b/CHANGES.md index b85cd9b0a27f..0fbd2ef26455 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,7 +24,6 @@ Change Log * Removed an unnecessary reprojection of Web Mercator imagery tiles to the Geographic projection on load. This should improve both visual quality and load performance slightly. * Fix a issue where a billboard entity would not render after toggling the show propery. [#4408](https://github.com/AnalyticalGraphicsInc/cesium/issues/4408) * Added `Transforms.northUpEastToFixedFrame` to compute a 4x4 local transformation matrix from a reference frame with an north-west-up axes. -* Added `Transforms.aircraftHeadingPitchRollToFixedFrame` to create a local frame from a position and heading/pitch/roll angles. The local frame is north-west-up axed. * Added `Transforms.aircraftHeadingPitchRollQuaternion` which is the quaternion rotation from `Transforms.aircraftHeadingPitchRollToFixedFrame`. * Added `HeadingPitchRoll` : * `HeadingPitchRoll.fromQuaternion` function for retrieving heading-pitch-roll angles from a quaternion. diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 9ab23703e62d..bd7745847674 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -553,7 +553,7 @@ define([ */ Transforms.aircraftHeadingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, result) { // checks for required parameters happen in the called functions - var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, scratchENUMatrix4); + var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, scratchENUMatrix4); var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3); return Quaternion.fromRotationMatrix(rotation, result); }; @@ -1041,7 +1041,5 @@ define([ return result; }; - Transforms.aircraftHeadingPitchRollToFixedFrame = Transforms.headingPitchRollToFixedFrame; - return Transforms; }); diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 84220cb5e21a..3c3c18b7ac48 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -354,70 +354,6 @@ defineSuite([ expect(actualTranslation).toEqual(origin); }); - it('aircraftHeadingPitchRollToFixedFrame works without a result parameter', function() { - var origin = new Cartesian3(1.0, 0.0, 0.0); - var heading = CesiumMath.toRadians(20.0); - var pitch = CesiumMath.toRadians(30.0); - var roll = CesiumMath.toRadians(40.0); - - var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); - var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); - var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); - var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); - - Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); - Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); - Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); - - scratchHeadingPitchRoll.heading = heading; - scratchHeadingPitchRoll.pitch = pitch; - scratchHeadingPitchRoll.roll = roll; - - var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); - var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); - var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); - var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); - var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); - - expect(actualX).toEqual(expectedX); - expect(actualY).toEqual(expectedY); - expect(actualZ).toEqual(expectedZ); - expect(actualTranslation).toEqual(origin); - }); - - it('aircraftHeadingPitchRollToFixedFrame works with a result parameter', function() { - var origin = new Cartesian3(1.0, 0.0, 0.0); - var heading = CesiumMath.toRadians(20.0); - var pitch = CesiumMath.toRadians(30.0); - var roll = CesiumMath.toRadians(40.0); - - var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); - var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); - var expectedY = Matrix3.getColumn(expectedRotation, 1, new Cartesian3()); - var expectedZ = Matrix3.getColumn(expectedRotation, 2, new Cartesian3()); - - Cartesian3.fromElements(expectedX.z, expectedX.x, expectedX.y, expectedX); - Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); - Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); - - scratchHeadingPitchRoll.heading = heading; - scratchHeadingPitchRoll.pitch = pitch; - scratchHeadingPitchRoll.roll = roll; - - var result = new Matrix4(); - var returnedResult = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE, result); - var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); - var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); - var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); - var actualTranslation = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 3, new Cartesian4())); - - expect(returnedResult).toBe(result); - expect(actualX).toEqual(expectedX); - expect(actualY).toEqual(expectedY); - expect(actualZ).toEqual(expectedZ); - expect(actualTranslation).toEqual(origin); - }); - it('headingPitchRollQuaternion works without a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0); var heading = CesiumMath.toRadians(20.0); @@ -454,7 +390,7 @@ defineSuite([ scratchHeadingPitchRoll.pitch = CesiumMath.toRadians(30.0); scratchHeadingPitchRoll.roll = CesiumMath.toRadians(40.0); - var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); + var transform = Transforms.headingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); var expected = Matrix4.getRotation(transform, new Matrix3()); var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); @@ -468,7 +404,7 @@ defineSuite([ scratchHeadingPitchRoll.pitch = CesiumMath.toRadians(30.0); scratchHeadingPitchRoll.roll = CesiumMath.toRadians(40.0); - var transform = Transforms.aircraftHeadingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); + var transform = Transforms.headingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); var expected = Matrix4.getRotation(transform, new Matrix3()); var result = new Quaternion(); @@ -1006,18 +942,6 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('aircraftHeadingPitchRollToFixedFrame throws without an origin', function() { - expect(function() { - Transforms.aircraftHeadingPitchRollToFixedFrame(undefined, scratchHeadingPitchRoll); - }).toThrowDeveloperError(); - }); - - it('aircraftHeadingPitchRollToFixedFrame throws without an headingPitchRoll', function() { - expect(function() { - Transforms.aircraftHeadingPitchRollToFixedFrame(Cartesian3.ZERO, undefined); - }).toThrowDeveloperError(); - }); - it('aircraftHeadingPitchRollQuaternion throws without an origin', function() { expect(function() { Transforms.aircraftHeadingPitchRollQuaternion(undefined, scratchHeadingPitchRoll); From f20531df3e2677686d1eb21e20b1a2e278adcdd7 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:45:50 -0400 Subject: [PATCH 05/18] Use HeadingPitchRoll in specs. --- Specs/Scene/ShadowMapSpec.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Specs/Scene/ShadowMapSpec.js b/Specs/Scene/ShadowMapSpec.js index dfd14519819c..91735845e759 100644 --- a/Specs/Scene/ShadowMapSpec.js +++ b/Specs/Scene/ShadowMapSpec.js @@ -11,6 +11,7 @@ defineSuite([ 'Core/EllipsoidTerrainProvider', 'Core/GeometryInstance', 'Core/HeadingPitchRange', + 'Core/HeadingPitchRoll', 'Core/HeightmapTerrainData', 'Core/JulianDate', 'Core/Math', @@ -43,6 +44,7 @@ defineSuite([ EllipsoidTerrainProvider, GeometryInstance, HeadingPitchRange, + HeadingPitchRoll, HeightmapTerrainData, JulianDate, CesiumMath, @@ -99,15 +101,16 @@ defineSuite([ Color.unpack(backgroundColor, 0, scene.backgroundColor); sunShadowMap = scene.shadowMap; + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); var boxOrigin = new Cartesian3.fromRadians(longitude, latitude, boxHeight); - var boxTransform = Transforms.headingPitchRollToFixedFrame(boxOrigin, 0.0, 0.0, 0.0); + var boxTransform = Transforms.headingPitchRollToFixedFrame(boxOrigin, hpr); var floorOrigin = new Cartesian3.fromRadians(longitude, latitude, floorHeight); - var floorTransform = Transforms.headingPitchRollToFixedFrame(floorOrigin, 0.0, 0.0, 0.0); + var floorTransform = Transforms.headingPitchRollToFixedFrame(floorOrigin, hpr); var roomOrigin = new Cartesian3.fromRadians(longitude, latitude, height); - var roomTransform = Transforms.headingPitchRollToFixedFrame(roomOrigin, 0.0, 0.0, 0.0); + var roomTransform = Transforms.headingPitchRollToFixedFrame(roomOrigin, hpr); var modelPromises = []; modelPromises.push(loadModel({ @@ -658,10 +661,11 @@ defineSuite([ new HeadingPitchRange(0, CesiumMath.PI_OVER_TWO, 0.1) ]; + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); for (var i = 0; i < 6; ++i) { var box = scene.primitives.add(Model.fromGltf({ url : boxUrl, - modelMatrix : Transforms.headingPitchRollToFixedFrame(origins[i], 0.0, 0.0, 0.0), + modelMatrix : Transforms.headingPitchRollToFixedFrame(origins[i], hpr), scale : 0.2 })); scene.render(); // Model is pre-loaded, render one frame to make it ready From 718e41a66e7f7cfb7fa7be74473f870cff209848 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:46:29 -0400 Subject: [PATCH 06/18] Use HeadingPitchRoll in Sandcastle apps. --- .../gallery/development/3D Models Node Explorer.html | 6 ++---- Apps/Sandcastle/gallery/development/3D Models.html | 3 ++- .../gallery/development/Multiple Shadows.html | 2 +- Apps/Sandcastle/gallery/development/Shadows.html | 12 ++++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html index 0c3a2bf340c2..9b7e98fa697a 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html +++ b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html @@ -181,11 +181,9 @@ var scene = viewer.scene; var height = 250000.0; -var heading = 0.0; -var pitch = 0.0; -var roll = 0.0; +var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height); -var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll); +var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : modelUrl, diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index d74e03952e41..e99f3175ca6d 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -35,9 +35,10 @@ heading = Cesium.defaultValue(heading, 0.0); pitch = Cesium.defaultValue(pitch, 0.0); roll = Cesium.defaultValue(roll, 0.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height); - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); scene.primitives.removeAll(); // Remove previous model var model = scene.primitives.add(Cesium.Model.fromGltf({ diff --git a/Apps/Sandcastle/gallery/development/Multiple Shadows.html b/Apps/Sandcastle/gallery/development/Multiple Shadows.html index 3794a9b205d0..43e86a1bbd6a 100644 --- a/Apps/Sandcastle/gallery/development/Multiple Shadows.html +++ b/Apps/Sandcastle/gallery/development/Multiple Shadows.html @@ -74,7 +74,7 @@ var model = scene.primitives.add(Cesium.Model.fromGltf({ url : '../../SampleData/models/ShadowTester/Shadow_Tester_Point.gltf', - modelMatrix : Cesium.Transforms.headingPitchRollToFixedFrame(center, heading, 0.0, 0.0) + modelMatrix : Cesium.Transforms.headingPitchRollToFixedFrame(center, new HeadingPitchRoll(heading, 0.0, 0.0)) })); model.readyPromise.then(function(model) { diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index 91d9640a257d..83db8eda9a9e 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -585,7 +585,8 @@ } function createModel(url, origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, 0.0, 0.0, 0.0); + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : url, @@ -606,7 +607,8 @@ } function createBoxRTC(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, 0.0, 0.0, 0.0); + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); var boxGeometry = Cesium.BoxGeometry.createGeometry(Cesium.BoxGeometry.fromDimensions({ vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, @@ -645,7 +647,8 @@ } function createBox(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, 0.0, 0.0, 0.0); + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); var box = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ @@ -670,7 +673,8 @@ } function createSphere(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, 0.0, 0.0, 0.0); + var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); var sphere = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ From 5eec6a0ad01c886b27fca0424eb29005849e102a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 14:59:26 -0400 Subject: [PATCH 07/18] Use default HeadingPitchRoll values. --- .../gallery/development/3D Models Node Explorer.html | 3 +-- Apps/Sandcastle/gallery/development/Shadows.html | 12 ++++-------- Specs/Scene/ShadowMapSpec.js | 10 ++++------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html index 9b7e98fa697a..2d7378b0a70e 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html +++ b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html @@ -181,9 +181,8 @@ var scene = viewer.scene; var height = 250000.0; -var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height); -var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); +var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : modelUrl, diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index 83db8eda9a9e..7bc8c57a5903 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -585,8 +585,7 @@ } function createModel(url, origin) { - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : url, @@ -607,8 +606,7 @@ } function createBoxRTC(origin) { - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); var boxGeometry = Cesium.BoxGeometry.createGeometry(Cesium.BoxGeometry.fromDimensions({ vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, @@ -647,8 +645,7 @@ } function createBox(origin) { - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); var box = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ @@ -673,8 +670,7 @@ } function createSphere(origin) { - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); var sphere = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ diff --git a/Specs/Scene/ShadowMapSpec.js b/Specs/Scene/ShadowMapSpec.js index 91735845e759..692a68548a2f 100644 --- a/Specs/Scene/ShadowMapSpec.js +++ b/Specs/Scene/ShadowMapSpec.js @@ -101,16 +101,15 @@ defineSuite([ Color.unpack(backgroundColor, 0, scene.backgroundColor); sunShadowMap = scene.shadowMap; - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); var boxOrigin = new Cartesian3.fromRadians(longitude, latitude, boxHeight); - var boxTransform = Transforms.headingPitchRollToFixedFrame(boxOrigin, hpr); + var boxTransform = Transforms.headingPitchRollToFixedFrame(boxOrigin, new HeadingPitchRoll()); var floorOrigin = new Cartesian3.fromRadians(longitude, latitude, floorHeight); - var floorTransform = Transforms.headingPitchRollToFixedFrame(floorOrigin, hpr); + var floorTransform = Transforms.headingPitchRollToFixedFrame(floorOrigin, new HeadingPitchRoll()); var roomOrigin = new Cartesian3.fromRadians(longitude, latitude, height); - var roomTransform = Transforms.headingPitchRollToFixedFrame(roomOrigin, hpr); + var roomTransform = Transforms.headingPitchRollToFixedFrame(roomOrigin, new HeadingPitchRoll()); var modelPromises = []; modelPromises.push(loadModel({ @@ -661,11 +660,10 @@ defineSuite([ new HeadingPitchRange(0, CesiumMath.PI_OVER_TWO, 0.1) ]; - var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); for (var i = 0; i < 6; ++i) { var box = scene.primitives.add(Model.fromGltf({ url : boxUrl, - modelMatrix : Transforms.headingPitchRollToFixedFrame(origins[i], hpr), + modelMatrix : Transforms.headingPitchRollToFixedFrame(origins[i], new HeadingPitchRoll()), scale : 0.2 })); scene.render(); // Model is pre-loaded, render one frame to make it ready From 9124171f5c557bab3a613294e2137a33ba0082db Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:01:22 -0400 Subject: [PATCH 08/18] Update headingPitchRollToFixedFrame documentation. --- Source/Core/Transforms.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index bd7745847674..28f81e59c545 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -458,10 +458,8 @@ define([ * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. * - * You should pass a HeadingPitchRoll object. Passing separate heading, pitch, and roll values is deprecated. - * * @param {Cartesian3} origin The center point of the local reference frame. - * @param {HeadingPitchRoll|Number} hprOrHeading A HeadingPitchRoll or the heading angle in radians. + * @param {HeadingPitchRoll} hprOrHeading A HeadingPitchRoll or the heading angle in radians. * @param {Number?} pitch The pitch angle in radians if a HeadingPitchRoll object was not passed. * @param {Number?} roll The roll angle in radians if a HeadingPitchRoll object was not passed. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. From 3c799c54957031170153428fc5677a5c458b64dc Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:04:06 -0400 Subject: [PATCH 09/18] Rename function argument. --- Source/Core/Transforms.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 28f81e59c545..7dcb4a98622e 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -459,7 +459,7 @@ define([ * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. * * @param {Cartesian3} origin The center point of the local reference frame. - * @param {HeadingPitchRoll} hprOrHeading A HeadingPitchRoll or the heading angle in radians. + * @param {HeadingPitchRoll} headingPitchRoll A HeadingPitchRoll or the heading angle in radians. * @param {Number?} pitch The pitch angle in radians if a HeadingPitchRoll object was not passed. * @param {Number?} roll The roll angle in radians if a HeadingPitchRoll object was not passed. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. @@ -474,18 +474,18 @@ define([ * var roll = 0.0; * var transform = Cesium.Transforms.headingPitchRollToFixedFrame(center, heading, pitch, roll); */ - Transforms.headingPitchRollToFixedFrame = function(origin, hprOrHeading, pitch, roll, ellipsoid, result) { + Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, pitch, roll, ellipsoid, result) { var heading; - if (typeof hprOrHeading === 'object') { + if (typeof headingPitchRoll === 'object') { // Shift arguments using assignments to encourage JIT optimization. ellipsoid = pitch; result = roll; - heading = hprOrHeading.heading; - pitch = hprOrHeading.pitch; - roll = hprOrHeading.roll; + heading = headingPitchRoll.heading; + pitch = headingPitchRoll.pitch; + roll = headingPitchRoll.roll; } else { deprecationWarning('headingPitchRollToFixedFrame', 'headingPitchRollToFixedFrame with separate heading, pitch, and roll arguments was deprecated in 1.27. It will be removed in 1.30. Use a HeadingPitchRoll object.'); - heading = hprOrHeading; + heading = headingPitchRoll; } // checks for required parameters happen in the called functions var hprQuaternion = Quaternion.fromHeadingPitchRoll(heading, pitch, roll, scratchHPRQuaternion); From 09bfcb65edc42fb79665c3b66d765bb5a2392668 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:13:25 -0400 Subject: [PATCH 10/18] Use more HeadingPitchRoll objects in tests. --- Specs/Core/TransformsSpec.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 3c3c18b7ac48..036ba0fa6e64 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -245,6 +245,7 @@ defineSuite([ var heading = CesiumMath.toRadians(20.0); var pitch = CesiumMath.toRadians(30.0); var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); @@ -255,7 +256,7 @@ defineSuite([ Cartesian3.fromElements(expectedY.z, expectedY.x, expectedY.y, expectedY); Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); - var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); + var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); @@ -300,6 +301,7 @@ defineSuite([ var heading = CesiumMath.toRadians(20.0); var pitch = CesiumMath.toRadians(30.0); var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); var expectedRotation = Matrix3.fromQuaternion(Quaternion.fromHeadingPitchRoll(heading, pitch, roll)); var expectedX = Matrix3.getColumn(expectedRotation, 0, new Cartesian3()); @@ -311,7 +313,7 @@ defineSuite([ Cartesian3.fromElements(expectedZ.z, expectedZ.x, expectedZ.y, expectedZ); var result = new Matrix4(); - var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE, result); + var returnedResult = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE, result); var actualX = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 0, new Cartesian4())); var actualY = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 1, new Cartesian4())); var actualZ = Cartesian3.fromCartesian4(Matrix4.getColumn(returnedResult, 2, new Cartesian4())); @@ -359,8 +361,9 @@ defineSuite([ var heading = CesiumMath.toRadians(20.0); var pitch = CesiumMath.toRadians(30.0); var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); - var transform = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); + var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); var expected = Matrix4.getRotation(transform, new Matrix3()); var quaternion = Transforms.headingPitchRollQuaternion(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); @@ -373,8 +376,9 @@ defineSuite([ var heading = CesiumMath.toRadians(20.0); var pitch = CesiumMath.toRadians(30.0); var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); - var transform = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, Ellipsoid.UNIT_SPHERE); + var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); var expected = Matrix4.getRotation(transform, new Matrix3()); var result = new Quaternion(); @@ -856,8 +860,9 @@ defineSuite([ var heading = CesiumMath.toRadians(90.0); var pitch = CesiumMath.toRadians(45.0); var roll = 0.0; + var hpr = new HeadingPitchRoll(heading, pitch, roll); - var modelMatrix = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, ellipsoid); + var modelMatrix = Transforms.headingPitchRollToFixedFrame(origin, hpr, ellipsoid); var modelMatrix2D = Transforms.basisTo2D(projection, modelMatrix, new Matrix4()); var translation2D = Cartesian3.fromCartesian4(Matrix4.getColumn(modelMatrix2D, 3, new Cartesian4())); @@ -876,8 +881,9 @@ defineSuite([ var heading = CesiumMath.toRadians(90.0); var pitch = CesiumMath.toRadians(45.0); var roll = 0.0; + var hpr = new HeadingPitchRoll(heading, pitch, roll); - var modelMatrix = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, ellipsoid); + var modelMatrix = Transforms.headingPitchRollToFixedFrame(origin, hpr, ellipsoid); var modelMatrix2D = Transforms.basisTo2D(projection, modelMatrix, new Matrix4()); var rotation2D = Matrix4.getRotation(modelMatrix2D, new Matrix3()); @@ -886,11 +892,11 @@ defineSuite([ var enuInverse = Matrix4.inverseTransformation(enu, enu); var hprPlusTranslate = Matrix4.multiply(enuInverse, modelMatrix, new Matrix4()); - var hpr = Matrix4.getRotation(hprPlusTranslate, new Matrix3()); + var hpr2 = Matrix4.getRotation(hprPlusTranslate, new Matrix3()); - var row0 = Matrix3.getRow(hpr, 0, new Cartesian3()); - var row1 = Matrix3.getRow(hpr, 1, new Cartesian3()); - var row2 = Matrix3.getRow(hpr, 2, new Cartesian3()); + var row0 = Matrix3.getRow(hpr2, 0, new Cartesian3()); + var row1 = Matrix3.getRow(hpr2, 1, new Cartesian3()); + var row2 = Matrix3.getRow(hpr2, 2, new Cartesian3()); var expected = new Matrix3(); Matrix3.setRow(expected, 0, row2, expected); From 9544f6a75370074df0ccdbab5183012aba71ed7d Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:18:43 -0400 Subject: [PATCH 11/18] Remove deprecated parameters from documentation. --- Source/Core/Transforms.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 7dcb4a98622e..257db93df844 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -459,9 +459,7 @@ define([ * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. * * @param {Cartesian3} origin The center point of the local reference frame. - * @param {HeadingPitchRoll} headingPitchRoll A HeadingPitchRoll or the heading angle in radians. - * @param {Number?} pitch The pitch angle in radians if a HeadingPitchRoll object was not passed. - * @param {Number?} roll The roll angle in radians if a HeadingPitchRoll object was not passed. + * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. * @param {Matrix4} [result] The object onto which to store the result. * @returns {Matrix4} The modified result parameter or a new Matrix4 instance if none was provided. From 7bff93f1d6a4be722aad5859fa935ce0c7cf3ae0 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:26:24 -0400 Subject: [PATCH 12/18] Allow headingPitchRollQuaternion to take a HeadingPitchRoll argument. --- Source/Core/Transforms.js | 25 +++++++++++++++++++------ Specs/Core/TransformsSpec.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 257db93df844..b2d391be72e9 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -492,6 +492,7 @@ define([ return Matrix4.multiply(result, hprMatrix, result); }; + var scratchHPR = new HeadingPitchRoll(); var scratchENUMatrix4 = new Matrix4(); var scratchHPRMatrix3 = new Matrix3(); @@ -502,9 +503,7 @@ define([ * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. * * @param {Cartesian3} origin The center point of the local reference frame. - * @param {Number} heading The heading angle in radians. - * @param {Number} pitch The pitch angle in radians. - * @param {Number} roll The roll angle in radians. + * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, and roll. * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. * @param {Quaternion} [result] The object onto which to store the result. * @returns {Quaternion} The modified result parameter or a new Quaternion instance if none was provided. @@ -515,11 +514,25 @@ define([ * var heading = -Cesium.Math.PI_OVER_TWO; * var pitch = Cesium.Math.PI_OVER_FOUR; * var roll = 0.0; - * var quaternion = Cesium.Transforms.headingPitchRollQuaternion(center, heading, pitch, roll); + * var hpr = new HeadingPitchRoll(heading, pitch, roll); + * var quaternion = Cesium.Transforms.headingPitchRollQuaternion(center, hpr); */ - Transforms.headingPitchRollQuaternion = function(origin, heading, pitch, roll, ellipsoid, result) { + Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, pitch, roll, ellipsoid, result) { + var hpr; + if (typeof headingPitchRoll === 'object') { + // Shift arguments using assignment to encourage JIT optimization. + hpr = headingPitchRoll; + ellipsoid = pitch; + result = roll; + } else { + deprecationWarning('headingPitchRollQuaternion', 'headingPitchRollQuaternion with separate heading, pitch, and roll arguments was deprecated in 1.27. It will be removed in 1.30. Use a HeadingPitchRoll object.'); + scratchHPR.heading = headingPitchRoll; + scratchHPR.pitch = pitch; + scratchHPR.roll = roll; + hpr = scratchHPR; + } // checks for required parameters happen in the called functions - var transform = Transforms.headingPitchRollToFixedFrame(origin, heading, pitch, roll, ellipsoid, scratchENUMatrix4); + var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, ellipsoid, scratchENUMatrix4); var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3); return Quaternion.fromRotationMatrix(rotation, result); }; diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 036ba0fa6e64..c244bdb32353 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -371,6 +371,21 @@ defineSuite([ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); }); + it('headingPitchRollQuaternion works with a HeadingPitchRoll object and without a result parameter', function() { + var origin = new Cartesian3(1.0, 0.0, 0.0); + var heading = CesiumMath.toRadians(20.0); + var pitch = CesiumMath.toRadians(30.0); + var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); + + var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); + var expected = Matrix4.getRotation(transform, new Matrix3()); + + var quaternion = Transforms.headingPitchRollQuaternion(origin, hpr, Ellipsoid.UNIT_SPHERE); + var actual = Matrix3.fromQuaternion(quaternion); + expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); + }); + it('headingPitchRollQuaternion works with a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0); var heading = CesiumMath.toRadians(20.0); @@ -388,6 +403,23 @@ defineSuite([ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); }); + it('headingPitchRollQuaternion works with a HeadingPitchRoll object and a result parameter', function() { + var origin = new Cartesian3(1.0, 0.0, 0.0); + var heading = CesiumMath.toRadians(20.0); + var pitch = CesiumMath.toRadians(30.0); + var roll = CesiumMath.toRadians(40.0); + var hpr = new HeadingPitchRoll(heading, pitch, roll); + + var transform = Transforms.headingPitchRollToFixedFrame(origin, hpr, Ellipsoid.UNIT_SPHERE); + var expected = Matrix4.getRotation(transform, new Matrix3()); + + var result = new Quaternion(); + var quaternion = Transforms.headingPitchRollQuaternion(origin, hpr, Ellipsoid.UNIT_SPHERE, result); + var actual = Matrix3.fromQuaternion(quaternion); + expect(quaternion).toBe(result); + expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); + }); + it('aircraftHeadingPitchRollQuaternion works without a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0); scratchHeadingPitchRoll.heading = CesiumMath.toRadians(20.0); From d0229815e652525a0dd26da07842baca71fea265 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:34:28 -0400 Subject: [PATCH 13/18] Use HeadingPitchRoll in Sandcastle apps. --- Apps/Sandcastle/gallery/3D Models.html | 3 ++- Apps/Sandcastle/gallery/Distance Display Conditions.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Apps/Sandcastle/gallery/3D Models.html b/Apps/Sandcastle/gallery/3D Models.html index 577880df487c..30caabdb7188 100644 --- a/Apps/Sandcastle/gallery/3D Models.html +++ b/Apps/Sandcastle/gallery/3D Models.html @@ -40,7 +40,8 @@ var heading = Cesium.Math.toRadians(135); var pitch = 0; var roll = 0; - var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll); + var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); + var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); var entity = viewer.entities.add({ name : url, diff --git a/Apps/Sandcastle/gallery/Distance Display Conditions.html b/Apps/Sandcastle/gallery/Distance Display Conditions.html index 988e9eb62a3c..d4475cabe5d8 100644 --- a/Apps/Sandcastle/gallery/Distance Display Conditions.html +++ b/Apps/Sandcastle/gallery/Distance Display Conditions.html @@ -54,7 +54,8 @@ var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 0.0); var heading = Cesium.Math.toRadians(135); - var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, 0.0, 0.0); + var hpr = new Cesium.HeadingPitchRoll(heading, 0.0, 0.0); + var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr); viewer.entities.add({ position : position, From 51c011bd1996b660fdd6086a5218e8ba59a49560 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:36:58 -0400 Subject: [PATCH 14/18] Add missing Cesium namespace. --- .../gallery/development/3D Models Node Explorer.html | 2 +- Apps/Sandcastle/gallery/development/3D Models.html | 2 +- Apps/Sandcastle/gallery/development/Multiple Shadows.html | 2 +- Apps/Sandcastle/gallery/development/Shadows.html | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html index 2d7378b0a70e..e9bf3a982bcf 100644 --- a/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html +++ b/Apps/Sandcastle/gallery/development/3D Models Node Explorer.html @@ -182,7 +182,7 @@ var height = 250000.0; var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height); -var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); +var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll()); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : modelUrl, diff --git a/Apps/Sandcastle/gallery/development/3D Models.html b/Apps/Sandcastle/gallery/development/3D Models.html index e99f3175ca6d..0504f5af2a7b 100644 --- a/Apps/Sandcastle/gallery/development/3D Models.html +++ b/Apps/Sandcastle/gallery/development/3D Models.html @@ -35,7 +35,7 @@ heading = Cesium.defaultValue(heading, 0.0); pitch = Cesium.defaultValue(pitch, 0.0); roll = Cesium.defaultValue(roll, 0.0); - var hpr = new HeadingPitchRoll(heading, pitch, roll); + var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); var origin = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height); var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, hpr); diff --git a/Apps/Sandcastle/gallery/development/Multiple Shadows.html b/Apps/Sandcastle/gallery/development/Multiple Shadows.html index 43e86a1bbd6a..798300e8c765 100644 --- a/Apps/Sandcastle/gallery/development/Multiple Shadows.html +++ b/Apps/Sandcastle/gallery/development/Multiple Shadows.html @@ -74,7 +74,7 @@ var model = scene.primitives.add(Cesium.Model.fromGltf({ url : '../../SampleData/models/ShadowTester/Shadow_Tester_Point.gltf', - modelMatrix : Cesium.Transforms.headingPitchRollToFixedFrame(center, new HeadingPitchRoll(heading, 0.0, 0.0)) + modelMatrix : Cesium.Transforms.headingPitchRollToFixedFrame(center, new Cesium.HeadingPitchRoll(heading, 0.0, 0.0)) })); model.readyPromise.then(function(model) { diff --git a/Apps/Sandcastle/gallery/development/Shadows.html b/Apps/Sandcastle/gallery/development/Shadows.html index 7bc8c57a5903..86c743789516 100644 --- a/Apps/Sandcastle/gallery/development/Shadows.html +++ b/Apps/Sandcastle/gallery/development/Shadows.html @@ -585,7 +585,7 @@ } function createModel(url, origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll()); var model = scene.primitives.add(Cesium.Model.fromGltf({ url : url, @@ -606,7 +606,7 @@ } function createBoxRTC(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll()); var boxGeometry = Cesium.BoxGeometry.createGeometry(Cesium.BoxGeometry.fromDimensions({ vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT, @@ -645,7 +645,7 @@ } function createBox(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll()); var box = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ @@ -670,7 +670,7 @@ } function createSphere(origin) { - var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new HeadingPitchRoll()); + var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(origin, new Cesium.HeadingPitchRoll()); var sphere = new Cesium.Primitive({ geometryInstances : new Cesium.GeometryInstance({ From e0319ebaadab9db6d321a095185c7d3423901513 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:41:19 -0400 Subject: [PATCH 15/18] Replace aircraftHeadingPitchRollQuaternion with headingPitchRollQuaternion. --- Source/Core/Transforms.js | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index b2d391be72e9..85b178a6c478 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -537,36 +537,6 @@ define([ return Quaternion.fromRotationMatrix(rotation, result); }; - /** - * Computes a quaternion from a reference frame with axes computed from the heading-pitch-roll angles - * centered at the provided origin. Heading is the rotation from the local north - * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles - * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis. - * - * @param {Cartesian3} origin The center point of the local reference frame. - * @param {HeadingPitchRoll} headingPitchRoll The heading, pitch, roll angles to apply. - * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid whose fixed frame is used in the transformation. - * @param {Quaternion} [result] The object onto which to store the result. - * @returns {Quaternion} The modified result parameter or a new Quaternion instance if none was provided. - * - * @example - * // Get the quaternion from local heading-pitch-roll at cartographic (0.0, 0.0) to Earth's fixed frame. - * var center = Cesium.Cartesian3.fromDegrees(0.0, 0.0); - * var hpr = new HeadingPitchRoll(0.0, 0.0, 0.0); - * var hpr.heading = -Cesium.Math.PI_OVER_TWO; - * var hpr.pitch = Cesium.Math.PI_OVER_FOUR; - * var hpr.roll = 0.0; - * var quaternion = Cesium.Transforms.aircraftHeadingPitchRollQuaternion(center, hpr); - * - * - */ - Transforms.aircraftHeadingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, result) { - // checks for required parameters happen in the called functions - var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, scratchENUMatrix4); - var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3); - return Quaternion.fromRotationMatrix(rotation, result); - }; - var gmstConstant0 = 6 * 3600 + 41 * 60 + 50.54841; var gmstConstant1 = 8640184.812866; var gmstConstant2 = 0.093104; @@ -1050,5 +1020,7 @@ define([ return result; }; + Transforms.aircraftHeadingPitchRollQuaternion = Transforms.headingPitchRollQuaternion; + return Transforms; }); From f20b28a73bd0f6a5f52a6810d7e1ce3182c68fd0 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:42:48 -0400 Subject: [PATCH 16/18] Remove aircraftHeadingPitchRollQuaternion. --- CHANGES.md | 1 - Source/Core/Transforms.js | 2 -- Specs/Core/TransformsSpec.js | 42 ------------------------------------ 3 files changed, 45 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0fbd2ef26455..47fcffac5ef1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,7 +24,6 @@ Change Log * Removed an unnecessary reprojection of Web Mercator imagery tiles to the Geographic projection on load. This should improve both visual quality and load performance slightly. * Fix a issue where a billboard entity would not render after toggling the show propery. [#4408](https://github.com/AnalyticalGraphicsInc/cesium/issues/4408) * Added `Transforms.northUpEastToFixedFrame` to compute a 4x4 local transformation matrix from a reference frame with an north-west-up axes. -* Added `Transforms.aircraftHeadingPitchRollQuaternion` which is the quaternion rotation from `Transforms.aircraftHeadingPitchRollToFixedFrame`. * Added `HeadingPitchRoll` : * `HeadingPitchRoll.fromQuaternion` function for retrieving heading-pitch-roll angles from a quaternion. * `HeadingPitchRoll.fromDegrees` function that returns a new HeadingPitchRoll instance from angles given in degrees. diff --git a/Source/Core/Transforms.js b/Source/Core/Transforms.js index 85b178a6c478..8c95db4c8d88 100644 --- a/Source/Core/Transforms.js +++ b/Source/Core/Transforms.js @@ -1020,7 +1020,5 @@ define([ return result; }; - Transforms.aircraftHeadingPitchRollQuaternion = Transforms.headingPitchRollQuaternion; - return Transforms; }); diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index c244bdb32353..5edb8333966c 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -420,36 +420,6 @@ defineSuite([ expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); }); - it('aircraftHeadingPitchRollQuaternion works without a result parameter', function() { - var origin = new Cartesian3(1.0, 0.0, 0.0); - scratchHeadingPitchRoll.heading = CesiumMath.toRadians(20.0); - scratchHeadingPitchRoll.pitch = CesiumMath.toRadians(30.0); - scratchHeadingPitchRoll.roll = CesiumMath.toRadians(40.0); - - var transform = Transforms.headingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); - var expected = Matrix4.getRotation(transform, new Matrix3()); - - var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); - var actual = Matrix3.fromQuaternion(quaternion); - expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); - }); - - it('aircraftHeadingPitchRollQuaternion works with a result parameter', function() { - var origin = new Cartesian3(1.0, 0.0, 0.0); - scratchHeadingPitchRoll.heading = CesiumMath.toRadians(20.0); - scratchHeadingPitchRoll.pitch = CesiumMath.toRadians(30.0); - scratchHeadingPitchRoll.roll = CesiumMath.toRadians(40.0); - - var transform = Transforms.headingPitchRollToFixedFrame(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE); - var expected = Matrix4.getRotation(transform, new Matrix3()); - - var result = new Quaternion(); - var quaternion = Transforms.aircraftHeadingPitchRollQuaternion(origin, scratchHeadingPitchRoll, Ellipsoid.UNIT_SPHERE, result); - var actual = Matrix3.fromQuaternion(quaternion); - expect(quaternion).toBe(result); - expect(actual).toEqualEpsilon(expected, CesiumMath.EPSILON11); - }); - it('computeTemeToPseudoFixedMatrix works before noon', function() { var time = JulianDate.fromDate(new Date('June 29, 2015 12:00:00 UTC')); var t = Transforms.computeTemeToPseudoFixedMatrix(time); @@ -980,18 +950,6 @@ defineSuite([ }).toThrowDeveloperError(); }); - it('aircraftHeadingPitchRollQuaternion throws without an origin', function() { - expect(function() { - Transforms.aircraftHeadingPitchRollQuaternion(undefined, scratchHeadingPitchRoll); - }).toThrowDeveloperError(); - }); - - it('aircraftHeadingPitchRollQuaternion throws without an headingPitchRoll', function() { - expect(function() { - Transforms.aircraftHeadingPitchRollQuaternion(Cartesian3.ZERO, undefined); - }).toThrowDeveloperError(); - }); - it('computeTemeToPseudoFixedMatrix throws without a date', function() { expect(function() { Transforms.computeTemeToPseudoFixedMatrix(undefined); From 72d40d4f8c19d14dc019be5012441fc6ae150fd2 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:45:30 -0400 Subject: [PATCH 17/18] Add change note to CHANGES.md. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 47fcffac5ef1..13cf67be9650 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -30,6 +30,7 @@ Change Log * `HeadingPitchRoll.clone` function to duplicate HeadingPitchRoll instance. * `HeadingPitchRoll.equals` and `HeadingPitchRoll.equalsEpsilon` functions for comparing two instances. * Added `Matrix3.fromHeadingPitchRoll` Computes a 3x3 rotation matrix from the provided headingPitchRoll. +* `Transforms.headingPitchRollToFixedFrame` and `Transforms.headingPitchRollQuaternion` now take a `HeadingPitchRoll` object in addition to separate heading, pitch, and roll values. Separate values will be deprecated in 1.30. ### 1.26 - 2016-10-03 From 33a8b4160c4059d24c172842d716c488e5eb1b63 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Fri, 21 Oct 2016 15:47:42 -0400 Subject: [PATCH 18/18] Remove unused variable. --- Specs/Core/TransformsSpec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Specs/Core/TransformsSpec.js b/Specs/Core/TransformsSpec.js index 5edb8333966c..40221fc9bc1f 100644 --- a/Specs/Core/TransformsSpec.js +++ b/Specs/Core/TransformsSpec.js @@ -46,7 +46,6 @@ defineSuite([ var negativeX = new Cartesian4(-1, 0, 0, 0); var negativeY = new Cartesian4(0, -1, 0, 0); var negativeZ = new Cartesian4(0, 0, -1, 0); - var scratchHeadingPitchRoll = new Quaternion(); it('eastNorthUpToFixedFrame works without a result parameter', function() { var origin = new Cartesian3(1.0, 0.0, 0.0);