Attached is some sample code where I’m trying to calculate a bounding sphere from the extents of the camera view. I first call Camera.computeViewRectangle() and verified the bounds of the resultant rectangle are correct. I then pass the rectangle to BoundingSphere.fromRectangle2D() but get results I wouldn’t expect. To try and verify the result, I create a point at the center of the bounding sphere but the point ends up on the other side of the globe and not in the view of the camera. I would probably expect the center to be slightly inside the Earth but not out in space on the opposite side of the Earth. Anything I’m doing wrong here?
Hi @kteneyck,
I believe you need to use BoundingSphere.fromRectangle3D
rather than BoundingSphere.fromRectangle2D
. The latter was using a different projection, which resulted in the bounding sphere showing up in an unexpected location.
Thanks,
Gabby
Ah perfect! Thanks for the example.