• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Leap.Vector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Leap.Vector的典型用法代码示例。如果您正苦于以下问题:C# Vector类的具体用法?C# Vector怎么用?C# Vector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Vector类属于Leap命名空间,在下文中一共展示了Vector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FingerData

 // Constructor for ReplayFrame
 public FingerData(int id, bool isFrontmost, float tipPosition_x, float tipPosition_y, float tipPosition_z, bool isValid)
 {
     m_id = id;
     m_isFrontmost = isFrontmost;
     m_tipPosition = new Vector(tipPosition_x, tipPosition_y, tipPosition_z);
     m_isValid = isValid;
 }
开发者ID:intuilab,项目名称:LeapIA,代码行数:8,代码来源:FingerData.cs


示例2: Matrix

 /**
    * Constructs a transformation matrix from the specified basis vectors.
    *
    * \include Matrix_Matrix_basis.txt
    *
    * @param xBasis A Vector specifying rotation and scale factors for the x-axis.
    * @param yBasis A Vector specifying rotation and scale factors for the y-axis.
    * @param zBasis A Vector specifying rotation and scale factors for the z-axis.
    * @since 1.0
    */
 public Matrix(Vector xBasis, Vector yBasis, Vector zBasis)
 {
     this._xBasis = xBasis;
     this._yBasis = yBasis;
     this._zBasis = zBasis;
     this._origin = Vector.Zero;
 }
开发者ID:VRWizards,项目名称:VR-Project,代码行数:17,代码来源:Matrix.cs


示例3: Finger

 public Finger(int frameId,
                    int handId, 
                    int fingerId,
                    float timeVisible,
                    Vector tipPosition,
                    Vector tipVelocity,
                    Vector direction,
                    Vector stabilizedTipPosition,
                    float width,
                    float length,
                    bool isExtended,
                    Finger.FingerType type,
                    Bone metacarpal,
                    Bone proximal,
                    Bone intermediate,
                    Bone distal)
 {
     _type = type;
     _bones [0] = metacarpal;
     _bones [1] = proximal;
     _bones [2] = intermediate;
     _bones [3] = distal;
     _frameId = frameId;
     _id = (handId * 10) + fingerId;
     _handID = handId;
     _tipPosition = tipPosition;
     _tipVelocity = tipVelocity;
     _direction = direction;
     _width = width;
     _length = length;
     _isExtended = isExtended;
     _isValid = false;
     _stabilizedTipPosition = stabilizedTipPosition;
     _timeVisible = timeVisible;
 }
开发者ID:VRWizards,项目名称:VR-Project,代码行数:35,代码来源:Finger.cs


示例4: OnFrame

        public override void OnFrame(Controller controller)
        {
            Pointable pointable = FindPointable(controller);

            // use the pointable movement to move the mouse
            if (null != pointable)
            {
                //SafeWriteLine("pointable: " + pointable.Id + ", " + GetPosition(pointable).ToString());

                if (HasPrevTipPosition)
                {
                    Vector tipMovement = GetPosition(pointable) - PrevTipPosition;
                    //Vector tipMovement = pointable.TipVelocity; // too noisy; need better precision for this

                    Vector mouseMovement = LeapTransform.TransformToScreenSpace(tipMovement);
                    mouseMovement.x *= MouseSensitivityX;
                    mouseMovement.y *= MouseSensitivityY;

                    // there are discontinuities in the data we get back; ignore them and only perform reasonably small movements
                    if (mouseMovement.Magnitude < 300)
                    {
                        MouseWrapper.MoveMouse((int)mouseMovement.x, (int)mouseMovement.y);
                    }
                }

                HasPrevTipPosition = true;
                PrevPointableId = pointable.Id;
                PrevTipPosition = GetPosition(pointable);
            }
            else
            {
                SafeWriteLine("No pointable");

                HasPrevTipPosition = false;
                PrevPointableId = int.MinValue;
                PrevTipPosition = null;
            }

            // convert keyboard presses into mouse clicks. We only want to do this with certain presses,
            // where the key combination would not normally cause anything to happen.  We assume that no
            // one actually presses the right shift key. :)
            if ((KeyboardWrapper.IsKeyDown(Keys.LControlKey)) && (KeyboardWrapper.IsKeyDown(Keys.Space)) && (FrameSinceLastClick > 20))
            {
                MouseWrapper.LeftClick();
                FrameSinceLastClick = 0;
            }
            else if ((KeyboardWrapper.IsKeyDown(Keys.RControlKey)) && (KeyboardWrapper.IsKeyDown(Keys.Space) && (FrameSinceLastClick > 20)))
            {
                MouseWrapper.RightClick();
                FrameSinceLastClick = 0;
            }
            else
            {
                FrameSinceLastClick += 1;
                if (FrameSinceLastClick < 0)
                {
                    FrameSinceLastClick = 20;
                }
            }
        }
