EllipsoidalOccluder

new Cesium.EllipsoidalOccluder(ellipsoid, cameraPosition)

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.
Name Type 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#cameraPosition must be called before testing visibility.
Example:
// Construct an ellipsoidal occluder with radii 1.0, 1.1, and 0.9.
const cameraPosition = new Cesium.Cartesian3(5.0, 6.0, 7.0);
const occluderEllipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9);
const occluder = new Cesium.EllipsoidalOccluder(occluderEllipsoid, cameraPosition);

Members

Gets or sets the position of the camera.
Gets the occluding ellipsoid.

Methods

computeHorizonCullingPoint(directionToPoint, positions, result) → Cartesian3

Computes a point that can be used for horizon culling from a list of positions. If the point is below the horizon, all of the positions are guaranteed to be below the horizon as well. The returned point is expressed in the ellipsoid-scaled space and is suitable for use with EllipsoidalOccluder#isScaledSpacePointVisible.
Name Type Description
directionToPoint Cartesian3 The direction that the computed point will lie along. A reasonable direction to use is the direction from the center of the ellipsoid to the center of the bounding sphere computed from the positions. The direction need not be normalized.
positions Array.<Cartesian3> The positions from which to compute the horizon culling point. The positions must be expressed in a reference frame centered at the ellipsoid and aligned with the ellipsoid's axes.
result Cartesian3 optional The instance on which to store the result instead of allocating a new instance.
Returns:
The computed horizon culling point, expressed in the ellipsoid-scaled space.

computeHorizonCullingPointFromRectangle(rectangle, ellipsoid, result) → Cartesian3

Computes a point that can be used for horizon culling of a rectangle. If the point is below the horizon, the ellipsoid-conforming rectangle is guaranteed to be below the horizon as well. The returned point is expressed in the ellipsoid-scaled space and is suitable for use with EllipsoidalOccluder#isScaledSpacePointVisible.
Name Type Description
rectangle Rectangle The rectangle for which to compute the horizon culling point.
ellipsoid Ellipsoid The ellipsoid on which the rectangle is defined. This may be different from the ellipsoid used by this instance for occlusion testing.
result Cartesian3 optional The instance on which to store the result instead of allocating a new instance.
Returns:
The computed horizon culling point, expressed in the ellipsoid-scaled space.

computeHorizonCullingPointFromVertices(directionToPoint, vertices, stride, center, result) → Cartesian3

Computes a point that can be used for horizon culling from a list of positions. If the point is below the horizon, all of the positions are guaranteed to be below the horizon as well. The returned point is expressed in the ellipsoid-scaled space and is suitable for use with EllipsoidalOccluder#isScaledSpacePointVisible.
Name Type Default Description
directionToPoint Cartesian3 The direction that the computed point will lie along. A reasonable direction to use is the direction from the center of the ellipsoid to the center of the bounding sphere computed from the positions. The direction need not be normalized.
vertices Array.<number> | Float32Array | Float64Array The vertices from which to compute the horizon culling point. The positions must be expressed in a reference frame centered at the ellipsoid and aligned with the ellipsoid's axes.
stride number 3 optional
center Cartesian3 Cartesian3.ZERO optional
result Cartesian3 optional The instance on which to store the result instead of allocating a new instance.
Returns:
The computed horizon culling point, expressed in the ellipsoid-scaled space.

computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid(directionToPoint, vertices, stride, center, minimumHeight, result) → Cartesian3

Similar to EllipsoidalOccluder#computeHorizonCullingPointFromVertices except computes the culling point relative to an ellipsoid that has been shrunk by the minimum height when the minimum height is below the ellipsoid. The returned point is expressed in the possibly-shrunk ellipsoid-scaled space and is suitable for use with EllipsoidalOccluder#isScaledSpacePointVisiblePossiblyUnderEllipsoid.
Name Type Default Description
directionToPoint Cartesian3 The direction that the computed point will lie along. A reasonable direction to use is the direction from the center of the ellipsoid to the center of the bounding sphere computed from the positions. The direction need not be normalized.
vertices Array.<number> | Float32Array | Float64Array The vertices from which to compute the horizon culling point. The positions must be expressed in a reference frame centered at the ellipsoid and aligned with the ellipsoid's axes.
stride number 3 optional
center Cartesian3 Cartesian3.ZERO optional
minimumHeight number optional The minimum height of all vertices. If this value is undefined, all vertices are assumed to be above the ellipsoid.
result Cartesian3 optional The instance on which to store the result instead of allocating a new instance.
Returns:
The computed horizon culling point, expressed in the possibly-shrunk ellipsoid-scaled space.

computeHorizonCullingPointPossiblyUnderEllipsoid(directionToPoint, positions, minimumHeight, result) → Cartesian3

Similar to EllipsoidalOccluder#computeHorizonCullingPoint except computes the culling point relative to an ellipsoid that has been shrunk by the minimum height when the minimum height is below the ellipsoid. The returned point is expressed in the possibly-shrunk ellipsoid-scaled space and is suitable for use with EllipsoidalOccluder#isScaledSpacePointVisiblePossiblyUnderEllipsoid.
Name Type Description
directionToPoint Cartesian3 The direction that the computed point will lie along. A reasonable direction to use is the direction from the center of the ellipsoid to the center of the bounding sphere computed from the positions. The direction need not be normalized.
positions Array.<Cartesian3> The positions from which to compute the horizon culling point. The positions must be expressed in a reference frame centered at the ellipsoid and aligned with the ellipsoid's axes.
minimumHeight number optional The minimum height of all positions. If this value is undefined, all positions are assumed to be above the ellipsoid.
result Cartesian3 optional The instance on which to store the result instead of allocating a new instance.
Returns:
The computed horizon culling point, expressed in the possibly-shrunk ellipsoid-scaled space.

isPointVisible(occludee) → boolean

Determines whether or not a point, the occludee, is hidden from view by the occluder.
Name Type Description
occludee Cartesian3 The point to test for visibility.
Returns:
true if the occludee is visible; otherwise false.
Example:
const cameraPosition = new Cesium.Cartesian3(0, 0, 2.5);
const ellipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9);
const occluder = new Cesium.EllipsoidalOccluder(ellipsoid, cameraPosition);
const point = new Cesium.Cartesian3(0, -3, -3);
occluder.isPointVisible(point); //returns true

isScaledSpacePointVisible(occludeeScaledSpacePosition) → boolean

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

isScaledSpacePointVisiblePossiblyUnderEllipsoid(occludeeScaledSpacePosition) → boolean

Similar to EllipsoidalOccluder#isScaledSpacePointVisible except tests against an ellipsoid that has been shrunk by the minimum height when the minimum height is below the ellipsoid. This is intended to be used with points generated by EllipsoidalOccluder#computeHorizonCullingPointPossiblyUnderEllipsoid or EllipsoidalOccluder#computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid.
Name Type Description
occludeeScaledSpacePosition Cartesian3 The point to test for visibility, represented in the scaled space of the possibly-shrunk ellipsoid.
Returns:
true if the occludee is visible; otherwise false.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.