//获取曲线点集合
getPostion(positions) {
if (!positions || positions.length < 2) {
return [];
}
let resultPoints = [];
let times = [];
let length = this.positions.length;
for (let index = 0; index < positions.length; index++) {
//这里设置点位对应的时间点
//假设最大时间为1,对应终点坐标,那么针对五个坐标点,对应的时间点就是[0,0.25,0.5,0.75,1]
times.push(index * (1 / (length - 1)));
}
//cesium样条插值
let spline = new Cesium.CatmullRomSpline({
times: times,//时间点
points: positions//对应的坐标点
});
for (let i = 0; i <= 10 * length; i++) {
//获取对应时间点下的坐标
let position = spline.evaluate(i / 10 / length);
resultPoints.push(position);
}
return resultPoints ;//这就是最终曲线的position集合
}
03-31
3348
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-08
596
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-10
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交