private void UseAll_Unchecked(object sender, RoutedEventArgs e) { foreach (CompositeElement joint in bvhTo.BVH.JointList) { JointFrame jf = bvhTo.BVH.FrameList[0].GetJointFrame(joint.Name); jf.SetValue("Xrotation", 0.0); } }
private static void ConvertJointFrame(JointFrame jfDest, string jointName, FrameElement srcFrame) { Matrix3D matrix; switch (jointName) { case "hip": matrix = jfDest.Matrix; JointFrame jfRoot = srcFrame.GetJointFrame("root"); Matrix3D rootMatrix = jfRoot.Matrix; rootMatrix.OffsetX *= 4; rootMatrix.OffsetY *= 4; rootMatrix.OffsetZ *= 4; rootMatrix.OffsetY += 12; matrix.Append(rootMatrix); jfDest.Matrix = matrix; break; case "abdomen": matrix = jfDest.Matrix; JointFrame jfLower = srcFrame.GetJointFrame("lower_body"); Matrix3D lowerMatrix = jfLower.Matrix; lowerMatrix.Invert(); matrix.Append(lowerMatrix); jfDest.Matrix = matrix; break; case "lShldr": matrix = jfDest.Matrix; matrix.RotatePrepend(new Quaternion(new Vector3D(0, 0, 1), -35)); jfDest.Matrix = matrix; break; case "lForeArm": case "lHand": matrix = jfDest.Matrix; matrix.RotatePrepend(new Quaternion(new Vector3D(0, 0, 1), -35)); matrix.Rotate(new Quaternion(new Vector3D(0, 0, 1), 35)); jfDest.Matrix = matrix; break; case "rShldr": // jfDest.AddValue("Zrotation", 35); matrix = jfDest.Matrix; matrix.RotatePrepend(new Quaternion(new Vector3D(0, 0, 1), 35)); jfDest.Matrix = matrix; break; case "rForeArm": case "rHand": matrix = jfDest.Matrix; matrix.RotatePrepend(new Quaternion(new Vector3D(0, 0, 1), 35)); matrix.Rotate(new Quaternion(new Vector3D(0, 0, 1), -35)); jfDest.Matrix = matrix; break; } }
public void Write(TextWriter writer) { foreach (CompositeElement joint in m_bvh.JointList) { JointFrame a = m_map[joint.Name]; foreach (string channel in joint.Channels.ChannelList) { writer.Write("{0} ", a.GetValue(channel)); } } writer.WriteLine(); }
public FrameElement(BVH bvh) { m_bvh = bvh; m_map = new Dictionary <string, JointFrame>(); foreach (CompositeElement joint in m_bvh.JointList) { JointFrame a = new JointFrame(); foreach (string channel in joint.Channels.ChannelList) { a.AddChannel(channel, 0); } m_map[joint.Name] = a; } }
private void UpdateFrame() { if (m_bvh == null) { return; } FrameElement frame = m_bvh.FrameList[(int)slider1.Value]; foreach (CompositeElement joint in m_bvh.JointList) { JointFrame jf = frame.GetJointFrame(joint.Name); Transform3DGroup tg = (Transform3DGroup)joint.Visual.Transform; MatrixTransform3D transform = (MatrixTransform3D)tg.Children[0]; transform.Matrix = jf.Matrix; } }
public FrameElement(BVH bvh, string[] args) : this(bvh) { Queue <string> queue = new Queue <string>(args); foreach (CompositeElement joint in m_bvh.JointList) { JointFrame a = m_map[joint.Name]; foreach (string channel in joint.Channels.ChannelList) { a.SetValue(channel, double.Parse(queue.Dequeue())); } } if (queue.Count != 0) { throw new InvalidDataException(); } }
private FrameElement ConvertFrame(BVH dest, FrameElement srcFrame) { FrameElement destFrame = new FrameElement(dest); foreach (CompositeElement joint in dest.JointList) { JointFrame jfDest = destFrame.GetJointFrame(joint.Name); JointFrame jfSrc = srcFrame.GetJointFrame(GetSrcJointName(joint.Name)); if (jfSrc == null) { continue; } foreach (string channel in new string[] { "Zrotation", "Xrotation", "Yrotation" }) { jfDest.SetValue(channel, jfSrc.GetValue(channel)); } ConvertJointFrame(jfDest, joint.Name, srcFrame); } return(destFrame); }