PerspectiveOffCenterFrustum

new Cesium.PerspectiveOffCenterFrustum(options)

视锥体由 6 个平面定义。 每个平面由一个 Cartesian4 对象表示,其中 x、y、z 分量 定义该平面的单位法向向量,w 分量为该平面到原点/相机位置的距离。
Name Type Description
options object optional An object with the following properties:
Name Type Default Description
left number optional 左裁剪平面距离。
right number optional 右裁剪平面距离。
top number optional 上裁剪平面距离。
bottom number optional 下裁剪平面距离。
near number 1.0 optional 近裁剪平面距离。
far number 500000000.0 optional 远裁剪平面距离。
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
获取由视锥体计算得到的透视投影矩阵,其远平面为无穷远。
See:
定义左裁剪平面。
Default Value: undefined
近平面距离。
Default Value: 1.0
获取由视锥体计算得到的透视投影矩阵。 如果任意视锥体参数发生变化,投影矩阵将被重新计算。
See:
定义右裁剪平面。
Default Value: undefined
定义上裁剪平面。
Default Value: undefined

Methods

返回 PerspectiveOffCenterFrustum 实例的副本。
Name Type Description
result PerspectiveOffCenterFrustum optional 用于存储结果的对象。
Returns:
被修改的 result 参数;如果未提供,则为一个新的 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);
按分量比较两个给定的 PerspectiveOffCenterFrustum,若相等则返回 true,否则返回 false
Name Type Description
other PerspectiveOffCenterFrustum optional 右侧的 PerspectiveOffCenterFrustum。
Returns:
如果它们相等则返回 true,否则返回 false

equalsEpsilon(other, relativeEpsilon, absoluteEpsilon)boolean

按分量比较两个给定的 PerspectiveOffCenterFrustum,若通过绝对或相对容差测试则返回 true,否则返回 false
Name Type Default Description
other PerspectiveOffCenterFrustum 右侧的 PerspectiveOffCenterFrustum。
relativeEpsilon number 用于相等性测试的相宽容差。
absoluteEpsilon number relativeEpsilon optional 用于相等性测试的绝对容差。
Returns:
如果当前实例与 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:
被修改的 result 参数,或一个新的 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());
需要帮助?获取答案的最快方式是在 Cesium 论坛 上向社区和团队提问。