Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust polygon position heights before removing duplicates if not perPositionHeight #6731

Merged
merged 2 commits into from Jun 25, 2018

Conversation

hpinkos
Copy link
Contributor

@hpinkos hpinkos commented Jun 25, 2018

Fixes crash reported in #4863 (comment)

If perPositionHeight: false, the positions passed to PolygonGeometry are scaled to the ellipsoid surface then adjusted for height and extrudedHeight. However, this needs to happen before arrayRemoveDuplicates for the case where there are positions with the same lon/lat but different heights.

@cesium-concierge
Copy link

Signed CLA is on file.

@hpinkos, thanks for the pull request! Maintainers, we have a signed CLA from @hpinkos, so you can review this at any time.

⚠️ I noticed that CHANGES.md has not been updated. If this change updates the public API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to CHANGES.md and comment on this pull request so we know it was updated. For more info, see the Pull Request Guidelines.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@mramato
Copy link
Member

mramato commented Jun 25, 2018

@likangning93 can you review.

Please update CHANGES.

Copy link
Contributor

@likangning93 likangning93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two small things in a couple places.

@@ -217,6 +217,13 @@ define([
var outerRing = outerNode.positions;
var holes = outerNode.holes;

var i;
if (!perPositionHeight) {
for (i = 0; i < outerRing.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this get set on a temp var before the loop?

var holePositions = arrayRemoveDuplicates(hole.positions, Cartesian3.equalsEpsilon, true);
var holePositions = hole.positions;
if (!perPositionHeight) {
for (j = 0; j < holePositions.length; ++j) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

while (queue.length !== 0) {
var outerNode = queue.dequeue();
var outerRing = outerNode.positions;
if (!perPositionHeight) {
for (i = 0; i < outerRing.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

if (hole.positions.length < 3) {
var holePositions = hole.positions;
if (!perPositionHeight) {
for (j = 0; j < holePositions.length; ++j) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

};

var geometry = PolygonOutlineGeometry.createGeometry(new PolygonOutlineGeometry({ polygonHierarchy : hierarchy, perPositionHeight: true }));
expect(geometry).not.toBeUndefined();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.toBeDefined()

};

var geometry = PolygonGeometry.createGeometry(new PolygonGeometry({ polygonHierarchy : hierarchy, perPositionHeight: true }));
expect(geometry).not.toBeUndefined();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.toBeDefined()

@hpinkos
Copy link
Contributor Author

hpinkos commented Jun 25, 2018

Thanks @likangning93! Updated

@likangning93 likangning93 merged commit 0f0c293 into master Jun 25, 2018
@likangning93 likangning93 deleted the polygon-duplicate-height branch June 25, 2018 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants