new PerspectiveOffCenterFrustum()
Each plane is represented by a Cartesian object, where the x, y, and z components define the unit normal vector of the plane, and the w component is the distance between the plane and the origin/camera position.
| Name | Type | Default | Description |
|---|---|---|---|
options.left |
Number |
optional
The distance of the left clipping plane. |
|
options.right |
Number |
optional
The distance of the right clipping plane. |
|
options.top |
Number |
optional
The distance of the upper cutting plane. |
|
options.bottom |
Number |
optional
The distance of the cutting plane. |
|
options.near |
Number | 1.0 |
optional
The distance to the cutting plane. |
options.far |
Number | 500000000.0 |
optional
Distance from the far cutting plane. |
- See:
Example
var frustum = new SuperMap3D.PerspectiveOffCenterFrustum({
left : -1.0,
right : 1.0,
top : 1.0,
bottom : -1.0,
near : 1.0,
far : 100.0
});
Members
-
bottomNumber
-
Define the bottom clipping plane.
- Default Value: undefined
farNumber
Distance from the far plane.
- Default Value: 500000000.0
readonly infiniteProjectionMatrixMatrix4
Obtain the perspective projection matrix calculated from an infinite plane cone.
leftNumber
Define the left clipping plane.
- Default Value: undefined
nearNumber
Distance near the plane.
- Default Value: 1.0
readonly projectionMatrixMatrix4
Obtain the perspective projection matrix calculated based on the viewing cone.
rightNumber
Define the right clipping plane.
- Default Value: undefined
topNumber
Define the top clipping plane.
- Default Value: undefined
Methods
-
clone(result){PerspectiveOffCenterFrustum}
-
Return a copy of the PerspectiveOffCenterFrustum instance.
Name Type Description resultPerspectiveOffCenterFrustum optional The object that stores the results.
Returns:
Type Description PerspectiveOffCenterFrustum The modified result parameters, or a new PerspectiveFrustum instance (if not provided). -
computeCullingVolume(position, direction, up){CullingVolume}
-
Create a cropped body for this viewing cone.
Name Type Description positionCartesian3 Viewpoint position.
directionCartesian3 Direction of gaze.
upCartesian3 Upward direction.
Returns:
Type Description CullingVolume A cropped object in a given position and direction. Example
// Check if a bounding volume intersects the frustum. var cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp); var intersect = cullingVolume.computeVisibility(boundingVolume); -
equals(other){Boolean}
-
Compare the provided PerspectiveOffCenterFrustum components, return true if they are equal, otherwise return false.
Name Type Description otherPerspectiveOffCenterFrustum optional The Perspective Off Center Frustum on the right
Returns:
Type Description Boolean If they are equal, it is true; otherwise, it is false. -
equalsEpsilon(other, relativeEpsilon, absoluteEpsilon){Boolean}
-
If the provided PerspectiveOffCenterFrustum components meet the inspection criteria for absolute or relative tolerances, return true; otherwise, return false.
Name Type Default Description otherPerspectiveOffCenterFrustum The visual cone to be compared.
relativeEpsilonNumber The relative epsilon tolerance value used for equality testing.
absoluteEpsilonNumber relativeEpsilon optional The absolute epsilon tolerance value used for equality testing.
Returns:
Type Description Boolean If this object and other objects are within the provided epsilon range, return true; otherwise, return false. -
getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result){Cartesian2}
-
Returns the width and height of pixels in meters.
Name Type Description drawingBufferWidthNumber Draw the width of the buffer.
drawingBufferHeightNumber Draw the height of the buffer.
distanceNumber The distance to the near plane, measured in meters.
resultCartesian2 The object that stores the results.
Throws:
-
-
drawingBufferWidth must be greater than zero.
- Type
- DeveloperError
-
-
-
drawingBufferHeight must be greater than zero.
- Type
- DeveloperError
-
Returns:
Type Description Cartesian2 The modified result parameter or a new instance of Cartesian2 contains the width and height of the pixel in its x and y attributes, respectively. Examples
// Example 1 // Get the width and height of a pixel. var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new SuperMap3D.Cartesian2());// 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. var position = camera.position; var direction = camera.direction; var toCenter = SuperMap3D.Cartesian3.subtract(primitive.boundingVolume.center, position, new SuperMap3D.Cartesian3()); // vector from camera to a primitive var toCenterProj = SuperMap3D.Cartesian3.multiplyByScalar(direction, SuperMap3D.Cartesian3.dot(direction, toCenter), new SuperMap3D.Cartesian3()); // project vector onto camera direction vector var distance = SuperMap3D.Cartesian3.magnitude(toCenterProj); var pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new SuperMap3D.Cartesian2()); -