Skip to content

Commit

Permalink
Merge pull request #5349 from klingerj/stop-time-offset-fixed
Browse files Browse the repository at this point in the history
Velocity computed using negative time offset if no valid position at positive offset.
  • Loading branch information
mramato authored May 24, 2017
2 parents 0c653d4 + cecdb54 commit b6e2d0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Change Log
* Fix picking polylines that use a depth fail appearance. [#5337](https://github.com/AnalyticalGraphicsInc/cesium/pull/5337)
* Fixed a crash when morphing from Columbus view to 3D. [#5311](https://github.com/AnalyticalGraphicsInc/cesium/issues/5311)
* Fixed a bug which prevented KML descriptions with relative paths from loading. [#5352](https://github.com/AnalyticalGraphicsInc/cesium/pull/5352)
* Fixed an issue where camera view could be invalid at the last frame of animation. [#4949](https://github.com/AnalyticalGraphicsInc/cesium/issues/4949)
* Updated documentation for Quaternion.fromHeadingPitchRoll [#5264](https://github.com/AnalyticalGraphicsInc/cesium/issues/5264)

### 1.33 - 2017-05-01
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Austin Eng](https://github.com/austinEng)
* [Shehzan Mohammed](https://github.com/shehzan10)
* [Rachel Hwang](https://github.com/rahwang)
* [Joseph Klinger](https://github.com/klingerj)
* [NICTA](http://www.nicta.com.au/)
* [Chris Cooper](https://github.com/chris-cooper)
* [Kevin Ring](https://github.com/kring)
Expand Down
16 changes: 15 additions & 1 deletion Source/DataSources/EntityView.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,24 @@ define([
var cartesian = positionProperty.getValue(time, that._lastCartesian);
if (defined(cartesian)) {
var hasBasis = false;
var invertVelocity = false;
var xBasis;
var yBasis;
var zBasis;

if (mode === SceneMode.SCENE3D) {
// The time delta was determined based on how fast satellites move compared to vehicles near the surface.
// Slower moving vehicles will most likely default to east-north-up, while faster ones will be VVLH.
deltaTime = JulianDate.addSeconds(time, 0.001, deltaTime);
JulianDate.addSeconds(time, 0.001, deltaTime);
var deltaCartesian = positionProperty.getValue(deltaTime, updateTransformCartesian3Scratch1);

// If no valid position at (time + 0.001), sample at (time - 0.001) and invert the vector
if (!defined(deltaCartesian)) {
JulianDate.addSeconds(time, -0.001, deltaTime);
deltaCartesian = positionProperty.getValue(deltaTime, updateTransformCartesian3Scratch1);
invertVelocity = true;
}

if (defined(deltaCartesian)) {
var toInertial = Transforms.computeFixedToIcrfMatrix(time, updateTransformMatrix3Scratch1);
var toInertialDelta = Transforms.computeFixedToIcrfMatrix(deltaTime, updateTransformMatrix3Scratch2);
Expand Down Expand Up @@ -114,6 +123,11 @@ define([

// Y is along the angular momentum vector (e.g. "orbit normal")
yBasis = Cartesian3.cross(zBasis, inertialDeltaCartesian, updateTransformCartesian3Scratch3);

if(invertVelocity) {
yBasis = Cartesian3.multiplyByScalar(yBasis, -1, yBasis);
}

if (!Cartesian3.equalsEpsilon(yBasis, Cartesian3.ZERO, CesiumMath.EPSILON7)) {
// X is along the cross of y and z (right handed basis / in the direction of motion)
xBasis = Cartesian3.cross(yBasis, zBasis, updateTransformCartesian3Scratch1);
Expand Down

0 comments on commit b6e2d0d

Please sign in to comment.