Created
January 16, 2017 08:24
-
-
Save sakapon/97659608cd8e63f27277451fec2b3a8c to your computer and use it in GitHub Desktop.
LeapSample / HandRotationLeap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows.Media.Media3D; | |
namespace HandRotationLeap | |
{ | |
public static class Leap3DHelper | |
{ | |
public static Vector3D ToVector3D(this Leap.Vector v) => new Vector3D(v.x, v.y, v.z); | |
// Wrong values. | |
public static EulerAngles GetEulerAngles_org(this Leap.Hand h) => new EulerAngles | |
{ | |
Yaw = h.Direction.Yaw, | |
Pitch = h.Direction.Pitch, | |
Roll = h.PalmNormal.Roll, | |
}; | |
// Improved values. | |
public static EulerAngles GetEulerAngles(this Leap.Hand h) => | |
Rotation3DHelper.ToEulerAngles(-h.Direction.ToVector3D(), -h.PalmNormal.ToVector3D()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The whole source code is HandRotationLeap (GitHub).