Exemple #1
0
 public Person(string ID, Point3D location, string gesture, trackingStates trackState,Joint leftHand, Joint rightHand, HandState leftHandState, HandState rightHandState, TrackingConfidence leftHandConfidence, TrackingConfidence rightHandConfidence)
 {
     this.ID = ID;
     this.location = location;
     this.gesture = gesture;
     this.trackingState = (int)trackState;
     this.leftHandLocation = null;
     this.rightHandLocation = null;
     if (leftHand.TrackingState == TrackingState.Tracked) {
         this.leftHandLocation = new Point3D((double)leftHand.Position.X, (double)leftHand.Position.Y, (double)leftHand.Position.Z);
         this.leftHandState = leftHandState.ToString();
         this.leftHandConfidence = leftHandConfidence.ToString();
         this.rightHandConfidence = rightHandConfidence.ToString();
     }
     if (rightHand.TrackingState == TrackingState.Tracked)
     {
         this.rightHandLocation = new Point3D((double)rightHand.Position.X, (double)rightHand.Position.Y, (double)rightHand.Position.Z);
         this.rightHandState = rightHandState.ToString();
     }
     
 }
 public TranslateRule(float changeInOrientation, float dX, float dZ, float xSpaceTran, float zSpaceTran, Point3D startingLocation)
 {
     this.changeInOrientation = changeInOrientation;
     this.dX = dX;
     this.dZ = dZ;
     this.xSpace = xSpaceTran;
     this.zSpace = zSpaceTran;
     this.startingLocation = startingLocation;
 }
        public Point3D applyTranslateRule(Point3D locationInMeters, TranslateRule translateRule)
        {

            Point3D location = new Point3D(locationInMeters.X * 1000, locationInMeters.Y * 1000, locationInMeters.Z * 1000);
            Vector vectorToStartingPoint = new Vector(location.X - translateRule.startingLocation.X, location.Z - translateRule.startingLocation.Z);

            Point3D rotatedPoint = new Point3D(
                vectorToStartingPoint.X * Math.Cos(translateRule.changeInOrientation * Math.PI / 180) + vectorToStartingPoint.Y * Math.Sin(translateRule.changeInOrientation * Math.PI / 180),//location.Z * Math.Sin(translateRule.changeInOrientation * Math.PI / 180),
                0.6,
                vectorToStartingPoint.Y * Math.Cos(translateRule.changeInOrientation * Math.PI / 180) - vectorToStartingPoint.X * Math.Sin(translateRule.changeInOrientation * Math.PI / 180));//location.X * Math.Sin(translateRule.changeInOrientation * Math.PI / 180));
            rotatedPoint.X += translateRule.dX + translateRule.startingLocation.X;
            rotatedPoint.Z += translateRule.dZ + translateRule.startingLocation.Z;
            rotatedPoint.X = Math.Round(rotatedPoint.X * 1000000000) / 1000000000 / 1000;
            rotatedPoint.Z = Math.Round(rotatedPoint.Z * 1000000000) / 1000000000 / 1000;
            //Console.WriteLine(locationInMeters.Y);
            return rotatedPoint;
        }