You can not create such a shape from 4 points generically.
To put it that way: Imagine you had a function like createSemiRing
that returned the result (e.g. as a 2D polygon). What should the parameters of this function be?
If you wanted to pass in four 2D points, like this…
Pseudocode with types here:
Polygon createSemiRing(
Cartesian2 c0,
Cartesian2 c1,
Cartesian2 c2,
Cartesian2 c3) {
....
}
then this function can simply not be implemented generically, because it is not clear what should happen for certain configurations of points. For example, if one of the points that you painted was at a different position…

or the case that the 4 points are the corners of a square (or degenerate cases, like all four points being on one line).
The question is: What are the values that uniquely define such a shape? It could be
- centerX, centerY, minAngle, maxAngle, innerRadius, outerRadius
- leftEdge (2 points), innerRadius, angle
- …
and many others. These are all consisting of 6 real numbers. When you have more than 6 numbers, then this is “too much input”, and the input may be inconsistent. (No mathematical proof here, but … I’m open to argue about that…)
However, as a mix of recreation and procrastination, I just assembled a few lines of code, implementing one possible approach. And you can call the function that is shown here with bogus input, and then it will not work. That’s just the way it is. Limiting the input to 6 real values would prevent that.
The approach is:



The result (i.e. the green lines) will be a 2D polygon of a shape that may be the desired one.
Visualizing that polygon in CesiumJS (by converting it to 3D and putting it somewhere on the globe) looks like this:
And here’s the Sandcastle for that:
(Sorry, no comments…)