Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scene.sampleHeight get wrong result when frequently call multi times. #7293

Closed
dminor112 opened this issue Nov 30, 2018 · 3 comments
Closed

Comments

@dminor112
Copy link

dminor112 commented Nov 30, 2018

Browser: electron
I try to get some points,s height on the b3dm model.
My code:

(function(){
    let angleToRadian = function (angle) {
      return angle * Math.PI / 180
    }
    let cartographicPosition = new Cesium.Cartographic()
    // bounds of a rectangle
    let latlng = {
        lng: 114.89866264972603,
        lat: 22.78452730869603
    }
    let latlng1 = {
        lng: 114.89915774594768,
        lat: 22.78440290231223
    }
    let lngOffset = (latlng1.lng - latlng.lng) / 10
    let latOffset = (latlng1.lat - latlng.lat) / 10
    console.log('haha', lngOffset, latOffset)
    // get 100 points of the react
    for(let i = 0; i < 10; i++){
        let lng = latlng.lng + lngOffset * i
        for(let j = 0; j < 10; j++){
            let lat = latlng.lat + latOffset * j
            let flag = lng >= latlng.lng && lng <= latlng1.lng && lat >= latlng1.lat && lat <= latlng.lat
            cartographicPosition.longitude = angleToRadian(lng)
            cartographicPosition.latitude = angleToRadian(lat)
            let t1 = Date.now()
            let h = cesiumManager.cesiumViewer.scene.sampleHeight(cartographicPosition)
            console.log('====>', h, flag, Date.now() - t1, lat, lng, 'i:' + i, 'j:' + j)
        }
    }
})()

got results(only first six got correct height):
image

Then I change the loop j to for(let j = 6; j < 10; j++), got result:
image

No metter how many times I called scene.sampleHeight, only the first six times got result.

@hpinkos
Copy link
Contributor

hpinkos commented Nov 30, 2018

@lilleyse any ideas?

@lilleyse
Copy link
Contributor

@dminor112 this might be a long shot but can you try this branch #7289?

@ggetz
Copy link
Contributor

ggetz commented Jan 27, 2022

Closing this issue due to lack of activity.

@ggetz ggetz closed this as completed Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants