Пример #1
0
        /// <summary>
        /// Get the average of the included states
        /// </summary>
        /// <returns>The average states</returns>
        public StateBase GetAverage()
        {
            if (this._w == 0)
            {
                return(null);
            }
            UV location  = this._location / this._w;
            UV direction = this._direction.Copy();

            direction.Unitize();
            UV velocity = this._velocity / this._w;

            return(new StateBase(location, direction, velocity));
        }
Пример #2
0
 private UV getDirection(double time)
 {
     if (this._interpolate_direction_U != null && this._interpolate_direction_V != null)
     {
         UV direction = new UV(this._interpolate_direction_U.Interpolate(time), this._interpolate_direction_V.Interpolate(time));
         direction.Unitize();
         return(direction);
     }
     else
     {
         UV spline    = new UV(this._interpolate_location_U.Differentiate(time), this._interpolate_location_V.Differentiate(time));
         UV linear    = new UV(this._ULinearInterpolation.Differentiate(time), this._VLinearInterpolation.Differentiate(time));
         UV direction = this._curvature * spline + (1.0d - this._curvature) * linear;
         direction.Unitize();
         return(direction);
     }
 }