当前位置: 首页>>代码示例>>Java>>正文


Java CircleGesture类代码示例

本文整理汇总了Java中com.leapmotion.leap.CircleGesture的典型用法代码示例。如果您正苦于以下问题:Java CircleGesture类的具体用法?Java CircleGesture怎么用?Java CircleGesture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CircleGesture类属于com.leapmotion.leap包,在下文中一共展示了CircleGesture类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: circleGestureListener

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
@Override
public void circleGestureListener(CircleGesture circle) {
    if(mouseOn){
        String clockwiseness;
        if (circle.state() == Gesture.State.STATE_STOP && circle.radius() < 10){
            if (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI/4) {
                // Clockwise if angle is less than 90 degrees
                clockwiseness = "clockwise";
                robot.mousePress(InputEvent.BUTTON1_MASK);
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
                robot.mousePress(InputEvent.BUTTON1_MASK);
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
                Debug.getInstance().mouse("raduis:" + circle.radius());
            } else {
                clockwiseness = "counterclockwise";
                robot.mousePress(InputEvent.BUTTON3_MASK);
                robot.mouseRelease(InputEvent.BUTTON3_MASK);
            }
            Debug.getInstance().mouse("end of swipe "+ clockwiseness);
        }
    }
}
 
开发者ID:francoiscabrol,项目名称:LoCALISM,代码行数:23,代码来源:MouseReplacement.java

示例2: circleGestureRecognized

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
@Override
public void circleGestureRecognized(CircleGesture detectedGesture) {
    if (detectedGesture.state() == Gesture.State.STATE_STOP) {
        //This may have been already consumed, we are not sure.
        if (!consumedCircleGestureBuffer.contains(detectedGesture.id()))
            circleGestureBuffer.put(detectedGesture.id(), detectedGesture);

        logger.debug("//////////////////////////////////////");
        logger.debug("Gesture type: " + detectedGesture.type().toString());
        logger.debug("ID: " + detectedGesture.id());
        logger.debug("Radius: " + detectedGesture.radius());
        logger.debug("Normal: " + detectedGesture.normal());
        logger.debug("Clockwise: " + JitterSystem.isClockwise(detectedGesture));
        logger.debug("Turns: " + detectedGesture.progress());
        logger.debug("Center: " + detectedGesture.center());
        logger.debug("Duration: " + detectedGesture.durationSeconds() + "s");
        logger.debug("//////////////////////////////////////");
    } else if (detectedGesture.state() == Gesture.State.STATE_START) {
        circleGestureBuffer.put(detectedGesture.id(), detectedGesture);
    } else if (detectedGesture.state() == Gesture.State.STATE_UPDATE) {
        if (!consumedCircleGestureBuffer.contains(detectedGesture.id()))
            circleGestureBuffer.put(detectedGesture.id(), detectedGesture);
    }
}
 
开发者ID:openleap,项目名称:jitter,代码行数:25,代码来源:BufferedJitterSystem.java

示例3: nextCircleBatch

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
/**
 * Returns the next CircleGesture in buffer, if any.
 * Note that consuming buffered gestures does not respect different ways to use the gesture.
 * If it is returned for use just once it is considered spent and will not be returned again.
 * @return a CircleGesture or null if none are available
 */
public Set<CircleGesture> nextCircleBatch() {
    Set<CircleGesture> circleBatch = new HashSet<CircleGesture>();

    for (CircleGesture circleGesture : circleGestureBuffer.values()) {

        // Automatically add every circle to the return batch since we have no constraints to test here
        circleBatch.add(circleGesture);

        // Consume (if that's enabled)
        consumeCircle(circleGesture);

        // Remove stopped circles from the buffer as they won't be seen again.
        removeStoppedCircles(circleGesture);
    }

    return circleBatch;
}
 
开发者ID:openleap,项目名称:jitter,代码行数:24,代码来源:BufferedJitterSystem.java

示例4: circleGesture

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
private boolean circleGesture(CircleGesture circle) {
	boolean clockwise;  //  Calculate clock direction using the angle between circle normal and pointable
	
	// Clockwise if angle is less than 90 degrees
	if (clockwise = (circle.pointable().direction().angleTo(circle.normal()) <= Math.PI / 4))
		callObservers(Gestures.RIGHT_CIRCLE);
	else
		callObservers(Gestures.LEFT_CIRCLE);
		
	System.out.println(LeapMotionListenerC.onCircle + " id: " + circle.id() + ", "
			+ circle.state() + ", progress: " + circle.progress()
			+ ", clockwise: " + clockwise);
	
	return true;
}
 
开发者ID:valenbg1,项目名称:protoboard,代码行数:16,代码来源:LeapMotionListener.java

示例5: consumeCircle

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
private void consumeCircle(CircleGesture circleGesture) {
    // If gestures of this type are considered consumed when returned for processing then flag & remove
    if (consumptionEnabled) {
        logger.debug("Consuming circle gesture with id: " + circleGesture.id());
        consumedCircleGestureBuffer.add(circleGesture.id());    // Mark circle as consumed so it won't get re-added
        circleGestureBuffer.remove(circleGesture.id());  // Remove it from the buffer so it won't be tested again
    }
}
 
开发者ID:openleap,项目名称:jitter,代码行数:9,代码来源:BufferedJitterSystem.java

示例6: removeStoppedCircles

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
private void removeStoppedCircles(CircleGesture circleGesture) {
    if (circleGesture.state() == Gesture.State.STATE_STOP) {
        circleGestureBuffer.remove(circleGesture.id());
        if (consumptionEnabled) {
            consumedCircleGestureBuffer.remove(circleGesture.id());
            logger.debug("Just removed gesture with id " + circleGesture.id() + " from the 'consumed' list");
        }
    }
}
 
开发者ID:openleap,项目名称:jitter,代码行数:10,代码来源:BufferedJitterSystem.java

示例7: onFrame

import com.leapmotion.leap.CircleGesture; //导入依赖的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

示例8: printGestureDetails

import com.leapmotion.leap.CircleGesture; //导入依赖的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

示例9: circleGestureRecognized

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
/**
 * Called when the Leap Listener detects a circle gesture.
 * @param gesture the CircleGesture detected
 */
void circleGestureRecognized(CircleGesture gesture);
 
开发者ID:openleap,项目名称:jitter,代码行数:6,代码来源:JitterListener.java

示例10: circleProperty

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
public ObservableValue<CircleGesture> circleProperty(){ return circle; } 
开发者ID:jperedadnr,项目名称:Leap3DFX,代码行数:2,代码来源:SimpleLeapListener.java

示例11: circleGestureListener

import com.leapmotion.leap.CircleGesture; //导入依赖的package包/类
public void circleGestureListener(CircleGesture circle); 
开发者ID:francoiscabrol,项目名称:LoCALISM,代码行数:2,代码来源:LeapListener.java


注:本文中的com.leapmotion.leap.CircleGesture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。