本文整理汇总了C#中SkeletonJoint类的典型用法代码示例。如果您正苦于以下问题:C# SkeletonJoint类的具体用法?C# SkeletonJoint怎么用?C# SkeletonJoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkeletonJoint类属于命名空间,在下文中一共展示了SkeletonJoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:CryZe,项目名称:WindEditor,代码行数:31,代码来源:JStudioModel.cs
示例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;
}
开发者ID:rasq,项目名称:UnityWrapper,代码行数:7,代码来源:Nite3.cs
示例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;
}
开发者ID:mattsonic,项目名称:Kinect-Unity-Interface,代码行数:7,代码来源:OpenNI2.cs
示例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);
}
开发者ID:znjRoLS,项目名称:RUISAircraftGunner,代码行数:15,代码来源:NISelectedPlayer.cs
示例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;
}
开发者ID:znjRoLS,项目名称:RUISAircraftGunner,代码行数:16,代码来源:NIPlayerCandidateObject.cs
示例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;
}
开发者ID:guanwenhu,项目名称:imola-unity,代码行数:16,代码来源:NISkeletonControllerLineDebugger.cs
示例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;
}
开发者ID:kindohm,项目名称:kinect-nite-dev,代码行数:14,代码来源:Kinect.cs
示例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);
}
开发者ID:ninuxsoft,项目名称:KinectSensorProgramming,代码行数:17,代码来源:Form1_Calibration.cs
示例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;
}
开发者ID:znjRoLS,项目名称:RUISAircraftGunner,代码行数:24,代码来源:NISelectedPlayer.cs
示例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);
}
开发者ID:sterlingswigart,项目名称:SpatialController,代码行数:38,代码来源:SkeletonDraw.cs
示例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;
}
开发者ID:user-mfp,项目名称:IMI,代码行数:12,代码来源:FubiUtils.cs
示例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();
}
开发者ID:guanwenhu,项目名称:imola-unity,代码行数:11,代码来源:NISkeletonControllerLineDebugger.cs
示例13: DebugLineDef
/// constructor. Sets the source and target to invalid.
public DebugLineDef()
{
m_source = SkeletonJoint.Invalid;
m_target = SkeletonJoint.Invalid;
}
开发者ID:guanwenhu,项目名称:imola-unity,代码行数:6,代码来源:NISkeletonControllerLineDebugger.cs
示例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;
}
开发者ID:guanwenhu,项目名称:imola-unity,代码行数:23,代码来源:NISelectedPlayer.cs
示例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;
}
开发者ID:lhongzhong,项目名称:SimpleAvatar,代码行数:19,代码来源:NISkeletonController.cs
示例16: DrawLine
private void DrawLine(Graphics g, Color color, Dictionary<SkeletonJoint, SkeletonJointPosition> dict, SkeletonJoint j1, SkeletonJoint j2)
{
Point3D pos1 = dict[j1].Position;
Point3D pos2 = dict[j2].Position;
if (dict[j1].Confidence == 0 || dict[j2].Confidence == 0)
return;
g.DrawLine(new Pen(color),
new Point((int)pos1.X, (int)pos1.Y),
new Point((int)pos2.X, (int)pos2.Y));
}
开发者ID:wair,项目名称:Patched_Kinect_Drivers_for_Ubuntu,代码行数:12,代码来源:MainWindow.cs
示例17: IsJointAvailable
public bool IsJointAvailable(SkeletonJoint joint)
{
return SafeNativeMethods.xnIsJointAvailable(this.InternalObject, joint);
}
开发者ID:huangxm,项目名称:OpenNI,代码行数:4,代码来源:SkeletonCapability.cs
示例18: GetJoint3D
/// <summary>
/// Loads the 3D data for a specific skeleton joint.
/// </summary>
private void GetJoint3D(SkeletonCapability source,
int user, SkeletonJoint joint,
JointDictionary target)
{
SkeletonJointPosition pos;
if (joint == SkeletonJoint.Waist)
{
// Calculate the joint position as arithmetic mean of right
// and left hip joints, as it is not possible to poll it
// directly.
pos = new SkeletonJointPosition();
SkeletonJointPosition posLeft = source.GetSkeletonJointPosition(user, SkeletonJoint.LeftHip);
SkeletonJointPosition posRight = source.GetSkeletonJointPosition(user, SkeletonJoint.RightHip);
if (posLeft.Position.Z == 0 || posRight.Position.Z == 0)
{
pos.Confidence = 0;
pos.Position = new Point3D(
(posLeft.Position.X + posRight.Position.X) / 2,
(posLeft.Position.Y + posRight.Position.Y) / 2,
0);
}
else
{
pos.Confidence = Math.Min(posLeft.Confidence, posRight.Confidence);
pos.Position = new Point3D(
(posLeft.Position.X + posRight.Position.X) / 2,
(posLeft.Position.Y + posRight.Position.Y) / 2,
(posLeft.Position.Z + posRight.Position.Z) / 2);
}
}
else
{
pos = source.GetSkeletonJointPosition(user, joint);
if (pos.Position.Z == 0)
{
pos.Confidence = 0;
}
}
target[joint] = pos;
}
开发者ID:jmtree,项目名称:Kinect-Annotation-and-Evaluation-Tool,代码行数:46,代码来源:OpenNIImageProvider.cs
示例19: DetectVirtualRelativeTouch
/// <summary>
///
/// </summary>
/// <param name="user"></param>
/// <param name="joint"></param>
/// <param name="jointRef"></param>
/// <param name="screenPlaneZoffset"></param>
/// <returns>true if touched </returns>
private void DetectVirtualRelativeTouch(User user, uint hand, SkeletonJoint jointRef, int screenPlaneZoffset)
{
SkeletonJoint jointHand;
if (hand == 0)
{
jointHand = SkeletonJoint.LeftHand;
}
else
{
jointHand = SkeletonJoint.RightHand;
}
Point3D pos = user.Joints[jointHand].Position;
Point3D posRef = user.Joints[jointRef].Position;
InputStatus status;
//hand not probably tracked return
if (user.Joints[jointHand].Confidence < 0.6)
{
sendContact(user.updateHand(hand, InputStatus.UNKNOWN));
return;
} //if the reference is not valid, only cursor mode will be reliable
else if (user.Joints[jointRef].Confidence < 0.6)
{
status = InputStatus.CURSOR;
}
else
{ //both joints are well tracked, touch detection is executed
if (pos.Z > (posRef.Z - screenPlaneZoffset))
{//No Touch
status = InputStatus.CURSOR;
}
else
{//Touch
status = InputStatus.TOUCHED;
}
}
//convert kinectcoordinates to screencoordinates
pos.X = virtualScreenXStart + virtualScreenConvertFactorX * (pos.X - kinectXCrop);
pos.Y = virtualScreenYStart + virtualScreenConvertFactorY * (pos.Y - kinectYCrop);
HandContact contact = user.updateHand(pos, hand, status);
sendContact(contact);
}
开发者ID:cehberlin,项目名称:KinectProvider4MultitouchVista,代码行数:56,代码来源:KinectManager.cs
示例20: GetJoint
private void GetJoint(int user, SkeletonJoint joint)
{
SkeletonJointPosition pos = this.skeletonCapability.GetSkeletonJointPosition(user, joint);
if (pos.Position.Z == 0)
{
pos.Confidence = 0;
}
else
{
//pos.position = this.depthGenerator.ConvertRealWorldToProjective(pos.position);
}
lock (joints)
{
try
{
if (!this.joints.ContainsKey(user))
{
this.joints.Add(user, new Dictionary<SkeletonJoint, SkeletonJointPosition>());
}
else if (!this.joints[user].ContainsKey(joint))
{
this.joints[user].Add(joint, pos);
}
else
{
this.joints[user][joint] = pos;
}
}
catch (NullReferenceException)
{
//eat it
}
}
}
开发者ID:InfoStrat,项目名称:MotionFx,代码行数:34,代码来源:HandPointGenerator.cs
注:本文中的SkeletonJoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论