视锥体由 6 个平面定义。每个平面由一个表示 The viewing frustum is defined by 6 planes. Each plane is represented by a
Cartesian4 对象,其中 x、y 和 z 分量定义垂直于平面的单位向量,w 分量是平面距原点/相机位置的距离。 object, where the x, y, and z components define the unit vector normal to the plane, and the w component is the distance of the plane from the origin/camera position.
| 名称 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
用于将对象打包到数组中的元素数量。 The number of elements used to pack the object into an array.
平截头体的宽度与其高度的纵横比。 The aspect ratio of the frustum's width to it's height.
-
默认值: Default Value:
undefined
远平面的距离。 The distance of the far plane.
-
默认值: Default Value:
500000000.0;
近平面的距离。 The distance of the near plane.
-
默认值: Default Value:
1.0
readonly projectionMatrix : Matrix4
获取根据视锥体计算的正交投影矩阵。 Gets the orthographic projection matrix computed from the view frustum.
平截头体的水平宽度(以米为单位)。 The horizontal width of the frustum in meters.
-
默认值: Default Value:
undefined
方法 Methods
将提供的实例存储到提供的数组中。 Stores the provided instance into the provided array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
value |
OrthographicFrustum | 包装的价值。 The value to pack. | |
array |
Array.<number> | 要打包到的数组。 The array to pack into. | |
startingIndex |
number |
0
|
可选 optional 开始打包元素的数组索引。 The index into the array at which to start packing the elements. |
返回: Returns:
被打包成的数组 The array that was packed into
static Cesium.OrthographicFrustum.unpack(array, startingIndex, result) → OrthographicFrustum
从打包数组中检索实例。 Retrieves an instance from a packed array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组。 The packed array. | |
startingIndex |
number |
0
|
可选 optional 要解包的元素的起始索引。 The starting index of the element to be unpacked. |
result |
OrthographicFrustum | 可选 optional 用于存储结果的对象。 The object into which to store the result. |
返回: Returns:
修改后的结果参数或新的 OrthographicFrustum 实例(如果未提供)。 The modified result parameter or a new OrthographicFrustum instance if one was not provided.
clone(result) → OrthographicFrustum
返回 OrthographicFrustum 实例的副本。 Returns a duplicate of a OrthographicFrustum instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
result |
OrthographicFrustum | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的 OrthographicFrustum 实例(如果未提供)。 The modified result parameter or a new OrthographicFrustum instance if one was not provided.
computeCullingVolume(position, direction, up) → CullingVolume
为此视锥体创建剔除体积。 Creates a culling volume for this frustum.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
position |
Cartesian3 | 眼睛的位置。 The eye position. |
direction |
Cartesian3 | 视线方向。 The view direction. |
up |
Cartesian3 | 向上的方向。 The up direction. |
返回: Returns:
给定位置和方向的剔除体积。 A culling volume at the given position and orientation.
示例: Example:
// Check if a bounding volume intersects the frustum.
const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
const intersect = cullingVolume.computeVisibility(boundingVolume);
比较提供的 OrthographicFrustum 组件并返回 Compares the provided OrthographicFrustum componentwise and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
other |
OrthographicFrustum | 可选 optional 右侧正交平截头体。 The right hand side OrthographicFrustum. |
返回: Returns:
true 如果它们相等, if they are equal, false otherwise.
比较提供的 OrthographicFrustum 组件并返回 Compares the provided OrthographicFrustum componentwise and returns
true 如果他们通过了绝对或相对耐受性测试, if they pass an absolute or relative tolerance test,
false otherwise.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
other |
OrthographicFrustum | 右侧正交平截头体。 The right hand side OrthographicFrustum. | |
relativeEpsilon |
number | 用于相等性测试的相对 epsilon 容差。 The relative epsilon tolerance to use for equality testing. | |
absoluteEpsilon |
number |
relativeEpsilon
|
可选 optional 用于相等性测试的绝对 epsilon 容差。 The absolute epsilon tolerance to use for equality testing. |
返回: Returns:
true 如果这个和其他都在提供的 epsilon 范围内, 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 像素的宽度和高度分别位于 x 和 y 属性中。 with the pixel's width and height in the x and y properties, respectively.
抛出: Throws:
-
DeveloperError :drawingBufferWidth 必须大于零。 : drawingBufferWidth must be greater than zero.
-
DeveloperError :drawingBufferHeight 必须大于零。 : drawingBufferHeight must be greater than zero.
-
DeveloperError :pixelRatio 必须大于零。 : 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());
