-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Added Cartographic.fromCartesian #3193
Conversation
This seems kind of like a weird function to add, since you have to specify the ellipsoid anyway (and the ellipsoid is the thing actually doing the conversion. Why not just call |
That's what was happening before. It might be useful as a utility function possibly. It would have been nice to let it use a default ellipsoid, but if I try using |
Yes, the circular dependency is exactly why we don't usually have |
This is the analog of That reminds me, we should also update this example: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Apps/Sandcastle/gallery/Picking.html#L177 To allow the WGS84 default and avoid the dependency, we could duplicate the code or, perhaps better, put it in a |
+1 for either doing this, or putting in a dummy function or documentation ("looking for .fromCartesian? click here") that points to ellipsoid. cartographic <-> cartesian is a super common operation, but getting a carto from a cart isn't very obvious. |
I'm fine with this if we can cleanly factor out a common function (or duplicate a small amount of code) to enable it to default to WGS84 |
@mramato agreed, I'm confident this can be done cleanly. |
I started to look at this more. It looks like there will be a lot of duplicate code because of scaleToGeodeticSurface, which cartesianToCartographic calls. Maybe there's a way to condense it, I'm just not familiar with the math. Factoring into an outside function seems strange just to make this work... Could there be some extra file that contains the |
I'm not completely following this. Why not introduce one new file with a |
Okay I'll do that, I just wasn't sure if What I meant above was have a really simple file called Or you could do the same thing but put the |
Ah, I see now. Interesting, but I think this other approach is more straightforward and avoids potential problems by calling these functions during initialization before that WGS84 variable would be defined. |
This is ready. |
Tweaked the picking example. Looks good. |
…phic-from-cartesian Added Cartographic.fromCartesian
This is also ready for a pull request into master. |
I updated Cities.html to use it. |
For #3177
Added
Cartographic.fromCartesian
to3d-tiles
. Once this is merged I can also open this pull request into master.