getPixelSize always returning NaN?

The following code was copied straight from Cesium documentation however does not work.

// Example 1
// Get the width and height of a pixel.
var pixelSize = camera.frustum.getPixelSize({
width : canvas.clientWidth,
height : canvas.clientHeight
});

``

Does anyone know why?

This function seemed very useful in order to display stuff auto-scaled to the current camera position.

The problem is that the function expects a Cartesian2 as the first parameter. Changing width to x and height to y fixes your problem.

Scott

I’ve submitted an issue to have the documentation corrected.

Scott