Occluder

new Cesium.Occluder (occluderBoundingSphere, cameraPosition)

创建从对象的位置和半径以及相机位置派生的 Occluder。遮挡物可用于确定其他对象是否可见或隐藏在由遮挡物和相机位置定义的可见地平线后面。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的边界球。
cameraPosition Cartesian3 查看器/相机的坐标。
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

相机的位置。
遮挡物的位置。

radius : Number

遮挡物的半径。

Methods

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

计算可用作可见性函数的被遮挡位置的点。使用零半径作为被遮挡半径。通常,用户计算用于可见性的对象周围的边界球;然而,也可以计算一个点,如果看到/未看到也将指示对象是否可见/不可见。对于不相对于遮挡物移动且较大的对象(例如一块地形),最好调用此函数。您最好不要调用它并将对象的边界球用于诸如卫星或地面车辆之类的对象。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的边界球。
occludeePosition Cartesian3 被遮挡物(半径为 0 的边界球)所在的点。
positions Array.< Cartesian3 > 遮挡物表面附近地平线上的高度点列表。
Returns:
一个包含两个属性的对象: occludeePoint valid ,它是一个布尔值。
Throws:
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

计算一个点,该点可用作矩形中可见性函数的遮挡位置。
Name Type Default Description
rectangle Rectangle 用于创建边界球体的矩形。
ellipsoid Ellipsoid Ellipsoid.WGS84 可选 用于确定矩形位置的椭球体。
Returns:
一个包含两个属性的对象: occludeePoint valid ,它是一个布尔值。

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

从边界球体和相机位置创建一个遮挡物。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的边界球。
cameraPosition Cartesian3 查看器/相机的坐标。
result Occluder 可选 存储结果的对象。
Returns:
遮挡物派生自对象的位置和半径,以及相机位置。

computeVisibility (occludeeBS) Visibility

确定被遮挡物的可见程度(不可见、部分可见或完全可见)。
Name Type Description
occludeeBS BoundingSphere 被遮挡物的边界球。
Returns:
如果被遮挡者不可见,则为 Visibility.NONE,如果被遮挡者部分可见,则为 Visibility.PARTIAL,如果被遮挡者完全可见,则为 Visibility.FULL。
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
See:
  • Occluder#isVisible

isBoundingSphereVisible (occludee) Boolean

确定球体(被 occludee )是否被遮挡物隐藏在视野之外。
Name Type Description
occludee BoundingSphere 围绕被遮挡对象的边界球。
Returns:
如果被遮挡物可见,则为 true ;否则 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

确定一个点,被 occludee ,是否被遮挡物隐藏在视野之外。
Name Type Description
occludee Cartesian3 被遮挡对象周围的点。
Returns:
如果被遮挡物可见,则为 true ;否则 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: