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

Large polygon triangulation produces incorrect results #2788

Closed
mramato opened this issue Jun 5, 2015 · 4 comments
Closed

Large polygon triangulation produces incorrect results #2788

mramato opened this issue Jun 5, 2015 · 4 comments

Comments

@mramato
Copy link
Contributor

mramato commented Jun 5, 2015

Via the forum

The two polygons below render fine. But if you create a single polygon where the second one is a hole in the first, you get totally incorrect results. Note, the 179.9999 is a workaround for the fact that we still fill large polygons, which I believe we have a bug on still.

var viewer = new Cesium.Viewer('cesiumContainer');

viewer.entities.add({
    polygon: {
        hierarchy:
        new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
                -179.9999, 80,
                -179.9999, -80,
                0.0, -80,
                0.0, 80])),
        material: Cesium.Color.WHITE.withAlpha(0.5)
    }
});

viewer.entities.add({
    polygon: {
        hierarchy:
        new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
                        -97.0, 31.0,
                        -97.0, 39.0,
                        -87.0, 39.0,
                        -87.0, 31.0
                    ])),
        material: Cesium.Color.BLUE.withAlpha(0.5)
    }
});
@mramato
Copy link
Contributor Author

mramato commented Jun 30, 2015

Another/better example from the forum

var viewer = new Cesium.Viewer('cesiumContainer');

Sandcastle.addDefaultToolbarButton('Outside Ring', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":1757344.1780213583,"y":647229.2581826366,"z":6076562.679864116},{"x":2652901.294209005,"y":-3818081.9914601683,"z":4351708.617454816},{"x":1708391.4177992684,"y":-6141499.230329198,"z":209100.18642667998},{"x":-518882.85347091674,"y":-4984862.003384907,"z":-3931712.274062728},{"x":-2734028.806781344,"y":-1006941.8720557253,"z":-5654757.474178011},{"x":-3628199.327763546,"y":3457493.058045505,"z":-3931712.2740627294},{"x":-2683204.532055827,"y":5782475.894605995,"z":209100.18642667856},{"x":-457314.81430675916,"y":4626715.739154917,"z":4351708.617454815},{"x":1757344.178021357,"y":647229.2581826397,"z":6076562.679864116}]},

            material : Cesium.Color.BLUE.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

Sandcastle.addToolbarButton('Inside Ring', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851},{"x":-3721636.2583392677,"y":-3387395.9853965403,"z":3905484.2649915754},{"x":-4114116.6922923024,"y":-4364787.286870347,"z":2161439.7161563924},{"x":-5049329.061953449,"y":-3873854.1936180294,"z":420676.3863324758},{"x":-5978446.167712633,"y":-2201859.6735957423,"z":-300033.82613763906},{"x":-6355767.250268093,"y":-326638.8674350246,"z":420676.38633247546},{"x":-5962391.688646079,"y":653612.7053441638,"z":2161439.716156392},{"x":-5029715.83629673,"y":164276.00972749802,"z":3905484.2649915745},{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851}]},

            material : Cesium.Color.RED.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

Sandcastle.addToolbarButton('Combined Rings', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":1757344.1780213583,"y":647229.2581826366,"z":6076562.679864116},{"x":2652901.294209005,"y":-3818081.9914601683,"z":4351708.617454816},{"x":1708391.4177992684,"y":-6141499.230329198,"z":209100.18642667998},{"x":-518882.85347091674,"y":-4984862.003384907,"z":-3931712.274062728},{"x":-2734028.806781344,"y":-1006941.8720557253,"z":-5654757.474178011},{"x":-3628199.327763546,"y":3457493.058045505,"z":-3931712.2740627294},{"x":-2683204.532055827,"y":5782475.894605995,"z":209100.18642667856},{"x":-457314.81430675916,"y":4626715.739154917,"z":4351708.617454815},{"x":1757344.178021357,"y":647229.2581826397,"z":6076562.679864116}],"holes":[{"positions":[{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851},{"x":-3721636.2583392677,"y":-3387395.9853965403,"z":3905484.2649915754},{"x":-4114116.6922923024,"y":-4364787.286870347,"z":2161439.7161563924},{"x":-5049329.061953449,"y":-3873854.1936180294,"z":420676.3863324758},{"x":-5978446.167712633,"y":-2201859.6735957423,"z":-300033.82613763906},{"x":-6355767.250268093,"y":-326638.8674350246,"z":420676.38633247546},{"x":-5962391.688646079,"y":653612.7053441638,"z":2161439.716156392},{"x":-5029715.83629673,"y":164276.00972749802,"z":3905484.2649915745},{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851}]}]},

            material : Cesium.Color.ORANGE.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

viewer.zoomTo(viewer.entities);

@pjcozzi pjcozzi changed the title Polygon triangulation produces incorrect results Large polygon triangulation produces incorrect results Jun 30, 2015
@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 30, 2015

Related: "Large filled circles fill the opposite side." #998

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 6, 2016

Can we close this given #3998?

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 6, 2016

@mramato can you update those forum threads?

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

No branches or pull requests

3 participants