Example #1
0
 /// <summary>
 /// Creates frame
 /// </summary>
 protected virtual void CreateFrame()
 {
     if (IsAcceleration)
     {
         relative = new Motion6DAcceleratedFrame();
         owp      = new Motion6DAcceleratedFrame();
     }
     else if (IsVelocity & IsAngularVelocity)
     {
         relative = new Motion6DFrame();
         owp      = new Motion6DFrame();
     }
     else if (IsAngularVelocity)
     {
         relative = new RotatedFrame();
         owp      = new RotatedFrame();
     }
     else if (IsVelocity)
     {
         relative = new MovedFrame();
         owp      = new MovedFrame();
     }
     else
     {
         relative = new ReferenceFrame();
         owp      = new ReferenceFrame();
     }
 }
        /// <summary>
        /// Creates frame
        /// </summary>
        protected override void CreateFrame()
        {
            int order = 2;

            for (int i = 0; i < measurements.Length; i++)
            {
                IMeasurement m = measurements[i];
                int          n = m.GetDerivativeOrder();
                if (n < order)
                {
                    order = n;
                }
            }
            if (order == 2)
            {
                base.CreateFrame();
                secondDeriM = new IMeasurement[7];
                for (int i = 0; i < secondDeriM.Length; i++)
                {
                    secondDeriM[i] = measurements[i].GetHigherDerivative(2);
                }
                return;
            }
            secondDeriM = null;
            bool velocity       = IsVelocity;           // Velocity support
            bool angularVelocty = IsAngularVelocity;    // Angular velocity support

            if (velocity & angularVelocty)              // If both velocity and angular velocity are supported
            {
                // Motion6DFrame implements both IVelocity and IAngularVelocity
                Relative = new Motion6DFrame();   // Relative reference frame
                owp      = new Motion6DFrame();   // Own reference frame
            }
            else if (angularVelocty)              // If angular velocity is supported
            {
                // RotatedFrame implements IAngularVelocity
                Relative = new RotatedFrame();    // Relative reference frame
                owp      = new RotatedFrame();    // Own reference frame
            }
            else if (velocity)                    // If velocity is supported
            {
                // MovedFrame implements IVelocity
                Relative = new MovedFrame();
                owp      = new MovedFrame();
            }
            else
            {
                Relative = new ReferenceFrame();  // Relative reference frame
                owp      = new ReferenceFrame();  // Own reference frame
            }
        }