Appearance
KBE3D / KBCore / Cesium / PerspectiveOffCenterFrustum
类: PerspectiveOffCenterFrustum
The viewing frustum is defined by 6 planes. Each plane is represented by a Cartesian4 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.
示例
ts
const frustum = new Cesium.PerspectiveOffCenterFrustum({
left : -1.0,
right : 1.0,
top : 1.0,
bottom : -1.0,
near : 1.0,
far : 100.0
});参数
An object with the following properties:
参数
The left clipping plane distance.
参数
The right clipping plane distance.
参数
The top clipping plane distance.
参数
The bottom clipping plane distance.
参数
The near clipping plane distance.
参数
The far clipping plane distance.
属性
left
left:
number|undefined
Defines the left clipping plane.
right
right:
number|undefined
Defines the right clipping plane.
top
top:
number|undefined
Defines the top clipping plane.
bottom
bottom:
number|undefined
Defines the bottom clipping plane.
near
near:
number
The distance of the near plane.
far
far:
number
The distance of the far plane.
projectionMatrix
readonlyprojectionMatrix:Matrix4
Gets the perspective projection matrix computed from the view frustum. The projection matrix will be recomputed if any frustum parameters have changed.
infiniteProjectionMatrix
readonlyinfiniteProjectionMatrix:Matrix4
Gets the perspective projection matrix computed from the view frustum with an infinite far plane.
方法
computeCullingVolume()
computeCullingVolume(
position:Cartesian3,direction:Cartesian3,up:Cartesian3):CullingVolume
Creates a culling volume for this frustum.
参数
position
The eye position.
direction
The view direction.
up
The up direction.
返回
A culling volume at the given position and orientation.
示例
ts
// Check if a bounding volume intersects the frustum.
const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);
const intersect = cullingVolume.computeVisibility(boundingVolume);getPixelDimensions()
getPixelDimensions(
drawingBufferWidth:number,drawingBufferHeight:number,distance:number,pixelRatio:number,result:Cartesian2):Cartesian2
Returns the pixel's width and height in meters.
参数
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
The object onto which to store the result.
返回
The modified result parameter or a new instance of Cartesian2 with the pixel's width and height in the x and y properties, respectively.
Examples
ts
// Example 1
// Get the width and height of a pixel.
const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, scene.pixelRatio, new Cesium.Cartesian2());ts
// 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.
const position = camera.position;
const direction = camera.direction;
const toCenter = Cesium.Cartesian3.subtract(primitive.boundingVolume.center, position, new Cesium.Cartesian3()); // vector from camera to a primitive
const toCenterProj = Cesium.Cartesian3.multiplyByScalar(direction, Cesium.Cartesian3.dot(direction, toCenter), new Cesium.Cartesian3()); // project vector onto camera direction vector
const distance = Cesium.Cartesian3.magnitude(toCenterProj);
const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, scene.pixelRatio, new Cesium.Cartesian2());clone()
clone(
result?:PerspectiveOffCenterFrustum):PerspectiveOffCenterFrustum
Returns a duplicate of a PerspectiveOffCenterFrustum instance.
参数
result?
PerspectiveOffCenterFrustum
The object onto which to store the result.
返回
PerspectiveOffCenterFrustum
The modified result parameter or a new PerspectiveFrustum instance if one was not provided.
equals()
equals(
other?:PerspectiveOffCenterFrustum):boolean
Compares the provided PerspectiveOffCenterFrustum componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.
参数
other?
PerspectiveOffCenterFrustum
The right hand side PerspectiveOffCenterFrustum.
返回
boolean
true if they are equal, false otherwise.
equalsEpsilon()
equalsEpsilon(
other:PerspectiveOffCenterFrustum,relativeEpsilon:number,absoluteEpsilon?:number):boolean
Compares the provided PerspectiveOffCenterFrustum componentwise and returns <code>true</code> if they pass an absolute or relative tolerance test, <code>false</code> otherwise.
参数
other
PerspectiveOffCenterFrustum
The right hand side PerspectiveOffCenterFrustum.
relativeEpsilon
number
The relative epsilon tolerance to use for equality testing.
absoluteEpsilon?
number
The absolute epsilon tolerance to use for equality testing.
返回
boolean
true if this and other are within the provided epsilon, false otherwise.
构造函数
构造函数
new PerspectiveOffCenterFrustum(
options?: {left?:number;right?:number;top?:number;bottom?:number;near?:number;far?:number; }):PerspectiveOffCenterFrustum
参数
options?
left?
number
right?
number
top?
number
bottom?
number
near?
number
far?
number
返回
PerspectiveOffCenterFrustum
