I am using the following code to create a polyline in my ReactJs app. I am getting “DeveloperError: Expected value to be greater than or equal to0.0125, the actual value was 0” error message. Can someone please explain to me why am I getting this error?
var viewer = new Cesium.Viewer("cesiumContainer");
var redLine = viewer.entities.add({
name: "Red line on terrain",
polyline: {
positions: Cesium.Cartesian3.fromDegreesArray([180,90, 180, -90]),
width: 5,
material: Cesium.Color.RED,
clampToGround: true,
},
});
Drawing a polyline that conforms to the shape of an ellipsoid necessitates the creation of intermediate points between the specified points. Computing the number of points is dependent on the length and the desired smoothness (granularity property of PolylineGraphics) of the resulting line.
The length of the line (a geodesic) is computed using Vincenty’s inverse formula which can fail when the end points are nearly antipodal (separated by 180 degrees). This error is telling you that the points you provided are nearly antipodal. The value of 0.0125 radians is about 0.7162 degrees.
Are these two vectors that you have mentioned in this comment are of the intermediate points(used for drawing line between 2 points) that you have mentioned in your first comment?
Also sorry, I meant points (90,0) and (-90,0), which are antipodal as well.
I’ve dug further in the code and found that lines are being split at the prime- and anti-meridians when such crossings are detected which explains why some combinations work.
Did somebody found a way to determine if the primitive can be handled by Cesium?
I have some weird geometry that crash Cesium but I need to filters them to keep the application alive.