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


C# Joint.Scale方法代码示例

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


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

示例1: DrawPoint

        public static void DrawPoint(this Canvas canvas, Joint joint, CoordinateMapper mapper)
        {
            if (joint.TrackingState == TrackingState.NotTracked) return;

            Point point = joint.Scale(mapper);

            Ellipse ellipse = new Ellipse
            {
                Width = 20,
                Height = 20,
                Fill = new SolidColorBrush(Colors.Red)
            };

            Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2);
            Canvas.SetTop(ellipse, point.Y - ellipse.Height / 2);

            canvas.Children.Add(ellipse);
        }
开发者ID:gw-sd-2016,项目名称:Presenting101,代码行数:18,代码来源:Extensions.cs

示例2: DrawLine

        public static void DrawLine(this Canvas canvas, Joint first, Joint second, CoordinateMapper mapper)
        {
            if (first.TrackingState == TrackingState.NotTracked || second.TrackingState == TrackingState.NotTracked) return;

            Point firstPoint = first.Scale(mapper);
            Point secondPoint = second.Scale(mapper);

            Line line = new Line
            {
                X1 = firstPoint.X,
                Y1 = firstPoint.Y,
                X2 = secondPoint.X,
                Y2 = secondPoint.Y,
                StrokeThickness = 8,
                Stroke = new SolidColorBrush(Colors.Red)
            };

            canvas.Children.Add(line);
        }
开发者ID:gw-sd-2016,项目名称:Presenting101,代码行数:19,代码来源:Extensions.cs

示例3: DrawHand

        public static void DrawHand(this Canvas canvas, Joint hand, CoordinateMapper mapper)
        {
            if (hand.TrackingState == TrackingState.NotTracked) return;

            Point point = hand.Scale(mapper);

            Ellipse ellipse = new Ellipse
            {
                Width = 100,
                Height = 100,
                Stroke = new SolidColorBrush(Colors.Red),
                StrokeThickness = 7 //4
            };

            Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2);
            Canvas.SetTop(ellipse, point.Y - ellipse.Height / 2);

            canvas.Children.Add(ellipse);
        }
开发者ID:gw-sd-2016,项目名称:Presenting101,代码行数:19,代码来源:Extensions.cs

示例4: DrawThumb

        public static void DrawThumb(this Canvas canvas, Joint thumb, CoordinateMapper mapper)
        {
            if (thumb.TrackingState == TrackingState.NotTracked) return;

            Point point = thumb.Scale(mapper);

            Ellipse ellipse = new Ellipse
            {
                Width = 40,
                Height = 40,
                Fill = new SolidColorBrush(Colors.LightBlue),
                Opacity = 0.7
            };

            Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2);
            Canvas.SetTop(ellipse, point.Y - ellipse.Height / 2);

            canvas.Children.Add(ellipse);
        }
开发者ID:Caribpa,项目名称:NPI---Kinect-2.0,代码行数:19,代码来源:Extensions.cs

示例5: CheckInitialConditions

        //kalibrierung
        void CheckInitialConditions(Joint head){            
		    if (head.Position.Z > 1.1 && head.Position.Z < 1.31){

                Point headPoint = head.Scale(_sensor.CoordinateMapper);
			    Point invisibleHeadPoint = canvas.PointFromScreen(InvisibleHead.PointToScreen(new Point()));

			    invisibleHeadPoint.X = (float)(invisibleHeadPoint.X + InvisibleHead.Width / 2);
			    invisibleHeadPoint.Y = (float)(invisibleHeadPoint.Y + InvisibleHead.Height / 2);

			    double distance = Math.Sqrt(
				    Math.Pow(
					    headPoint.X > invisibleHeadPoint.X ?
					    invisibleHeadPoint.X - headPoint.X :
					    headPoint.X - invisibleHeadPoint.X
				    , 2)
				     +
				    Math.Pow(
					    headPoint.Y > invisibleHeadPoint.Y ?
					    invisibleHeadPoint.Y - headPoint.Y :
					    headPoint.Y - invisibleHeadPoint.Y
				    , 2)
			    );

			    if (distance < 61){
				    pink.Visibility = System.Windows.Visibility.Hidden;
				    green.Visibility = System.Windows.Visibility.Visible;

				    if (countdownIsStored){
				        int elapsed =  5 - countdown.Elapsed.Seconds;

				        Countdown.Text = elapsed.ToString();

				        if (elapsed < 1){
					        countdown.Reset();
					        countdown.Start();

					        Countdown.Text = "STAAAART";

					        green.Visibility = System.Windows.Visibility.Hidden;
					        

					        actualState = GameState.ShowStart;
				        }
				    } 
				    else{
		                countdown.Reset();
				        countdown.Start();
				        countdownIsStored = true;
				    }
			    }
			    else{
				    countdownIsStored = false;

				    pink.Visibility = System.Windows.Visibility.Visible;
				    green.Visibility = System.Windows.Visibility.Hidden;

				    Countdown.Text = "Depth is OK";
			    }

		    }
		    else{
			    if (head.Position.Z < 1.1)
			        Countdown.Text = "Back!!!!";
			    else
			        Countdown.Text = "Forwardddd!!!!";

			    countdownIsStored = false;

			    pink.Visibility = System.Windows.Visibility.Visible;
			    green.Visibility = System.Windows.Visibility.Hidden;
		    }
        }
开发者ID:ylegatParticulate,项目名称:NPI---Kinect-2.0,代码行数:73,代码来源:MainWindow.xaml.cs


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