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


C# SkeletonPoint.ToVector3方法代码示例

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


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

示例1: Add

        public virtual void Add(SkeletonPoint position, KinectSensor sensor, Object format)
        {
            Entry newEntry = new Entry {Position = position.ToVector3(), Time = DateTime.Now};
            Entries.Add(newEntry);

            // Drawing
            if (DisplayCanvas != null)
            {
                newEntry.DisplayEllipse = new Ellipse
                {
                    Width = 4,
                    Height = 4,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    StrokeThickness = 2.0,
                    Stroke = new SolidColorBrush(DisplayColor),
                    StrokeLineJoin = PenLineJoin.Round
                };

                Vector2 vector2 = Tools.Convert(sensor.CoordinateMapper, position, format);

                float x = (float)(vector2.X * DisplayCanvas.ActualWidth);
                float y = (float)(vector2.Y * DisplayCanvas.ActualHeight);

                Canvas.SetLeft(newEntry.DisplayEllipse, x - newEntry.DisplayEllipse.Width / 2);
                Canvas.SetTop(newEntry.DisplayEllipse, y - newEntry.DisplayEllipse.Height / 2);

                DisplayCanvas.Children.Add(newEntry.DisplayEllipse);
            }

            // Remove too old positions
            if (Entries.Count > WindowSize)
            {
                Entry entryToRemove = Entries[0];

                if (DisplayCanvas != null)
                {
                    DisplayCanvas.Children.Remove(entryToRemove.DisplayEllipse);
                }

                Entries.Remove(entryToRemove);
            }

            // Look for gestures
            LookForGesture();
        }
开发者ID:ushadow,项目名称:kinect_toolbox,代码行数:46,代码来源:GestureDetector.cs

示例2: Add

        /// <summary>
        /// Adds the skeleton point to the positions being tracked by the gesture detector.
        /// Checks if the gesture has been detected.
        /// </summary>
        /// <param name="position">The position of the joint being tracked.</param>
        public virtual void Add(SkeletonPoint position)
        {
            if (this.GestureDetected == GestureType.None)
            {
                GestureEntry newEntry = new GestureEntry(position.ToVector3(), DateTime.UtcNow);
                this.GestureEntries.Add(newEntry);
                if (this.GestureEntries.Count > this.MaxRecordedPositions)
                {
                    this.GestureEntries.RemoveAt(0);
                }

                this.LookForGesture();
            }
        }
开发者ID:K-Cully,项目名称:SticKart,代码行数:19,代码来源:GestureDetector.cs


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