예제 #1
0
        public static Frame MakeTestFrame(int frameId, bool leftHandIncluded, bool rightHandIncluded)
        {
            Frame testFrame = new Frame(frameId, 0, 120.0f, new InteractionBox());

            if (leftHandIncluded)
            {
                testFrame.AddHand(MakeTestHand(frameId, 10, true));
            }
            if (rightHandIncluded)
            {
                testFrame.AddHand(MakeTestHand(frameId, 20, false));
            }
            return(testFrame);
        }
예제 #2
0
        public Frame TransformedCopy(Matrix trs)
        {
            Frame transformedFrame = new Frame(_id,
                                               _timestamp,
                                               _fps,
                                               new InteractionBox(InteractionBox.Center, InteractionBox.Size));

            //TODO should InteractionBox be transformed, too?

            for (int h = 0; h < this.Hands.Count; h++)
            {
                transformedFrame.AddHand(this.Hands [h].TransformedCopy(trs));
            }
            return(transformedFrame);
        }
예제 #3
0
        public Frame makeFrame(ref LEAP_TRACKING_EVENT trackingMsg)
        {
            Frame newFrame = new Leap.Frame((long)trackingMsg.info.frame_id,
                                            (long)trackingMsg.info.timestamp,
                                            trackingMsg.framerate,
                                            new InteractionBox(trackingMsg.interaction_box_center.ToLeapVector(),
                                                               trackingMsg.interaction_box_size.ToLeapVector()));

            int handStructSize   = Marshal.SizeOf(typeof(LEAP_HAND));
            int pHandArrayOffset = 0;

            for (int h = 0; h < trackingMsg.nHands; h++)
            {
                LEAP_HAND hand = LeapC.PtrToStruct <LEAP_HAND> (new IntPtr(trackingMsg.pHands.ToInt64() + pHandArrayOffset));
                pHandArrayOffset += handStructSize;

                Hand newHand = makeHand(ref hand, newFrame);
                newFrame.AddHand(newHand);
            }
            return(newFrame);
        }