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

make Heading pitch roll counter clock wise again 2 #5809

Closed
wants to merge 14 commits into from

Conversation

kaktus40
Copy link
Contributor

@kaktus40 kaktus40 commented Sep 3, 2017

following this and that

@cesium-concierge
Copy link

@kaktus40, thanks for the pull request! Maintainers, we have a signed CLA from @kaktus40, so you can review this at any time.

I am a bot who helps you make Cesium awesome! Thanks again.

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kaktus40! I have a few comments.

@@ -208,7 +208,7 @@
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.headingPitchRollToFixedFrame(position, hpRoll, Cesium.Ellipsoid.WGS84, fixedFrameTransform, planePrimitive.modelMatrix);
Cesium.Transforms.directHeadingPitchRollToFixedFrame(position, hpRoll, Cesium.Ellipsoid.WGS84, fixedFrameTransform, planePrimitive.modelMatrix);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For directHeadingPitchRollToFixedFrane, do we need to modify the parameters for these two functions at all like you are doing everywhere else you're using the new functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

directHeadingPitchRollToFixedFrame takes the same parameters than headingPitchRollToFixedFrame. Internally, it uses Quaternion.fromDirectHeadingPitchRoll instead of Quaternion.fromHeadingPitchRoll. For now in this PR we have two groups of functions that we shouldn't mix. The first group, that should be deprecated, has the next functions:

  • HeadingPitchRoll.fromQuaternion,
  • Matrix3.fromHeadingPitchRoll,
  • Quaternion.fromHeadingPitchRoll,
  • Transforms.HeadingPitchRollToFixedFrame.

The newcomer group, that should replace the first group, has the next functions:

  • HeadingPitchRoll.fromDirectQuaternion,
  • Matrix3.fromDirectHeadingPitchRoll,
  • Quaternion.fromDirectHeadingPitchRoll,
  • Transforms.directHeadingPitchRollToFixedFrame.

A function in the first group and its equivalent in the second group takes the same parameters in the same orders and return the same type of result (HeadingPitchRoll, Matrix3, Quaternion or Matrix4 instances respectively). The only difference is the sense of rotation for heading and pitch used internally.

Normally, I checked in my IDE that each instance of the first group functions and if needed, I changed for the equivalent in the second group. Also I didn't replace the functions when the parameters where heading=0, pitch=0 because there will be no change in their behaviour.

