Browse Source

imporve the track interpolation

tags/2.2.5
Caven Chen 4 years ago
parent
commit
60a846358f
1 changed files with 20 additions and 5 deletions
  1. 20
    5
      modules/history-track/Track.js

+ 20
- 5
modules/history-track/Track.js View File

@@ -14,7 +14,9 @@ import TrackViewMode from './TrackViewMode'

const DEF_OPTS = {
clampToGround: false,
clampToTileset: false
clampToTileset: false,
interpolationType: 'Hermite',
interpolationDegree: 2
}

const DEF_PATH_STYLE = {
@@ -301,10 +303,23 @@ class Track {
)
this._sampledPosition.forwardExtrapolationType =
Cesium.ExtrapolationType.HOLD
this._sampledPosition.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm: Cesium.HermitePolynomialApproximation
})
/// setInterpolationOptions
if (this._options.interpolationType === 'Hermite') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 2,
interpolationAlgorithm: Cesium.HermitePolynomialApproximation
})
} else if (this._options.interpolationType === 'Linear') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 1,
interpolationAlgorithm: Cesium.LinearApproximation
})
} else if (this._options.interpolationType === 'Lagrange') {
this._sampledPosition.setInterpolationOptions({
interpolationDegree: this._options.interpolationDegree || 5,
interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
})
}
this._delegate.orientation = new Cesium.VelocityOrientationProperty(
this._sampledPosition
)

Loading…
Cancel
Save