Why do I get unexpected results from cartesianToCartographic?

1. A concise explanation of the problem you’re experiencing.

If I create a Cartesian3 point and I convert it to Cartographic, the longitude and latitude do not appear to be correct. This happens for every set of points I’ve tried.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

const point = Cesium.Cartesian3.fromDegrees(-53.09, -10.78, 0);

const earth = this.cesiumViewer.scene.globe.ellipsoid;

const pointLatLon = earth.cartesianToCartographic( point );

console.log( ‘pointLatLon.longitude’, pointLatLon.longitude ); //-0.9265952998837899

console.log( ‘pointLatLon.latitude’, pointLatLon.latitude );//1.070235897322923

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am trying to draw arcs to demonstrate bi-directional data. I plan on getting the midpoint, and using the meter distance and radial distance to get a consistent tilt of the arc in one way or the other so instead of the arcs being seen from above as a straight line, |, the arcs will look like an elipse, (). If I can get the midpoint, I can then get a perpendicular line to the arc, and move alone that line to get a perfect elipse.

4. The Cesium version you’re using, your operating system and browser.

“cesium”: {

“version”: “1.44.0”,

“resolved”: “https://registry.npmjs.org/cesium/-/cesium-1.44.0.tgz”,

“integrity”: “sha512-C9Tv0PivQHIQwZntcIsa4s6Z71sOxRbt8NyeZHCXozCt2oAexci4PbXc2QY8aZzyk8P+m/CNfdQsOgsK0Pd+Yg==”,

“dev”: true,

“requires”: {

“requirejs”: “2.3.5”

}

},

Mac OS 10.13.1

Google Chrome

Version 65.0.3325.181 (Official Build) (64-bit)

I tested my minimal in sandcastle and fixed some issues with it.

var cesiumViewer = new Cesium.Viewer(‘cesiumContainer’);

let point = Cesium.Cartesian3.fromDegrees(-53.09, -10.78, 0);

let earth = cesiumViewer.scene.globe.ellipsoid;

let pointLatLon = earth.cartesianToCartographic( point );

console.log( ‘pointLatLon.longitude’);

console.log( pointLatLon.longitude );

console.log( ‘pointLatLon.latitude’);

console.log( pointLatLon.latitude );

/*

pointLatLon.longitude
-0.9265952998837897
pointLatLon.latitude
-0.18814649336498868

*/

Your results look correct to me. -53.09 degrees is approx. -0.9265953 radians and -10.78 degrees is approx. -0.18814649 radians What problem are you having?

Trying to offset two arc representing bidirectional data so they’re not on top of each other. I read the Cesium.Cartesian docs for a good half hour over the span of yesterday and didn’t clue in. Thanks.