Skip to content

Commit

Permalink
Merge branch 'master' into rectangleCartoArrayIDL
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Dec 10, 2015
2 parents c1c050d + c796c61 commit 1a4a3de
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 85 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Change Log
* Removed `TerrainMesh` from the public API. It is now private and subject to change without notice.
* Removed `jsonp`. Use `loadJsonp` instead.
* Reduced the amount of both GPU and CPU memory used by terrain. The CPU memory was reduced by up to 40%.
* `CorridorGeometry` and `PolylineVolumeGeometry` render short segments [#3293](https://github.com/AnalyticalGraphicsInc/cesium/issues/3293)
* `Rectangle.fromCartographicArray` finds the smallest rectangle regardess of whether or not it crosses the international date line. [#3227](https://github.com/AnalyticalGraphicsInc/cesium/issues/3227)

### 1.16 - 2015-12-01
Expand Down
26 changes: 18 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Thanks for contributing to Cesium. You rock! Are you

* [submitting an issue](#submitting-an-issue),
* [getting started contributing code and documentation](#getting-started-contributing-code-and-documentation), or
* [getting started contributing](#getting-started-contributing), or
* [opening a pull request](#opening-a-pull-request)?

# Submitting an Issue
Expand All @@ -18,16 +18,26 @@ If a related issue does not exist, submit a new one. Please be concise and incl
* The version of Cesium. Did this work in a previous version?
* Ideas for how to fix or workaround the issue. Also mention if you are willing to help fix it. If so, the Cesium team can often provide guidance and the issue may get fixed more quickly with your help.

# Getting Started Contributing Code and Documentation
# Getting Started Contributing

Thanks for helping make Cesium awesome! If you are looking for places to start contributing, consider:
Everyone is welcome to contribute to Cesium!

* issues labeled [beginner](https://github.com/AnalyticalGraphicsInc/cesium/labels/beginner),
* issues labeled [doc](https://github.com/AnalyticalGraphicsInc/cesium/labels/doc),
* issues labeled [roadmap](https://github.com/AnalyticalGraphicsInc/cesium/labels/roadmap), and
* introducing yourself on the [Cesium forum](http://cesiumjs.org/forum.html) and asking for ideas.
In addition to contributing core Cesium code, we appreciate many types of contributions:

See the [Contributor's Guide](https://github.com/AnalyticalGraphicsInc/cesium/wiki/Contributor%27s-Guide) for how to build and run Cesium on your system. Then, review the next section for how to open a great pull request.
* Being active on the [Cesium forum](http://cesiumjs.org/forum.html) by answering questions and providing input on Cesium's direction.
* Showcasing your Cesium apps on the [demos page](http://cesiumjs.org/demos.html) or writing a guest post blog on the [Cesium blog](http://cesiumjs.org/blog.html). To do either, contact [Sarah Chow](http://cesiumjs.org/team/SarahChow.html), [email protected].
* Writing tutorials, creating examples, and improving the reference documentation. See the issues labeled [doc](https://github.com/AnalyticalGraphicsInc/cesium/labels/doc).
* Submitting issues as [described above](#submitting-an-issue).
* Creating ecosystem projects for [glTF](https://github.com/KhronosGroup/glTF/issues/456), [CZML](https://github.com/AnalyticalGraphicsInc/cesium/wiki/CZML-Guide), and [3D Tiles](https://github.com/AnalyticalGraphicsInc/3d-tiles).

For ideas for Cesium code contributions, see:

* issues labeled [beginner](https://github.com/AnalyticalGraphicsInc/cesium/labels/beginner) and
* issues labeled [roadmap](https://github.com/AnalyticalGraphicsInc/cesium/labels/roadmap).

See the [Contributor's Guide](https://github.com/AnalyticalGraphicsInc/cesium/wiki/Contributor%27s-Guide) for how to build and run Cesium on your system.

Always feel free to introduce yourself on the [Cesium forum](http://cesiumjs.org/forum.html) to brainstorm ideas and ask for guidance.

# Opening a Pull Request

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/PolylinePipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ define([
};
};

var removeDuplicatesEpsilon = CesiumMath.EPSILON7;
var removeDuplicatesEpsilon = CesiumMath.EPSILON10;

/**
* Removes adjacent duplicate positions in an array of positions.
Expand Down
4 changes: 3 additions & 1 deletion Source/Core/PolylineVolumeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define([
'./IndexDatatype',
'./Math',
'./PolygonPipeline',
'./PolylinePipeline',
'./PolylineVolumeGeometryLibrary',
'./PrimitiveType',
'./VertexFormat',
Expand All @@ -39,6 +40,7 @@ define([
IndexDatatype,
CesiumMath,
PolygonPipeline,
PolylinePipeline,
PolylineVolumeGeometryLibrary,
PrimitiveType,
VertexFormat,
Expand Down Expand Up @@ -374,7 +376,7 @@ define([
*/
PolylineVolumeGeometry.createGeometry = function(polylineVolumeGeometry) {
var positions = polylineVolumeGeometry._positions;
var cleanPositions = PolylineVolumeGeometryLibrary.removeDuplicatesFromPositions(positions, polylineVolumeGeometry._ellipsoid);
var cleanPositions = PolylinePipeline.removeDuplicates(positions);
var shape2D = polylineVolumeGeometry._shape;
shape2D = PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(shape2D);

Expand Down
28 changes: 0 additions & 28 deletions Source/Core/PolylineVolumeGeometryLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,34 +262,6 @@ define([
return ((prev.x * next.y) - (prev.y * next.x)) >= 0.0;
};

function latLonEquals(c0, c1) {
return ((CesiumMath.equalsEpsilon(c0.latitude, c1.latitude, CesiumMath.EPSILON6)) && (CesiumMath.equalsEpsilon(c0.longitude, c1.longitude, CesiumMath.EPSILON6)));
}
var carto0 = new Cartographic();
var carto1 = new Cartographic();
PolylineVolumeGeometryLibrary.removeDuplicatesFromPositions = function(positions, ellipsoid) {
var length = positions.length;
if (length < 2) {
return positions.slice(0);
}

var cleanedPositions = [];
cleanedPositions.push(positions[0]);

for (var i = 1; i < length; ++i) {
var v0 = positions[i - 1];
var v1 = positions[i];
var c0 = ellipsoid.cartesianToCartographic(v0, carto0);
var c1 = ellipsoid.cartesianToCartographic(v1, carto1);

if (!latLonEquals(c0, c1)) {
cleanedPositions.push(v1); // Shallow copy!
}
}

return cleanedPositions;
};

var scratchForwardProjection = new Cartesian3();
var scratchBackwardProjection = new Cartesian3();

Expand Down
4 changes: 3 additions & 1 deletion Source/Core/PolylineVolumeOutlineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ define([
'./IndexDatatype',
'./Math',
'./PolygonPipeline',
'./PolylinePipeline',
'./PolylineVolumeGeometryLibrary',
'./PrimitiveType',
'./WindingOrder'
Expand All @@ -36,6 +37,7 @@ define([
IndexDatatype,
CesiumMath,
PolygonPipeline,
PolylinePipeline,
PolylineVolumeGeometryLibrary,
PrimitiveType,
WindingOrder) {
Expand Down Expand Up @@ -280,7 +282,7 @@ define([
*/
PolylineVolumeOutlineGeometry.createGeometry = function(polylineVolumeOutlineGeometry) {
var positions = polylineVolumeOutlineGeometry._positions;
var cleanPositions = PolylineVolumeGeometryLibrary.removeDuplicatesFromPositions(positions, polylineVolumeOutlineGeometry._ellipsoid);
var cleanPositions = PolylinePipeline.removeDuplicates(positions);
var shape2D = polylineVolumeOutlineGeometry._shape;
shape2D = PolylineVolumeGeometryLibrary.removeDuplicatesFromShape(shape2D);

Expand Down
36 changes: 0 additions & 36 deletions Specs/Core/PolylineGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,42 +111,6 @@ defineSuite([
expect(line.attributes.color.values.length).toEqual(numVertices * 4);
});

it('removes duplicates within absolute epsilon 7', function() {
var positions = [
new Cartesian3(1.0, 0.0, 0.0),
new Cartesian3(1.0, 0.0, 0.0),
new Cartesian3(1.0 + CesiumMath.EPSILON7, 0.0, 0.0),
new Cartesian3(0.0, 1.0, 0.0),
new Cartesian3(0.0, 0.0, 1.0)];
var line = PolylineGeometry.createGeometry(new PolylineGeometry({
positions : positions,
width : 10.0,
vertexFormat : VertexFormat.POSITION_ONLY,
followSurface : false
}));

var numVertices = ((positions.length - 2) * 4 - 4);
expect(line.attributes.position.values.length).toEqual(numVertices * 3);
});

it('removes duplicates within relative epsilon 7', function() {
var positions = [
new Cartesian3(3000000.0, 0.0, 0.0),
new Cartesian3(3000000.0, 0.0, 0.0),
new Cartesian3(3000000.2, 0.0, 0.0),
new Cartesian3(0.0, 3000000.0, 0.0),
new Cartesian3(0.0, 0.0, 3000000.0)];
var line = PolylineGeometry.createGeometry(new PolylineGeometry({
positions : positions,
width : 10.0,
vertexFormat : VertexFormat.POSITION_ONLY,
followSurface : false
}));

var numVertices = ((positions.length - 2) * 4 - 4);
expect(line.attributes.position.values.length).toEqual(numVertices * 3);
});

it('createGeometry returns undefined without at least 2 unique positions', function() {
var position = new Cartesian3(100000.0, -200000.0, 300000.0);
var positions = [position, Cartesian3.clone(position)];
Expand Down
20 changes: 10 additions & 10 deletions Specs/Core/PolylinePipelineSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,40 +86,40 @@ defineSuite([
expect(noDuplicates).toEqual(positions);
});

it('removeDuplicates to remove positions within absolute epsilon 7', function() {
it('removeDuplicates to remove positions within absolute epsilon 10', function() {
var positions = [
new Cartesian3(1.0, 1.0, 1.0),
new Cartesian3(1.0, 2.0, 3.0),
new Cartesian3(1.0, 2.0, 3.0 + CesiumMath.EPSILON7)];
new Cartesian3(1.0, 2.0, 3.0 + CesiumMath.EPSILON10)];
var expectedPositions = [
new Cartesian3(1.0, 1.0, 1.0),
new Cartesian3(1.0, 2.0, 3.0)];
var noDuplicates = PolylinePipeline.removeDuplicates(positions);
expect(noDuplicates).toEqual(expectedPositions);
});

it('removeDuplicates to remove positions within relative epsilon 7', function() {
it('removeDuplicates to remove positions within relative epsilon 10', function() {
var positions = [
new Cartesian3(0.0, 0.0, 1000000.0),
new Cartesian3(0.0, 0.0, 3000000.0),
new Cartesian3(0.0, 0.0, 3000000.2)];
new Cartesian3(0.0, 0.0, 3000000.0002)];
var expectedPositions = [
new Cartesian3(0.0, 0.0, 1000000.0),
new Cartesian3(0.0, 0.0, 3000000.0)];
var noDuplicates = PolylinePipeline.removeDuplicates(positions);
expect(noDuplicates).toEqual(expectedPositions);
});

it('removeDuplicates keeps positions that add up past relative epsilon 7', function() {
var eightyPercentOfEpsilon7 = 0.8 * CesiumMath.EPSILON7;
it('removeDuplicates keeps positions that add up past relative epsilon 10', function() {
var eightyPercentOfEpsilon = 0.8 * CesiumMath.EPSILON10;
var positions = [
new Cartesian3(0.0, 0.0, 1.0),
new Cartesian3(0.0, 0.0, 1.0 + eightyPercentOfEpsilon7),
new Cartesian3(0.0, 0.0, 1.0 + (2 * eightyPercentOfEpsilon7)),
new Cartesian3(0.0, 0.0, 1.0 + (3 * eightyPercentOfEpsilon7))];
new Cartesian3(0.0, 0.0, 1.0 + eightyPercentOfEpsilon),
new Cartesian3(0.0, 0.0, 1.0 + (2 * eightyPercentOfEpsilon)),
new Cartesian3(0.0, 0.0, 1.0 + (3 * eightyPercentOfEpsilon))];
var expectedPositions = [
new Cartesian3(0.0, 0.0, 1.0),
new Cartesian3(0.0, 0.0, 1.0 + (2 * eightyPercentOfEpsilon7))];
new Cartesian3(0.0, 0.0, 1.0 + (2 * eightyPercentOfEpsilon))];
var noDuplicates = PolylinePipeline.removeDuplicates(positions);
expect(noDuplicates).toEqual(expectedPositions);
});
Expand Down

0 comments on commit 1a4a3de

Please sign in to comment.