EllipsoidalOccluder

EllipsoidalOccluder

new EllipsoidalOccluder

Determine whether or not other objects are visible or hidden behind the visible horizon defined by an Ellipsoid and a camera position. The ellipsoid is assumed to be located at the origin of the coordinate system. This class uses the algorithm described in the Horizon Culling blog post.

Parameters:
Name Type Argument Description
ellipsoid Ellipsoid The ellipsoid to use as an occluder.
cameraPosition Cartesian3 <optional>
The coordinate of the viewer/camera. If this parameter is not specified, EllipsoidalOccluder#setCameraPosition must be called before testing visibility.
Throws:
DeveloperError : ellipsoid is required.
Example
// Construct an ellipsoidal occluder with radii 1.0, 1.1, and 0.9.
var cameraPosition = new Cartesian3(5.0, 6.0, 7.0);
var occluderEllipsoid = new Ellipsoid(1.0, 1.1, 0.9);
var occluder = new EllipsoidalOccluder(occluderEllipsoid, cameraPosition);

Methods

getCameraPosition

Gets the position of the camera.

Returns:
Cartesian3 The position of the camera.

getEllipsoid

Returns the occluding ellipsoid.

Returns:
Ellipsoid The ellipsoid.

isPointVisible

Determines whether or not a point, the occludee, is hidden from view by the occluder.

Parameters:
Name Type Description
occludee Cartesian3 The point to test for visibility.
Returns:
boolean true if the occludee is visible; otherwise false.
Example
var cameraPosition = new Cartesian3(0, 0, 2.5);
var ellipsoid = new Ellipsoid(1.0, 1.1, 0.9);
var occluder = new EllipsoidalOccluder(ellipsoid, cameraPosition);
var point = new Cartesian3(0, -3, -3);
occluder.isPointVisible(point); //returns true

isScaledSpacePointVisible

Determines whether or not a point expressed in the ellipsoid scaled space, is hidden from view by the occluder. To transform a Cartesian X, Y, Z position in the coordinate system aligned with the ellipsoid into the scaled space, call Ellipsoid#transformPositionToScaledSpace.

Parameters:
Name Type Description
occludeeScaledSpacePosition Cartesian3 The point to test for visibility, represented in the scaled space.
Returns:
boolean true if the occludee is visible; otherwise false.
Example
var cameraPosition = new Cartesian3(0, 0, 2.5);
var ellipsoid = new Ellipsoid(1.0, 1.1, 0.9);
var occluder = new EllipsoidalOccluder(ellipsoid, cameraPosition);
var point = new Cartesian3(0, -3, -3);
var scaledSpacePoint = ellipsoid.transformPositionToScaledSpace(point);
occluder.isScaledSpacePointVisible(scaledSpacePoint); //returns true

setCameraPosition

Sets the position of the camera.

Parameters:
Name Type Description
cameraPosition Cartesian3 The new position of the camera.