本文整理汇总了C#中SkeletonJoint类的典型用法代码示例。如果您正苦于以下问题:C# SkeletonJoint类的具体用法?C# SkeletonJoint怎么用?C# SkeletonJoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkeletonJoint类属于命名空间,在下文中一共展示了SkeletonJoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IterateHierarchyForSkeletonRecursive
private void IterateHierarchyForSkeletonRecursive(SceneGraph curNode, List<SkeletonJoint> jointList, int parentId)
{
switch (curNode.NodeType)
{
case J3DFormat.HierarchyDataTypes.NewNode:
parentId = jointList.Count - 1;
break;
case J3DFormat.HierarchyDataTypes.Joint:
J3DFormat.Joint j3dJoint = _file.Joints.GetJoint(curNode.DataIndex);
SkeletonJoint joint = new SkeletonJoint();
joint.Name = _file.Joints.GetString(_file.Joints.GetStringTableEntry(_file.Joints.GetStringIndex(curNode.DataIndex))); //Todo: You have got to be kidding me.
Vector3 jointAngles = j3dJoint.GetRotation().ToDegrees();
joint.Rotation = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(jointAngles.X)) * Matrix4.CreateRotationY(MathHelper.DegreesToRadians(jointAngles.Y)) * Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(jointAngles.Z));
//joint.Rotation.Normalize();
joint.Position = j3dJoint.GetTranslation();
joint.ParentId = parentId;
joint.Scale = j3dJoint.GetScale();
Console.WriteLine("{0} - Pos: {1} Rot: {2}", joint, joint.Position, jointAngles);
jointList.Add(joint);
break;
}
foreach (SceneGraph child in curNode.Children)
{
IterateHierarchyForSkeletonRecursive(child, jointList, parentId);
}
}
示例2: MoveTransform
void MoveTransform( uint userId, SkeletonJoint joint, Transform dest)
{
SkeletonJointPosition pos = new SkeletonJointPosition();
this.skeletonCapbility.GetSkeletonJointPosition(userId, joint, ref pos);
Vector3 v3pos = new Vector3(pos.position.X, pos.position.Y, pos.position.Z);
dest.position = (v3pos / scale) + bias;
}
示例3: getJointVector3
Vector3 getJointVector3(uint user, SkeletonJoint joint)
{
SkeletonJointPosition pos = new SkeletonJointPosition ();
skeletonCapability.GetSkeletonJointPosition (user, joint, ref pos);
Vector3 v3pos = new Vector3 (-pos.position.X, pos.position.Y, pos.position.Z);
return v3pos / scale + bias;
}
示例4: GetReferenceSkeletonJointTransform
/// @brief Gets a reference joint position and orientation on the joint.
///
/// This method gets the reference joint information for the joint. The reference
/// is the joint position and transformation at the time when the user was chosen AND
/// started tracking.
/// @param joint The joint we want information on.
/// @param referenceTransform [out] The reference Transform.
/// @return True on success and false on failure (e.g. an illegal joint or the user is not tracking).
public bool GetReferenceSkeletonJointTransform(SkeletonJoint joint, out SkeletonJointTransformation referenceTransform)
{
referenceTransform=NIPlayerCandidateObject.m_InitializedZero;
if(!Valid)
return false;
return m_user.GetReferenceSkeletonJointTransform(joint, out referenceTransform);
}
示例5: GetReferenceSkeletonJointTransform
/// @brief Gets a reference joint position and orientation on the joint.
///
/// This method gets the reference joint information for the joint. The reference
/// is the joint position and transformation at the time when the user was chosen AND
/// started tracking.
/// @param joint The joint we want information on.
/// @param referenceTransform [out] The reference Transform.
/// @return True on success and false on failure (e.g. an illegal joint or the user is not tracking).
public bool GetReferenceSkeletonJointTransform(SkeletonJoint joint, out SkeletonJointTransformation referenceTransform)
{
referenceTransform = m_InitializedZero;
if (m_playerStatus != UserStatus.Tracking || m_openNIUserID <= 0)
return false;
referenceTransform = m_referenceSkeletonJointTransform[joint];
return true;
}
示例6: UpdateJointInfoForJoint
/// @brief Utility method to update JointInfo for the joint
///
/// @param joint the joint we want to update the info for
/// @param jointPos the position of the joint
/// @param posConf the confidence of the position of the joint
/// @param jointRot the quaternion rotation of the joint
/// @param rotConf the confidence of the rotation of the joint
public virtual void UpdateJointInfoForJoint(SkeletonJoint joint, Vector3 jointPos, float posConf, Quaternion jointRot, float rotConf)
{
if (m_jointsInfo[(int)joint] == null)
return; // irrelevant joint
m_jointsInfo[(int)joint].m_jointPos = jointPos;
m_jointsInfo[(int)joint].m_posConfidence = posConf;
m_jointsInfo[(int)joint].m_rotation = jointRot;
m_jointsInfo[(int)joint].m_rotConfidence = rotConf;
}
示例7: GetJointPosition
SkeletonJointPosition GetJointPosition(uint user, SkeletonJoint joint)
{
SkeletonJointPosition pos = new SkeletonJointPosition();
this.skeletonCapbility.GetSkeletonJointPosition(user, joint, ref pos);
if (pos.position.Z == 0)
{
pos.fConfidence = 0;
}
else
{
pos.position = this.depth.ConvertRealWorldToProjective(pos.position);
}
return pos;
}
示例8: DrawLine
// 骨格の線を引く
void DrawLine(int player, SkeletonJoint eJoint1, SkeletonJoint eJoint2)
{
// 各箇所の座標を取得する
SkeletonJointPosition joint1 = skelton.GetSkeletonJointPosition(player, eJoint1);
SkeletonJointPosition joint2 = skelton.GetSkeletonJointPosition(player, eJoint2);
if (joint1.Confidence < 0.5 || joint2.Confidence < 0.5) {
return;
}
// 現実の座標から画面の座標に変換する
Point3D[] pt = new Point3D[] { joint1.Position, joint2.Position };
pt = depth.ConvertRealWorldToProjective(pt);
Graphics g = Graphics.FromImage(bitmap);
g.DrawLine(pen, pt[0].X, pt[0].Y, pt[1].X, pt[1].Y);
}
示例9: GetSkeletonJoint
/// @brief Gets the current joint transformation for a specific joint
///
/// @param joint The joint we want the transformation to.
/// @param curTransform [out] The current joint transformation
/// @return True on success and false on failure (e.g. the user is not tracking).
/// @note An exception might occur if there is an error (e.g. an illegal joint is used).
public bool GetSkeletonJoint(SkeletonJoint joint, out SkeletonJointTransformation curTransform)
{
curTransform = NIPlayerCandidateObject.m_InitializedZero;
if (!Tracking)
return false;
if (m_user.Skeleton == null)
return false;
try
{
curTransform = m_user.Skeleton.GetSkeletonJoint(m_user.OpenNIUserID, joint);
}
catch
{
return false;
}
return true;
}
示例10: DrawOrientation
public void DrawOrientation(ref WriteableBitmap image, int id, UserGenerator userGenerator, SkeletonJoint joint, Point3D corner)
{
SkeletonJointOrientation orientation = new SkeletonJointOrientation();
SkeletonJointPosition position = new SkeletonJointPosition();
position = userGenerator.SkeletonCapability.GetSkeletonJointPosition(id, joint);
orientation = userGenerator.SkeletonCapability.GetSkeletonJointOrientation(id, joint);
if (position.Confidence != 1 && orientation.Confidence != 1)
{
return;
}
SkeletonJointPosition v1 = new SkeletonJointPosition();
SkeletonJointPosition v2 = new SkeletonJointPosition();
v1.Confidence = v2.Confidence = 1;
v1.Position = position.Position;
v2.Position = new Point3D(v1.Position.X + 100 * orientation.X1,
v1.Position.Y + 100 * orientation.Y1,
v1.Position.Z + 100 * orientation.Z1);
DrawTheLine(ref image, ref v1, ref v2);
v1.Position = position.Position;
v2.Position = new Point3D(v1.Position.X + 100 * orientation.X2,
v1.Position.Y + 100 * orientation.Y2,
v1.Position.Z + 100 * orientation.Z2);
DrawTheLine(ref image, ref v1, ref v2);
v1.Position = position.Position;
v2.Position = new Point3D(v1.Position.X + 100 * orientation.X3,
v1.Position.Y + 100 * orientation.Y3,
v1.Position.Z + 100 * orientation.Z3);
DrawTheLine(ref image, ref v1, ref v2);
}
示例11: RecognitionCorrectionHint
public RecognitionCorrectionHint(SkeletonJoint joint = SkeletonJoint.NUM_JOINTS, float dirX = 0, float dirY = 0, float dirZ = 0,
bool isAngle = false, ChangeType changeType = ChangeType.SPEED, ChangeDirection changeDir = ChangeDirection.DIFFERENT, int failedState = -1)
{
m_joint = joint;
m_dirX = dirX;
m_dirY = dirY;
m_dirZ = dirZ;
m_isAngle = isAngle;
m_changeType = changeType;
m_changeDirection = changeDir;
m_failedState = failedState;
}
示例12: InitJoint
/// @brief Initializes the joint
///
/// @note a line containing a joint not initialized will not be drawn. This means that it is
/// possible to use a debugger with lots of lines and connect it to a skeleton controller with few
/// joints. The skeleton controller is responsible for setting the joints and therefore irrelevant
/// joints will simply not be used.
/// @param joint the joint to initialize.
public virtual void InitJoint(SkeletonJoint joint)
{
m_jointsInfo[(int)joint] = new JointInfo();
}
示例13: DebugLineDef
/// constructor. Sets the source and target to invalid.
public DebugLineDef()
{
m_source = SkeletonJoint.Invalid;
m_target = SkeletonJoint.Invalid;
}
示例14: GetSkeletonJointPosition
/// @brief Gets the current joint position for a specific joint
///
/// @param joint The joint we want the position to.
/// @param curPos [out] The current joint rotation
/// @return True on success and false on failure (e.g. the user is not tracking).
/// @note An exception might occur if there is an error (e.g. an illegal joint is used).
public bool GetSkeletonJointPosition(SkeletonJoint joint, out SkeletonJointPosition curPos)
{
curPos = NIPlayerCandidateObject.m_InitializedZero.Position;
if (!Tracking)
return false;
if (m_user.Skeleton == null)
return false;
try
{
curPos = m_user.Skeleton.GetSkeletonJointPosition(m_user.OpenNIUserID, joint);
}
catch
{
return false;
}
return true;
}
示例15: UpdateJointPosition
/// @brief a utility method to update joint position
///
/// This utility method receives a joint and unscaled position (x,y,z) and moves the joint there.
/// it makes sure the joint has been attached and that scale is applied.
/// @param joint The joint to update (the method makes sure it is legal)
/// @param xPos The unscaled position along the x axis (scale will be applied)
/// @param yPos The unscaled position along the y axis (scale will be applied)
/// @param zPos The unscaled position along the z axis (scale will be applied)
protected void UpdateJointPosition(SkeletonJoint joint, float xPos, float yPos, float zPos)
{
if(((int)joint)>=m_jointTransforms.Length || m_jointTransforms[(int)joint] == null)
return; // an illegal joint
Vector3 tmpPos = Vector3.zero;
tmpPos.x = xPos;
tmpPos.y = yPos;
tmpPos.z = zPos;
tmpPos *= m_scale;
m_jointTransforms[(int)joint].localPosition = tmpPos;
}