From 5cc551109e6a71c579fb71608820a403d2c0f97d Mon Sep 17 00:00:00 2001 From: Frank Stoner Date: Fri, 25 Apr 2014 09:54:06 -0400 Subject: [PATCH] Addressing comments from merge request. --- Source/Core/SphericalPolygon.js | 8 +++++--- Source/Scene/CustomSensorVolume.js | 13 ++++++++----- Source/Scene/SphericalPolygonShaderSupport.js | 8 ++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Source/Core/SphericalPolygon.js b/Source/Core/SphericalPolygon.js index 8fcbde09e80..def327c3554 100644 --- a/Source/Core/SphericalPolygon.js +++ b/Source/Core/SphericalPolygon.js @@ -470,7 +470,9 @@ define([ }, /** - * Gets and sets the vertices which define the spherical polygon. + * Gets and sets the vertices which define the spherical polygon. The list of vertices should conform to the following restrictions: + * - Duplicate vertices are not allowed. + * - Consecutive vertices should be less than 180 degrees apart. * * @memberof SphericalPolygon.prototype * @type {Array} @@ -487,8 +489,6 @@ define([ this._directionsNormalsAndBisectorsWithMagnitudeSquared = new Float32Array(3 * size + length); - // TODO: Enforce that angle between vertices cannot be zero or exceed 180 degrees. - var convexVertices = []; this._isConvex = true; @@ -527,6 +527,8 @@ define([ this._vertices = vertices; this._convexHull = []; + this._referenceAxis = undefined; + this._referenceDistance = undefined; } }, diff --git a/Source/Scene/CustomSensorVolume.js b/Source/Scene/CustomSensorVolume.js index 74184082618..0e83bc16e24 100644 --- a/Source/Scene/CustomSensorVolume.js +++ b/Source/Scene/CustomSensorVolume.js @@ -431,7 +431,10 @@ define([ }; /** - * DOC_TBA + * Sets the directions which define the vertices of the custom sensor volume. + * The list of vertices should conform to the following restrictions: + * - Duplicate vertices are not allowed. + * - Consecutive vertices should be less than 180 degrees apart. * * @memberof CustomSensorVolume * @@ -1529,7 +1532,7 @@ define([ t = Cartesian3.normalize(Cartesian3.subtract(r, qUnit, t), t); var cosineOn = Cartesian3.dot(t, xAxis); var sineOn = Cartesian3.dot(t, yAxis); - var cOn = new Crossing(r, cosineOn, sineOn, 'On'); + var cOn = new Crossing(r, cosineOn, sineOn, 1); crossings.push(cOn); } @@ -1566,7 +1569,7 @@ define([ t = Cartesian3.normalize(Cartesian3.subtract(r, qUnit, t), t); var cosineOff = Cartesian3.dot(t, xAxis); var sineOff = Cartesian3.dot(t, yAxis); - var cOff = new Crossing(r, cosineOff, sineOff, 'Off'); + var cOff = new Crossing(r, cosineOff, sineOff, -1); crossings.push(cOff); } @@ -1606,7 +1609,7 @@ define([ count = 0; for (var j = 0; j < crossings.length; ++j) { var c = crossings[j]; - if (c.kind === 'Off') { + if (c.kind === -1) { if (!foundOnCrossing) { Cartesian3.clone(c.r, firstOffCrossing); foundOffCrossingFirst = true; @@ -1624,7 +1627,7 @@ define([ ++count; } - if (c.kind === 'On') { + if (c.kind === 1) { Cartesian3.clone(c.r, onCrossing); foundOnCrossing = true; } diff --git a/Source/Scene/SphericalPolygonShaderSupport.js b/Source/Scene/SphericalPolygonShaderSupport.js index ae9e0b0362d..2c5562934d5 100644 --- a/Source/Scene/SphericalPolygonShaderSupport.js +++ b/Source/Scene/SphericalPolygonShaderSupport.js @@ -24,9 +24,9 @@ define([ var normalsOffset = 3; /** - * A simple polygon on the unit sphere {S2}. + * Shader support functions for the SphericalPolygon type. * - * @alias SphericalPolygon + * @alias SphericalPolygonShaderSupport * @constructor * * @private @@ -156,7 +156,7 @@ define([ /** * DOC_TBA * - * @memberof SphericalPolygon.prototype + * @memberof SphericalPolygonShaderSupport * * @private */ @@ -169,7 +169,7 @@ define([ /** * DOC_TBA * - * @memberof SphericalPolygon.prototype + * @memberof SphericalPolygonShaderSupport * * @private */