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

Fixes for Ellipsoid.scaleToGeodeticSurface #407

Merged
merged 3 commits into from Jan 3, 2013
Merged

Conversation

mramato
Copy link
Member

@mramato mramato commented Dec 21, 2012

  1. Handle case where cartesian is at or near the center of the ellipsoid.
  2. For positions at the center, we now return undefined.
  3. For positions near the center, we now return the result instead of getting stuck in an infinite loop.
  4. Fixes Problems programatically switching modes with widgets #338 by handling case 2 during a morph.
  5. Minor cleanup related to above changes.

CC @kring @bagnell

1. Handle case where cartesian is at or near the center of the ellipsoid.
2. For positions at the center, we now return `undefined`.
3. For positions near the center, we now return the result instead of getting stuck in an infinite loop.
4. Fixes #338 by handling case 2 during a morph.
5. Minor cleanup related to above changes.

CC @kring @bagnell
var z2 = positionZ * positionZ;
//* If the position is near the center, the iteration will not converge.
if (squaredNorm < this._centerToleranceSquared) {
return Cartesian3.magnitudeSquared(cartesian) === 0 ? undefined : Cartesian3.clone(intersection, result);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should compare to an epsilon value like CesiumMath.EPSILON20. I was able to get NaNs with

Ellipsoid.WGS84.cartesianToCartographic(new Cartesian3(1.0, 1.0, 1.0).multiplyByScalar(1e-150))

Copy link
Member Author

Choose a reason for hiding this comment

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

This is ported from Components and it computes a value there 0.785398163397448, 0.61864960609024, -6370952.8006335. I'll look more into this.

@mramato
Copy link
Member Author

mramato commented Jan 2, 2013

Ready for another review.

@bagnell
Copy link
Contributor

bagnell commented Jan 3, 2013

This looks good to me. Tests pass.

@kring Want to review and merge?

@kring
Copy link
Member

kring commented Jan 3, 2013

Looks good to me as well. Merging.

kring added a commit that referenced this pull request Jan 3, 2013
…face

Fixes for Ellipsoid.scaleToGeodeticSurface
@kring kring merged commit d5b082c into master Jan 3, 2013
@kring kring deleted the scaleToGeodeticSurface branch January 3, 2013 16:48
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.

Problems programatically switching modes with widgets
3 participants