Class: PerspectiveOffCenterFrustum

PerspectiveOffCenterFrustum

new PerspectiveOffCenterFrustum()

每个平面由一个 Cartesian4 对象表示,其中 x、y 和 z 分量定义了平面的单位法向量,w 分量是平面与原点/相机位置的距离。

Name Type Default Description
options.left Number 可选

左裁剪平面的距离。

options.right Number 可选

右裁剪平面的距离。

options.top Number 可选

上裁剪平面的距离。

options.bottom Number 可选

下裁剪平面的距离。

options.near Number 1.0 可选

近裁剪平面的距离。

options.far Number 500000000.0 可选

远裁剪平面的距离。

See:
Example
var frustum = new SuperMap3D.PerspectiveOffCenterFrustum({
    left : -1.0,
    right : 1.0,
    top : 1.0,
    bottom : -1.0,
    near : 1.0,
    far : 100.0
});

Members

bottomNumber

定义底部裁剪平面。

Default Value:
undefined

farNumber

远平面的距离。

Default Value:
500000000.0

readonly infiniteProjectionMatrixMatrix4

获取由无限远平面视锥计算得出的透视投影矩阵。

See:

leftNumber

定义左裁剪平面。

Default Value:
undefined

nearNumber

近平面的距离。

Default Value:
1.0

readonly projectionMatrixMatrix4

获取根据视锥计算得出的透视投影矩阵。

See:

定义右裁剪平面。

Default Value:
undefined

topNumber

定义顶部裁剪平面。

Default Value:
undefined

Methods

返回 PerspectiveOffCenterFrustum 实例的副本。

Name Type Description
result PerspectiveOffCenterFrustum 可选

存储结果的对象。

Returns:
Type Description
PerspectiveOffCenterFrustum 修改后的结果参数,或一个新的 PerspectiveFrustum 实例(如果没有提供)。

computeCullingVolume(position, direction, up){CullingVolume}

为这个视锥体创建一个裁剪体。

Name Type Description
position Cartesian3

视点位置。

direction Cartesian3

视线方向。

up Cartesian3

向上的方向。

Returns:
Type Description
CullingVolume 在给定位置和方向上的裁剪体。
Example
// Check if a bounding volume intersects the frustum.
var cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
var intersect = cullingVolume.computeVisibility(boundingVolume);

equals(other){Boolean}

比较所提供的 PerspectiveOffCenterFrustum 分量,如果相等则返回 true,否则返回 false。

Name Type Description
other PerspectiveOffCenterFrustum 可选

右侧的PerspectiveOffCenterFrustum.

Returns:
Type Description
Boolean 如果相等则为 true,否则为 false。

equalsEpsilon(other, relativeEpsilon, absoluteEpsilon){Boolean}

比较提供的PerspectiveOffCenterFrustum分量 若这些分量满足绝对公差或相对公差的检验标准, 则返回true,否则返回false

Name Type Default Description
other PerspectiveOffCenterFrustum

要进行比较的视锥体。

relativeEpsilon Number

用于相等性测试的相对epsilon容差值。

absoluteEpsilon Number relativeEpsilon 可选

用于相等性测试的绝对epsilon容差值。

Returns:
Type Description
Boolean 如果此对象和其他对象在提供的epsilon范围内,则返回true,否则返回false

getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result){Cartesian2}

返回像素的宽度和高度(以米为单位)。

Name Type Description
drawingBufferWidth Number

绘制buffer的宽度。

drawingBufferHeight Number

绘制buffer的高度。

distance Number

到近平面的距离,以米为单位。

result Cartesian2

存储结果的对象。

Throws:
  • drawingBufferWidth must be greater than zero.

    Type
    DeveloperError
  • drawingBufferHeight must be greater than zero.

    Type
    DeveloperError
Returns:
Type Description
Cartesian2 修改后的结果参数或 Cartesian2 的新实例,其 x 和 y 属性中分别包含像素的宽度和高度。
Examples
// Example 1
// Get the width and height of a pixel.
var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new SuperMap3D.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 = SuperMap3D.Cartesian3.subtract(primitive.boundingVolume.center, position, new SuperMap3D.Cartesian3());      // vector from camera to a primitive
var toCenterProj = SuperMap3D.Cartesian3.multiplyByScalar(direction, SuperMap3D.Cartesian3.dot(direction, toCenter), new SuperMap3D.Cartesian3()); // project vector onto camera direction vector
var distance = SuperMap3D.Cartesian3.magnitude(toCenterProj);
var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new SuperMap3D.Cartesian2());