本文整理汇总了Java中com.leapmotion.leap.Gesture.State类的典型用法代码示例。如果您正苦于以下问题:Java State类的具体用法?Java State怎么用?Java State使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
State类属于com.leapmotion.leap.Gesture包,在下文中一共展示了State类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: printGestureDetails
import com.leapmotion.leap.Gesture.State; //导入依赖的package包/类
private void printGestureDetails(Gesture gesture, Controller controller) {
switch (gesture.type()) {
case TYPE_CIRCLE:
CircleGesture circle = new CircleGesture(gesture);
// Calculate clock direction using the angle between circle normal and pointable
String clockwise;
if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI / 4) {
// Clockwise if angle is less than 90 degrees
clockwise = "clockwise";
} else {
clockwise = "counterclockwise";
}
// Calculate angle swept since last frame
double sweptAngle = 0;
if (circle.state() != State.STATE_START) {
CircleGesture previousUpdate =
new CircleGesture(controller.frame(1).gesture(circle.id()));
sweptAngle = (circle.progress() - previousUpdate.progress()) * 2 * Math.PI;
}
logger.debug("Circle id: " + circle.id() + ", " + circle.state() + ", progress: "
+ circle.progress() + ", radius: " + circle.radius() + ", angle: "
+ Math.toDegrees(sweptAngle) + ", " + clockwise);
break;
case TYPE_SWIPE:
SwipeGesture swipe = new SwipeGesture(gesture);
logger.debug("Swipe id: " + swipe.id() + ", " + swipe.state() + ", position: "
+ swipe.position() + ", direction: " + swipe.direction() + ", speed: " + swipe.speed());
break;
case TYPE_SCREEN_TAP:
ScreenTapGesture screenTap = new ScreenTapGesture(gesture);
logger.debug("Screen Tap id: " + screenTap.id() + ", " + screenTap.state()
+ ", position: " + screenTap.position() + ", direction: " + screenTap.direction());
break;
case TYPE_KEY_TAP:
KeyTapGesture keyTap = new KeyTapGesture(gesture);
logger.debug("Key Tap id: " + keyTap.id() + ", " + keyTap.state() + ", position: "
+ keyTap.position() + ", direction: " + keyTap.direction());
break;
default:
logger.debug("Unknown gesture type.");
break;
}
}
开发者ID:openleap,项目名称:jitter,代码行数:47,代码来源:InternalLeapListener.java
注:本文中的com.leapmotion.leap.Gesture.State类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论