Exemplo n.º 1
0
        /// <summary>
        /// Norm of accelation
        /// </summary>
        /// <param name="acceleration">Acceleration</param>
        /// <returns>Norm</returns>
        public static double Norm(this IAccelerationData acceleration)
        {
            double x = acceleration.AccelerationX;
            double y = acceleration.AccelerationY;
            double z = acceleration.AccelerationZ;

            return(Math.Sqrt(x * x + y * y + z * z));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Product of acceleration data by coeffient
 /// </summary>
 /// <param name="acceleration">Acceleration data</param>
 /// <param name="coefficient">Coefficient</param>
 /// <returns>Product</returns>
 public static double[] Product(this IAccelerationData acceleration, double coefficient)
 {
     double[] output = new double[3];
     output[0] = coefficient * acceleration.AccelerationX;
     output[1] = coefficient * acceleration.AccelerationY;
     output[2] = coefficient * acceleration.AccelerationZ;
     return(output);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Power of the norm
 /// </summary>
 /// <param name="acceleration">Acceleration</param>
 /// <param name="power">Power</param>
 /// <returns>Power of the norm</returns>
 public static double NormPower(this IAccelerationData acceleration, double power)
 {
     return(Math.Pow(acceleration.Norm(), power));
 }
Exemplo n.º 4
0
 void IAccelerationData.Copy(IAccelerationData accelerationData)
 {
     accelerationX = accelerationData.AccelerationX;
     accelerationY = accelerationData.AccelerationY;
     accelerationZ = accelerationData.AccelerationZ;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor from prototype
 /// </summary>
 /// <param name="data">The prototype</param>
 public AccelerationData(IAccelerationData data)
 {
     (this as IAccelerationData).Copy(data);
 }