Exemplo n.º 1
0
 private void UpdateBoundaryRadius()
 {
     if (position == null)
     {
         UpdatePosition();
     }
     boundaryRadius = functionAdder.SumMany(new MonotonicFunction[] {
         Left.GetBoundaryRadius(), new Constant(leftDistanceFromOrigin),
         Right.GetBoundaryRadius(), new Constant(rightDistanceFromOrigin)
     });
 }
Exemplo n.º 2
0
        /// <summary>
        /// Determine the new reach function for this accelerating body,
        /// assuming that some of the measured properties have changed since
        /// it was last calculated.
        /// </summary>
        private void RecalculateReach()
        {
            float t  = measuredTime;
            float s0 = BodyRadius;
            float v0 = velocity.Magnitude;
            float a0 = acceleration.Magnitude;

            if (a0 != 0.0f)
            {
                float a = 0.5f * a0;
                float b = v0 - 2 * a * t;
                float c = s0 - b * t - a * t * t;
                reach = new Quadratic(a, b, c);
            }
            else if (v0 != 0)
            {
                reach = new Linear(v0, s0);
            }
            else
            {
                reach = new Constant(s0);
            }
        }
Exemplo n.º 3
0
 private void ResetProperties()
 {
     position          = null;
     boundaryRadius    = null;
     nextDiscontinuity = null;
 }