本文整理汇总了C#中Microsoft.Kinect.SkeletonPoint.To2DPoint方法的典型用法代码示例。如果您正苦于以下问题:C# SkeletonPoint.To2DPoint方法的具体用法?C# SkeletonPoint.To2DPoint怎么用?C# SkeletonPoint.To2DPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Kinect.SkeletonPoint
的用法示例。
在下文中一共展示了SkeletonPoint.To2DPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePushEvent
private void HandlePushEvent(SkeletonPoint pt, bool isPlayerOne)
{
if (selectingBall) return;
SeesawObject pushedBall = null;
PointCanvas ballHolder = null;
var heldBalls = isPlayerOne ? game.PlayerOneHeldBalls : game.PlayerTwoHeldBalls;
var ballHolders = isPlayerOne ? _playerOneBallHolders : _playerTwoBallHolders;
foreach (var holder in ballHolders)
{
Rect rect = holder.GetBoundaryRect();
if (rect.Contains(pt.To2DPoint()))
{
if (holder.Children.Count > 0)
{
pushedBall = (SeesawObject) holder.Children[0];
ballHolder = holder;
}
}
}
if (pushedBall != null)
{
int index = heldBalls.IndexOf(pushedBall);
HitBall(index, new Vector(0, 0), isPlayerOne);
}
}
示例2: HitTestRects
/// <summary>
/// Checks whether the joint hit a rectangle and if so, return the index of the rect it hit
/// </summary>
/// <param name="skelPt">The skeleton point to check</param>
/// <returns>The index of the rectangle hit if found; otherwise -1</returns>
private int HitTestRects(SkeletonPoint skelPt)
{
Point pt = skelPt.To2DPoint();
for (int i = 0; i < HitRectangles.Count; i++)
{
if (HitRectangles[i].Contains(pt))
{
return i;
}
}
return -1;
}