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

How does bounds work in combination with bearing? #1823

Closed
musicformellons opened this issue Dec 10, 2015 · 2 comments
Closed

How does bounds work in combination with bearing? #1823

musicformellons opened this issue Dec 10, 2015 · 2 comments

Comments

@musicformellons
Copy link

I am trying to hack something related to #1740 as I would think that is possible. To do so I need to know the length of the side of the viewbox, X:
nicedrawing

Blue shaded is the mobile viewbox. Alpha is the bearing.

As far as I remember math, X would be equal to (after some nasty equation solution work):
{(Northbound - Southbound) x cosine bearingindegrees - (Eastbound - Westbound) x sine bearingindegrees} / (1 - (sine bearingindegrees)²)

Results are not satisfying, also not after extensive fiddling. So right now my question is:

  • Is my understanding as depicted in the drawing of how the bounds relate to the viewbox when there is a bearing correct?

Don't dare to ask but feel free to check my math.

@musicformellons
Copy link
Author

I think this:
http://wiki.openstreetmap.org/wiki/Bounding_Box

tells me that the concept I use of bounding box is correct, so any idea what I am doing wrong?

@musicformellons
Copy link
Author

Mmmh, calculation must be wrong as X must be undetermined: suddenly realized that although the bearing is a given you can still make different sized viewport rectangles within the bounding box rectangle with different lengths of X. Will close this and continue looking at:
https://www.mapbox.com/mapbox-gl-js/api/#Map.unproject

as that provides maybe a solution for me.

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

No branches or pull requests

1 participant