getPixelDimensions

fun getPixelDimensions(drawingBufferWidth: Double, drawingBufferHeight: Double, distance: Double, pixelRatio: Double, result: Cartesian2): Cartesian2(source)

Returns the pixel's width and height in meters.

// Example 1
// Get the width and height of a pixel.
const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 0.0, scene.pixelRatio, new Cartesian2());

Return

The modified result parameter or a new instance of Cartesian2 with the pixel's width and height in the x and y properties, respectively.

Parameters

drawingBufferWidth

The width of the drawing buffer.

drawingBufferHeight

The height of the drawing buffer.

distance

The distance to the near plane in meters.

pixelRatio

The scaling factor from pixel space to coordinate space.

result

The object onto which to store the result.

See also