Example #1
0
        /**
         * Returns a copy of this Hand object transformed by the specifid transform matrix.
         */
        public Hand TransformedCopy(LeapTransform trs)
        {
            List <Finger> transformedFingers = new List <Finger>(5);

            for (int f = 0; f < this.Fingers.Count; f++)
            {
                transformedFingers.Add(Fingers[f].TransformedCopy(trs));
            }

            return(new Hand(
                       FrameId,
                       Id,
                       Confidence,
                       GrabStrength,
                       GrabAngle,
                       PinchStrength,
                       PinchDistance,
                       PalmWidth * trs.scale.x,
                       IsLeft,
                       TimeVisible,
                       Arm.TransformedCopy(trs),
                       transformedFingers,
                       trs.TransformPoint(PalmPosition),
                       trs.TransformPoint(StabilizedPalmPosition),
                       trs.TransformVelocity(PalmVelocity),
                       trs.TransformDirection(PalmNormal),
                       trs.TransformDirection(Direction),
                       trs.TransformPoint(WristPosition)
                       ));
        }
Example #2
0
 /**
  * Creates a copy of this arm, transformed by the specified transform.
  *
  * @param trs A LeapTransform containing the desired translation, rotation, and scale
  * of the copied arm.
  * @since 3.0
  */
 public new Arm TransformedCopy(LeapTransform trs)
 {
     return(new Arm(trs.TransformPoint(PrevJoint),
                    trs.TransformPoint(NextJoint),
                    trs.TransformPoint(Center),
                    trs.TransformDirection(Direction),
                    Length * trs.scale.z,
                    Width * trs.scale.x,
                    trs.TransformQuaternion(Rotation)));
 }
        /**
         * Does an in-place rigid transformation of a Hand.
         *
         * @param transform A LeapTransform containing the desired translation, rotation, and scale
         * to be applied to the Hand.
         */
        public static Hand Transform(this Hand hand, LeapTransform transform)
        {
            hand.PalmPosition           = transform.TransformPoint(hand.PalmPosition);
            hand.StabilizedPalmPosition = transform.TransformPoint(hand.StabilizedPalmPosition);
            hand.PalmVelocity           = transform.TransformVelocity(hand.PalmVelocity);
            hand.PalmNormal             = transform.TransformDirection(hand.PalmNormal);
            hand.Direction     = transform.TransformDirection(hand.Direction);
            hand.WristPosition = transform.TransformPoint(hand.WristPosition);
            hand.PalmWidth    *= Math.Abs(transform.scale.x);
            hand.Rotation      = transform.TransformQuaternion(hand.Rotation);

            hand.Arm.Transform(transform);

            for (int i = 5; i-- != 0;)
            {
                hand.Fingers[i].Transform(transform);
            }

            return(hand);
        }
Example #4
0
 /**
  * Creates a copy of this finger, transformed by the specified transform.
  *
  * @param trs A LeapTransform containing the desired translation, rotation, and scale
  * of the copied finger.
  * @since 3.0
  */
 public Finger TransformedCopy(LeapTransform trs)
 {
     return(new Finger(_frameId,
                       HandId,
                       Id % 10, //remove hand portion of finger Id
                       TimeVisible,
                       trs.TransformPoint(TipPosition),
                       trs.TransformVelocity(TipVelocity),
                       trs.TransformDirection(Direction),
                       trs.TransformPoint(StabilizedTipPosition),
                       Width * trs.scale.x,
                       Length * trs.scale.z,
                       IsExtended,
                       Type,
                       _bones[0].TransformedCopy(trs),
                       _bones[1].TransformedCopy(trs),
                       _bones[2].TransformedCopy(trs),
                       _bones[3].TransformedCopy(trs)));
 }
Example #5
0
 /**
  * Creates a copy of this finger, transformed by the specified transform.
  *
  * @param trs A LeapTransform containing the desired translation, rotation, and scale
  * of the copied finger.
  * @since 3.0
  */
 public Finger TransformedCopy(LeapTransform trs)
 {
     return new Finger(_frameId,
                 HandId,
                 Id % 10, //remove hand portion of finger Id
                 TimeVisible,
                 trs.TransformPoint(TipPosition),
                 trs.TransformVelocity(TipVelocity),
                 trs.TransformDirection(Direction),
                 trs.TransformPoint(StabilizedTipPosition),
                 Width * trs.scale.x,
                 Length * trs.scale.z,
                 IsExtended,
                 Type,
                 _bones[0].TransformedCopy(trs),
                 _bones[1].TransformedCopy(trs),
                 _bones[2].TransformedCopy(trs),
                 _bones[3].TransformedCopy(trs));
 }
Example #6
0
 /**
  * Creates a copy of this arm, transformed by the specified transform.
  *
  * @param trs A LeapTransform containing the desired translation, rotation, and scale
  * of the copied arm.
  * @since 3.0
  */
 public new Arm TransformedCopy(LeapTransform trs)
 {
     return new Arm(trs.TransformPoint(PrevJoint),
       trs.TransformPoint(NextJoint),
       trs.TransformPoint(Center),
       trs.TransformDirection(Direction),
       Length * trs.scale.z,
       Width * trs.scale.x,
       trs.TransformQuaternion(Rotation));
 }