Ejemplo n.º 1
0
        public TimeSeriesCollection BuildKinematics(FilteredTrajectory traj, CalibrationHelper calibrationHelper)
        {
            TimeSeriesCollection tsc = new TimeSeriesCollection(traj.Length);

            if (traj.Length == 0)
            {
                return(tsc);
            }

            tsc.AddTimes(traj.Times);
            tsc.AddComponent(Kinematics.XRaw, traj.RawXs);
            tsc.AddComponent(Kinematics.YRaw, traj.RawYs);
            tsc.AddComponent(Kinematics.X, traj.Xs);
            tsc.AddComponent(Kinematics.Y, traj.Ys);

            Func <int, PointF> getCoord;

            if (traj.CanFilter)
            {
                getCoord = traj.Coordinates;
            }
            else
            {
                getCoord = traj.RawCoordinates;
            }

            tsc.InitializeKinematicComponents(new List <Kinematics>()
            {
                Kinematics.LinearDistance,
                Kinematics.LinearHorizontalDisplacement,
                Kinematics.LinearVerticalDisplacement,
                Kinematics.LinearSpeed,
                Kinematics.LinearHorizontalVelocity,
                Kinematics.LinearVerticalVelocity,
                Kinematics.LinearAcceleration,
                Kinematics.LinearHorizontalAcceleration,
                Kinematics.LinearVerticalAcceleration,
            });

            ComputeDistances(tsc, calibrationHelper, getCoord);
            ComputeVelocities(tsc, calibrationHelper, getCoord);
            ComputeAccelerations(tsc, calibrationHelper, getCoord);

            return(tsc);
        }
Ejemplo n.º 2
0
        public TimeSeriesCollection BuildKinematics(Dictionary <string, FilteredTrajectory> trajs, AngleOptions angleOptions, CalibrationHelper calibrationHelper)
        {
            if (trajs == null || trajs.Count != 3)
            {
                throw new InvalidProgramException();
            }

            // Assume o, a, b keys for now.
            // We also use the "o" key as a reference, this implies that all three trajectories must have data at the same time points.
            // We must take care during tracking to keep the length of trajectories the same.
            TimeSeriesCollection tsc = new TimeSeriesCollection(trajs["o"].Length);

            tsc.AddTimes(trajs["o"].Times);

            tsc.InitializeKinematicComponents(new List <Kinematics>()
            {
                Kinematics.AngularPosition,
                Kinematics.AngularDisplacement,
                Kinematics.TotalAngularDisplacement,
                Kinematics.AngularVelocity,
                Kinematics.TangentialVelocity,
                Kinematics.AngularAcceleration,
                Kinematics.TangentialAcceleration,
                Kinematics.CentripetalAcceleration,
                Kinematics.ResultantLinearAcceleration
            });

            // Keep series in the reference unit.
            radii         = new float[tsc.Length];
            positions     = new float[tsc.Length];
            velocities    = new float[tsc.Length];
            accelerations = new float[tsc.Length];

            ComputeAngles(tsc, calibrationHelper, trajs, angleOptions);
            ComputeVelocity(tsc, calibrationHelper);
            ComputeAcceleration(tsc, calibrationHelper);

            return(tsc);
        }