开发者ID:rothda,项目名称:UniController2,代码行数:60,代码来源:UniListener.cs


示例5: ApplyPositionUpdate

 protected override void ApplyPositionUpdate(PersistentHand hand, Vector change, int velocity)
 {
     var linesToScroll = (IsInverted ? -Lines : Lines) * Math.Sign(GetX(change));
     if (IsAccelerated)
         linesToScroll *= Convert.ToInt32(Math.Floor(change.Magnitude / MinDistance));
     InputSimulator.Mouse.VerticalScroll(linesToScroll);
 }
开发者ID:RossDay,项目名称:Leap,代码行数:7,代码来源:MouseScrollAction.cs


示例6: ApplyPositionUpdate

        protected override void ApplyPositionUpdate(PersistentHand hand, Vector change, int velocity)
        {
            double scaleX;
            double scaleY;
            if (velocity > 150)
            {
                scaleX = _ScaleFactorX;
                scaleY = _ScaleFactorY;
            }
            else if (velocity > 100)
            {
                scaleX = _ScaleFactorX * 2.0 / 3.0;
                scaleY = _ScaleFactorY * 2.0 / 3.0;
            }
            else if (velocity > 50)
            {
                scaleX = _ScaleFactorX * 1.0 / 3.0;
                scaleY = _ScaleFactorY * 1.0 / 3.0;
            }
            else
            {
                scaleX = 1;
                scaleY = 1;
            }
            var x = Convert.ToInt32(GetX(change) * 2 * scaleX);
            var y = Convert.ToInt32(GetY(change) * 2 * scaleY);

            InputSimulator.Mouse.MoveMouseBy(x, -y);
        }
开发者ID:RossDay,项目名称:Leap,代码行数:29,代码来源:MouseMoveAction.cs


示例7: GetLeapMatrix

 /**
  * Provides the translation matrix to convert Leap transform data to the Unity space of a specific Unity Transform.
  * @param t The Unity Transform to which the Leap transformation data is translated
  */
 public static Matrix GetLeapMatrix(Transform t) {
   Vector xbasis = new Vector(t.right.x, t.right.y, t.right.z) * t.lossyScale.x * MM_TO_M;
   Vector ybasis = new Vector(t.up.x, t.up.y, t.up.z) * t.lossyScale.y * MM_TO_M;
   Vector zbasis = new Vector(t.forward.x, t.forward.y, t.forward.z) * -t.lossyScale.z * MM_TO_M;
   Vector trans = new Vector(t.position.x, t.position.y, t.position.z);
   return new Matrix(xbasis, ybasis, zbasis, trans);
 }
开发者ID:waltzaround,项目名称:CTEC708-BrokenVRThing,代码行数:11,代码来源:LeapUnityExtensions.cs


示例8: GestureSpace

        /// <summary>
        /// Initializes a new instance of the <see cref="Leap.GestureSpace"/> class
        /// using the predefined constants to define the workspace size.
        /// </summary>
        public GestureSpace()
        {
            Vector topLeft = new Vector(Left, 0, Top);
            Vector bottomRight = new Vector(Right, 0, Bottom);

            xz = new Rectangle((int)topLeft.x, (int)topLeft.z, (int)(bottomRight.x - topLeft.x), (int)Math.Abs(topLeft.z - bottomRight.z));
        }
开发者ID:RomeoInc,项目名称:InCarGestureInteraction,代码行数:11,代码来源:GestureSpace.cs


