Пример #1
0
            public PickOrDropEvent(string conditionOrder, int newSessionID, HaikuStudyCondition newCondition, bool isPickUp, Point location, int userNum, int isInvasion,
                WordBox inBox)
            {
                timestamp = (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds;
                sessionID = newSessionID;
                currentCondition = newCondition;

                secondsSinceStart = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;

                if (isPickUp)
                {
                    pickUpEvent = 1;
                    dropEvent = 0;
                }
                else
                {
                    pickUpEvent = 0;
                    dropEvent = 1;
                }

                locationOfEvent = location;

                user = userNum;
                isAnInvasion = isInvasion;

                box = WordBox.CreateWordBox("", -1.0f, WordBoxCategory.None);
                box.Location = new Point(-1, -1);
                box.originalLocation = new Point(-1, -1);

                if (inBox != null)
                {
                    box.Location = inBox.Location;
                    box.originalLocation = inBox.originalLocation;
                    box.setWord(inBox.textString);
                }
            }
Пример #2
0
            public CrossingEvent(string conditionOrder, int newSessionID, HaikuStudyCondition newCondition, double duration, double maxCrossDist,
                double intersectionDuration, double maxIntersectionArea, bool isBlobIntersection, int user1Blame, int user2Blame)
            {
                timestamp = (DateTime.Now - new DateTime(1970, 1, 1)).TotalMilliseconds;
                sessionID = newSessionID;
                currentCondition = newCondition;

                secondsSinceStart = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;

                durationOfCrossing = duration;
                maxCrossAmount = maxCrossDist;

                durationOfBlobIntersection = intersectionDuration;
                maxBlobIntersectionArea = maxIntersectionArea;
                isBlobIntersectionBit = isBlobIntersection ? 1 : 0;

                user1AtFault = user1Blame;
                user2AtFault = user2Blame;
            }
Пример #3
0
            public MainLogEntry(Point mouse1Location, Point mouse2Location, bool is1Down, bool is2Down, 
                string conditionOrder, int newSessionID, HaikuStudyCondition newCondition, bool areBlocked)
            {
                timestamp = (DateTime.Now - new DateTime (1970, 1, 1)).TotalMilliseconds;
                sessionID = newSessionID;
                currentCondition = newCondition;
                secondsSinceBeginning = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;

                currentBlobIntersectionArea = Program.mainForm.blobOverlap;
                user1AtFault = Program.mainForm.user1AtFault ? 1 : 0;
                user2AtFault = Program.mainForm.user2AtFault ? 1 : 0;

                mouse1 = mouse1Location;
                mouse2 = mouse2Location;
                if (positionTwoAreaRectangle.Contains(mouse1Location))
                {
                    isUser1Invading = 1;
                    isUser1OnAPaper = 1;
                }
                else if (positionTwoAreaRectangle.Contains(mouse2Location))
                    isUser2OnAPaper = 1;

                if (positionOneAreaRectangle.Contains(mouse2Location))
                {
                    isUser2Invading = 1;
                    isUser2OnAPaper = 1;
                }
                else if (positionOneAreaRectangle.Contains(mouse1Location))
                    isUser1OnAPaper = 1;

                if (is1Down == true) is1Dragging = 1;
                else is1Dragging = 0;

                if (is2Down == true) is2Dragging = 1;
                else is2Dragging = 0;

                Point origin1 = Program.user1Origin;
                Point origin2 = Program.user2Origin;
                orderOfConditions = conditionOrder;
                lengthOfEmbodiment1 = Utilities.distanceBetweenPoints(mouse1Location, origin1);
                lengthOfEmbodiment2 = Utilities.distanceBetweenPoints(mouse2Location, origin2);

                distanceMouse1ToOrigin2 = Utilities.distanceBetweenPoints(mouse1Location, origin2);
                distanceMouse2ToOrigin1 = Utilities.distanceBetweenPoints(mouse2Location, origin1);

                //Are they crossing?
                double distance1Crossing = 0.0;
                double distance2Crossing = 0.0;
                Utilities.Segment line1 = new Utilities.Segment();
                line1.Start = origin1;
                line1.End = mouse1Location;
                Utilities.Segment line2 = new Utilities.Segment();
                line2.Start = origin2;
                line2.End = mouse2Location;

                // Blob intersection

                user1ArmUser2PaperOcclusionArea = Program.mainForm.user1ArmUser2PaperOcclusion;
                user1ArmUser2PaperAreOccluding = user1ArmUser2PaperOcclusionArea == 0 ? 0 : 1;

                user2ArmUser1PaperOcclusionArea = Program.mainForm.user2ArmUser1PaperOcclusion;
                user2ArmUser1PaperAreOccluding = user2ArmUser1PaperOcclusionArea == 0 ? 0 : 1;

                durationOfBlobsIntersecting = 0;

                if (Program.mainForm.blobOverlap == 0)
                {
                    beginBlobsIntersecting = 0;
                    areBlobsIntersecting = 0;

                    if (wereBlobsIntersecting == true)
                    {
                        //not intersecting. this is the first time we see them apart
                        endBlobsIntersecting = 1;
                        wereBlobsIntersecting = false;
                    }
                    else
                    {
                        //not intersecting, reset
                        beginBlobsIntersecting = 0;
                        endBlobsIntersecting = 0;
                    }
                }
                else
                {
                    areBlobsIntersecting = 1;
                    if (wereBlobsIntersecting == false)
                    {
                        //first time we see this intersection
                        beginBlobsIntersecting = 1;
                        endBlobsIntersecting = 0;
                        startSecondsOfBlobsIntersecting = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;
                        wereBlobsIntersecting = true;
                    }
                    else
                    {
                        //still intersecting, not first time
                        beginBlobsIntersecting = 0;
                        endBlobsIntersecting = 0;
                    }
                }

                if (Program.mainForm.blobOverlap > maxBlobIntersectionAmount)
                    maxBlobIntersectionAmount = Program.mainForm.blobOverlap;

                if (startSecondsOfBlobsIntersecting > 0)
                    durationOfBlobsIntersecting = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds - startSecondsOfBlobsIntersecting;

                if (endBlobsIntersecting == 1)
                {
                    CrossingEvent cross = new CrossingEvent(conditionOrder, sessionID, currentCondition, 0, 0, durationOfBlobsIntersecting,
                        maxBlobIntersectionAmount, true, user1AtFault, user2AtFault);
                    HaikuStudyController.crossingEventsLog.Add(cross);
                    startSecondsOfBlobsIntersecting = 0;
                    maxBlobIntersectionAmount = 0;
                }

                // Line crossing

                durationOfCrossing = 0;

                crossingPoint = Point.Empty;
                PointF? tempIntersectionPoint = Utilities.areSegmentsIntersecting(line1, line2);
                Point intersectionPoint = Point.Empty;
                if (tempIntersectionPoint == null)
                {
                    beginCrossing = 0;
                    areCrossing = 0;

                    if (wereCrossing == true)
                    {
                        //not crossing. this is the first time we see them uncrossed
                        endCrossing = 1;
                        wereCrossing = false;
                    }
                    else
                    {
                        //not crossing, reset
                        beginCrossing = 0;
                        endCrossing = 0;
                    }
                }
                else
                {
                    areCrossing = 1;
                    if (wereCrossing == false)
                    {
                        //first time we see this cross
                        beginCrossing = 1;
                        endCrossing = 0;
                        startSecondsOfCrossing = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;
                        wereCrossing = true;
                    }
                    else
                    {
                        //still crossing, not first time
                        beginCrossing = 0;
                        endCrossing = 0;
                    }

                    intersectionPoint = new Point((int)tempIntersectionPoint.Value.X, (int)tempIntersectionPoint.Value.Y);
                    crossingPoint = intersectionPoint;
                    distance1Crossing = Utilities.distanceBetweenPoints(mouse1Location, intersectionPoint);
                    distance2Crossing = Utilities.distanceBetweenPoints(mouse2Location, intersectionPoint);
                    //Console.WriteLine("crossing with distances " + distance1Crossing + " " + distance2Crossing);
                }

                howMuch1Crossing = distance1Crossing;
                howMuch2Crossing = distance2Crossing;
                if (distance1Crossing > maxCrossAmount)
                    maxCrossAmount = distance1Crossing;
                if (distance2Crossing > maxCrossAmount)
                    maxCrossAmount = distance2Crossing;

                //Distance between the two endpoints
                distanceBetweenEndPoints = Utilities.distanceBetweenPoints(mouse1Location, mouse2Location);

                //Minimum distance between mouse1 and embodiment2
                distanceBetweenMouse1Embodiment2 = Utilities.getMinimumDistanceBetweenLineAndPoint(line2, mouse1Location.X, mouse1Location.Y);

                //Minimum distance between mouse2 and embodiment1
                distanceBetweenMouse2Embodiment1 = Utilities.getMinimumDistanceBetweenLineAndPoint(line1, mouse2Location.X, mouse2Location.Y);

                if (startSecondsOfCrossing > 0)
                    durationOfCrossing = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds - startSecondsOfCrossing;

                isUser1OnOtherSide = isUser2OnOtherSide = 0;
                if (mouse1Location.X > Program.tableWidth / 2.0)
                    isUser1OnOtherSide = 1;
                if (mouse2Location.X < Program.tableHeight / 2.0)
                    isUser2OnOtherSide = 1;

                if (user1LastLocation != Point.Empty)
                    user1TotalDistance += Utilities.distanceBetweenPoints(mouse1Location, user1LastLocation);
                if (user2LastLocation != Point.Empty)
                    user2TotalDistance += Utilities.distanceBetweenPoints(mouse2Location, user2LastLocation);

                user1LastLocation = mouse1Location;
                user2LastLocation = mouse2Location;

                if (endCrossing == 1)
                {
                    CrossingEvent cross = new CrossingEvent(conditionOrder, sessionID, currentCondition, durationOfCrossing, maxCrossAmount, 0, 0, false, user1AtFault, user2AtFault);
                    HaikuStudyController.crossingEventsLog.Add(cross);
                    startSecondsOfCrossing = 0;
                    maxCrossAmount = 0;
                }

                if (areBlocked == true)
                {
                    if (wereBlocked == false)
                        startSecondsOfCrossing = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds;

                    areTheyBlocked = 1;
                    wereBlocked = true;
                }
                else if (wereBlocked == true)
                {
                    durationOfCrossing = (DateTime.Now - Utilities.experimentBeganAtTime).TotalSeconds - startSecondsOfCrossing;
                    CrossingEvent cross = new CrossingEvent(conditionOrder, sessionID, currentCondition, durationOfCrossing, maxCrossAmount, 0, 0, false, user1AtFault, user2AtFault);
                    HaikuStudyController.crossingEventsLog.Add(cross);
                    startSecondsOfCrossing = 0;
                    wereBlocked = false;
                }
            }
Пример #4
0
        public void startNextCondition()
        {
            wordBoxController.clearCurrentWordBoxes();
            currentCondition = conditions.Dequeue();

            if (currentCondition == HaikuStudyCondition.LinesSlowed
                || currentCondition == HaikuStudyCondition.LinesSlowedLess
                || currentCondition == HaikuStudyCondition.LinesSlowOne
                || currentCondition == HaikuStudyCondition.LinesSlowTwo
                || currentCondition == HaikuStudyCondition.LinesBlocking
                || currentCondition == HaikuStudyCondition.Blocking
                || currentCondition == HaikuStudyCondition.Slowed)
                isSpeedPenalty = true;
            else
                isSpeedPenalty = false;

            if ((currentCondition == HaikuStudyCondition.LinesVibrate
                || currentCondition == HaikuStudyCondition.LinesVibrateOne
                || currentCondition == HaikuStudyCondition.LinesVibrateTwo
                || currentCondition == HaikuStudyCondition.LinesMouseVibrate
                || currentCondition == HaikuStudyCondition.LinesBeltVibrate
                || currentCondition == HaikuStudyCondition.PocketVibration
                || currentCondition == HaikuStudyCondition.MouseVibration
                || currentCondition == HaikuStudyCondition.KinectArmsVibration
                || currentCondition.UsesVibration())
                && Program.isDebug == false)
            {
                isActuatePenalty = true;
                //Program.mainForm.phidgetController.setUpServos();
            }
            else
                isActuatePenalty = false;

            Program.mainForm.resetEmbodimentOrigins();
            Program.mainForm.showMyArm = false;
            Program.mainForm.showTheirArm = false;

            currentCategories.Clear();
            currentCategories = nextCategories();

            user1Category = currentCategories[1];
            user2Category = currentCategories[0];
        }