上次我们绘制了一条可以流动的线,但是现在想让他拥有弧度;
首先我们需要知道线的起点和终点然后计算出弯曲的弧度:
// 线的起点和终点
const startPoint = Cesium.Cartesian3.fromDegrees(117.025419, 32.00651, 51.2)
const endPoint = Cesium.Cartesian3.fromDegrees(117.323963, 32.050384, 33.8)
// 通过起点和终点计算曲线点 20000-弯曲值 50-点集数量(转折点的数量)
const positions = mars3d.PolyUtil.getLinkedPointList(startPoint, endPoint, 20000, 50)
接下来绘制一条线,将线的位置换成上面计算过的位置即可
const graphic = new mars3d.graphic.PolylineEntity({
positions: positions,
style: {
width: 8,
color:"red"
}
})
map.graphicLayer.addGraphic(graphic)