throw new DeveloperError('quaternion is required');
}
//>>includeEnd('debug');
deprecationWarning('HeadingPitchRoll.fromDirectQuaternion', 'This HeadingPitchRoll.fromDirectQuaternion works in the classical interpretation used in mathematics. This function will replaced HeadingPitchRoll.fromQuaternion in 1.43.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't include the deprecation warning in the new functions. Instead include this additional information about how it's been calculated in the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just updated following your recommandations

@ggetz
Copy link
Contributor

ggetz commented Sep 7, 2017

Alright, thanks @kaktus40! This looks good to me.

Make sure before we merge this you submit issues to remove the depreciated function in future versions as we specify in the Coding Guide in the Deprecation section

@pjcozzi Does this look good to merge?

CHANGES.md Outdated
* Breaking changes

* Deprecated
* `HeadingPitchRoll.fromDirectQuaternion` is deprecated and his behaviour will replace `HeadingPitchRoll.fromQuaternion` behaviour in 1.43. [#5666](https://github.com/AnalyticalGraphicsInc/cesium/issues/5666)
Copy link
Contributor

@hpinkos hpinkos Sep 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to deprecate this 6 months out? We normally do 1-3 releases. I think 3 releases would be appropriate for this case unless someone said otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, who decides?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaktus40 usually the developer and whoever reviews decides.

I agree with @hpinkos that 3 releases would be fine. Please submit a GitHub issue for the deprecation.

For more on deprecation, see https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/CodingGuide#deprecation-and-breaking-changes

@@ -179,6 +181,7 @@ define([
* Computes a rotation from the given heading, pitch and roll angles. Heading is the rotation about the
* negative z axis. Pitch is the rotation about the negative y axis. Roll is the rotation about
* the positive x axis.
* @deprecated since V1.38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the "since V1.38" show up in the doc? We usually just put @deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it shows up in the doc. I found this syntax here

it('conversion from direct quaternion', function() {
var testingTab = [
[0, 0, 0],
[90 * deg2rad, 0, 0],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this file was already like this, but why not use the conversion functions in Cesium.Math?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the old PR, I used this variable, which is also a shortcut to CesiumMath.RADIANS_PER_DEGREE, for its concision.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 8, 2017

It's a shame that we have to deprecate the most natural name for these functions, what is the meaning of "direct?" Is that the best possible name? Are there any other options that would preserve the current name, e.g., with the addition of a parameter?

@kaktus40
Copy link
Contributor Author

kaktus40 commented Sep 8, 2017

Well for the name of direct, it's a hint about direct orthonormed repere. I didn't find an elegant solution to maintain the current name because after deprecation, the additional parameter will be removed. For the user who decide to update his code, he'll need to change a second time.
That was my initial idea to add a parameter also if you prefer this solution, I can make it.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 8, 2017

direct orthonormed repere

Sorry I'm dense here, but what does this mean? "direct orthonormal representation?"

Can you point me to a use of this term with "direct" in some literature?

@kaktus40
Copy link
Contributor Author

kaktus40 commented Sep 8, 2017 via email

@kaktus40
Copy link
Contributor Author

kaktus40 commented Sep 10, 2017 via email

@ggetz
Copy link
Contributor

ggetz commented Sep 11, 2017

Thanks @kaktus40. I think adding and optional boolean parameter might keep the naming more clear.

Could you also make your updates to CHANGES.md shorter with maybe one or two bullet points describing the changes?

@kaktus40
Copy link
Contributor Author

I'll need some suggestions to sum up my writings in the CHANGES.md.

@ggetz
Copy link
Contributor

ggetz commented Sep 11, 2017

If we're going with passing the parameter, I think this will be enough:

The default behavior of the functions HeadingPitchRoll.fromQuaternion, Matrix3.fromHeadingPitchRoll, Quaternion.fromHeadingPitchRoll, Transforms.headingPitchRollToFixedFrame, and Transforms.headingPitchRollQuaternion has been deprecated. An optional boolean flag can be supplied to these functions that, if true, uses the classical orientation of heading and pitch calculated counter-clockwise. The flag will be removed and the new behavior made default in 1.40.
#5666

@kaktus40
Copy link
Contributor Author

That's good for me. So @pjcozzi is it ok to add a boolean parameter or an other solution?

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 11, 2017

@kaktus40 thanks for the updates. I'll take a quick look this week.

@kaktus40
Copy link
Contributor Author

I push the update where I add a boolean parameter into original functions.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 15, 2017

@kaktus40 thanks again for the updates!

Given all the undefined arguments this can require adding, and then a user's code needs to be changed again later, I suggest we break the standard deprecation policy, and just make the breaking change right away. To lessen the impact, we could also put a deprecationWarning in the changed functions for one or two releases that explains the breaking change and how to update.

Let's sit on this idea for a few days to see if anyone has any objections.

@kaktus40
Copy link
Contributor Author

Hello, so what should I do?

@ggetz
Copy link
Contributor

ggetz commented Sep 22, 2017

@kaktus40 I think @pjcozzi 's plan here to remove the if(classical === true) blocks entirely and just break the functions now, including the developer warnings of course, so people can update to the new correct functions immediately.

Thanks for your patience, these changes will have a pretty big impact, so we want to make sure we taking the best path forward!

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 22, 2017

Given no objections to #5809 (comment), I think it is OK to make this change now.

@kaktus40 do you want to do it or do you want one of the maintainers to do it?

@kaktus40
Copy link
Contributor Author

kaktus40 commented Sep 22, 2017 via email

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 26, 2017

@ggetz do you have time to do this before the next release?

@ggetz
Copy link
Contributor

ggetz commented Sep 27, 2017

@pjcozzi Updated in #5848

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 28, 2017

Thanks @kaktus40 @ggetz! Will close this and merge #5848.

@pjcozzi pjcozzi closed this Sep 28, 2017
@kaktus40 kaktus40 deleted the CorrectHPRtoQuaternion branch October 2, 2017 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants