Skip to content

Commit 0ccd97c

Browse files
author
Hannah
authored
Merge pull request #5872 from AnalyticalGraphicsInc/revert
Revert heading, pitch, roll changes
2 parents 9b05ee6 + edbd815 commit 0ccd97c

File tree

15 files changed

+47
-73
lines changed

15 files changed

+47
-73
lines changed

Apps/Sandcastle/gallery/3D Models Coloring.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
viewer.entities.removeAll();
173173

174174
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
175-
var heading = -Cesium.Math.toRadians(135);
175+
var heading = Cesium.Math.toRadians(135);
176176
var pitch = 0;
177177
var roll = 0;
178178
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);

Apps/Sandcastle/gallery/Classification.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
var center = new Cesium.Cartesian3(1216378.730451297, -4736275.917774027, 4081266.871000864);
5858
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
59-
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-2.619728786416368, 0.0, 0.0));
59+
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(2.619728786416368, 0.0, 0.0));
6060
var hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(0.0, 0.0, -2.0));
6161
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
6262

@@ -91,7 +91,7 @@
9191

9292
var center = new Cesium.Cartesian3(1216398.6054139996, -4736204.533089285, 4081338.6585485404);
9393
var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
94-
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-5.785339046755887, 0.0, 0.0));
94+
var hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(5.785339046755887, 0.0, 0.0));
9595
var hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(0.4, 0.0, -2.0));
9696
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
9797

@@ -111,7 +111,7 @@
111111

112112
center = new Cesium.Cartesian3(1216394.3346955755, -4736207.431365568, 4081336.7768881875);
113113
modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);
114-
hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(-5.785339046755887, 0.0, 0.0));
114+
hprRotation = Cesium.Matrix3.fromHeadingPitchRoll(new Cesium.HeadingPitchRoll(5.785339046755887, 0.0, 0.0));
115115
hpr = Cesium.Matrix4.fromRotationTranslation(hprRotation, new Cesium.Cartesian3(-0.25, 0.0, -2.0));
116116
Cesium.Matrix4.multiply(modelMatrix, hpr, modelMatrix);
117117

Apps/Sandcastle/gallery/Distance Display Conditions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
var position = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 0.0);
5656
var heading = Cesium.Math.toRadians(135);
57-
var hpr = new Cesium.HeadingPitchRoll(-heading, 0.0, 0.0);
57+
var hpr = new Cesium.HeadingPitchRoll(heading, 0.0, 0.0);
5858
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
5959

6060
viewer.entities.add({

Apps/Sandcastle/gallery/Projection.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
viewer.projectionPicker.viewModel.switchToOrthographic();
3737

3838
var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, 0.0);
39-
var hpr = new Cesium.HeadingPitchRoll(-Cesium.Math.toRadians(135), 0.0, 0.0);
39+
var hpr = new Cesium.HeadingPitchRoll(Cesium.Math.toRadians(135), 0.0, 0.0);
4040
var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);
4141

