English中文

Occluder

new Cesium.Occluder(occluderBoundingSphere, cameraPosition)

创建根据对象的位置和半径以及相机位置派生的遮挡器。遮挡器可用于确定其他对象是否可见或隐藏在由遮挡器和摄像机位置定义的可见地平线后面。 Creates an Occluder derived from an object's position and radius, as well as the camera position. The occluder can be used to determine whether or not other objects are visible or hidden behind the visible horizon defined by the occluder and camera position.
名称 Name 类型 Type 说明 Description
occluderBoundingSphere BoundingSphere 遮挡器周围的边界球体。 The bounding sphere surrounding the occluder.
cameraPosition Cartesian3 观察者/相机的坐标。 The coordinate of the viewer/camera.
示例: Example:
// Construct an occluder one unit away from the origin with a radius of one.
const cameraPosition = Cesium.Cartesian3.ZERO;
const occluderBoundingSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 1);
const occluder = new Cesium.Occluder(occluderBoundingSphere, cameraPosition);

成员 Members

相机的位置。 The position of the camera.
遮挡器的位置。 The position of the occluder.
遮挡物的半径。 The radius of the occluder.

方法 Methods

static Cesium.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions)object

计算可用作可见性函数的被遮挡位置的点。使用零半径作为被遮挡物半径。通常,用户计算用于可见性的对象周围的边界球体;然而,也可以计算一个点,如果看到/不看到也将指示对象是否可见/不可见。对于不相对于遮挡物移动且较大的对象(例如一大块地形),最好调用此函数。您最好不要调用它并使用对象的边界球体来表示卫星或地面车辆等对象。 Computes a point that can be used as the occludee position to the visibility functions. Use a radius of zero for the occludee radius. Typically, a user computes a bounding sphere around an object that is used for visibility; however it is also possible to compute a point that if seen/not seen would also indicate if an object is visible/not visible. This function is better called for objects that do not move relative to the occluder and is large, such as a chunk of terrain. You are better off not calling this and using the object's bounding sphere for objects such as a satellite or ground vehicle.
名称 Name 类型 Type 说明 Description
occluderBoundingSphere BoundingSphere 遮挡器周围的边界球体。 The bounding sphere surrounding the occluder.
occludeePosition Cartesian3 被遮挡物(半径为 0 的边界球体)所在的点。 The point where the occludee (bounding sphere of radius 0) is located.
positions Array.<Cartesian3> 遮挡物表面附近地平线上的高度点列表。 List of altitude points on the horizon near the surface of the occluder.
返回: Returns:
一个对象包含两个属性: An object containing two attributes: occludeePoint and valid 这是一个布尔值。 which is a boolean value.
抛出: Throws:
  • DeveloperError : positions 必须包含至少一个元素。 must contain at least one element.
  • DeveloperError : occludeePosition 必须具有除 must have a value other than occluderBoundingSphere.center.
示例: Example:
const cameraPosition = new Cesium.Cartesian3(0, 0, 0);
const occluderBoundingSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -8), 2);
const occluder = new Cesium.Occluder(occluderBoundingSphere, cameraPosition);
const positions = [new Cesium.Cartesian3(-0.25, 0, -5.3), new Cesium.Cartesian3(0.25, 0, -5.3)];
const tileOccluderSphere = Cesium.BoundingSphere.fromPoints(positions);
const occludeePosition = tileOccluderSphere.center;
const occludeePt = Cesium.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);

static Cesium.Occluder.computeOccludeePointFromRectangle(rectangle, ellipsoid)object

计算一个点,该点可用作矩形可见性函数的被遮挡位置。 Computes a point that can be used as the occludee position to the visibility functions from a rectangle.
名称 Name 类型 Type 默认值 Default 说明 Description
rectangle Rectangle 用于创建边界球体的矩形。 The rectangle used to create a bounding sphere.
ellipsoid Ellipsoid Ellipsoid.default 可选 optional 用于确定矩形位置的椭球体。 The ellipsoid used to determine positions of the rectangle.
返回: Returns:
一个对象包含两个属性: An object containing two attributes: occludeePoint and valid 这是一个布尔值。 which is a boolean value.

static Cesium.Occluder.fromBoundingSphere(occluderBoundingSphere, cameraPosition, result)Occluder

根据边界球体和相机位置创建遮挡器。 Creates an occluder from a bounding sphere and the camera position.
名称 Name 类型 Type 说明 Description
occluderBoundingSphere BoundingSphere 遮挡器周围的边界球体。 The bounding sphere surrounding the occluder.
cameraPosition Cartesian3 观察者/相机的坐标。 The coordinate of the viewer/camera.
result Occluder 可选 optional 用于存储结果的对象。 The object onto which to store the result.
返回: Returns:
遮挡器源自对象的位置和半径以及相机位置。 The occluder derived from an object's position and radius, as well as the camera position.

computeVisibility(occludeeBS)Visibility

确定被遮挡物的可见程度(不可见、部分可见或完全可见)。 Determine to what extent an occludee is visible (not visible, partially visible, or fully visible).
名称 Name 类型 Type 说明 Description
occludeeBS BoundingSphere 被遮挡者的边界球体。 The bounding sphere of the occludee.
返回: Returns:
如果被遮挡物不可见,则为 Visibility.NONE;如果被遮挡物部分可见,则为 Visibility.PARTIAL;如果被遮挡物完全可见,则为 Visibility.FULL。 Visibility.NONE if the occludee is not visible, Visibility.PARTIAL if the occludee is partially visible, or Visibility.FULL if the occludee is fully visible.
示例: Example:
const sphere1 = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1.5), 0.5);
const sphere2 = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -2.5), 0.5);
const cameraPosition = new Cesium.Cartesian3(0, 0, 0);
const occluder = new Cesium.Occluder(sphere1, cameraPosition);
occluder.computeVisibility(sphere2); //returns Visibility.NONE

isBoundingSphereVisible(occludee)boolean

确定是否为球体, Determines whether or not a sphere, the occludee,被遮挡物隐藏起来。 , is hidden from view by the occluder.
名称 Name 类型 Type 说明 Description
occludee BoundingSphere 被遮挡对象周围的边界球体。 The bounding sphere surrounding the occludee object.
返回: Returns:
true 如果被遮挡者可见;否则 if the occludee is visible; otherwise false.
示例: Example:
const cameraPosition = new Cesium.Cartesian3(0, 0, 0);
const littleSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 0.25);
const occluder = new Cesium.Occluder(littleSphere, cameraPosition);
const bigSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -3), 1);
occluder.isBoundingSphereVisible(bigSphere); //returns true
另见: See:

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 surrounding the occludee object.
返回: Returns:
true 如果被遮挡者可见;否则 if the occludee is visible; otherwise false.
示例: Example:
const cameraPosition = new Cesium.Cartesian3(0, 0, 0);
const littleSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 0.25);
const occluder = new Cesium.Occluder(littleSphere, cameraPosition);
const point = new Cesium.Cartesian3(0, 0, -3);
occluder.isPointVisible(point); //returns true
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.