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

Primitive exception for empty rectangle #2657

Closed
pjcozzi opened this issue Apr 22, 2015 · 4 comments
Closed

Primitive exception for empty rectangle #2657

pjcozzi opened this issue Apr 22, 2015 · 4 comments

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Apr 22, 2015

Run the following in Sandcastle:

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

var instance = new Cesium.GeometryInstance({
    geometry : new Cesium.RectangleOutlineGeometry({
        rectangle : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -100.0, 30.0)
    }),
    attributes : {
        color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)
    }
});
scene.primitives.add(new Cesium.Primitive({
    geometryInstances : instance,
    appearance : new Cesium.PerInstanceColorAppearance({
        flat : true,
        renderState : {
            lineWidth : Math.min(2.0, scene.maximumAliasedLineWidth)
        }
    })
}));

Note that the rectangle's west === east and south === north.
image
This is not an exceptional case. We should just render nothing. I suspect there is a similar issue in RectangleGeometry and probably most geometries.

@bagnell can you have a look after we finish billboards/labels on terrain?

@TomPed
Copy link
Contributor

TomPed commented Feb 8, 2016

If you change this:

rectangle : Cesium.Rectangle.fromDegrees(-100.0, 30.0, -100.0, 30.0)

to this:

rectangle : Cesium.Rectangle.fromDegrees()

I believe that you get the same error. So should we also not allow the parameters to be optional? Or should I just add and if check: if ((north === south) || (east === west)) and handle this case separately?

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Feb 8, 2016

Leave Rectangle.fromDegrees as is, and do the check in RectangleOutlineGeometry and OutlineGeometry (and most likely through the pipeline into Primitive, which should now not assume the input geometry has any vertices.

We should check the other geometries too, e.g., if all sides of a box have length zero, etc.

@TomPed
Copy link
Contributor

TomPed commented Feb 8, 2016

Gotcha, thanks.

@hpinkos
Copy link
Contributor

hpinkos commented Feb 18, 2016

Fixed in #3599

@hpinkos hpinkos closed this as completed Feb 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants