/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../chunks/vec3","../../chunks/vec3f64","./FilteredFiniteDifference","./Momentum"],(function(e,t,i,n,s,r){"use strict";let c=function(e){function i(t,i,n,s,r){var c;return(c=e.call(this,t,i,n)||this).sceneVelocity=s,c.direction=r,c}return t._inheritsLoose(i,e),i.prototype.value=function(t){return e.prototype.valueFromInitialVelocity.call(this,this.sceneVelocity,t)},i}(r.Momentum),l=function(){function e(e=300,t=12,i=.84){this.minimumInitialVelocity=e,this.stopVelocity=t,this.friction=i,this.enabled=!0,this.time=new s.FilteredFiniteDifference(.6),this.screen=[new s.FilteredFiniteDifference(.4),new s.FilteredFiniteDifference(.4)],this.scene=[new s.FilteredFiniteDifference(.6),new s.FilteredFiniteDifference(.6),new s.FilteredFiniteDifference(.6)],this.tmpDirection=n.create()}var t=e.prototype;return t.add=function(e,t,i){if(this.enabled){if(this.time.hasLastValue){if(this.time.computeDelta(i)<.015)return}this.screen[0].update(e[0]),this.screen[1].update(e[1]),this.scene[0].update(t[0]),this.scene[1].update(t[1]),this.scene[2].update(t[2]),this.time.update(i)}},t.reset=function(){this.screen[0].reset(),this.screen[1].reset(),this.scene[0].reset(),this.scene[1].reset(),this.scene[2].reset(),this.time.reset()},t.evaluateMomentum=function(){if(!this.enabled||!this.screen[0].hasFilteredDelta)return null;const e=this.screen[0].filteredDelta,t=this.screen[1].filteredDelta,i=Math.sqrt(e*e+t*t)/this.time.filteredDelta;return Math.abs(i)<this.minimumInitialVelocity?null:this.createMomentum(i,this.stopVelocity,this.friction)},t.createMomentum=function(e,t,n){i.set(this.tmpDirection,this.scene[0].filteredDelta,this.scene[1].filteredDelta,this.scene[2].filteredDelta);const s=i.length(this.tmpDirection);s>0&&i.scale(this.tmpDirection,this.tmpDirection,1/s);const r=s/this.time.filteredDelta;return new c(e,t,n,r,this.tmpDirection)},e}();e.PanPlanarMomentum=c,e.PanPlanarMomentumEstimator=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
