视锥体由6个平面定义。
每个平面由
Cartesian4 对象表示,其中 x、y 和 z 分量
定义平面的单位法向量,w 分量是
平面到原点/相机位置的距离。
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
包含以下属性的对象:
|
Example:
const maxRadii = ellipsoid.maximumRadius;
const frustum = new Cesium.OrthographicOffCenterFrustum();
frustum.right = maxRadii * Cesium.Math.PI;
frustum.left = -c.frustum.right;
frustum.top = c.frustum.right * (canvas.clientHeight / canvas.clientWidth);
frustum.bottom = -c.frustum.top;
frustum.near = 0.01 * maxRadii;
frustum.far = 50.0 * maxRadii;
Members
下裁剪平面。
-
Default Value:
undefined
远平面距离。
-
Default Value:
500000000.0;
左裁剪平面。
-
Default Value:
undefined
近平面距离。
-
Default Value:
1.0
readonly projectionMatrix : Matrix4
获取从视锥体计算出的正交投影矩阵。
右裁剪平面。
-
Default Value:
undefined
上裁剪平面。
-
Default Value:
undefined
Methods
Returns a duplicate of a OrthographicOffCenterFrustum instance.
| Name | Type | Description |
|---|---|---|
result |
OrthographicOffCenterFrustum | optional The object onto which to store the result. |
Returns:
The modified result parameter or a new OrthographicOffCenterFrustum instance if one was not provided.
computeCullingVolume(position, direction, up) → CullingVolume
为此视锥体创建剔除体。
| Name | Type | Description |
|---|---|---|
position |
Cartesian3 | 眼睛位置。 |
direction |
Cartesian3 | 视图方向。 |
up |
Cartesian3 | 上方向。 |
Returns:
在给定位置和方向的剔除体。
Example:
// 检查边界体是否与视锥体相交。
const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
const intersect = cullingVolume.computeVisibility(boundingVolume);
Compares the provided OrthographicOffCenterFrustum componentwise and returns
true if they are equal, false otherwise.
| Name | Type | Description |
|---|---|---|
other |
OrthographicOffCenterFrustum | optional The right hand side OrthographicOffCenterFrustum. |
Returns:
true if they are equal, false otherwise.
Compares the provided OrthographicOffCenterFrustum componentwise and returns
true if they pass an absolute or relative tolerance test,
false otherwise.
| Name | Type | Default | Description |
|---|---|---|---|
other |
OrthographicOffCenterFrustum | The right hand side OrthographicOffCenterFrustum. | |
relativeEpsilon |
number | The relative epsilon tolerance to use for equality testing. | |
absoluteEpsilon |
number |
relativeEpsilon
|
optional The absolute epsilon tolerance to use for equality testing. |
Returns:
true if this and other are within the provided epsilon, false otherwise.
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) → Cartesian2
Returns the pixel's width and height in meters.
| Name | Type | Description |
|---|---|---|
drawingBufferWidth |
number | The width of the drawing buffer. |
drawingBufferHeight |
number | The height of the drawing buffer. |
distance |
number | The distance to the near plane in meters. |
pixelRatio |
number | The scaling factor from pixel space to coordinate space. |
result |
Cartesian2 | The object onto which to store the result. |
Returns:
The modified result parameter or a new instance of
Cartesian2 with the pixel's width and height in the x and y properties, respectively.
Throws:
-
DeveloperError : drawingBufferWidth must be greater than zero.
-
DeveloperError : drawingBufferHeight must be greater than zero.
-
DeveloperError : pixelRatio must be greater than zero.
Example:
// Example 1
// Get the width and height of a pixel.
const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cesium.Cartesian2());
