当前位置: 首页>>代码示例>>C#>>正文


C# Frame.Hand方法代码示例

本文整理汇总了C#中Frame.Hand方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.Hand方法的具体用法?C# Frame.Hand怎么用?C# Frame.Hand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frame的用法示例。


在下文中一共展示了Frame.Hand方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        public bool Update(Frame frame)
        {
            if (IsFinalized)
                return true;

            CurrentFPS = frame.CurrentFramesPerSecond;

            var hand = frame.Hand(Id);
            if (!hand.IsValid)
            {
                // Our hand is not in this frame,
                // but we won't give up for 25ms.
                if (frame.Timestamp - CurrentHandTime < 25000)
                    return true;

                // Our hand is truly gone...
                FinalHand = CurrentHand;
                DetectedHand = Hand.Invalid;
                StabilizedHand = Hand.Invalid;
                CurrentHand = Hand.Invalid;
                _Stabilized.CurrentValue = false;
                Id = 0;
                return true;
            }

            // We still exist in this frame, update current
            CurrentHand = hand;
            CurrentHandTime = frame.Timestamp;

            if (!IsStabilized)
            {
                // Check for stabilization complete
                if (_Stabilized.Update(frame))
                    StabilizedHand = hand;
            }

            _Velocity.Update(frame);
            _X.Update(frame);
            _Y.Update(frame);
            _Z.Update(frame);
            if (_Velocity.CurrentValue < 300)
            {
                _Pitch.Update(frame);
                _Roll.Update(frame);
                _Yaw.Update(frame);
            }
            _FingerCount.Update(frame);
            HandTracker.Update(frame);
            FingerTracker.Update(frame);

            return true;
        }
开发者ID:RossDay,项目名称:Leap,代码行数:52,代码来源:PersistentHand.cs

示例2: DispatchLostEvents

	private static void DispatchLostEvents(Frame newFrame, Frame oldFrame)
	{
		foreach( Hand h in oldFrame.Hands )
		{
			if( !h.IsValid )
				continue;
			if( !newFrame.Hand(h.Id).IsValid && HandLost != null )
				HandLost(h.Id);
		}
		foreach( Pointable p in oldFrame.Pointables )
		{
			if( !p.IsValid )
				continue;
			if( !newFrame.Pointable(p.Id).IsValid && PointableLost != null )
				PointableLost(p.Id);
		}
	}
开发者ID:VentorLee,项目名称:unity,代码行数:17,代码来源:LeapInput.cs

示例3: DispatchFoundEvents

	private static void DispatchFoundEvents(Frame newFrame, Frame oldFrame)
	{
		foreach( Hand h in newFrame.Hands )
		{
			if( !h.IsValid )
				continue;
			if( !oldFrame.Hand(h.Id).IsValid && HandFound != null)
				HandFound(h);
		}
		foreach( Pointable p in newFrame.Pointables )
		{
			if( !p.IsValid )
				continue;
			if( !oldFrame.Pointable(p.Id).IsValid && PointableFound != null )
				PointableFound(p);
		}
	}
开发者ID:VentorLee,项目名称:unity,代码行数:17,代码来源:LeapInput.cs

示例4: DispatchUpdatedEvents

	private static void DispatchUpdatedEvents(Frame newFrame, Frame oldFrame)
	{
		foreach( Hand h in newFrame.Hands )
		{
			if( !h.IsValid )
				continue;
			if( oldFrame.Hand(h.Id).IsValid)
				HandUpdated(h);
		}
		foreach( Pointable p in newFrame.Pointables )
		{
			if( !p.IsValid )
				continue;
			if( oldFrame.Pointable(p.Id).IsValid)
				PointableUpdated(p);
		}
	}	
开发者ID:KevinWhalen,项目名称:motion-game,代码行数:17,代码来源:LeapInputEx.cs

示例5: GetLeapHand

	public Hand GetLeapHand(Frame frame) {
		return frame.Hand (id);
	}
开发者ID:raffomania,项目名称:multiphobia,代码行数:3,代码来源:ExtendedHand.cs

