How to answer the question "Can the camera see point (X,Y,Z) right now?"

Hi Peter,

Testing if a point is visible to the camera has two parts. First, you need to determine if the point is inside the camera’s view frustum. The easiest way to do that is to use the cullingVolume property of the FrameState that is passed to update functions. The CullingVolume’s getVisibility method takes a bounding volume, so to test a single point you can construct a BoundingSphere with a zero radius:

var cullingVolume = frameState.cullingVolume;
if (cullingVolume.getVisibility(new BoundingSphere(target, 0.0)) === Intersect.INSIDE) {
// target point is inside the culling volume
}

Second, you need to determine whether or not the point is occluded by other objects in the scene. This is tricky in the general case, but if you’re only concerned with occlusion by the ellipsoidal Earth itself - in other words, you want to test if the point is below the horizon - you can use EllipsoidalOccluder and its isPointVisible method. You may not even need to worry about occlusion testing because you’ve already determined that all your points are visible from the camera’s chosen location.

If you want to pan the camera before the point reaches the extreme edges of the camera’s view, you can construct a CullingVolume based on a smaller field-of-view and use the smaller volume in the test above.

I hope this helps,

Kevin