Ellipsoid Geodesic methods

Currently Cesium seems to have only 2 methods

interpolate (absolute or by fraction)
set end points (by constructor or edit existing)

I tried to see if interpolate would also extrapolate (EDIT: it does also extrapolate I found out later)

I used to use formulas found here (which assumes perfect sphere) to travel along great circles using the Google Earth API many years ago

movable-type also has formulas for ellipsoids for greater accuracy

(Cesium seems to lack this extrapolation)
“Given distance, initial bearing, start point”
“Destination point, final bearing”

(Cesium does have this with Geodesic properties)
“Given two points”
“Initial bearing, final bearing, and distance”

All calculations given in JavaScript, under opensource.org/licenses/MIT . GitHub page here github.com/chrisveness/geodesy Of course some transcribing would be required if used in Cesium, such as converting latlon object to cartographic objects.

Geodesic I believe are basically just segments of Great Circles.
(Great Circles being the circle intersection of a plane that cuts the Earth in half)
(they are also ‘straight’ lines along an ellipsoid’s surface)
(the Equator and all longitude lines are Great Circles)

Having a Great Circle module would be nice, or perhaps just make it a part of Geodesic, a full Geodesic where the start and stop points are one in the same (maybe make them the point where the circle crosses the equator going north, not just a segment of a Great Circle.) The higher the inclination of the Great Circle the more of a Great Ellipse it becomes. I wonder if the same holds true for orbits.

some example methods:
-Given 2 points: Identify the Great Circle they both are a part of.
-Given 2 Great Circles: Identify both intersection points
-length (Equator being the longest, longitudes being the shortest)
-Given 1 Great Circle and a latitude: find intersection points (either 2 or 1 or 0)
(equator is both a Great Circle and a latitude, intersecting itself infinitely)
-Given 1 Great Circle: find max latitude (equator 0, longitude circles 90, everything else in between)

I think this sounds like a good idea - I don’t see GitHub discussions on this (here https://github.com/CesiumGS/cesium/issues). I wonder if some of this already exists internally in the engine but isn’t exposed, like as part of creating the geometry of polygons that curve with the surface of the earth:

I think it would be great if you can:

  • Show how this can be currently done in CesiumJS. This will help motivate the discussion on supporting this as part of the public API, if it takes a lot of effort currently or requires external libraries
  • Describe the use cases you see for it. The more common a use case is the more likely the Cesium team will consider a feature for future releases.

Perhaps it is also something that can just be better documented/made as a code example how to do some of these things, like this code example that was recently added: https://sandcastle.cesium.com/?src=Parallels%20and%20Meridians.html

EDIT: I was playing around with this sandcastle
Find the intersection point of a polyline with a circle / sphere
and discovered that interpolate can also extrapolate! So now I guess the next big thing would be determining the 2 intersection points of 2 great circles.

I suppose the main functionality that I don’t see is geodesic extrapolation, just interpolation. I tried using the interpolation method for extrapolation, but it didn’t seem to work, perhaps I didn’t use it correctly. Great Circles simply being geodesics that go all the way around, so just expanding the geodesic library would be nice. I think drawing geometry along the curve of the Earth is in another library, possibly by web workers?

Meridians and the Equator are easy as all points are on the same longitude (latitude for Equator.) However other Great Circles aren’t so easy to calculate, why extrapolation would be useful.

Unlike Rhumblines Great circles are straight lines on a globe (equator and meridians being exceptions, as they are both Rhumblines and Great Circles), representing the shortest path between two points. Very useful for Aircraft and ship navigation. Say a geodesic only went so far, and you wanted to extend it. How would you identify points in the distance to target to extent it?

Wondering where the paths of 2 crafts intersect, Great Circle intersection could assist (then see when they’d arrive at that point.)

EDIT: no need after finding out that interpolate can indeed also extrapolate.
Spherical geocentric math is fairly easy, but ellipsoidal math is a bit tricky. I suppose I could transcribe the extrapolation code I linked to to Cesium, I could then make a Sandcastle example to demonstrate it.

EDIT2: some related recent posts
Finding a point on the surface at a given distance
Move a Cartographic by a distance in meters?

One more thing for you to investigate: if these types of lines are possible to represent in a GeoJSON or KML, it’s possible CesiumJS already has this implemented. You can test it by loading a GeoJSON with that line type, see if it is rendered correctly, and then trace back in the code to see how it’s done.