示例9: Finger

 /**
  * Constructs a finger.
  *
  * Generally, you should not create your own finger objects. Such objects will not
  * have valid tracking data. Get valid finger objects from a hand in a frame
  * received from the service.
  *
  * @param frameId The id of the frame this finger appears in.
  * @param handId The id of the hand this finger belongs to.
  * @param fingerId The id of this finger (handId + 0-4 for finger position).
  * @param timeVisible How long this instance of the finger has been visible.
  * @param tipPosition The position of the finger tip.
  * @param tipVelocity The velocity of the finger tip.
  * @param direction The pointing direction of the finger.
  * @param stabilizedTipPosition The stabilized tip position.
  * @param width The average width of the finger.
  * @param length The length of the finger.
  * @param isExtended Whether the finger is more-or-less straight.
  * @param type The finger name.
  * @param metacarpal The first bone of the finger (inside the hand).
  * @param proximal The second bone of the finger
  * @param intermediate The third bone of the finger.
  * @param distal The end bone.
  * @since 3.0
  */
 public Finger(long frameId,
               int handId,
               int fingerId,
               float timeVisible,
               Vector tipPosition,
               Vector tipVelocity,
               Vector direction,
               Vector stabilizedTipPosition,
               float width,
               float length,
               bool isExtended,
               Finger.FingerType type,
               Bone metacarpal,
               Bone proximal,
               Bone intermediate,
               Bone distal)
 {
   Type = type;
   _bones[0] = metacarpal;
   _bones[1] = proximal;
   _bones[2] = intermediate;
   _bones[3] = distal;
   _frameId = frameId;
   Id = (handId * 10) + fingerId;
   HandId = handId;
   TipPosition = tipPosition;
   TipVelocity = tipVelocity;
   Direction = direction;
   Width = width;
   Length = length;
   IsExtended = isExtended;
   StabilizedTipPosition = stabilizedTipPosition;
   TimeVisible = timeVisible;
 }
开发者ID:CMPUT302-W2016,项目名称:HCI-Gestures,代码行数:59,代码来源:Finger.cs


示例10: CalculateRealScreenPosition

        private void CalculateRealScreenPosition(Screen screen, Vector intersection)
        {
            CursorPositionX += (intersection.x * screen.WidthPixels - CursorPositionX) * VelocityResponse;
            CursorPositionY += ((1 - intersection.y) * screen.HeightPixels - CursorPositionY) * VelocityResponse;

            mouseFacade.SetCursorPosition((int)CursorPositionX, (int)CursorPositionY);
        }
开发者ID:ufouz1990,项目名称:leap-windows-controller,代码行数:7,代码来源:LeapMouseController.cs


示例11: PositionTracker

 public PositionTracker(PersistentHand hand, Func<PersistentHand, Vector> positionGetter, Func<PersistentHand, int> velocityGetter)
 {
     Hand = hand;
     PositionGetter = positionGetter;
     VelocityGetter = velocityGetter;
     _CurrentPosition = PositionGetter(Hand);
 }
开发者ID:RossDay,项目名称:Leap,代码行数:7,代码来源:PositionTracker.cs


示例12: DrawBasis

 public void DrawBasis(Vector position, LeapTransform basis, float scale)
 {
     Vector3 origin = position.ToVector3();
       Debug.DrawLine(origin, origin + basis.xBasis.ToVector3() * scale, Color.red);
       Debug.DrawLine(origin, origin + basis.yBasis.ToVector3() * scale, Color.green);
       Debug.DrawLine(origin, origin + basis.zBasis.ToVector3() * scale, Color.blue);
 }
开发者ID:x1angli,项目名称:Experiments,代码行数:7,代码来源:DebugHand.cs


示例13: TransformToScreenSpace

 public Vector TransformToScreenSpace(Vector leapVector)
 {
     if (Orientation.Equals(SensorOrientation.DesktopLeftward))
     {
         return new Vector(leapVector.x, -leapVector.y, 0);
     }
     else if (Orientation.Equals(SensorOrientation.MonitorLeftward))
     {
         return new Vector(leapVector.x, leapVector.z, 0);
     }
     else if (Orientation.Equals(SensorOrientation.MonitorRightward))
     {
         return new Vector(leapVector.x, -leapVector.z, 0);
     }
     else if (Orientation.Equals(SensorOrientation.MonitorSkyward))
     {
         return new Vector(-leapVector.z, leapVector.x, 0);
     }
     else if (Orientation.Equals(SensorOrientation.MonitorEarthward))
     {
         return new Vector(-leapVector.z, -leapVector.x, 0);
     }
     else
     {
         Debug.Assert(false);
         return new Vector();
     }
 }
