diff --git a/CHANGES.md b/CHANGES.md index 987bef965dad..dcf36e2a7773 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * Fixed a bug causing crashes with custom vertex attributes on `Geometry` crossing the IDL. Attributes will be barycentrically interpolated. [#6644](https://github.com/AnalyticalGraphicsInc/cesium/pull/6644) * Fixed a bug causing Point Cloud tiles with unsigned int batch-ids to not load. [#6666](https://github.com/AnalyticalGraphicsInc/cesium/pull/6666) * Fixed a bug with Draco encoded i3dm tiles, and loading two Draco models with the same url. [#6668](https://github.com/AnalyticalGraphicsInc/cesium/issues/6668) +* Fixed a bug caused by creating a polygon with positions at the same longitude/latitude position but different heights [#6731](https://github.com/AnalyticalGraphicsInc/cesium/pull/6731) * Fixed terrain clipping when the camera was close to flat terrain and was using logarithmic depth. [#6701](https://github.com/AnalyticalGraphicsInc/cesium/pull/6701) * Fixed KML bug that constantly requested the same image if it failed to load. [#6710](https://github.com/AnalyticalGraphicsInc/cesium/pull/6710) * Improved billboard and label rendering so they no longer sink into terrain when clamped to ground. [#6621](https://github.com/AnalyticalGraphicsInc/cesium/pull/6621) diff --git a/Source/Core/PolygonGeometryLibrary.js b/Source/Core/PolygonGeometryLibrary.js index c1f836661a62..ba6cf5426414 100644 --- a/Source/Core/PolygonGeometryLibrary.js +++ b/Source/Core/PolygonGeometryLibrary.js @@ -218,8 +218,10 @@ define([ var holes = outerNode.holes; var i; + var length; if (!perPositionHeight) { - for (i = 0; i < outerRing.length; i++) { + length = outerRing.length; + for (i = 0; i < length; i++) { ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]); } } @@ -247,7 +249,8 @@ define([ var hole = holes[i]; var holePositions = hole.positions; if (!perPositionHeight) { - for (j = 0; j < holePositions.length; ++j) { + length = holePositions.length; + for (j = 0; j < length; ++j) { ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]); } } diff --git a/Source/Core/PolygonOutlineGeometry.js b/Source/Core/PolygonOutlineGeometry.js index 0caac11696ad..95a854cd1f65 100644 --- a/Source/Core/PolygonOutlineGeometry.js +++ b/Source/Core/PolygonOutlineGeometry.js @@ -484,11 +484,13 @@ define([ queue.enqueue(polygonHierarchy); var i; var j; + var length; while (queue.length !== 0) { var outerNode = queue.dequeue(); var outerRing = outerNode.positions; if (!perPositionHeight) { - for (i = 0; i < outerRing.length; i++) { + length = outerRing.length; + for (i = 0; i < length; i++) { ellipsoid.scaleToGeodeticSurface(outerRing[i], outerRing[i]); } } @@ -503,7 +505,8 @@ define([ var hole = outerNode.holes[i]; var holePositions = hole.positions; if (!perPositionHeight) { - for (j = 0; j < holePositions.length; ++j) { + length = holePositions.length; + for (j = 0; j < length; ++j) { ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]); } } @@ -566,7 +569,7 @@ define([ geometryInstance.geometry.attributes.position.values = PolygonPipeline.scaleToGeodeticHeight(geometryInstance.geometry.attributes.position.values, height, ellipsoid, !perPositionHeight); if (defined(polygonGeometry._offsetAttribute)) { - var length = geometryInstance.geometry.attributes.position.values.length; + length = geometryInstance.geometry.attributes.position.values.length; var applyOffset = new Uint8Array(length / 3); offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute.NONE ? 0 : 1; arrayFill(applyOffset, offsetValue); diff --git a/Specs/Core/PolygonGeometrySpec.js b/Specs/Core/PolygonGeometrySpec.js index 4a6f90318759..f97032f86453 100644 --- a/Specs/Core/PolygonGeometrySpec.js +++ b/Specs/Core/PolygonGeometrySpec.js @@ -139,7 +139,7 @@ defineSuite([ }; var geometry = PolygonGeometry.createGeometry(new PolygonGeometry({ polygonHierarchy : hierarchy, perPositionHeight: true })); - expect(geometry).not.toBeUndefined(); + expect(geometry).toBeDefined(); }); it('computes positions', function() { diff --git a/Specs/Core/PolygonOutlineGeometrySpec.js b/Specs/Core/PolygonOutlineGeometrySpec.js index c3a76589dae6..013329d16c0b 100644 --- a/Specs/Core/PolygonOutlineGeometrySpec.js +++ b/Specs/Core/PolygonOutlineGeometrySpec.js @@ -133,7 +133,7 @@ defineSuite([ }; var geometry = PolygonOutlineGeometry.createGeometry(new PolygonOutlineGeometry({ polygonHierarchy : hierarchy, perPositionHeight: true })); - expect(geometry).not.toBeUndefined(); + expect(geometry).toBeDefined(); }); it('computes positions', function() {