worldToDrawingBufferCoordinates

fun worldToDrawingBufferCoordinates(scene: Scene, position: Cartesian3, result: Cartesian2? = definedExternally): Cartesian2?(source)

Transforms a position in world coordinates to drawing buffer coordinates. This may produce different results from SceneTransforms.worldToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.

// Output the window position of longitude/latitude (0, 0) every time the mouse moves.
const position = Cartesian3.fromDegrees(0.0, 0.0);
const handler = new ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
console.log(SceneTransforms.worldToDrawingBufferCoordinates(scene, position));
}, ScreenSpaceEventType.MOUSE_MOVE);

Return

The modified result parameter or a new Cartesian2 instance if one was not provided. This may be undefined if the input position is near the center of the ellipsoid.

Parameters

scene

The scene.

position

The position in world (WGS84 or alternative ellipsoid) coordinates.

result

An optional object to return the input position transformed to window coordinates.

See also