Location of highest density on a sphere

后端 未结 9 1313
梦毁少年i
梦毁少年i 2020-11-30 12:48

I have a lot of points on the surface of the sphere. How can I calculate the area/spot of the sphere that has the largest point density? I need this to be done very fast. If

9条回答
  •  悲&欢浪女
    2020-11-30 13:28

    There is in fact no real reason to partition the sphere into a regular non-overlapping mesh, try this:

    • partition your sphere into semi-overlapping circles

      see here for generating uniformly distributed points (your circle centers)

      Dispersing n points uniformly on a sphere

    • you can identify the points in each circle very fast by a simple dot product..it really doesn't matter if some points are double counted, the circle with the most points still represents the highest density

    enter image description here

    mathematica implementation

    this takes 12 seconds to analyze 5000 points. (and took about 10 minutes to write )

     testcircles = { RandomReal[ {0, 1}, {3}] // Normalize};
     Do[While[ (test = RandomReal[ {-1, 1}, {3}] // Normalize ;
         Select[testcircles , #.test > .9 & , 1] ) == {} ];
            AppendTo[testcircles, test];, {2000}];
     vmax = testcircles[[First@
        Ordering[-Table[ 
            Count[ (testcircles[[i]].#) & /@ points   , x_ /; x > .98 ] ,
                  {i, Length[testcircles]}], 1]]];
    

    enter image description here

提交回复
热议问题