Skip to content

Commit 042f1e4

Browse files
committed
handle adjacent positions that would be identical when squashed to lat/long
1 parent 948edb5 commit 042f1e4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Source/Core/GroundPolylineGeometry.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ define([
407407
var index;
408408
var i;
409409

410-
var positions = arrayRemoveDuplicates(groundPolylineGeometry._positions, Cartesian3.equalsEpsilon);
410+
var positions = groundPolylineGeometry._positions;
411411
var positionsLength = positions.length;
412412

413413
if (positionsLength === 2) {
@@ -453,6 +453,10 @@ define([
453453
cartographics[i] = cartographic;
454454
}
455455

456+
// Remove duplicates
457+
cartographics = arrayRemoveDuplicates(cartographics, Cartographic.equalsEpsilon);
458+
cartographicsLength = cartographics.length;
459+
456460
/**** Build heap-side arrays for positions, interpolated cartographics, and normals from which to compute vertices ****/
457461
// We build a "wall" and then decompose it into separately connected component "volumes" because we need a lot
458462
// of information about the wall. Also, this simplifies interpolation.

Specs/Core/GroundPolylineGeometrySpec.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,15 @@ defineSuite([
216216
expect(geometry.attributes.texcoordNormalization2D).not.toBeDefined();
217217
});
218218

219-
it('removes adjacent duplicate positions', function() {
219+
it('removes adjacent positions with the same latitude/longitude', function() {
220220
var startCartographic = Cartographic.fromDegrees(0.01, 0.0);
221221
var endCartographic = Cartographic.fromDegrees(0.02, 0.0);
222222
var groundPolylineGeometry = new GroundPolylineGeometry({
223-
positions : Cartesian3.fromRadiansArray([
224-
startCartographic.longitude, startCartographic.latitude,
225-
endCartographic.longitude, endCartographic.latitude,
226-
endCartographic.longitude, endCartographic.latitude
223+
positions : Cartesian3.fromRadiansArrayHeights([
224+
startCartographic.longitude, startCartographic.latitude, 0.0,
225+
endCartographic.longitude, endCartographic.latitude, 0.0,
226+
endCartographic.longitude, endCartographic.latitude, 0.0,
227+
endCartographic.longitude, endCartographic.latitude, 10.0
227228
]),
228229
granularity : 0.0
229230
});

0 commit comments

Comments
 (0)