Geometry and Appearances Example Bug

Cutting & pasting the last example in the Geometry and Appearances - Combing (Combining?) Geometries section (rectangles covering the entire globe at 5 degrees) into Sandcastle results in an error (Win7, Chrome 54.0.2840.87, also IE11):

An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: normalized result is not a number
Error
at new DeveloperError (http://cesiumjs.org/Cesium/Source/Core/DeveloperError.js:44:19)
at Function.Cartesian3.normalize (http://cesiumjs.org/Cesium/Source/Core/Cartesian3.js:459:19)
at computeTriangleAttributes (http://cesiumjs.org/Cesium/Source/Core/GeometryPipeline.js:1901:24)
at splitLongitudeTriangles (http://cesiumjs.org/Cesium/Source/Core/GeometryPipeline.js:2058:17)
at Object.GeometryPipeline.splitLongitude (http://cesiumjs.org/Cesium/Source/Core/GeometryPipeline.js:2482:17)
at geometryPipeline (http://cesiumjs.org/Cesium/Source/Scene/PrimitivePipeline.js:135:38)
at Object.PrimitivePipeline.combineGeometry (http://cesiumjs.org/Cesium/Source/Scene/PrimitivePipeline.js:278:26)
at combineGeometry (http://cesiumjs.org/Cesium/Source/Workers/combineGeometry.js:12:41)
at http://cesiumjs.org/Cesium/Source/Workers/createTaskProcessorWorker.js:56:42

I removed the loop to make a simpler example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var scene = viewer.scene;

var lon = -180.0;
var lat = -90.0;

var instance = new Cesium.GeometryInstance({
geometry : new Cesium.RectangleGeometry({
rectangle : Cesium.Rectangle.fromDegrees(lon, lat, lon + 5.0, lat + 5.0)
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
});

scene.primitives.add(new Cesium.Primitive({
geometryInstances : instance,
appearance : new Cesium.PerInstanceColorAppearance()
}));

``

Additionally, if you ignore the lat/lons that trigger the rendering error, this example renders with color artifacts due to the missing vertexFormat option:
vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT

``

Thanks! This looks like a bug that’s caused by using latitude = -90. I filed a bug report here: https://github.com/AnalyticalGraphicsInc/cesium/issues/4760

For now, if you change the example to for (var lat = -85.0; lat < 85.0; lat += 5.0) { it should work.

Best,

Hannah