Example #1
0
        protected bool wandIsPaused(List <Position> positions)
        {
            bool paused = false;
            //PositionStatistics stats = new PositionStatistics(positions);
            List <Position>    lastFive      = positions.GetRange(positions.Count - 5, 5);
            PositionStatistics lastFiveStats = new PositionStatistics(lastFive);

            if (lastFiveStats.Diagonal() < 10)
            {
                paused = true;
                //Console.WriteLine("Paused. Diagonal: " + lastFiveStats.Diagonal());
            }
            //paused = true;
            return(paused);
        }
Example #2
0
        public static PositionStatistics GetStudentRaiting(List <Statistics> groupStatistics)
        {
            PositionStatistics positions = new PositionStatistics();

            var orderByMark = groupStatistics.OrderByDescending(i => i.AverageMark).ToList();

            positions.GroupPositionByMark = orderByMark.FindIndex(i => i.UserId == SimpleService.LoggedUser.Id) + 1;

            var orderByPresent = groupStatistics.OrderByDescending(i => i.PercentagePresents).ToList();

            positions.GroupPositionByPresent = orderByPresent.FindIndex(i => i.UserId == SimpleService.LoggedUser.Id) + 1;

            positions.CountStudentsInGroup = groupStatistics.Count;

            return(positions);
        }
Example #3
0
        protected override bool verifyTrigger(List <Position> positions)
        {
            bool verified = base.verifyTrigger(positions);

            if (verified)
            {
                // Verify that the start and end points are near the bottom, to avoid confusion with Tarantallegra
                PositionStatistics stats = new PositionStatistics(positions);

                if ((Math.Abs(stats.Start().point.Y - stats.yMin) > Math.Abs(stats.Start().point.Y - stats.yMax)) ||
                    (Math.Abs(stats.End().point.Y - stats.yMin) > Math.Abs(stats.End().point.Y - stats.yMax)))
                {
                    verified = false;
                }
            }

            return(verified);
        }
        protected virtual bool verifyTrigger(List <Position> positions)
        {
            PositionStatistics stats = new PositionStatistics(positions);

            StrokeDirection direction = StrokeDecomposer.determineDirection(stats.Start(), stats.End());
            double          distance  = stats.Diagonal();
            double          relativeStartAndEndDistance = stats.FractionOfTotal(stats.Start(), stats.End());

            /*
             * if (this.GetType() == typeof(Ascendio))
             * {
             *  Console.WriteLine(
             *      "Confidence: " + confidence
             + " direction: " + direction
             + " (" + stats.Start().point.ToString() + " -> " + stats.End().point.ToString() + ")"
             + " distance: " + distance + " (" + relativeStartAndEndDistance + ")");
             + }
             */

            bool verified = false;

            foreach (StrokeDirection dir in acceptableDirectionsFromStartToEndPoint)
            {
                if (dir == direction)
                {
                    verified = true;
                }
            }

            verified = verified && confidence >= minConfidence;

            verified = verified && distance >= 400.0;
            verified = verified && (relativeStartAndEndDistance * 100) >= minPercentOfTotalBetweenStartAndEndPoints;
            verified = verified && (relativeStartAndEndDistance * 100) <= maxPercentOfTotalBetweenStartAndEndPoints;

            return(verified);
        }