Should’t “Rectangle.fromCartographicArray” function account for cases where the rectangle crosses 180 degrees longitude? I see other function like “Rectangle.contains” expect a rectangle’s east to be sometimes less than its west, I am assuming that is to cover the cases where the rectangle crosses 180 degrees?
Here is what I am doing. I compute the current minimum bounding rectangle using the code below. Then I am trying to use “Rectangle.contains” to test if a bunch cartographic points are in view.
var leftTop = camera.pickEllipsoid(new Cesium.Cartesian2(0, 0), ellipsoid);
var leftBottom = camera.pickEllipsoid(new Cesium.Cartesian2(0, canvasHeight), ellipsoid);
var rightTop = camera.pickEllipsoid(new Cesium.Cartesian2(canvasWidth, 0), ellipsoid);
var rightBottom = camera.pickEllipsoid(new Cesium.Cartesian2(canvasWidth, canvasHeight), ellipsoid);
Thanks for pointing this out! It seems to be an oversight. In the beginning, we didn’t support rectangles that crossed the 180 degrees line. We made changes to most functions to it supports it, but we seem to have missed this one.
Thanks Hannah! Sorry I did not get to it on time. I actually found today the code I posted sometimes gives values of longitude > PI because the floating point less than comparison is a toss up when it comes to equal values. I see you handled the case by making sure the final values are not greater that PI. I removed the post that had the code so people don’t pick it it by mistake.