English 中文(简体)
Determining visible area from globe frustum
原标题:

I m working with a mapping application (worldwind) and trying to determine the minimum and maximum latitudes and longitudes that are currently displayed. I have access to the frustum, but I m not sure how to account for the fact that the globe can have its heading and/or pitch changed. Any help on this problem would be appreciated.

thanks,

Jeff

最佳回答

Actually the Frustum isn t the most useful thing in this context. What you need to do is reverse the ModelView-Project transform.

If you can retrieve your projection (frustum) and model-view matrices, then you can invert them. If you project a ray from your camera position along projection space, then you can use those inversions to find that ray in world space. From there, you can intersect that ray with your world to find the exact point where that ray hits the globe.

Do this for the four corners of the screen and then calculate your 2D bounding box based upon those intersection coordinates.

问题回答

What exactly are you trying to calculate ? Corner points of your window or that of your globe. Remember a circle does not have corners (nor does a sphere). Have you seen the minimap tool in worldwind (WorldMapLayer) . It shows the currently visible extent as an overlay in the minimap, this can give you an idea to work out what exactly is being displayed.

Good to see worldwind questions flowing everywhere. We mustn t be doing a good enough job at the forums.

The corner cases (1) of my previous proposal are making the algorithm difficult for you (I ve never had to zoom out from the globe and still don t understand why you still don t just use the hemisphere in that case), so here is another method that can work.

Take your projection frustum as a 3D object and intersect it with the globe (as a 3D object). There are a variety CSG algorithms that can give you union, intersection, and difference. Use intersection. This will result in a 3D mesh of the pieces of the globe that intersect with the frustum. The extents of that mesh are the extents of the bounding box. (Project along the major axis of the frustum.)

This is horribly less efficient than my previous proposal. :-)

(1) Pun completely intended.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签