Plotting a star chart efficiently

我的梦境 提交于 2020-01-06 03:53:11

问题


I'd like to visualize astronomical star catalogues that can contain hundreds of thousands of entries. The catalogues usually consist of simply a list of stars, with spherical coordinates and other data for each star. By spherical coordinates I mean right ascension (0-360 degrees or 0-24 hours) and declination (-90 degrees to +90 degrees). This corresponds to longitude and latitude, just on the celestial sphere instead of Earth's surface.

I'd like to plot all the stars in the catalogue that are located inside a certain field of view, defined by the center (in spherical coordinates) and the size of the field of view (in degrees) and the projection (e.g. stereographic projection).

Plotting the stars by going through the whole catalogue and just checking whether each star is inside the field of view or not is very inefficient.

How could I make this more efficient? Is there a good algorithm or data structure for this kind of a problem?


回答1:


  1. For modern gfx cards numbers like 300K (and more) stars are still manageable...

    So you can try to load them all to gfx as VBO/VAO and leave the render/clipping to gfx alone. I use Hipparcos (118322 stars) in this way without problems while each star is a transparent Quad. You just need to pre-compute the quads to view position prior to rendering (just once). Here screenshot from one of my apps where Hipparcos is used in this manner as background stars (in RT)

    You can also use geometry shaders to ease up things a lot (can send just points or even Ra,Dec,Distance instead of Quads) but this will limit your Target gfx HW to only those supporting geometry shaders.

  2. If you got more stars then your HW can handle then use sorted dataset

    Most catalogs are sorted by Ra or Dec. You can use this by:

    1. select view area min(Ra,Dec),max(Ra,Dec)
    2. let assume your data is sorted by Ra ascending
    3. find first i0 where star[i0].Ra>=min.Ra
      • use binary search !!!
    4. find first i1 where star[i1].Ra>=max.Ra
      • use binary search !!!
    5. process stars i0<=i<i1

    test if min.Dec <= star[i].Dec <= max.Dec and if yes then render it.

  3. If even this is not fast enough you need to use spatial subdivision

    So divide your dataset to smaller ones. And prior to rendering according to selected view area use only datasets near that area. This will lower the amound of data processed significantly.



来源:https://stackoverflow.com/questions/33184329/plotting-a-star-chart-efficiently

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!