Hi,
I have for 4 Cartesian3 points of a polygon and I want to create a rectangle from these (must be same with polygon).
Are there any easy way to do this except finding width/height and center point and then calculate rectangle, because it’s a waste of a memory in my case. The other way that I thought is finding westernmost long, southernmost lat, easternmost long and northernmost lat but that’s not easy as I thought.
I tried to use:
var rec = viewer.entities.add({
rectangle : {
height: 0,
coordinates : Cesium.Rectangle.fromCartesianArray(cartesianArray),
material : Cesium.Color.BLUE.withAlpha(0.5)
}
});
But the problem is, when the actual polygon was blue, rectangle created like red one even they have same coordinates because it take as westernmost, southernmost etc.:
Any ideas about it?
Here’s Sandcastle link: https://sandcastle.cesium.com
Thanks in advance.