Skip to content

Commit

Permalink
Addressing comments from merge request.
Browse files Browse the repository at this point in the history
  • Loading branch information
fstoner committed Apr 25, 2014
1 parent 6946880 commit 5cc5511
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 5 additions & 3 deletions Source/Core/SphericalPolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;
Expand Down Expand Up @@ -527,6 +527,8 @@ define([

this._vertices = vertices;
this._convexHull = [];
this._referenceAxis = undefined;
this._referenceDistance = undefined;
}
},

Expand Down
13 changes: 8 additions & 5 deletions Source/Scene/CustomSensorVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand All @@ -1624,7 +1627,7 @@ define([

++count;
}
if (c.kind === 'On') {
if (c.kind === 1) {
Cartesian3.clone(c.r, onCrossing);
foundOnCrossing = true;
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Scene/SphericalPolygonShaderSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -156,7 +156,7 @@ define([
/**
* DOC_TBA
*
* @memberof SphericalPolygon.prototype
* @memberof SphericalPolygonShaderSupport
*
* @private
*/
Expand All @@ -169,7 +169,7 @@ define([
/**
* DOC_TBA
*
* @memberof SphericalPolygon.prototype
* @memberof SphericalPolygonShaderSupport
*
* @private
*/
Expand Down

0 comments on commit 5cc5511

Please sign in to comment.