Cesium解决传感器抖动问题

Cesium解决传感器抖动问题

解决问题原理:在基本步长的基础上,为每一段轨道再进行细化(使用拉格朗日插值算法进行计算差值)

// 传入轨道数据,传出positionProperty对象、开始时间、结束时间
import * as Cesium from 'cesium'
import store from '@/store/index'

export default function handleOrbitalMsg(satelliteOrbit: any) {
    const positionProperty = new Cesium.SampledPositionProperty();
    const propertyArr: Array<string> = [];// 存储所有时间,取头尾,计算startTime  stopTime

    for(const i of satelliteOrbit) {
        propertyArr.push(i.time);
        const time = Cesium.JulianDate.fromIso8601(i.time);
        const position = Cesium.Cartesian3.fromDegrees(i.lon, i.lat, i.alt);
        positionProperty.addSample(time, position);
    }

    // 计算差值,解决传感器抖动问题(设置插入位置时要使用的算法和度数)
    positionProperty.setInterpolationOptions({
        interpolationDegree: 5, // 新的差值度
        interpolationAlgorithm: // 新的插值算法
            Cesium.LagrangePolynomialApproximation, // 拉格朗日差值算法
    });

    const start = Cesium.JulianDate.fromIso8601(propertyArr[0]);
    const stop = Cesium.JulianDate.fromIso8601(propertyArr[propertyArr.length - 1]);

    store.commit('setTimelineStart', propertyArr[0]);
    store.commit('setTimelineStop', propertyArr[propertyArr.length - 1]);

    // 计算start  stop的时间差
    const timeDifference = Cesium.JulianDate.secondsDifference(stop, start);
    store.commit('setTimeDifference', timeDifference);

    return {
        positionProperty,
        start,
        stop
    }
}
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值