-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Tidy up HeadingPitchRoll API #4498
Conversation
…e, as documented.
This PR also addresses #4468. |
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 0.0, 0.0, 0.0
is the default, can you change this throughout to just new HeadingPitchRoll ();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* @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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document as just HeadingPitchRoll
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submit an issue to remove this deprecated feature.
Transforms.headingPitchRollToFixedFrame = function(origin, heading, pitch, roll, ellipsoid, result) { | ||
Transforms.headingPitchRollToFixedFrame = function(origin, hprOrHeading, pitch, roll, ellipsoid, result) { | ||
var heading; | ||
if (typeof hprOrHeading === 'object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename hprOrHeading
to headingPitchRoll
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Thanks @twpayne. Just those comments. |
* @param {Number} pitch The pitch angle in radians. | ||
* @param {Number} roll The roll 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I wasn't clear, let's also remove pitch
and roll
. Also generate the doc to doublecheck that it looks OK; it should be fine since I believe the tool will only look at these comments, not the function signature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Confirmed that the generated documentation is as desired:
Cesium.Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result) → Matrix4
Can you fix the jsHint warnings?
|
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, new HeadingPitchRoll()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all the Sandcastle examples, this should be Cesium.HeadingPitchRoll
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I caught this too :) Done.
Looks good, thanks again @twpayne. |
Thanks! I created #4506 to track the removal in 1.30. |
Hello, I don't understand why did you remove |
As the author of this PR, but not a representative of Cesium, the reasons for the clean-up were:
|
Hello, thanks for your reply.
Thus, there is no big changes. What do you think? |
@kaktus40 your suggestion has potential, but we would have to make a new function and put the 1.27 is on Tuesday so it would be tight to try to make this change by then, but please consider opening a PR when you have time. |
This PR uses the new
HeadingPitchRoll
objects introduced in #4047 more widely in the API. It also removes theaircraftHeadingPitchRoll*
functions introduced in the same PR.@pjcozzi, could you take a quick look at this to check that it's on the right track? If so, similar work needs to be done for
headingPitchRollToQuaternion
andaircraftHeadingPitchRollQuaternion
.