From 2f087015333dd629b8fca1817216f0eddf35e567 Mon Sep 17 00:00:00 2001 From: Joseph Klinger Date: Mon, 22 May 2017 16:46:53 -0400 Subject: [PATCH 1/3] Velocity computed using negative time offset if no valid position at positive offset. --- Source/DataSources/EntityView.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/DataSources/EntityView.js b/Source/DataSources/EntityView.js index b8857df00372..39fd4e7638a7 100644 --- a/Source/DataSources/EntityView.js +++ b/Source/DataSources/EntityView.js @@ -47,6 +47,7 @@ define([ var cartesian = positionProperty.getValue(time, that._lastCartesian); if (defined(cartesian)) { var hasBasis = false; + var invertVelocity = false; var xBasis; var yBasis; var zBasis; @@ -54,8 +55,16 @@ define([ 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); @@ -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); + } else { + Cartesian3.subtract(inertialCartesian, inertialDeltaCartesian, updateTransformCartesian3Scratch4); + } var inertialVelocity = Cartesian3.magnitude(updateTransformCartesian3Scratch4) * 1000.0; // meters/sec // http://en.wikipedia.org/wiki/Standard_gravitational_parameter From 2d5d7b31b548fc6bf7f99875e77e3175629bb07d Mon Sep 17 00:00:00 2001 From: Joseph Klinger Date: Mon, 22 May 2017 17:00:32 -0400 Subject: [PATCH 2/3] Updated CHANGES.md and CONTRIBUTORS.md. --- CHANGES.md | 3 ++- CONTRIBUTORS.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 62f9b059952a..96a78149e27b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,12 +13,13 @@ 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) ### 1.33 - 2017-05-01 * Breaking changes * Removed left, right, bottom and top properties from `OrthographicFrustum`. Use `OrthographicOffCenterFrustum` instead. [#5109](https://github.com/AnalyticalGraphicsInc/cesium/issues/5109) -* Added `GoogleEarthEnterpriseTerrainProvider` and `GoogleEarthEnterpriseImageryProvider` to read data from Google Earth Enterprise servers. [#5189](https://github.com/AnalyticalGraphicsInc/cesium/pull/5189). +* Added `GoogleEarthEnterpriseTerrainProvider` and `GoogleEarthEnterpriseImageryProvider` to read data from Google Earth Enterprise servers. [#5189](https://github.com/AnalyticalGraphicsInc/cesium/pull/5189). * Support for dashed polylines [#5159](https://github.com/AnalyticalGraphicsInc/cesium/pull/5159). * Added `PolylineDash` Material type. * Added `PolylineDashMaterialProperty` to the Entity API. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 19eeef970de0..3effdc0b0e2b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -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) From 46764b47e643424ef539dfb8b2dae7ad2e0112c2 Mon Sep 17 00:00:00 2001 From: Joseph Klinger Date: Tue, 23 May 2017 14:10:21 -0400 Subject: [PATCH 3/3] Fixed time offset issue for objects using VVLH view. --- Source/DataSources/EntityView.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/DataSources/EntityView.js b/Source/DataSources/EntityView.js index 39fd4e7638a7..05610b38e61f 100644 --- a/Source/DataSources/EntityView.js +++ b/Source/DataSources/EntityView.js @@ -82,11 +82,7 @@ define([ var inertialCartesian = Matrix3.multiplyByVector(toInertial, cartesian, updateTransformCartesian3Scratch5); var inertialDeltaCartesian = Matrix3.multiplyByVector(toInertialDelta, deltaCartesian, updateTransformCartesian3Scratch6); - if (invertVelocity) { - Cartesian3.subtract(inertialDeltaCartesian, inertialCartesian, updateTransformCartesian3Scratch4); - } else { - Cartesian3.subtract(inertialCartesian, inertialDeltaCartesian, updateTransformCartesian3Scratch4); - } + Cartesian3.subtract(inertialCartesian, inertialDeltaCartesian, updateTransformCartesian3Scratch4); var inertialVelocity = Cartesian3.magnitude(updateTransformCartesian3Scratch4) * 1000.0; // meters/sec // http://en.wikipedia.org/wiki/Standard_gravitational_parameter @@ -127,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);