Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Velocity computed using negative time offset if no valid position at positive offset. #5349

Merged
merged 5 commits into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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