Skip to content

Instantly share code, notes, and snippets.

@sakapon

sakapon/AppModel.cs

Created Jan 16, 2017
Embed
What would you like to do?
LeapSample / HandRotationLeap
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());
}
}
@sakapon

This comment has been minimized.

Copy link
Owner Author

@sakapon sakapon commented Jan 16, 2017

The whole source code is HandRotationLeap (GitHub).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment