PerspectiveFrustum

new Cesium.PerspectiveFrustum(options)

视锥由6个平面定义。 每个平面由一个Cartesian4对象表示,其中x、y和z分量 定义垂直于平面的单位向量,w分量是 从原点/摄影机位置平面。
Name Type Description
options Object optional 具有以下属性的对象:
Name Type Default Description
fov Number optional 视野(FOV)的角度,以弧度为单位。
aspectRatio Number optional 截锥的宽高比。
near Number 1.0 optional 近平面的距离。
far Number 500000000.0 optional 远平面的距离。
xOffset Number 0.0 optional x方向的偏移。
yOffset Number 0.0 optional y方向上的偏移。
Example:
var frustum = new Cesium.PerspectiveFrustum({
    fov : Cesium.Math.PI_OVER_THREE,
    aspectRatio : canvas.clientWidth / canvas.clientHeight
    near : 1.0,
    far : 1000.0
});
See:

Members

static Cesium.PerspectiveFrustum.packedLength : Number

用于将对象打包到数组中的元素数。

aspectRatio : Number

截锥的宽高比。
Default Value: undefined
远平面的距离。
Default Value: 500000000.0
视野(FOV)的角度,以弧度为单位。将使用此角度 如果宽度大于高度,则为水平视野,否则 它将是垂直视野。
Default Value: undefined

readonly fovy : Number

获取垂直视野的角度(以弧度为单位)。
Default Value: undefined

readonly infiniteProjectionMatrix : Matrix4

从无限远平面的视锥计算透视投影矩阵。
See:
近平面的距离。
Default Value: 1.0

readonly projectionMatrix : Matrix4

获取从视图视锥计算的透视投影矩阵。
See:
沿x方向偏移平截面。
Default Value: 0.0
在截锥方向上的偏移。
Default Value: 0.0

Methods

static Cesium.PerspectiveFrustum.pack(value, array, startingIndex)Array.<Number>

将提供的实例存储到提供的数组中。
Name Type Default Description
value PerspectiveFrustum 要打包的值。
array Array.<Number> 要打包到的数组。
startingIndex Number 0 optional 数组中开始打包元素的索引。
Returns:
被压缩到的数组

static Cesium.PerspectiveFrustum.unpack(array, startingIndex, result)PerspectiveFrustum

从压缩数组检索实例。
Name Type Default Description
array Array.<Number> 压缩数组。
startingIndex Number 0 optional 要解包的元素的起始索引。
result PerspectiveFrustum optional 要将结果存储到其中的对象。
Returns:
修改后的结果参数或新的PerspectiveFrustum实例(如果未提供实例)。
返回PerspectiveFrustum实例的副本。
Name Type Description
result PerspectiveFrustum optional 要将结果存储到的对象。
Returns:
修改后的结果参数或新的PerspectiveFrustum实例(如果未提供实例)。

computeCullingVolume(position, direction, up)CullingVolume

为此视锥创建剔除体积。
Name Type Description
position Cartesian3 眼睛的位置。
direction Cartesian3 视图方向。
up Cartesian3 向上的方向。
Returns:
在给定位置和方向的剔除体积。
Example:
// Check if a bounding volume intersects the frustum.
var cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
var intersect = cullingVolume.computeVisibility(boundingVolume);

equals(other)Boolean

比较提供的透视视锥体组件并返回 如果相等,则为true,否则为false
Name Type Description
other PerspectiveFrustum optional 右手边的透视截锥。
Returns:
如果相等,则为true,否则为false

equalsEpsilon(other, relativeEpsilon, absoluteEpsilon)Boolean

比较提供的透视视锥体组件并返回 true如果它们通过绝对或相对公差测试, false否则。
Name Type Default Description
other PerspectiveFrustum 右手边的透视截锥。
relativeEpsilon Number 用于相等性测试的相对ε公差。
absoluteEpsilon Number relativeEpsilon optional 用于相等性测试的绝对ε公差。
Returns:
true如果这个和其他都在提供的epsilon内,则为false

getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result)Cartesian2

返回像素的宽度和高度(以米为单位)。
Name Type Description
drawingBufferWidth Number 绘图缓冲区的宽度。
drawingBufferHeight Number 绘图缓冲区的高度。
distance Number 到近平面的距离,以米为单位。
pixelRatio Number 从像素空间到坐标空间的比例因子。
result Cartesian2 要存储结果的对象。
Returns:
修改后的结果参数或Cartesian2的新实例,其像素宽度和高度分别在x和y属性中。
Throws:
Examples:
// Example 1
// Get the width and height of a pixel.
var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());
// Example 2
// Get the width and height of a pixel if the near plane was set to 'distance'.
// For example, get the size of a pixel of an image on a billboard.
var position = camera.position;
var direction = camera.direction;
var toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3());      // vector from camera to a primitive
var toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
var distance = Cesium.Cartesian3.magnitude(toCenterProj);
var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());