KeyTapGesture类(Leap:: KeyTapGesture)

来源:互联网 发布:南昌哪里有mac魅可专柜 编辑:程序博客网 时间:2024/05/14 09:13

KeyTapGesture类(Leap:: KeyTapGesture)

这里写图片描述

这个类代表了手指或工具的一种点击手势。当手指的顶端向下转向手掌,然后回弹到原来的位置,如同点击一样,则被识别为按键点击手势。在开始点击之前,点击的手指一定要简短的暂停。注意,为了在应用程序中用这个手势,一定要打开使能“开关”,见Gesture类。
按键点击手势是离散的,描述点击的KeyTapGesture对象总是会有停止的状态:STATE_STOP。每个识别了的按键点击手势只创建一个KeyTapGesture对象。
可以用一个连接了的Controller对象的配置属性来设置把一个运动识别为按键点击所要求的手指移动和速率的最小值,还要调整检测窗口来估计运动。用以下keys来配置按键点击识别:

这里写图片描述

下面的例子说明了如何配置这些参数,在设置这些参数之前要把Controller对象和Leap Motion的服务/守护进程连接起来。
controller.config().setFloat(“Gesture. KeyTap.MinDownVelocity”, 40.0);
controller.config().setFloat(“Gesture. KeyTap.HistorySeconds”, .2);
controller.config().setFloat(“Gesture. KeyTap.MinDistance”, 8.0);
controller.config().save();
Vector direction(): 表示手指顶端的运动方向。
用法:Leap::Vector tapDirection=keytap.direction();
KeyTapGesture(): 表示构造一个新的KeyTapGesture对象。没有初始化的Gesture对象被认为是无效的。从Frame对象中得到KeyTapGesture类的有效的实例。
KeyTapGesture(const Gesture & rhs): 表示从一个Gesture对象的实例中构造出一个KeyTapGesture对象。参数rhs是需要特定化的Gesture实例,一定要是KeyTapGesture对象。
用法:if (gesture.type()==Leap:: KeyTapGesture:: classType())
KeyTapGesture =Leap:: KeyTapGesture(gesture);
Pointable pointable(): 表示实现这个按键点击手势的手指。
用法:Leap:: Pointable tappingPointable=keytap.pointable();
Vector position(): 表示记录按键点击的位置。
用法:Leap::Vector tapPosition=keytap.position();
float progress(): 对于按键点击手势,这个值始终为1.
Type classType(): 表示按键点击手势的类别。返回TYPE_KEY_TAP。

译自:https://developer.leapmotion.com/documentation/cpp/api/Leap.KeyTapGesture.html

0 0
原创粉丝点击