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


C# Leap.Vector类代码示例

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


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


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