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

Flyto options #5070

Merged
merged 12 commits into from
Mar 13, 2017
Merged

Flyto options #5070

merged 12 commits into from
Mar 13, 2017

Conversation

kiselev-dv
Copy link
Contributor

Forum discussion http://cesiumjs.org/forum.html#!topic/cesium-dev/naHiF2_0F5M/discussion

I've added 2 new mechanics to camera flyto.

First one is pitchAdjusAltitude

When you fly for a big distance and with high altitude and start pitch and end pitch are quite close to zero, Earth goes out of sight.
That happens because pitch interpolated linear between start and end points, and with high altitude camera looks straight and Earth goes out of viewport.

What I want, is to point camera down during the high altitude flights.
So camera pitch interpolates following way:

(startPitch) ----- ( straight down ) ----- (endPitch)

Pitch interpolated accordingly to camera altitude distance between start/end altitude and middle point.

But for small altitude I wan to leave default behavior. I've implemented flyTo options parameter pitchAdjusAltitude. If camera goes higher than this altitude, camera pitch interpolated as mentioned above.

If this option is omitted, or camera goes lower, pitch interpolated as it was.

Second item is flyOverLon and flyOverLonWeight options.

Lets say you want to fly camera from Los Angeles to Tokyo. There are two ways on globe to do that:

a) over Pacific ocean (shortest path which is used now)
b) over Atlantic and Europe - which some times may be preferable, because it's populated and the rest of your data might be located there.

So to be able to specify which way you want camera to fly, you can add flyOverLon. For example above you can set it to 0 (Greenwich meridian).

flyOverLonWeight sets treshold for this option, camera will fly over flyOverLon only if this way is shorten than default way * flyOverLonWeight. In a nut shell we'll fly over flyOverLon until it's not too far away.

flyOverLon - longitude which we want camerra to cross duiring the flight
flyOverLonweight - Fly over the lon specifyed via flyOverLon only if that way is not longer than short way times flyOverLonWeight.
This flyto option allows to point camera down duiring the flight
if camera flyes higher than pitchAdjusAltitude

That helps to keep Earth in sight duiring the long flights.
@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 8, 2017

Cool, thanks for this, @kiselev-dv!

@bagnell can you please review this once you wrap up #5021?

@kiselev-dv a few quick comments:

  • Can you please remove the example app, and instead update the Camera Sandcastle example? Sandcastle is where we keep all the code examples.
  • Update CHANGES.md with a concise description of the new features.
  • Avoid using abbreviations when naming public identifiers, e.g., flyOverLon would be something like flyOverLongitude. Also use "height", e.g., pitchAdjustAltitude would be pitchAdjustHeight. See the Coding Guide for more info.
  • Add unit tests.

For more general info on contributing, see the Pull Request Guidelines.

@kiselev-dv
Copy link
Contributor Author

@pjcozzi what would be better to use for flyOverLongitude radians or degrees?

Now I'm using radians because angular properties in Cesium is used to be in radians, but I always forget that it's in radians, so I'm afraid others will be confused as well.

So what will be more Cesiumish?

  • use flyOverLongitudeRadians parameter name
  • set flyOverLongitude in degrees and convert to radians
  • set flyOverLongitude in radians (leave it as it is)

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 10, 2017

Use the last option:

set flyOverLongitude in radians (leave it as it is)

Everything in Cesium is radians; see the Units Section of the Coding Guide.

@kiselev-dv
Copy link
Contributor Author

  • Fix options naming
  • Update CHANGES.md
  • Unit tests
  • Sandcastle demo

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 12, 2017

Great, thanks so much @kiselev-dv! @bagnell please review when you're available.

@bagnell
Copy link
Contributor

bagnell commented Mar 13, 2017

@kiselev-dv I made some minor code style tweaks in 29f351b. This looks great! Thanks!

@bagnell bagnell merged commit 33f3c6f into CesiumGS:master Mar 13, 2017
@bagnell
Copy link
Contributor

bagnell commented Mar 13, 2017

Also, can you add yourself to CONTRIBUTORS.md if you aren't already listed.

@kiselev-dv
Copy link
Contributor Author

#5102

Sorry for separate PR just for Contributors.

fredj added a commit to fredj/ol-cesium that referenced this pull request Apr 4, 2017
fredj added a commit to openlayers/ol-cesium that referenced this pull request Apr 4, 2017
Add new options to `Camera.flyTo`:
  CesiumGS/cesium#5070
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.

3 participants