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#cameraPosition must be called before testing visibility. |
Example
// Construct an ellipsoidal occluder with radii 1.0, 1.1, and 0.9. var cameraPosition = new Cesium.Cartesian3(5.0, 6.0, 7.0); var occluderEllipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9); var occluder = new Cesium.EllipsoidalOccluder(occluderEllipsoid, cameraPosition);
Source:
Members
-
cameraPosition :Cartesian3
-
Gets or sets the position of the camera.
-
ellipsoid :Ellipsoid
-
Gets the occluding ellipsoid.
Methods
-
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:
booleantrue
if the occludee is visible; otherwisefalse
.Example
var cameraPosition = new Cesium.Cartesian3(0, 0, 2.5); var ellipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9); var occluder = new Cesium.EllipsoidalOccluder(ellipsoid, cameraPosition); var point = new Cesium.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:
booleantrue
if the occludee is visible; otherwisefalse
.Example
var cameraPosition = new Cesium.Cartesian3(0, 0, 2.5); var ellipsoid = new Cesium.Ellipsoid(1.0, 1.1, 0.9); var occluder = new Cesium.EllipsoidalOccluder(ellipsoid, cameraPosition); var point = new Cesium.Cartesian3(0, -3, -3); var scaledSpacePoint = ellipsoid.transformPositionToScaledSpace(point); occluder.isScaledSpacePointVisible(scaledSpacePoint); //returns true
-
<static> prototype.computeHorizonCullingPoint
-
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.
Parameters:
Name Type Argument 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
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:
Cartesian3 The computed horizon culling point, expressed in the ellipsoid-scaled space. -
<static> prototype.computeHorizonCullingPointFromRectangle
-
Computes a point that can be used for horizon culling of an 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.
Parameters:
Name Type Argument 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:
Cartesian3 The computed horizon culling point, expressed in the ellipsoid-scaled space. -
<static> prototype.computeHorizonCullingPointFromVertices
-
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.
Parameters:
Name Type Argument 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
Number[] 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 <optional>
3 center
Cartesian3 <optional>
Cartesian3.ZERO result
Cartesian3 <optional>
The instance on which to store the result instead of allocating a new instance. Returns:
Cartesian3 The computed horizon culling point, expressed in the ellipsoid-scaled space.