diff --git a/Source/Core/CorridorGeometryLibrary.js b/Source/Core/CorridorGeometryLibrary.js index d937443a23c1..418fcf3d3573 100644 --- a/Source/Core/CorridorGeometryLibrary.js +++ b/Source/Core/CorridorGeometryLibrary.js @@ -219,7 +219,7 @@ define([ Cartesian3.subtract(backward, backwardProjection, backwardProjection); Cartesian3.normalize(backwardProjection, backwardProjection); - var doCorner = !CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(forwardProjection, backwardProjection)), 1.0, CesiumMath.EPSILON1); + var doCorner = !CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(forwardProjection, backwardProjection)), 1.0, CesiumMath.EPSILON7); if (doCorner) { cornerDirection = Cartesian3.cross(cornerDirection, normal, cornerDirection); diff --git a/Source/Core/PolylineVolumeGeometryLibrary.js b/Source/Core/PolylineVolumeGeometryLibrary.js index 9df76e151611..39e5733aaeba 100644 --- a/Source/Core/PolylineVolumeGeometryLibrary.js +++ b/Source/Core/PolylineVolumeGeometryLibrary.js @@ -350,7 +350,7 @@ define([ Cartesian3.subtract(backward, backwardProjection, backwardProjection); Cartesian3.normalize(backwardProjection, backwardProjection); - var doCorner = !CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(forwardProjection, backwardProjection)), 1.0, CesiumMath.EPSILON1); + var doCorner = !CesiumMath.equalsEpsilon(Math.abs(Cartesian3.dot(forwardProjection, backwardProjection)), 1.0, CesiumMath.EPSILON7); if (doCorner) { cornerDirection = Cartesian3.cross(cornerDirection, surfaceNormal, cornerDirection); diff --git a/Specs/Core/CorridorGeometrySpec.js b/Specs/Core/CorridorGeometrySpec.js index e531decff19b..58ea955b6a55 100644 --- a/Specs/Core/CorridorGeometrySpec.js +++ b/Specs/Core/CorridorGeometrySpec.js @@ -180,6 +180,24 @@ defineSuite([ expect(m.indices.length).toEqual(3 * 8); }); + it('computes sharp turns', function() { + var m = CorridorGeometry.createGeometry(new CorridorGeometry({ + vertexFormat : VertexFormat.POSITION_ONLY, + positions : Cartesian3.fromDegreesArray([ + 2.00571672577652,52.7781459942399, + 1.99188457974115,52.7764958852886, + 2.01325961458495,52.7674170680511, + 1.98708058340534,52.7733979856253, + 2.00634853946644,52.7650460748473 + ]), + cornerType: CornerType.BEVELED, + width : 100 + })); + + expect(m.attributes.position.values.length).toEqual(3 * 13); + expect(m.indices.length).toEqual(3 * 11); + }); + it('computes straight corridors', function() { var m = CorridorGeometry.createGeometry(new CorridorGeometry({ vertexFormat : VertexFormat.POSITION_ONLY, diff --git a/Specs/Core/PolylineVolumeGeometrySpec.js b/Specs/Core/PolylineVolumeGeometrySpec.js index de819ab2a7bc..a8cec93e6a27 100644 --- a/Specs/Core/PolylineVolumeGeometrySpec.js +++ b/Specs/Core/PolylineVolumeGeometrySpec.js @@ -169,6 +169,24 @@ defineSuite([ expect(m.indices.length).toEqual(3 * (8 * 2 + 4 * 7 * 2 + 4)); }); + it('computes sharp turns', function() { + var m = PolylineVolumeGeometry.createGeometry(new PolylineVolumeGeometry({ + vertexFormat : VertexFormat.POSITION_ONLY, + polylinePositions : Cartesian3.fromDegreesArrayHeights([ + 2.00571672577652, 52.7781459942399, 500, + 1.99188457974115, 52.7764958852886, 500, + 2.01325961458495, 52.7674170680511, 500, + 1.98708058340534, 52.7733979856253, 500, + 2.00634853946644, 52.7650460748473, 500 + ]), + cornerType: CornerType.BEVELED, + shapePositions: shape + })); + + expect(m.attributes.position.values.length).toEqual(360); + expect(m.indices.length).toEqual(324); + }); + it('computes straight volume', function() { var m = PolylineVolumeGeometry.createGeometry(new PolylineVolumeGeometry({ vertexFormat : VertexFormat.POSITION_ONLY,