开发者ID:rothda,项目名称:UniController2,代码行数:28,代码来源:SimpleTransform.cs


示例14: GestureDetectedEventArgs

 public GestureDetectedEventArgs(GestureType type, float speed, Vector direction, long timestamp)
 {
     m_type = type;
     m_speed = speed;
     m_direction = direction;
     m_timestamp = timestamp;
 }
开发者ID:intuilab,项目名称:LeapIA,代码行数:7,代码来源:GestureDetectedEventArgs.cs


示例15: cursorFingerVelocity

        private long TimeDifference; // difference between time stamps

        #endregion Fields

        #region Methods

        public double cursorFingerVelocity(Vector pos1, Vector pos2, Vector pos3, Vector pos4)
        {
            double fingerVelocity = 0;

            fingerVelocity = (pos1.y - pos2.y) / 0.1;

            return fingerVelocity;
        }
开发者ID:RealtaNua,项目名称:Leap_Interface,代码行数:14,代码来源:LeapListener.cs


示例16: HandData

 // Constructor for ReplayFrame
 public HandData(int id, int nbOfFingers, bool isFrontmost, float palmPosition_x, float palmPosition_y, float palmPosition_z, bool isValid)
 {
     m_id = id;
     m_nbOfFingers = nbOfFingers;
     m_isFrontmost = isFrontmost;
     m_palmPosition = new Vector(palmPosition_x, palmPosition_y, palmPosition_z);
     m_isValid = isValid;
 }
开发者ID:intuilab,项目名称:LeapIA,代码行数:9,代码来源:HandData.cs


示例17: MakeMiddleFinger

  static Finger MakeMiddleFinger(int frameId, int handId){
     //Middle Finger
     Vector position = new Vector(2.78877821918f, 4.0f, -23.252105626f);
     Vector forward = new Vector(0.0295207858556f, -0.148340452932f, -0.988495641481f);
     Vector up = new Vector(-0.145765270107f, 0.977715980076f, -0.151075968756f);
     float[]  jointLengths = {64.60f, 44.63f, 26.33f, 17.40f};
     return MakeFinger (Finger.FingerType.TYPE_MIDDLE, position, forward, up, jointLengths, frameId, handId, handId + 2);
 }
开发者ID:CMPUT302-W2016,项目名称:HCI-Gestures,代码行数:8,代码来源:TestHandFactory.cs


示例18: CreateFinger

 private static IJoint CreateFinger(Vector position, Vector normal, JointType jt)
 {
     var finger = new OrientedJoint();
     finger.JointType = jt;
     finger.Point = new Vector3(position.x, position.y, position.z);
     finger.Orientation = new Vector4(10 * normal.x, 10 * normal.y, 10 * normal.z, 0);
     return finger;
 }
开发者ID:i2e-haw-hamburg,项目名称:trame,代码行数:8,代码来源:Program.cs


示例19: LeapTransform

 public LeapTransform(Vector translation, LeapQuaternion rotation, Vector scale)
     : this()
 {
     _scale = scale;
       // these are non-trival setters.
       this.translation = translation;
       this.rotation = rotation; // Calls validateBasis
 }
开发者ID:microdee,项目名称:leappack,代码行数:8,代码来源:LeapTransform.cs


示例20: MakeThumb

  static Finger MakeThumb(int frameId, int handId){
     //Thumb
     Vector position = new Vector(19.3382610281f, -6.0f, 53.168484654f);
     Vector forward = new Vector(0.436329113772f, 0.0f, -0.899787143982f);
     Vector up = new Vector(0.804793943718f, 0.447213915513f, 0.390264553767f);
     float[] jointLengths = {0.0f, 46.22f, 31.57f, 21.67f};
     return MakeFinger (Finger.FingerType.TYPE_THUMB, position, forward, up, jointLengths, frameId, handId, handId + 0);
 }
开发者ID:CMPUT302-W2016,项目名称:HCI-Gestures,代码行数:8,代码来源:TestHandFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Legends.World类代码示例发布时间:2022-05-26
下一篇:
C# Leap.Controller类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap