コード例 #1
0
ファイル: NumericsTests.cs プロジェクト: psuong/math-utils
        public void DefaultRoundTest()
        {
            var third = 100f / 3f;
            var v     = new float3(third, third, third);

            var output = NumericsUtil.Normalize(v);

            Assert.AreEqual(output, new float3(33.33f, 33.33f, 33.33f), "Value mismatch!");
        }
コード例 #2
0
    public void CopyFrom(Skeleton skeleton, Transform kinect, uint timestamp)
    {
        const float mm2m = 0.001f; // When using 0.001, we get a dwarf. Do they mean cm?

        for (int i = 0; i < 32; i++)
        {
            var joint = skeleton.GetJoint(i);

            var bone = new BoneState();
            bone.position        = kinect.TransformPoint(NumericsUtil.Convert(joint.Position) * mm2m);
            bone.rotation        = kinect.rotation * NumericsUtil.Convert(joint.Quaternion);
            bone.confidenceLevel = joint.ConfidenceLevel;
            bones[i]             = bone;
        }

        this.timestamp = timestamp;
    }