Skip to content

Commit

Permalink
corner type doc, change extruded lines
Browse files Browse the repository at this point in the history
  • Loading branch information
hpinkos committed Sep 3, 2013
1 parent eaecef1 commit ad44696
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
15 changes: 15 additions & 0 deletions Source/Core/CornerType.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,35 @@ define(['../Core/Enumeration'], function(Enumeration) {
*/
var CornerType = {
/**
* ___
* ( ___
* | |
*
* Corner is circular.
* @type {Enumeration}
* @constant
* @default 0
*/
ROUNDED : new Enumeration(0, 'ROUNDED'),

/**
* ______
* | ___
* | |
*
* Corner point is the intersection of adjacent edges.
* @type {Enumeration}
* @constant
* @default 1
*/
MITERED : new Enumeration(1, 'MITERED'),

/**
* ___
* / ___
* | |
*
* Corner is clipped.
* @type {Enumeration}
* @constant
* @default 2
Expand Down
28 changes: 17 additions & 11 deletions Source/Core/CorridorOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define([
var cartesian2 = new Cartesian3();
var cartesian3 = new Cartesian3();

function combine(computedPositions, ellipsoid) {
function combine(computedPositions, ellipsoid, cornerType) {
var wallIndices = [];
var positions = computedPositions.positions;
var corners = computedPositions.corners;
Expand Down Expand Up @@ -152,28 +152,34 @@ define([
if (defined(l)) {
back -= 3;
start = UR;
wallIndices.push(start, LR);
wallIndices.push(LR);
for (j = 0; j < l.length / 3; j++) {
outsidePoint = Cartesian3.fromArray(l, j * 3, outsidePoint);
indices[index++] = start - j - 1;
indices[index++] = start - j;
CorridorGeometryLibrary.addAttribute(finalPositions, outsidePoint, undefined, back);
back -= 3;
}
wallIndices.push(start - Math.floor(l.length / 6), (back - 2) / 3 + 1);
wallIndices.push(start - Math.floor(l.length / 6));
if (cornerType.value === CornerType.BEVELED.value) {
wallIndices.push((back - 2) / 3 + 1);
}
front += 3;
} else {
front += 3;
start = LR;
wallIndices.push(start, UR);
wallIndices.push(UR);
for (j = 0; j < r.length / 3; j++) {
outsidePoint = Cartesian3.fromArray(r, j * 3, outsidePoint);
indices[index++] = start + j;
indices[index++] = start + j + 1;
CorridorGeometryLibrary.addAttribute(finalPositions, outsidePoint, front);
front += 3;
}
wallIndices.push(start + Math.floor(r.length / 6), front / 3 - 1);
wallIndices.push(start + Math.floor(r.length / 6));
if (cornerType.value === CornerType.BEVELED.value) {
wallIndices.push(front / 3 - 1);
}
back -= 3;
}
rightEdge = positions[posIndex++];
Expand Down Expand Up @@ -225,13 +231,13 @@ define([
front += 3;
back -= 3;
}
}
indices[index++] = front / 3;
indices[index++] = (back - 2) / 3;

if (i === 0) {
wallIndices.push(front / 3);
} else {
wallIndices.push(front / 3, (back - 2) / 3);
}
indices[index++] = front / 3;
indices[index++] = (back - 2) / 3;

attributes.position = new GeometryAttribute({
componentDatatype : ComponentDatatype.DOUBLE,
Expand All @@ -249,7 +255,7 @@ define([
function computePositionsExtruded(params) {
var ellipsoid = params.ellipsoid;
var computedPositions = CorridorGeometryLibrary.computePositions(params);
var attr = combine(computedPositions, ellipsoid);
var attr = combine(computedPositions, ellipsoid, params.cornerType);
var wallIndices = attr.wallIndices;
var height = params.height;
var extrudedHeight = params.extrudedHeight;
Expand Down Expand Up @@ -381,7 +387,7 @@ define([
attr = computePositionsExtruded(params);
} else {
var computedPositions = CorridorGeometryLibrary.computePositions(params);
attr = combine(computedPositions, ellipsoid);
attr = combine(computedPositions, ellipsoid, params.cornerType);
attr.attributes.position.values = new Float64Array(PolylinePipeline.scaleToGeodeticHeight(attr.attributes.position.values, height, ellipsoid));
}
var attributes = attr.attributes;
Expand Down

0 comments on commit ad44696

Please sign in to comment.