本文整理汇总了Java中com.leapmotion.leap.GestureList.get方法的典型用法代码示例。如果您正苦于以下问题:Java GestureList.get方法的具体用法?Java GestureList.get怎么用?Java GestureList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.leapmotion.leap.GestureList
的用法示例。
在下文中一共展示了GestureList.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processGestures
import com.leapmotion.leap.GestureList; //导入方法依赖的package包/类
private void processGestures(Controller controller) {
GestureList list = controller.frame().gestures();
//TODO: Hmm, this if isn't actually needed, is it? list.count() == 0 will skip the loop anyway
if (!list.isEmpty()) {
for (int i = 0; i < list.count(); i++) {
Gesture gesture = list.get(i);
invokeCallback(gesture);
printGestureDetails(gesture, controller);
}
}
}
示例2: onFrame
import com.leapmotion.leap.GestureList; //导入方法依赖的package包/类
@Override
public void onFrame(Controller controller) {
Frame frame = controller.frame();
if (!frame.hands().isEmpty()) {
numHands.set(frame.hands().count());
Screen screen = controller.locatedScreens().get(0);
if (screen != null && screen.isValid()){
Hand hand;
if(numHands.get()>1){
hand=frame.hands().leftmost();
} else {
hand=frame.hands().get(0);
}
z1.set(hand.palmPosition().getZ());
pitchLeftAverage.add(new Double(hand.direction().pitch()));
rollLeftAverage.add(new Double(hand.palmNormal().roll()));
yawLeftAverage.add(new Double(hand.direction().yaw()));
pitchLeft.set(dAverage(pitchLeftAverage));
rollLeft.set(dAverage(rollLeftAverage));
yawLeft.set(dAverage(yawLeftAverage));
Vector intersect = screen.intersect(hand.palmPosition(),hand.direction(), true);
posLeftAverage.add(intersect);
Vector avIntersect=vAverage(posLeftAverage);
posHandLeft.setValue(new Point3D(screen.widthPixels()*Math.min(1d,Math.max(0d,avIntersect.getX())),
screen.heightPixels()*Math.min(1d,Math.max(0d,(1d-avIntersect.getY()))),
hand.palmPosition().getZ()));
}
}
GestureList gestures = frame.gestures();
for (int i = 0; i < gestures.count(); i++) {
Gesture gesture = gestures.get(i);
if(gesture.type()==Type.TYPE_CIRCLE){
CircleGesture cGesture = new CircleGesture(gesture);
if(numHands.get()>1){
for(Hand h:cGesture.hands()){
if(h.equals(frame.hands().rightmost())){
circle.set(cGesture);
break;
}
}
}
break;
}
}
}
示例3: onFrame
import com.leapmotion.leap.GestureList; //导入方法依赖的package包/类
public void onFrame(Controller controller) {
// Get the most recent frame and report some basic information
Frame frame = controller.frame();
/*System.out.println("Frame id: " + frame.id()
+ ", timestamp: " + frame.timestamp()
+ ", hands: " + frame.hands().count()
+ ", fingers: " + frame.fingers().count()
+ ", tools: " + frame.tools().count()
+ ", gestures " + frame.gestures().count());
//*/
if (frame.hands().count() == 1 && frame.fingers().count() == 0) {
// One hand, closed fist = set volume.
//System.out.println(frame.hands().get(0).palmPosition().getY());
this.pushVolumeSample(frame.hands().get(0).palmPosition().getY());
}
GestureList gestures = frame.gestures();
for (int i = 0; i < gestures.count(); i++) {
Gesture gesture = gestures.get(i);
switch (gesture.type()) {
case TYPE_SWIPE:
SwipeGesture swipe = new SwipeGesture(gesture);
//System.out.println("Swipe id: " + swipe.id()
// + ", " + swipe.state()
// + ", position: " + swipe.position()
// + ", direction: " + swipe.direction()
// + ", speed: " + swipe.speed());
if (swipe.state().toString().equals("STATE_STOP")) {
// Only listen to the end of the swipe, as a quick and dirty proxy for a swipe.
if (swipe.speed() > SWIPE_SPEED_MINIMUM) {
if (swipe.direction().getX() > SWIPE_DIRECTEDNESS_THRESHOLD) {
// Swipe to the right is to pause.
this.updateCommand(CMD_PAUSE, 0.0f);
}
else if (swipe.direction().getX() < -SWIPE_DIRECTEDNESS_THRESHOLD) {
// Swipe to the left is to play.
this.updateCommand(CMD_PLAY, 0.0f);
}
}
}
break;
default:
break;
}
}
}