Sort entities based on distance from a center?

1. A concise explanation of the problem you’re experiencing.

Given an entityCollection and a Cartesian3 center,

need to get entities sitting on right / left / top/ bottom of that center, and then the next on the right / left / top / bottom…and so on

Is there a way to traverse the entityCollection based on spatialCoordinate?

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

as #1

4. The Cesium version you’re using, your operating system and browser.


So center is white, X axis red line, Y: green, Z: blue

Given a white sphere as center,

if user clicks “Right button” then it returns first red sphere on the right of Red line

if “Bottom button” then returns first green sphere below white on Green line