Style edits

This commit is contained in:
Sean Lilley 2017-07-24 16:42:03 -04:00
parent f526e9b0d8
commit 9da383e434
1 changed files with 8 additions and 8 deletions

View File

@ -160,7 +160,9 @@ function loadObj(objPath, options) {
var normal = new Cartesian3(); var normal = new Cartesian3();
var ray = new Ray(); var ray = new Ray();
var plane = new Plane(Cesium.Cartesian3.UNIT_X, 0); var plane = new Plane(Cesium.Cartesian3.UNIT_X, 0);
function projectTo2D(positions) { function projectTo2D(positions) {
var i;
var positions2D = new Array(positions.length); var positions2D = new Array(positions.length);
var obb = OrientedBoundingBox.fromPoints(positions); var obb = OrientedBoundingBox.fromPoints(positions);
var halfAxes = obb.halfAxes; var halfAxes = obb.halfAxes;
@ -175,7 +177,6 @@ function loadObj(objPath, options) {
// If all the points are on a line, just remove one of the zero dimensions // If all the points are on a line, just remove one of the zero dimensions
if (xMag === 0 && (yMag === 0 || zMag === 0)) { if (xMag === 0 && (yMag === 0 || zMag === 0)) {
var i;
for (i = 0; i < positions.length; i++) { for (i = 0; i < positions.length; i++) {
positions2D[i] = new Cartesian2(positions[i].y, positions[i].z); positions2D[i] = new Cartesian2(positions[i].y, positions[i].z);
} }
@ -328,15 +329,14 @@ function loadObj(objPath, options) {
// Given the cartesian 2 vertices of a polygon, determine if convex // Given the cartesian 2 vertices of a polygon, determine if convex
function isConvex(positions2D) { function isConvex(positions2D) {
var i; var turnDirection = getTurnDirection(positions2D[0], positions2D[1], positions2D[2]);
var turnDirection = getTurnDirection(positions2D[0], positions2D[1], positions2D[2]); for (var i=1; i < positions2D.length-2; ++i) {
for (i=1; i < positions2D.length-2; ++i) { var currentTurnDirection = getTurnDirection(positions2D[i], positions2D[i+1], positions2D[i+2]);
var currentTurnDirection = getTurnDirection(positions2D[i], positions2D[i+1], positions2D[i+2]);
if (turnDirection * currentTurnDirection < 0) { if (turnDirection * currentTurnDirection < 0) {
return false; return false;
} }
} }
return true; return true;
} }
var scratch3 = new Cartesian3(); var scratch3 = new Cartesian3();
@ -470,7 +470,7 @@ function loadObj(objPath, options) {
} }
lineBuffer += line; lineBuffer += line;
if (lineBuffer.substring(0, 2) === 'f ') { if (lineBuffer.substring(0, 2) === 'f ') {
while ( (result = facePattern.exec(lineBuffer)) !== null ) { while ((result = facePattern.exec(lineBuffer)) !== null) {
faceVertices.push(result[0]); faceVertices.push(result[0]);
facePositions.push(result[1]); facePositions.push(result[1]);
faceUvs.push(result[2]); faceUvs.push(result[2]);