Occluder

new Cesium.Occluder(occluderBoundingSphere, cameraPosition)

创建从对象的位置和半径以及摄影机位置派生的阻挡器。 遮挡器可用于确定其他对象是否可见或隐藏在 由遮光器和相机位置定义的可见地平线。
Name Type Description
occluderBoundingSphere BoundingSphere 封堵器周围的边界球体。
cameraPosition Cartesian3 观察者/摄像机的坐标。
Example:
// Construct an occluder one unit away from the origin with a radius of one.
var cameraPosition = Cesium.Cartesian3.ZERO;
var occluderBoundingSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 1);
var occluder = new Cesium.Occluder(occluderBoundingSphere, cameraPosition);

Members

cameraPosition : Cartesian3

摄像机的位置。
封堵器的位置。

radius : Number

封堵器的半径。

Methods

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

计算一个点,该点可用作可见性函数的遮挡位置。 使用零半径作为occludedee半径。通常,用户计算周围的边界球体 用于可见性的对象;但是也可以计算一个点,如果 seen/not-seen还表示对象是否可见/不可见。这个功能比较好 为不相对于阻挡器移动且较大的对象调用,例如 地形。最好不要调用它,而使用对象的边界球体作为对象 例如卫星或地面车辆。
Name Type Description
occluderBoundingSphere BoundingSphere 封堵器周围的边界球体。
occludeePosition Cartesian3 occludee(半径为0的边界球体)所在的点。
positions Array.<Cartesian3> 封堵器表面附近地平线上的高度点列表。
Returns:
一种包含两个属性的对象:occludeePointvalid 这是布尔值。
Throws:
  • DeveloperErrorpositions必须至少包含一个元素。
  • DeveloperErroroccludeePosition的值必须不是occluderBoundingSphere.center
Example:
var cameraPosition = new Cesium.Cartesian3(0, 0, 0);
var occluderBoundingSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -8), 2);
var occluder = new Cesium.Occluder(occluderBoundingSphere, cameraPosition);
var positions = [new Cesium.Cartesian3(-0.25, 0, -5.3), new Cesium.Cartesian3(0.25, 0, -5.3)];
var tileOccluderSphere = Cesium.BoundingSphere.fromPoints(positions);
var occludeePosition = tileOccluderSphere.center;
var occludeePt = Cesium.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);

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

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

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

从边界球体和摄影机位置创建阻挡器。
Name Type Description
occluderBoundingSphere BoundingSphere 封堵器周围的边界球体。
cameraPosition Cartesian3 观察者/摄像机的坐标。
result Occluder optional 要将结果存储到的对象。
Returns:
遮挡器从对象的位置和半径以及摄影机位置导出。

computeVisibility(occludeeBS)Visibility

确定occludedee可见的程度(不可见、部分可见或完全可见)。
Name Type Description
occludeeBS BoundingSphere 封堵器的边界球。
Returns:
可见性。无如果封堵器不可见, 可见性.局部如果闭塞物部分可见,或 能见度.全如果封堵器完全可见。
Example:
var sphere1 = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1.5), 0.5);
var sphere2 = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -2.5), 0.5);
var cameraPosition = new Cesium.Cartesian3(0, 0, 0);
var occluder = new Cesium.Occluder(sphere1, cameraPosition);
occluder.computeVisibility(sphere2); //returns Visibility.NONE
See:
  • Occluder#isVisible

isBoundingSphereVisible(occludee)Boolean

确定球体occludee是否被遮挡器隐藏。
Name Type Description
occludee BoundingSphere 围绕occludedee对象的边界球体。
Returns:
如果封堵器可见,则为true;否则为false
Example:
var cameraPosition = new Cesium.Cartesian3(0, 0, 0);
var littleSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 0.25);
var occluder = new Cesium.Occluder(littleSphere, cameraPosition);
var 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:
var cameraPosition = new Cesium.Cartesian3(0, 0, 0);
var littleSphere = new Cesium.BoundingSphere(new Cesium.Cartesian3(0, 0, -1), 0.25);
var occluder = new Cesium.Occluder(littleSphere, cameraPosition);
var point = new Cesium.Cartesian3(0, 0, -3);
occluder.isPointVisible(point); //returns true
See: