I want to move a Cartesian3 position vertically up by x
amount of units (e.g., meters).
I DON'T want to convert it to Cartographic, add x
to the altitude and covert back to Cartesian3.
What would be the best way (performance-wise) to do this operation?
Super easy.
const position = Cesium.Cartesian3.fromDegrees(129.507780, 42.9075, 0);
const origMagnitude = Cesium.Cartesian3.magnitude(position);
const verticalAmount = 10;
const newMagnitude = origMagnitude + verticalAmount;
const scalar = newMagnitude / origMagnitude;
const newPosition = new Cesium.Cartesian3();
Cesium.Cartesian3.multiplyByScalar(position, scalar, newPosition);
Here's Sandcastle link