PerspectiveOffCenterFrustum

new Cesium.PerspectiveOffCenterFrustum ( options )

视锥体由 6 个平面定义。每个平面由一个 Cartesian4 对象表示,其中 x、y 和 z 分量定义垂直于平面的单位矢量,w 分量是平面到原点/相机位置的距离。
Name Type Description
options Object 可选 具有以下属性的对象:
姓名 类型 默认 描述
left 数字 可选 左剪裁平面距离。
right 数字 可选 右剪裁平面距离。
top 数字 可选 顶部剪裁平面距离。
bottom 数字 可选 底部剪裁平面距离。
near 数字 1.0 可选 近剪裁平面距离。
far 数字 500000000.0 可选 远剪裁平面距离。
Example:
const frustum = new Cesium.PerspectiveOffCenterFrustum({
    left : -1.0,
    right : 1.0,
    top : 1.0,
    bottom : -1.0,
    near : 1.0,
    far : 100.0
});
See:

Members

定义底部剪裁平面。
Default Value: undefined
远平面的距离。
Default Value: 500000000.0

readonly infiniteProjectionMatrix : Matrix4

获取从具有无限远平面的视锥体计算的透视投影矩阵。
See:
定义左剪裁平面。
Default Value: undefined
近平面的距离。
Default Value: 1.0
获取从视锥计算的透视投影矩阵。
See:
定义正确的剪裁平面。
Default Value: undefined
定义顶部剪裁平面。
Default Value: undefined

Methods

返回 PerspectiveOffCenterFrustum 实例的副本。
Name Type Description
result PerspectiveOffCenterFrustum 可选 存储结果的对象。
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.
const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
const intersect = cullingVolume.computeVisibility(boundingVolume);

equals ( other ) → Boolean

比较提供的 PerspectiveOffCenterFrustum 组件,如果它们相等则返回 true ,否则返回 false 。
Name Type Description
other PerspectiveOffCenterFrustum 可选 右侧 PerspectiveOffCenterFrustum。
Returns:
如果它们相等,则为 true ,否则为 false 。

equalsEpsilon (other, relativeEpsilon, absoluteEpsilon ) → Boolean

比较提供的 PerspectiveOffCenterFrustum 组件,如果它们通过绝对或相对容差测试,则返回 true ,否则返回 false 。
Name Type Default Description
other PerspectiveOffCenterFrustum 右侧 PerspectiveOffCenterFrustum。
relativeEpsilon Number 用于相等性测试的相对 epsilon 容差。
absoluteEpsilon Number relativeEpsilon 可选 用于相等测试的绝对 epsilon 容差。
Returns:
true this 和 other 在提供的 epsilon 内,则为 true,否则为 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.
const 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.
const position = camera.position;
const direction = camera.direction;
const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3());      // vector from camera to a primitive
const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
const distance = Cesium.Cartesian3.magnitude(toCenterProj);
const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());