视锥体由 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.OrthographicFrustum();
frustum.near = 0.01 * maxRadii;
frustum.far = 50.0 * maxRadii;
Members
将该对象打包进数组时使用的元素数量。
视锥体宽度与高度(height)的宽高比。
-
Default Value:
undefined
远平面的距离。
-
Default Value:
500000000.0;
近平面的距离。
-
Default Value:
1.0
readonly projectionMatrix : Matrix4
获取根据视锥体计算得到的正交投影矩阵。
视锥体的水平宽度(单位:米)。
-
Default Value:
undefined
Methods
将所提供的实例存储到所提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
OrthographicFrustum | 要打包的值。 | |
array |
Array.<number> | 要打包进的数组。 | |
startingIndex |
number |
0
|
optional 数组中开始打包元素的索引。 |
Returns:
被打包进的数组
static Cesium.OrthographicFrustum.unpack(array, startingIndex, result) → OrthographicFrustum
从打包后的数组中取出一个实例。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 已打包的数组。 | |
startingIndex |
number |
0
|
optional 要解包的元素起始索引。 |
result |
OrthographicFrustum | optional 用于存储结果的对象。 |
Returns:
被修改的 result 参数;如果未提供,则为一个新的 OrthographicFrustum 实例。
clone(result) → OrthographicFrustum
返回一个 OrthographicFrustum 实例的副本。
| Name | Type | Description |
|---|---|---|
result |
OrthographicFrustum | optional 用于存储结果的对象。 |
Returns:
被修改的 result 参数;如果未提供,则为一个新的 OrthographicFrustum 实例。
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);
逐分量比较所提供的 OrthographicFrustum,相等时返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
other |
OrthographicFrustum | optional 右侧的 OrthographicFrustum。 |
Returns:
若它们相等则为
true,否则为 false。
逐分量比较所提供的 OrthographicFrustum,当它们通过绝对或相对容差测试时返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
other |
OrthographicFrustum | 右侧的 OrthographicFrustum。 | |
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());