4242
var entity = viewer.entities.add({

Apps/Sandcastle/gallery/development/3D Models.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123

124124
function createModel(url, height, heading, pitch, roll) {
125125
height = Cesium.defaultValue(height, 0.0);
126-
heading = -Cesium.defaultValue(heading, 0.0);
127-
pitch = -Cesium.defaultValue(pitch, 0.0);
126+
heading = Cesium.defaultValue(heading, 0.0);
127+
pitch = Cesium.defaultValue(pitch, 0.0);
128128
roll = Cesium.defaultValue(roll, 0.0);
129129
var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
130130

CHANGES.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Change Log
33
### 1.38 - 2017-10-02
44

55
* Breaking changes
6-
* `HeadingPitchRoll.fromQuaternion`, `Matrix3.fromHeadingPitchRoll`, `Quaternion.fromHeadingPitchRoll`, `Transforms.headingPitchRollToFixedFrame`, and `Transforms.headingPitchRollQuaternion` now use the classical orientation of heading and pitch calculated counter-clockwise. With this new behavior, heading and pitch need to be the negative of their previous values. The warning message will be removed in Cesium 1.40.[#5666](https://github.com/AnalyticalGraphicsInc/cesium/issues/5666)
76
* `Scene/CullingVolume` has been removed. Use `Core/CullingVolume`.
87
* `Scene/OrthographicFrustum` has been removed. Use `Core/OrthographicFrustum`.
98
* `Scene/OrthographicOffCenterFrustum` has been removed. Use `Core/OrthographicOffCenterFrustum`.

Source/Core/HeadingPitchRoll.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ define([
22
'./defaultValue',
33
'./defined',
44
'./DeveloperError',
5-
'./Math',
6-
'./deprecationWarning'
5+
'./Math'
76
], function(
87
defaultValue,
98
defined,
109
DeveloperError,
11-
CesiumMath,
12-
deprecationWarning) {
10+
CesiumMath) {
1311
'use strict';
1412

1513
/**
@@ -42,23 +40,17 @@ define([
4240
throw new DeveloperError('quaternion is required');
4341
}
4442
//>>includeEnd('debug');
45-
46-
deprecationWarning('HeadingPitchRoll.fromQuaternion', 'This function now uses a counter-clockwise orientation of heading and pitch as per mathematical conventions. With this new behavior, heading and pitch will need to be the negative of their previous values. This was introduced in 1.38 and the deprecation warning will be removed in Cesium 1.40.');
47-
4843
if (!defined(result)) {
4944
result = new HeadingPitchRoll();
5045
}
51-
5246
var test = 2 * (quaternion.w * quaternion.y - quaternion.z * quaternion.x);
5347
var denominatorRoll = 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y);
5448
var numeratorRoll = 2 * (quaternion.w * quaternion.x + quaternion.y * quaternion.z);
5549
var denominatorHeading = 1 - 2 * (quaternion.y * quaternion.y + quaternion.z * quaternion.z);
5650
var numeratorHeading = 2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y);
57-
58-
result.heading = Math.atan2(numeratorHeading, denominatorHeading);
51+
result.heading = -Math.atan2(numeratorHeading, denominatorHeading);
5952
result.roll = Math.atan2(numeratorRoll, denominatorRoll);
60-
result.pitch = Math.asin(test);
61-
53+
result.pitch = -Math.asin(test);
6254
return result;
6355
};
6456

Source/Core/Matrix3.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ define([
66
'./defineProperties',
77
'./DeveloperError',
88
'./freezeObject',
9-
'./Math',
10-
'./deprecationWarning'
9+
'./Math'
1110
], function(
1211
Cartesian3,
1312
Check,
@@ -16,8 +15,7 @@ define([
1615
defineProperties,
1716
DeveloperError,
1817
freezeObject,
19-
CesiumMath,
20-
deprecationWarning) {
18+
CesiumMath) {
2119
'use strict';
2220

2321
/**
@@ -306,13 +304,11 @@ define([
306304
Check.typeOf.object('headingPitchRoll', headingPitchRoll);
307305
//>>includeEnd('debug');
308306

309-
deprecationWarning('Matrix3.fromHeadingPitchRoll', 'This function now uses a counter-clockwise orientation of heading and pitch as per mathematical conventions. With this new behavior, heading and pitch will need to be the negative of their previous values. This was introduced in 1.38 and the deprecation warning will be removed in Cesium 1.40.');
310-
311-
var cosTheta = Math.cos(headingPitchRoll.pitch);
312-
var cosPsi = Math.cos(headingPitchRoll.heading);
307+
var cosTheta = Math.cos(-headingPitchRoll.pitch);
308+
var cosPsi = Math.cos(-headingPitchRoll.heading);
313309
var cosPhi = Math.cos(headingPitchRoll.roll);
314-
var sinTheta = Math.sin(headingPitchRoll.pitch);
315-
var sinPsi = Math.sin(headingPitchRoll.heading);
310+
var sinTheta = Math.sin(-headingPitchRoll.pitch);
311+
var sinPsi = Math.sin(-headingPitchRoll.heading);
316312
var sinPhi = Math.sin(headingPitchRoll.roll);
317313

318314
var m00 = cosTheta * cosPsi;

Source/Core/Quaternion.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ define([
77
'./freezeObject',
88
'./HeadingPitchRoll',
99
'./Math',
10-
'./Matrix3',
11-
'./deprecationWarning'
10+
'./Matrix3'
1211
], function(
1312
Cartesian3,
1413
Check,
@@ -18,8 +17,7 @@ define([
1817
freezeObject,
1918
HeadingPitchRoll,
2019
CesiumMath,
21-
Matrix3,
22-
deprecationWarning) {
20+
Matrix3) {
2321
'use strict';
2422

2523
/**
@@ -191,13 +189,10 @@ define([
191189
Check.typeOf.object('headingPitchRoll', headingPitchRoll);
192190
//>>includeEnd('debug');
193191

194-
deprecationWarning('Quaternion.fromHeadingPitchRoll', 'This function now uses a counter-clockwise orientation of heading and pitch as per mathematical conventions. With this new behavior, heading and pitch will need to be the negative of their previous values. This was introduced in 1.38 and the deprecation warning will be removed in Cesium 1.40.');
195-
196192
scratchRollQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_X, headingPitchRoll.roll, scratchHPRQuaternion);
197-
scratchPitchQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, headingPitchRoll.pitch, result);
193+
scratchPitchQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Y, -headingPitchRoll.pitch, result);
198194
result = Quaternion.multiply(scratchPitchQuaternion, scratchRollQuaternion, scratchPitchQuaternion);
199-
scratchHeadingQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, headingPitchRoll.heading, scratchHPRQuaternion);
200-
195+
scratchHeadingQuaternion = Quaternion.fromAxisAngle(Cartesian3.UNIT_Z, -headingPitchRoll.heading, scratchHPRQuaternion);
201196
return Quaternion.multiply(scratchHeadingQuaternion, result, result);
202197
};
203198

Source/Core/Transforms.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ define([
1818
'./Matrix3',
1919
'./Matrix4',
2020
'./Quaternion',
21-
'./TimeConstants',
22-
'./deprecationWarning'
21+
'./TimeConstants'
2322
], function(
2423
when,
2524
Cartesian2,
@@ -40,8 +39,7 @@ define([
4039
Matrix3,
4140
Matrix4,
4241
Quaternion,
43-
TimeConstants,
44-
deprecationWarning) {
42+
TimeConstants) {
4543
'use strict';
4644

4745
/**
@@ -336,12 +334,8 @@ define([
336334
Check.typeOf.object( 'HeadingPitchRoll', headingPitchRoll);
337335
//>>includeEnd('debug');
338336

339-
deprecationWarning('Transforms.headingPitchRollToFixedFrame', 'This function now uses a counter-clockwise orientation of heading and pitch as per mathematical conventions. With this new behavior, heading and pitch will need to be the negative of their previous values. This was introduced in 1.38 and the deprecation warning will be removed in Cesium 1.40.');
340-
341337
fixedFrameTransform = defaultValue(fixedFrameTransform, Transforms.eastNorthUpToFixedFrame);
342-
343-
var hprQuaternion = Quaternion.fromHeadingPitchRoll(headingPitchRoll, scratchHPRQuaternion);
344-
338+
var hprQuaternion = Quaternion.fromHeadingPitchRoll(headingPitchRoll, scratchHPRQuaternion);
345339
var hprMatrix = Matrix4.fromTranslationQuaternionRotationScale(Cartesian3.ZERO, hprQuaternion, scratchScale, scratchHPRMatrix4);
346340
result = fixedFrameTransform(origin, ellipsoid, result);
347341
return Matrix4.multiply(result, hprMatrix, result);
@@ -378,11 +372,6 @@ define([
378372
Check.typeOf.object( 'HeadingPitchRoll', headingPitchRoll);
379373
//>>includeEnd('debug');
380374

381-
deprecationWarning('Transforms.headingPitchRollQuaternion', 'This function now uses a counter-clockwise orientation of heading and pitch as per mathematical conventions. With this new behavior, heading and pitch will need to be the negative of their previous values. This was introduced in 1.38 and the deprecation warning will be removed in Cesium 1.40.');
382-
383-
scratchENUMatrix4 = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, scratchENUMatrix4);
384-
Matrix4.getRotation(scratchENUMatrix4, scratchHPRMatrix3);
385-
386375
var transform = Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, scratchENUMatrix4);
387376
var rotation = Matrix4.getRotation(transform, scratchHPRMatrix3);
388377
return Quaternion.fromRotationMatrix(rotation, result);

0 commit comments

Comments
 (0)