CesiumGS / CesiumGS/cesium

Camera.getRectangleCameraCoordinates doesn't account for terrain

Open
#4,807 3 comments 3 reactions 0 assignees View on GitHub
category - camera type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/R7CLnK9PZE8

In this example, the camera zooms to span where the rectangle would be on the WGS84 ellipsoid, which is zoomed in too far for where the rectangle is on the terrain surface.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
url : '//assets.agi.com/stk-terrain/world'
});

var west = -45.977340999999605;
var south = -21.417668000000273;
var east = -45.96351400000036;
var north = -21.403251000000008;
var rectangle = new Cesium.Rectangle.fromDegrees(west, south, east, north);
viewer.entities.add({
rectangle : {
coordinates: rectangle,
material: Cesium.Color.RED.withAlpha(0.5)
}
});

Sandcastle.addToolbarButton('Set View', function() {
viewer.camera.setView({
destination: rectangle
});
});
```

Contributor guide

Open the contributing guide

Research direction

Start with Camera.getRectangleCameraCoordinates and reproduce the Sandcastle example using CesiumTerrainProvider and the supplied rectangle. Compare the camera framing for the WGS84 ellipsoid with the terrain surface; done means setting the rectangle view leaves the terrain-covered rectangle fully visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.