CesiumGS / CesiumGS/cesium

Transforms.preloadIcrfFixed resolving too soon

Open
#4,638 6 comments 0 reactions 0 assignees View on GitHub
category - math type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/7xyQSQJSHk8

The function below prints out `FAILURE` the first time it runs and `SUCCESS` subsequent times you press the button. I was under the impression that if you waited for the `preloadIcrfFixed` promise to resolve, calls to `computeIcrfToFixedMatrix` should work.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer');

Sandcastle.addDefaultToolbarButton('Default styling', function() {

var start_time = new Date(1285216305688);
var stop_time = new Date(1285259505688);

var timeInterval = new Cesium.TimeInterval({
start : start_time,
stop : stop_time,
isStartIncluded : true,
isStopIncluded : true
});

var promise = Cesium.Transforms.preloadIcrfFixed(timeInterval);

promise.then(function() {

var pointInFixed = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
var fixedToIcrf = Cesium.Transforms.computeIcrfToFixedMatrix(stop_time);
var pointInInertial = new Cesium.Cartesian3();
if (Cesium.defined(fixedToIcrf)) {
pointInInertial = Cesium.Matrix3.multiplyByVector(fixedToIcrf, pointInFixed, pointInInertial);
console.log("SUCCESS");
} else{
console.log("FAILURE");
}
});
});
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Sandcastle example using Transforms.preloadIcrfFixed and computeIcrfToFixedMatrix with the supplied TimeInterval. Trace when the preload promise resolves relative to matrix availability; done means the first promise callback produces a defined matrix and the documented computation succeeds without requiring a second button press.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.