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 3 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 @@ -13,6 +13,7 @@ Change Log
* Fixed translucency bug for certain material types [#5335](https://github.com/AnalyticalGraphicsInc/cesium/pull/5335)
* 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 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
17 changes: 15 additions & 2 deletions 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 All @@ -73,7 +82,11 @@ define([
var inertialCartesian = Matrix3.multiplyByVector(toInertial, cartesian, updateTransformCartesian3Scratch5);
var inertialDeltaCartesian = Matrix3.multiplyByVector(toInertialDelta, deltaCartesian, updateTransformCartesian3Scratch6);

Cartesian3.subtract(inertialCartesian, inertialDeltaCartesian, updateTransformCartesian3Scratch4);
if (invertVelocity) {
Cartesian3.subtract(inertialDeltaCartesian, inertialCartesian, updateTransformCartesian3Scratch4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this more closely, the result here gets fed straight into Cartesian3.magnitude and not used again. So I don't think the invertVelocity flag needs to be checked here at all, as magnitude yields an absolute value. The flag does need to be checked in the VVLH section below for yBasis.

} else {
Cartesian3.subtract(inertialCartesian, inertialDeltaCartesian, updateTransformCartesian3Scratch4);
}
var inertialVelocity = Cartesian3.magnitude(updateTransformCartesian3Scratch4) * 1000.0; // meters/sec

// http://en.wikipedia.org/wiki/Standard_gravitational_parameter
Expand Down