本文整理汇总了Java中com.leapmotion.leap.GestureList类的典型用法代码示例。如果您正苦于以下问题:Java GestureList类的具体用法?Java GestureList怎么用?Java GestureList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GestureList类属于com.leapmotion.leap包,在下文中一共展示了GestureList类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onFrame
import com.leapmotion.leap.GestureList; //导入依赖的package包/类
public void onFrame(Controller controller)
{
Frame frame = controller.frame();
GestureList gestures = frame.gestures();
for (Gesture gesture : gestures)
{
processGestureEvent(gesture);
}
if (frame.hands().isEmpty())
{
processNoDetectionEvent();
} else
{
Hand hand = frame.hands().get(0);
processDetectionEvent(hand);
}
}
开发者ID:theone1984,项目名称:parroteer,代码行数:21,代码来源:LeapMotionListener.java
示例2: GestureListObj
import com.leapmotion.leap.GestureList; //导入依赖的package包/类
public GestureListObj(GestureList list, FrameObj frame, ControllerObj controller) {
this.controller = controller;
gestures = new ArrayList<GestureObj>();
for (Gesture g : list) {
gestures.add(new GestureObj(g, frame, controller));
}
}
开发者ID:paluka,项目名称:Multi-Leap,代码行数:9,代码来源:GestureListObj.java
示例3: 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);
}
}
}
开发者ID:openleap,项目名称:jitter,代码行数:12,代码来源:InternalLeapListener.java
示例4: 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;
}
}
}
开发者ID:jperedadnr,项目名称:Leap3DFX,代码行数:48,代码来源:SimpleLeapListener.java
示例5: 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;
}
}
}
开发者ID:andrewgu,项目名称:leapmotion-spotify-controller,代码行数:50,代码来源:SwipeListener.java
注:本文中的com.leapmotion.leap.GestureList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论