PointableList類(Leap:: PointableList)

PointableList類(Leap:: PointableList)

這個類代表了Pointable對象的列表。Pointable對象包括了可以指向的實體,比如手指和工具。通過調用Frame:: pointables()和Hand:: pointables()可以得到一個PointableList對象。
Leap::PointableList inFrame = frame.pointables();
Leap::PointableList onHand = hand.pointables();
PointableList & append(const PointableList & other): 表示把指定的一個PointableList的成員添加到這個PointableList對象中。參數other表示一個PointableList對象,其中包含Pointable對象,將要添加到這個PointableList對象末端。
PointableList & append(const FingerList & other): 表示把指定的一個FingerList的成員添加到這個PointableList對象中。參數other表示一個FingerList對象,其中包含Finger對象,將要添加到這個PointableList對象末端。
PointableList & append(const ToolList & other): 表示把指定的一個ToolList的成員添加到這個PointableList對象中。參數other表示一個ToolList對象,其中包含Tool對象,將要添加到這個PointableList對象末端。
const_iterator begin(): 表示C++的迭代器,設置在這個PointableList對象的開始。
用法:Leap::PointableList pointables = frame.pointables();
for (Leap::PointableList::const_iterator pl = pointables.begin(); pl != pointables.end(); pl++)
std::cout << *pl << std::endl;
int count(): 表示這個列表中有指向實體的數目。
用法:for (int p = 0; p < frame.pointables().count(); p++) {
std::cout << frame.pointables()[p] << std::endl;
}
const_iterator end(): 表示C++的迭代器,設置在這個PointableList對象的結束。
用法:Leap::PointableList pointables = frame.pointables();
for (Leap::PointableList::const_iterator pl = pointables.begin(); pl != pointables.end(); pl++)
std::cout << *pl << std::endl;
PointableList extended(): 表示一個新的列表,其中包含了當前列表中可以擴展的成員。這個包括所有的工具和isExtended()爲真的手指。
Pointable frontmost(): 表示在Leap Motion參照系下這個列表中最靠前的成員(也就是z值最小)。
用法:Leap::Pointable furthestFront=frame. pointables().frontmost();
bool isEmpty(): 判斷這個列表是否爲空。如果沒有成員,返回True。
Pointable leftmost(): 表示在Leap Motion參照系下這個列表中最靠左的成員(也就是x值最小)。
用法:Leap::Pointable leftmostInFrame=frame. pointables().leftmost();
Pointable operator[](int index): 表示對列表中一個成員位置的訪問。返回的是指定索引下的Pointable對象。
用法:Leap::PointableList pointablesOfHand = hand.pointables();
for (int index = 0; index < pointablesOfHand.count(); index++) {
std::cout << pointablesOfHand[index] << std::endl;
}
PointableList(): 表示構造一個沒有實體的空列表。
Pointable rightmost(): 表示在Leap Motion參照系下這個列表中最靠右的成員(也就是x值最大)。
用法:Leap::Pointable rightmostInFrame=frame. pointables().rightmost();

引自:https://developer.leapmotion.com/documentation/cpp/api/Leap.PointableList.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章