您的位置:首页 > 编程语言 > C语言/C++

LeapMotion开发(五)-- Hand模块下的所有Methods用法和说明(下篇)(C++SDK)

2016-09-26 13:34 639 查看
官方C++ SDK介绍地址:

https://developer.leapmotion.com/documentation/cpp/api/Leap.Hand.html#cppclass_leap_1_1_hand_1aa2c9cca797fde17bf7371451a297e608

 

本文是就着英文版官方说明给出了翻译以及自己的理解,Hand模块总共分为了两块,这里为下篇。

 

目录概览:

 

·        pinchDistance()const
·        pinchStrength()const
·        pointable(int32_tid)
const
·        pointables()const
·        rotationAngle(constFrame
&sinceFrame) const
·        rotationAngle(constFrame
&sinceFrame, const Vector &axis) const
·        rotationAxis(constFrame
&sinceFrame) const
·        rotationMatrix(constFrame
&sinceFrame) const
·        rotationProbability(constFrame
&sinceFrame) const
·        scaleFactor(constFrame
&sinceFrame) const
·        scaleProbability(constFrame
&sinceFrame) const
·        sphereCenter()const
·        sphereRadius()const
·        stabilizedPalmPosition()const
·        timeVisible()const
·        toString()
const
·        translation(constFrame
&sinceFrame) const
·        translationProbability(constFrame
&sinceFrame) const
·        wristPosition()const
 

 

详细解释:

 

 

float pinchDistance() const
大拇指和食指的距离。单位:毫米。
Since
3.0
 
float pinchStrength() const
废弃!
用 pinchDistance() 替代
Since
2.0
 

Pointable pointable(int32_t id) const
返回Hand对应ID的Pointable对象
Leap::PointableknownPointable
= hand.pointable(pointableID);
Since
1.0
 

PointableList pointables() const
返回Potintable组成的一个列表(其实就是五根手指组成的).
// hand is a Leap::Hand object
Leap::PointableListpointables
= hand.pointables();// Both fingers and
tools
Leap::FingerListfingers
= hand.fingers();
Since
1.0
 

float rotationAngle(const Frame & sinceFrame) const
返回和startFrame那一帧相比,手的相对旋转
float rotationOfHand = hand.rotationAngle(startFrame);
 

 

float rotationAngle(const Frame & sinceFrame,const Vector & axis) const
返回和sinceFrame那一帧相比,绕axis的相对旋转的角度
float rotationAroundYAxis = hand.rotationAngle(startFrame,Leap::Vector::yAxis());
 

Vector rotationAxis(const Frame & sinceFrame) const
返回当前和sinceFrame那一帧相比,启发式(heuristically)确定的绕着旋转的轴的Vector
Leap::VectoraxisOfHandRotation
= hand.rotationAxis(startFrame);
 

Matrix rotationMatrix(const Frame & sinceFrame) const
返回和SinceFrame相比的变换矩阵,Matrix类型。
Leap::MatrixhandRotationTransform
= hand.rotationMatrix(startFrame);
 

 

float rotationProbability(const Frame & sinceFrame) const
与sinceFrame相比,当前帧为旋转移动成的可能性,返回一个0-1的float。
float rotationIntentFactor = hand.rotationProbability(startFrame);
 
 

 

float scaleFactor(const Frame & sinceFrame) const
返回当前和指定帧的缩放比例
float handScaleMotion = hand.scaleFactor(startFrame);
 

 

float scaleProbability(const Frame & sinceFrame) const
返回两帧之间是缩放运动的可能性,数值为0-1的float。
float scaleIntentFactor = hand.scaleProbability(startFrame);
 

Vector sphereCenter() const
返回手掌抓取球的模型中球的球心位置坐标。
Leap::VectorsphereCenter=
hand.sphereCenter();
Since
1.0
 

 

float sphereRadius() const
返回上述模型中的球的半径(就是假装握着球,这球有多大,233),单位为毫米
float sphereDiameter = 2 * hand.sphereRadius();
Since
1.0
 

 

Vector stabilizedPalmPosition() const
经过平滑处理以及一系列其他处理之后的手掌的位置坐标,返回值为Vector
//可靠性和手运动的速度有关,如果速度过快可能会有滞后感
Leap::VectorfilteredHandPosition
= hand.stabilizedPalmPosition();
Since
1.0
 

 

float timeVisible() const
返回这个hand被追踪的时间,单位是秒
float lifetimeOfThisHandObject = hand.timeVisible();
Since
1.0
 

 

std::string toString() const
把hand的信息转化为方便阅读与显示的string类型。
Since
1.0
 

Vector translation(const Frame & sinceFrame) const
返回前后两帧平移运动位置变化的Vector。
Leap::VectorlinearHandMovement
= hand.translation(startFrame);
 

float translationProbability(const Frame & sinceFrame) const
返回前后两帧为平移运动的可能性质,大小为0-1的float。
float translationIntentFactor = hand.translationProbability(startFrame);
 

 

Vector wristPosition() const
返回腕部以毫米为单位的坐标的Vector。
Since
2.0.3
 

 

补充两点:

 

Public Static Functions
const Hand & invalid()
返回invalid的Hand
if (hand !=Leap::Hand::invalid()){
    //Process handdata...
}
Since
1.0
Friends
friendstd::ostream & operator<<
输出方便阅读的Hand对象
std::cout << hand << std::endl;
Since
1.0
 

 

终于把Hand部分翻译完啦,还是有不少值得关注的方便的功能函数的

 



起飞~最后祝大家编程愉快: )
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  C++ Leapmotion Hand