A couple of poly issues

Hi,

I've been working on an interactive extent selection mechanism in
Cesium. It seems to be working ok now though I've noticed a couple of
rendering issues on large polygons/polylines (see attached images).
In case they haven't been reported they are as follows...

- In 3d view polylines take a path through the earth, whereas polygons
curve with the ellipsoid
- In 2d view the polyline behaves, but the polygon has bent edges

I'm hoping to work around this for now by adding intermediate points
along edges rather than just specifying corners.

btw Is there a way to temporarily disable navigation? For now I've
resorted to removing all camera controllers while selection is taking
place then adding back in afterwards.

Cheers,
Chris

// should be able to repro in current version of terrain branch with
something like...

var west = Cesium.Math.toRadians(109.0);
var south = Cesium.Math.toRadians(-45.0);
var east = Cesium.Math.toRadians(157.0);
var north = Cesium.Math.toRadians(-8.0);

var extent = new Cesium.Extent(west, south, east, north);
scene.viewExtent(extent, Cesium.Ellipsoid.WGS84);

var polylines = new Cesium.PolylineCollection();
pts = Cesium.Ellipsoid.WGS84.cartographicArrayToCartesianArray([
  new Cesium.Cartographic(west, south),
  new Cesium.Cartographic(west, north),
  new Cesium.Cartographic(east, north),
  new Cesium.Cartographic(east, south),
  new Cesium.Cartographic(west, south)]);

polylines.add({positions: pts});
scene.getPrimitives().add(polylines);

var poly = new Cesium.Polygon();
poly.material.uniforms.color = new Cesium.Color(1.0, 0.5, 0.0, 0.6);
poly.setPositions(pts);
poly.affectedByLighting = false;
scene.getPrimitives().add(poly);

prob2d.jpg

prob3d.jpg

Hi Chris,

For the polygon, use configureExtent, e.g.,

polygon.configureExtent(extent);

A polyline draws straight lines, so it will cut under the globe. We have plans to support geodesic and rhumb lines, but they are a few months out (you are welcome to contribute them, of course). In the meantime, it would be very simple to port my C# function, ComputeCurve, which is a small function that relies on ScaleToGeocentricSurface, which is already part of the Ellipsoid in Cesium. However, this is not what we want long-term in Cesium. I believe great circles and great arcs only exists on spheres, and we want geodesics on ellipsoids, but this is probably sufficient for your needs.

Someone more familiar with the camera, can answer your other question.

Regards,

Patrick

Thanks Patrick,

As a follow up for now I'm using configureExtent() for the poly, then
do the same 'granularity' style stepping in lat/long to get a matching
polyline as it seemed non-trivial to use ExtentTesselator directly.
Visually they now appear to match exactly in all views. btw For the
future it could be handy to allow a user to pass through a granularity
value to the ExtentTesselator via Polygon.configureExtent().

Cheers,
Chris