CesiumGS / CesiumGS/cesium

Entity's bounding sphere is incorrect (occasionally)

Open
#9,690 1 comment 0 reactions 0 assignees View on GitHub
category - entity type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

I use the `viewer.dataSourceDisplay.getBoundingSphere()` method to calculate the bounding sphere, and then use the `viewer.camera.viewBoundingSphere()` method to track the `Entity`, and use a red `Box` to indicate the size of the Entity's bounding sphere.

`getBoundingSphere()` is very unstable. Sometimes the calculation results are correct and sometimes incorrect. Why does this happen?

The [sandcastle example](https://sandcastle.cesium.com/#c=rVZtb9o6FP4rFvcDqYQcoNAWRqsV6N0msVG17O7DqDqTHII1J45sh0In/vtOApQ4gTtd6fIBxT4vPuc55zw2IenPk5E2ZMnhBRS5JhG8kAFonoT0n2zPqXrZciAjw3gEqlojv6YR2f1YxENmuIy6ZM6EhtpBNGMaRmwN6p57P0GVFeaJENpTAFE/MeaYiwCkJ/1jtgsZwikrHs1lX67KAsNDEJhDWRKxJQ+yPD6CiE85NqAUYnCv5JJnUe2QwhyYgW9SCX+yVXHO9labs3fTaL/Ygu29hmLIDHuUifLABn1gyZy88bZG1H+TaqoglEu4FSJTPKnGfN85ZGEfT4VkvvP9ICb58mZw+l1S9aWXhBCZas0WLkHprPrVBq1X87LNYfH0hsYhzEIUsZIYqXZyZ2fnekzlj4yl5ttus4JELYP4Mdz/3mrUG602PW+etxqtZrPdqZF2u9msX13QK1zjV+eyRs4bFxeXnQ5uNeqXF+3OeevJymwu1QtT/t3KKBZLkbXGZB1j61Q/jkfDXKabnJ1gMxCF2OZciIEUUnWLwKpgxjDgeo002+3D35OFYiGqyKRQX8UrMko87jOCc6mlALsuC6n4azqwYqx4wNPyDO6+TO4ebDUsnuHeH5QWwIOFeYA5KIi8FIDB6Pbz/fNk/PzhYfz1y9BWj/kKxHg+12BKCb+VqblLu/4vuWqzFulpf38ajewjDKxSFG65OlGGEDmjWIZAmDkaLYyJddd1NYt8j2kjgHq7IZah+8jCWEDalm7mQ7vbscSjdl/P+EkDMfuvGOUCPcoMCNcE2UkmxnHOyPVNPvgta+DwcbNGtihMTrbPccoDMP31J9/JZibve+9hJpPI51HwGC8wTpt3+pbMsc1LlDLkOhZsnR1pG+ZR2UZsN3CBUUkhqIOknAB2OZJV4FRtE7yP7I2C5R95Zsc0M7kqdPJxrsG5PdT5B2L9117xx+lmnqXXUcGNj/WOUvLUJZHNaEVZETSqmM8TXfuf9YpqT/bGpuAn5bnukQITgk29vXWNSk7IvnHfLLqkeVx6nD73BLq/OVMl+nA3pEb21wje4Q4uXUjWYnO02T0WgmI0XRVavNxte0BIu16vn72r1Cq9jL1u9qL3PIylMiRRwqHUNYA0gy8G7c4SfBoZ6mm999Nz86Y9ny+xPa+nlcIrbFohnmBaoyR9Rj3yV5hWbnou6pdM0xse4x0j3ePQpmqLxs1ou0kp7bm4PG5ppBQzpgqefwM) may not be able to reproduce this problem, because this problem occurs occasionally.

There are 2 screenshots below, Figure 1 is correct, and Figure 2 is incorrect.

Figure 1:
![correct](https://user-images.githubusercontent.com/43558998/126459209-70fd1d7a-3120-4759-a9b5-e360c754cc02.png)

Figure 2:
![incorrect](https://user-images.githubusercontent.com/43558998/126459215-f7d31d07-eb86-4643-b299-64e7a9a168a4.png)

Sandcastle example: https://sandcastle.cesium.com/#c=rVZtb9o6FP4rFvcDqYQcoNAWRqsV6N0msVG17O7DqDqTHII1J45sh0In/vtOApQ4gTtd6fIBxT4vPuc55zw2IenPk5E2ZMnhBRS5JhG8kAFonoT0n2zPqXrZciAjw3gEqlojv6YR2f1YxENmuIy6ZM6EhtpBNGMaRmwN6p57P0GVFeaJENpTAFE/MeaYiwCkJ/1jtgsZwikrHs1lX67KAsNDEJhDWRKxJQ+yPD6CiE85NqAUYnCv5JJnUe2QwhyYgW9SCX+yVXHO9labs3fTaL/Ygu29hmLIDHuUifLABn1gyZy88bZG1H+TaqoglEu4FSJTPKnGfN85ZGEfT4VkvvP9ICb58mZw+l1S9aWXhBCZas0WLkHprPrVBq1X87LNYfH0hsYhzEIUsZIYqXZyZ2fnekzlj4yl5ttus4JELYP4Mdz/3mrUG602PW+etxqtZrPdqZF2u9msX13QK1zjV+eyRs4bFxeXnQ5uNeqXF+3OeevJymwu1QtT/t3KKBZLkbXGZB1j61Q/jkfDXKabnJ1gMxCF2OZciIEUUnWLwKpgxjDgeo002+3D35OFYiGqyKRQX8UrMko87jOCc6mlALsuC6n4azqwYqx4wNPyDO6+TO4ebDUsnuHeH5QWwIOFeYA5KIi8FIDB6Pbz/fNk/PzhYfz1y9BWj/kKxHg+12BKCb+VqblLu/4vuWqzFulpf38ajewjDKxSFG65OlGGEDmjWIZAmDkaLYyJddd1NYt8j2kjgHq7IZah+8jCWEDalm7mQ7vbscSjdl/P+EkDMfuvGOUCPcoMCNcE2UkmxnHOyPVNPvgta+DwcbNGtihMTrbPccoDMP31J9/JZibve+9hJpPI51HwGC8wTpt3+pbMsc1LlDLkOhZsnR1pG+ZR2UZsN3CBUUkhqIOknAB2OZJV4FRtE7yP7I2C5R95Zsc0M7kqdPJxrsG5PdT5B2L9117xx+lmnqXXUcGNj/WOUvLUJZHNaEVZETSqmM8TXfuf9YpqT/bGpuAn5bnukQITgk29vXWNSk7IvnHfLLqkeVx6nD73BLq/OVMl+nA3pEb21wje4Q4uXUjWYnO02T0WgmI0XRVavNxte0BIu16vn72r1Cq9jL1u9qL3PIylMiRRwqHUNYA0gy8G7c4SfBoZ6mm999Nz86Y9ny+xPa+nlcIrbFohnmBaoyR9Rj3yV5hWbnou6pdM0xse4x0j3ePQpmqLxs1ou0kp7bm4PG5ppBQzpgqefwM

Browser: Google Chrome 91.0.4472.164

Operating System: windows10

Contributor guide

Open the contributing guide

Research direction

Start with the linked Sandcastle example and reproduce the intermittent behavior around viewer.dataSourceDisplay.getBoundingSphere() and viewer.camera.viewBoundingSphere(). Compare the correct and incorrect results shown in the screenshots, then trace the Entity bounding-sphere calculation to determine why the returned sphere varies; done means the sphere is consistently correct for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.