本文整理汇总了C++中Bone::center方法的典型用法代码示例。如果您正苦于以下问题:C++ Bone::center方法的具体用法?C++ Bone::center怎么用?C++ Bone::center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bone
的用法示例。
在下文中一共展示了Bone::center方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onFrame
void SampleListener::onFrame(const Controller& controller)
{
bool thand, index = false;
// Get the most recent frame and report some basic information
const Frame frame = controller.frame();
// Receive Hand List
HandList hands = frame.hands();
// For all hands
for (HandList::const_iterator hl = hands.begin(); hl != hands.end(); ++hl)
{
// Get the first hand
const Hand hand = *hl;
// Only for right hand
if( hand.isRight() )
{
// Get fingers
const FingerList fingers = hand.fingers();
// For all fingers in the list
for (FingerList::const_iterator fl = fingers.begin(); fl != fingers.end(); ++fl)
{
Bone bone;
const Finger finger = *fl;
// If thamb or Index finger
if( finger.type() == Finger::TYPE_THUMB )
{
// Receive nided bone
bone = finger.bone(Bone::TYPE_DISTAL);
m_vThand = bone.center();
thand = true;
}
else if( finger.type() == Finger::TYPE_INDEX )
{
// Receive nided bone
bone = finger.bone(Bone::TYPE_DISTAL);
m_vIndex = bone.center();
index = true;
}
}
}
}
bool newState;
if( !thand || !index )
{
newState = false;
}
else
{
float distance = m_vThand.distanceTo(m_vIndex);
qDebug () << "Distance: " << distance;
if( distance < 40 )
{
newState = true;
}
else
{
newState = false;
}
}
if( newState != m_bLastState )
{
Q_EMIT releySignal( newState );
m_bLastState = newState;
}
}