示例6: DispatchLostEvents

 private static void DispatchLostEvents(Frame newFrame, Frame oldFrame)
 {
     // Iterate over hands in the previous frame
     foreach( Hand h in oldFrame.Hands )
     {
         // If this hand in the previous frame was invalid, continue
         // (A valid hand is one that contains valid tracking data)
         if( !h.IsValid )
             continue;
         // If this hand in the previous frame was valid, but is now
         // invalid, and if the HandLost event has a handler
         if( !newFrame.Hand(h.Id).IsValid && HandLost != null )
             // Fire the HandLost event for this hand
             HandLost(h.Id);
     }
     // Do the same as above for pointables (Fingers and Tools)
     // (Note that Hands are not Pointables)
     foreach( Pointable p in oldFrame.Pointables )
     {
         if( !p.IsValid )
             continue;
         if( !newFrame.Pointable(p.Id).IsValid && PointableLost != null )
             PointableLost(p.Id);
     }
 }
开发者ID:brennon,项目名称:lightitup,代码行数:25,代码来源:LeapInput.cs

示例7: DispatchUpdatedEvents

 private static void DispatchUpdatedEvents(Frame newFrame, Frame oldFrame)
 {
     // For each Hand in the new Frame
     foreach( Hand h in newFrame.Hands )
     {
         // Do nothing if the hand is invalid (fire no events)
         if( !h.IsValid )
             continue;
         // If the hand was valid in the previous Frame and is _still_
         // valid, and the HandUpdated event has a handler
         if( oldFrame.Hand(h.Id).IsValid && HandUpdated != null)
             // Fire the HandUpdated event for this Hand
             HandUpdated(h);
     }
     // Do the same as above for pointables (Fingers and Tools)
     // (Note that Hands are not Pointables)
     foreach( Pointable p in newFrame.Pointables )
     {
         if( !p.IsValid )
             continue;
         if( oldFrame.Pointable(p.Id).IsValid && PointableUpdated != null)
             PointableUpdated(p);
     }
 }
开发者ID:brennon,项目名称:lightitup,代码行数:24,代码来源:LeapInput.cs

示例8: GetRightMostHand

	Hand GetRightMostHand(Frame f) {
		Hand res = f.Hands.Rightmost;
		if (rightHandID != -1 && f.Hand (rightHandID).IsValid) {
			res = f.Hand(rightHandID);
		}else{
			rightHandID = res.Id;	
		}
		return res;
	}
开发者ID:xgrommx,项目名称:FlyFlyShootShoot,代码行数:9,代码来源:LeapController.cs

示例9: DispatchFoundEvents

 private static void DispatchFoundEvents(Frame newFrame, Frame oldFrame)
 {
     // Iterate over hands in the new frame
     foreach( Hand h in newFrame.Hands )
     {
         // If the current hand is not valid, continue (fire no events)
         if( !h.IsValid )
             continue;
         // If the current hand was not valid in the previous frame
         // and if the HandLost event has a handler
         if( !oldFrame.Hand(h.Id).IsValid && HandFound != null)
             // Fire the HandFound event for this hand
             HandFound(h);
     }
     // Do the same as above for pointables (Fingers and Tools)
     // (Note that Hands are not Pointables)
     foreach( Pointable p in newFrame.Pointables )
     {
         if( !p.IsValid )
             continue;
         if( !oldFrame.Pointable(p.Id).IsValid && PointableFound != null )
             PointableFound(p);
     }
 }
开发者ID:brennon,项目名称:lightitup,代码行数:24,代码来源:LeapInput.cs

示例10: GetLeftMostHand

	Hand GetLeftMostHand(Frame f) {
		Hand res = f.Hands.Leftmost;
		if (leftHandID != -1 && f.Hand (leftHandID).IsValid) {
			res = f.Hand(leftHandID);
		}else{
			leftHandID = res.Id;	
		}
		return res;
	}
开发者ID:xgrommx,项目名称:FlyFlyShootShoot,代码行数:9,代码来源:LeapController.cs

示例11: Translation

        /**

        /**
         * The change of position of this hand between the current frame and
         * the specified frame.
         *
         * The returned translation vector provides the magnitude and direction of
         * the movement in millimeters.
         *
         * \include Hand_translation.txt
         *
         * If a corresponding Hand object is not found in sinceFrame, or if either
         * this frame or sinceFrame are invalid Frame objects, then this method
         * returns a zero vector.
         *
         * @param sinceFrame The starting frame for computing the translation.
         * @returns A Vector representing the heuristically determined change in
         * hand position between the current frame and that specified in the
         * sinceFrame parameter.
         * @since 1.0
         */
        public Vector Translation(Frame sinceFrame)
        {
            Hand sinceHand = sinceFrame.Hand(this.Id);

            if(!sinceHand.IsValid)
                return Vector.Zero;

            return this.PalmPosition - sinceHand.PalmPosition;
        }
