How to update pointprimitive position efficiently?

I update it like this now, but it doesn’t look ideal.

this.viewer.scene.preRender.addEventListener(() => {

        this.pointPrimitives._pointPrimitives.forEach(point => {

          const time = this.viewer.clock.currentTime

          const position = point.SampledPosition.getValue(time)

          point.position = position

        })

}

At first, I used the sampling position of entity to update the point position, but the performance of loading a large number of entities decreased sharply :disappointed:

I see this update method on this website, But I don’t know how to achieve it
image

Does anyone know how to update in this way

Any idea? I’m in the same situation

I finally used the wasm module to update the position of the point, but it is used to bind the orbit data and calculate the coordinates of the satellite. This module is written in other languages and then compiled into a wasm module that can run in JS :grinning:

Thanks. Where can I find it? Is it public?

I get the code from this website. Just check the resources in F12

any tutorial? I have tried this wasm, but it failed. a little tricky for me. :rofl:

Sgp4propagatorjs is a module for calculating coordinates
Demo

1 Like

That’s amazing! You save me from a lot of annoying things.Thank you very much.

By the way, all i have to do is slice all the positions by the satellite index? I don’t know the last line getValueInReferenceFrame for what.

In addition, I found that wasmModule.propagate may take too much time when many points, what is your solution? now I use registerEntity for every one satellite, any other methods? Thanks.

new Float64Array(wasmModule.HEAP8.buffer, wasmModule.getValueInReferenceFrame(pointer, current_time.getTime(), !0, !1, !1), 3)

This is the offset used to obtain the coordinates of a satellite alone

There are more than 20000 satellites in total. This speed will not be slow

Thanks for your reply. Are you using webpack? I’m using vue cli 5 and there are some problems with the spg.js file importing.Do you have this situation? May it’s caused by this?

I have got this code but it can’t work properly. Can you help me point out the problem?It’s just about six 6000 satellites, but may make browser crashed. So sad.:joy:

this.viewer.scene.preRender.addEventListener((e, t) => {
        const date = Cesium.JulianDate.toDate(t).getTime()
        const offset = this.wasmModule.propagate(date, !0)
        const positions = new Float64Array(this.wasmModule.HEAP8.buffer, offset, 3 * this.allSatellite.size)
        let i = 0
        this.allSatellite.forEach(point => {
          Cesium.Cartesian3.fromArray(positions, 3 * i, satellitePosition)
          point.position = satellitePosition
          i++
        })
})

This is how I update the coordinates. I updated more than 20000 points, and the scene is still very smooth. Is it because you update the frame incorrectly?

What’s wrong with this?

Oh, god, what a silly mistake! I don’t know when did I change this line code but … Thanks for your help. Very helpful for me , really appreciate for that ! :heart_decoration: