本文整理汇总了C#中JointType类的典型用法代码示例。如果您正苦于以下问题:C# JointType类的具体用法?C# JointType怎么用?C# JointType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JointType类属于命名空间,在下文中一共展示了JointType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OrientedJoint
/// <summary>
/// Initializes a new instance of the <see cref="Trame.Implementation.Skeleton.OrientedJoint"/> class.
/// </summary>
/// <param name="type">Type.</param>
/// <param name="valid">If set to <c>true</c> valid.</param>
public OrientedJoint(JointType type, bool valid)
{
this.type = type;
this.isValid = valid;
orientation = new Vector4();
point = new Vector3();
}
示例2: readarmangle
public int readarmangle(Skeleton[] skeldata, JointType joint1, JointType joint2, int ang1)
{
ang1 = 0;
Vector2 joint1pos = new Vector2(0, 0);
Vector2 joint2pos = new Vector2(0, 0);
int ang = 0;
foreach (Skeleton data in skeldata)
{
if (data.TrackingState == SkeletonTrackingState.Tracked)
{
foreach (Joint joint in data.Joints)
{
if (joint.JointType == joint1)
{
joint1pos.X = joint.Position.X;
joint1pos.Y = joint.Position.Y;
}
if (joint.JointType == joint2)
{
joint2pos.X = joint.Position.X;
joint2pos.Y = joint.Position.Y;
}
}
Vector2 anglevec = joint1pos - joint2pos;
ang = (int)MathHelper.ToDegrees((float)Math.Atan2(anglevec.X, anglevec.Y));
if (ang < 0) ang += 360;
}
}
return ang;
}
示例3: ConnectedJoint
public ConnectedJoint(JointType jointType, int jointID)
{
this.jointType = jointType;
this.jointID = jointID;
this.nextJoint = null;
this.childGestureRulesCollection = new List<ChildGestureRules>();
}
示例4: Add
public void Add(Skeleton skeleton, JointType jointType)
{
var trackingID = skeleton.TrackingId;
var position = skeleton.Joints.Where(j => j.JointType == jointType).First().Position.ToVector3();
Add(position, trackingID);
}
示例5: UpdateSkeleton
public void UpdateSkeleton(JointType jt, IJoint j)
{
lock (_joints)
{
_joints[jt] = j;
}
}
示例6: Plot
void Plot(JointType centerID, JointType baseID, JointCollection joints)
{
float centerX;
float centerY;
GetCoordinates(centerID, joints, out centerX, out centerY);
float baseX;
float baseY;
GetCoordinates(baseID, joints, out baseX, out baseY);
double diameter = Math.Abs(baseY - centerY);
Ellipse ellipse = new Ellipse
{
Width = diameter,
Height = diameter,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
StrokeThickness = 4.0,
Stroke = new SolidColorBrush(Colors.Green),
StrokeLineJoin = PenLineJoin.Round
};
Canvas.SetLeft(ellipse, centerX - ellipse.Width / 2);
Canvas.SetTop(ellipse, centerY - ellipse.Height / 2);
rootCanvas.Children.Add(ellipse);
}
示例7: getDataPoint
public KinectDataPoint getDataPoint(JointType type, KinectUser user)
{
KinectDataPoint result = null;
jointMap.TryGetValue(type, out result);
return result;
}
示例8: GetRelativeVelocity
/// <summary>
/// Calculates the relative velocity of a joint referencing to a second one.</summary>
/// <param name="steady">
/// The referenctial JointType.</param>
/// <param name="moving">
/// The moving JointType of interest</param>
/// <returns>
/// Returns the relative velocity in meters</returns>
public static double GetRelativeVelocity(JointType steady, JointType moving)
{
if (!(MainWindow.jointRecords.PositionExistsAt(steady, 0) && MainWindow.jointRecords.PositionExistsAt(steady, 1) &&
MainWindow.jointRecords.PositionExistsAt(steady, 2)
&& MainWindow.jointRecords.PositionExistsAt(moving, 0) && MainWindow.jointRecords.PositionExistsAt(moving, 1)
&& MainWindow.jointRecords.PositionExistsAt(moving, 2) ))
{
return 0;
}
CameraSpacePoint d0 = SubstractedPointsAt(steady, moving, 0);
CameraSpacePoint d1 = SubstractedPointsAt(steady, moving, 1);
if (!(MainWindow.jointRecords.PositionExistsAt(steady, 3) && MainWindow.jointRecords.PositionExistsAt(steady, 3)))
{
return DistanceBetweenPoints(d0, d1) / MainWindow.jointRecords.MillisBetweenPositions(moving, 1, 0);
}
CameraSpacePoint d2 = SubstractedPointsAt(steady, moving, 2);
CameraSpacePoint d3 = SubstractedPointsAt(steady, moving, 3);
return Median(
DistanceBetweenPoints(d0, d1) * 1000.0 / MainWindow.jointRecords.MillisBetweenPositions(moving, 1, 0),
DistanceBetweenPoints(d1, d2) * 1000.0 / MainWindow.jointRecords.MillisBetweenPositions(moving, 2, 1),
DistanceBetweenPoints(d2, d3) * 1000.0 / MainWindow.jointRecords.MillisBetweenPositions(moving, 3, 2)
);
}
示例9: DrawBone
private void DrawBone(Skeleton skeleton, DrawingContext drawingContext, JointType jointType0,
JointType jointType1)
{
var joint0 = skeleton.Joints[jointType0];
var joint1 = skeleton.Joints[jointType1];
// If we can't find either of these joints, exit
if (joint0.TrackingState == JointTrackingState.NotTracked ||
joint1.TrackingState == JointTrackingState.NotTracked)
{
return;
}
// Don't draw if both points are inferred
if (joint0.TrackingState == JointTrackingState.Inferred &&
joint1.TrackingState == JointTrackingState.Inferred)
{
return;
}
// We assume all drawn bones are inferred unless BOTH joints are tracked
Pen drawPen = _inferredBonePen;
if (joint0.TrackingState == JointTrackingState.Tracked && joint1.TrackingState == JointTrackingState.Tracked)
{
drawPen = _trackedBonePen;
}
drawingContext.DrawLine(drawPen, SkeletonPointToScreen(joint0.Position),
SkeletonPointToScreen(joint1.Position));
}
示例10: DesenharMaosUsuario
public static void DesenharMaosUsuario(
this SkeletonFrame pQuadro,
KinectSensor pKinectSensor,
Canvas pCanvasParaDesenhar,
Brush pCorDesenho,
JointType pMaoParaDesenhar)
{
if (pKinectSensor == null)
throw new ArgumentNullException("kinectSensor");
if (pCanvasParaDesenhar == null)
throw new ArgumentNullException("canvasParaDesenhar");
Skeleton lEsqueleto = ObterEsqueletoUsuario(pQuadro);
if (lEsqueleto != null)
{
EsqueletoUsuarioAuxiliar lEsqueletoUsuarioAuxiliar = new EsqueletoUsuarioAuxiliar(pKinectSensor);
//desenha mao direita
//lEsqueletoUsuarioAuxiliar.DesenharUmaMaoPintura(
// lEsqueleto.Joints[JointType.HandRight],
// pCanvasParaDesenhar,
// Brushes.Aquamarine);
//desenha mao esquerda
lEsqueletoUsuarioAuxiliar.DesenharUmaMaoPintura(
//lEsqueleto.Joints[JointType.HandRight],
lEsqueleto.Joints[pMaoParaDesenhar],
pCanvasParaDesenhar,
pCorDesenho);
}
}
示例11: AdjacentJointPair
public AdjacentJointPair(JointType left, JointType right, double thresholdHeight)
{
JointTypes = Tuple.Create(left, right);
ThresholdHeight = thresholdHeight;
DeactivateJointPair();
}
示例12: SwipeCondition
public SwipeCondition(Person p, JointType leftOrRightHand)
: base(p)
{
_index = 0;
_hand = leftOrRightHand;
_checker = new Checker(p);
}
示例13: MainWindow
// MainWindow Constructor
public MainWindow()
{
InitializeComponent();
// Instantiate the wave player
_player = new SineWavePlayer();
// Set up the UI
freqLabel.Content = _player.Frequency;
ampLabel.Content = _player.Amplitude;
for (int i = 0; i < _player.frequencyDict.Count; i++)
{
keyBox.Items.Add(_player.frequencyDict.ElementAt(i).Key);
}
keyBox.SelectedIndex = 0;
// Initialize the wave player
ChangeKey();
_player.Frequency = _player.MinFreq;
// Set the starting handedness
_freqHand = JointType.HandRight;
_ampHand = JointType.HandLeft;
// Draw the guides
_freqInterval = guideCanvas.Height / 12;
//_ampInterval = guideCanvas.Height / 4;
DrawGuides();
// Instantiate and initialize the KinectHelper
_helper = new KinectHelper(true, false, true);
_helper.ToggleSeatedMode(true);
_helper.SkeletonDataChanged += new KinectHelper.SkeletonDataChangedEvent(SkeletonDataChange);
skeletonImage.Source = _helper.skeletonBitmap;
rgbImage.Source = _helper.colorBitmap;
}
示例14: GestureRecognizer
/// <summary>
/// constructor with frames and threshold
/// </summary>
/// <param name="frames">framesToCompare</param>
/// <param name="thresh">threshold</param>
/// <param name="jointToTrack">default joint</param>
public GestureRecognizer(int frames, double threshold, JointType jointToTrack)
{
_framesToCompare = frames;
_threshold = threshold;
_trackedJoint = jointToTrack;
_coordinatesList = new List<SkeletonPoint>();
}
示例15: GestureInProgress
public void GestureInProgress(long userId, int userIndex, KinectGestures.Gestures gesture,
float progress, JointType joint, Vector3 screenPos)
{
//GestureInfo.guiText.text = string.Format("{0} Progress: {1:F1}%", gesture, (progress * 100));
// if(gesture == KinectGestures.Gestures.Click && progress > 0.3f)
// {
// string sGestureText = string.Format ("{0} {1:F1}% complete", gesture, progress * 100);
// if(GestureInfo != null)
// GestureInfo.guiText.text = sGestureText;
//
// progressDisplayed = true;
// }
// else
if((gesture == KinectGestures.Gestures.ZoomOut || gesture == KinectGestures.Gestures.ZoomIn) && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, zoom={1:F1}%", gesture, screenPos.z * 100);
if(GestureInfo != null)
GestureInfo.guiText.text = sGestureText;
progressDisplayed = true;
}
else if(gesture == KinectGestures.Gestures.Wheel && progress > 0.5f)
{
string sGestureText = string.Format ("{0} detected, angle={1:F1} deg", gesture, screenPos.z);
if(GestureInfo != null)
GestureInfo.guiText.text = sGestureText;
progressDisplayed = true;
}
}