Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix plane model matrix #9112

Merged
merged 10 commits into from
Sep 1, 2020
Merged

Fix plane model matrix #9112

merged 10 commits into from
Sep 1, 2020

Conversation

baothientran
Copy link
Contributor

Fixes #8268

Currently the rotation is constructed manually to align the plane with the surface of the ellipsoid. This works correctly if the plane's normal is not aligned with the main axis. Instead of transforming the plane's origin and normal to the world coordinate first, we can orient the plane in the local coordinate using its original normal and origin. Then, we multiply the local transform with the world transform to convert to the world coordinate. Because the world transform already has the rotation matrix that will align the plane with the ellipsoid's surface, this should work with all of the examples as before.

@lilleyse or @hpinkos Can you please take a look at it? Please let me know if it is a right approach

@cesium-concierge
Copy link

Thanks for the pull request @baothientran!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@lilleyse lilleyse requested review from IanLilleyT and removed request for lilleyse and hpinkos August 29, 2020 16:14
@lilleyse
Copy link
Contributor

@IanLilleyT can you review? I think you had the same idea when you wrote up #8268

@lilleyse
Copy link
Contributor

@baothientran can you update CHANGES.md?

@baothientran
Copy link
Contributor Author

CHANGES.md is updated

Copy link
Contributor

@IanLilleyT IanLilleyT left a comment

Choose a reason for hiding this comment

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

Looks good and fixes the problems in this sandcastle

Just one minor change in the comments.

1.0,
CesiumMath.EPSILON8
)
) {
up = Cartesian3.clone(Cartesian3.UNIT_Z, up);
up = Cartesian3.clone(Cartesian3.UNIT_Y, up);
if (
Copy link
Contributor

@IanLilleyT IanLilleyT Aug 31, 2020

Choose a reason for hiding this comment

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

I know this isn't code you added, but I think we can safely delete this section (lines 347 to 355). There's no way the initial up guess is aligned to both the Z and Y axes, so setting to UNIT_X will never happen.

@baothientran
Copy link
Contributor Author

@IanLilleyT I updated to remove the unreachable condition that aligns up with X-axis.

@IanLilleyT IanLilleyT merged commit b41eb35 into master Sep 1, 2020
@IanLilleyT IanLilleyT deleted the plane-model-matrix branch September 1, 2020 20:12
@IanLilleyT
Copy link
Contributor

Thanks @baothientran !

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.

Plane entity not rotating correctly
4 participants