视锥体由 6 个平面定义。
每个平面由一个
Cartesian4 对象表示,其中 x、y、z 分量
定义了垂直于该平面的单位向量,w 分量是该平面
到原点/相机位置的距离。
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
An object with the following properties:
|
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
返回一个 OrthographicOffCenterFrustum 实例的副本。
| Name | Type | Description |
|---|---|---|
result |
OrthographicOffCenterFrustum | optional 用于存储结果的对象。 |
Returns:
被修改的 result 参数;如果未提供,则为一个新的 OrthographicOffCenterFrustum 实例。
computeCullingVolume(position, direction, up) → CullingVolume
为此视锥体创建一个剔除体积(culling volume)。
| Name | Type | Description |
|---|---|---|
position |
Cartesian3 | 视点(eye)位置。 |
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);
逐分量比较所提供的 OrthographicOffCenterFrustum,相等时返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
other |
OrthographicOffCenterFrustum | optional 右侧的 OrthographicOffCenterFrustum。 |
Returns:
若它们相等则为
true,否则为 false。
逐分量比较所提供的 OrthographicOffCenterFrustum,当它们通过绝对或相对容差测试时返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
other |
OrthographicOffCenterFrustum | 右侧的 OrthographicOffCenterFrustum。 | |
relativeEpsilon |
number | 用于相等性测试的相对象差(relative epsilon)容差。 | |
absoluteEpsilon |
number |
relativeEpsilon
|
optional 用于相等性测试的绝对对象差(absolute epsilon)容差。 |
Returns:
若 this 与 other 在所提供容差范围内则为
true,否则为 false。
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, pixelRatio, result) → Cartesian2
返回像素的宽度和高度(单位:米)。
| Name | Type | Description |
|---|---|---|
drawingBufferWidth |
number | 绘制缓冲区(drawing buffer)的宽度。 |
drawingBufferHeight |
number | 绘制缓冲区(drawing buffer)的高度。 |
distance |
number | 到近平面的距离(单位:米)。 |
pixelRatio |
number | 从像素空间到坐标空间的缩放因子。 |
result |
Cartesian2 | 用于存储结果的对象。 |
Returns:
被修改的 result 参数;或一个新的
Cartesian2 实例,其 x、y 属性分别为像素的宽度和高度。
Throws:
-
DeveloperError :drawingBufferWidth 必须大于零。
-
DeveloperError :drawingBufferHeight 必须大于零。
-
DeveloperError :pixelRatio 必须大于零。
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());
