-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Cartographic cleanup. #109
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
Conversation
1. Cartographic3 now has static versions of it's prototype methods. 2. Cartographic3 methods now work on object literals that expose longitude/latitude/height properties. 3. Cartographic3 now has proper error handling and full test coverage.
1. Remove all usage of creating Cartographic instances using degrees as internal representation, Cartographics are always represented as radians. 2. Add fromDegrees helper function to aid in creating Cartographics from degrees. 3. Reaname toCartesian(s) and toCartographic(s) methods to cartesianToCartographic/cartesianArrayToCartographicArray and cartographicToCartesian and cartographicArrayToCartesianArray respectively. 4. Fix comment in Quaternion.fromAxisAngle to specify the correct unit.
…n code with new helper function.
This all looks good to me. Given the major API changes, I think @pjcozzi should look at it too. |
Awesome - less is more. |
Source/Core/Cartographic.js
Outdated
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.
Perhaps say "longitude, latitude, and height" since that is the order in the constructor.
@mramato Just that one comment and this is ready to go. |
Thanks @pjcozzi, all done. |
Fixed crash when computing sensor horizon crossings.
Unlike the recent Cartesian cleanup, Cartographic cleanup was a little more all over the place. The biggest aspect of this change is making sure we no longer construct Cartographic instances that store their internal values as degrees. Instead we always require Cartographic instances to be expressed in radians. This will clean-up the API and make using Cartographics much less error-proned. Obviously users like degrees, so we make it easy to create Cartographics from degrees, we just don't store them that way. There's still plenty of cleanup to be done on other core types that use Cartographic, like Ellipsoid, but that will be done in another pull request. This once concentrates on just Cartographic itself. That being said, I did rename some Ellipsoid methods because they were very unclear.
Cartographic3
has been renamed toCartographic
.Cartographic2
use been removed as it is redundant, usCartographic
with height 0.0 instead.Cartographic
now has static versions of all prototype methods and can now perform operations with object literals as long as they havelongitude
,latitude
, andheight properties
.Cartographic.fromDegrees
to make it easier to create Cartographic instances from values in degrees. This simple converts the components to radians before calling the constructor.Cartographic
and brought test coverage up to 100%.Ellipsoid.toCartesian
was renamed toEllipsoid.cartographicToCartesian
Ellipsoid.toCartesians
was renamed toEllipsoid.cartographicArrayToCartesianArray
Ellipsoid.toCartographic2
was renamed toEllipsoid.cartesianToCartographic
Ellipsoid.toCartographic2s
was renamed toEllipsoid.cartesianArrayToCartographicArray
Ellipsoid.toCartographic3
was renamed toEllipsoid.cartesianToCartographic
Ellipsoid.toCartographic3s
was renamed toEllipsoid.cartesianArrayToCartographicArray
Ellipsoid.cartographicDegreesToCartesian
,Math.cartographic3ToRadians
,Math.cartographic2ToRadians
,Math.cartographic2ToDegrees
, andMath.cartographic3ToDegrees
were removed. These functions are no longer needed because Cartographic instances are always represented in radians.CustomSensorVolume
with calls toCartesian3.fromSpherical
.EDIT: Forgot to mention that these changes are related to issues #71, #84, #86 (those issues will remain open until we address them for every Core type).