cesium线切割为多个贴地形贴模型的点

发布时间 2023-11-17 18:04:57作者: 一起天天向上
interpolation(pos1, pos2) { 
            let po1 = pos1
            let po2 = pos2
            this.getPositionwkt(po1, po2).then((res) => {
                this.$config.viewer.scene.clampToHeightMostDetailed(res).then((clampedCartesians) => {//异步获取当前位置的3d对象
                    showPath = showPath.concat(clampedCartesians)
                    // pathIndex++
                    maxIndex = showPath.length
                    // linePath = clampedCartesians;
                })
            })
        },
        getPositionwkt(startP, endP) {//等分线,返回点的数组
            return new Promise(resolve => {
                var count = 30;
                var cartesians = new Array(count);
                for (var i = 0; i < count; ++i) {
                    var offset = i / (count - 1);
                    cartesians[i] = Cesium.Cartesian3.lerp(
                        startP,
                        endP,
                        offset,
                        new Cesium.Cartesian3()
                    );
                }
                resolve(cartesians);
            })
        },