开发者ID:VRWizards,项目名称:VR-Project,代码行数:30,代码来源:Hand.cs

示例12: ScaleFactor

        /**
         * The scale factor derived from this hand's motion between the current frame
         * and the specified frame.
         *
         * The scale factor is always positive. A value of 1.0 indicates no
         * scaling took place. Values between 0.0 and 1.0 indicate contraction
         * and values greater than 1.0 indicate expansion.
         *
         * \include Hand_scaleFactor.txt
         *
         * The Leap Motion software derives scaling from the relative inward or outward motion of
         * a hand and its associated fingers (independent of translation
         * and rotation).
         *
         * If a corresponding Hand object is not found in sinceFrame, or if either
         * this frame or sinceFrame are invalid Frame objects, then this method
         * returns 1.0.
         *
         * @param sinceFrame The starting frame for computing the relative scaling.
         * @returns A positive value representing the heuristically determined
         * scaling change ratio of the hand between the current frame and that
         * specified in the sinceFrame parameter.
         * @since 1.0
         */
        public float ScaleFactor(Frame sinceFrame)
        {
            Hand sinceHand = sinceFrame.Hand(this.Id);

            if(!sinceHand.IsValid)
                return 1.0f;

            float thisFactor = 1 - Math.Max(this.PinchStrength, this.GrabStrength);
            float sinceFactor = 1 - Math.Max(sinceHand.PinchStrength, sinceHand.GrabStrength);

            if (thisFactor < Leap.Constants.EPSILON && sinceFactor < Leap.Constants.EPSILON)
                return 1.0f;

            //Contraction
            if(thisFactor > sinceFactor && thisFactor > Leap.Constants.EPSILON)
                return (thisFactor - sinceFactor)/thisFactor;

            //Expansion
            if(sinceFactor > thisFactor && sinceFactor > Leap.Constants.EPSILON)
                return (sinceFactor - thisFactor)/sinceFactor;

            return 1.0f;
        }
开发者ID:VRWizards,项目名称:VR-Project,代码行数:47,代码来源:Hand.cs

示例13: RotationMatrix

        /**
         * The transform matrix expressing the rotation derived from the change
         * in orientation of this hand, and any associated fingers,
         * between the current frame and the specified frame.
         *
         * \include Hand_rotationMatrix.txt
         *
         * If a corresponding Hand object is not found in sinceFrame, or if either
         * this frame or sinceFrame are invalid Frame objects, then this method
         * returns an identity matrix.
         *
         * @param sinceFrame The starting frame for computing the relative rotation.
         * @returns A transformation Matrix representing the heuristically determined
         * rotational change of the hand between the current frame and that specified
         * in the sinceFrame parameter.
         * @since 1.0
         */
        public Matrix RotationMatrix(Frame sinceFrame)
        {
            Hand sinceHand = sinceFrame.Hand(this.Id);

            if(!sinceHand.IsValid)
                return Matrix.Identity;

            return this.Basis * sinceHand.Basis.RigidInverse();
        }
开发者ID:VRWizards,项目名称:VR-Project,代码行数:26,代码来源:Hand.cs

示例14: DispatchUpdatedEvents

 private static void DispatchUpdatedEvents(Frame newFrame, Frame oldFrame)
 {
     foreach( Hand h in newFrame.Hands )
     {
         if( !h.IsValid )
             continue;
         if( oldFrame.Hand(h.Id).IsValid && HandUpdated != null)
             HandUpdated(h, !HandCloseToBoundary(h));
     }
     foreach( Pointable p in newFrame.Pointables )
     {
         if( !p.IsValid )
             continue;
         if( oldFrame.Pointable(p.Id).IsValid && PointableUpdated != null)
             PointableUpdated(p, !FingerCloseToBoundary(p) && !DraggingMode);
     }
 }
开发者ID:lzljzys,项目名称:VRAIDS,代码行数:17,代码来源:LeapInput.cs


注:本文中的Frame.Hand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。