Occluder

new LSGlobe.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 = LSGlobe.Cartesian3.ZERO;
var occluderBoundingSphere = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -1), 1);
var occluder = new LSGlobe.Occluder(occluderBoundingSphere, cameraPosition);

Members

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

radius : Number

封堵器的半径。

Methods

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

计算可以用作可见性功能的遮挡位置的点。使用零半径作为遮挡半径。通常,用户计算周围的边界球用于可见性的对象;但是也可以计算出一个点,如果可见/不可见还将指示对象是否可见/不可见。这个功能比较好要求不相对于封堵器移动且较大的对象,例如地形。最好不要调用此方法,并使用对象的边界球作为对象例如卫星或地面车辆。
Name Type Description
occluderBoundingSphere BoundingSphere 遮挡物周围的边界球。
occludeePosition Cartesian3 遮挡物(半径为0的边界球)所在的点。
positions Array.< Cartesian3 > 靠近封堵器表面的地平线上的海拔点列表。
Returns:
包含两个属性的对象: 咬合点 有效 这是一个布尔值。
Throws:
  • DeveloperError : 职位 必须包含至少一个元素。
  • DeveloperError : 遮挡位置 必须具有除以下以外的其他值 occluderBoundingSphere.center
Example:
var cameraPosition = new LSGlobe.Cartesian3(0, 0, 0);
var occluderBoundingSphere = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -8), 2);
var occluder = new LSGlobe.Occluder(occluderBoundingSphere, cameraPosition);
var positions = [new LSGlobe.Cartesian3(-0.25, 0, -5.3), new LSGlobe.Cartesian3(0.25, 0, -5.3)];
var tileOccluderSphere = LSGlobe.BoundingSphere.fromPoints(positions);
var occludeePosition = tileOccluderSphere.center;
var occludeePt = LSGlobe.Occluder.computeOccludeePoint(occluderBoundingSphere, occludeePosition, positions);

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

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

static LSGlobe.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.PARTIAL(如果遮挡物部分可见),或 Visibility.FULL(完全可见)。
Example:
var sphere1 = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -1.5), 0.5);
var sphere2 = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -2.5), 0.5);
var cameraPosition = new LSGlobe.Cartesian3(0, 0, 0);
var occluder = new LSGlobe.Occluder(sphere1, cameraPosition);
occluder.computeVisibility(sphere2); //returns Visibility.NONE
See:
  • Occluder#isVisible

isBoundingSphereVisible (occludee) Boolean

确定是否遮挡物隐藏了球形 occludee
Name Type Description
occludee BoundingSphere 遮挡物周围的边界球。
Returns:
真正 如果遮挡物可见;除此以外
Example:
var cameraPosition = new LSGlobe.Cartesian3(0, 0, 0);
var littleSphere = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -1), 0.25);
var occluder = new LSGlobe.Occluder(littleSphere, cameraPosition);
var bigSphere = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -3), 1);
occluder.isBoundingSphereVisible(bigSphere); //returns true
See:

isPointVisible (occludee) Boolean

确定遮挡物是否从视线中隐藏了 occludee 点。
Name Type Description
occludee Cartesian3 遮挡物周围的点。
Returns:
真正 如果遮挡物可见;除此以外
Example:
var cameraPosition = new LSGlobe.Cartesian3(0, 0, 0);
var littleSphere = new LSGlobe.BoundingSphere(new LSGlobe.Cartesian3(0, 0, -1), 0.25);
var occluder = new LSGlobe.Occluder(littleSphere, cameraPosition);
var point = new LSGlobe.Cartesian3(0, 0, -3);
occluder.isPointVisible(point); //returns true
See: