Example #1
0
        public ScenarioState finishState(ScenarioState next)
        {
            VolumeState gualState = new VolumeState(this);
            // make sure this is same state
            if (!this.isSameState(next))
            {
                if (next.GetType().Equals(this.GetType()))
                {
                    VolumeState nextState = (VolumeState)next;

                    // make gualState's start be the earlier of the two
                    if (nextState._start.CompareTo(gualState._start) < 0)
                    {
                        gualState._start = nextState._start;
                    }
                    // make gualState's start be the later of the two
                    if (nextState._end.CompareTo(gualState._end) > 0)
                    {
                        gualState._end = nextState._end;
                    }
                }
            }
            return gualState;
        }
        public override void processSkeleton(Skeleton skeleton)
        {
            if (skeleton != null)
            {

                //ONLY TO FIGURE OUT THE DISTANCE--otherwise, hardcode it into swipeLeftDetector

                Joint rightHand = skeleton.Joints[JointType.HandRight];
                double swipeCrossLine = skeleton.Joints[JointType.ShoulderRight].Position.Y;

                Boolean isRightArmStraight = this._straightArmIndicator.isRightArmStraight(skeleton, false);
                if (isRightArmStraight)
                {
                    processVolumeDecreaseRightHand(rightHand, swipeCrossLine);
                }
                else
                {
                    resetVars("right");
                    VolumeState state = new VolumeState(VolumeState.VolumePosition.NON_VOLUME, DateTime.Now, DateTime.Now);
                    this._rightHandHistory.addState(state);
                }

            }
        }
Example #3
0
 public VolumeState(VolumeState goalState)
 {
     this._start = goalState._start;
     this._end = goalState._end;
     this._pos = goalState._pos;
 }
        private void processVolumeDecreaseRightHand(Joint rightHand, double adjustCrossLine)
        {
            double curX = rightHand.Position.X;
            double curY = rightHand.Position.Y;
            double curZ = rightHand.Position.Z;

            //if right hand is right of cross line AND the person hasn't started a swipe yet, start the swipe!
            if (!this.rh_adjustInitiated)
            {
                this.rh_start.X = rightHand.Position.X;
                this.rh_start.Y = rightHand.Position.Y;
                this.rh_start.Z = rightHand.Position.Z;

                this.rh_last.X = rightHand.Position.X;
                this.rh_last.Y = rightHand.Position.Y;
                this.rh_last.Z = rightHand.Position.Z;

                this.rh_adjustInitiated = true;
                VolumeState state = new VolumeState(VolumeState.VolumePosition.ADJUST_INITIATED, DateTime.Now, DateTime.Now);
                this._rightHandHistory.addState(state);
            }
            else
            { //the swipe has been started, check if in bounds and moving to the left!

                if (stillWithinXBounds(curX, this.rh_start))
                {
                    VolumeState state = new VolumeState(VolumeState.VolumePosition.ADJUST_VOLUME, DateTime.Now, DateTime.Now);
                    this._rightHandHistory.addState(state);
                    this.rh_deltaY = curY - rh_last.Y;

                    this.rh_last.X = curX;
                    this.rh_last.Y = curY;
                    this.rh_last.Z = curZ;
                }
                else //if NOT in y bounds OR is moving to the right!
                {
                    resetVars("right");
                    VolumeState state = new VolumeState(VolumeState.VolumePosition.NON_VOLUME, DateTime.Now, DateTime.Now);
                    this._rightHandHistory.addState(state);
                }
            }
        }