Example #1
0
        /// <summary>
        /// 指定された点により近いユーザーをアクティブにする
        /// </summary>
        /// <param name="skeletons"></param>
        public static void SetActivePlayerAtCenter(SkeletonStream stream, SkeletonFrame frame, SkeletonPoint centerPosition)
        {
            Skeleton player   = null;
            double   distance = 100;

            var skeletons = frame.ToSkeletonData();

            foreach (var skeleton in skeletons)
            {
                if (skeleton.TrackingState != SkeletonTrackingState.NotTracked)
                {
                    double new_ = Distance_XY(centerPosition, skeleton.Position);
                    if ((new_ < distance))
                    {
                        player   = skeleton;
                        distance = new_;
                    }
                }
            }

            if (player != null)
            {
                stream.ChooseSkeletons(player.TrackingId);
            }
            else
            {
                stream.ChooseSkeletons();
            }
        }
Example #2
0
 // trackedなスケルトンのSkeletonDataを返す
 public static IEnumerable <Skeleton> GetTrackedSkeletons(this SkeletonFrame skeletonFrame)
 {
     return(from s in skeletonFrame.ToSkeletonData()
            where s.TrackingState == SkeletonTrackingState.Tracked
            select s);
 }
Example #3
0
 /// <summary>
 /// 場所のみ追跡しているスケルトンの一覧を取得する
 /// </summary>
 /// <param name="frame"></param>
 /// <returns></returns>
 public static IEnumerable <Skeleton> GetTrackedOrPositionOnlySkeleton(this SkeletonFrame frame)
 {
     return(from s in frame.ToSkeletonData()
            where s.TrackingState != SkeletonTrackingState.NotTracked
            select s);
 }