How to convert x,y to longitude, latitude in Cesium?

I have got 90 intermediate points between two latitudes and longitudes, i.e., two points.
But how to convert these points to latitudes and longitudes in Cesium?
I have to use those intermediate points for height calculation. So I need those x,y as latitudes and longitudes.

Otherwise, please suggest met another way to find n number of intermediate points between two given points. (latitudes and longitudes)

Here’s some psuedo code that should work

Convert both points to Cartesian, name them to something like from and to.

rotate_vector = Cross(from,to)

angle_total = angleBetween(from,to)

var count=0;while(count<90)

{

angle = count * angle_total/90;

location = rotatePointAroundVector(angle,rotate_vector)

convert location to CartoGraphic

count+=1;

}

After converting to Cartographic you can alter the height if needed, if height is important.

While it’s a private funciton, PolylinePipeline.generateArc may do what you want. Rather than a fixed number of points, it’s granularity is in radians which will produce better results because it adapts to the curvature depending on where you are on the globe. If you’re worried about the fact that it’s a private funciton, you can just copy it into your own code and adapt it to suite your needs.

PolylinePipeline.generateArc uses EllipsoidGeodesic which is more accurate for the oblate ellipsoid reference. The method I wrote is accurate for a sphere, but is just an approximation for the oblate ellipsoid. Though it shouldn’t be all that far off as the Earth isn’t that far off from a sphere (semi-minor axis is about 99.66% the length of the semi-major axis.)