本文整理汇总了C++中Gesture::pointables方法的典型用法代码示例。如果您正苦于以下问题:C++ Gesture::pointables方法的具体用法?C++ Gesture::pointables怎么用?C++ Gesture::pointables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gesture
的用法示例。
在下文中一共展示了Gesture::pointables方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFrame
FREObject LNLeapDevice::getFrame() {
Frame frame = controller->frame();
// TODO: Only continue with valid Frame?
FREObject freCurrentFrame;
FRENewObject( (const uint8_t*) "com.leapmotion.leap.Frame", 0, NULL, &freCurrentFrame, NULL);
FREObject freFrameId;
FRENewObjectFromInt32((int32_t) frame.id(), &freFrameId);
FRESetObjectProperty(freCurrentFrame, (const uint8_t*) "id", freFrameId, NULL);
const Vector frameTranslation = frame.translation(lastFrame);
FRESetObjectProperty(freCurrentFrame, (const uint8_t*) "translationVector", createVector3(frameTranslation.x, frameTranslation.y, frameTranslation.z), NULL);
const Matrix frameRotation = frame.rotationMatrix(lastFrame);
FRESetObjectProperty(freCurrentFrame, (const uint8_t*) "rotation", createMatrix(
createVector3(frameRotation.xBasis[0], frameRotation.xBasis[1], frameRotation.xBasis[2]),
createVector3(frameRotation.yBasis[0], frameRotation.yBasis[1], frameRotation.yBasis[2]),
createVector3(frameRotation.zBasis[0], frameRotation.zBasis[1], frameRotation.zBasis[2]),
createVector3(frameRotation.origin[0], frameRotation.origin[1], frameRotation.origin[2])
), NULL);
FREObject freFrameScaleFactor;
FRENewObjectFromDouble(frame.scaleFactor(lastFrame), &freFrameScaleFactor);
FRESetObjectProperty(freCurrentFrame, (const uint8_t*) "scaleFactorNumber", freFrameScaleFactor, NULL);
FREObject freTimestamp;
FRENewObjectFromInt32((int32_t) frame.timestamp(), &freTimestamp);
FRESetObjectProperty(freCurrentFrame, (const uint8_t*) "timestamp", freTimestamp, NULL);
std::map<int, FREObject> freHandsMap;
if (!frame.hands().empty()) {
FREObject freHands;
FREGetObjectProperty(freCurrentFrame, (const uint8_t*) "hands", &freHands, NULL);
for(int i = 0; i < frame.hands().count(); i++) {
const Hand hand = frame.hands()[i];
FREObject freHand;
FRENewObject( (const uint8_t*) "com.leapmotion.leap.Hand", 0, NULL, &freHand, NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "frame", freCurrentFrame, NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "direction", createVector3(hand.direction()[0], hand.direction()[1], hand.direction()[2]), NULL);
FREObject freHandId;
FRENewObjectFromInt32(hand.id(), &freHandId);
FRESetObjectProperty(freHand, (const uint8_t*) "id", freHandId, NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "palmNormal", createVector3(hand.palmNormal()[0], hand.palmNormal()[1], hand.palmNormal()[2]), NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "palmPosition", createVector3(hand.palmPosition()[0], hand.palmPosition()[1], hand.palmPosition()[2]), NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "palmVelocity", createVector3(hand.palmVelocity()[0], hand.palmVelocity()[1], hand.palmVelocity()[2]), NULL);
const Matrix rotation = hand.rotationMatrix(lastFrame);
FRESetObjectProperty(freHand, (const uint8_t*) "rotation", createMatrix(
createVector3(rotation.xBasis[0], rotation.xBasis[1], rotation.xBasis[2]),
createVector3(rotation.yBasis[0], rotation.yBasis[1], rotation.yBasis[2]),
createVector3(rotation.zBasis[0], rotation.zBasis[1], rotation.zBasis[2]),
createVector3(rotation.origin[0], rotation.origin[1], rotation.origin[2])
), NULL);
FREObject freScaleFactor;
FRENewObjectFromDouble(hand.scaleFactor(lastFrame), &freScaleFactor);
FRESetObjectProperty(freHand, (const uint8_t*) "scaleFactorNumber", freScaleFactor, NULL);
FRESetObjectProperty(freHand, (const uint8_t*) "sphereCenter", createVector3(hand.sphereCenter()[0], hand.sphereCenter()[1], hand.sphereCenter()[2]), NULL);
FREObject freSphereRadius;
FRENewObjectFromDouble(hand.sphereRadius(), &freSphereRadius);
FRESetObjectProperty(freHand, (const uint8_t*) "sphereRadius", freSphereRadius, NULL);
const Vector translation = hand.translation(lastFrame);
FRESetObjectProperty(freHand, (const uint8_t*) "translationVector", createVector3(translation.x, translation.y, translation.z), NULL);
FRESetArrayElementAt(freHands, i, freHand);
freHandsMap[hand.id()] = freHand;
}
}
std::map<int, FREObject> frePointablesMap;
if(!frame.pointables().empty()) {
FREObject frePointables;
FREGetObjectProperty(freCurrentFrame, (const uint8_t*) "pointables", &frePointables, NULL);
for(int i = 0; i < frame.pointables().count(); i++) {
const Pointable pointable = frame.pointables()[i];
FREObject frePointable;
if(pointable.isTool()) {
FRENewObject( (const uint8_t*) "com.leapmotion.leap.Tool", 0, NULL, &frePointable, NULL);
} else {
FRENewObject( (const uint8_t*) "com.leapmotion.leap.Finger", 0, NULL, &frePointable, NULL);
}
FRESetObjectProperty(frePointable, (const uint8_t*) "frame", freCurrentFrame, NULL);
FREObject frePointableId;
FRENewObjectFromInt32(pointable.id(), &frePointableId);
//.........这里部分代码省略.........