Problem creating seamless "looping" orbit

Hello Cesium team!

I am currently in the process of creating an API for poliastro that helps extract orbital data to CZML format.

My problem is I can't seem to get a seamless looping orbit no matter how much I tweak the parameters. I checked and everything seems to be fine (enough data points, correct period, ending coordinates are close to starting coordinates, I made sure I got the formatting right [passed time (seconds), x coordinate (kms), y coordinate (kms), z coordinate (kms)]) but the problem persists.

Here is the pastebin for my Sandcastle input: https://pastebin.com/fL2iW4Dm

The prototype of the extractor: https://github.com/Sedictious/poliastro/blob/CZLM/contrib/extract_czml.py

Thanks in advance,
Eleftheria

Hey Eleftheria,

Poliastro looks super cool! I’d love to see Cesium visualizing its output like that. As a quick tip, you can share a direct link to a Sandcastle by clicking “Share”. Here’s the direct link to it.

I think the problem here is that the CZML is only defined for this period of time, and when it runs out, it resets back, hence the jump when it loops.

Also, one thing that may not be obvious is that the camera is actually moving with the rotation of the Earth. If you set it to a fixed frame of reference (see the ICRF view in this Sandcastle https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Camera.html) then the orbit looks seamless (but then you’ll see a jump in the rotating globe).

Here’s your Sandcastle with the ICRF view. Let me know if that’s what you need!

Looks like this Sandcastle is too big to share! Here’s the code snippet without the CZML part:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

shouldAnimate : true

});

Sandcastle.addDefaultToolbarButton(‘Satellites’, function() {

viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));

viewer.camera.flyHome(0);

});

var scene = viewer.scene;

var clock = viewer.clock;

Sandcastle.reset = function() {

viewer.dataSources.removeAll();

};

function icrf(scene, time) {

if (scene.mode !== Cesium.SceneMode.SCENE3D) {

return;

}

var icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);

if (Cesium.defined(icrfToFixed)) {

var camera = viewer.camera;

var offset = Cesium.Cartesian3.clone(camera.position);

var transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);

camera.lookAtTransform(transform, offset);

}

}

function viewInICRF() {

viewer.camera.flyHome(0);

clock.multiplier = 3 * 60 * 60;

scene.postUpdate.addEventListener(icrf);

scene.globe.enableLighting = true;

}

viewInICRF();

``

Hello Omar,

Thanks for replying and giving me feedback! Yes, this is exactly what I had in mind and now everything works as intended (though it took me embarassingly long to figure out I messed up the reference frames).

As a quick follow-up: is there a way to change (or at least re-skin) the default earth object? I searched in the docs for a bit, but it seems like there is no non-trivial way of achieving this. If this is a welcome feature, let me know if there is anything I could at least try to help you with!

Στις Πέμ, 21 Μαρ 2019 στις 6:24 μ.μ., ο/η Omar Shehata omar.sameh.shehata@gmail.com έγραψε:

You most certainly can! Check out the imagery layers example:

Notice that you can turn off everything and just see the blue globe. You can have any custom imagery layer you like. Is that what you were thinking?

Oh yes precisely! Thank you very much for the help, it was greatly appreciated!

Στις Παρ, 22 Μαρ 2019 στις 3:18 π.μ., ο/η Omar Shehata omar.sameh.shehata@gmail.com έγραψε: