How to get the center of a polyline

Hello!

Is there any formula or method to get the center of the polyline?
Basically I have 2 cartesian3 and I want to get the center of it.

Thanks!

Was able to get what I need through this.

Cesium.Cartesian3.midpoint

Provide an idea:

  1. Calculate their distance and total distance.
  2. Calculate the half of total distance then you will know which cartesain the midpoint is on.
  3. Use Cartesian3.lerp() to get midpoint position.

Using lerp or midpoint I believe will give the incorrect solution. The arcType of the polyline will determine where the center of the line is.

For example, if the arcType is RHUMB, then EllipsoidRhumbLine can be used to determine the center.

An example sandcastle